AccountSettings: Update the visibility of the add account button.
authorKlaas Freitag <freitag@owncloud.com>
Wed, 2 Dec 2015 15:33:24 +0000 (16:33 +0100)
committerKlaas Freitag <freitag@owncloud.com>
Wed, 2 Dec 2015 15:33:37 +0000 (16:33 +0100)
That fixes #4238

src/gui/accountsettings.cpp

index 275ac917c65c0c925b1e5929391964722742507d..abd0670c97fd1c64b7a141874c294073c2af2f6c 100644 (file)
@@ -150,6 +150,8 @@ void AccountSettings::createAccountToolbox()
     ui->_accountToolbox->setText(tr("Account") + QLatin1Char(' '));
     ui->_accountToolbox->setMenu(menu);
     ui->_accountToolbox->setPopupMode(QToolButton::InstantPopup);
+
+    slotAccountAdded(_accountState);
 }
 
 void AccountSettings::slotOpenAccountWizard()
@@ -665,9 +667,11 @@ void AccountSettings::slotAccountAdded(AccountState*)
 {
     // if the theme is limited to single account, the button must hide if
     // there is already one account.
-    if( AccountManager::instance()->accounts().size() > 1 &&
-            !Theme::instance()->multiAccount() ) {
+    int s = AccountManager::instance()->accounts().size();
+    if( s > 0 && !Theme::instance()->multiAccount() ) {
         _addAccountAction->setVisible(false);
+    } else {
+        _addAccountAction->setVisible(true);
     }
 }