From 2f708c0877defdac6a42942873a166620543d970 Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Fri, 29 Nov 2013 16:12:58 +0100 Subject: [PATCH] Move checkAccountExists out of gui class. --- src/mirall/application.cpp | 9 +++++---- src/mirall/owncloudgui.cpp | 7 ++----- src/mirall/owncloudgui.h | 1 + 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/mirall/application.cpp b/src/mirall/application.cpp index 07b07a663..c1435cadf 100644 --- a/src/mirall/application.cpp +++ b/src/mirall/application.cpp @@ -204,8 +204,9 @@ void Application::slotStartUpdateDetector() void Application::slotCheckConnection() { - if( _gui->checkAccountExists(false) ) { - Account *account = AccountManager::instance()->account(); + Account *account = AccountManager::instance()->account(); + + if( account ) { AbstractCredentials* credentials(account->credentials()); if (! credentials->ready()) { @@ -216,8 +217,8 @@ void Application::slotCheckConnection() runValidator(); } } else { - // the call to checkConfigExists opens the setup wizard - // if the config does not exist. Nothing to do here. + // let gui open the setup wizard + _gui->slotOpenSettingsDialog( true ); } } diff --git a/src/mirall/owncloudgui.cpp b/src/mirall/owncloudgui.cpp index 424fb8459..770ed38fb 100644 --- a/src/mirall/owncloudgui.cpp +++ b/src/mirall/owncloudgui.cpp @@ -81,7 +81,7 @@ ownCloudGui::ownCloudGui(Application *parent) : } // This should rather be in application.... or rather in MirallConfigFile? -bool ownCloudGui::checkAccountExists(bool openSettings) +void ownCloudGui::slotOpenSettingsDialog( bool openSettings ) { // if account is set up, start the configuration wizard. if( AccountManager::instance()->account() ) { @@ -91,13 +91,10 @@ bool ownCloudGui::checkAccountExists(bool openSettings) } else { _settingsDialog->close(); } - } - return true; } else { qDebug() << "No configured folders yet, starting setup wizard"; OwncloudSetupWizard::runWizard(qApp, SLOT(slotownCloudWizardDone(int))); - return false; } } @@ -112,7 +109,7 @@ void ownCloudGui::slotTrayClicked( QSystemTrayIcon::ActivationReason reason ) // Linux, not on Mac. They want a menu entry. #if !defined Q_OS_MAC if( reason == QSystemTrayIcon::Trigger ) { - checkAccountExists(true); // start settings if config is existing. + slotOpenSettingsDialog(true); // start settings if config is existing. } #endif } diff --git a/src/mirall/owncloudgui.h b/src/mirall/owncloudgui.h index d1018d200..074433a24 100644 --- a/src/mirall/owncloudgui.h +++ b/src/mirall/owncloudgui.h @@ -65,6 +65,7 @@ public slots: void slotTrayClicked( QSystemTrayIcon::ActivationReason reason ); void slotToggleLogBrowser(); void slotOpenOwnCloud(); + void slotOpenSettingsDialog( bool openSettings ); void slotHelp(); void slotOpenPath(const QString& path); void slotAccountStateChanged();