[Pkg-owncloud-commits] [owncloud-client] 36/164: Show the settings also when no arguments are passed
Sandro Knauß
hefee-guest at moszumanska.debian.org
Sun Mar 22 11:56:47 UTC 2015
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 03e23da6a319f0608747d7fb3ce287d47704b550
Author: Jocelyn Turcotte <jturcotte at woboq.com>
Date: Thu Feb 19 16:54:34 2015 +0100
Show the settings also when no arguments are passed
sendMessage would only be called if there were options to
be sent to the running application.
Fix the issue by having explicitly named messages and always
send the show settings message.
Issue #2374
---
src/gui/application.cpp | 19 ++++++++++---------
src/gui/application.h | 2 +-
src/gui/main.cpp | 10 ++++++----
3 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/src/gui/application.cpp b/src/gui/application.cpp
index 352616e..beab9dc 100644
--- a/src/gui/application.cpp
+++ b/src/gui/application.cpp
@@ -111,7 +111,7 @@ Application::Application(int &argc, char **argv) :
_folderManager.reset(new FolderMan);
- connect( this, SIGNAL(messageReceived(QString, QObject*)), SLOT(slotParseOptions(QString, QObject*)));
+ connect(this, SIGNAL(messageReceived(QString, QObject*)), SLOT(slotParseMessage(QString, QObject*)));
// Create the account info manager to ensure it's listening to the
// account manager.
@@ -343,15 +343,16 @@ void Application::slotUseMonoIconsChanged(bool)
_gui->slotComputeOverallSyncStatus();
}
-void Application::slotParseOptions(const QString &opts, QObject*)
+void Application::slotParseMessage(const QString &msg, QObject*)
{
- QStringList options = opts.split(QLatin1Char('|'));
- parseOptions(options);
- setupLogging();
-
- //This function is calld happens when someone tries to run another instance of ownCloud
- // show the settings dialog
- showSettingsDialog();
+ if (msg.startsWith(QLatin1String("MSG_PARSEOPTIONS:"))) {
+ const int lengthOfMsgPrefix = 17;
+ QStringList options = msg.mid(lengthOfMsgPrefix).split(QLatin1Char('|'));
+ parseOptions(options);
+ setupLogging();
+ } else if (msg.startsWith(QLatin1String("MSG_SHOWSETTINGS"))) {
+ showSettingsDialog();
+ }
}
void Application::parseOptions(const QStringList &options)
diff --git a/src/gui/application.h b/src/gui/application.h
index e968760..411eb9a 100644
--- a/src/gui/application.h
+++ b/src/gui/application.h
@@ -73,7 +73,7 @@ signals:
void folderStateChanged(Folder*);
protected slots:
- void slotParseOptions( const QString&, QObject* );
+ void slotParseMessage(const QString&, QObject*);
void slotCheckConnection();
void slotUpdateConnectionErrors(int accountState);
void slotStartUpdateDetector();
diff --git a/src/gui/main.cpp b/src/gui/main.cpp
index 6cb1b50..6975a79 100644
--- a/src/gui/main.cpp
+++ b/src/gui/main.cpp
@@ -96,14 +96,16 @@ int main(int argc, char **argv)
}
// if the application is already running, notify it.
- if( app.isRunning() ) {
+ if(app.isRunning()) {
qDebug() << Q_FUNC_INFO << "Already running, exiting...";
QStringList args = app.arguments();
- if ( args.size() > 1 && ! app.giveHelp() ) {
- QString msg = args.join( QLatin1String("|") );
- if( ! app.sendMessage( msg ) )
+ if (args.size() > 1) {
+ QString msg = args.join(QLatin1String("|"));
+ if(!app.sendMessage(QLatin1String("MSG_PARSEOPTIONS:") + msg))
return -1;
}
+ if(!app.sendMessage(QLatin1String("MSG_SHOWSETTINGS")))
+ return -1;
return 0;
} else {
if (!QSystemTrayIcon::isSystemTrayAvailable()) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list