The branch, master has been updated via 3cc2704301afd08ed3202af04e12e92c85578b04 (commit) from 63121e5ae383ee304fdd93824fd9889d1975b330 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3cc2704301afd08ed3202af04e12e92c85578b04 Author: Oleksandr Shneyder <oleksandr.shneyder@treuchtlingen.de> Date: Tue Dec 27 12:01:33 2011 +0100 changing proxywin title and icon, multi display support * changing title of proxy window to session name * changing icon of proxy window (only on Linux) * multi display support: x2goclient can be configured to fit proxy window on one of the existing displays * multi display support: support for xinerama (temporary disabled - support in x2goagent needed) ----------------------------------------------------------------------- Summary of changes: debian/changelog | 8 +- object_script.npx2goplugin.Debug | 58 --- object_script.npx2goplugin.Release | 58 --- object_script.x2goclient.Debug | 64 --- object_script.x2goclient.Release | 64 --- object_script.x2goplugin.Debug | 57 --- object_script.x2goplugin.Release | 57 --- onmainwindow.cpp | 488 ++++++++++---------- onmainwindow.h | 35 +- onmainwindow_part2.cpp | 18 +- onmainwindow_part3.cpp | 2 +- onmainwindow_part4.cpp | 266 ++++++++++- onmainwindow_privat.h | 2 + sessionbutton.cpp | 116 +++-- sessionbutton.h | 109 +++-- sessionwidget.cpp | 12 +- sessionwidget.h | 1 + settingswidget.cpp | 925 ++++++++++++++++++++---------------- settingswidget.h | 94 ++-- sshmasterconnection.cpp | 39 ++- sshmasterconnection.h | 36 ++- version.h | 2 +- wapi.cpp | 727 ++++++++++++++++------------- wapi.h | 35 +- x2goclient.pro | 6 +- x2goplugin.rc | 10 +- 26 files changed, 1756 insertions(+), 1533 deletions(-) delete mode 100644 object_script.npx2goplugin.Debug delete mode 100644 object_script.npx2goplugin.Release delete mode 100644 object_script.x2goclient.Debug delete mode 100644 object_script.x2goclient.Release delete mode 100644 object_script.x2goplugin.Debug delete mode 100644 object_script.x2goplugin.Release mode change 100644 => 100755 x2goclient.pro The diff of changes is: diff --git a/debian/changelog b/debian/changelog index 276b560..fc972be 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -x2goclient (3.99.0.3-0~x2go1) UNRELEASED; urgency=low +x2goclient (3.99.0.3-0~x2go4) UNRELEASED; urgency=low [ Mike Gabriel ] * New upstream version (3.99.0.3): @@ -12,8 +12,12 @@ x2goclient (3.99.0.3-0~x2go1) UNRELEASED; urgency=low [ Oleksandr Shneyder ] * New upstream version (3.99.0.2): - LDAP: ssh port for every x2goserver can be specified in Server entry, parameter "l" + * changing title of proxy window to session name + * changing icon of proxy window (only on Linux) + * multi display support: x2goclient can be configured to fit proxy window on one of the existing displays + * multi display support: support for xinerama (temporary disabled - support in x2goagent needed) - -- Oleksandr Shneyder <oleksandr.shneyder@treuchtlingen.de> Fri, 25 Nov 2011 13:01:01 +0100 + -- Oleksandr Shneyder <oleksandr.shneyder@treuchtlingen.de> Tue, 27 Dec 2011 11:49:29 +0100 x2goclient (3.99.0.2-0~x2go1) unstable; urgency=low diff --git a/object_script.npx2goplugin.Debug b/object_script.npx2goplugin.Debug deleted file mode 100644 index 2e85c85..0000000 --- a/object_script.npx2goplugin.Debug +++ /dev/null @@ -1,58 +0,0 @@ -INPUT( -./debug/sharewidget.o -./debug/settingswidget.o -./debug/configwidget.o -./debug/sessionwidget.o -./debug/connectionwidget.o -./debug/configdialog.o -./debug/editconnectiondialog.o -./debug/exportdialog.o -./debug/imgframe.o -./debug/LDAPSession.o -./debug/onmainwindow.o -./debug/sessionbutton.o -./debug/sessionmanagedialog.o -./debug/sshmasterconnection.o -./debug/sshprocess.o -./debug/SVGFrame.o -./debug/userbutton.o -./debug/x2gologdebug.o -./debug/printprocess.o -./debug/cupsprint.o -./debug/cupsprintwidget.o -./debug/cupsprintersettingsdialog.o -./debug/printwidget.o -./debug/printercmddialog.o -./debug/printdialog.o -./debug/wapi.o -./debug/clicklineedit.o -./debug/httpbrokerclient.o -./debug/ongetpass.o -./debug/x2gosettings.o -./debug/qtbrowserplugin.o -./debug/qtbrowserplugin_win.o -./debug/moc_configdialog.o -./debug/moc_editconnectiondialog.o -./debug/moc_exportdialog.o -./debug/moc_imgframe.o -./debug/moc_onmainwindow.o -./debug/moc_sessionbutton.o -./debug/moc_sessionmanagedialog.o -./debug/moc_sshmasterconnection.o -./debug/moc_sshprocess.o -./debug/moc_SVGFrame.o -./debug/moc_userbutton.o -./debug/moc_printprocess.o -./debug/moc_cupsprintwidget.o -./debug/moc_cupsprintersettingsdialog.o -./debug/moc_printwidget.o -./debug/moc_printercmddialog.o -./debug/moc_printdialog.o -./debug/moc_sessionwidget.o -./debug/moc_connectionwidget.o -./debug/moc_settingswidget.o -./debug/moc_sharewidget.o -./debug/moc_clicklineedit.o -./debug/moc_httpbrokerclient.o -./debug/qrc_resources.o -); diff --git a/object_script.npx2goplugin.Release b/object_script.npx2goplugin.Release deleted file mode 100644 index 68a5ff0..0000000 --- a/object_script.npx2goplugin.Release +++ /dev/null @@ -1,58 +0,0 @@ -INPUT( -./release/sharewidget.o -./release/settingswidget.o -./release/configwidget.o -./release/sessionwidget.o -./release/connectionwidget.o -./release/configdialog.o -./release/editconnectiondialog.o -./release/exportdialog.o -./release/imgframe.o -./release/LDAPSession.o -./release/onmainwindow.o -./release/sessionbutton.o -./release/sessionmanagedialog.o -./release/sshmasterconnection.o -./release/sshprocess.o -./release/SVGFrame.o -./release/userbutton.o -./release/x2gologdebug.o -./release/printprocess.o -./release/cupsprint.o -./release/cupsprintwidget.o -./release/cupsprintersettingsdialog.o -./release/printwidget.o -./release/printercmddialog.o -./release/printdialog.o -./release/wapi.o -./release/clicklineedit.o -./release/httpbrokerclient.o -./release/ongetpass.o -./release/x2gosettings.o -./release/qtbrowserplugin.o -./release/qtbrowserplugin_win.o -./release/moc_configdialog.o -./release/moc_editconnectiondialog.o -./release/moc_exportdialog.o -./release/moc_imgframe.o -./release/moc_onmainwindow.o -./release/moc_sessionbutton.o -./release/moc_sessionmanagedialog.o -./release/moc_sshmasterconnection.o -./release/moc_sshprocess.o -./release/moc_SVGFrame.o -./release/moc_userbutton.o -./release/moc_printprocess.o -./release/moc_cupsprintwidget.o -./release/moc_cupsprintersettingsdialog.o -./release/moc_printwidget.o -./release/moc_printercmddialog.o -./release/moc_printdialog.o -./release/moc_sessionwidget.o -./release/moc_connectionwidget.o -./release/moc_settingswidget.o -./release/moc_sharewidget.o -./release/moc_clicklineedit.o -./release/moc_httpbrokerclient.o -./release/qrc_resources.o -); diff --git a/object_script.x2goclient.Debug b/object_script.x2goclient.Debug deleted file mode 100644 index 8c972be..0000000 --- a/object_script.x2goclient.Debug +++ /dev/null @@ -1,64 +0,0 @@ -INPUT( -./debug\sharewidget.o -./debug\settingswidget.o -./debug\configwidget.o -./debug\sessionwidget.o -./debug\connectionwidget.o -./debug\configdialog.o -./debug\editconnectiondialog.o -./debug\exportdialog.o -./debug\imgframe.o -./debug\LDAPSession.o -./debug\onmainwindow.o -./debug\onmainwindow_part2.o -./debug\onmainwindow_part3.o -./debug\onmainwindow_part4.o -./debug\sessionbutton.o -./debug\sessionmanagedialog.o -./debug\sshmasterconnection.o -./debug\sshprocess.o -./debug\SVGFrame.o -./debug\userbutton.o -./debug\x2gologdebug.o -./debug\printprocess.o -./debug\cupsprint.o -./debug\cupsprintwidget.o -./debug\cupsprintersettingsdialog.o -./debug\printwidget.o -./debug\printercmddialog.o -./debug\printdialog.o -./debug\wapi.o -./debug\clicklineedit.o -./debug\httpbrokerclient.o -./debug\ongetpass.o -./debug\x2gosettings.o -./debug\brokerpassdlg.o -./debug\xsettingswidget.o -./debug\x2goclient.o -./debug\moc_configdialog.o -./debug\moc_editconnectiondialog.o -./debug\moc_exportdialog.o -./debug\moc_imgframe.o -./debug\moc_onmainwindow.o -./debug\moc_sessionbutton.o -./debug\moc_sessionmanagedialog.o -./debug\moc_sshmasterconnection.o -./debug\moc_sshprocess.o -./debug\moc_SVGFrame.o -./debug\moc_userbutton.o -./debug\moc_printprocess.o -./debug\moc_cupsprintwidget.o -./debug\moc_cupsprintersettingsdialog.o -./debug\moc_printwidget.o -./debug\moc_printercmddialog.o -./debug\moc_printdialog.o -./debug\moc_sessionwidget.o -./debug\moc_connectionwidget.o -./debug\moc_settingswidget.o -./debug\moc_sharewidget.o -./debug\moc_clicklineedit.o -./debug\moc_httpbrokerclient.o -./debug\moc_brokerpassdlg.o -./debug\moc_xsettingswidget.o -./debug\qrc_resources.o -); diff --git a/object_script.x2goclient.Release b/object_script.x2goclient.Release deleted file mode 100644 index 74e0753..0000000 --- a/object_script.x2goclient.Release +++ /dev/null @@ -1,64 +0,0 @@ -INPUT( -./release\sharewidget.o -./release\settingswidget.o -./release\configwidget.o -./release\sessionwidget.o -./release\connectionwidget.o -./release\configdialog.o -./release\editconnectiondialog.o -./release\exportdialog.o -./release\imgframe.o -./release\LDAPSession.o -./release\onmainwindow.o -./release\onmainwindow_part2.o -./release\onmainwindow_part3.o -./release\onmainwindow_part4.o -./release\sessionbutton.o -./release\sessionmanagedialog.o -./release\sshmasterconnection.o -./release\sshprocess.o -./release\SVGFrame.o -./release\userbutton.o -./release\x2gologdebug.o -./release\printprocess.o -./release\cupsprint.o -./release\cupsprintwidget.o -./release\cupsprintersettingsdialog.o -./release\printwidget.o -./release\printercmddialog.o -./release\printdialog.o -./release\wapi.o -./release\clicklineedit.o -./release\httpbrokerclient.o -./release\ongetpass.o -./release\x2gosettings.o -./release\brokerpassdlg.o -./release\xsettingswidget.o -./release\x2goclient.o -./release\moc_configdialog.o -./release\moc_editconnectiondialog.o -./release\moc_exportdialog.o -./release\moc_imgframe.o -./release\moc_onmainwindow.o -./release\moc_sessionbutton.o -./release\moc_sessionmanagedialog.o -./release\moc_sshmasterconnection.o -./release\moc_sshprocess.o -./release\moc_SVGFrame.o -./release\moc_userbutton.o -./release\moc_printprocess.o -./release\moc_cupsprintwidget.o -./release\moc_cupsprintersettingsdialog.o -./release\moc_printwidget.o -./release\moc_printercmddialog.o -./release\moc_printdialog.o -./release\moc_sessionwidget.o -./release\moc_connectionwidget.o -./release\moc_settingswidget.o -./release\moc_sharewidget.o -./release\moc_clicklineedit.o -./release\moc_httpbrokerclient.o -./release\moc_brokerpassdlg.o -./release\moc_xsettingswidget.o -./release\qrc_resources.o -); diff --git a/object_script.x2goplugin.Debug b/object_script.x2goplugin.Debug deleted file mode 100644 index af4d381..0000000 --- a/object_script.x2goplugin.Debug +++ /dev/null @@ -1,57 +0,0 @@ -INPUT( -./debug/sharewidget.o -./debug/settingswidget.o -./debug/configwidget.o -./debug/sessionwidget.o -./debug/connectionwidget.o -./debug/configdialog.o -./debug/editconnectiondialog.o -./debug/exportdialog.o -./debug/imgframe.o -./debug/LDAPSession.o -./debug/onmainwindow.o -./debug/sessionbutton.o -./debug/sessionmanagedialog.o -./debug/sshmasterconnection.o -./debug/sshprocess.o -./debug/SVGFrame.o -./debug/userbutton.o -./debug/x2gologdebug.o -./debug/printprocess.o -./debug/cupsprint.o -./debug/cupsprintwidget.o -./debug/cupsprintersettingsdialog.o -./debug/printwidget.o -./debug/printercmddialog.o -./debug/printdialog.o -./debug/embedwidget.o -./debug/wapi.o -./debug/clicklineedit.o -./debug/httpbrokerclient.o -./debug/ongetpass.o -./debug/x2gosettings.o -./debug/moc_configdialog.o -./debug/moc_editconnectiondialog.o -./debug/moc_exportdialog.o -./debug/moc_imgframe.o -./debug/moc_onmainwindow.o -./debug/moc_sessionbutton.o -./debug/moc_sessionmanagedialog.o -./debug/moc_sshmasterconnection.o -./debug/moc_sshprocess.o -./debug/moc_SVGFrame.o -./debug/moc_userbutton.o -./debug/moc_printprocess.o -./debug/moc_cupsprintwidget.o -./debug/moc_cupsprintersettingsdialog.o -./debug/moc_printwidget.o -./debug/moc_printercmddialog.o -./debug/moc_printdialog.o -./debug/moc_sessionwidget.o -./debug/moc_connectionwidget.o -./debug/moc_settingswidget.o -./debug/moc_sharewidget.o -./debug/moc_clicklineedit.o -./debug/moc_httpbrokerclient.o -./debug/qrc_resources.o -); diff --git a/object_script.x2goplugin.Release b/object_script.x2goplugin.Release deleted file mode 100644 index 39406a3..0000000 --- a/object_script.x2goplugin.Release +++ /dev/null @@ -1,57 +0,0 @@ -INPUT( -./release/sharewidget.o -./release/settingswidget.o -./release/configwidget.o -./release/sessionwidget.o -./release/connectionwidget.o -./release/configdialog.o -./release/editconnectiondialog.o -./release/exportdialog.o -./release/imgframe.o -./release/LDAPSession.o -./release/onmainwindow.o -./release/sessionbutton.o -./release/sessionmanagedialog.o -./release/sshmasterconnection.o -./release/sshprocess.o -./release/SVGFrame.o -./release/userbutton.o -./release/x2gologdebug.o -./release/printprocess.o -./release/cupsprint.o -./release/cupsprintwidget.o -./release/cupsprintersettingsdialog.o -./release/printwidget.o -./release/printercmddialog.o -./release/printdialog.o -./release/embedwidget.o -./release/wapi.o -./release/clicklineedit.o -./release/httpbrokerclient.o -./release/ongetpass.o -./release/x2gosettings.o -./release/moc_configdialog.o -./release/moc_editconnectiondialog.o -./release/moc_exportdialog.o -./release/moc_imgframe.o -./release/moc_onmainwindow.o -./release/moc_sessionbutton.o -./release/moc_sessionmanagedialog.o -./release/moc_sshmasterconnection.o -./release/moc_sshprocess.o -./release/moc_SVGFrame.o -./release/moc_userbutton.o -./release/moc_printprocess.o -./release/moc_cupsprintwidget.o -./release/moc_cupsprintersettingsdialog.o -./release/moc_printwidget.o -./release/moc_printercmddialog.o -./release/moc_printdialog.o -./release/moc_sessionwidget.o -./release/moc_connectionwidget.o -./release/moc_settingswidget.o -./release/moc_sharewidget.o -./release/moc_clicklineedit.o -./release/moc_httpbrokerclient.o -./release/qrc_resources.o -); diff --git a/onmainwindow.cpp b/onmainwindow.cpp index b7f54cd..81dce94 100644 --- a/onmainwindow.cpp +++ b/onmainwindow.cpp @@ -45,6 +45,9 @@ QString ONMainWindow::u3Device; ONMainWindow::ONMainWindow ( QWidget *parent ) :QMainWindow ( parent ) { +#ifdef Q_OS_LINUX + image=shape=0; +#endif x2goDebug<<"ONMainWindow constructor"<<endl; setFocusPolicy ( Qt::StrongFocus ); installTranslator(); @@ -212,7 +215,7 @@ ONMainWindow::ONMainWindow ( QWidget *parent ) :QMainWindow ( parent ) homeDir=portableDataPath; x2goDebug<<"running in \"portable\" mode\n"<< "Data Dir is "<<portableDataPath; - QTimer *timer = new QTimer(this); + QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(slotCheckPortableDir())); timer->start(1000); } @@ -266,10 +269,10 @@ ONMainWindow::ONMainWindow ( QWidget *parent ) :QMainWindow ( parent ) #ifndef Q_WS_HILDON - if(BGFile.size()) - bgFrame=new SVGFrame ( ( QString ) BGFile,true,fr ); + if (BGFile.size()) + bgFrame=new SVGFrame ( ( QString ) BGFile,true,fr ); else - bgFrame=new SVGFrame ( ( QString ) ":/svg/bg.svg",true,fr ); + bgFrame=new SVGFrame ( ( QString ) ":/svg/bg.svg",true,fr ); #else bgFrame=new SVGFrame ( ( QString ) ":/svg/bg_hildon.svg",true,fr ); #endif @@ -324,18 +327,18 @@ ONMainWindow::ONMainWindow ( QWidget *parent ) :QMainWindow ( parent ) act_set=new QAction ( QIcon ( iconsPath ( "/32x32/edit_settings.png" ) ), tr ( "&Settings ..." ),this ); - - if(supportMenuFile!=QString::null) + + if (supportMenuFile!=QString::null) { act_support=new QAction ( tr ( "Support ..." ),this ); connect ( act_support,SIGNAL ( triggered ( bool ) ),this, - SLOT ( slotSupport() ) ); - + SLOT ( slotSupport() ) ); + } - + act_abclient=new QAction ( QIcon ( ":icons/32x32/x2goclient.png" ), tr ( "About X2GO client" ),this ); - + @@ -378,6 +381,8 @@ ONMainWindow::ONMainWindow ( QWidget *parent ) :QMainWindow ( parent ) #endif + + mainL->setSpacing ( 0 ); mainL->setMargin ( 0 ); mainL->insertWidget ( 0, bgFrame ); @@ -386,26 +391,32 @@ ONMainWindow::ONMainWindow ( QWidget *parent ) :QMainWindow ( parent ) connect ( fr,SIGNAL ( resized ( const QSize ) ),this, SLOT ( slotResize ( const QSize ) ) ); slotResize ( fr->size() ); - - if(brokerMode) - { - broker=new HttpBrokerClient ( this, &config ); - connect ( broker,SIGNAL ( haveSshKey ( QString ) ),this, - SLOT ( slotStartSshAgent ( QString ) ) ); - connect ( broker,SIGNAL ( haveAgentInfo () ),this, - SLOT ( slotStartNewBrokerSession () ) ); - connect ( broker,SIGNAL ( fatalHttpError() ),this, - SLOT ( close() ) ); - connect ( broker,SIGNAL ( cmdReconnect() ),this, - SLOT ( slotReconnectSession() ) ); - connect ( broker, SIGNAL ( authFailed()), this ,SLOT ( slotGetBrokerAuth())); - connect ( broker, SIGNAL( sessionsLoaded()), this, SLOT (slotReadSessions())); - connect ( broker, SIGNAL ( getSession(QString)), this, SLOT (slotGetBrokerSession(QString))); - connect ( broker, SIGNAL ( passwordChanged(QString)), this, SLOT ( slotPassChanged(QString))); - + if (brokerMode) + { + broker=new HttpBrokerClient ( this, &config ); + connect ( broker,SIGNAL ( haveSshKey ( QString ) ),this, + SLOT ( slotStartSshAgent ( QString ) ) ); + connect ( broker,SIGNAL ( haveAgentInfo () ),this, + SLOT ( slotStartNewBrokerSession () ) ); + connect ( broker,SIGNAL ( fatalHttpError() ),this, + SLOT ( close() ) ); + connect ( broker,SIGNAL ( cmdReconnect() ),this, + SLOT ( slotReconnectSession() ) ); + connect ( broker, SIGNAL ( authFailed()), this ,SLOT ( slotGetBrokerAuth())); + connect ( broker, SIGNAL( sessionsLoaded()), this, SLOT (slotReadSessions())); + connect ( broker, SIGNAL ( getSession(QString)), this, SLOT (slotGetBrokerSession(QString))); + connect ( broker, SIGNAL ( passwordChanged(QString)), this, SLOT ( slotPassChanged(QString))); } - + + proxyWinTimer=new QTimer ( this ); + connect ( proxyWinTimer, SIGNAL ( timeout() ), this, + SLOT ( slotFindProxyWin() ) ); + + xineramaTimer=new QTimer (this); + + connect( xineramaTimer, SIGNAL(timeout()), this, SLOT(slotConfigXinerama())); + x2goDebug<<"ONMainWindows constructor finished, home Directory is:"<<homeDir<<endl; } @@ -468,9 +479,6 @@ void ONMainWindow::initWidgetsEmbed() #ifndef Q_OS_WIN statusBar()->hide(); #endif - proxyWinTimer=new QTimer ( this ); - connect ( proxyWinTimer, SIGNAL ( timeout() ), this, - SLOT ( slotFindProxyWin() ) ); act_shareFolder=new QAction ( QIcon ( ":icons/32x32/file-open.png" ), @@ -664,39 +672,39 @@ void ONMainWindow::initWidgetsNormal() act_edit=new QAction ( QIcon ( iconsPath ( "/32x32/edit.png" ) ), tr ( "Session management..." ),this ); act_edit->setShortcut ( tr ( "Ctrl+E" ) ); - - if(noSessionEdit) + + if (noSessionEdit) { - act_edit->setEnabled(false); - act_new->setEnabled(false); + act_edit->setEnabled(false); + act_new->setEnabled(false); } act_sessicon=new QAction ( QIcon ( iconsPath ( "/32x32/create_file.png" ) ), tr ( "&Create session icon on desktop..." ), this ); - if(brokerMode) - act_sessicon->setEnabled(false); - - if(changeBrokerPass) - { - act_changeBrokerPass=new QAction ( - QIcon ( iconsPath ( "/32x32/auth.png" ) ), - tr ( "&Set broker password..." ), - this ); - connect ( act_changeBrokerPass,SIGNAL ( triggered(bool)),this, - SLOT ( slotChangeBrokerPass()) ); - act_changeBrokerPass->setEnabled(false); + if (brokerMode) + act_sessicon->setEnabled(false); + + if (changeBrokerPass) + { + act_changeBrokerPass=new QAction ( + QIcon ( iconsPath ( "/32x32/auth.png" ) ), + tr ( "&Set broker password..." ), + this ); + connect ( act_changeBrokerPass,SIGNAL ( triggered(bool)),this, + SLOT ( slotChangeBrokerPass()) ); + act_changeBrokerPass->setEnabled(false); } - - if(connTest) + + if (connTest) { - act_testCon=new QAction ( - QIcon ( iconsPath ( "/32x32/contest.png" ) ), - tr ( "&Connectivity test..." ), - this ); - connect ( act_testCon,SIGNAL ( triggered(bool)),this, - SLOT ( slotTestConnection()) ); + act_testCon=new QAction ( + QIcon ( iconsPath ( "/32x32/contest.png" ) ), + tr ( "&Connectivity test..." ), + this ); + connect ( act_testCon,SIGNAL ( triggered(bool)),this, + SLOT ( slotTestConnection()) ); } @@ -720,7 +728,7 @@ void ONMainWindow::initWidgetsNormal() SLOT ( trayQuit()) ) ; connect ( act_tb,SIGNAL ( toggled ( bool ) ),this, SLOT ( displayToolBar ( bool ) ) ); - + stb=addToolBar ( tr ( "Show toolbar" ) ); QShortcut* ex=new QShortcut ( QKeySequence ( tr ( "Ctrl+Q","exit" ) ), @@ -731,45 +739,45 @@ void ONMainWindow::initWidgetsNormal() { QMenu* menu_sess=menuBar()->addMenu ( tr ( "&Session" ) ); QMenu* menu_opts=menuBar()->addMenu ( tr ( "&Options" ) ); - if(!brokerMode) + if (!brokerMode) { - menu_sess->addAction ( act_new ); - menu_sess->addAction ( act_edit ); + menu_sess->addAction ( act_new ); + menu_sess->addAction ( act_edit ); #if (!defined Q_WS_HILDON) && (!defined Q_OS_DARWIN) - if ( !portable ) - menu_sess->addAction ( act_sessicon ); + if ( !portable ) + menu_sess->addAction ( act_sessicon ); #endif - menu_sess->addSeparator(); - } + menu_sess->addSeparator(); + } menu_sess->addAction ( act_exit ); menu_opts->addAction ( act_set ); menu_opts->addAction ( act_tb ); - if(changeBrokerPass) - menu_opts->addAction(act_changeBrokerPass); - if(connTest) - menu_opts->addAction(act_testCon); + if (changeBrokerPass) + menu_opts->addAction(act_changeBrokerPass); + if (connTest) + menu_opts->addAction(act_testCon); QMenu* menu_help=menuBar()->addMenu ( tr ( "&Help" ) ); - if(supportMenuFile!=QString::null) - menu_help->addAction ( act_support ); + if (supportMenuFile!=QString::null) + menu_help->addAction ( act_support ); menu_help->addAction ( act_abclient ); menu_help->addAction ( act_abqt ); - if(!brokerMode) - { - stb->addAction ( act_new ); - stb->addAction ( act_edit ); + if (!brokerMode) + { + stb->addAction ( act_new ); + stb->addAction ( act_edit ); #if (!defined Q_WS_HILDON) && (!defined Q_OS_DARWIN) - if ( !portable ) - stb->addAction ( act_sessicon ); + if ( !portable ) + stb->addAction ( act_sessicon ); #endif - stb->addSeparator(); - } + stb->addSeparator(); + } stb->addAction ( act_set ); - if(changeBrokerPass) - stb->addAction(act_changeBrokerPass); - if(connTest) - stb->addAction(act_testCon); + if (changeBrokerPass) + stb->addAction(act_changeBrokerPass); + if (connTest) + stb->addAction(act_testCon); if ( !showToolBar ) stb->hide(); @@ -793,117 +801,107 @@ void ONMainWindow::initWidgetsNormal() } else { - if(!brokerMode) - QTimer::singleShot ( 1, this, SLOT ( slotReadSessions() ) ); - else - { - QTimer::singleShot(1, this,SLOT(slotGetBrokerAuth())); - } - } -/* QTimer* t=new QTimer ( this ); - connect ( t,SIGNAL ( timeout() ),this,SLOT ( slotRereadUsers() ) ); - t->start ( 20000 ); -*/ -#ifdef Q_OS_WIN - proxyWinTimer=new QTimer ( this ); - connect ( proxyWinTimer, SIGNAL ( timeout() ), this, - SLOT ( slotFindProxyWin() ) ); -#endif - + if (!brokerMode) + QTimer::singleShot ( 1, this, SLOT ( slotReadSessions() ) ); + else + { + QTimer::singleShot(1, this,SLOT(slotGetBrokerAuth())); + } + } } void ONMainWindow::slotPassChanged(const QString& result) { - - if(result==QString::null) - { - QMessageBox::critical(this, tr("Error"),tr("Operation failed")); - } - else - { - QMessageBox::information(this, tr("Password changed"),tr("Password changed")); - config.brokerPass=result; - } - setEnabled(true); - - slotClosePass(); - sessionStatusDlg->hide(); - + + if (result==QString::null) + { + QMessageBox::critical(this, tr("Error"),tr("Operation failed")); + } + else + { + QMessageBox::information(this, tr("Password changed"),tr("Password changed")); + config.brokerPass=result; + } + setEnabled(true); + + slotClosePass(); + sessionStatusDlg->hide(); + } void ONMainWindow::slotTestConnection() { - ConTest test( broker, config.brokerurl, this); - test.exec(); + ConTest test( broker, config.brokerurl, this); + test.exec(); } void ONMainWindow::slotChangeBrokerPass() { - x2goDebug<<"change broker pass"; - BrokerPassDlg passDlg; - if(passDlg.exec()!=QDialog::Accepted) - return; - if(passDlg.oldPass()!=config.brokerPass) - { - QMessageBox::critical(this,tr("Error"),tr("Wrong password!")); + x2goDebug<<"change broker pass"; + BrokerPassDlg passDlg; + if (passDlg.exec()!=QDialog::Accepted) + return; + if (passDlg.oldPass()!=config.brokerPass) + { + QMessageBox::critical(this,tr("Error"),tr("Wrong password!")); + return; + } + broker->changePassword(passDlg.newPass()); + setStatStatus ( tr ( "Connecting to broker" ) ); + stInfo->insertPlainText ( "broker url: "+config.brokerurl ); + setEnabled ( false ); + uname->hide(); + u->hide(); return; - } - broker->changePassword(passDlg.newPass()); - setStatStatus ( tr ( "Connecting to broker" ) ); - stInfo->insertPlainText ( "broker url: "+config.brokerurl ); - setEnabled ( false ); - uname->hide(); - u->hide(); - return; } void ONMainWindow::slotCheckPortableDir() { - if(!QFile::exists(homeDir)) - { - x2goDebug<<"portable dir not exists, close"; - close(); - } + if (!QFile::exists(homeDir)) + { + x2goDebug<<"portable dir not exists, close"; + close(); + } } void ONMainWindow::slotGetBrokerAuth() { - pass->clear(); - login->clear(); - QString pixFile=":icons/128x128/x2gosession.png"; - if(SPixFile!=QString::null) - pixFile=SPixFile; - QPixmap pix(pixFile); - if ( !miniMode ) - { - fotoLabel->setPixmap ( - pix.scaled ( 64,64, + pass->clear(); + login->clear(); + QString pixFile=":icons/128x128/x2gosession.png"; + if (SPixFile!=QString::null) + pixFile=SPixFile; + QPixmap pix(pixFile); + if ( !miniMode ) + { + fotoLabel->setPixmap ( + pix.scaled ( 64,64, Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) ); - fotoLabel->setFixedSize ( 64,64 ); - } - else - { - fotoLabel->setPixmap ( - pix.scaled ( 48,48, + fotoLabel->setFixedSize ( 64,64 ); + } + else + { + fotoLabel->setPixmap ( + pix.scaled ( 48,48, Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) ); - fotoLabel->setFixedSize ( 48,48 ); - } - users->hide(); - ln->hide(); - bgLay->insertStretch(3); - QString text=tr("<b>Authentication</b>"); - /* if(config.brokerName.length()>0) - text+=config.brokerName; - else - text+=config.brokerurl;*/ - nameLabel->setText ( text ); - slotShowPassForm(); - config.brokerAuthenticated=false; + fotoLabel->setFixedSize ( 48,48 ); + } + users->hide(); + ln->hide(); + bgLay->insertStretch(3); + QString text=tr("<b>Authentication</b>"); + /* if(config.brokerName.length()>0) + text+=config.brokerName; + else + text+=config.brokerurl;*/ + nameLabel->setText ( text ); + slotShowPassForm(); + config.brokerAuthenticated=false; } @@ -1078,6 +1076,12 @@ void ONMainWindow::closeClient() QVariant ( isMaximized() ) ); st.setting()->sync(); x2goDebug<<"done"; +#ifdef Q_OS_LINUX + if (image) + XFreePixmap(QX11Info::display(),image); + if (shape) + XFreePixmap(QX11Info::display(),shape); +#endif } if ( nxproxy!=0l ) { @@ -1099,18 +1103,18 @@ void ONMainWindow::closeClient() sshConnection->wait ( 10000 ); x2goDebug<<"sshConnection is closed\n"; } - if(useLdap) + if (useLdap) { - for(int i=0;i<serverSshConnections.count();++i) - { - if(serverSshConnections[i]) - { - serverSshConnections[i]->disconnectSession(); - x2goDebug<<"waiting sshConnection to finish\n"; - serverSshConnections[i]->wait ( 10000 ); - x2goDebug<<"sshConnection is closed\n"; - } - } + for (int i=0;i<serverSshConnections.count();++i) + { + if (serverSshConnections[i]) + { + serverSshConnections[i]->disconnectSession(); + x2goDebug<<"waiting sshConnection to finish\n"; + serverSshConnections[i]->wait ( 10000 ); + x2goDebug<<"sshConnection is closed\n"; + } + } } /* if ( tunnel!=0l ) @@ -1440,10 +1444,10 @@ void ONMainWindow::slotSelectedFromList ( UserButton* user ) void ONMainWindow::slotClosePass() { - if(brokerMode) + if (brokerMode) { - if(!config.brokerAuthenticated) - close(); + if (!config.brokerAuthenticated) + close(); } passForm->hide(); if ( !embedMode ) @@ -1460,11 +1464,11 @@ void ONMainWindow::slotClosePass() } else { - if(lastSession) - { - lastSession->show(); - uname->setText ( lastSession->name() ); - } + if (lastSession) + { + lastSession->show(); + uname->setText ( lastSession->name() ); + } } uname->setEnabled ( true ); u->setEnabled ( true ); @@ -1477,7 +1481,7 @@ void ONMainWindow::slotClosePass() void ONMainWindow::slotPassEnter() { - + shadowSession=false; #if defined ( Q_OS_WIN ) || defined (Q_OS_DARWIN ) QString disp=getXDisplay(); @@ -1545,7 +1549,7 @@ void ONMainWindow::slotPassEnter() QString sPort="22"; list<string> sL=LDAPSession::getStringAttrValues ( - *it,"l" ); + *it,"l" ); if ( sL.size() >0 ) { sPort=sL.front().c_str(); @@ -1563,13 +1567,13 @@ void ONMainWindow::slotPassEnter() x2goDebug<<server.name<<": factor is "<<sFactor; server.factor=sFactor.toFloat(); server.sess=0; - server.sshPort=sPort; + server.sshPort=sPort; server.connOk=true; if ( !isFirstServerSet ) { isFirstServerSet=true; firstServer=server.name; - sshPort=server.sshPort; + sshPort=server.sshPort; } x2goServers.append ( server ); } @@ -1589,9 +1593,9 @@ void ONMainWindow::slotPassEnter() // QString host=ldapServer; QString host=firstServer; passwd=getCurrentPass(); - if(sshConnection) - sshConnection->disconnectSession(); - sshConnection=startSshConnection ( host,sshPort,acceptRsa,user,passwd,true ); + if (sshConnection) + sshConnection->disconnectSession(); + sshConnection=startSshConnection ( host,sshPort,acceptRsa,user,passwd,true, false ); #endif } @@ -1914,45 +1918,45 @@ void ONMainWindow::slotCreateDesktopIcon ( SessionButton* bt ) void ONMainWindow::slotReadSessions() { - + users->show(); ln->show(); X2goSettings *st; lastSession=0; - - if(brokerMode) - { - if(changeBrokerPass) - act_changeBrokerPass->setEnabled(true); - config.key=QString::null; - config.user=QString::null; - config.sessiondata=QString::null; - for (int i=sessions.count()-1;i>=0;--i) - { - SessionButton* but=sessions.takeAt(i); - if(but) - delete but; - } - - st=new X2goSettings(config.iniFile,QSettings::IniFormat); - sessionStatusDlg->hide(); - selectSessionDlg->hide(); - setEnabled ( true ); - slotClosePass(); + + if (brokerMode) + { + if (changeBrokerPass) + act_changeBrokerPass->setEnabled(true); + config.key=QString::null; + config.user=QString::null; + config.sessiondata=QString::null; + for (int i=sessions.count()-1;i>=0;--i) + { + SessionButton* but=sessions.takeAt(i); + if (but) + delete but; + } + + st=new X2goSettings(config.iniFile,QSettings::IniFormat); + sessionStatusDlg->hide(); + selectSessionDlg->hide(); + setEnabled ( true ); + slotClosePass(); } else - st= new X2goSettings( "sessions" ); + st= new X2goSettings( "sessions" ); QStringList slst=st->setting()->childGroups(); x2goDebug<<"read "<<slst.size()<<" sessions from config file"; - if(brokerMode && (slst.size()==0)) + if (brokerMode && (slst.size()==0)) { - QMessageBox::critical(this,tr("Error"),tr("X2Go sessions not found")); - close(); + QMessageBox::critical(this,tr("Error"),tr("X2Go sessions not found")); + close(); } for ( int i=0;i<slst.size();++i ) - { + { if ( slst[i]!="embedded" ) createBut ( slst[i] ); } @@ -2072,7 +2076,7 @@ void ONMainWindow::placeButtons() else sessions[i]->move ( ( users->width()-260 ) /2, i*155+i*20+5 ); - if(brokerMode) + if (brokerMode) sessions[i]->move ( ( users->width()-360 ) /2, i*150+i*25+5 ); sessions[i]->show(); @@ -2085,7 +2089,7 @@ void ONMainWindow::placeButtons() else uframe->setFixedHeight ( sessions.size() *155+ ( sessions.size()-1 ) *20 ); - if(brokerMode) + if (brokerMode) uframe->setFixedHeight ( sessions.size() *150+ ( sessions.size()-1 ) *25 ); } @@ -2371,6 +2375,7 @@ void ONMainWindow::slotSelectedFromList ( SessionButton* session ) QString server; QString userName; bool autologin=false; + bool krblogin=false; QString sessIcon; QPalette pal; QString sessionName; @@ -2382,15 +2387,15 @@ void ONMainWindow::slotSelectedFromList ( SessionButton* session ) sessionName=session->name(); QString sid=session->id(); - if(brokerMode) + if (brokerMode) { - broker->selectUserSession(session->id()); - setStatStatus ( tr ( "Connecting to broker" ) ); - stInfo->insertPlainText ( "broker url: "+config.brokerurl ); - setEnabled ( false ); - uname->hide(); - u->hide(); - return; + broker->selectUserSession(session->id()); + setStatStatus ( tr ( "Connecting to broker" ) ); + stInfo->insertPlainText ( "broker url: "+config.brokerurl ); + setEnabled ( false ); + uname->hide(); + u->hide(); + return; } X2goSettings st ( "sessions" ); @@ -2419,7 +2424,10 @@ void ONMainWindow::slotSelectedFromList ( SessionButton* session ) ( QVariant ) QString::null ).toString(); autologin=st.setting()->value ( sid+"/autologin", - ( QVariant ) QString::null ).toBool(); + ( QVariant ) false ).toBool(); + krblogin=st.setting()->value ( + sid+"/krblogin", + ( QVariant ) false ).toBool(); #ifdef Q_OS_WIN if ( portable && u3Device.length() >0 ) @@ -2522,7 +2530,7 @@ void ONMainWindow::slotSelectedFromList ( SessionButton* session ) x2goDebug<<"Have key, starting session"<<endl; slotSessEnter(); } - if ( cardReady ||/* useSshAgent ||*/ autologin ) + if ( cardReady || autologin || krblogin ) { nopass=true; if ( cardReady ) @@ -2546,13 +2554,13 @@ void ONMainWindow::slotSelectedFromList ( SessionButton* session ) } -SshMasterConnection* ONMainWindow::startSshConnection ( QString host, QString port, bool acceptUnknownHosts, - QString login, - QString password, bool autologin, bool getSrv) +SshMasterConnection* ONMainWindow::startSshConnection ( QString host, QString port, bool acceptUnknownHosts, + QString login, + QString password, bool autologin, bool krbLogin, bool getSrv) { - + SshMasterConnection* con; - x2goDebug<<"start new ssh connection to server:"<<host<<":"<<port<<endl; + x2goDebug<<"start new ssh connection to server:"<<host<<":"<<port<<"krb: "<<krbLogin<<endl; for ( int i=0;i<sshEnv.size();++i ) { #ifndef Q_OS_WIN @@ -2575,16 +2583,16 @@ SshMasterConnection* ONMainWindow::startSshConnection ( QString host, QString po passForm->setEnabled ( false ); con=new SshMasterConnection ( host, port.toInt(),acceptUnknownHosts, - login, password,currentKey, autologin, this ); - if(!getSrv) - connect ( con, SIGNAL ( connectionOk(QString) ), this, SLOT ( slotSshConnectionOk() ) ); + login, password,currentKey, autologin,krbLogin, this ); + if (!getSrv) + connect ( con, SIGNAL ( connectionOk(QString) ), this, SLOT ( slotSshConnectionOk() ) ); else - connect ( con, SIGNAL ( connectionOk(QString)), this, SLOT ( slotServSshConnectionOk(QString) ) ); - + connect ( con, SIGNAL ( connectionOk(QString)), this, SLOT ( slotServSshConnectionOk(QString) ) ); + connect ( con, SIGNAL ( serverAuthError ( int,QString ) ),this,SLOT ( slotSshServerAuthError ( int,QString ) ) ); connect ( con, SIGNAL ( userAuthError ( QString ) ),this,SLOT ( slotSshUserAuthError ( QString ) ) ); - connect ( con, SIGNAL ( connectionError ( QString,QString ) ), this, - SLOT ( slotSshConnectionError ( QString,QString ) ) ); + connect ( con, SIGNAL ( connectionError ( QString,QString ) ), this, + SLOT ( slotSshConnectionError ( QString,QString ) ) ); con->start(); return con; } diff --git a/onmainwindow.h b/onmainwindow.h index 7d5a3e9..4a41d58 100644 --- a/onmainwindow.h +++ b/onmainwindow.h @@ -146,7 +146,7 @@ struct ConfigFile QString brokerUserId; QString brokerName; bool brokerAuthenticated; - QString iniFile; + QString iniFile; QString server; QString sshport; QString proxy; @@ -414,10 +414,10 @@ public: } bool sessionEditEnabled() { - return !noSessionEdit; + return !noSessionEdit; } - - + + SshMasterConnection* findServerSshConnection(QString host); void showHelp(); @@ -577,6 +577,10 @@ private: QTimer *agentCheckTimer; QTimer *spoolTimer; QTimer *proxyWinTimer; + QTimer *xineramaTimer; + short xinSizeInc; + QRect lastDisplayGeometry; + QList <QRect> xineramaScreens; QStyle* widgetExtraStyle; bool isPassShown; bool xmodExecuted; @@ -626,7 +630,7 @@ private: bool ldapOnly; bool isScDaemonOk; bool parecTunnelOk; - + bool startSessSound; int startSessSndSystem; @@ -645,7 +649,7 @@ private: int ldapPort2; QString ldapDn; QString sessionCmd; - + QString supportMenuFile; QString BGFile; QString SPixFile; @@ -727,6 +731,11 @@ private: QString xorgWidth; QString xorgHeight; int waitingForX; + QRect dispGeometry; +#endif + +#ifdef Q_OS_LINUX + long image, shape; #endif // Tray icon stuff based on patch from Joachim Langenbach <joachim@falaba.de> @@ -781,9 +790,12 @@ private: void closeClient(); void continueNormalSession(); void continueLDAPSession(); - SshMasterConnection* startSshConnection ( QString host, QString port, - bool acceptUnknownHosts, QString login, - QString password, bool autologin, bool getSrv=false); + SshMasterConnection* startSshConnection ( QString host, QString port, + bool acceptUnknownHosts, QString login, + QString password, bool autologin, bool krbLogin, bool getSrv=false); + void setProxyWinTitle(); + QRect proxyWinGeometry(); + protected: virtual void closeEvent ( QCloseEvent* event ); @@ -899,6 +911,7 @@ private slots: private slots: + void slotSetProxyWinFullscreen(); void slotCheckPrintSpool(); void slotRereadUsers(); void slotExtTimer(); @@ -917,6 +930,8 @@ private slots: void slotExecXmodmap(); void slotCreateSessionIcon(); void slotFindProxyWin(); + void slotConfigXinerama(); + void slotXineramaConfigured(); void slotAttachProxyWindow(); void slotEmbedIntoParentWindow(); void slotEmbedWindow(); @@ -934,7 +949,9 @@ private slots: void slotReconnectSession(); void slotStartBroker(); void slotStartNewBrokerSession (); + private: + void resizeProxyWinOnDisplay(int display); #ifdef Q_OS_LINUX long X11FindWindow ( QString text, long rootWin=0 ); #endif diff --git a/onmainwindow_part2.cpp b/onmainwindow_part2.cpp index ac5ecd4..aa98603 100644 --- a/onmainwindow_part2.cpp +++ b/onmainwindow_part2.cpp @@ -226,6 +226,7 @@ bool ONMainWindow::startSession ( const QString& sid ) QString user; QString host; bool autologin=false; + bool krblogin=false; user=getCurrentUname(); runRemoteCommand=true; shadowSession=false; @@ -247,7 +248,9 @@ bool ONMainWindow::startSession ( const QString& sid ) QString cmd=st.setting()->value ( sid+"/command", ( QVariant ) QString::null ).toString(); autologin=st.setting()->value ( sid+"/autologin", - ( QVariant ) QString::null ).toBool(); + ( QVariant ) false ).toBool(); + krblogin=st.setting()->value ( sid+"/krblogin", + ( QVariant ) false ).toBool(); if ( cmd=="SHADOW" ) shadowSession=true; } @@ -273,7 +276,7 @@ bool ONMainWindow::startSession ( const QString& sid ) } if(sshConnection) sshConnection->disconnectSession(); - sshConnection=startSshConnection ( host,sshPort,acceptRsa,user,passwd,autologin ); + sshConnection=startSshConnection ( host,sshPort,acceptRsa,user,passwd,autologin, krblogin ); return true; } @@ -1920,10 +1923,11 @@ void ONMainWindow::slotTunnelOk() #endif //Q_OS_DARWIN x2goDebug<<"starting nxproxy with: "<<proxyCmd<<endl; nxproxy->start ( proxyCmd ); - +//always search for proxyWin + proxyWinTimer->start ( 300 ); if ( embedMode ) { - proxyWinTimer->start ( 300 ); +// proxyWinTimer->start ( 300 ); if ( !startEmbedded ) { act_embedContol->setText ( @@ -1934,10 +1938,10 @@ void ONMainWindow::slotTunnelOk() else { // #ifdef CFGCLIENT - // if using XMing, we must find proxy win for case, that we should make it fullscreen - if(useInternalX&& (internalX==XMING)) +// // if using XMing, we must find proxy win for case, that we should make it fullscreen + // if(useInternalX&& (internalX==XMING)) // #endif - proxyWinTimer->start ( 300 ); +// proxyWinTimer->start ( 300 ); } #endif diff --git a/onmainwindow_part3.cpp b/onmainwindow_part3.cpp index d2d6747..abd29f5 100644 --- a/onmainwindow_part3.cpp +++ b/onmainwindow_part3.cpp @@ -825,7 +825,7 @@ void ONMainWindow::slotGetServers ( bool result, QString output, { QString host=x2goServers[j].name; sshPort=x2goServers[j].sshPort; - serverSshConnections<<startSshConnection ( host,sshPort,acceptRsa,user,passwd,true,true); + serverSshConnections<<startSshConnection ( host,sshPort,acceptRsa,user,passwd,true,false,true); } } diff --git a/onmainwindow_part4.cpp b/onmainwindow_part4.cpp index 76fd224..5d8eecd 100644 --- a/onmainwindow_part4.cpp +++ b/onmainwindow_part4.cpp @@ -246,32 +246,32 @@ bool ONMainWindow::isServerRunning ( int port ) char* localIP; int iResult; WSADATA wsaData; - + struct in_addr addr = { 0 }; - + iResult = WSAStartup(MAKEWORD(2, 2), &wsaData); - if (iResult != 0) + if (iResult != 0) { x2goDebug<<"WARNING: WSAStartup failed: "<< iResult<<endl; return false; } - + addr.s_addr = inet_addr("127.0.0.1"); - if (addr.s_addr == INADDR_NONE) + if (addr.s_addr == INADDR_NONE) { - x2goDebug<< "WARNING: The IPv4 address entered must be a legal address\n"; - return false; + x2goDebug<< "WARNING: The IPv4 address entered must be a legal address\n"; + return false; } - + localHost = gethostbyaddr((char*)&addr,4, AF_INET); - if(!localHost) + if (!localHost) { - x2goDebug<<"WARNING: gethostbyaddr failed: "<<WSAGetLastError()<<endl; - return false; + x2goDebug<<"WARNING: gethostbyaddr failed: "<<WSAGetLastError()<<endl; + return false; } x2goDebug<<"got localhost"<<endl; - + localIP = inet_ntoa (*(struct in_addr *)*localHost->h_addr_list); saServer.sin_family = AF_INET; @@ -961,20 +961,254 @@ void ONMainWindow::startSshd() #endif } +void ONMainWindow::setProxyWinTitle() +{ + + QString title; + + if (!useLdap) + title=lastSession->name(); + else + title=getCurrentUname()+"@"+resumingSession.server; + + QPixmap pixmap; + + if (useLdap) + pixmap=lastUser->foto(); + else + pixmap=*(lastSession->sessIcon()); + +#ifdef Q_OS_LINUX + + XStoreName(QX11Info::display(), proxyWinId, title.toLocal8Bit().data()); + + XWMHints* win_hints; + + + QByteArray bytes; + QBuffer buffer(&bytes); + buffer.open(QIODevice::WriteOnly); + pixmap.save(&buffer, "XPM"); + + + int rez; + + if (image) + XFreePixmap(QX11Info::display(),image); + if (shape) + XFreePixmap(QX11Info::display(),shape); + + + rez=XpmCreatePixmapFromBuffer(QX11Info::display(), proxyWinId, bytes.data(), + (Pixmap *) &image, (Pixmap *) &shape, NULL); + if (!rez) + { + + win_hints = XAllocWMHints(); + if (win_hints) + { + win_hints->flags = IconPixmapHint|IconMaskHint; + win_hints->icon_pixmap = image; + win_hints->icon_mask = shape; + XSetWMHints(QX11Info::display(), proxyWinId, win_hints); + XFree(win_hints); + } + } + +#endif +#ifdef Q_OS_WIN + wapiSetWindowText((HWND)proxyWinId, title); +// wapiSetWindowIcon((HWND)proxyWinId, pixmap); +#endif +} + +void ONMainWindow::slotSetProxyWinFullscreen() +{ + +#ifdef Q_OS_LINUX + XSync(QX11Info::display(),false); + XEvent event; + long emask = StructureNotifyMask | ResizeRedirectMask; + event.xclient.type = ClientMessage; + event.xclient.serial = 0; + event.xclient.send_event = True; + event.xclient.display = QX11Info::display(); + event.xclient.window = proxyWinId; + event.xclient.message_type = XInternAtom(QX11Info::display(),"_NET_WM_STATE",False); + event.xclient.format = 32; + event.xclient.data.l[0] = 1; + event.xclient.data.l[1] = XInternAtom(QX11Info::display(),"_NET_WM_STATE_FULLSCREEN",False); + event.xclient.data.l[2] = 0; + event.xclient.data.l[3] = 0; + event.xclient.data.l[4] = 0; + Status st; + st=XSendEvent(QX11Info::display(), DefaultRootWindow(QX11Info::display()), + False, emask,&event); + XSync(QX11Info::display(),false); +#endif +#ifdef Q_OS_WIN + wapiSetFSWindow ( ( HWND ) proxyWinId, + dispGeometry ); + +#endif +} + + +void ONMainWindow::resizeProxyWinOnDisplay(int disp) +{ + QRect geom=QApplication::desktop()->screenGeometry(disp-1); + x2goDebug<<"resizing proxy win to fit display "<<disp<<"("<<geom<<")"<<endl; +#ifdef Q_OS_LINUX + XSync(QX11Info::display(),false); + XMoveWindow(QX11Info::display(), proxyWinId,geom.x(),geom.y()); +#endif +#ifdef Q_OS_WIN + dispGeometry=geom; +#endif + QTimer::singleShot(500, this, SLOT(slotSetProxyWinFullscreen())); +} + + +QRect ONMainWindow::proxyWinGeometry() +{ +#ifdef Q_OS_WIN + QRect proxyRect; + if (!wapiWindowRectWithoutDecoration((HWND)proxyWinId,proxyRect)) + return QRect(); + return proxyRect; +#endif +#ifdef Q_OS_LINUX + QRect proxyRect; + Window root; + int x,y; + uint w,h,border,depth; + if (XGetGeometry(QX11Info::display(), proxyWinId, &root,&x,&y,&w,&h,&border,&depth)) + { + + int realx,realy; + Window child; + XTranslateCoordinates(QX11Info::display(), proxyWinId, root, 0, 0, &realx, &realy, &child); + proxyRect.setRect(realx, realy, w,h); + } + return proxyRect; +#endif + return QRect(); +} + +void ONMainWindow::slotConfigXinerama() +{ + QRect newGeometry=proxyWinGeometry(); + if (newGeometry.isNull()) + { +// x2goDebug<<"error getting window geometry (window closed?)\n"; + xineramaTimer->stop(); + return; + } + if (newGeometry==lastDisplayGeometry) + return; + lastDisplayGeometry=newGeometry; + x2goDebug<<"New proxy geometry: "<<lastDisplayGeometry<<endl; + QDesktopWidget* root=QApplication::desktop(); + QList<QRect> newXineramaScreens; + for (int i=0; i< root->numScreens();++i) + { + QRect intersection=root->screenGeometry(i).intersected(lastDisplayGeometry); + if (!intersection.isNull()) + { + x2goDebug<<"intersected with "<<i<<": "<<intersection<<endl; + intersection.moveLeft(intersection.x()-lastDisplayGeometry.x()); + intersection.moveTop(intersection.y()-lastDisplayGeometry.y()); + x2goDebug<<"xinerama screen: "<<intersection<<endl; + newXineramaScreens<<intersection; + } + } + if (xineramaScreens != newXineramaScreens) + { + xineramaScreens=newXineramaScreens; + x2goDebug<<"xinerama screen changed, new screens: "<<xineramaScreens<<endl; + SshProcess* proc=new SshProcess(sshConnection, this); + xineramaTimer->stop(); + connect (proc, SIGNAL(sshFinished(bool,QString,SshProcess*)), this, SLOT(slotXineramaConfigured())); + QStringList screens; + foreach (QRect disp, xineramaScreens) + screens<<QString::number(disp.x())+" "+QString::number(disp.y())+" "+QString::number(disp.width())+ + " "+QString::number(disp.height()); + QString cmd="export DISPLAY=:"+resumingSession.display+";echo -e "+screens.join("\\\\n")+" > ~/.x2go/C-"+ + resumingSession.sessionId+"/xinerama.conf"; + + x2goDebug<<cmd<<endl; + proc->startNormal(cmd); + } +} + +void ONMainWindow::slotXineramaConfigured() +{ + if (xinSizeInc == -1) + xinSizeInc=1; + else + xinSizeInc=-1; +#ifdef Q_OS_LINUX + XSync(QX11Info::display(),false); + XResizeWindow(QX11Info::display(), proxyWinId, + lastDisplayGeometry.width()+xinSizeInc,lastDisplayGeometry.height()); + XSync(QX11Info::display(),false); + lastDisplayGeometry=proxyWinGeometry(); +#endif +#ifdef Q_OS_WIN + QRect geom; + wapiWindowRect ( (HWND) proxyWinId, geom ); + wapiMoveWindow( (HWND) proxyWinId, geom.x(), geom.y(), geom.width()+xinSizeInc, geom.height(),true); + lastDisplayGeometry=proxyWinGeometry(); +#endif + xineramaTimer->start(500); +} void ONMainWindow::slotFindProxyWin() { - x2goDebug<<"search proxy win: "<<"X2GO-"+resumingSession.sessionId; #ifndef Q_OS_DARWIN + x2goDebug<<"search proxy win: "<<"X2GO-"+resumingSession.sessionId; -//#ifdef CFGPLUGIN proxyWinId=findWindow ( "X2GO-"+resumingSession.sessionId ); -//#endif - if ( proxyWinId ) { x2goDebug<<"proxy win found:"<<proxyWinId; + setProxyWinTitle(); proxyWinTimer->stop(); + if (!useLdap) + { + X2goSettings *st; + QString sid; + if ( !embedMode ) + sid=lastSession->id(); + else + sid="embedded"; + + if (brokerMode) + st=new X2goSettings(config.iniFile,QSettings::IniFormat); + else + st= new X2goSettings( "sessions" ); + uint displays=QApplication::desktop()->numScreens(); + if (st->setting()->value ( sid+"/xinerama", + ( QVariant ) false ).toBool()) + { + x2goDebug<<"Starting xinerama timer\n"; + lastDisplayGeometry=QRect(); + xineramaScreens.clear(); + xineramaTimer->start(500); + } + if (st->setting()->value ( sid+"/multidisp", + ( QVariant ) false ).toBool()) + { + uint disp=st->setting()->value ( sid+"/display", + ( QVariant ) 1 ).toUInt(); + if (disp>displays) + { + disp=1; + } + resizeProxyWinOnDisplay(disp); + return; + } + } if ( embedMode ) { if ( config.rootless ) diff --git a/onmainwindow_privat.h b/onmainwindow_privat.h index a97e961..98cef6e 100644 --- a/onmainwindow_privat.h +++ b/onmainwindow_privat.h @@ -82,6 +82,8 @@ #if !defined Q_OS_WIN #include <sys/mount.h> #ifdef Q_OS_LINUX +#include <X11/Xatom.h> +#include <X11/xpm.h> #include <linux/fs.h> #endif // Q_OS_LINUX #endif // !defined Q_OS_WIN diff --git a/sessionbutton.cpp b/sessionbutton.cpp index c5ec122..e4ad225 100644 --- a/sessionbutton.cpp +++ b/sessionbutton.cpp @@ -24,6 +24,8 @@ #include <QPushButton> #include "onmainwindow.h" #include "x2gologdebug.h" +#include <QApplication> +#include <QDesktopWidget> SessionButton::SessionButton ( ONMainWindow* mw,QWidget *parent, QString id ) @@ -143,7 +145,7 @@ SessionButton::SessionButton ( ONMainWindow* mw,QWidget *parent, QString id ) if ( !miniMode ) { sessName->move ( 80,34 ); - sessStatus->move(80,50); + sessStatus->move(80,50); editBut->move ( 307,156 ); serverIcon->move ( 58,84 ); server->move ( 80,84 ); @@ -160,7 +162,7 @@ SessionButton::SessionButton ( ONMainWindow* mw,QWidget *parent, QString id ) { editBut->move ( 218,113 ); sessName->move ( 64,11 ); - sessStatus->hide(); + sessStatus->hide(); serverIcon->move ( 66,44 ); server->move ( 88,44 ); cmdIcon->move ( 66,68 ); @@ -172,13 +174,13 @@ SessionButton::SessionButton ( ONMainWindow* mw,QWidget *parent, QString id ) soundIcon->move ( 66,116 ); sound->move ( 86,116 ); } - - if(mw->brokerMode) + + if (mw->brokerMode) { - icon->move(10,30); - sessName->move(90,50); - sessStatus->move(90,70); - setFixedHeight(120); + icon->move(10,30); + sessName->move(90,50); + sessStatus->move(90,70); + setFixedHeight(120); } @@ -219,16 +221,16 @@ SessionButton::SessionButton ( ONMainWindow* mw,QWidget *parent, QString id ) sessMenu->hide(); sound->setEnabled(false); } - if(mw->brokerMode) + if (mw->brokerMode) { - cmd->hide(); - cmdIcon->hide(); - server->hide(); - serverIcon->hide(); - geom->hide(); - geomIcon->hide(); - sound->hide(); - soundIcon->hide(); + cmd->hide(); + cmdIcon->hide(); + server->hide(); + serverIcon->hide(); + geom->hide(); + geomIcon->hide(); + sound->hide(); + soundIcon->hide(); } } @@ -381,6 +383,11 @@ void SessionButton::redraw() geomBox->clear(); geomBox->addItem ( tr ( "fullscreen" ) ); + uint displays=QApplication::desktop()->numScreens(); + for (uint i=0;i<displays;++i) + { + geomBox->addItem ( tr( "Display " )+QString::number(i+1)); + } #ifndef Q_WS_HILDON geomBox->addItem ( "1440x900" ); geomBox->addItem ( "1280x1024" ); @@ -395,21 +402,42 @@ void SessionButton::redraw() geom->setText ( tr ( "fullscreen" ) ); } else - { + if (st->setting()->value ( sid+"/multidisp", + ( QVariant ) false ).toBool()) + { + uint disp=st->setting()->value ( sid+"/display", + ( QVariant ) 1 ).toUInt(); + if (disp<=displays) + { + geom->setText( tr( "Display " )+QString::number(disp)); + } + else + { + geom->setText( tr( "Display " )+QString::number(1)); + } + for (int i=0;i<geomBox->count();++i) + if (geomBox->itemText(i)==geom->text()) + { + geomBox->setCurrentIndex(i); + break; + } + } + else + { #ifndef Q_WS_HILDON - QString g=QString::number ( st->setting()->value ( - sid+"/width" ).toInt() ); - g+="x"+QString::number ( st->setting()->value ( - sid+"/height" ).toInt() ); - geom->setText ( g ); - if ( geomBox->findText ( g ) ==-1 ) - geomBox->addItem ( g ); - geomBox->setCurrentIndex ( geomBox->findText ( g ) ); + QString g=QString::number ( st->setting()->value ( + sid+"/width" ).toInt() ); + g+="x"+QString::number ( st->setting()->value ( + sid+"/height" ).toInt() ); + geom->setText ( g ); + if ( geomBox->findText ( g ) ==-1 ) + geomBox->addItem ( g ); + geomBox->setCurrentIndex ( geomBox->findText ( g ) ); #else - geom->setText ( tr ( "window" ) ); - geomBox->setCurrentIndex ( 1 ); + geom->setText ( tr ( "window" ) ); + geomBox->setCurrentIndex ( 1 ); #endif - } + } snd=st->setting()->value ( sid+"/sound", ( QVariant ) true ).toBool(); @@ -633,19 +661,31 @@ void SessionButton::slot_geom_change ( const QString& new_g ) geom->setText ( new_g ); X2goSettings st ( "sessions" ); if ( new_g==tr ( "fullscreen" ) ) + { st.setting()->setValue ( sid+"/fullscreen", ( QVariant ) true ); + st.setting()->setValue ( sid+"/multidisp", ( QVariant ) false ); + } else - { - QString new_geom=new_g; + if (new_g.indexOf(tr("Display "))==0) + { + QString g= new_g; + g.replace(tr("Display "),""); + st.setting()->setValue ( sid+"/multidisp", ( QVariant ) true ); + st.setting()->setValue ( sid+"/display", ( QVariant ) g.toUInt()); + st.setting()->setValue ( sid+"/fullscreen", ( QVariant ) false ); + } + else + { + QString new_geom=new_g; #ifdef Q_WS_HILDON - new_geom="800x600"; + new_geom="800x600"; #endif - st.setting()->setValue ( sid+"/fullscreen", - ( QVariant ) false ); - QStringList lst=new_geom.split ( 'x' ); - st.setting()->setValue ( sid+"/width", ( QVariant ) lst[0] ); - st.setting()->setValue ( sid+"/height", ( QVariant ) lst[1] ); - } + st.setting()->setValue ( sid+"/fullscreen", ( QVariant ) false ); + st.setting()->setValue ( sid+"/multidisp", ( QVariant ) false ); + QStringList lst=new_geom.split ( 'x' ); + st.setting()->setValue ( sid+"/width", ( QVariant ) lst[0] ); + st.setting()->setValue ( sid+"/height", ( QVariant ) lst[1] ); + } st.setting()->sync(); } diff --git a/sessionbutton.h b/sessionbutton.h index b39bdb5..cad3770 100644 --- a/sessionbutton.h +++ b/sessionbutton.h @@ -14,8 +14,8 @@ #include "SVGFrame.h" #include <QPushButton> +#include <QLabel> class ONMainWindow; -class QLabel; class QComboBox; class QPushButton; @@ -24,58 +24,63 @@ class QPushButton; */ class SessionButton : public SVGFrame { - Q_OBJECT - public: - enum {KDE,GNOME,LXDE,RDP,XDMCP,SHADOW,OTHER,APPLICATION}; - SessionButton ( ONMainWindow* mw, QWidget* parent,QString id ); - ~SessionButton(); - QString id() { return sid; } - void redraw(); - static bool lessThen ( const SessionButton* b1, const SessionButton* b2 ); - QString name(); - private: - QString sid; - QLabel* sessName; - QLabel* sessStatus; - QLabel* icon; - QComboBox* cmdBox; - QLabel* cmd; - QLabel* serverIcon; - QLabel* geomIcon; - QLabel* cmdIcon; - QLabel* server; - QPushButton* editBut; - QLabel* geom; - QMenu* sessMenu; - QComboBox* geomBox; - QPushButton* sound; - QLabel* soundIcon; - ONMainWindow* par; - QAction* act_edit; - QAction* act_createIcon; - QAction* act_remove; - bool rootless; - bool editable; + Q_OBJECT +public: + enum {KDE,GNOME,LXDE,RDP,XDMCP,SHADOW,OTHER,APPLICATION}; + SessionButton ( ONMainWindow* mw, QWidget* parent,QString id ); + ~SessionButton(); + QString id() { + return sid; + } + void redraw(); + const QPixmap* sessIcon() { + return icon->pixmap(); + } + static bool lessThen ( const SessionButton* b1, const SessionButton* b2 ); + QString name(); +private: + QString sid; + QLabel* sessName; + QLabel* sessStatus; + QLabel* icon; + QComboBox* cmdBox; + QLabel* cmd; + QLabel* serverIcon; + QLabel* geomIcon; + QLabel* cmdIcon; + QLabel* server; + QPushButton* editBut; + QLabel* geom; + QMenu* sessMenu; + QComboBox* geomBox; + QPushButton* sound; + QLabel* soundIcon; + ONMainWindow* par; + QAction* act_edit; + QAction* act_createIcon; + QAction* act_remove; + bool rootless; + bool editable; - private slots: - void slotClicked(); - void slotEdit(); - void slot_soundClicked(); - void slot_cmd_change ( const QString& command ); - void slot_geom_change ( const QString& new_g ); - void slotRemove(); - void slotMenuHide(); - void slotShowMenu(); - void slotCreateSessionIcon(); - signals: - void sessionSelected ( SessionButton* ); - void signal_edit ( SessionButton* ); - void signal_remove ( SessionButton* ); - void clicked(); - protected: - virtual void mouseMoveEvent ( QMouseEvent * event ); - virtual void mousePressEvent ( QMouseEvent * event ); - virtual void mouseReleaseEvent ( QMouseEvent * event ); +private slots: + void slotClicked(); + void slotEdit(); + void slot_soundClicked(); + void slot_cmd_change ( const QString& command ); + void slot_geom_change ( const QString& new_g ); + void slotRemove(); + void slotMenuHide(); + void slotShowMenu(); + void slotCreateSessionIcon(); +signals: + void sessionSelected ( SessionButton* ); + void signal_edit ( SessionButton* ); + void signal_remove ( SessionButton* ); + void clicked(); +protected: + virtual void mouseMoveEvent ( QMouseEvent * event ); + virtual void mousePressEvent ( QMouseEvent * event ); + virtual void mouseReleaseEvent ( QMouseEvent * event ); }; #endif diff --git a/sessionwidget.cpp b/sessionwidget.cpp index 9faae9a..4a9603c 100644 --- a/sessionwidget.cpp +++ b/sessionwidget.cpp @@ -105,7 +105,9 @@ SessionWidget::SessionWidget ( QString id, ONMainWindow * mw, sgbLay->addLayout ( suLay ); sgbLay->addLayout ( keyLay ); cbAutoLogin=new QCheckBox(tr("Try auto login (ssh-agent or default ssh key)"),sgb); + cbKrbLogin=new QCheckBox(tr("Kerberos 5 (GSSAPI) authentication"),sgb); sgbLay->addWidget(cbAutoLogin); + sgbLay->addWidget(cbKrbLogin); #ifndef Q_WS_HILDON QGroupBox *deskSess=new QGroupBox ( tr ( "&Session type" ),this ); @@ -178,6 +180,8 @@ SessionWidget::SessionWidget ( QString id, ONMainWindow * mw, connect ( sessName,SIGNAL ( textChanged ( const QString & ) ),this, SIGNAL ( nameChanged ( const QString & ) ) ); readConfig(); + cbKrbLogin->setChecked(false); + cbKrbLogin->setVisible(false); } SessionWidget::~SessionWidget() @@ -320,7 +324,10 @@ void SessionWidget::readConfig() ( QVariant ) QString::null ).toString() ); cbAutoLogin->setChecked(st.setting()->value ( sessionId+"/autologin", - ( QVariant ) QString::null ).toBool()); + ( QVariant ) false ).toBool()); + cbKrbLogin->setChecked(st.setting()->value ( + sessionId+"/krblogin", + ( QVariant ) false ).toBool()); sshPort->setValue ( st.setting()->value ( sessionId+"/sshport", @@ -416,7 +423,9 @@ void SessionWidget::setDefaults() cmdCombo->addItem ( "" ); cmdCombo->addItems ( mainWindow->transApplicationsNames() ); cbAutoLogin->setChecked(false); + cbKrbLogin->setChecked(false); cmdCombo->lineEdit()->setText ( + tr ( "Path to executable" ) ); cmdCombo->lineEdit()->selectAll(); slot_changeCmd ( 0 ); @@ -446,6 +455,7 @@ void SessionWidget::saveSettings() st.setting()->setValue ( sessionId+"/sshport", ( QVariant ) sshPort->value() ); st.setting()->setValue(sessionId+"/autologin",( QVariant ) cbAutoLogin->isChecked()); + st.setting()->setValue(sessionId+"/krblogin",( QVariant ) cbKrbLogin->isChecked()); QString command; bool rootless=false; diff --git a/sessionwidget.h b/sessionwidget.h index 9cf8af0..27767d2 100644 --- a/sessionwidget.h +++ b/sessionwidget.h @@ -47,6 +47,7 @@ class SessionWidget : public ConfigWidget QSpinBox* sshPort; QLineEdit* key; QCheckBox* cbAutoLogin; + QCheckBox* cbKrbLogin; QString sessIcon; QPushButton* icon; QLineEdit* cmd; diff --git a/settingswidget.cpp b/settingswidget.cpp index 8adf148..86c5395 100644 --- a/settingswidget.cpp +++ b/settingswidget.cpp @@ -21,205 +21,258 @@ #include <QLabel> #include "x2gosettings.h" #include <QDir> +#include <QApplication> +#include <QDesktopWidget> +#include <QTimer> +#include <QSplashScreen> +#include "x2gologdebug.h" + SettingsWidget::SettingsWidget ( QString id, ONMainWindow * mw, QWidget * parent, Qt::WindowFlags f ) - : ConfigWidget ( id,mw,parent,f ) + : ConfigWidget ( id,mw,parent,f ) { + multiDisp=(QApplication::desktop()->screenCount()>1); #ifdef Q_WS_HILDON - QTabWidget* tabSettings=new QTabWidget ( this ); - QFrame* dgb=new QFrame(); - QFrame* kgb=new QFrame(); - QFrame* sbgr=new QFrame(); - tabSettings->addTab ( dgb, tr ( "&Display" ) ); - tabSettings->addTab ( kgb,tr ( "&Keyboard" ) ); - tabSettings->addTab ( sbgr,tr ( "Sound" ) ); + QTabWidget* tabSettings=new QTabWidget ( this ); + QFrame* dgb=new QFrame(); + QFrame* kgb=new QFrame(); + QFrame* sbgr=new QFrame(); + tabSettings->addTab ( dgb, tr ( "&Display" ) ); + tabSettings->addTab ( kgb,tr ( "&Keyboard" ) ); + tabSettings->addTab ( sbgr,tr ( "Sound" ) ); #else - QGroupBox *dgb=new QGroupBox ( tr ( "&Display" ),this ); - QGroupBox *kgb=new QGroupBox ( tr ( "&Keyboard" ),this ); - QGroupBox *sbgr=new QGroupBox ( tr ( "Sound" ),this ); + QGroupBox *dgb=new QGroupBox ( tr ( "&Display" ),this ); + QGroupBox *kgb=new QGroupBox ( tr ( "&Keyboard" ),this ); + QGroupBox *sbgr=new QGroupBox ( tr ( "Sound" ),this ); #endif - QVBoxLayout *dbLay = new QVBoxLayout ( dgb ); - QVBoxLayout *sndLay=new QVBoxLayout ( sbgr ); - QHBoxLayout* sLay=new QHBoxLayout ( ); - QVBoxLayout* sLay_sys=new QVBoxLayout ( ); - QVBoxLayout* sLay_opt=new QVBoxLayout ( ); - sLay->addLayout ( sLay_sys ); - sLay->addLayout ( sLay_opt ); - QVBoxLayout* setLay=new QVBoxLayout ( this ); - QButtonGroup* radio = new QButtonGroup ( dgb ); - fs=new QRadioButton ( tr ( "Fullscreen" ),dgb ); + QVBoxLayout *dbLay = new QVBoxLayout ( dgb ); + QVBoxLayout *sndLay=new QVBoxLayout ( sbgr ); + QHBoxLayout* sLay=new QHBoxLayout ( ); + QVBoxLayout* sLay_sys=new QVBoxLayout ( ); + QVBoxLayout* sLay_opt=new QVBoxLayout ( ); + sLay->addLayout ( sLay_sys ); + sLay->addLayout ( sLay_opt ); + QVBoxLayout* setLay=new QVBoxLayout ( this ); + QButtonGroup* radio = new QButtonGroup ( dgb ); + fs=new QRadioButton ( tr ( "Fullscreen" ),dgb ); #ifndef Q_WS_HILDON - custom=new QRadioButton ( tr ( "Custom" ),dgb ); + custom=new QRadioButton ( tr ( "Custom" ),dgb ); #else - custom=new QRadioButton ( tr ( "Window" ),dgb ); + custom=new QRadioButton ( tr ( "Window" ),dgb ); #endif - radio->addButton ( fs ); - radio->addButton ( custom ); - radio->setExclusive ( true ); - width=new QSpinBox ( dgb ); - height=new QSpinBox ( dgb ); - cbSetDPI=new QCheckBox ( tr ( "Set display DPI" ),dgb ); - - DPI=new QSpinBox ( dgb ); - DPI->setRange ( 1,1000 ); - - QHBoxLayout *dgLay =new QHBoxLayout(); - QHBoxLayout *dwLay =new QHBoxLayout(); - QHBoxLayout *ddLay =new QHBoxLayout(); - ddLay->addWidget ( cbSetDPI ); - ddLay->addWidget ( DPI ); - ddLay->addStretch(); - ddLay->setSpacing ( 15 ); - - dgLay->addWidget ( fs ); - dgLay->addStretch(); - - dwLay->addWidget ( custom ); - dwLay->addSpacing ( 15 ); - dwLay->addWidget ( widthLabel=new QLabel ( tr ( "Width:" ),dgb ) ); - dwLay->addWidget ( width ); - width->setRange ( 0,10000 ); - dwLay->addWidget ( heightLabel=new QLabel ( tr ( "Height:" ),dgb ) ); - dwLay->addWidget ( height ); - height->setRange ( 0,10000 ); - dwLay->addStretch(); - dbLay->addLayout ( dgLay ); - dbLay->addLayout ( dwLay ); - QFrame* dhl=new QFrame ( dgb ); - dhl->setFrameStyle ( QFrame::HLine | QFrame::Sunken ); - dbLay->addWidget ( dhl ); - dbLay->addLayout ( ddLay ); + display=new QRadioButton ( tr ( "Use whole display" ),dgb ); + + radio->addButton ( fs ); + radio->addButton ( custom ); + radio->setExclusive ( true ); + radio->addButton(display); + width=new QSpinBox ( dgb ); + height=new QSpinBox ( dgb ); + cbSetDPI=new QCheckBox ( tr ( "Set display DPI" ),dgb ); + + DPI=new QSpinBox ( dgb ); + DPI->setRange ( 1,1000 ); + + cbXinerama= new QCheckBox(tr( "Xinerama extension (support for two or more physical displays)"),dgb); + + QHBoxLayout *dgLay =new QHBoxLayout(); + QHBoxLayout *dwLay =new QHBoxLayout(); + QHBoxLayout *ddLay =new QHBoxLayout(); + QHBoxLayout *dispLay= new QHBoxLayout(); + ddLay->addWidget ( cbSetDPI ); + ddLay->addWidget ( DPI ); + ddLay->addStretch(); + ddLay->setSpacing ( 15 ); + + dgLay->addWidget ( fs ); + dgLay->addStretch(); + + dwLay->addWidget ( custom ); + dwLay->addSpacing ( 15 ); + dwLay->addWidget ( widthLabel=new QLabel ( tr ( "Width:" ),dgb ) ); + dwLay->addWidget ( width ); + width->setRange ( 0,10000 ); + dwLay->addWidget ( heightLabel=new QLabel ( tr ( "Height:" ),dgb ) ); + dwLay->addWidget ( height ); + height->setRange ( 0,10000 ); + dwLay->addStretch(); + + dispLay->addWidget(display); + dispLay->addSpacing(15); + dispLay->addWidget(lDisplay=new QLabel(tr("&Display:"),dgb)); + dispLay->addWidget(displayNumber=new QSpinBox(dgb)); + pbIdentDisp=new QPushButton(tr("&Identify all displays"), dgb); + dispLay->addWidget(pbIdentDisp); + dispLay->addStretch(); + lDisplay->setBuddy(displayNumber); + + displayNumber->setMinimum(1); + displayNumber->setMaximum(QApplication::desktop()->screenCount()); + if (!multiDisp) + { + displayNumber->hide(); + lDisplay->hide(); + pbIdentDisp->hide(); + display->hide(); + } + lDisplay->setEnabled ( false ); + displayNumber->setEnabled ( false ); + + + dbLay->addLayout ( dgLay ); + dbLay->addLayout ( dwLay ); + dbLay->addLayout(dispLay); + QFrame* dhl=new QFrame ( dgb ); + dhl->setFrameStyle ( QFrame::HLine | QFrame::Sunken ); + dbLay->addWidget ( dhl ); + dbLay->addLayout ( ddLay ); + dhl=new QFrame ( dgb ); + dhl->setFrameStyle ( QFrame::HLine | QFrame::Sunken ); + dbLay->addWidget ( dhl ); + dbLay->addWidget ( cbXinerama ); #ifdef Q_WS_HILDON - width->hide(); - height->hide(); - widthLabel->hide(); - heightLabel->hide(); + width->hide(); + height->hide(); + widthLabel->hide(); + heightLabel->hide(); #endif - kbd=new QCheckBox ( tr ( "Keep current keyboard Settings" ),kgb ); - layout=new QLineEdit ( kgb ); - type=new QLineEdit ( kgb ); - QVBoxLayout *kbLay = new QVBoxLayout ( kgb ); - - QVBoxLayout *klLay = new QVBoxLayout(); - QVBoxLayout *kwLay = new QVBoxLayout(); - QHBoxLayout *ksLay = new QHBoxLayout(); - - klLay->addWidget ( layoutLabel= new QLabel ( - tr ( "Keyboard layout:" ),kgb ) ); - klLay->addWidget ( typeLabel= new QLabel ( - tr ( "Keyboard model:" ),kgb ) ); - - kwLay->addWidget ( layout ); - kwLay->addWidget ( type ); - - ksLay->addLayout ( klLay ); - ksLay->addLayout ( kwLay ); - - kbLay->addWidget ( kbd ); - kbLay->addLayout ( ksLay ); - - sound=new QCheckBox ( tr ( "Enable sound support" ),sbgr ); - QButtonGroup* sndsys=new QButtonGroup; - pulse=new QRadioButton ( "PulseAudio",sbgr ); - arts=new QRadioButton ( "arts",sbgr ); - esd=new QRadioButton ( "esd",sbgr ); - sndsys->addButton ( pulse,PULSE ); - sndsys->addButton ( arts,ARTS ); - sndsys->addButton ( esd,ESD ); - sndsys->setExclusive ( true ); - rbStartSnd=new QRadioButton ( tr ( "Start sound daemon" ),sbgr ); - rbNotStartSnd=new QRadioButton ( - tr ( "Use running sound daemon" ),sbgr ); - cbSndSshTun=new QCheckBox ( - tr ( "Use SSH port forwarding to tunnel\n" - "sound system connections through firewalls" ),sbgr ); - cbDefSndPort=new QCheckBox ( tr ( "Use default sound port" ),sbgr ); - sbSndPort=new QSpinBox ( sbgr ); - sbSndPort->setMinimum ( 1 ); - sbSndPort->setMaximum ( 99999999 ); - - - QHBoxLayout *sndPortLay = new QHBoxLayout(); - lSndPort=new QLabel ( tr ( "Sound port:" ),sbgr ); - sndPortLay->addWidget ( lSndPort ); - sndPortLay->addWidget ( sbSndPort ); - - sLay_sys->addWidget ( pulse ); - sLay_sys->addWidget ( arts ); - sLay_sys->addWidget ( esd ); - - sLay_opt->addWidget ( rbStartSnd ); - sLay_opt->addWidget ( rbNotStartSnd ); - sLay_opt->addWidget ( cbSndSshTun ); - QFrame* hl=new QFrame ( sbgr ); - hl->setFrameStyle ( QFrame::HLine | QFrame::Sunken ); - sLay_opt->addWidget ( hl ); - sLay_opt->addWidget ( cbDefSndPort ); - sLay_opt->addLayout ( sndPortLay ); - sndLay->addWidget ( sound ); - sndLay->addLayout ( sLay ); + kbd=new QCheckBox ( tr ( "Keep current keyboard Settings" ),kgb ); + layout=new QLineEdit ( kgb ); + type=new QLineEdit ( kgb ); + QVBoxLayout *kbLay = new QVBoxLayout ( kgb ); + + QVBoxLayout *klLay = new QVBoxLayout(); + QVBoxLayout *kwLay = new QVBoxLayout(); + QHBoxLayout *ksLay = new QHBoxLayout(); + + klLay->addWidget ( layoutLabel= new QLabel ( + tr ( "Keyboard layout:" ),kgb ) ); + klLay->addWidget ( typeLabel= new QLabel ( + tr ( "Keyboard model:" ),kgb ) ); + + kwLay->addWidget ( layout ); + kwLay->addWidget ( type ); + + ksLay->addLayout ( klLay ); + ksLay->addLayout ( kwLay ); + + kbLay->addWidget ( kbd ); + kbLay->addLayout ( ksLay ); + + sound=new QCheckBox ( tr ( "Enable sound support" ),sbgr ); + QButtonGroup* sndsys=new QButtonGroup; + pulse=new QRadioButton ( "PulseAudio",sbgr ); + arts=new QRadioButton ( "arts",sbgr ); + esd=new QRadioButton ( "esd",sbgr ); + sndsys->addButton ( pulse,PULSE ); + sndsys->addButton ( arts,ARTS ); + sndsys->addButton ( esd,ESD ); + sndsys->setExclusive ( true ); + rbStartSnd=new QRadioButton ( tr ( "Start sound daemon" ),sbgr ); + rbNotStartSnd=new QRadioButton ( + tr ( "Use running sound daemon" ),sbgr ); + cbSndSshTun=new QCheckBox ( + tr ( "Use SSH port forwarding to tunnel\n" + "sound system connections through firewalls" ),sbgr ); + cbDefSndPort=new QCheckBox ( tr ( "Use default sound port" ),sbgr ); + sbSndPort=new QSpinBox ( sbgr ); + sbSndPort->setMinimum ( 1 ); + sbSndPort->setMaximum ( 99999999 ); + + + QHBoxLayout *sndPortLay = new QHBoxLayout(); + lSndPort=new QLabel ( tr ( "Sound port:" ),sbgr ); + sndPortLay->addWidget ( lSndPort ); + sndPortLay->addWidget ( sbSndPort ); + + sLay_sys->addWidget ( pulse ); + sLay_sys->addWidget ( arts ); + sLay_sys->addWidget ( esd ); + + sLay_opt->addWidget ( rbStartSnd ); + sLay_opt->addWidget ( rbNotStartSnd ); + sLay_opt->addWidget ( cbSndSshTun ); + QFrame* hl=new QFrame ( sbgr ); + hl->setFrameStyle ( QFrame::HLine | QFrame::Sunken ); + sLay_opt->addWidget ( hl ); + sLay_opt->addWidget ( cbDefSndPort ); + sLay_opt->addLayout ( sndPortLay ); + sndLay->addWidget ( sound ); + sndLay->addLayout ( sLay ); #ifdef Q_OS_WIN - arts->hide(); - hl->hide(); - cbDefSndPort->hide(); - lSndPort->hide(); - sbSndPort->hide(); + arts->hide(); + hl->hide(); + cbDefSndPort->hide(); + lSndPort->hide(); + sbSndPort->hide(); #endif - cbClientPrint=new QCheckBox ( tr ( "Client side printing support" ), - this ); + cbClientPrint=new QCheckBox ( tr ( "Client side printing support" ), + this ); #ifdef Q_OS_DARWIN - arts->hide(); - pulse->hide(); - esd->setChecked ( true ); + arts->hide(); + pulse->hide(); + esd->setChecked ( true ); #endif #ifndef Q_WS_HILDON - setLay->addWidget ( dgb ); - setLay->addWidget ( kgb ); - setLay->addWidget ( sbgr ); + setLay->addWidget ( dgb ); + setLay->addWidget ( kgb ); + setLay->addWidget ( sbgr ); #else - setLay->addWidget ( tabSettings ); + setLay->addWidget ( tabSettings ); // cbClientPrint->hide(); #endif - setLay->addWidget ( cbClientPrint ); - setLay->addStretch(); - - connect ( custom,SIGNAL ( toggled ( bool ) ),width, - SLOT ( setEnabled ( bool ) ) ); - connect ( custom,SIGNAL ( toggled ( bool ) ),height, - SLOT ( setEnabled ( bool ) ) ); - connect ( custom,SIGNAL ( toggled ( bool ) ),widthLabel, - SLOT ( setEnabled ( bool ) ) ); - connect ( custom,SIGNAL ( toggled ( bool ) ),heightLabel, - SLOT ( setEnabled ( bool ) ) ); - connect ( cbSetDPI,SIGNAL ( toggled ( bool ) ),DPI, - SLOT ( setEnabled ( bool ) ) ); - connect ( kbd,SIGNAL ( toggled ( bool ) ),layout, - SLOT ( setDisabled ( bool ) ) ); - connect ( kbd,SIGNAL ( toggled ( bool ) ),layoutLabel, - SLOT ( setDisabled ( bool ) ) ); - connect ( kbd,SIGNAL ( toggled ( bool ) ),type, - SLOT ( setDisabled ( bool ) ) ); - connect ( kbd,SIGNAL ( toggled ( bool ) ),typeLabel, - SLOT ( setDisabled ( bool ) ) ); - connect ( sound,SIGNAL ( toggled ( bool ) ),this, - SLOT ( slot_sndToggled ( bool ) ) ); - connect ( sndsys,SIGNAL ( buttonClicked ( int ) ),this, - SLOT ( slot_sndSysSelected ( int ) ) ); - connect ( rbStartSnd,SIGNAL ( clicked ( ) ),this, - SLOT ( slot_sndStartClicked() ) ); - connect ( rbNotStartSnd,SIGNAL ( clicked ( ) ),this, - SLOT ( slot_sndStartClicked() ) ); - connect ( cbDefSndPort,SIGNAL ( toggled ( bool ) ),this, - SLOT ( slot_sndDefPortChecked ( bool ) ) ); - kbd->setChecked ( true ); - custom->setChecked ( true ); - readConfig(); + setLay->addWidget ( cbClientPrint ); + setLay->addStretch(); + + connect ( custom,SIGNAL ( toggled ( bool ) ),width, + SLOT ( setEnabled ( bool ) ) ); + connect ( custom,SIGNAL ( toggled ( bool ) ),height, + SLOT ( setEnabled ( bool ) ) ); + connect ( custom,SIGNAL ( toggled ( bool ) ),widthLabel, + SLOT ( setEnabled ( bool ) ) ); + connect ( custom,SIGNAL ( toggled ( bool ) ),heightLabel, + SLOT ( setEnabled ( bool ) ) ); + + connect ( display,SIGNAL ( toggled ( bool ) ),displayNumber, + SLOT ( setEnabled ( bool ) ) ); + connect ( display,SIGNAL ( toggled ( bool ) ),lDisplay, + SLOT ( setEnabled ( bool ) ) ); + connect(pbIdentDisp, SIGNAL(clicked()), this, SLOT (slot_identDisplays())); + + + + connect ( cbSetDPI,SIGNAL ( toggled ( bool ) ),DPI, + SLOT ( setEnabled ( bool ) ) ); + connect ( kbd,SIGNAL ( toggled ( bool ) ),layout, + SLOT ( setDisabled ( bool ) ) ); + connect ( kbd,SIGNAL ( toggled ( bool ) ),layoutLabel, + SLOT ( setDisabled ( bool ) ) ); + connect ( kbd,SIGNAL ( toggled ( bool ) ),type, + SLOT ( setDisabled ( bool ) ) ); + connect ( kbd,SIGNAL ( toggled ( bool ) ),typeLabel, + SLOT ( setDisabled ( bool ) ) ); + connect ( sound,SIGNAL ( toggled ( bool ) ),this, + SLOT ( slot_sndToggled ( bool ) ) ); + connect ( sndsys,SIGNAL ( buttonClicked ( int ) ),this, + SLOT ( slot_sndSysSelected ( int ) ) ); + connect ( rbStartSnd,SIGNAL ( clicked ( ) ),this, + SLOT ( slot_sndStartClicked() ) ); + connect ( rbNotStartSnd,SIGNAL ( clicked ( ) ),this, + SLOT ( slot_sndStartClicked() ) ); + connect ( cbDefSndPort,SIGNAL ( toggled ( bool ) ),this, + SLOT ( slot_sndDefPortChecked ( bool ) ) ); + kbd->setChecked ( true ); + custom->setChecked ( true ); + readConfig(); + + cbXinerama->setVisible(false); + cbXinerama->setChecked(false); } @@ -227,268 +280,340 @@ SettingsWidget::~SettingsWidget() { } + +void SettingsWidget::slot_identDisplays() +{ + pbIdentDisp->setEnabled(false); + identWins.clear(); + for (int i=0;i<QApplication::desktop()->screenCount();++i) + { + QMainWindow *mw=new QMainWindow( + this, Qt::FramelessWindowHint|Qt::X11BypassWindowManagerHint|Qt::WindowStaysOnTopHint); + mw->setFixedSize(150,200); + QLabel* fr=new QLabel(QString::number(i+1), mw); + QFont f=fr->font(); + f.setBold(true); + f.setPointSize(56); + fr->setFont(f); + fr->setAlignment(Qt::AlignCenter); + mw->setCentralWidget(fr); + fr->setFrameStyle(QFrame::Box); + QRect geom=QApplication::desktop()->screenGeometry(i); + int x_pos=geom.width()/2-75; + int y_pos=geom.height()/2-100; + x_pos=565; + identWins<<mw; + mw ->move(geom.x()+x_pos, geom.y()+y_pos); + mw->show(); + mw->raise(); + } + QTimer::singleShot(1200,this, SLOT(slot_hideIdentWins())); +} + +void SettingsWidget::slot_hideIdentWins() +{ + QMainWindow* mw; + foreach(mw,identWins) + { + mw->close(); + } + pbIdentDisp->setEnabled(true); +} + + void SettingsWidget::slot_sndSysSelected ( int system ) { - rbStartSnd->show(); - rbNotStartSnd->show(); - cbSndSshTun->hide(); - cbDefSndPort->setChecked ( true ); - cbDefSndPort->setEnabled ( true ); - - switch ( system ) - { - case PULSE: - { - rbStartSnd->hide(); - rbNotStartSnd->hide(); - cbSndSshTun->show(); - cbSndSshTun->setEnabled ( true ); - break; - } - case ARTS: - { - cbDefSndPort->setChecked ( false ); - cbDefSndPort->setEnabled ( false ); - sbSndPort->setValue ( 20221 ); - break; - } - case ESD: - { + rbStartSnd->show(); + rbNotStartSnd->show(); + cbSndSshTun->hide(); + cbDefSndPort->setChecked ( true ); + cbDefSndPort->setEnabled ( true ); + + switch ( system ) + { + case PULSE: + { + rbStartSnd->hide(); + rbNotStartSnd->hide(); + cbSndSshTun->show(); + cbSndSshTun->setEnabled ( true ); + break; + } + case ARTS: + { + cbDefSndPort->setChecked ( false ); + cbDefSndPort->setEnabled ( false ); + sbSndPort->setValue ( 20221 ); + break; + } + case ESD: + { #ifdef Q_OS_WIN - rbStartSnd->hide(); - rbNotStartSnd->hide(); - cbSndSshTun->show(); - cbSndSshTun->setEnabled ( false ); - cbSndSshTun->setChecked ( true ); + rbStartSnd->hide(); + rbNotStartSnd->hide(); + cbSndSshTun->show(); + cbSndSshTun->setEnabled ( false ); + cbSndSshTun->setChecked ( true ); #endif - sbSndPort->setValue ( 16001 ); - break; - } - } - slot_sndStartClicked(); + sbSndPort->setValue ( 16001 ); + break; + } + } + slot_sndStartClicked(); } void SettingsWidget::slot_sndToggled ( bool val ) { - arts->setEnabled ( val ); - pulse->setEnabled ( val ); - esd->setEnabled ( val ); - - rbStartSnd->setEnabled ( val ); - rbNotStartSnd->setEnabled ( val ); - - cbSndSshTun->setEnabled ( false ); - if ( pulse->isChecked() ) - cbSndSshTun->setEnabled ( val ); - lSndPort->setEnabled ( val ); - if ( !arts->isChecked() ) - cbDefSndPort->setEnabled ( val ); - sbSndPort->setEnabled ( val ); - if ( val ) - slot_sndStartClicked(); + arts->setEnabled ( val ); + pulse->setEnabled ( val ); + esd->setEnabled ( val ); + + rbStartSnd->setEnabled ( val ); + rbNotStartSnd->setEnabled ( val ); + + cbSndSshTun->setEnabled ( false ); + if ( pulse->isChecked() ) + cbSndSshTun->setEnabled ( val ); + lSndPort->setEnabled ( val ); + if ( !arts->isChecked() ) + cbDefSndPort->setEnabled ( val ); + sbSndPort->setEnabled ( val ); + if ( val ) + slot_sndStartClicked(); } void SettingsWidget::slot_sndStartClicked() { - bool start=rbStartSnd->isChecked(); + bool start=rbStartSnd->isChecked(); #ifdef Q_OS_WIN - start=false; + start=false; #endif - if ( pulse->isChecked() ) - { - lSndPort->setEnabled ( true ); - sbSndPort->setEnabled ( true ); - cbDefSndPort->setEnabled ( true ); - } - else - { - lSndPort->setEnabled ( !start ); - sbSndPort->setEnabled ( !start ); - cbDefSndPort->setEnabled ( !start ); - } - if ( arts->isChecked() ) - cbDefSndPort->setEnabled ( false ); - if ( ( !start && esd->isChecked() ) ||pulse->isChecked() ) - slot_sndDefPortChecked ( cbDefSndPort->isChecked() ); + if ( pulse->isChecked() ) + { + lSndPort->setEnabled ( true ); + sbSndPort->setEnabled ( true ); + cbDefSndPort->setEnabled ( true ); + } + else + { + lSndPort->setEnabled ( !start ); + sbSndPort->setEnabled ( !start ); + cbDefSndPort->setEnabled ( !start ); + } + if ( arts->isChecked() ) + cbDefSndPort->setEnabled ( false ); + if ( ( !start && esd->isChecked() ) ||pulse->isChecked() ) + slot_sndDefPortChecked ( cbDefSndPort->isChecked() ); } void SettingsWidget::slot_sndDefPortChecked ( bool val ) { - sbSndPort->setEnabled ( !val ); - lSndPort->setEnabled ( !val ); - if ( val ) - { - if ( pulse->isChecked() ) - sbSndPort->setValue ( 4713 ); - if ( arts->isChecked() ) - sbSndPort->setValue ( 20221 ); - if ( esd->isChecked() ) - sbSndPort->setValue ( 16001 ); - } + sbSndPort->setEnabled ( !val ); + lSndPort->setEnabled ( !val ); + if ( val ) + { + if ( pulse->isChecked() ) + sbSndPort->setValue ( 4713 ); + if ( arts->isChecked() ) + sbSndPort->setValue ( 20221 ); + if ( esd->isChecked() ) + sbSndPort->setValue ( 16001 ); + } } void SettingsWidget::readConfig() { - X2goSettings st ( "sessions" ); - - fs->setChecked ( - st.setting()->value ( sessionId+"/fullscreen", - ( QVariant ) mainWindow->getDefaultFullscreen() ).toBool() ); - - custom->setChecked ( ! st.setting()->value ( - sessionId+"/fullscreen", - ( QVariant ) mainWindow->getDefaultFullscreen() - ).toBool() ); - - - width->setValue ( - st.setting()->value ( sessionId+"/width", - ( QVariant ) mainWindow->getDefaultWidth() ).toInt() ); - height->setValue ( - st.setting()->value ( sessionId+"/height", - ( QVariant ) mainWindow->getDefaultHeight() ).toInt() ); - - cbSetDPI->setChecked ( - st.setting()->value ( sessionId+"/setdpi", - ( QVariant ) mainWindow->getDefaultSetDPI() ).toBool() ); - DPI->setEnabled ( cbSetDPI->isChecked() ); - DPI->setValue ( - st.setting()->value ( sessionId+"/dpi", - ( QVariant ) mainWindow->getDefaultDPI() ).toUInt() ); - - kbd->setChecked ( !st.setting()->value ( - sessionId+"/usekbd", - ( QVariant ) mainWindow->getDefaultSetKbd() - ).toBool() ); - layout->setText ( - st.setting()->value ( sessionId+"/layout", - ( QVariant ) mainWindow->getDefaultLayout() - ).toString() ); - type->setText ( - st.setting()->value ( sessionId+"/type", - ( QVariant ) mainWindow->getDefaultKbdType() - ).toString() ); - bool snd=st.setting()->value ( - sessionId+"/sound", - ( QVariant ) mainWindow->getDefaultUseSound() - ).toBool(); - QString sndsys=st.setting()->value ( sessionId+"/soundsystem", - "pulse" ).toString(); - bool startServ=st.setting()->value ( sessionId+"/startsoundsystem", - true ).toBool(); - bool sndInTun=st.setting()->value ( sessionId+"/soundtunnel", - true ).toBool(); - bool defSndPort=st.setting()->value ( sessionId+"/defsndport", - true ).toBool(); - int sndPort= st.setting()->value ( sessionId+"/sndport",4713 ).toInt(); - if ( startServ ) - rbStartSnd->setChecked ( true ); - else - rbNotStartSnd->setChecked ( true ); - - pulse->setChecked ( true ); - slot_sndSysSelected ( PULSE ); + X2goSettings st ( "sessions" ); + + fs->setChecked ( + st.setting()->value ( sessionId+"/fullscreen", + ( QVariant ) mainWindow->getDefaultFullscreen() ).toBool() ); + + custom->setChecked ( ! st.setting()->value ( + sessionId+"/fullscreen", + ( QVariant ) mainWindow->getDefaultFullscreen() + ).toBool() ); + + + width->setValue ( + st.setting()->value ( sessionId+"/width", + ( QVariant ) mainWindow->getDefaultWidth() ).toInt() ); + height->setValue ( + st.setting()->value ( sessionId+"/height", + ( QVariant ) mainWindow->getDefaultHeight() ).toInt() ); + + if (multiDisp) + { + bool md=st.setting()->value ( sessionId+"/multidisp", + ( QVariant ) false).toBool(); + if (md) + display->setChecked(true); + int disp=st.setting()->value ( sessionId+"/display", + ( QVariant ) 1).toUInt(); + if (disp<= displayNumber->maximum()) + displayNumber->setValue(disp); + else + displayNumber->setValue(1); + } + + cbSetDPI->setChecked ( + st.setting()->value ( sessionId+"/setdpi", + ( QVariant ) mainWindow->getDefaultSetDPI() ).toBool() ); + + cbXinerama->setChecked ( + st.setting()->value ( sessionId+"/xinerama", + ( QVariant ) false).toBool()); + + + DPI->setEnabled ( cbSetDPI->isChecked() ); + DPI->setValue ( + st.setting()->value ( sessionId+"/dpi", + ( QVariant ) mainWindow->getDefaultDPI() ).toUInt() ); + + kbd->setChecked ( !st.setting()->value ( + sessionId+"/usekbd", + ( QVariant ) mainWindow->getDefaultSetKbd() + ).toBool() ); + layout->setText ( + st.setting()->value ( sessionId+"/layout", + ( QVariant ) mainWindow->getDefaultLayout() + ).toString() ); + type->setText ( + st.setting()->value ( sessionId+"/type", + ( QVariant ) mainWindow->getDefaultKbdType() + ).toString() ); + bool snd=st.setting()->value ( + sessionId+"/sound", + ( QVariant ) mainWindow->getDefaultUseSound() + ).toBool(); + QString sndsys=st.setting()->value ( sessionId+"/soundsystem", + "pulse" ).toString(); + bool startServ=st.setting()->value ( sessionId+"/startsoundsystem", + true ).toBool(); + bool sndInTun=st.setting()->value ( sessionId+"/soundtunnel", + true ).toBool(); + bool defSndPort=st.setting()->value ( sessionId+"/defsndport", + true ).toBool(); + int sndPort= st.setting()->value ( sessionId+"/sndport",4713 ).toInt(); + if ( startServ ) + rbStartSnd->setChecked ( true ); + else + rbNotStartSnd->setChecked ( true ); + + pulse->setChecked ( true ); + slot_sndSysSelected ( PULSE ); #ifdef Q_OS_WIN - if ( sndsys=="arts" ) - { - sndsys="pulse"; - } + if ( sndsys=="arts" ) + { + sndsys="pulse"; + } #endif - if ( sndsys=="arts" ) - { - arts->setChecked ( true ); - slot_sndSysSelected ( ARTS ); - } + if ( sndsys=="arts" ) + { + arts->setChecked ( true ); + slot_sndSysSelected ( ARTS ); + } #ifdef Q_OS_DARWIN - sndsys="esd"; + sndsys="esd"; #endif - if ( sndsys=="esd" ) - { - esd->setChecked ( true ); - slot_sndSysSelected ( ESD ); - } - cbSndSshTun->setChecked ( sndInTun ); - sound->setChecked ( snd ); - if ( !defSndPort ) - sbSndPort->setValue ( sndPort ); - cbDefSndPort->setChecked ( defSndPort ); - if ( sndsys=="arts" ) - cbDefSndPort->setChecked ( false ); - slot_sndToggled ( snd ); - slot_sndStartClicked(); - - cbClientPrint->setChecked ( st.setting()->value ( sessionId+"/print", - true ).toBool() ); + if ( sndsys=="esd" ) + { + esd->setChecked ( true ); + slot_sndSysSelected ( ESD ); + } + cbSndSshTun->setChecked ( sndInTun ); + sound->setChecked ( snd ); + if ( !defSndPort ) + sbSndPort->setValue ( sndPort ); + cbDefSndPort->setChecked ( defSndPort ); + if ( sndsys=="arts" ) + cbDefSndPort->setChecked ( false ); + slot_sndToggled ( snd ); + slot_sndStartClicked(); + + cbClientPrint->setChecked ( st.setting()->value ( sessionId+"/print", + true ).toBool() ); } void SettingsWidget::setDefaults() { - fs->setChecked ( false ); - custom->setChecked ( true ); - width->setValue ( 800 ); - height->setValue ( 600 ); - - cbSetDPI->setChecked ( mainWindow->getDefaultSetDPI() ); - DPI->setValue ( mainWindow->getDefaultDPI() ); - DPI->setEnabled ( mainWindow->getDefaultSetDPI() ); - - kbd->setChecked ( !mainWindow->getDefaultSetKbd() ); - layout->setText ( tr ( "us" ) ); - type->setText ( tr ( "pc105/us" ) ); - sound->setChecked ( true ); - pulse->setChecked ( true ); - slot_sndToggled ( true ); - slot_sndSysSelected ( PULSE ); - cbSndSshTun->setChecked ( true ); - rbStartSnd->setChecked ( true ); - cbClientPrint->setChecked ( true ); + fs->setChecked ( false ); + display->setChecked ( false ); + lDisplay->setEnabled ( false ); + displayNumber->setEnabled ( false ); + custom->setChecked ( true ); + width->setValue ( 800 ); + height->setValue ( 600 ); + + cbSetDPI->setChecked ( mainWindow->getDefaultSetDPI() ); + DPI->setValue ( mainWindow->getDefaultDPI() ); + DPI->setEnabled ( mainWindow->getDefaultSetDPI() ); + + kbd->setChecked ( !mainWindow->getDefaultSetKbd() ); + layout->setText ( tr ( "us" ) ); + type->setText ( tr ( "pc105/us" ) ); + sound->setChecked ( true ); + pulse->setChecked ( true ); + slot_sndToggled ( true ); + slot_sndSysSelected ( PULSE ); + cbSndSshTun->setChecked ( true ); + rbStartSnd->setChecked ( true ); + cbClientPrint->setChecked ( true ); + cbXinerama->setChecked ( false ); } void SettingsWidget::saveSettings() { - X2goSettings st ( "sessions" ); - - st.setting()->setValue ( sessionId+"/fullscreen", - ( QVariant ) fs->isChecked() ); - st.setting()->setValue ( sessionId+"/width", - ( QVariant ) width->value() ); - st.setting()->setValue ( sessionId+"/height", - ( QVariant ) height->value() ); - st.setting()->setValue ( sessionId+"/dpi", - ( QVariant ) DPI->value() ); - st.setting()->setValue ( sessionId+"/setdpi", - ( QVariant ) cbSetDPI->isChecked() ); - st.setting()->setValue ( sessionId+"/usekbd", - ( QVariant ) !kbd->isChecked() ); - st.setting()->setValue ( sessionId+"/layout", - ( QVariant ) layout->text() ); - st.setting()->setValue ( sessionId+"/type", - ( QVariant ) type->text() ); - st.setting()->setValue ( sessionId+"/sound", - ( QVariant ) sound->isChecked() ); - if ( arts->isChecked() ) - st.setting()->setValue ( sessionId+"/soundsystem", - ( QVariant ) "arts" ); - if ( esd->isChecked() ) - st.setting()->setValue ( sessionId+"/soundsystem", - ( QVariant ) "esd" ); - if ( pulse->isChecked() ) - st.setting()->setValue ( sessionId+"/soundsystem", - ( QVariant ) "pulse" ); - - st.setting()->setValue ( sessionId+"/startsoundsystem", - ( QVariant ) rbStartSnd->isChecked() ); - st.setting()->setValue ( sessionId+"/soundtunnel", - ( QVariant ) cbSndSshTun->isChecked() ); - st.setting()->setValue ( sessionId+"/defsndport", - ( QVariant ) cbDefSndPort->isChecked() ); - st.setting()->setValue ( sessionId+"/sndport", - ( QVariant ) sbSndPort->value() ); - st.setting()->setValue ( sessionId+"/print", - ( QVariant ) cbClientPrint->isChecked() ); - st.setting()->sync(); + X2goSettings st ( "sessions" ); + + st.setting()->setValue ( sessionId+"/fullscreen", + ( QVariant ) fs->isChecked() ); + st.setting()->setValue ( sessionId+"/width", + ( QVariant ) width->value() ); + st.setting()->setValue ( sessionId+"/multidisp", + ( QVariant ) display->isChecked() ); + st.setting()->setValue ( sessionId+"/display", + ( QVariant ) displayNumber->value() ); + st.setting()->setValue ( sessionId+"/height", + ( QVariant ) height->value() ); + st.setting()->setValue ( sessionId+"/dpi", + ( QVariant ) DPI->value() ); + st.setting()->setValue ( sessionId+"/setdpi", + ( QVariant ) cbSetDPI->isChecked() ); + st.setting()->setValue ( sessionId+"/xinerama", + ( QVariant ) cbXinerama->isChecked() ); + + st.setting()->setValue ( sessionId+"/usekbd", + ( QVariant ) !kbd->isChecked() ); + st.setting()->setValue ( sessionId+"/layout", + ( QVariant ) layout->text() ); + st.setting()->setValue ( sessionId+"/type", + ( QVariant ) type->text() ); + st.setting()->setValue ( sessionId+"/sound", + ( QVariant ) sound->isChecked() ); + if ( arts->isChecked() ) + st.setting()->setValue ( sessionId+"/soundsystem", + ( QVariant ) "arts" ); + if ( esd->isChecked() ) + st.setting()->setValue ( sessionId+"/soundsystem", + ( QVariant ) "esd" ); + if ( pulse->isChecked() ) + st.setting()->setValue ( sessionId+"/soundsystem", + ( QVariant ) "pulse" ); + + st.setting()->setValue ( sessionId+"/startsoundsystem", + ( QVariant ) rbStartSnd->isChecked() ); + st.setting()->setValue ( sessionId+"/soundtunnel", + ( QVariant ) cbSndSshTun->isChecked() ); + st.setting()->setValue ( sessionId+"/defsndport", + ( QVariant ) cbDefSndPort->isChecked() ); + st.setting()->setValue ( sessionId+"/sndport", + ( QVariant ) sbSndPort->value() ); + st.setting()->setValue ( sessionId+"/print", + ( QVariant ) cbClientPrint->isChecked() ); + st.setting()->sync(); } diff --git a/settingswidget.h b/settingswidget.h index a52573b..8c5ebf8 100644 --- a/settingswidget.h +++ b/settingswidget.h @@ -23,49 +23,61 @@ class QCheckBox; class QLineEdit; class QSpinBox; class QLabel; +class QPushButton; +class QMainWindow; + + class SettingsWidget : public ConfigWidget { - Q_OBJECT - public: - SettingsWidget ( QString id, ONMainWindow * mw, - QWidget * parent=0, Qt::WindowFlags f=0 ); - ~SettingsWidget(); - void setDefaults(); - void saveSettings(); - private slots: - void slot_sndSysSelected ( int system ); - void slot_sndToggled ( bool val ); - void slot_sndStartClicked(); - void slot_sndDefPortChecked ( bool val ); - private: - enum {PULSE,ARTS,ESD}; - QSpinBox* width; - QSpinBox* height; - QRadioButton* fs; - QCheckBox* kbd; - QLineEdit* layout; - QLineEdit* type; - QRadioButton* custom; - QRadioButton* arts; - QRadioButton* pulse; - QRadioButton* esd; - QCheckBox* sound; - QRadioButton* rbStartSnd; - QRadioButton* rbNotStartSnd; - QCheckBox* cbSndSshTun; - QCheckBox* cbClientPrint; - QCheckBox* cbDefSndPort; - QCheckBox* cbSetDPI; - QLabel* lSndPort; - QSpinBox* sbSndPort; - QSpinBox* DPI; - QLabel* widthLabel; - QLabel* heightLabel; - QLabel* layoutLabel; - QLabel* typeLabel; - private: - void readConfig(); - + Q_OBJECT +public: + SettingsWidget ( QString id, ONMainWindow * mw, + QWidget * parent=0, Qt::WindowFlags f=0 ); + ~SettingsWidget(); + void setDefaults(); + void saveSettings(); +private slots: + void slot_sndSysSelected ( int system ); + void slot_sndToggled ( bool val ); + void slot_sndStartClicked(); + void slot_sndDefPortChecked ( bool val ); + void slot_identDisplays(); + void slot_hideIdentWins(); +private: + enum {PULSE,ARTS,ESD}; + QSpinBox* width; + QSpinBox* height; + QSpinBox* displayNumber; + QRadioButton* fs; + QCheckBox* kbd; + QLineEdit* layout; + QLineEdit* type; + QRadioButton* custom; + QRadioButton* display; + QRadioButton* arts; + QRadioButton* pulse; + QRadioButton* esd; + QCheckBox* sound; + QRadioButton* rbStartSnd; + QRadioButton* rbNotStartSnd; + QCheckBox* cbSndSshTun; + QCheckBox* cbClientPrint; + QCheckBox* cbDefSndPort; + QCheckBox* cbSetDPI; + QCheckBox* cbXinerama; + QLabel* lSndPort; + QSpinBox* sbSndPort; + QSpinBox* DPI; + QLabel* widthLabel; + QLabel* heightLabel; + QLabel* layoutLabel; + QLabel* typeLabel; + QLabel* lDisplay; + bool multiDisp; + QPushButton* pbIdentDisp; + QList <QMainWindow*> identWins; +private: + void readConfig(); }; #endif diff --git a/sshmasterconnection.cpp b/sshmasterconnection.cpp index 1f89963..ef08cd8 100644 --- a/sshmasterconnection.cpp +++ b/sshmasterconnection.cpp @@ -27,16 +27,18 @@ #ifndef Q_OS_WIN #include <arpa/inet.h> #endif +#include <math.h> #include "onmainwindow.h" #undef DEBUG -// #define DEBUG +//#define DEBUG static bool isLibSshInited=false; + SshMasterConnection::SshMasterConnection ( QString host, int port, bool acceptUnknownServers, QString user, - QString pass, QString key,bool autologin, QObject* parent ) : QThread ( parent ) + QString pass, QString key,bool autologin, bool krblogin, QObject* parent ) : QThread ( parent ) { this->host=host; this->port=port; @@ -47,12 +49,20 @@ SshMasterConnection::SshMasterConnection ( QString host, int port, bool acceptUn this->acceptUnknownServers=acceptUnknownServers; reverseTunnel=false; mainWnd=(ONMainWindow*) parent; + kerberos=krblogin; +#ifdef DEBUG + if (kerberos) + x2goDebug<<"starting ssh connection with kerberos authentication"<<endl; + else + x2goDebug<<"starting ssh connection without kerberos authentication"<<endl; +#endif +kerberos=false; } SshMasterConnection::SshMasterConnection ( QString host, int port, bool acceptUnknownServers, QString user, QString pass, QString key, bool autologin, - int remotePort, QString localHost, int localPort, SshProcess* creator, - QObject* parent, ONMainWindow* mwd ) : QThread ( parent ) + int remotePort, QString localHost, int localPort, SshProcess* creator, + QObject* parent, ONMainWindow* mwd ) : QThread ( parent ) { this->host=host; @@ -76,6 +86,7 @@ SshMasterConnection* SshMasterConnection::reverseTunnelConnection ( SshProcess* SshMasterConnection* con=new SshMasterConnection ( host,port,acceptUnknownServers,user,pass, key,autologin, remotePort,localHost, localPort,creator,this, mainWnd); + con->kerberos=kerberos; connect ( con,SIGNAL ( ioErr ( SshProcess*,QString,QString ) ),this,SIGNAL ( ioErr ( SshProcess*,QString,QString ) ) ); connect ( con,SIGNAL ( stdErr ( SshProcess*,QByteArray ) ),this,SIGNAL ( stdErr ( SshProcess*,QByteArray ) ) ); @@ -125,7 +136,7 @@ void SshMasterConnection::run() quit(); return; } -#ifdef Q_OS_WIN +#ifdef Q_OS_WIN ssh_options_set ( my_ssh_session, SSH_OPTIONS_SSH_DIR, (mainWnd->getHomeDirectory()+"/ssh").toAscii()); #endif // ssh_options_set(my_ssh_session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity); @@ -153,21 +164,26 @@ void SshMasterConnection::run() } ssh_options_set ( my_ssh_session, SSH_OPTIONS_USER, user.toAscii() ); -#ifdef Q_OS_WIN +#ifdef Q_OS_WIN ssh_options_set ( my_ssh_session, SSH_OPTIONS_SSH_DIR, (mainWnd->getHomeDirectory()+"/ssh").toAscii()); -#endif + +#ifdef DEBUG x2goDebug<<"setting SSH DIR to "<<mainWnd->getHomeDirectory()+"/ssh"; +#endif +#endif if ( userAuth() ) { - #ifdef DEBUG +#ifdef DEBUG x2goDebug<<"user auth OK\n"; - #endif +#endif emit connectionOk(host); } else { - QString err=ssh_get_error ( my_ssh_session ); + QString err; + if (!kerberos) + err=ssh_get_error ( my_ssh_session ); QString message=tr ( "Authentication failed" ); x2goDebug<<message<<" - "<<err; emit userAuthError ( authErrors.join ( "\n" ) ); @@ -237,6 +253,8 @@ bool SshMasterConnection::sshConnect() } + + int SshMasterConnection::serverAuth ( QString& errorMsg ) { #ifdef DEBUG @@ -250,6 +268,7 @@ int SshMasterConnection::serverAuth ( QString& errorMsg ) state = ssh_is_server_known ( my_ssh_session ); hlen = ssh_get_pubkey_hash ( my_ssh_session, &hash ); + if ( hlen < 0 ) return SSH_SERVER_ERROR; diff --git a/sshmasterconnection.h b/sshmasterconnection.h index 0de9a22..c5d79e1 100644 --- a/sshmasterconnection.h +++ b/sshmasterconnection.h @@ -56,7 +56,7 @@ class SshMasterConnection: public QThread public: void run(); SshMasterConnection(QString host, int port, bool acceptUnknownServers, QString user, - QString pass, QString key,bool autologin, QObject* parent = 0); + QString pass, QString key, bool autologin, bool krblogin, QObject* parent = 0); ~SshMasterConnection(); static void finalizeLibSsh(); void addChannelConnection(SshProcess* creator, int sock, QString forwardHost, @@ -66,16 +66,33 @@ public: void disconnectSession(); void setAcceptUnknownServers(bool accept) { - acceptUnknownServers=accept; + acceptUnknownServers=accept; } - SshMasterConnection* reverseTunnelConnection(SshProcess* creator, int remotePort, QString localHost, int localPort); - QString getHost(){return host;} + SshMasterConnection* reverseTunnelConnection(SshProcess* creator, int remotePort, + QString localHost, int localPort); + QString getHost() + { + return host; + } + QString getUser() + { + return user; + } + int getPort() + { + return port; + } + bool useKerberos() + { + return kerberos; + }; + private: SshMasterConnection(QString host, int port, bool acceptUnknownServers, QString user, QString pass, QString key, bool autologin, - int remotePort, QString localHost, int localPort, SshProcess* creator, - QObject* parent, ONMainWindow* parWnd); + int remotePort, QString localHost, int localPort, SshProcess* creator, + QObject* parent, ONMainWindow* parWnd); bool sshConnect(); bool userAuthWithPass(); bool userAuthAuto(); @@ -85,6 +102,9 @@ private: void finalize(int arg1); void copy(); int serverAuth(QString& errorMsg); +#ifdef Q_OS_WIN + void parseKnownHosts(); +#endif private: ssh_session my_ssh_session; @@ -108,8 +128,10 @@ private: int reverseTunnelLocalPort; bool acceptUnknownServers; QString reverseTunnelLocalHost; - SshProcess* reverseTunnelCreator; + SshProcess* reverseTunnelCreator; ONMainWindow* mainWnd; + bool kerberos; + QString sshProcErrString; signals: void stdErr(SshProcess* caller, QByteArray data); diff --git a/version.h b/version.h index d74ef6a..6e5c5e0 100644 --- a/version.h +++ b/version.h @@ -1 +1 @@ -#define VERSION "3.99.0.3" +#define VERSION "3.99.0.4" diff --git a/wapi.cpp b/wapi.cpp index e565cc6..9af6085 100644 --- a/wapi.cpp +++ b/wapi.cpp @@ -13,415 +13,488 @@ long wapiSetFSWindow ( HWND hWnd, const QRect& desktopGeometry ) { - long style=GetWindowLong ( hWnd,GWL_STYLE ); - SetWindowPos ( hWnd, HWND_TOP, desktopGeometry.x(), - desktopGeometry.y(), - desktopGeometry.width(), - desktopGeometry.height(), - SWP_FRAMECHANGED ); - SetWindowLong ( hWnd, GWL_STYLE, - WS_VISIBLE | WS_SYSMENU | - WS_CLIPCHILDREN | WS_CLIPSIBLINGS ); - - SetWindowPos ( hWnd, HWND_TOP, desktopGeometry.x(), - desktopGeometry.y(), - desktopGeometry.width(), - desktopGeometry.height(), - SWP_FRAMECHANGED ); - - SetForegroundWindow ( hWnd ); - return style; + long style=GetWindowLong ( hWnd,GWL_STYLE ); + SetWindowPos ( hWnd, HWND_TOP, desktopGeometry.x(), + desktopGeometry.y(), + desktopGeometry.width(), + desktopGeometry.height(), + SWP_FRAMECHANGED ); + SetWindowLong ( hWnd, GWL_STYLE, + WS_VISIBLE | WS_SYSMENU | + WS_CLIPCHILDREN | WS_CLIPSIBLINGS ); + + SetWindowPos ( hWnd, HWND_TOP, desktopGeometry.x(), + desktopGeometry.y(), + desktopGeometry.width(), + desktopGeometry.height(), + SWP_FRAMECHANGED ); + + SetForegroundWindow ( hWnd ); + return style; } void wapiRestoreWindow( HWND hWnd, long style, const QRect& desktopGeometry ) { - SetWindowLong ( hWnd, GWL_STYLE,style); - SetWindowPos ( hWnd, HWND_TOP, desktopGeometry.x(), - desktopGeometry.y(), - desktopGeometry.width(), - desktopGeometry.height(), - SWP_FRAMECHANGED ); + SetWindowLong ( hWnd, GWL_STYLE,style); + SetWindowPos ( hWnd, HWND_TOP, desktopGeometry.x(), + desktopGeometry.y(), + desktopGeometry.width(), + desktopGeometry.height(), + SWP_FRAMECHANGED ); } void wapiHideFromTaskBar ( HWND wnd ) { - ShowWindow ( wnd, SW_HIDE ) ; - SetWindowLong ( wnd, GWL_EXSTYLE, GetWindowLong ( wnd, GWL_EXSTYLE ) & - ~WS_EX_APPWINDOW ); - SetWindowLong ( wnd, GWL_EXSTYLE, GetWindowLong ( wnd, GWL_EXSTYLE ) | - WS_EX_TOOLWINDOW ); - ShowWindow ( wnd, SW_SHOW ) ; + ShowWindow ( wnd, SW_HIDE ) ; + SetWindowLong ( wnd, GWL_EXSTYLE, GetWindowLong ( wnd, GWL_EXSTYLE ) & + ~WS_EX_APPWINDOW ); + SetWindowLong ( wnd, GWL_EXSTYLE, GetWindowLong ( wnd, GWL_EXSTYLE ) | + WS_EX_TOOLWINDOW ); + ShowWindow ( wnd, SW_SHOW ) ; } HWND wapiSetParent ( HWND child, HWND par ) { - HWND wn=SetParent ( child,par ); - if ( par ) - SetWindowLong ( child, GWL_STYLE, - GetWindowLong ( child, GWL_STYLE ) | WS_CHILD ); - else - SetWindowLong ( - child, GWL_STYLE, - GetWindowLong ( child, GWL_STYLE ) &~ WS_CHILD ); - SetWindowLong ( child, GWL_STYLE, - GetWindowLong ( child, GWL_STYLE ) | WS_POPUP ); - return wn; + HWND wn=SetParent ( child,par ); + if ( par ) + SetWindowLong ( child, GWL_STYLE, + GetWindowLong ( child, GWL_STYLE ) | WS_CHILD ); + else + SetWindowLong ( + child, GWL_STYLE, + GetWindowLong ( child, GWL_STYLE ) &~ WS_CHILD ); + SetWindowLong ( child, GWL_STYLE, + GetWindowLong ( child, GWL_STYLE ) | WS_POPUP ); + return wn; } bool wapiClientRect ( HWND wnd, QRect& rect ) { - RECT rcWindow; - if ( GetClientRect ( wnd,&rcWindow ) ) - { - rect.setCoords ( rcWindow.left, - rcWindow.top, - rcWindow.right,rcWindow.bottom ); - return true; - } - return false; + RECT rcWindow; + if ( GetClientRect ( wnd,&rcWindow ) ) + { + rect.setCoords ( rcWindow.left, + rcWindow.top, + rcWindow.right,rcWindow.bottom ); + return true; + } + return false; +} + +bool wapiWindowRectWithoutDecoration ( HWND wnd, QRect& rect ) +{ + RECT rcWindow; + if ( GetClientRect ( wnd,&rcWindow ) ) + { + POINT pnt; + pnt.x=0; + pnt.y=0; + ClientToScreen(wnd,&pnt); + rect.setRect ( pnt.x, + pnt.y, + rcWindow.right-rcWindow.left,rcWindow.bottom-rcWindow.top ); + return true; + } + return false; } + bool wapiWindowRect ( HWND wnd, QRect& rect ) { - RECT rcWindow; - if ( GetWindowRect ( wnd,&rcWindow ) ) - { - rect.setCoords ( rcWindow.left, - rcWindow.top, - rcWindow.right,rcWindow.bottom ); - return true; - } - return false; + RECT rcWindow; + if ( GetWindowRect ( wnd,&rcWindow ) ) + { + rect.setCoords ( rcWindow.left, + rcWindow.top, + rcWindow.right,rcWindow.bottom ); + return true; + } + return false; } bool wapiGetBorders ( HWND wnd, int& vBorder, int& hBorder, int& barHeight ) { - WINDOWINFO wifo; - wifo.cbSize=sizeof ( WINDOWINFO ); - if ( !GetWindowInfo ( wnd,&wifo ) ) - return false; - vBorder=wifo.cxWindowBorders; - hBorder=wifo.cyWindowBorders; - TITLEBARINFO bifo; - bifo.cbSize=sizeof ( TITLEBARINFO ); - if ( !GetTitleBarInfo ( wnd,&bifo ) ) - return false; - barHeight=bifo.rcTitleBar.bottom-bifo.rcTitleBar.top; - - return true; + WINDOWINFO wifo; + wifo.cbSize=sizeof ( WINDOWINFO ); + if ( !GetWindowInfo ( wnd,&wifo ) ) + return false; + vBorder=wifo.cxWindowBorders; + hBorder=wifo.cyWindowBorders; + TITLEBARINFO bifo; + bifo.cbSize=sizeof ( TITLEBARINFO ); + if ( !GetTitleBarInfo ( wnd,&bifo ) ) + return false; + barHeight=bifo.rcTitleBar.bottom-bifo.rcTitleBar.top; + + return true; } bool wapiShowWindow ( HWND wnd, wapiCmdShow nCmdShow ) { - int cmd=WAPI_SHOWNORMAL; - switch ( nCmdShow ) - { - case WAPI_FORCEMINIMIZE:cmd=SW_FORCEMINIMIZE;break; - case WAPI_HIDE:cmd=SW_HIDE;break; - case WAPI_MAXIMIZE:cmd=SW_MAXIMIZE;break; - case WAPI_MINIMIZE:cmd=SW_MINIMIZE;break; - case WAPI_RESTORE:cmd=SW_RESTORE;break; - case WAPI_SHOW:cmd=SW_SHOW;break; - case WAPI_SHOWDEFAULT:cmd=SW_SHOWDEFAULT;break; - case WAPI_SHOWMAXIMIZED:cmd=SW_SHOWMAXIMIZED;break; - case WAPI_SHOWMINIMIZED:cmd=SW_SHOWMINIMIZED;break; - case WAPI_SHOWMINNOACTIVE:cmd=SW_SHOWMINNOACTIVE;break; - case WAPI_SHOWNA:cmd=SW_SHOWNA;break; - case WAPI_SHOWNOACTIVATE:cmd=SW_SHOWNOACTIVATE;break; - case WAPI_SHOWNORMAL:cmd=SW_SHOWNORMAL;break; - } - - return ShowWindow ( wnd, cmd ); + int cmd=WAPI_SHOWNORMAL; + switch ( nCmdShow ) + { + case WAPI_FORCEMINIMIZE: + cmd=SW_FORCEMINIMIZE; + break; + case WAPI_HIDE: + cmd=SW_HIDE; + break; + case WAPI_MAXIMIZE: + cmd=SW_MAXIMIZE; + break; + case WAPI_MINIMIZE: + cmd=SW_MINIMIZE; + break; + case WAPI_RESTORE: + cmd=SW_RESTORE; + break; + case WAPI_SHOW: + cmd=SW_SHOW; + break; + case WAPI_SHOWDEFAULT: + cmd=SW_SHOWDEFAULT; + break; + case WAPI_SHOWMAXIMIZED: + cmd=SW_SHOWMAXIMIZED; + break; + case WAPI_SHOWMINIMIZED: + cmd=SW_SHOWMINIMIZED; + break; + case WAPI_SHOWMINNOACTIVE: + cmd=SW_SHOWMINNOACTIVE; + break; + case WAPI_SHOWNA: + cmd=SW_SHOWNA; + break; + case WAPI_SHOWNOACTIVATE: + cmd=SW_SHOWNOACTIVATE; + break; + case WAPI_SHOWNORMAL: + cmd=SW_SHOWNORMAL; + break; + } + + return ShowWindow ( wnd, cmd ); } bool wapiUpdateWindow ( HWND wnd ) { - return RedrawWindow ( wnd,0,0,RDW_INVALIDATE ); + return RedrawWindow ( wnd,0,0,RDW_INVALIDATE ); } bool wapiMoveWindow ( HWND wnd, int x, int y, int width, int height, bool repaint ) { - return MoveWindow ( wnd, x, y, width, height, repaint ); + return MoveWindow ( wnd, x, y, width, height, repaint ); } HWND wapiFindWindow ( const ushort * className, const ushort * text ) { - return FindWindowEx ( 0,0, ( LPCTSTR ) className, ( LPCTSTR ) text ); + return FindWindowEx ( 0,0, ( LPCTSTR ) className, ( LPCTSTR ) text ); +} + +bool wapiSetWindowText( HWND wnd, const QString& text) +{ + return SetWindowText(wnd, (LPCTSTR)text.utf16() ); } +void wapiSetWindowIcon ( HWND wnd, const QPixmap& icon) +{ + int iconx=GetSystemMetrics(SM_CXICON); + int icony=GetSystemMetrics(SM_CYICON); + int smallx=GetSystemMetrics(SM_CXSMICON); + int smally=GetSystemMetrics(SM_CXSMICON); + + HICON largeIcon=0; + HICON smallIcon=0; + + largeIcon=icon.scaled(iconx,icony, Qt::IgnoreAspectRatio,Qt::SmoothTransformation).toWinHICON (); + smallIcon=icon.scaled(smallx,smally, Qt::IgnoreAspectRatio,Qt::SmoothTransformation).toWinHICON (); + + x2goDebug<<"large icon: "<<largeIcon<<iconx<<"x"<<icony<<endl; + x2goDebug<<"small icon: "<<smallIcon<<smallx<<"x"<<smally<<endl; + int rez=SetClassLong(wnd,GCL_HICON, (LONG)largeIcon); + if (!rez) + x2goDebug<<"ERROR: "<<GetLastError()<<endl; + rez=SetClassLong(wnd,GCL_HICONSM,(LONG)smallIcon); + if (!rez) + x2goDebug<<"ERROR: "<<GetLastError()<<endl; + /* ShowWindow(wnd, SW_HIDE); + ShowWindow(wnd, SW_SHOW);*/ +} QString wapiShortFileName ( const QString& longName ) { - long length = 0; - TCHAR* buffer = NULL; - - length = GetShortPathName ( ( LPCTSTR ) longName.utf16(), NULL, 0 ); - if ( !length ) - { - return QString::null; - } - - buffer = new TCHAR[length]; - length = GetShortPathName ( ( LPCTSTR ) longName.utf16(), - buffer,length ); - if ( !length ) - { - delete []buffer; - return QString::null; - } - QString spath=QString::fromUtf16 ( ( const ushort* ) buffer ); - delete []buffer; - return spath; + long length = 0; + TCHAR* buffer = NULL; + + length = GetShortPathName ( ( LPCTSTR ) longName.utf16(), NULL, 0 ); + if ( !length ) + { + return QString::null; + } + + buffer = new TCHAR[length]; + length = GetShortPathName ( ( LPCTSTR ) longName.utf16(), + buffer,length ); + if ( !length ) + { + delete []buffer; + return QString::null; + } + QString spath=QString::fromUtf16 ( ( const ushort* ) buffer ); + delete []buffer; + return spath; } QString wapiGetDriveByLabel(const QString& label) { - int len=GetLogicalDriveStrings(0,0); - if(len>0) - { - TCHAR* buf=new TCHAR[len+1]; - len=GetLogicalDriveStrings(len,buf); - for(int i=0;i<len;i+=4) - { - QString drive=QString::fromUtf16 ( ( const ushort* ) buf+i ); - x2goDebug<<"drive:"<<drive; - TCHAR vol[MAX_PATH+1]; - TCHAR fs[MAX_PATH+1]; - GetVolumeInformation(buf+i,vol,MAX_PATH,0,0,0,fs,MAX_PATH); - QString volume=QString::fromUtf16 ( ( const ushort* ) vol ); - x2goDebug<<"vol:"<<volume<< - "fs:"<<QString::fromUtf16 ( ( const ushort* ) fs ); - if(!volume.compare(label,Qt::CaseInsensitive)) - { - x2goDebug<<"matched! "; - - delete []buf; - return drive.replace(":\\",""); - } + int len=GetLogicalDriveStrings(0,0); + if (len>0) + { + TCHAR* buf=new TCHAR[len+1]; + len=GetLogicalDriveStrings(len,buf); + for (int i=0;i<len;i+=4) + { + QString drive=QString::fromUtf16 ( ( const ushort* ) buf+i ); + x2goDebug<<"drive:"<<drive; + TCHAR vol[MAX_PATH+1]; + TCHAR fs[MAX_PATH+1]; + GetVolumeInformation(buf+i,vol,MAX_PATH,0,0,0,fs,MAX_PATH); + QString volume=QString::fromUtf16 ( ( const ushort* ) vol ); + x2goDebug<<"vol:"<<volume<< + "fs:"<<QString::fromUtf16 ( ( const ushort* ) fs ); + if (!volume.compare(label,Qt::CaseInsensitive)) + { + x2goDebug<<"matched! "; + + delete []buf; + return drive.replace(":\\",""); + } + } + delete []buf; } - delete []buf; - } - - return label; + + return label; } QString getNameFromSid ( PSID psid, QString* systemName ) { - DWORD length=0; - DWORD dlength=0; - TCHAR* name=0; - TCHAR* sysName=0; - SID_NAME_USE eUse; - - LookupAccountSid ( 0,psid, - name,&length,sysName,&dlength,&eUse ); - if ( !length ) - { - return QString::null; - } - - name=new TCHAR[length]; - sysName=new TCHAR[dlength]; - - if ( ! LookupAccountSid ( 0,psid, - name,&length,sysName, - &dlength,&eUse ) ) - { - delete []name; - delete []sysName; - return QString::null; - } - - QString strName=QString::fromUtf16 ( - ( const ushort* ) name ); - if ( systemName ) - *systemName=QString::fromUtf16 ( - ( const ushort* ) sysName ); - delete []sysName; - delete []name; - return strName; + DWORD length=0; + DWORD dlength=0; + TCHAR* name=0; + TCHAR* sysName=0; + SID_NAME_USE eUse; + + LookupAccountSid ( 0,psid, + name,&length,sysName,&dlength,&eUse ); + if ( !length ) + { + return QString::null; + } + + name=new TCHAR[length]; + sysName=new TCHAR[dlength]; + + if ( ! LookupAccountSid ( 0,psid, + name,&length,sysName, + &dlength,&eUse ) ) + { + delete []name; + delete []sysName; + return QString::null; + } + + QString strName=QString::fromUtf16 ( + ( const ushort* ) name ); + if ( systemName ) + *systemName=QString::fromUtf16 ( + ( const ushort* ) sysName ); + delete []sysName; + delete []name; + return strName; } QString getStringFromSid ( PSID psid ) { - LPTSTR stringSid; - ConvertSidToStringSid ( psid, - &stringSid ); - QString str=QString::fromUtf16 ( - ( const ushort* ) stringSid ); - LocalFree ( stringSid ); - return str; + LPTSTR stringSid; + ConvertSidToStringSid ( psid, + &stringSid ); + QString str=QString::fromUtf16 ( + ( const ushort* ) stringSid ); + LocalFree ( stringSid ); + return str; } bool wapiAccountInfo ( QString* retSid, QString* retUname, QString* primaryGroupSID, QString* primaryGroupName, QString* retSysName ) { - HANDLE hToken; - if ( !OpenProcessToken ( GetCurrentProcess(), - TOKEN_QUERY, &hToken ) ) - { - return false; - } - if ( primaryGroupSID || primaryGroupName ) - { - PTOKEN_PRIMARY_GROUP pGroupInfo=0; - DWORD dwResult=0; - DWORD dwSize=0; - if ( !GetTokenInformation ( hToken, TokenPrimaryGroup, - NULL, dwSize, &dwSize ) ) - { - dwResult = GetLastError(); - if ( dwResult != ERROR_INSUFFICIENT_BUFFER ) - { - CloseHandle ( hToken ); - return false; - } - } - pGroupInfo = ( PTOKEN_PRIMARY_GROUP ) GlobalAlloc ( GPTR, - dwSize ); - - if ( ! GetTokenInformation ( hToken, TokenPrimaryGroup, - pGroupInfo, - dwSize, &dwSize ) ) - { - if ( pGroupInfo ) - GlobalFree ( pGroupInfo ); - CloseHandle ( hToken ); - return false; - } - - if ( primaryGroupSID ) - { - *primaryGroupSID=getStringFromSid ( - pGroupInfo->PrimaryGroup ); - } - if ( primaryGroupName ) - { - *primaryGroupName=getNameFromSid ( - pGroupInfo->PrimaryGroup, - retSysName ); - } - - if ( pGroupInfo ) - GlobalFree ( pGroupInfo ); - } - if ( retSid || retUname ) - { - PTOKEN_USER pUserInfo=0; - DWORD dwResult=0; - DWORD dwSize=0; - - if ( !GetTokenInformation ( hToken, TokenUser, - NULL, dwSize, &dwSize ) ) - { - dwResult = GetLastError(); - if ( dwResult != ERROR_INSUFFICIENT_BUFFER ) - { - CloseHandle ( hToken ); - return false; - } - } - pUserInfo = ( PTOKEN_USER ) GlobalAlloc ( GPTR, - dwSize ); - - if ( ! GetTokenInformation ( hToken, TokenUser, - pUserInfo, - dwSize, &dwSize ) ) - { - if ( pUserInfo ) - GlobalFree ( pUserInfo ); - CloseHandle ( hToken ); - return false; - } - - if ( retSid ) - { - *retSid=getStringFromSid ( - pUserInfo->User.Sid ); - } - if ( retUname ) - { - *retUname=getNameFromSid ( - pUserInfo->User.Sid, - retSysName ); - } - if ( pUserInfo ) - GlobalFree ( pUserInfo ); - } - CloseHandle ( hToken ); - return true; + HANDLE hToken; + if ( !OpenProcessToken ( GetCurrentProcess(), + TOKEN_QUERY, &hToken ) ) + { + return false; + } + if ( primaryGroupSID || primaryGroupName ) + { + PTOKEN_PRIMARY_GROUP pGroupInfo=0; + DWORD dwResult=0; + DWORD dwSize=0; + if ( !GetTokenInformation ( hToken, TokenPrimaryGroup, + NULL, dwSize, &dwSize ) ) + { + dwResult = GetLastError(); + if ( dwResult != ERROR_INSUFFICIENT_BUFFER ) + { + CloseHandle ( hToken ); + return false; + } + } + pGroupInfo = ( PTOKEN_PRIMARY_GROUP ) GlobalAlloc ( GPTR, + dwSize ); + + if ( ! GetTokenInformation ( hToken, TokenPrimaryGroup, + pGroupInfo, + dwSize, &dwSize ) ) + { + if ( pGroupInfo ) + GlobalFree ( pGroupInfo ); + CloseHandle ( hToken ); + return false; + } + + if ( primaryGroupSID ) + { + *primaryGroupSID=getStringFromSid ( + pGroupInfo->PrimaryGroup ); + } + if ( primaryGroupName ) + { + *primaryGroupName=getNameFromSid ( + pGroupInfo->PrimaryGroup, + retSysName ); + } + + if ( pGroupInfo ) + GlobalFree ( pGroupInfo ); + } + if ( retSid || retUname ) + { + PTOKEN_USER pUserInfo=0; + DWORD dwResult=0; + DWORD dwSize=0; + + if ( !GetTokenInformation ( hToken, TokenUser, + NULL, dwSize, &dwSize ) ) + { + dwResult = GetLastError(); + if ( dwResult != ERROR_INSUFFICIENT_BUFFER ) + { + CloseHandle ( hToken ); + return false; + } + } + pUserInfo = ( PTOKEN_USER ) GlobalAlloc ( GPTR, + dwSize ); + + if ( ! GetTokenInformation ( hToken, TokenUser, + pUserInfo, + dwSize, &dwSize ) ) + { + if ( pUserInfo ) + GlobalFree ( pUserInfo ); + CloseHandle ( hToken ); + return false; + } + + if ( retSid ) + { + *retSid=getStringFromSid ( + pUserInfo->User.Sid ); + } + if ( retUname ) + { + *retUname=getNameFromSid ( + pUserInfo->User.Sid, + retSysName ); + } + if ( pUserInfo ) + GlobalFree ( pUserInfo ); + } + CloseHandle ( hToken ); + return true; } void wapiShellExecute ( const QString& operation, const QString& file, const QString& parameters, const QString& dir, HWND win ) { - if ( parameters==QString::null ) - ShellExecute ( win, ( LPCTSTR ) ( operation.utf16() ), - ( LPCTSTR ) ( file.utf16() ),0, - ( LPCTSTR ) ( dir.utf16() ),SW_SHOWNORMAL ); - else - ShellExecute ( win, ( LPCTSTR ) ( operation.utf16() ), - ( LPCTSTR ) ( file.utf16() ), - ( LPCTSTR ) ( parameters.utf16() ), - ( LPCTSTR ) ( dir.utf16() ),SW_SHOWNORMAL ); + if ( parameters==QString::null ) + ShellExecute ( win, ( LPCTSTR ) ( operation.utf16() ), + ( LPCTSTR ) ( file.utf16() ),0, + ( LPCTSTR ) ( dir.utf16() ),SW_SHOWNORMAL ); + else + ShellExecute ( win, ( LPCTSTR ) ( operation.utf16() ), + ( LPCTSTR ) ( file.utf16() ), + ( LPCTSTR ) ( parameters.utf16() ), + ( LPCTSTR ) ( dir.utf16() ),SW_SHOWNORMAL ); } QString wapiGetDefaultPrinter() { - TCHAR *prName; - DWORD length; - GetDefaultPrinter ( 0,&length ); - if ( !length ) - return QString::null; - prName=new TCHAR[length]; - GetDefaultPrinter ( prName,&length ); - if ( !length ) - { - delete []prName; - return QString::null; - } - QString printer=QString::fromUtf16 ( ( const ushort* ) prName ); - delete []prName; - return printer; + TCHAR *prName; + DWORD length; + GetDefaultPrinter ( 0,&length ); + if ( !length ) + return QString::null; + prName=new TCHAR[length]; + GetDefaultPrinter ( prName,&length ); + if ( !length ) + { + delete []prName; + return QString::null; + } + QString printer=QString::fromUtf16 ( ( const ushort* ) prName ); + delete []prName; + return printer; } QStringList wapiGetLocalPrinters() { - QStringList printers; - PRINTER_INFO_4 *info_array; - DWORD sizeOfArray; - DWORD bufSize=0; - DWORD sizeNeeded=0; - EnumPrinters ( PRINTER_ENUM_LOCAL,0,4,NULL,bufSize, - &sizeNeeded,&sizeOfArray ); - if ( !sizeNeeded ) - { - return printers; - } - info_array= ( PRINTER_INFO_4* ) new char[sizeNeeded]; - if ( !info_array ) - return printers; - bufSize=sizeNeeded; - EnumPrinters ( PRINTER_ENUM_LOCAL,0,4, ( LPBYTE ) info_array,bufSize, - &sizeNeeded,&sizeOfArray ); - if ( !sizeNeeded || !sizeOfArray ) - { - delete []info_array; - return printers; - } - for ( uint i=0;i<sizeOfArray;++i ) - { - printers<<QString::fromUtf16 ( - ( const ushort* ) ( info_array[i].pPrinterName ) ); - } - delete []info_array; - return printers; + QStringList printers; + PRINTER_INFO_4 *info_array; + DWORD sizeOfArray; + DWORD bufSize=0; + DWORD sizeNeeded=0; + EnumPrinters ( PRINTER_ENUM_LOCAL,0,4,NULL,bufSize, + &sizeNeeded,&sizeOfArray ); + if ( !sizeNeeded ) + { + return printers; + } + info_array= ( PRINTER_INFO_4* ) new char[sizeNeeded]; + if ( !info_array ) + return printers; + bufSize=sizeNeeded; + EnumPrinters ( PRINTER_ENUM_LOCAL,0,4, ( LPBYTE ) info_array,bufSize, + &sizeNeeded,&sizeOfArray ); + if ( !sizeNeeded || !sizeOfArray ) + { + delete []info_array; + return printers; + } + for ( uint i=0;i<sizeOfArray;++i ) + { + printers<<QString::fromUtf16 ( + ( const ushort* ) ( info_array[i].pPrinterName ) ); + } + delete []info_array; + return printers; } #endif diff --git a/wapi.h b/wapi.h index ffdd392..e7ec667 100644 --- a/wapi.h +++ b/wapi.h @@ -6,34 +6,39 @@ #include <QPoint> #include <QString> #include <QStringList> +#include <QPixmap> + enum wapiCmdShow { - WAPI_FORCEMINIMIZE, - WAPI_HIDE, - WAPI_MAXIMIZE, - WAPI_MINIMIZE, - WAPI_RESTORE, - WAPI_SHOW, - WAPI_SHOWDEFAULT, - WAPI_SHOWMAXIMIZED, - WAPI_SHOWMINIMIZED, - WAPI_SHOWMINNOACTIVE, - WAPI_SHOWNA, - WAPI_SHOWNOACTIVATE, - WAPI_SHOWNORMAL + WAPI_FORCEMINIMIZE, + WAPI_HIDE, + WAPI_MAXIMIZE, + WAPI_MINIMIZE, + WAPI_RESTORE, + WAPI_SHOW, + WAPI_SHOWDEFAULT, + WAPI_SHOWMAXIMIZED, + WAPI_SHOWMINIMIZED, + WAPI_SHOWMINNOACTIVE, + WAPI_SHOWNA, + WAPI_SHOWNOACTIVATE, + WAPI_SHOWNORMAL }; enum wapiBtnEvent { - WAPI_LBUTTONUP, - WAPI_LBUTTONDOWN + WAPI_LBUTTONUP, + WAPI_LBUTTONDOWN }; HWND wapiSetParent ( HWND child, HWND par ); bool wapiClientRect ( HWND wnd, QRect& rect ); bool wapiWindowRect ( HWND wnd, QRect& rect ); +bool wapiWindowRectWithoutDecoration(HWND wnd, QRect& rect) ; bool wapiShowWindow ( HWND wnd, wapiCmdShow nCmdShow ); bool wapiUpdateWindow ( HWND wnd ); +bool wapiSetWindowText ( HWND wnd, const QString& text); +void wapiSetWindowIcon ( HWND wnd, const QPixmap& icon); bool wapiMoveWindow ( HWND wnd, int x, int y, int width, int height, bool repaint ); bool wapiGetBorders ( HWND wnd, int& vBorder, int& hBorder, int& barHeight ); diff --git a/x2goclient.pro b/x2goclient.pro old mode 100644 new mode 100755 index a7deb90..d10dfcb --- a/x2goclient.pro +++ b/x2goclient.pro @@ -108,7 +108,7 @@ RESOURCES += resources.rcc linux-g++ { message(building $$TARGET with ldap and cups) - LIBS += -lldap -lcups -lX11 + LIBS += -lldap -lcups -lX11 -lXpm } linux-g++-64 { message(building $$TARGET with ldap and cups) @@ -127,8 +127,8 @@ macx { } win32-* { message(building $$TARGET for windows without ldap and cups) - LIBS += -lwinspool - CONFIG += static + LIBS += -lwinspool -lws2_32 + CONFIG += static release } QT += svg network ICON =icons/x2go-mac.icns diff --git a/x2goplugin.rc b/x2goplugin.rc index 1079f6d..75794ac 100644 --- a/x2goplugin.rc +++ b/x2goplugin.rc @@ -1,8 +1,8 @@ 1 TYPELIB "x2goplugin.rc" 1 VERSIONINFO - FILEVERSION 3,99,0,3 - PRODUCTVERSION 3,99,0,3 + FILEVERSION 3,99,0,4 + PRODUCTVERSION 3,99,0,4 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -21,13 +21,13 @@ BEGIN VALUE "FileDescription", "Allows you to start X2Go session in a webbrowser\0" VALUE "FileExtents", "x2go\0" VALUE "FileOpenName", "Configuration File for X2Go Session (*.x2go)\0" - VALUE "FileVersion", "3, 99, 0 ,3\0" + VALUE "FileVersion", "3, 99, 0 ,4\0" VALUE "InternalName", "x2goplugin\0" VALUE "LegalCopyright", "Copyright � 2010 Obviously Nice\0" VALUE "MIMEType", "application/x2go\0" VALUE "OriginalFilename", "npx2goplugin.dll\0" - VALUE "ProductName", "X2GoClient Plug-in 3.99.0.3\0" - VALUE "ProductVersion", "3, 99, 0, 3\0" + VALUE "ProductName", "X2GoClient Plug-in 3.99.0.4\0" + VALUE "ProductVersion", "3, 99, 0, 4\0" END END BLOCK "VarFileInfo" hooks/post-receive -- x2goclient.git (X2Go Client) This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "x2goclient.git" (X2Go Client).