~x2go/x2go/x2goclient_master

« back to all changes in this revision

Viewing changes to onmainwindow.h

  • Committer: Reinhard Tartler
  • Author(s): Oleksander Schneyder
  • Date: 2011-01-27 20:43:11 UTC
  • Revision ID: git-v1:af42fa37d555c1031810a868db687f39c2f9e574
Imported x2goclient_3.01-16.tar.gz

Summary: Imported x2goclient_3.01-16.tar.gz
Keywords:

Imported x2goclient_3.01-16.tar.gz
into Git repository

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
#include <QPixmap>
41
41
#include <QProcess>
42
42
#include "LDAPSession.h"
43
 
#include "embedwidget.h"
44
43
#include <QToolBar>
45
44
 
46
45
 
50
49
/**
51
50
@author Oleksandr Shneyder
52
51
*/
 
52
 
 
53
#if defined(CFGPLUGIN) && defined(Q_OS_LINUX)
 
54
class QX11EmbedContainer;
 
55
#endif
53
56
class QLineEdit;
54
57
class QFrame;
55
58
class QVBoxLayout;
74
77
class HttpBrokerClient;
75
78
struct user
76
79
{
77
 
        int uin;
78
 
        QString uid;
79
 
        QString name;
80
 
        QPixmap foto;
81
 
        static bool lessThen ( user u1,user u2 )
82
 
        {
83
 
                return u1.uid < u2.uid;
84
 
        }
 
80
    int uin;
 
81
    QString uid;
 
82
    QString name;
 
83
    QPixmap foto;
 
84
    static bool lessThen ( user u1,user u2 )
 
85
    {
 
86
        return u1.uid < u2.uid;
 
87
    }
85
88
};
86
89
 
87
90
struct directory
88
91
{
89
 
        QString key;
90
 
        QString dstKey;
91
 
        QString dirList;
92
 
        bool isRemovable;
93
 
        SshProcess* proc;
 
92
    QString key;
 
93
    QString dstKey;
 
94
    QString dirList;
 
95
    bool isRemovable;
 
96
    SshProcess* proc;
94
97
};
95
98
 
96
99
struct serv
97
100
{
98
 
        QString name;
99
 
        float factor;
100
 
        float sess;
101
 
        bool connOk;
102
 
        bool operator < ( const struct serv it )
103
 
        {
104
 
                return ( it.sess < sess );
105
 
        }
106
 
        static bool lt ( const struct serv it, const struct serv it1 )
107
 
        {
108
 
                return it.sess<it1.sess;
109
 
        }
 
101
    QString name;
 
102
    float factor;
 
103
    float sess;
 
104
    bool connOk;
 
105
    bool operator < ( const struct serv it )
 
106
    {
 
107
        return ( it.sess < sess );
 
108
    }
 
109
    static bool lt ( const struct serv it, const struct serv it1 )
 
110
    {
 
111
        return it.sess<it1.sess;
 
112
    }
110
113
};
111
114
 
112
115
struct x2goSession
113
116
{
114
 
        QString agentPid;
115
 
        QString sessionId;
116
 
        QString display;
117
 
        QString server;
118
 
        QString status;
119
 
        QString crTime;
120
 
        QString cookie;
121
 
        QString clientIp;
122
 
        QString grPort;
123
 
        QString sndPort;
124
 
        QString fsPort;
125
 
        int colorDepth;
126
 
        enum{DESKTOP,ROOTLESS,SHADOW} sessionType;
127
 
        QString command;
128
 
        void operator = ( const x2goSession& s );
 
117
    QString agentPid;
 
118
    QString sessionId;
 
119
    QString display;
 
120
    QString server;
 
121
    QString status;
 
122
    QString crTime;
 
123
    QString cookie;
 
124
    QString clientIp;
 
125
    QString grPort;
 
126
    QString sndPort;
 
127
    QString fsPort;
 
128
    int colorDepth;
 
129
    enum {DESKTOP,ROOTLESS,SHADOW} sessionType;
 
130
    QString command;
 
131
    void operator = ( const x2goSession& s );
129
132
};
130
133
 
131
134
struct ConfigFile
132
135
{
133
 
        QString session;
134
 
        QString user;
135
 
        QString server;
136
 
        QString sshport;
137
 
        QString proxy;
138
 
        QString proxyport;
139
 
        QString command;
140
 
        bool rootless;
141
 
        QString cookie;
142
 
        QString connectionts;
143
 
        QString brokerurl;
144
 
        QString sessiondata;
145
 
        bool checkexitstatus;
146
 
        bool showtermbutton;
147
 
        bool showexpbutton;
148
 
        bool showextconfig;
149
 
        bool showconfig;
150
 
        bool showstatusbar;
151
 
        bool showtoolbar;
 
136
    QString session;
 
137
    QString user;
 
138
    QString server;
 
139
    QString sshport;
 
140
    QString proxy;
 
141
    QString proxyport;
 
142
    QString command;
 
143
    QString key;
 
144
    bool rootless;
 
145
    QString cookie;
 
146
    QString connectionts;
 
147
    QString brokerurl;
 
148
    QString sessiondata;
 
149
    bool checkexitstatus;
 
150
    bool showtermbutton;
 
151
    bool showexpbutton;
 
152
    bool showextconfig;
 
153
    bool showconfig;
 
154
    bool showstatusbar;
 
155
    bool showtoolbar;
152
156
 
153
 
        //if true - use cfg values, else default or client settings
154
 
        bool confSnd;
155
 
        bool confFS;
156
 
        bool confConSpd;
157
 
        bool confCompMet;
158
 
        bool confImageQ;
159
 
        bool confDPI;
160
 
        bool confKbd;
161
 
        //
162
 
        bool useSnd;
163
 
        bool useFs;
164
 
        int conSpeed;
165
 
        QString compMet;
166
 
        int imageQ;
167
 
        int dpi;
168
 
        QString kbdLay;
169
 
        QString kbdType;
170
 
        //
 
157
    //if true - use cfg values, else default or client settings
 
158
    bool confSnd;
 
159
    bool confFS;
 
160
    bool confConSpd;
 
161
    bool confCompMet;
 
162
    bool confImageQ;
 
163
    bool confDPI;
 
164
    bool confKbd;
 
165
    //
 
166
    bool useSnd;
 
167
    bool useFs;
 
168
    int conSpeed;
 
169
    QString compMet;
 
170
    int imageQ;
 
171
    int dpi;
 
172
    QString kbdLay;
 
173
    QString kbdType;
 
174
    //
171
175
};
172
176
 
173
177
struct SshProxy
174
178
{
175
 
        bool use;
176
 
        QString host;
177
 
        QString port;
178
 
        QString bin;
 
179
    bool use;
 
180
    QString host;
 
181
    QString port;
 
182
    QString bin;
179
183
};
180
184
//wrapper to send mouse events under windows in embedded mode
181
185
#ifdef Q_OS_WIN
182
186
class WWrapper : public QPushButton
183
187
{
184
 
                friend class ONMainWindow;
 
188
    friend class ONMainWindow;
185
189
};
186
190
#include <QThread>
187
191
#include <QMutex>
188
192
class ONMainWindow;
189
193
class WinServerStarter: public QThread
190
194
{
191
 
        public:
192
 
                enum daemon{X,SSH,PULSE};
193
 
                WinServerStarter ( daemon server, ONMainWindow * par );
194
 
                void run();
195
 
        private:
196
 
                daemon mode;
197
 
                ONMainWindow* parent;
 
195
public:
 
196
    enum daemon {X,SSH,PULSE};
 
197
    WinServerStarter ( daemon server, ONMainWindow * par );
 
198
    void run();
 
199
private:
 
200
    daemon mode;
 
201
    ONMainWindow* parent;
198
202
};
199
203
#endif
200
204
class ClickLineEdit;
201
 
