~x2go/x2go/x2goclient_master

« back to all changes in this revision

Viewing changes to src/onmainwindow.h

  • Committer: Mihai Moldovan
  • Date: 2015-03-04 20:15:47 UTC
  • Revision ID: git-v1:b7398771a7abd84ddcff407063edb95dd0a205d3
general: move *.cpp and *.h files to src/ and *.ts files to src/i18n/.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**************************************************************************
 
2
*   Copyright (C) 2005-2015 by Oleksandr Shneyder                         *
 
3
*   o.shneyder@phoca-gmbh.de                                              *
 
4
*                                                                         *
 
5
*   This program is free software; you can redistribute it and/or modify  *
 
6
*   it under the terms of the GNU General Public License as published by  *
 
7
*   the Free Software Foundation; either version 2 of the License, or     *
 
8
*   (at your option) any later version.                                   *
 
9
*   This program is distributed in the hope that it will be useful,       *
 
10
*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
11
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
12
*   GNU General Public License for more details.                          *
 
13
*                                                                         *
 
14
*   You should have received a copy of the GNU General Public License     *
 
15
*   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
 
16
***************************************************************************/
 
17
 
 
18
#ifndef ONMAINWINDOW_H
 
19
#define ONMAINWINDOW_H
 
20
 
 
21
#ifdef CFGPLUGIN
 
22
#include <QMetaClassInfo>
 
23
#include <qtbrowserplugin.h>
 
24
 
 
25
#ifdef QAXSERVER
 
26
#include <ActiveQt/QAxBindable>
 
27
#include <ActiveQt/QAxFactory>
 
28
#include <qt_windows.h>
 
29
#endif
 
30
 
 
31
#endif
 
32
 
 
33
#include "x2goclientconfig.h"
 
34
//#include "CallbackInterface.h"
 
35
#include <QMainWindow>
 
36
#include <QList>
 
37
#include <QPushButton>
 
38
#include <QPixmap>
 
39
#include <QProcess>
 
40
#include <QTreeView>
 
41
#include "LDAPSession.h"
 
42
#include <QToolBar>
 
43
#include <QSystemTrayIcon>
 
44
#include "sshmasterconnection.h"
 
45
 
 
46
 
 
47
 
 
48
#ifdef Q_OS_WIN
 
49
#include <windows.h>
 
50
#include <QSysInfo>
 
51
#endif
 
52
/**
 
53
@author Oleksandr Shneyder
 
54
*/
 
55
 
 
56
#if defined(CFGPLUGIN) && defined(Q_OS_LINUX)
 
57
class QX11EmbedContainer;
 
58
#endif
 
59
class QToolButton;
 
60
class QTemporaryFile;
 
61
class QLineEdit;
 
62
class QFrame;
 
63
class QVBoxLayout;
 
64
class QHBoxLayout;
 
65
class QScrollArea;
 
66
class UserButton;
 
67
class QTextEdit;
 
68
class SessionButton;
 
69
class QLabel;
 
70
class QProcess;
 
71
class QFile;
 
72
class SVGFrame;
 
73
class SessionButton;
 
74
class QAction;
 
75
class QCheckBox;
 
76
class QModelIndex;
 
77
class SshMasterConnection;
 
78
class IMGFrame;
 
79
class QStandardItemModel;
 
80
class HttpBrokerClient;
 
81
class QMenu;
 
82
class QComboBox;
 
83
 
 
84
class SessionExplorer;
 
85
struct user
 
86
{
 
87
    int uin;
 
88
    QString uid;
 
89
    QString name;
 
90
    QPixmap foto;
 
91
    static bool lessThen ( user u1,user u2 )
 
92
    {
 
93
        return u1.uid < u2.uid;
 
94
    }
 
95
};
 
96
 
 
97
struct directory
 
98
{
 
99
    QString key;
 
100
    QString dstKey;
 
101
    QString dirList;
 
102
    bool isRemovable;
 
103
    int pid;
 
104
};
 
105
 
 
106
struct serv
 
107
{
 
108
    QString name;
 
109
    float factor;
 
110
    float sess;
 
111
    bool connOk;
 
112
    bool operator < ( const struct serv it )
 
113
    {
 
114
        return ( it.sess < sess );
 
115
    }
 
116
    static bool lt ( const struct serv it, const struct serv it1 )
 
117
    {
 
118
        return it.sess<it1.sess;
 
119
    }
 
120
    QString sshPort;
 
121
};
 
122
 
 
123
struct Application
 
124
{
 
125
    QString name;
 
126
    QString comment;
 
127
    QString exec;
 
128
    QPixmap icon;
 
129
    enum {MULTIMEDIA, DEVELOPMENT, EDUCATION, GAME,
 
130
          GRAPHICS, NETWORK, OFFICE,
 
131
          SETTINGS, SYSTEM, UTILITY, OTHER, TOP
 
132
         } category;
 
133
    static bool lessThen(Application t1, Application t2)
 
134
    {
 
135
        return (t1.name.compare(t2.name,Qt::CaseInsensitive)<0);
 
136
    }
 
137
};
 
138
 
 
139
struct x2goSession
 
140
{
 
141
    QString agentPid;
 
142
    QString sessionId;
 
143
    QString display;
 
144
    QString server;
 
145
    QString status;
 
146
    QString crTime;
 
147
    QString cookie;
 
148
    QString clientIp;
 
149
    QString grPort;
 
150
    QString sndPort;
 
151
    QString fsPort;
 
152
    bool published;
 
153
    int colorDepth;
 
154
    bool fullscreen;
 
155
    enum {DESKTOP,ROOTLESS,SHADOW} sessionType;
 
156
    QString command;
 
157
    void operator = ( const x2goSession& s );
 
158
};
 
