This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goclient. commit 1ec40ee32d26b19f4213768e87ebad27b56190ed Author: Jason Alavaliant <alavaliant@ra09.com> Date: Sun Sep 25 20:17:17 2016 +1300 src/{onmainwindow.{cpp,h},help.cpp}: modify autostart option to support multiple autostart apps at the same time. Fixes: #1024. --- debian/changelog | 5 +++++ src/help.cpp | 2 +- src/onmainwindow.cpp | 51 ++++++++++++++++++++++++++++++++++++-------------- src/onmainwindow.h | 2 +- 4 files changed, 44 insertions(+), 16 deletions(-) diff --git a/debian/changelog b/debian/changelog index 24182c4..3fb5cc8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -17,6 +17,11 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium file. Qt5 stumbles upon that - i.e., it doesn't try to compile files with the "rcc" extension, while Qt4 did. + [ Jason Alavaliant ] + * New upstream version (4.0.5.3): + - src/{onmainwindow.{cpp,h},help.cpp}: modify autostart option to support + multiple autostart apps at the same time. Fixes: #1024. + -- X2Go Release Manager <git-admin@x2go.org> Mon, 19 Sep 2016 09:07:07 +0200 x2goclient (4.0.5.2-0x2go1) unstable; urgency=medium diff --git a/src/help.cpp b/src/help.cpp index a708d81..5e37195 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -139,7 +139,7 @@ help::params_t help::build_params () { ADD_OPT ("--kbd-type=<type>", QT_TRANSLATE_NOOP ("Help", "Sets the default keyboard type.")); ADD_OPT ("--home=<dir>", QT_TRANSLATE_NOOP ("Help", "Sets the user's home directory.")); ADD_OPT ("--set-kbd=<0|1>", QT_TRANSLATE_NOOP ("Help", "Enables or disables overwriting the current keyboard settings.")); - ADD_OPT ("--autostart=<app>", QT_TRANSLATE_NOOP ("Help", "Automatically launches the application \"app\" on session start in Published Applications mode.")); + ADD_OPT ("--autostart=<app>,[<app2>,...]", QT_TRANSLATE_NOOP ("Help", "Automatically launches the application(s) \"app\", \"app2\", ... on session start in Published Applications mode.")); ADD_OPT ("--session-conf=<file>", QT_TRANSLATE_NOOP ("Help", "Defines an alternative session config file path.")); ADD_OPT ("--tray-icon", QT_TRANSLATE_NOOP ("Help", "Force-enables session system tray icon.")); ADD_OPT ("--close-disconnect", QT_TRANSLATE_NOOP ("Help", "Automatically closes X2Go Client after a disconnect.")); diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index 4b3fb05..be271d2 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -6747,7 +6747,7 @@ void ONMainWindow::slotReadApplications(bool result, QString output, applications.clear(); QString locallong=QLocale::system().name(); QString localshort=QLocale::system().name().split("_")[0]; - bool startAppFound=false; + QStringList startAppsFound; foreach(QString appstr, output.split("</desktop>",QString::SkipEmptyParts)) { @@ -6776,9 +6776,12 @@ void ONMainWindow::slotReadApplications(bool result, QString output, if (line.indexOf("Name=")!=-1 && !localname) { app.name=line.split("=")[1]; - if (app.name==autostartApp) - startAppFound=true; - // x2goDebug<<"name: "<<app.name<<endl; + for (int i=0; i<autostartApps.length(); ++i) + { + if (app.name==autostartApps[i]) + startAppsFound.append(app.name); + // x2goDebug<<"name: "<<app.name<<endl; + } } if (line.indexOf("Comment=")!=-1 && !localcomment) { @@ -6794,9 +6797,12 @@ void ONMainWindow::slotReadApplications(bool result, QString output, app.exec.replace("%u","",Qt::CaseInsensitive); app.exec.replace("%i","",Qt::CaseInsensitive); app.exec.replace("%c",app.name,Qt::CaseInsensitive); - if (app.exec==autostartApp) - startAppFound=true; - // x2goDebug<<"exec: "<<app.exec<<endl; + for (int i=0; i<autostartApps.length(); ++i) + { + if (app.exec==autostartApps[i]) + startAppsFound.append(app.exec); + // x2goDebug<<"exec: "<<app.exec<<endl; + } } if (line.indexOf("Categories=")!=-1) { @@ -6861,14 +6867,25 @@ void ONMainWindow::slotReadApplications(bool result, QString output, qSort(applications.begin(), applications.end(),Application::lessThen); plugAppsInTray(); - if (runStartApp && autostartApp.length()>1) + if (runStartApp && autostartApps.length()>0) { - if (!startAppFound) { - x2goDebug<<"Autostart application "<<autostartApp<< " not found in desktop files."; - } - else + for (int i=0; i<autostartApps.length(); ++i) { - runApplication(autostartApp); + bool startAppFound = false; + for (int j=0; j<startAppsFound.length(); ++j) + { + if (startAppsFound[j] == autostartApps[i]) + { + startAppFound = true; + } + } + if (!startAppFound) { + x2goDebug<<"Autostart application "<<autostartApps[i]<< " not found in desktop files."; + } + else + { + runApplication(autostartApps[i]); + } } } else @@ -7233,7 +7250,13 @@ bool ONMainWindow::parseParameter ( QString param ) } if ( setting == "--autostart") { - autostartApp=value; + autostartApps.append(value.split(',')); + + /* Fix up by trimming whitespace. */ + for (QStringList::iterator it = autostartApps.begin (); it != autostartApps.end (); ++it) { + *it = it->trimmed (); + } + return true; } if ( setting == "--auth-id") diff --git a/src/onmainwindow.h b/src/onmainwindow.h index 344f7d1..e0e4d26 100644 --- a/src/onmainwindow.h +++ b/src/onmainwindow.h @@ -624,7 +624,7 @@ private: bool embedMode; bool thinMode; QString statusString; - QString autostartApp; + QStringList autostartApps; bool cmdAutologin; int defaultLink; int defaultQuality; -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git