Skip to content

Commit

Permalink
Tray: Add a 'New account...' action if no account is configured #5307
Browse files Browse the repository at this point in the history
Useful when left-clicking the tray icon isn't working for some reason.
  • Loading branch information
ckamm committed Nov 18, 2016
1 parent 0152842 commit 6451eb3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/gui/owncloudgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void ownCloudGui::slotOpenSettingsDialog()
}
} else {
qDebug() << "No configured folders yet, starting setup wizard";
OwncloudSetupWizard::runWizard(qApp, SLOT(slotownCloudWizardDone(int)));
slotNewAccountWizard();
}
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/gui/owncloudgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ private slots:
void slotLogout();
void slotUnpauseAllFolders();
void slotPauseAllFolders();
void slotNewAccountWizard();

private:
void setPauseOnAllFoldersHelper(bool pause);
Expand Down Expand Up @@ -123,6 +124,7 @@ private slots:
QAction *_actionLogin;
QAction *_actionLogout;

QAction *_actionNewAccountWizard;
QAction *_actionSettings;
QAction *_actionStatus;
QAction *_actionEstimate;
Expand Down

0 comments on commit 6451eb3

Please sign in to comment.