159
 
 
160
struct ConfigFile
 
161
{
 
162
    QString session;
 
163
    QString user;
 
164
    QString brokerUser;
 
165
    QString brokerPass;
 
166
    QString brokerUserId;
 
167
    QString brokerName;
 
168
    QString sshBrokerBin;
 
169
    bool brokerAuthenticated;
 
170
    bool brokerNoAuth;
 
171
    bool brokerAutologin;
 
172
    bool brokerAutologoff;
 
173
    bool brokerKrbLogin;
 
174
    QString brokerSshKey;
 
175
    QString brokerCaCertFile;
 
176
    QString iniFile;
 
177
    QString server;
 
178
    QString serverIp;//Can be different from server (use for loadballancing)
 
179
    QString sshport;
 
180
    QString command;
 
181
    QString key;
 
182
    bool rootless;
 
183
    QString cookie;
 
184
    QString connectionts;
 
185
    QString brokerurl;
 
186
    QString sessiondata;
 
187
    bool checkexitstatus;
 
188
    bool showtermbutton;
 
189
    bool showexpbutton;
 
190
    bool showextconfig;
 
191
    bool showconfig;
 
192
    bool showstatusbar;
 
193
    bool showtoolbar;
 
194
 
 
195
    //if true - use cfg values, else default or client settings
 
196
    bool confSnd;
 
197
    bool confFS;
 
198
    bool confConSpd;
 
199
    bool confCompMet;
 
200
    bool confImageQ;
 
201
    bool confDPI;
 
202
    bool confKbd;
 
203
    //
 
204
    bool useSnd;
 
205
    bool useFs;
 
206
    bool published;
 
207
    int conSpeed;
 
208
    QString compMet;
 
209
    int imageQ;
 
210
    int dpi;
 
211
    QString kbdLay;
 
212
    QString kbdType;
 
213
    //
 
214
    bool useproxy;
 
215
    SshMasterConnection::ProxyType proxyType;
 
216
    QString proxyserver;
 
217
    int proxyport;
 
218
    QString proxylogin;
 
219
    QString proxypassword;
 
220
    QString proxyKey;
 
221
    bool proxyAutologin;
 
222
    bool proxyKrbLogin;
 
223
 
 
224
};
 
225
 
 
226
 
 
227
struct sshKey
 
228
{
 
229
    QString server;
 
230
    QString port;
 
231
    QString user;
 
232
    QString key;
 
233
};
 
234
 
 
235
 
 
236
//wrapper to send mouse events under windows in embedded mode
 
237
#ifdef Q_OS_WIN
 
238
class WWrapper : public QPushButton
 
239
{
 
240
    friend class ONMainWindow;
 
241
};
 
242
#include <QThread>
 
243
#include <QMutex>
 
244
class ONMainWindow;
 
245
class WinServerStarter: public QThread
 
246
{
 
247
public:
 
248
    enum daemon {X,SSH,PULSE};
 
249
    WinServerStarter ( daemon server, ONMainWindow * par );
 
250
    void run();
 
251
private:
 
252
    daemon mode;
 
253
    ONMainWindow* parent;
 
254
};
 
255
#endif
 
256
 
 
257
 
 
258
class SessTreeView : public QTreeView
 
259
{
 
260
    Q_OBJECT
 
261
 
 
262
public:
 
263
    SessTreeView ( QWidget* parent = 0 ) : QTreeView ( parent ) {}
 
264
 
 
265
    virtual void selectionChanged ( const QItemSelection& selected,
 
266
                                    const QItemSelection& deselected ) {
 
267
        emit this->selected ( currentIndex() );
 
268
        QTreeView::selectionChanged ( selected, deselected );
 
269
    }
 
270
 
 
271
Q_SIGNALS:
 
272
    void selected ( const QModelIndex& index );
 
273
};
 
274
 
 
275
 
 
276
class ClickLineEdit;
 
277
class ONMainWindow : public QMainWindow
 
278
#ifdef CFGPLUGIN
 
279
    , public QtNPBindable
 
280
 
 
281
#ifdef QAXSERVER
 
282
    , public QAxBindable
 
283
#endif
 
284
#endif
 
