Have the new account wizard open again
authorKevin Ottens <kevin.ottens@nextcloud.com>
Mon, 14 Dec 2020 14:58:52 +0000 (15:58 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Mon, 14 Dec 2020 14:58:52 +0000 (15:58 +0100)
UserModel can't be connected to AccountSettings if the settings dialog
doesn't exist. This is the case now since we delay the creation of that
dialog and free it after use.

Instead it should be properly channeled through the Systray object all
the way up to OwncloudGui which knows how to handle this properly.

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

index b878aa58af2344d376ff1f7a3b4fb6376aada84f..b2e1b8e475d458e15c6e27e67787a64dfb280b18 100644 (file)
@@ -214,9 +214,6 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent)
         _ui->encryptionMessage->hide();
     }
 
-    connect(UserModel::instance(), &UserModel::addAccount,
-         this, &AccountSettings::slotOpenAccountWizard);
-
     customizeStyle();
 }
 
@@ -251,17 +248,6 @@ QString AccountSettings::selectedFolderAlias() const
     return _model->data(selected, FolderStatusDelegate::FolderAliasRole).toString();
 }
 
-void AccountSettings::slotOpenAccountWizard()
-{
-    // We can't call isSystemTrayAvailable with appmenu-qt5 because it breaks the systemtray
-    // (issue #4693, #4944)
-    if (qgetenv("QT_QPA_PLATFORMTHEME") == "appmenu-qt5" || QSystemTrayIcon::isSystemTrayAvailable()) {
-        topLevelWidget()->close();
-    }
-
-    OwncloudSetupWizard::runWizard(qApp, SLOT(slotownCloudWizardDone(int)), nullptr);
-}
-
 void AccountSettings::slotToggleSignInState()
 {
     if (_accountState->isSignedOut()) {
index ade9d6c58b0583ba500d04dc1c02c497137129a7..60671afd275405ef388e040c20675ce625cff641 100644 (file)
@@ -89,7 +89,6 @@ protected slots:
     void slotFolderWizardRejected();
     void slotDeleteAccount();
     void slotToggleSignInState();
-    void slotOpenAccountWizard();
     void refreshSelectiveSyncStatus();
     void slotMarkSubfolderEncrypted(const FolderStatusModel::SubFolderInfo* folderInfo);
     void slotSubfolderContextMenuRequested(const QModelIndex& idx, const QPoint& point);
index 422c41b88a5db98141164e51d1086a5ff6720e8e..c8d33f982d4f7a41882e0b2b03d5293e5d6dedb3 100644 (file)
@@ -119,6 +119,8 @@ Systray::Systray()
 
     connect(UserModel::instance(), &UserModel::newUserSelected,
         this, &Systray::slotNewUserSelected);
+    connect(UserModel::instance(), &UserModel::addAccount,
+            this, &Systray::openAccountWizard);
 
     connect(AccountManager::instance(), &AccountManager::accountAdded,
         this, &Systray::showWindow);