diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2021-11-17 17:20:40 +0300 |
---|---|---|
committer | Hannah von Reth <hannah.vonreth@owncloud.com> | 2021-11-17 17:20:40 +0300 |
commit | 724f7c8f97a3d9cb18d821942132762dade12c04 (patch) | |
tree | 5ca7710c0799ce0061fb676acd5038e8e591a006 /src/gui/accountstate.cpp | |
parent | 7fe14d0e67f83c3a4a6512b9c1c1826b92400fe8 (diff) | |
parent | 36311b00be41b1edbe46791f1c44d11f8584c4f8 (diff) |
Merge remote-tracking branch 'origin/2.9'
Diffstat (limited to 'src/gui/accountstate.cpp')
-rw-r--r-- | src/gui/accountstate.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp index 721a4aebb..50cad4110 100644 --- a/src/gui/accountstate.cpp +++ b/src/gui/accountstate.cpp @@ -29,6 +29,15 @@ #include <QSettings> #include <QTimer> +namespace { + +inline const QLatin1String userExplicitlySignedOutC() +{ + return QLatin1String("userExplicitlySignedOut"); +} + +} // anonymous namespace + namespace OCC { Q_LOGGING_CATEGORY(lcAccountState, "gui.account.state", QtInfoMsg) @@ -101,20 +110,37 @@ AccountState::AccountState(AccountPtr account) connect(this, &AccountState::urlUpdated, this, [this] { checkConnectivity(false); }); + connect(account.data(), &Account::requestUrlUpdate, this, &AccountState::updateUrlDialog, Qt::QueuedConnection); + connect( + this, &AccountState::urlUpdated, this, [this] { + checkConnectivity(false); + }, + Qt::QueuedConnection); } AccountState::~AccountState() { } -AccountState *AccountState::loadFromSettings(AccountPtr account, QSettings & /*settings*/) +AccountState *AccountState::loadFromSettings(AccountPtr account, const QSettings &settings) { auto accountState = new AccountState(account); + const bool userExplicitlySignedOut = settings.value(userExplicitlySignedOutC(), false).toBool(); + if (userExplicitlySignedOut) { + // see writeToSettings below + accountState->_state = SignedOut; + } return accountState; } -void AccountState::writeToSettings(QSettings & /*settings*/) +void AccountState::writeToSettings(QSettings &settings) const { + // The SignedOut state is the only state where the client should *not* ask for credentials, nor + // try to connect to the server. All other states should transition to Connected by either + // (re-)trying to make a connection, or by authenticating (AskCredentials). So we save the + // SignedOut state to indicate that the client should not try to re-connect the next time it + // is started. + settings.setValue(userExplicitlySignedOutC(), _state == SignedOut); } AccountPtr AccountState::account() const |