285
{
 
286
    friend class HttpBrokerClient;
 
287
    friend class SessionButton;
 
288
#ifdef CFGPLUGIN
 
289
    Q_PROPERTY ( QString x2goconfig READ x2goconfig WRITE setX2goconfig )
 
290
    Q_CLASSINFO ( "ClassID", "{5a20006d-118f-4185-9653-9f98958a0008}" )
 
291
    Q_CLASSINFO ( "InterfaceID", "{2df000ba-da4f-4fb7-8f35-b8dfbf80009a}" )
 
292
    Q_CLASSINFO ( "EventsID", "{44900013-f8bd-4d2e-a2cf-eab407c03005}" )
 
293
    Q_CLASSINFO ( "MIME",
 
294
                  "application/x2go:x2go:Configuration File "
 
295
                  "for X2Go Session" )
 
296
    Q_CLASSINFO ( "ToSuperClass", "ONMainWindow" )
 
297
    Q_CLASSINFO ( "DefaultProperty","x2goconfig" )
 
298
#endif
 
299
    Q_OBJECT
 
300
public:
 
301
    enum
 
302
    {
 
303
        S_DISPLAY,
 
304
        S_STATUS,
 
305
        S_COMMAND,
 
306
        S_TYPE,
 
307
        S_SERVER,
 
308
        S_CRTIME,
 
309
        S_IP,
 
310
        S_ID
 
311
    };
 
312
    enum
 
313
    {
 
314
        MODEM,
 
315
        ISDN,
 
316
        ADSL,
 
317
        WAN,
 
318
        LAN
 
319
    };
 
320
    enum
 
321
    {
 
322
        D_USER,
 
323
        D_DISPLAY
 
324
    };
 
325
    enum
 
326
    {
 
327
        SHADOW_VIEWONLY,
 
328
        SHADOW_FULL
 
329
    };
 
330
    enum
 
331
    {
 
332
        PULSE,
 
333
        ARTS,
 
334
        ESD
 
335
    };
 
336
 
 
337
    static bool debugging;
 
338
 
 
339
    static bool portable;
 
340
    ONMainWindow ( QWidget *parent = 0 );
 
341
    ~ONMainWindow();
 
342
    static void installTranslator();
 
343
    QString iconsPath ( QString fname );
 
344
    static bool isServerRunning ( int port );
 
345
    void startNewSession();
 
346
    void suspendSession ( QString sessId );
 
347
    bool termSession ( QString sessId,
 
348
                       bool warn=true );
 
349
    void setStatStatus ( QString status=QString::null );
 
350
    x2goSession getNewSessionFromString ( const QString& string );
 
351
    void runCommand();
 
352
    long findWindow ( QString text );
 
353
    bool retUseLdap()
 
354
    {
 
355
        return useLdap;
 
356
    }
 
357
    bool retMiniMode()
 
358
    {
 
359
        return miniMode;
 
360
    }
 
361
    QString retLdapServer()
 
362
    {
 
363
        return ldapServer;
 
364
    }
 
365
    int retLdapPort()
 
366
    {
 
367
        return ldapPort;
 
368
    }
 
369
    QString retLdapDn()
 
370
    {
 
371
        return ldapDn;
 
372
    }
 
373
    QString retLdapServer1()
 
374
    {
 
375
        return ldapServer1;
 
376
    }
 
377
    int retLdapPort1()
 
378
    {
 
379
        return ldapPort1;
 
380
    }
 
381
    QString retLdapServer2()
 
382
    {
 
383
        return ldapServer2;
 
384
    }
 
385
    int retLdapPort2()
 
386
    {
 
387
        return ldapPort2;
 
388
    }
 
389
    QHBoxLayout* mainLayout()
 
390
    {
 
391
        return mainL;
 
392
    }
 
393
    QWidget* mainWidget()
 
394
    {
 
395
        return ( QWidget* ) fr;
 
396
    }
 
397
 
 
398
    static bool getPortable()
 
399
    {
 
400
        return portable;
 
401
    }
 
402
    static QString getHomeDirectory()
 
403
    {
 
404
        return homeDir;
 
405
    }
 
406
    bool getShowAdvOption()
 
407
    {
 
408
        return config.showextconfig;
 
409
    }
 
410
    bool getUsePGPCard()
 
411
    {
 
412
        return usePGPCard;
 
413
    }
 
414
    QString getCardLogin()
 
415
    {
 
416
        return cardLogin;
 
417
    }
 
418
    QString getDefaultCmd()
 
419
    {
 
420
        return defaultCmd;
 
421
    }
 
422
    QString getDefaultSshPort()
 
423
    {
 
424
        return defaultSshPort;
 
425
    }
 
426
    QString getDefaultClipboardMode()
 
427
    {
 
428
        return defaultClipboardMode;
 
429
    }
 
430
    QString getDefaultKbdType()
 
431
    {
 
432
        return defaultKbdType;
 
433
    }
 
434
    QStringList getDefaultLayout()
 
435
    {
 
436
        return defaultLayout;
 
437
    }
 
438
    QString getDefaultPack()
 
439
    {
 
440
        return defaultPack;
 
441
    }
 
442
    int getDefaultQuality()
 
443
    {
 
444
        return defaultQuality;
 
445
    }
 
446
 
 
447
    uint getDefaultDPI()
 
448
    {
 
449
        return defaultDPI;
 
450
    }
 
451
 
 
452
    bool getDefaultSetDPI()
 
453
    {
 
454
        return defaultSetDPI;
 
455
    }
 
456
 
 
457
    bool getEmbedMode()
 
458
    {
 
459
        return embedMode;
 
460
    }
 
461
 
 
462
    int getDefaultLink()
 
463
    {
 
464
        return defaultLink;
 
465
    }
 
466
    int getDefaultWidth()
 
467
    {
 
468
        return defaultWidth;
 
469
    }
 
470
    int getDefaultHeight()
 
471
    {
 
472
        return defaultHeight;
 
473
    }
 
474
    bool getDefaultSetKbd()
 
475
    {
 
476
        return defaultSetKbd;
 
477
    }
 
478
    bool getDefaultUseSound()
 
479
    {
 
480
        return defaultUseSound;
 
481
    }
 
482
    bool getDefaultFullscreen()
 
483
    {
 
484
        return defaultFullscreen;
 
485
    }
 
486
    bool sessionEditEnabled()
 
487
    {
 
488
        return !noSessionEdit;
 
489
    }
 
490
    const QList<Application>& getApplications()
 
491
    {
 
492
        return applications;
 
493
    }
 
494
    static QString getSessionConf()
 
495
    {
 
496
        return sessionCfg;
 
497
    }
 
498
    bool getHideFolderSharing()
 
499
    {
 
500
        return hideFolderSharing;
 
501
    }
 
502
 
 
503
    SessionExplorer* getSessionExplorer()
 
504
    {
 
505
        return sessionExplorer;
 
506
    }
 
507
 
 
508
    bool getBrokerMode()
 
509
    {
 
510
        return brokerMode;
 
511
    }
 
512
 
 
513
    bool getMiniMode()
 
514
    {
 
515
        return miniMode;
 
516
    }
 
517
 
 
518
    QScrollArea* getUsersArea()
 
519
    {
 
520
        return users;
 
521
    }
 
522
 
 
523
    QFrame* getUsersFrame()
 
524
    {
 
525
        return uframe;
 
526
    }
 
527
 
 
528
    IMGFrame* getCentralFrame()
 
529
    {
 
530
        return fr;
 
531
    }
 
532
 
 
533
    ConfigFile* getConfig()
 
534
    {
 
535
        return &config;
 
536
    }
 
537
 
 
538
    void runApplication(QString exec);
 
539
 
 
540
 
 
541
    SshMasterConnection* findServerSshConnection(QString host);
 
542
 
 
543
    void showHelp();
 
544
    void showVersion();
 
545
    void showTextFile(QString file, QString title);
 
546
    void showGit();
 
547
    void showChangelog();
 
548
    void showHelpPack();
 
549
    void exportDirs ( QString exports,bool removable=false );
 
550
    void reloadUsers();
 
551
    void setWidgetStyle ( QWidget* widget );
 
552
    QStringList internApplicationsNames()
 
553
    {
 
554
        return _internApplicationsNames;
 
555
    }
 
556
    QStringList transApplicationsNames()
 
557
    {
 
558
        return _transApplicationsNames;
 
559
    }
 
560
    QString transAppName ( const QString& internAppName,
 
561
                           bool* found=0l );
 
562
    QString internAppName ( const QString& transAppName,
 
563
                            bool* found=0l );
 
564
    void setEmbedSessionActionsEnabled ( bool enable );
 
565
    void startSshd();
 
566
    QSize getEmbedAreaSize();
 
567
#ifdef Q_OS_WIN
 
568
    static QString cygwinPath ( const QString& winPath );
 
569
    void startXOrg();
 
570
    void startPulsed();
 
571
    static bool haveCygwinEntry();
 
572
    static void removeCygwinEntry();
 
573
    static QString U3DevicePath()
 
574
    {
 
575
        return u3Device;
 
576
    }
 
577
#endif
 
578
 
 
579
 
 
580
private:
 
581
    QString m_x2goconfig;
 
582
    QStringList _internApplicationsNames;
 
583
    QStringList _transApplicationsNames;
 
584
    QString portableDataPath;
 
585
    QString proxyErrString;
 
586
    bool haveTerminal;
 
587
    bool proxyRunning;
 
588
    bool drawMenu;
 
589
    bool extStarted;
 
590
    bool startMaximized;
 
591
    bool closeDisconnect;
 
592
    bool startHidden;
 
593
    bool keepTrayIcon;
 
594
    bool hideFolderSharing;
 
595
    bool brokerNoauthWithSessionUsername;
 
596
    bool defaultUseSound;
 
597
    bool defaultXinerama;
 
598
    bool cardStarted;
 
599
    bool defaultSetKbd;
 
600
    bool showExport;
 
601
    bool usePGPCard;
 
602
    bool miniMode;
 
603
    bool managedMode;
 
604
    bool brokerMode;
 
605
    bool changeBrokerPass;
 
606
    bool connTest;
 
607
    bool embedMode;
 
608
    bool thinMode;
 
609
    QString statusString;
 
610
    QString autostartApp;
 
611
    bool cmdAutologin;
 
612
    int defaultLink;
 
613
    int defaultQuality;
 
614
    int defaultWidth;
 
615
    int defaultHeight;
 
616
    bool defaultFullscreen;
 
617
    bool acceptRsa;
 
618
    bool startEmbedded;
 
619
    bool extLogin;
 
620
    bool printSupport;
 
621
    bool showTbTooltip;
 
622
    bool noSessionEdit;
 
623
    bool cleanAllFiles;
 
624
    bool PGPInited;
 
625
    bool resumeAfterSuspending;
 
626
    QString sshPort;
 
627
    QString clientSshPort;
 
628
    QString defaultSshPort;
 
629
    QVBoxLayout* selectSesDlgLayout;
 
630
    SshMasterConnection* sshConnection;
 
631
    QList<SshMasterConnection*> serverSshConnections;
 
632
    bool closeEventSent;
 
633
    int shadowMode;
 
634
    QString shadowUser;
 
635
    QString shadowDisplay;
 
636
    QString defaultPack;
 
637
    QStringList defaultLayout;
 
638
    QString selectedLayout;
 
639
    QString defaultKbdType;
 
640
    QString defaultClipboardMode;
 
641
    QString defaultCmd;
 
642
    bool defaultSetDPI;
 
643
    uint defaultDPI;
 
644
    QStringList listedSessions;
 
645
    QString appDir;
 
646
    QString localGraphicPort;
 
647
    static QString homeDir;
 
648
    int retSessions;
 
649
    QList<serv> x2goServers;
 
650
    QList<Application> applications;
 
651
    QList<sshKey> cmdSshKeys;
 
652
    bool forceToShowTrayicon; //true if --tray-icon passed in command line
 
653
 
 
654
    QPushButton* bSusp;
 
655
    QPushButton* bTerm;
 
656
    QPushButton* bNew;
 
657
    QPushButton* bShadow;
 
658
    QPushButton* bShadowView;
 
659
    QPushButton* bCancel;
 
660
 
 
661
 
 
662
    QLabel* selectSessionLabel;
 
663
    SessTreeView* sessTv;
 
664
 
 
665
    QLineEdit* desktopFilter;
 
666
    QCheckBox* desktopFilterCb;
 
667
 
 
668
    SessionExplorer* sessionExplorer;
 
669
 
 
670
    IMGFrame* fr;
 
671
    SVGFrame *bgFrame;
 
672
    QLineEdit* uname;
 
673
    ClickLineEdit* pass;
 
674
    ClickLineEdit* login;
 
675
    QFrame* uframe;
 
676
    SVGFrame *passForm;
 
677
    QSize mwSize;
 
678
    bool mwMax;
 
679
    QPoint mwPos;
 
680
    SVGFrame *selectSessionDlg;
 
681
    SVGFrame *sessionStatusDlg;
 
682
    QLabel* u;
 
683
    QLabel* fotoLabel;
 
684
    QLabel* nameLabel;
 
685
    QLabel* passPrompt;
 
686
    QLabel* loginPrompt;
 
687
    QLabel* layoutPrompt;
 
688
    QLabel* slName;
 
689
    QLabel* slVal;
 
690
    QComboBox* cbLayout;
 
691
    QPushButton* ok;
 
692
    QPushButton* cancel;
 
693
    QString readExportsFrom;
 
694
    QString readLoginsFrom;
 
695
    QPushButton* sOk;
 
696
    QToolButton* sbSusp;
 
697
    QToolButton* sbExp;
 
698
    QToolButton* sbTerm;
 
699
    QToolButton* sbApps;
 
700
    QCheckBox* sbAdv;
 
701
    QPushButton* sCancel;
 
702
    QString resolution;
 
703
    QString kdeIconsPath;
 
704
    QScrollArea* users;
 
705
    QVBoxLayout* userl;
 
706
    QHBoxLayout* mainL;
 
707
    QHBoxLayout* bgLay;
 
708
    QList<UserButton*> names;
 
709
    UserButton* lastUser;
 
710
    QString prevText;
 
711
    QString onserver;
 
712
    QString id;
 
713
    QString selectedCommand;
 
714
    QString currentKey;
 
715
    QTimer *exportTimer;
 
716
    QTimer *extTimer;
 
717
    QTimer *agentCheckTimer;
 
718
    QTimer *spoolTimer;
 
719
    QTimer *proxyWinTimer;
 
720
    QTimer *xineramaTimer;
 
721
    short xinSizeInc;
 
722
    QRect lastDisplayGeometry;
 
723
    QList <QRect> xineramaScreens;
 
724
    QStyle* widgetExtraStyle;
 
725
    bool isPassShown;
 
726
    bool xmodExecuted;
 
727
    long proxyWinId;
 
728
    bool embedControlChanged;
 
729
    bool embedTbVisible;
 
730
    QLabel* statusLabel;
 
731
    ConfigFile config;
 
732
    QStandardItemModel* model;
 
733
    QStandardItemModel* modelDesktop;
 
734
 
 
735
    QAction *act_set;
 
736
    QAction *act_abclient;
 
737
    QAction *act_support;
 
738
    QAction *act_shareFolder;
 
739
    QAction *act_showApps;
 
740
    QAction *act_suspend;
 
741
    QAction *act_terminate;
 
742
    QAction *act_reconnect;
 
743
    QAction *act_embedContol;
 
744
    QAction *act_embedToolBar;
 
745
    QAction *act_changeBrokerPass;
 
746
    QAction *act_testCon;
 
747
    QList <QAction*> topActions;
 
748
 
 
749
    QToolBar *stb;
 
750
 
 
751
    QString sessionStatus;
 
752
    QString spoolDir;
 
753
    QString sessionRes;
 
754
    QHBoxLayout* username;
 
755
    QList <user> userList;
 
756
    QList <directory> exportDir;
 
757
    QString nick;
 
758
    QString nfsPort;
 
759
    QString mntPort;
 
760
    static QString sessionCfg;
 
761
    QProcess* ssh;
 
762
    QProcess* soundServer;
 
763
    QProcess* scDaemon;
 
764
    QProcess* gpgAgent;
 
765
    QProcess* gpg;
 
766
    LDAPSession* ld;
 
767
    long embedParent;
 
768
    long embedChild;
 
769
    bool proxyWinEmbedded;
 
770
    bool useLdap;
 
771
    bool showToolBar;
 
772
    bool showHaltBtn;
 
773
    bool newSession;
 
774
    bool runStartApp;
 
775
    bool ldapOnly;
 
776
    bool isScDaemonOk;
 
777
    bool parecTunnelOk;
 
778
#ifdef Q_OS_LINUX
 
779
    bool directRDP;
 
780
#endif
 
781
 
 
782
    bool startSessSound;
 
783
    int startSessSndSystem;
 
784
 
 
785
    bool fsInTun;
 
786
    bool fsTunReady;
 
787
 
 
788
    QString fsExportKey;
 
789
    bool fsExportKeyReady;
 
790
 
 
791
    QString ldapServer;
 
792
    int ldapPort;
 
793
    QString ldapServer1;
 
794
    int ldapPort1;
 
795
    QString ldapServer2;
 
796
    int ldapPort2;
 
797
    QString ldapDn;
 
798
    QString sessionCmd;
 
799
 
 
800
    QString supportMenuFile;
 
801
    QString BGFile;
 
802
    QString SPixFile;
 
803
 
 
804
    QString LDAPSndSys;
 
805
    QString LDAPSndPort;
 
806
    bool LDAPSndStartServer;
 
807
 
 
808
    bool  LDAPPrintSupport;
 
809
 
 
810
    QAction *act_edit;
 
811
    QAction *act_new;
 
812
    QAction *act_sessicon;
 
813
    QProcess *nxproxy;
 
814
#ifndef Q_OS_WIN
 
815
    QProcess *sshd;
 
816
    bool userSshd;
 
817
#else
 
818
    QProcess *xorg;
 
819
    PROCESS_INFORMATION sshd;
 
820
    bool winSshdStarted;
 
821
    static QString u3Device;
 
822
    bool pulseStarted;
 
823
 
 
824
    QString pulseVersionTestOutput;
 
825
    QProcess* pulseVersionTest;
 
826
    bool pulseVersionIsLegacy;
 
827
    QProcess* pulseServer;
 
828
    QStringList pulseArgs;
 
829
    QTimer* pulseTimer;
 
830
    int xDisplay;
 
831
    int sshdPort;
 
832
    bool winServersReady;
 
833
    QString oldEtcDir;
 
834
    QString oldBinDir;
 
835
    QString oldTmpDir;
 
836
 
 
837
    bool cyEntry;
 
838
 
 
839
    QString pulseDir;
 
840
    QString pulseBaseDir;
 
841
    QString pulseRuntimeDir;
 
842
    QString pulseCookieArg;
 
843
    int pulsePort;
 
844
    int esdPort;
 
845
    bool maximizeProxyWin;
 
846
    int proxyWinWidth;
 
847
    int proxyWinHeight;
 
848
    QTimer* xorgLogTimer;
 
849
    QString xorgLogFile;
 
850
    QMutex xorgLogMutex;
 
851
#endif
 
852
    QString lastFreeServer;
 
853
    QString cardLogin;
 
854
    QTextEdit* stInfo;
 
855
    int localDisplayNumber;
 
856
 
 
857
    SVGFrame* ln;
 
858
    int tunnel;
 
859
    int sndTunnel;
 
860
    int fsTunnel;
 
861
    QList<x2goSession> selectedSessions;
 
862
    QStringList selectedDesktops;
 
863
    x2goSession resumingSession;
 
864
    bool startSound;
 
865
    bool restartResume;
 
866
    bool runRemoteCommand;
 
867
    bool shadowSession;
 
868
    int firstUid;
 
869
    int lastUid;
 
870
    QStringList sshEnv;
 
871
    QString agentPid;
 
872
    bool cardReady;
 
873
    HttpBrokerClient* broker;
 
874
 
 
875
 
 
876
#if defined ( Q_OS_WIN) //&& defined (CFGCLIENT )
 
877
    void xorgSettings();
 
878
    bool startXorgOnStart;
 
879
    bool useInternalX;
 
880
    enum {VCXSRV, XMING} internalX;
 
881
    QString xorgExe;
 
882
    QString xorgOptions;
 
883
    QString xorgWinOptions;
 
884
    QString xorgFSOptions;
 
885
    QString xorgSAppOptions;
 
886
    enum {WIN,FS,SAPP} xorgMode;
 
887
    QString xorgWidth;
 
888
    QString xorgHeight;
 
889
    int waitingForX;
 
890
    QRect dispGeometry;
 
891
#endif
 
892
 
 
893
#ifdef Q_OS_LINUX
 
894
    long image, shape;
 
895
#endif
 
896
 
 
897
    // Tray icon stuff based on patch from Joachim Langenbach <joachim@falaba.de>
 
898
    QSystemTrayIcon *trayIcon;
 
899
    QMenu *trayIconMenu;
 
900
    QMenu *trayIconActiveConnectionMenu;
 
901
 
 
902
    QAction* appSeparator;
 
903
    QMenu* appMenu[Application::OTHER+1];
 
904
 
 
905
    bool trayEnabled;
 
906
    bool trayMinToTray;
 
907
    bool trayNoclose;
 
908
    bool trayMinCon;
 
909
    bool trayMaxDiscon;
 
910
    bool trayAutoHidden;
 
911
 
 
912
    QString findSshKeyForServer(QString user, QString server, QString port);
 
913
    void loadSettings();
 
914
    void showPass ( UserButton* user );
 
915
    void clean();
 
916
    bool defaultSession;
 
917
    QString defaultSessionName;
 
918
    QString defaultSessionId;
 
919
    QString defaultUserName;
 
920
    bool defaultUser;
 
921
    QString getKdeIconsPath();
 
922
    QString findTheme ( QString theme );
 
923
    bool initLdapSession ( bool showBox=true );
 
924
    bool startSession ( const QString& id );
 
925
    x2goSession getSessionFromString ( const QString& string );
 
926
    void resumeSession ( const x2goSession& s );
 
927
    void selectSession ( QStringList& sessions );
 
928
    x2goSession getSelectedSession();
 
929
    bool parseParameter ( QString param );
 
930
    bool linkParameter ( QString value );
 
931
    bool clipboardParameter ( QString value );
 
932
    bool geometry_par ( QString value );
 
933
    bool setKbd_par ( QString value );
 
934
    bool ldapParameter ( QString value );
 
935
    bool ldap1Parameter ( QString value );
 
936
    bool ldap2Parameter ( QString value );
 
937
    bool packParameter ( QString value );
 
938
    bool soundParameter ( QString val );
 
939
    void printError ( QString param );
 
940
    void exportDefaultDirs();
 
941
    QString createRSAKey();
 
942
    directory* getExpDir ( QString key );
 
943
    bool findInList ( const QString& uid );
 
944
    void setUsersEnabled ( bool enable );
 
945
    void externalLogout ( const QString& logoutDir );
 
946
    void externalLogin ( const QString& loginDir );
 
947
    void startGPGAgent ( const QString& login,
 
948
                         const QString& appId );
 
949
    void closeClient();
 
950
    void continueNormalSession();
 
951
    void continueLDAPSession();
 
952
    SshMasterConnection* startSshConnection ( QString host, QString port,
 
953
            bool acceptUnknownHosts, QString login,
 
954
            QString password, bool autologin, bool krbLogin, bool getSrv=false, bool useproxy=false,
 
955
            SshMasterConnection::ProxyType type=SshMasterConnection::PROXYSSH,
 
956
            QString proxyserver=QString::null, quint16 proxyport=0,
 
957
            QString proxylogin=QString::null, QString proxypassword=QString::null, QString proxyKey=QString::null,
 
958
            bool proxyAutologin=false, bool proxyKrbLogin=false );
 
959
    void setProxyWinTitle();
 
960
    QRect proxyWinGeometry();
 
961
    void readApplications();
 
962
    void removeAppsFromTray();
 
963
    void plugAppsInTray();
 
964
    QMenu* initTrayAppMenu(QString text, QPixmap icon);
 
965
    void setTrayIconToSessionIcon(QString info);
 
966
 
 
967
 
 
968
protected:
 
969
    virtual void closeEvent ( QCloseEvent* event );
 
970
    virtual void hideEvent ( QHideEvent* event);
 
971
 
 
972
#ifndef Q_OS_WIN
 
973
    virtual void mouseReleaseEvent ( QMouseEvent * event );
 
974
#else
 
975
private slots:
 
976
    void slotSetWinServersReady();
 
977
    void startWinServers();
 
978
    void slotCheckXOrgLog();
 
979
    void slotCheckXOrgConnection();
 
980
    void slotCheckPulse();
 
981
    void slotStartParec ();
 
982
#endif
 
983
private slots:
 
984
    void slotAppDialog();
 
985
    void slotShowPassForm();
 
986
    void displayUsers();
 
987
    void slotAppMenuTriggered ( QAction * action );
 
988
    void slotPassChanged(const QString& result);
 
989
    void slotResize ( const QSize sz );
 
990
    void slotUnameChanged ( const QString& text );
 
991
    void slotPassEnter();
 
992
    void slotChangeBrokerPass();
 
993
    void slotTestConnection();
 
994
    void slotCheckPortableDir();
 
995
    void readUsers();
 
996
    void slotSelectedFromList ( UserButton* user );
 
997
    void slotUnameEntered();
 
998
    void slotClosePass();
 
999
    void slotReadSessions();
 
1000
    void slotManage();
 
1001
    void displayToolBar ( bool );
 
1002
    void showSessionStatus();
 
1003
    void slotSshConnectionError ( QString message, QString lastSessionError );
 
1004
    void slotSshServerAuthError ( int error, QString sshMessage, SshMasterConnection* connection );
 
1005
    void slotSshServerAuthPassphrase ( SshMasterConnection* connection, bool verificationCode );
 
1006
    void slotSshUserAuthError ( QString error );
 
1007
    void slotSshConnectionOk();
 
1008
    void slotServSshConnectionOk(QString server);
 
1009
    void slotChangeKbdLayout(const QString& layout);
 
1010
    void slotSyncX();
 
1011
    void slotShutdownThinClient();
 
1012
    void slotReadApplications(bool result, QString output, int pid );
 
1013
 
 
1014
public slots:
 
1015
    void slotConfig();
 
1016
    void slotNewSession();
 
1017
    void slotEmbedControlAction();
 
1018
    void slotDetachProxyWindow();
 
1019
    void slotActivateWindow();
 
1020
    void setFocus();
 
1021
 
 
1022
private slots:
 
1023
    void slotSnameChanged ( const QString& );
 
1024
    void slotSelectedFromList ( SessionButton* session );
 
1025
    void slotSessEnter();
 
1026
    void slotCloseSelectDlg();
 
1027
    void slotActivated ( const QModelIndex& index );
 
1028
    void slotResumeSess();
 
1029
    void slotSuspendSess();
 
1030
    void slotTermSessFromSt();
 
1031
    void slotSuspendSessFromSt();
 
1032
    void slotTermSess();
 
1033
    void slotNewSess();
 
1034
    void slotGetBrokerAuth();
 
1035
    void slotGetBrokerSession();
 
1036
    void slotCmdMessage ( bool result,QString output,
 
1037
                          int );
 
1038
    void slotListSessions ( bool result,QString output,
 
1039
                            int );
 
1040
    void slotRetSuspSess ( bool value,QString message,
 
1041
                           int );
 
1042
    void slotRetTermSess ( bool result,QString output,
 
1043
                           int );
 
1044
    void slotRetResumeSess ( bool result,QString output,
 
1045
                             int );
 
1046
    void slotTunnelFailed ( bool result,QString output,
 
1047
                            int );
 
1048
    void slotFsTunnelFailed ( bool result,QString output,
 
1049
                              int );
 
1050
    void slotSndTunnelFailed ( bool result,QString output,
 
1051
                               int );
 
1052
    void slotCopyKey ( bool result,QString output,int );
 
1053
    void slotTunnelOk(int );
 
1054
    void slotFsTunnelOk(int );
 
1055
    void slotProxyError ( QProcess::ProcessError err );
 
1056
    void slotProxyFinished ( int result,QProcess::ExitStatus st );
 
1057
    void slotProxyStderr();
 
1058
    void slotProxyStdout();
 
1059
    void slotResumeDoubleClick ( const QModelIndex& );
 
1060
    void slotShowAdvancedStat();
 
1061
    void slotRestartProxy();
 
1062
    void slotTestSessionStatus();
 
1063
    void slotRetRunCommand ( bool result, QString output,
 
1064
                             int );
 
1065
    void slotGetServers ( bool result, QString output,
 
1066
                          int );
 
1067
    void slotListAllSessions ( bool result,QString output,
 
1068
                               int );
 
1069
    void slotRetExportDir ( bool result,QString output,
 
1070
                            int );
 
1071
    void slotResize();
 
1072
    void slotExportDirectory();
 
1073
    void slotExportTimer();
 
1074
    void slotAboutQt();
 
1075
    void slotAbout();
 
1076
    void slotSupport();
 
1077
 
 
1078
    //trayIcon stuff
 
1079
    void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
 
1080
    void trayMessageClicked();
 
1081
    void trayQuit();
 
1082
    void trayIconInit();
 
1083
 
 
1084
 
 
1085
private slots:
 
1086
    void slotSetProxyWinFullscreen();
 
1087
    void slotCheckPrintSpool();
 
1088
    void slotRereadUsers();
 
1089
    void slotExtTimer();
 
1090
    void slotStartPGPAuth();
 
1091
    void slotScDaemonOut();
 
1092
    void slotScDaemonError();
 
1093
    void slotGpgFinished ( int exitCode,
 
1094
                           QProcess::ExitStatus exitStatus );
 
1095
    void slotScDaemonFinished ( int exitCode,
 
1096
                                QProcess::ExitStatus exitStatus );
 
1097
    void slotGpgError();
 
1098
    void slotCheckScDaemon();
 
1099
    void slotGpgAgentFinished ( int exitCode,
 
1100
                                QProcess::ExitStatus exitStatus );
 
1101
    void slotCheckAgentProcess();
 
1102
    void slotExecXmodmap();
 
1103
    void slotCreateSessionIcon();
 
1104
    void slotFindProxyWin();
 
1105
    void slotConfigXinerama();
 
1106
    void slotXineramaConfigured();
 
1107
    void slotAttachProxyWindow();
 
1108
    void slotEmbedIntoParentWindow();
 
1109
    void slotEmbedWindow();
 
1110
    void slotSndTunOk();
 
1111
    void slotPCookieReady (     bool result,QString output,
 
1112
                            int proc );
 
1113
    void slotEmbedToolBar();
 
1114
    void slotEmbedToolBarToolTip();
 
1115
    void slotHideEmbedToolBarToolTip();
 
1116
    void slotDesktopFilterChanged ( const QString& text ) ;
 
1117
    void slotDesktopFilterCb ( int state ) ;
 
1118
    void slotShadowViewSess();
 
1119
    void slotShadowSess();
 
1120
    void slotReconnectSession();
 
1121
    void slotStartBroker();
 
1122
    void slotStartNewBrokerSession ();
 
1123
#ifdef Q_OS_DARWIN
 
1124
    void slotSetModMap();
 
1125
private:
 
1126
    QTimer* modMapTimer;
 
1127
    QString kbMap;
 
1128
#endif
 
1129
 
 
1130
private:
 
1131
    void resizeProxyWinOnDisplay(int display);
 
1132
#ifdef Q_OS_LINUX
 
1133
    long X11FindWindow ( QString text, long rootWin=0 );
 
1134
#endif
 
1135
    void addToAppNames ( QString intName, QString transName );
 
1136
    bool checkAgentProcess();
 
1137
    bool isColorDepthOk ( int disp, int sess );
 
1138
    void check_cmd_status();
 
1139
    int startSshFsTunnel();
 
1140
    void startX2goMount();
 
1141
    void cleanPrintSpool();
 
1142
    void cleanAskPass();
 
1143
    void initWidgetsEmbed();
 
1144
    void initWidgetsNormal();
 
1145
    QString getCurrentUname();
 
1146
    QString getCurrentPass();
 
1147
    void processSessionConfig();
 
1148
    void processCfgLine ( QString line );
 
1149
    void initSelectSessDlg();
 
1150
    void initStatusDlg();
 
1151
    void initPassDlg();
 
1152
    void printSshDError_startupFailure();
 
1153
    void printSshDError_noHostPubKey();
 
1154
    void printSshDError_noExportPubKey();
 
1155
    void printSshDError_noAuthorizedKeysFile();
 
1156
    void loadPulseModuleNativeProtocol();
 
1157
    void initEmbedToolBar();
 
1158
#ifdef Q_OS_LINUX
 
1159
    void startDirectRDP();
 
1160
#endif
 
1161
    void filterDesktops ( const QString& filter,
 
1162
                          bool strict=false );
 
1163
    void generateHostDsaKey();
 
1164
    void generateEtcFiles();
 
1165
    QString u3DataPath();
 
1166
    void cleanPortable();
 
1167
    void removeDir ( QString path );
 
1168
#ifdef Q_OS_WIN
 
1169
    void saveCygnusSettings();
 
1170
    void restoreCygnusSettings();
 
1171
#endif
 
1172
#if defined  (Q_OS_WIN) || defined (Q_OS_DARWIN)
 
1173
    QString getXDisplay();
 
1174
#endif
 
1175
 
 
1176
////////////////plugin stuff////////////////////
 
1177
#ifdef CFGPLUGIN
 
1178
public slots:
 
1179
    void setX2goconfig ( const QString& text );
 
1180
public:
 
1181
    QString x2goconfig() const
 
1182
    {
 
1183
        return m_x2goconfig;
 
1184
    }
 
1185
 
 
1186
#ifndef Q_OS_DARWIN
 
1187
public:
 
1188
    void embedWindow ( long wndId );
 
1189
    void detachClient();
 
1190
private:
 
1191
    long parentId;
 
1192
    long childId;
 
1193
    QSize oldParentSize;
 
1194
 
 
1195
#ifdef Q_OS_LINUX
 
1196
    QX11EmbedContainer* embedContainer;
 
1197
#endif
 
1198
#ifdef Q_OS_WIN
 
1199
    QWidget* embedContainer;
 
1200
    QPoint oldParentPos;
 
1201
    QPoint oldChildPos;
 
1202
    QSize oldContainerSize;
 
1203
    QTimer *updateTimer;
 
1204
    int gcor;
 
1205
    long winFlags;
 
1206
#endif
 
1207
private:
 
1208
    QSize getWindowSize ( long winId );
 
1209
    void doPluginInit();
 
1210
 
 
1211
#ifdef Q_OS_WIN
 
1212
private slots:
 
1213
    void slotUpdateEmbedWindow();
 
1214
#endif
 
1215
 
 
1216
#endif //(Q_OS_DARWIN)
 
1217
#endif
 
1218
////////////////end of plugin stuff////////////////////
 
1219
};
 
1220
 
 
1221
#endif