Let context menu open wizard if there are no accounts
authorStephan Beyer <s-beyer@gmx.net>
Mon, 6 Jul 2020 21:17:33 +0000 (23:17 +0200)
committerKevin Ottens <ervin@ipsquad.net>
Thu, 23 Jul 2020 19:08:53 +0000 (21:08 +0200)
The context menu offers to open the main dialog and the settings
even if no accounts are configured.  In this case, the main dialog
is useless and the settings are probably confusing.  Hence, this
commit replaces these actions in the context menu by an action
to open the wizard (which also opens on left click, so this is
the most natural thing to do).

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
src/gui/owncloudgui.cpp
src/gui/systray.cpp
src/gui/systray.h

index 22876641d3beb517d57a5634981147f7f80e7ae3..825844fcbf8f43111f447327c24230bbbfac8210 100644 (file)
@@ -85,6 +85,9 @@ ownCloudGui::ownCloudGui(Application *parent)
     connect(_tray.data(), &Systray::openHelp,
         this, &ownCloudGui::slotHelp);
 
+    connect(_tray.data(), &Systray::openAccountWizard,
+        this, &ownCloudGui::slotNewAccountWizard);
+
     connect(_tray.data(), &Systray::openMainDialog,
         this, &ownCloudGui::slotOpenMainDialog);
 
index 23ffa5429f0a02f286aeb4a70a60d25a9a155e1c..07f8e3353446c9ec6d03ae120355ecdda98d02da 100644 (file)
@@ -82,8 +82,12 @@ Systray::Systray()
 
 #ifndef Q_OS_MAC
     auto contextMenu = new QMenu();
-    contextMenu->addAction(tr("Open main dialog"), this, &Systray::openMainDialog);
-    contextMenu->addAction(tr("Settings"), this, &Systray::openSettings);
+    if (AccountManager::instance()->accounts().isEmpty()) {
+        contextMenu->addAction(tr("Add account"), this, &Systray::openAccountWizard);
+    } else {
+        contextMenu->addAction(tr("Open main dialog"), this, &Systray::openMainDialog);
+        contextMenu->addAction(tr("Settings"), this, &Systray::openSettings);
+    }
     contextMenu->addAction(tr("Exit %1").arg(Theme::instance()->appNameGUI()), this, &Systray::shutdown);
     setContextMenu(contextMenu);
 #endif
index b78aa72ee2bddaae55111d18c9eb8ba62a75cddb..995d7c6198eebb5cd5cc68909fc9097a464c774d 100644 (file)
@@ -64,6 +64,7 @@ public:
 
 signals:
     void currentUserChanged();
+    void openAccountWizard();
     void openMainDialog();
     void openSettings();
     void openHelp();