#ifndef Q_OS_DARWIN
202
 
class ONMainWindow : public QMainWindow, public EmbedWidget
203
 
#else
204
205
class ONMainWindow : public QMainWindow
205
 
#endif
206
206
#ifdef CFGPLUGIN
207
 
                        , public QtNPBindable
 
207
            , public QtNPBindable
208
208
 
209
209
#ifdef QAXSERVER
210
 
                        , public QAxBindable
 
210
            , public QAxBindable
211
211
#endif
212
212
#endif
213
213
{
214
 
                friend class HttpBrokerClient;
215
 
#ifdef CFGPLUGIN
216
 
                Q_PROPERTY ( QString x2goconfig READ x2goconfig WRITE setX2goconfig )
217
 
                Q_CLASSINFO ( "ClassID", "{5a20006d-118f-4185-9653-9f98958a0008}" )
218
 
                Q_CLASSINFO ( "InterfaceID", "{2df000ba-da4f-4fb7-8f35-b8dfbf80009a}" )
219
 
                Q_CLASSINFO ( "EventsID", "{44900013-f8bd-4d2e-a2cf-eab407c03005}" )
220
 
                Q_CLASSINFO ( "MIME",
221
 
                              "application/x2go:x2go:Configuration File "
222
 
                              "for X2Go Session" )
223
 
                Q_CLASSINFO ( "ToSuperClass", "ONMainWindow" )
224
 
                Q_CLASSINFO ( "DefaultProperty","x2goconfig" )
225
 
#endif
226
 
                Q_OBJECT
227
 
        public:
228
 
                enum
229
 
                {
230
 
                        S_DISPLAY,
231
 
                        S_STATUS,
232
 
                        S_COMMAND,
233
 
                        S_TYPE,
234
 
                        S_SERVER,
235
 
                        S_CRTIME,
236
 
                        S_IP,
237
 
                        S_ID
238
 
                };
239
 
                enum
240
 
                {
241
 
                        MODEM,
242
 
                        ISDN,
243
 
                        ADSL,
244
 
                        WAN,
245
 
                        LAN
246
 
                };
247
 
                enum
248
 
                {
249
 
                        D_USER,
250
 
                        D_DISPLAY
251
 
                };
252
 
                enum
253
 
                {
254
 
                        SHADOW_VIEWONLY,
255
 
                        SHADOW_FULL
256
 
                };
257
 
                enum
258
 
                {
259
 
                        PULSE,
260
 
                        ARTS,
261
 
                        ESD
262
 
                };
263
 
                static bool portable;
264
 
                ONMainWindow ( QWidget *parent = 0 );
265
 
                ~ONMainWindow();
266
 
                QString iconsPath ( QString fname );
267
 
                const QList<SessionButton*> * getSessionsList()
268
 
                {
269
 
                        return &sessions;
270
 
                }
271
 
                void startNewSession();
272
 
                void suspendSession (QString sessId );
273
 
                bool termSession ( QString sessId,
274
 
                                   bool warn=true );
275
 
                void setStatStatus ( QString status=QString::null );
276
 
                x2goSession getNewSessionFromString ( const QString& string );
277
 
                void runCommand();
278
 
                bool retUseLdap() {return useLdap;}
279
 
                bool retMiniMode() {return miniMode;}
280
 
                QString retLdapServer() {return ldapServer;}
281
 
                int retLdapPort() {return ldapPort;}
282
 
                QString retLdapDn() {return ldapDn;}
283
 
                QString retLdapServer1() {return ldapServer1;}
284
 
                int retLdapPort1() {return ldapPort1;}
285
 
                QString retLdapServer2() {return ldapServer2;}
286
 
                int retLdapPort2() {return ldapPort2;}
287
 
                QHBoxLayout* mainLayout() {return mainL;}
288
 
                QWidget* mainWidget() {return ( QWidget* ) fr;}
289
 
#ifdef CFGPLUGIN
290
 
                QString x2goconfig() const
291
 
                {
292
 
                        return m_x2goconfig;
293
 
                }
294
 
#endif
295
 
 
296
 
                static bool getPortable()
297
 
                {
298
 
                        return portable;
299
 
                }
300
 
                static QString getHomeDirectory()
301
 
                {
302
 
                        return homeDir;
303
 
                }
304
 
                bool getShowAdvOption()
305
 
                {
306
 
                        return config.showextconfig;
307
 
                }
308
 
                QString getDefaultCmd()
309
 
                {
310
 
                        return defaultCmd;
311
 
                }
312
 
                QString getDefaultSshPort()
313
 
                {
314
 
                        return defaultSshPort;
315
 
                }
316
 
                QString getDefaultKbdType()
317
 
                {
318
 
                        return defaultKbdType;
319
 
                }
320
 
                QString getDefaultLayout()
321
 
                {
322
 
                        return defaultLayout;
323
 
                }
324
 
                QString getDefaultPack()
325
 
                {
326
 
                        return defaultPack;
327
 
                }
328
 
                int getDefaultQuality()
329
 
                {
330
 
                        return defaultQuality;
331
 
                }
332
 
 
333
 
                uint getDefaultDPI()
334
 
                {
335
 
                        return defaultDPI;
336
 
                }
337
 
 
338
 
                bool getDefaultSetDPI()
339
 
                {
340
 
                        return defaultSetDPI;
341
 
                }
342
 
 
343
 
                bool getEmbedMode()
344
 
                {
345
 
                        return embedMode;
346
 
                }
347
 
 
348
 
                int getDefaultLink()
349
 
                {
350
 
                        return defaultLink;
351
 
                }
352
 
                int getDefaultWidth()
353
 
                {
354
 
                        return defaultWidth;
355
 
                }
356
 
                int getDefaultHeight()
357
 
                {
358
 
                        return defaultHeight;
359
 
                }
360
 
                bool getDefaultSetKbd()
361
 
                {
362
 
                        return defaultSetKbd;
363
 
                }
364
 
                bool getDefaultUseSound()
365
 
                {
366
 
                        return defaultUseSound;
367
 
                }
368
 
                bool getDefaultFullscreen()
369
 
                {
370
 
                        return defaultFullscreen;
371
 
                }
372
 
 
373
 
                void showHelp();
374
 
                void showHelpPack();
375
 
                void exportDirs ( QString exports,bool removable=false );
376
 
                void reloadUsers();
377
 
                void setWidgetStyle ( QWidget* widget );
378
 
                QStringList internApplicationsNames()
379
 
                {
380
 
                        return _internApplicationsNames;
381
 
                }
382
 
                QStringList transApplicationsNames()
383
 
                {
384
 
                        return _transApplicationsNames;
385
 
                }
386
 
                QString transAppName ( const QString& internAppName,
387
 
                                       bool* found=0l );
388
 
                QString internAppName ( const QString& transAppName,
389
 
                                        bool* found=0l );
390
 
                void setEmbedSessionActionsEnabled ( bool enable );
391
 
                void startSshd();
392
 
                QSize getEmbedAreaSize();
393
 
#ifdef Q_OS_WIN
394
 
                static QString cygwinPath ( const QString& winPath );
395
 
                void startXOrg();
396
 
                void startPulsed();
397
 
                static bool haveCySolEntry();
398
 
                static bool haveCygwinEntry();
399
 
                static void removeCySolEntry();
400
 
                static void removeCygwinEntry();
401
 
                static QString U3DevicePath()
402
 
                {
403
 
                        return u3Device;
404
 
                }
405
 
#endif
406
 
 
407
 
        private:
408
 
                QString m_x2goconfig;
409
 
                QStringList _internApplicationsNames;
410
 
                QStringList _transApplicationsNames;
411
 
                QString portableDataPath;
412
 
                bool drawMenu;
413
 
                bool extStarted;
414
 
                bool startMaximized;
415
 
                bool startHidden;
416
 
                bool defaultUseSound;
417
 
                bool cardStarted;
418
 
                bool defaultSetKbd;
419
 
                bool showExport;
420
 
                bool usePGPCard;
421
 
                bool miniMode;
422
 
                bool managedMode;
423
 
                bool embedMode;
424
 
                QString statusString;
425
 
                int defaultLink;
426
 
                int defaultQuality;
427
 
                int defaultWidth;
428
 
                int defaultHeight;
429
 
                bool defaultFullscreen;
430
 
                bool acceptRsa;
431
 
                bool startEmbedded;
432
 
                bool extLogin;
433
 
                bool printSupport;
434
 
                bool showTbTooltip;
435
 
                struct SshProxy sshProxy;
436
 
                QString sshPort;
437
 
                QString clientSshPort;
438
 
                QString defaultSshPort;
439
 
                QVBoxLayout* selectSesDlgLayout;
440
 
                SshMasterConnection* sshConnection;
441
 
                bool closeEventSent;
442
 
                int shadowMode;
443
 
                QString shadowUser;
444
 
                QString shadowDisplay;
445
 
                QString defaultPack;
446
 
                QString defaultLayout;
447
 
                QString defaultKbdType;
448
 
                QString defaultCmd;
449
 
                bool defaultSetDPI;
450
 
                uint defaultDPI;
451
 
                QStringList listedSessions;
452
 
                QString appDir;
453
 
                QString localGraphicPort;
454
 
                static QString homeDir;
455
 
                int retSessions;
456
 
                QList<serv> x2goServers;
457
 
 
458
 
                QPushButton* bSusp;
459
 
                QPushButton* sbExp;
460
 
                QPushButton* bTerm;
461
 
                QPushButton* bNew;
462
 
                QPushButton* bShadow;
463
 
                QPushButton* bShadowView;
464
 
                QPushButton* bCancel;
465
 
 
466
 
 
467
 
                QLabel* selectSessionLabel;
468
 
                QTreeView* sessTv;
469
 
 
470
 
                QLineEdit* desktopFilter;
471
 
                QCheckBox* desktopFilterCb;
472
 
 
473
 
                IMGFrame* fr;
474
 
                SVGFrame *bgFrame;
475
 
                QLineEdit* uname;
476
 
                ClickLineEdit* pass;
477
 
                ClickLineEdit* login;
478
 
                QFrame* uframe;
479
 
                SVGFrame *passForm;
480
 
                QSize mwSize;
481
 
                bool mwMax;
482
 
                QPoint mwPos;
483
 
                SVGFrame *selectSessionDlg;
484
 
                SVGFrame *sessionStatusDlg;
485
 
                QLabel* u;
486
 
                QLabel* fotoLabel;
487
 
                QLabel* nameLabel;
488
 
                QLabel* passPrompt;
489
 
                QLabel* loginPrompt;
490
 
                QLabel* slName;
491
 
                QLabel* slVal;
492
 
                QPushButton* ok;
493
 
                QPushButton* cancel;
494
 
                QString readExportsFrom;
495
 
                QString readLoginsFrom;
496
 
                QPushButton* sOk;
497
 
                QPushButton* sbSusp;
498
 
                QPushButton* sbTerm;
499
 
                QCheckBox* sbAdv;
500
 
                QPushButton* sCancel;
501
 
                QString resolution;
502
 
                QString kdeIconsPath;
503
 
                QScrollArea* users;
504
 
                QVBoxLayout* userl;
505
 
                QHBoxLayout* mainL;
506
 
                QList<UserButton*> names;
507
 
                QList<SessionButton*> sessions;
508
 
                UserButton* lastUser;
509
 
                SessionButton* lastSession;
510
 
                QString prevText;
511
 
                QString onserver;
512
 
                QString id;
513
 
                QString selectedCommand;
514
 
                QString currentKey;
515
 
                QTimer *exportTimer;
516
 
                QTimer *extTimer;
517
 
                QTimer *agentCheckTimer;
518
 
                QTimer *spoolTimer;
519
 
                QTimer *proxyWinTimer;
520
 
                QStyle* widgetExtraStyle;
521
 
                bool isPassShown;
522
 
                bool xmodExecuted;
523
 
                long proxyWinId;
524
 
                bool embedControlChanged;
525
 
                bool embedTbVisible;
526
 
                QLabel* statusLabel;
527
 
                ConfigFile config;
528
 
                QStandardItemModel* model;
529
 
                QStandardItemModel* modelDesktop;
530
 
 
531
 
                QAction *act_set;
532
 
                QAction *act_abclient;
533
 
                QAction *act_shareFolder;
534
 
                QAction *act_suspend;
535
 
                QAction *act_terminate;
536
 
                QAction *act_reconnect;
537
 
                QAction *act_embedContol;
538
 
                QAction *act_embedToolBar;
539
 
 
540
 
                QToolBar *stb;
541
 
 
542
 
                QString sessionStatus;
543
 
                QString spoolDir;
544
 
                QString sessionRes;
545
 
                QHBoxLayout* username;
546
 
                QList <user> userList;
547
 
                QList <directory> exportDir;
548
 
                QString nick;
549
 
                QString nfsPort;
550
 
                QString mntPort;
551
 
                QProcess* ssh;
552
 
                QProcess* soundServer;
553
 
                QProcess* scDaemon;
554
 
                QProcess* gpgAgent;
555
 
                QString sshAgentPid;
556
 
                QProcess* gpg;
557
 
                LDAPSession* ld;
558
 
                long embedParent;
559
 
                long embedChild;
560
 
                bool proxyWinEmbedded;
561
 
                bool useLdap;
562
 
                bool showToolBar;
563
 
                bool newSession;
564
 
                bool ldapOnly;
565
 
                bool isScDaemonOk;
566
 
                bool parecTunnelOk;
567
 
 
568
 
                bool startSessSound;
569
 
                int startSessSndSystem;
570
 
 
571
 
                bool fsInTun;
572
 
                bool fsTunReady;
573
 
 
574
 
                QString fsExportKey;
575
 
                bool fsExportKeyReady;
576
 
 
577
 
                QString ldapServer;
578
 
                int ldapPort;
579
 
                QString ldapServer1;
580
 
                int ldapPort1;
581
 
                QString ldapServer2;
582
 
                int ldapPort2;
583
 
                QString ldapDn;
584
 
                QString sessionCmd;
585
 
 
586
 
                QString LDAPSndSys;
587
 
                QString LDAPSndPort;
588
 
                bool LDAPSndStartServer;
589
 
 
590
 
                bool  LDAPPrintSupport;         
591
 
 
592
 
                QAction *act_edit;
593
 
                QAction *act_new;
594
 
                QAction *act_sessicon;
595
 
                QProcess *nxproxy;
596
 
#ifndef Q_OS_WIN
597
 
                QProcess *sshd;
598
 
                bool userSshd;
599
 
#else
600
 
                QProcess *xorg;
601
 
                PROCESS_INFORMATION sshd;
602
 
                bool winSshdStarted;
603
 
                static QString u3Device;
604
 
 
605
 
                QProcess* pulseServer;
606
 
                int xDisplay;
607
 
                int sshdPort;
608
 
                bool winServersReady;
609
 
                QString oldEtcDir;
610
 
                QString oldBinDir;
611
 
                QString oldTmpDir;
612
 
 
613
 
                bool cySolEntry;
614
 
                bool cyEntry;
615
 
 
616
 
                QString pulseDir;
617
 
                int pulsePort;
618
 
                int esdPort;
619
 
                bool maximizeProxyWin;
620
 
                int proxyWinWidth;
621
 
                int proxyWinHeight;
622
 
                QTimer* xorgLogTimer;
623
 
                QString xorgLogFile;
624
 
                QMutex xorgLogMutex;
625
 
#endif
626
 
                QString lastFreeServer;
627
 
                QString cardLogin;
628
 
                QTextEdit* stInfo;
629
 
 
630
 
                SVGFrame* ln;
631
 
                SshProcess* tunnel;
632
 
                SshProcess* sndTunnel;
633
 
                SshProcess* fsTunnel;
634
 
                QList<x2goSession> selectedSessions;
635
 
                QStringList selectedDesktops;
636
 
                x2goSession resumingSession;
637
 
                bool startSound;
638
 
                bool restartResume;
639
 
                bool runRemoteCommand;
640
 
                bool shadowSession;
641
 
                int firstUid;
642
 
                int lastUid;
643
 
                QStringList sshEnv;
644
 
                QString agentPid;
645
 
                bool cardReady;
646
 
                bool useSshAgent;
647
 
                HttpBrokerClient* broker;
648
 
 
649
 
#ifdef  CFGPLUGIN
650
 
                void doPluginInit();
651
 
#endif
652
 
                void installTranslator();
653
 
                void loadSettings();
654
 
                void showPass ( UserButton* user );
655
 
                void clean();
656
 
                bool defaultSession;
657
 
                QString defaultSessionName;
658
 
                QString defaultSessionId;
659
 
                QString defaultUserName;
660
 
                bool defaultUser;
661
 
                SessionButton* createBut ( const QString& id );
662
 
                void placeButtons();
663
 
                QString getKdeIconsPath();
664
 
                QString findTheme ( QString theme );
665
 
                bool initLdapSession ( bool showBox=true );
666
 
                bool startSession ( const QString& id );
667
 
                x2goSession getSessionFromString ( const QString& string );
668
 
                void resumeSession ( const x2goSession& s );
669
 
                void selectSession ( QStringList& sessions );
670
 
                x2goSession getSelectedSession();
671
 
                bool parseParameter ( QString param );
672
 
                bool linkParameter ( QString value );
673
 
                bool geometry_par ( QString value );
674
 
                bool setKbd_par ( QString value );
675
 
                bool ldapParameter ( QString value );
676
 
                bool ldap1Parameter ( QString value );
677
 
                bool ldap2Parameter ( QString value );
678
 
                bool packParameter ( QString value );
679
 
                bool soundParameter ( QString val );
680
 
                void printError ( QString param );
681
 
                void exportDefaultDirs();
682
 
                QString createRSAKey();
683
 
                directory* getExpDir ( QString key );
684
 
                bool findInList ( const QString& uid );
685
 
                void setUsersEnabled ( bool enable );
686
 
                void externalLogout ( const QString& logoutDir );
687
 
                void externalLogin ( const QString& loginDir );
688
 
                void startGPGAgent ( const QString& login,
689
 
                                     const QString& appId );
690
 
                void closeClient();
691
 
                void continueNormalSession();
692
 
                void continueLDAPSession();
693
 
                void startSshConnection(QString host, QString port, bool acceptUnknownHosts, QString login, QString password, bool autologin);
694
 
 
695
 
        protected:
696
 
                virtual void closeEvent ( QCloseEvent* event );
697
 
#ifndef Q_OS_WIN
698
 
                virtual void mouseReleaseEvent ( QMouseEvent * event );
699
 
#else
700
 
        private slots:
701
 
                void slotSetWinServersReady();
702
 
                void startWinServers();
703
 
                void slotCheckXOrgLog();
704
 
#endif
705
 
        private slots:
706
 
                void slotShowPassForm();
707
 
                void displayUsers();
708
 
                void slotResize ( const QSize sz );
709
 
                void slotUnameChanged ( const QString& text );
710
 
                void slotPassEnter();
711
 
 
712
 
                void readUsers();
713
 
                void slotSelectedFromList ( UserButton* user );
714
 
                void slotUnameEntered();
715
 
                void slotClosePass();
716
 
                void slotReadSessions();
717
 
                void slotManage();
718
 
                void displayToolBar ( bool );
719
 
                void showSessionStatus();
720
 
                void slotSshConnectionError(QString message, QString lastSessionError);
721
 
                void slotSshServerAuthError(int error, QString sshMessage);
722
 
                void slotSshUserAuthError(QString error);
723
 
                void slotSshConnectionOk();
724
 
 
725
 
        public slots:
726
 
#ifdef CFGPLUGIN
727
 
                void setX2goconfig ( const QString& text );
728
 
#endif
729
 
                void slotConfig();
730
 
                void slotNewSession();
731
 
                void slotDeleteButton ( SessionButton * bt );
732
 
                void slotEdit ( SessionButton* );
733
 
                void slotCreateDesktopIcon ( SessionButton* bt );
734
 
                void exportsEdit ( SessionButton* bt );
735
 
                void slotUpdateEmbed();
736
 
                void slotEmbedControlAction();
737
 
                void slotDetachProxyWindow();
738
 
                void slotActivateWindow();
739
 
 
740
 
        private slots:
741
 
                void slotSnameChanged ( const QString& );
742
 
                void slotSelectedFromList ( SessionButton* session );
743
 
                void slotSessEnter();
744
 
                void slotCloseSelectDlg();
745
 
                void slotActivated ( const QModelIndex& index );
746
 
                void slotResumeSess();
747
 
                void slotSuspendSess();
748
 
                void slotTermSessFromSt();
749
 
                void slotSuspendSessFromSt();
750
 
                void slotTermSess();
751
 
                void slotNewSess();
752
 
                void slotCmdMessage ( bool result,QString output,
753
 
                                       SshProcess* );
754
 
                void slotListSessions ( bool result,QString output,
755
 
                                         SshProcess* );
756
 
                void slotRetSuspSess ( bool value,QString message,
757
 
                                        SshProcess* );
758
 
                void slotRetTermSess ( bool result,QString output,
759
 
                                        SshProcess* );
760
 
                void slotRetResumeSess ( bool result,QString output,
761
 
                                          SshProcess* );
762
 
                void slotTunnelFailed ( bool result,QString output,
763
 
                                         SshProcess* );
764
 
                void slotFsTunnelFailed ( bool result,QString output,
765
 
                                           SshProcess* );
766
 
                void slotSndTunnelFailed ( bool result,QString output,
767
 
                                            SshProcess* );
768
 
                void slotCopyKey ( bool result,QString output,SshProcess* );
769
 
                void slotTunnelOk();
770
 
                void slotFsTunnelOk();
771
 
                void slotProxyError ( QProcess::ProcessError err );
772
 
                void slotProxyFinished ( int result,QProcess::ExitStatus st );
773
 
                void slotProxyStderr();
774
 
                void slotProxyStdout();
775
 
                void slotResumeDoubleClick ( const QModelIndex& );
776
 
                void slotShowAdvancedStat();
777
 
                void slotRestartProxy();
778
 
                void slotTestSessionStatus();
779
 
                void slotRetRunCommand ( bool result, QString output,
780
 
                                          SshProcess* );
781
 
                void slotGetServers ( bool result, QString output,
782
 
                                       SshProcess* );
783
 
                void slotListAllSessions ( bool result,QString output,
784
 
                                            SshProcess* );
785
 
                void slotRetExportDir ( bool result,QString output,
786
 
                                         SshProcess* );
787
 
                void slotResize();
788
 
                void slotExportDirectory();
789
 
                void slotExportTimer();
790
 
                void slotAboutQt();
791
 
                void slotAbout();
792
 
        private slots:
793
 
                void slotCheckPrintSpool();
794
 
                void slotRereadUsers();
795
 
                void slotExtTimer();
796
 
                void slotStartPGPAuth();
797
 
                void slotScDaemonOut();
798
 
                void slotScDaemonError();
799
 
                void slotGpgFinished ( int exitCode,
800
 
                                        QProcess::ExitStatus exitStatus );
801
 
                void slotScDaemonFinished ( int exitCode,
802
 
                                             QProcess::ExitStatus exitStatus );
803
 
                void slotGpgError();
804
 
                void slotCheckScDaemon();
805
 
                void slotGpgAgentFinished ( int exitCode,
806
 
                                             QProcess::ExitStatus exitStatus );
807
 
                void slotCheckAgentProcess();
808
 
                void slotExecXmodmap();
809
 
                void slotSudoErr ( QString errstr, SshProcess* pr );
810
 
                void slotCreateSessionIcon();
811
 
                void slotFindProxyWin();
812
 
                void slotAttachProxyWindow();
813
 
                void slotEmbedIntoParentWindow();
814
 
                void slotEmbedWindow();
815
 
                void slotStartParec ();
816
 
                void slotSndTunOk();
817
 
                void slotPCookieReady ( bool result,QString output,
818
 
                                        SshProcess* proc );
819
 
                void slotEmbedToolBar();
820
 
                void slotEmbedToolBarToolTip();
821
 
                void slotHideEmbedToolBarToolTip();
822
 
                void slotDesktopFilterChanged ( const QString& text ) ;
823
 
                void slotDesktopFilterCb ( int state ) ;
824
 
                void slotShadowViewSess();
825
 
                void slotShadowSess();
826
 
                void slotStartSshAgent ( QString key );
827
 
                void slotReconnectSession();
828
 
                void slotStartBroker();
829
 
                void slotStartNewBrokerSession ();
830
 
        private:
831
 
                void addToAppNames ( QString intName, QString transName );
832
 
                bool checkAgentProcess();
833
 
                bool isColorDepthOk ( int disp, int sess );
834
 
                void check_cmd_status();
835
 
                int startSshFsTunnel();
836
 
                void startX2goMount();
837
 
                void cleanPrintSpool();
838
 
                void cleanAskPass();
839
 
                void initWidgetsEmbed();
840
 
                void initWidgetsNormal();
841
 
                QString getCurrentUname();
842
 
                QString getCurrentPass();
843
 
                void processSessionConfig();
844
 
                void addKey2SshAgent ( const QString& keyName );
845
 
                void finishSshAgent();
846
 
                void processCfgLine ( QString line );
847
 
                void initSelectSessDlg();
848
 
                void initStatusDlg();
849
 
                void initPassDlg();
850
 
                void printSshDError();
851
 
                void loadPulseModuleNativeProtocol();
852
 
                void initEmbedToolBar();
853
 
                bool isServerRunning ( int port );
854
 
                void filterDesktops ( const QString& filter,
855
 
                                      bool strict=false );
856
 
                void generateHostDsaKey();
857
 
                void generateEtcFiles();
858
 
                QString u3DataPath();
859
 
                void cleanPortable();
860
 
                void removeDir ( QString path );
861
 
#ifdef Q_OS_WIN
862
 
                void saveCygnusSettings();
863
 
                void restoreCygnusSettings();
 
214
    friend class HttpBrokerClient;
 
215
#ifdef CFGPLUGIN
 
216
    Q_PROPERTY ( QString x2goconfig READ x2goconfig WRITE setX2goconfig )
 
217
    Q_CLASSINFO ( "ClassID", "{5a20006d-118f-4185-9653-9f98958a0008}" )
 
218
    Q_CLASSINFO ( "InterfaceID", "{2df000ba-da4f-4fb7-8f35-b8dfbf80009a}" )
 
219
    Q_CLASSINFO ( "EventsID", "{44900013-f8bd-4d2e-a2cf-eab407c03005}" )
 
220
    Q_CLASSINFO ( "MIME",
 
221
                  "application/x2go:x2go:Configuration File "
 
222
                  "for X2Go Session" )
 
223
    Q_CLASSINFO ( "ToSuperClass", "ONMainWindow" )
 
224
    Q_CLASSINFO ( "DefaultProperty","x2goconfig" )
 
225
#endif
 
226
    Q_OBJECT
 
227
public:
 
228
    enum
 
229
    {
 
230
        S_DISPLAY,
 
231
        S_STATUS,
 
232
        S_COMMAND,
 
233
        S_TYPE,
 
234
        S_SERVER,
 
235
        S_CRTIME,
 
236
        S_IP,
 
237
        S_ID
 
238
    };
 
239
    enum
 
240
    {
 
241
        MODEM,
 
242
        ISDN,
 
243
        ADSL,
 
244
        WAN,
 
245
        LAN
 
246
    };
 
247
    enum
 
248
    {
 
249
        D_USER,
 
250
        D_DISPLAY
 
251
    };
 
252
    enum
 
253
    {
 
254
        SHADOW_VIEWONLY,
 
255
        SHADOW_FULL
 
256
    };
 
257
    enum
 
258
    {
 
259
        PULSE,
 
260
        ARTS,
 
261
        ESD
 
262
    };
 
263
    static bool portable;
 
264
    ONMainWindow ( QWidget *parent = 0 );
 
265
    ~ONMainWindow();
 
266
    QString iconsPath ( QString fname );
 
267
    const QList<SessionButton*> * getSessionsList()
 
268
    {
 
269
        return &sessions;
 
270
    }
 
271
    void startNewSession();
 
272
    void suspendSession ( QString sessId );
 
273
    bool termSession ( QString sessId,
 
274
                       bool warn=true );
 
275
    void setStatStatus ( QString status=QString::null );
 
276
    x2goSession getNewSessionFromString ( const QString& string );
 
277
    void runCommand();
 
278
    long findWindow ( QString text );
 
279
    bool retUseLdap()
 
280
    {
 
281
        return useLdap;
 
282
    }
 
283
    bool retMiniMode()
 
284
    {
 
285
        return miniMode;
 
286
    }
 
287
    QString retLdapServer()
 
288
    {
 
289
        return ldapServer;
 
290
    }
 
291
    int retLdapPort()
 
292
    {
 
293
        return ldapPort;
 
294
    }
 
295
    QString retLdapDn()
 
296
    {
 
297
        return ldapDn;
 
298
    }
 
299
    QString retLdapServer1()
 
300
    {
 
301
        return ldapServer1;
 
302
    }
 
303
    int retLdapPort1()
 
304
    {
 
305
        return ldapPort1;
 
306
    }
 
307
    QString retLdapServer2()
 
308
    {
 
309
        return ldapServer2;
 
310
    }
 
311
    int retLdapPort2()
 
312
    {
 
313
        return ldapPort2;
 
314
    }
 
315
    QHBoxLayout* mainLayout()
 
316
    {
 
317
        return mainL;
 
318
    }
 
319
    QWidget* mainWidget()
 
320
    {
 
321
        return ( QWidget* ) fr;
 
322
    }
 
323
 
 
324
    static bool getPortable()
 
325
    {
 
326
        return portable;
 
327
    }
 
328
    static QString getHomeDirectory()
 
329
    {
 
330
        return homeDir;
 
331
    }
 
332
    bool getShowAdvOption()
 
333
    {
 
334
        return config.showextconfig;
 
335
    }
 
336
    QString getDefaultCmd()
 
337
    {
 
338
        return defaultCmd;
 
339
    }
 
340
    QString getDefaultSshPort()
 
341
    {
 
342
        return defaultSshPort;
 
343
    }
 
344
    QString getDefaultKbdType()
 
345
    {
 
346
        return defaultKbdType;
 
347
    }
 
348
    QString getDefaultLayout()
 
349
    {
 
350
        return defaultLayout;
 
351
    }
 
352
    QString getDefaultPack()
 
353
    {
 
354
        return defaultPack;
 
355
    }
 
356
    int getDefaultQuality()
 
357
    {
 
358
        return defaultQuality;
 
359
    }
 
360
 
 
361
    uint getDefaultDPI()
 
362
    {
 
363
        return defaultDPI;
 
364
    }
 
365
 
 
366
    bool getDefaultSetDPI()
 
367
    {
 
368
        return defaultSetDPI;
 
369
    }
 
370
 
 
371
    bool getEmbedMode()
 
372
    {
 
373
        return embedMode;
 
374
    }
 
375
 
 
376
    int getDefaultLink()
 
377
    {
 
378
        return defaultLink;
 
379
    }
 
380
    int getDefaultWidth()
 
381
    {
 
382
        return defaultWidth;
 
383
    }
 
384
    int getDefaultHeight()
 
385
    {
 
386
        return defaultHeight;
 
387
    }
 
388
    bool getDefaultSetKbd()
 
389
    {
 
390
        return defaultSetKbd;
 
391
    }
 
392
    bool getDefaultUseSound()
 
393
    {
 
394
        return defaultUseSound;
 
395
    }
 
396
    bool getDefaultFullscreen()
 
397
    {
 
398
        return defaultFullscreen;
 
399
    }
 
400
 
 
401
    void showHelp();
 
402
    void showHelpPack();
 
403
    void exportDirs ( QString exports,bool removable=false );
 
404
    void reloadUsers();
 
405
    void setWidgetStyle ( QWidget* widget );
 
406
    QStringList internApplicationsNames()
 
407
    {
 
408
        return _internApplicationsNames;
 
409
    }
 
410
    QStringList transApplicationsNames()
 
411
    {
 
412
        return _transApplicationsNames;
 
413
    }
 
414
    QString transAppName ( const QString& internAppName,
 
415
                           bool* found=0l );
 
416
    QString internAppName ( const QString& transAppName,
 
417
                            bool* found=0l );
 
418
    void setEmbedSessionActionsEnabled ( bool enable );
 
419
    void startSshd();
 
420
    QSize getEmbedAreaSize();
 
421
#ifdef Q_OS_WIN
 
422
    static QString cygwinPath ( const QString& winPath );
 
423
    void startXOrg();
 
424
    void startPulsed();
 
425
    static bool haveCySolEntry();
 
426
    static bool haveCygwinEntry();
 
427
    static void removeCySolEntry();
 
428
    static void removeCygwinEntry();
 
429
    static QString U3DevicePath()
 
430
    {
 
431
        return u3Device;
 
432
    }
 
433
#endif
 
434
 
 
435
private:
 
436
    QString m_x2goconfig;
 
437
    QStringList _internApplicationsNames;
 
438
    QStringList _transApplicationsNames;
 
439
    QString portableDataPath;
 
440
    bool drawMenu;
 
441
    bool extStarted;
 
442
    bool startMaximized;
 
443
    bool startHidden;
 
444
    bool defaultUseSound;
 
445
    bool cardStarted;
 
446
    bool defaultSetKbd;
 
447
    bool showExport;
 
448
    bool usePGPCard;
 
449
    bool miniMode;
 
450
    bool managedMode;
 
451
    bool embedMode;
 
452
    QString statusString;
 
453
    int defaultLink;
 
454
    int defaultQuality;
 
455
    int defaultWidth;
 
456
    int defaultHeight;
 
457
    bool defaultFullscreen;
 
458
    bool acceptRsa;
 
459
    bool startEmbedded;
 
460
    bool extLogin;
 
461
    bool printSupport;
 
462
    bool showTbTooltip;
 
463
    struct SshProxy sshProxy;
 
464
    QString sshPort;
 
465
    QString clientSshPort;
 
466
    QString defaultSshPort;
 
467
    QVBoxLayout* selectSesDlgLayout;
 
468
    SshMasterConnection* sshConnection;
 
469
    bool closeEventSent;
 
470
    int shadowMode;
 
471
    QString shadowUser;
 
472
    QString shadowDisplay;
 
473
    QString defaultPack;
 
474
    QString defaultLayout;
 
475
    QString defaultKbdType;
 
476
    QString defaultCmd;
 
477
    bool defaultSetDPI;
 
478
    uint defaultDPI;
 
479
    QStringList listedSessions;
 
480
    QString appDir;
 
481
    QString localGraphicPort;
 
482
    static QString homeDir;
 
483
    int retSessions;
 
484
    QList<serv> x2goServers;
 
485
 
 
486
    QPushButton* bSusp;
 
487
    QPushButton* sbExp;
 
488
    QPushButton* bTerm;
 
489
    QPushButton* bNew;
 
490
    QPushButton* bShadow;
 
491
    QPushButton* bShadowView;
 
492
    QPushButton* bCancel;
 
493
 
 
494
 
 
495
    QLabel* selectSessionLabel;
 
496
    QTreeView* sessTv;
 
497
 
 
498
    QLineEdit* desktopFilter;
 
499
    QCheckBox* desktopFilterCb;
 
500
 
 
501
    IMGFrame* fr;
 
502
    SVGFrame *bgFrame;
 
503
    QLineEdit* uname;
 
504
    ClickLineEdit* pass;
 
505
    ClickLineEdit* login;
 
506
    QFrame* uframe;
 
507
    SVGFrame *passForm;
 
508
    QSize mwSize;
 
509
    bool mwMax;
 
510
    QPoint mwPos;
 
511
    SVGFrame *selectSessionDlg;
 
512
    SVGFrame *sessionStatusDlg;
 
513
    QLabel* u;
 
514
    QLabel* fotoLabel;
 
515
    QLabel* nameLabel;
 
516
    QLabel* passPrompt;
 
517
    QLabel* loginPrompt;
 
518
    QLabel* slName;
 
519
    QLabel* slVal;
 
520
    QPushButton* ok;
 
521
    QPushButton* cancel;
 
522
    QString readExportsFrom;
 
523
    QString readLoginsFrom;
 
524
    QPushButton* sOk;
 
525
    QPushButton* sbSusp;
 
526
    QPushButton* sbTerm;
 
527
    QCheckBox* sbAdv;
 
528
    QPushButton* sCancel;
 
529
    QString resolution;
 
530
    QString kdeIconsPath;
 
531
    QScrollArea* users;
 
532
    QVBoxLayout* userl;
 
533
    QHBoxLayout* mainL;
 
534
    QList<UserButton*> names;
 
535
    QList<SessionButton*> sessions;
 
536
    UserButton* lastUser;
 
537
    SessionButton* lastSession;
 
538
    QString prevText;
 
539
    QString onserver;
 
540
    QString id;
 
541
    QString selectedCommand;
 
542
    QString currentKey;
 
543
    QTimer *exportTimer;
 
544
    QTimer *extTimer;
 
545
    QTimer *agentCheckTimer;
 
546
    QTimer *spoolTimer;
 
547
    QTimer *proxyWinTimer;
 
548
    QStyle* widgetExtraStyle;
 
549
    bool isPassShown;
 
550
    bool xmodExecuted;
 
551
    long proxyWinId;
 
552
    bool embedControlChanged;
 
553
    bool embedTbVisible;
 
554
    QLabel* statusLabel;
 
555
    ConfigFile config;
 
556
    QStandardItemModel* model;
 
557
    QStandardItemModel* modelDesktop;
 
558
 
 
559
    QAction *act_set;
 
560
    QAction *act_abclient;
 
561
    QAction *act_shareFolder;
 
562
    QAction *act_suspend;
 
563
    QAction *act_terminate;
 
564
    QAction *act_reconnect;
 
565
    QAction *act_embedContol;
 
566
    QAction *act_embedToolBar;
 
567
 
 
568
    QToolBar *stb;
 
569
 
 
570
    QString sessionStatus;
 
571
    QString spoolDir;
 
572
    QString sessionRes;
 
573
    QHBoxLayout* username;
 
574
    QList <user> userList;
 
575
    QList <directory> exportDir;
 
576
    QString nick;
 
577
    QString nfsPort;
 
578
    QString mntPort;
 
579
    QProcess* ssh;
 
580
    QProcess* soundServer;
 
581
    QProcess* scDaemon;
 
582
    QProcess* gpgAgent;
 
583
    QProcess* gpg;
 
584
    LDAPSession* ld;
 
585
    long embedParent;
 
586
    long embedChild;
 
587
    bool proxyWinEmbedded;
 
588
    bool useLdap;
 
589
    bool showToolBar;
 
590
    bool newSession;
 
591
    bool ldapOnly;
 
592
    bool isScDaemonOk;
 
593
    bool parecTunnelOk;
 
594
 
 
595
    bool startSessSound;
 
596
    int startSessSndSystem;
 
597
 
 
598
    bool fsInTun;
 
599
    bool fsTunReady;
 
600
 
 
601
    QString fsExportKey;
 
602
    bool fsExportKeyReady;
 
603
 
 
604
    QString ldapServer;
 
605
    int ldapPort;
 
606
    QString ldapServer1;
 
607
    int ldapPort1;
 
608
    QString ldapServer2;
 
609
    int ldapPort2;
 
610
    QString ldapDn;
 
611
    QString sessionCmd;
 
612
 
 
613
    QString LDAPSndSys;
 
614
    QString LDAPSndPort;
 
615
    bool LDAPSndStartServer;
 
616
 
 
617
    bool  LDAPPrintSupport;
 
618
 
 
619
    QAction *act_edit;
 
620
    QAction *act_new;
 
621
    QAction *act_sessicon;
 
622
    QProcess *nxproxy;
 
623
#ifndef Q_OS_WIN
 
624
    QProcess *sshd;
 
625
    bool userSshd;
 
626
#else
 
627
    QProcess *xorg;
 
628
    PROCESS_INFORMATION sshd;
 
629
    bool winSshdStarted;
 
630
    static QString u3Device;
 
631
 
 
632
    QProcess* pulseServer;
 
633
    int xDisplay;
 
634
    int sshdPort;
 
635
    bool winServersReady;
 
636
    QString oldEtcDir;
 
637
    QString oldBinDir;
 
638
    QString oldTmpDir;
 
639
 
 
640
    bool cySolEntry;
 
641
    bool cyEntry;
 
642
 
 
643
    QString pulseDir;
 
644
    int pulsePort;
 
645
    int esdPort;
 
646
    bool maximizeProxyWin;
 
647
    int proxyWinWidth;
 
648
    int proxyWinHeight;
 
649
    QTimer* xorgLogTimer;
 
650
    QString xorgLogFile;
 
651
    QMutex xorgLogMutex;
 
652
#endif
 
653
    QString lastFreeServer;
 
654
    QString cardLogin;
 
655
    QTextEdit* stInfo;
 
656
 
 
657
    SVGFrame* ln;
 
658
    SshProcess* tunnel;
 
659
    SshProcess* sndTunnel;
 
660
    SshProcess* fsTunnel;
 
661
    QList<x2goSession> selectedSessions;
 
662
    QStringList selectedDesktops;
 
663
    x2goSession resumingSession;
 
664
    bool startSound;
 
665
    bool restartResume;
 
666
    bool runRemoteCommand;
 
667
    bool shadowSession;
 
668
    int firstUid;
 
669
    int lastUid;
 
670
    QStringList sshEnv;
 
671
    QString agentPid;
 
672
    bool cardReady;
 
673
    HttpBrokerClient* broker;
 
674
 
 
675
    void installTranslator();
 
676
    void loadSettings();
 
677
    void showPass ( UserButton* user );
 
678
    void clean();
 
679
    bool defaultSession;
 
680
    QString defaultSessionName;
 
681
    QString defaultSessionId;
 
682
    QString defaultUserName;
 
683
    bool defaultUser;
 
684
    SessionButton* createBut ( const QString& id );
 
685
    void placeButtons();
 
686
    QString getKdeIconsPath();
 
687
    QString findTheme ( QString theme );
 
688
    bool initLdapSession ( bool showBox=true );
 
689
    bool startSession ( const QString& id );
 
690
    x2goSession getSessionFromString ( const QString& string );
 
691
    void resumeSession ( const x2goSession& s );
 
692
    void selectSession ( QStringList& sessions );
 
693
    x2goSession getSelectedSession();
 
694
    bool parseParameter ( QString param );
 
695
    bool linkParameter ( QString value );
 
696
    bool geometry_par ( QString value );
 
697
    bool setKbd_par ( QString value );
 
698
    bool ldapParameter ( QString value );
 
699
    bool ldap1Parameter ( QString value );
 
700
    bool ldap2Parameter ( QString value );
 
701
    bool packParameter ( QString value );
 
702
    bool soundParameter ( QString val );
 
703
    void printError ( QString param );
 
704
    void exportDefaultDirs();
 
705
    QString createRSAKey();
 
706
    directory* getExpDir ( QString key );
 
707
    bool findInList ( const QString& uid );
 
708
    void setUsersEnabled ( bool enable );
 
709
    void externalLogout ( const QString& logoutDir );
 
710
    void externalLogin ( const QString& loginDir );
 
711
    void startGPGAgent ( const QString& login,
 
712
                         const QString& appId );
 
713
    void closeClient();
 
714
    void continueNormalSession();
 
715
    void continueLDAPSession();
 
716
    void startSshConnection ( QString host, QString port, bool acceptUnknownHosts, QString login, QString password, bool autologin );
 
717
 
 
718
protected:
 
719
    virtual void closeEvent ( QCloseEvent* event );
 
720
#ifndef Q_OS_WIN
 
721
    virtual void mouseReleaseEvent ( QMouseEvent * event );
 
722
#else
 
723
private slots:
 
724
    void slotSetWinServersReady();
 
725
    void startWinServers();
 
726
    void slotCheckXOrgLog();
 
727
#endif
 
728
private slots:
 
729
    void slotShowPassForm();
 
730
    void displayUsers();
 
731
    void slotResize ( const QSize sz );
 
732
    void slotUnameChanged ( const QString& text );
 
733
    void slotPassEnter();
 
734
 
 
735
    void readUsers();
 
736
    void slotSelectedFromList ( UserButton* user );
 
737
    void slotUnameEntered();
 
738
    void slotClosePass();
 
739
    void slotReadSessions();
 
740
    void slotManage();
 
741
    void displayToolBar ( bool );
 
742
    void showSessionStatus();
 
743
    void slotSshConnectionError ( QString message, QString lastSessionError );
 
744
    void slotSshServerAuthError ( int error, QString sshMessage );
 
745
    void slotSshUserAuthError ( QString error );
 
746
    void slotSshConnectionOk();
 
747
 
 
748
public slots:
 
749
    void slotConfig();
 
750
    void slotNewSession();
 
751
    void slotDeleteButton ( SessionButton * bt );
 
752
    void slotEdit ( SessionButton* );
 
753
    void slotCreateDesktopIcon ( SessionButton* bt );
 
754
    void exportsEdit ( SessionButton* bt );
 
755
    void slotEmbedControlAction();
 
756
    void slotDetachProxyWindow();
 
757
    void slotActivateWindow();
 
758
 
 
759
private slots:
 
760
    void slotSnameChanged ( const QString& );
 
761
    void slotSelectedFromList ( SessionButton* session );
 
762
    void slotSessEnter();
 
763
    void slotCloseSelectDlg();
 
764
    void slotActivated ( const QModelIndex& index );
 
765
    void slotResumeSess();
 
766
    void slotSuspendSess();
 
767
    void slotTermSessFromSt();
 
768
    void slotSuspendSessFromSt();
 
769
    void slotTermSess();
 
770
    void slotNewSess();
 
771
    void slotCmdMessage ( bool result,QString output,
 
772
                          SshProcess* );
 
773
    void slotListSessions ( bool result,QString output,
 
774
                            SshProcess* );
 
775
    void slotRetSuspSess ( bool value,QString message,
 
776
                           SshProcess* );
 
777
    void slotRetTermSess ( bool result,QString output,
 
778
                           SshProcess* );
 
779
    void slotRetResumeSess ( bool result,QString output,
 
780
                             SshProcess* );
 
781
    void slotTunnelFailed ( bool result,QString output,
 
782
                            SshProcess* );
 
783
    void slotFsTunnelFailed ( bool result,QString output,
 
784
                              SshProcess* );
 
785
    void slotSndTunnelFailed ( bool result,QString output,
 
786
                               SshProcess* );
 
787
    void slotCopyKey ( bool result,QString output,SshProcess* );
 
788
    void slotTunnelOk();
 
789
    void slotFsTunnelOk();
 
790
    void slotProxyError ( QProcess::ProcessError err );
 
791
    void slotProxyFinished ( int result,QProcess::ExitStatus st );
 
792
    void slotProxyStderr();
 
793
    void slotProxyStdout();
 
794
    void slotResumeDoubleClick ( const QModelIndex& );
 
795
    void slotShowAdvancedStat();
 
796
    void slotRestartProxy();
 
797
    void slotTestSessionStatus();
 
798
    void slotRetRunCommand ( bool result, QString output,
 
799
                             SshProcess* );
 
800
    void slotGetServers ( bool result, QString output,
 
801
                          SshProcess* );
 
802
    void slotListAllSessions ( bool result,QString output,
 
803
                               SshProcess* );
 
804
    void slotRetExportDir ( bool result,QString output,
 
805
                            SshProcess* );
 
806
    void slotResize();
 
807
    void slotExportDirectory();
 
808
    void slotExportTimer();
 
809
    void slotAboutQt();
 
810
    void slotAbout();
 
811
private slots:
 
812
    void slotCheckPrintSpool();
 
813
    void slotRereadUsers();
 
814
    void slotExtTimer();
 
815
    void slotStartPGPAuth();
 
816
    void slotScDaemonOut();
 
817
    void slotScDaemonError();
 
818
    void slotGpgFinished ( int exitCode,
 
819
                           QProcess::ExitStatus exitStatus );
 
820
    void slotScDaemonFinished ( int exitCode,
 
821
                                QProcess::ExitStatus exitStatus );
 
822
    void slotGpgError();
 
823
    void slotCheckScDaemon();
 
824
    void slotGpgAgentFinished ( int exitCode,
 
825
                                QProcess::ExitStatus exitStatus );
 
826
    void slotCheckAgentProcess();
 
827
    void slotExecXmodmap();
 
828
    void slotCreateSessionIcon();
 
829
    void slotFindProxyWin();
 
830
    void slotAttachProxyWindow();
 
831
    void slotEmbedIntoParentWindow();
 
832
    void slotEmbedWindow();
 
833
    void slotStartParec ();
 
834
    void slotSndTunOk();
 
835
    void slotPCookieReady (     bool result,QString output,
 
836
                            SshProcess* proc );
 
837
    void slotEmbedToolBar();
 
838
    void slotEmbedToolBarToolTip();
 
839
    void slotHideEmbedToolBarToolTip();
 
840
    void slotDesktopFilterChanged ( const QString& text ) ;
 
841
    void slotDesktopFilterCb ( int state ) ;
 
842
    void slotShadowViewSess();
 
843
    void slotShadowSess();
 
844
    void slotReconnectSession();
 
845
    void slotStartBroker();
 
846
    void slotStartNewBrokerSession ();
 
847
private:
 
848
#ifdef Q_OS_LINUX
 
849
    long X11FindWindow ( QString text, long rootWin=0 );
 
850
#endif
 
851
    void addToAppNames ( QString intName, QString transName );
 
852
    bool checkAgentProcess();
 
853
    bool isColorDepthOk ( int disp, int sess );
 
854
    void check_cmd_status();
 
855
    int startSshFsTunnel();
 
856
    void startX2goMount();
 
857
    void cleanPrintSpool();
 
858
    void cleanAskPass();
 
859
    void initWidgetsEmbed();
 
860
    void initWidgetsNormal();
 
861
    QString getCurrentUname();
 
862
    QString getCurrentPass();
 
863
    void processSessionConfig();
 
864
    void processCfgLine ( QString line );
 
865
    void initSelectSessDlg();
 
866
    void initStatusDlg();
 
867
    void initPassDlg();
 
868
    void printSshDError();
 
869
    void loadPulseModuleNativeProtocol();
 
870
    void initEmbedToolBar();
 
871
    bool isServerRunning ( int port );
 
872
    void filterDesktops ( const QString& filter,
 
873
                          bool strict=false );
 
874
    void generateHostDsaKey();
 
875
    void generateEtcFiles();
 
876
    QString u3DataPath();
 
877
    void cleanPortable();
 
878
    void removeDir ( QString path );
 
879
#ifdef Q_OS_WIN
 
880
    void saveCygnusSettings();
 
881
    void restoreCygnusSettings();
864
882
#endif
865
883
#if defined  (Q_OS_WIN) || defined (Q_OS_DARWIN)
866
 
                QString getXDisplay();
867
 
#endif
 
884
    QString getXDisplay();
 
885
#endif
 
886
 
 
887
////////////////plugin stuff////////////////////
 
888
#ifdef CFGPLUGIN
 
889
public slots:
 
890
    void setX2goconfig ( const QString& text );
 
891
public:
 
892
    QString x2goconfig() const
 
893
    {
 
894
        return m_x2goconfig;
 
895
    }
 
896
 
 
897
#ifndef Q_OS_DARWIN
 
898
public:
 
899
    void embedWindow ( long wndId );
 
900
    void detachClient();
 
901
private:
 
902
    long parentId;
 
903
    long childId;
 
904
    QSize oldParentSize;
 
905
 
 
906
#ifdef Q_OS_LINUX
 
907
    QX11EmbedContainer* embedContainer;
 
908
#endif
 
909
#ifdef Q_OS_WIN
 
910
    QWidget* embedContainer;
 
911
    QPoint oldParentPos;
 
912
    QPoint oldChildPos;
 
913
    QSize oldContainerSize;
 
914
    QTimer *updateTimer;
 
915
    int gcor;
 
916
    long winFlags;
 
917
#endif
 
918
private:
 
919
    QSize getWindowSize ( long winId );
 
920
    void doPluginInit();
 
921
 
 
922
#ifdef Q_OS_WIN
 
923
private slots:
 
924
    void slotUpdateEmbedWindow();
 
925
#endif
 
926
 
 
927
#endif //(Q_OS_DARWIN)
 
928
#endif
 
929
////////////////end of plugin stuff////////////////////
868
930
};
869
931
 
870
932
#endif