Account removal: Do it inside global application object

For #4229 #4202
This commit is contained in:
Markus Goetz 2015-12-01 16:30:57 +01:00
parent d2f1c141d8
commit db7d70a929
2 changed files with 10 additions and 8 deletions

View file

@ -693,14 +693,8 @@ void AccountSettings::slotDeleteAccount()
manager->deleteAccount(_accountState);
manager->save();
// if there is no more account, show the wizard.
if( manager->accounts().isEmpty() ) {
// allow to add a new account if there is non any more. Always think
// about single account theming!
_addAccountAction->setVisible(true);
OwncloudSetupWizard::runWizard(qApp, SLOT(slotownCloudWizardDone(int)));
}
// IMPORTANT: "this" is deleted from this point on. We should probably remove this synchronous
// .exec() QMessageBox magic above as it recurses into the event loop.
}
bool AccountSettings::event(QEvent* e)

View file

@ -36,6 +36,7 @@
#include "creds/abstractcredentials.h"
#include "updater/ocupdater.h"
#include "excludedfiles.h"
#include "owncloudsetupwizard.h"
#include "config.h"
@ -219,6 +220,13 @@ void Application::slotAccountStateRemoved(AccountState *accountState)
disconnect(accountState, SIGNAL(stateChanged(int)),
_folderManager.data(), SLOT(slotAccountStateChanged()));
}
// if there is no more account, show the wizard.
if( AccountManager::instance()->accounts().isEmpty() ) {
// allow to add a new account if there is non any more. Always think
// about single account theming!
OwncloudSetupWizard::runWizard(this, SLOT(slotownCloudWizardDone(int)));
}
}
void Application::slotAccountStateAdded(AccountState *accountState)