tag #316 - patch Mike,
Attaching the new patch. Now there is new command line parameter --tray-icon for x2goclient. When x2goclient find this parameter tray icon will be shown (also when --hide parameter is present too). When x2goclient asking about create desktop icon in hide mode there is a new checkbox to set if desktop launcher is going to show tray icon or not (default is not). So take a look and tell me something about. Cheers! 2013/10/30 Mike Gabriel <[email protected]> > Hi Ricardo, > > > On Mi 30 Okt 2013 08:14:09 CET, Ricardo Díaz Martín wrote: > > Yes, I think the way you said will be better. So I'm going to add this >> command line option and make a new patch ;-) >> > > Cool. > > Thanks! > > Mike > -- > > DAS-NETZWERKTEAM > mike gabriel, herweg 7, 24357 fleckeby > fon: +49 (1520) 1976 148 > > GnuPG Key ID 0x25771B31 > mail: mike.gabriel@das-netzwerkteam.**de<[email protected]>, > http://das-netzwerkteam.de > > freeBusy: > https://mail.das-netzwerkteam.**de/freebusy/m.gabriel%40das-** > netzwerkteam.de.xfb<https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.xfb> >
From 05e964a38219ce13a37010429f339f098422f74f Mon Sep 17 00:00:00 2001 From: Ricardo Diaz <[email protected]> Date: Wed, 30 Oct 2013 10:05:48 +0100 Subject: [PATCH 3/3] --tray-icon comand line --- onmainwindow.cpp | 51 ++++++++++++++++++++++++++++++++++++++------------- onmainwindow.h | 1 + 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/onmainwindow.cpp b/onmainwindow.cpp index 031ba2f..64b3486 100644 --- a/onmainwindow.cpp +++ b/onmainwindow.cpp @@ -101,6 +101,7 @@ ONMainWindow::ONMainWindow ( QWidget *parent ) :QMainWindow ( parent ) lastSession=0l; changeBrokerPass=false; resumeAfterSuspending=false; + forceToShowTrayicon=false; appSeparator=0; config.brokerNoAuth=false; @@ -1099,7 +1100,7 @@ void ONMainWindow::trayIconInit() trayIcon->setToolTip(tr("Left mouse button to hide/restore - Right mouse button to display context menu")); } - if (!startHidden | trayEnabled) + if (!startHidden | forceToShowTrayicon) { trayIcon->show(); plugAppsInTray(); @@ -2034,17 +2035,29 @@ void ONMainWindow::slotEdit ( SessionButton* bt ) void ONMainWindow::slotCreateDesktopIcon ( SessionButton* bt ) { - bool crHidden= ( QMessageBox::question ( - this, - tr ( "Create session icon on desktop" ), - tr ( "Desktop icons can be configured " - "not to show x2goclient (hidden mode). " - "If you like to use this feature you'll " - "need to configure login by a gpg key " - "or gpg smart card.\n\n" - "Use x2goclient hidden mode?" ), - QMessageBox::Yes|QMessageBox::No ) == - QMessageBox::Yes ); + QMessageBox messageBox(QMessageBox::Question, + tr ( "Create session icon on desktop" ), + tr ( "Desktop icons can be configured " + "not to show x2goclient (hidden mode). " + "If you like to use this feature you'll " + "need to configure login by a gpg key " + "or gpg smart card.\n\n" + "Use x2goclient hidden mode?" ), + QMessageBox::Yes|QMessageBox::No, + this); + + //adding a chekbox to know if user want to enable trayicon in hide sessions + QCheckBox cbShowTrayIcon(tr("Show session tray icon when running")); + messageBox.layout()->addWidget(&cbShowTrayIcon); + QGridLayout* gridLayout = (QGridLayout*) messageBox.layout(); + gridLayout->addWidget(&cbShowTrayIcon, gridLayout->rowCount(), 0, 1, gridLayout->columnCount()); + cbShowTrayIcon.blockSignals(true); + + //getting the result + bool crHidden = (messageBox.exec() == QMessageBox::Yes); + bool bShowTrayicon = (cbShowTrayIcon.checkState() == Qt::Checked); + + X2goSettings st ( "sessions" ); QString name=st.setting()->value ( bt->id() +"/name", @@ -2073,6 +2086,10 @@ void ONMainWindow::slotCreateDesktopIcon ( SessionButton* bt ) QString cmd="x2goclient"; if ( crHidden ) cmd="x2goclient --hide"; + + if (bShowTrayicon) + cmd += " --tray-icon"; + QTextStream out ( &file ); out << "[Desktop Entry]\n"<< "Exec="<<cmd<<" --sessionid="<<bt->id() <<"\n"<< @@ -6477,6 +6494,12 @@ bool ONMainWindow::parseParameter ( QString param ) return true; } + //force to show trayicon + if (param == "--tray-icon") + { + forceToShowTrayicon = true; + return true; + } QString setting,value; QStringList vals=param.split ( "=" ); @@ -6978,7 +7001,9 @@ void ONMainWindow::showHelp() "--set-kbd=<0|1>\t\t\t overwrite current keyboard settings\n" "--autostart=<app> \t\t launch \"app\" by session start in \"published " "applications\" mode\n" - "--session-conf=<file>\t\t path to alternative session config\n"; + "--session-conf=<file>\t\t path to alternative session config\n" + "--tray-icon\t\t force to show session trayicon\n"; + qCritical ( "%s",helpMsg.toLocal8Bit().data() ); if (!startHidden) { diff --git a/onmainwindow.h b/onmainwindow.h index 70504d2..f12c8a6 100644 --- a/onmainwindow.h +++ b/onmainwindow.h @@ -594,6 +594,7 @@ private: QList<serv> x2goServers; QList<Application> applications; QList<sshKey> cmdSshKeys; + bool forceToShowTrayicon; //true if --tray-icon passed in command line QPushButton* bSusp; QPushButton* bTerm; -- 1.8.3.2
_______________________________________________ X2Go-Dev mailing list [email protected] https://lists.berlios.de/mailman/listinfo/x2go-dev
