Tray: Add a 'New account...' action if no account is configured #5307
authorChristian Kamm <mail@ckamm.de>
Fri, 18 Nov 2016 11:17:05 +0000 (12:17 +0100)
committerChristian Kamm <mail@ckamm.de>
Fri, 18 Nov 2016 11:17:05 +0000 (12:17 +0100)
Useful when left-clicking the tray icon isn't working for some reason.

src/gui/owncloudgui.cpp
src/gui/owncloudgui.h

index a074bc29e95532212d8ac9e0c222e7170fe8e237..babfe2627b0b1310f2f7b05a2df75e69bce97389 100644 (file)
@@ -159,7 +159,7 @@ void ownCloudGui::slotOpenSettingsDialog()
         }
     } else {
         qDebug() << "No configured folders yet, starting setup wizard";
-        OwncloudSetupWizard::runWizard(qApp, SLOT(slotownCloudWizardDone(int)));
+        slotNewAccountWizard();
     }
 }
 
@@ -599,6 +599,9 @@ void ownCloudGui::updateContextMenu()
         _contextMenu->addMenu(_recentActionsMenu);
         _contextMenu->addSeparator();
     }
+    if (accountList.isEmpty()) {
+        _contextMenu->addAction(_actionNewAccountWizard);
+    }
     _contextMenu->addAction(_actionSettings);
     if (!Theme::instance()->helpUrl().isEmpty()) {
         _contextMenu->addAction(_actionHelp);
@@ -723,11 +726,13 @@ void ownCloudGui::setupActions()
     _actionStatus = new QAction(tr("Unknown status"), this);
     _actionStatus->setEnabled( false );
     _actionSettings = new QAction(tr("Settings..."), this);
+    _actionNewAccountWizard = new QAction(tr("New account..."), this);
     _actionRecent = new QAction(tr("Details..."), this);
     _actionRecent->setEnabled( true );
 
     QObject::connect(_actionRecent, SIGNAL(triggered(bool)), SLOT(slotShowSyncProtocol()));
     QObject::connect(_actionSettings, SIGNAL(triggered(bool)), SLOT(slotShowSettings()));
+    QObject::connect(_actionNewAccountWizard, SIGNAL(triggered(bool)), SLOT(slotNewAccountWizard()));
     _actionHelp = new QAction(tr("Help"), this);
     QObject::connect(_actionHelp, SIGNAL(triggered(bool)), SLOT(slotHelp()));
     _actionQuit = new QAction(tr("Quit %1").arg(Theme::instance()->appNameGUI()), this);
@@ -890,6 +895,11 @@ void ownCloudGui::slotPauseAllFolders()
     setPauseOnAllFoldersHelper(true);
 }
 
+void ownCloudGui::slotNewAccountWizard()
+{
+    OwncloudSetupWizard::runWizard(qApp, SLOT(slotownCloudWizardDone(int)));
+}
+
 void ownCloudGui::setPauseOnAllFoldersHelper(bool pause)
 {
     QList<AccountState*> accounts;
index 938158d8a91a51b7177d98108f8b8fef77fbe60a..ddb5327080d44e03b997af2d88ff49b9c8e69d83 100644 (file)
@@ -94,6 +94,7 @@ private slots:
     void slotLogout();
     void slotUnpauseAllFolders();
     void slotPauseAllFolders();
+    void slotNewAccountWizard();
 
 private:
     void setPauseOnAllFoldersHelper(bool pause);
@@ -123,6 +124,7 @@ private:
     QAction *_actionLogin;
     QAction *_actionLogout;
 
+    QAction *_actionNewAccountWizard;
     QAction *_actionSettings;
     QAction *_actionStatus;
     QAction *_actionEstimate;