Bring forward the main systray dialog on second execution
authorKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 16 Jun 2020 16:59:16 +0000 (18:59 +0200)
committerKevin Ottens (Rebase PR Action) <er-vin@users.noreply.github.com>
Wed, 17 Jun 2020 16:01:49 +0000 (16:01 +0000)
Previously we were showing up the settings dialog but it doesn't quite
make sense anymore now that we got two dialogs.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
src/gui/application.cpp
src/gui/application.h
src/gui/main.cpp
src/gui/owncloudgui.cpp
src/gui/owncloudgui.h

index 65539b9b5c84842bc24cc2c0d9ffafa4e3ad5acc..20d5b6e9bb8fcc25cfee195d9fd696b0f4944e8a 100644 (file)
@@ -433,14 +433,14 @@ void Application::slotParseMessage(const QString &msg, QObject *)
         QStringList options = msg.mid(lengthOfMsgPrefix).split(QLatin1Char('|'));
         parseOptions(options);
         setupLogging();
-    } else if (msg.startsWith(QLatin1String("MSG_SHOWSETTINGS"))) {
+    } else if (msg.startsWith(QLatin1String("MSG_SHOWMAINDIALOG"))) {
         qCInfo(lcApplication) << "Running for" << _startedAt.elapsed() / 1000.0 << "sec";
         if (_startedAt.elapsed() < 10 * 1000) {
             // This call is mirrored with the one in int main()
-            qCWarning(lcApplication) << "Ignoring MSG_SHOWSETTINGS, possibly double-invocation of client via session restore and auto start";
+            qCWarning(lcApplication) << "Ignoring MSG_SHOWMAINDIALOG, possibly double-invocation of client via session restore and auto start";
             return;
         }
-        showSettingsDialog();
+        showMainDialog();
     }
 }
 
@@ -662,9 +662,9 @@ bool Application::versionOnly()
     return _versionOnly;
 }
 
-void Application::showSettingsDialog()
+void Application::showMainDialog()
 {
-    _gui->slotShowSettings();
+    _gui->slotOpenMainDialog();
 }
 
 void Application::slotGuiIsShowingSettings()
index ac303cb4c2f44e76176f700cb20e2453e75b8e9b..36d994a311523cf0d2e2ad8a1daaa5f2147a3831 100644 (file)
@@ -67,7 +67,7 @@ public:
     bool versionOnly(); // only display the version?
     void showVersion();
 
-    void showSettingsDialog();
+    void showMainDialog();
 
 public slots:
     // TODO: this should not be public
index 4b3da14b799093b6930b488f3bdee5f91bdaa888..060cc7ef75980de3c0142b00c8bab6a71b6ccac1 100644 (file)
@@ -139,7 +139,7 @@ int main(int argc, char **argv)
             if (!app.sendMessage(QLatin1String("MSG_PARSEOPTIONS:") + msg))
                 return -1;
         }
-        if (!app.backgroundMode() && !app.sendMessage(QLatin1String("MSG_SHOWSETTINGS"))) {
+        if (!app.backgroundMode() && !app.sendMessage(QLatin1String("MSG_SHOWMAINDIALOG"))) {
             return -1;
         }
         return 0;
@@ -172,7 +172,7 @@ int main(int argc, char **argv)
                 }
             }
             if (!app.backgroundMode() && !QSystemTrayIcon::isSystemTrayAvailable() && desktopSession != "ubuntu") {
-                app.showSettingsDialog();
+                app.showMainDialog();
             }
         }
     }
index 6c7971b2bdbd71c45216713079fcb37b605ebe1e..ef335ffed0a72496ec028283b0f51bb27148e367 100644 (file)
@@ -154,6 +154,13 @@ void ownCloudGui::slotOpenSettingsDialog()
     }
 }
 
+void ownCloudGui::slotOpenMainDialog()
+{
+    if (!_tray->isOpen()) {
+        _tray->showWindow();
+    }
+}
+
 void ownCloudGui::slotTrayClicked(QSystemTrayIcon::ActivationReason reason)
 {
     if (reason == QSystemTrayIcon::Trigger || reason == QSystemTrayIcon::Context) {
index 380a69659692a95735c5697ab0a79095f17cddea..74a1abfddeb10e3ea6686f877f4903cdf5505505 100644 (file)
@@ -86,6 +86,7 @@ public slots:
     void slotToggleLogBrowser();
     void slotOpenOwnCloud();
     void slotOpenSettingsDialog();
+    void slotOpenMainDialog();
     void slotSettingsDialogActivated();
     void slotHelp();
     void slotOpenPath(const QString &path);