Skip to content

Commit

Permalink
Add {} for single line condition, const auto and fix comments.
Browse files Browse the repository at this point in the history
Signed-off-by: Camila <[email protected]>
  • Loading branch information
Camila committed Aug 15, 2023
1 parent 888e537 commit 88e0c66
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/gui/accountmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ AccountManager::AccountsRestoreResult AccountManager::restore(const bool alsoRes
if (auto accState = AccountState::loadFromSettings(acc, *settings)) {
auto jar = qobject_cast<CookieJar*>(acc->_am->cookieJar());
ASSERT(jar);
if (jar)
if (jar) {
jar->restore(acc->cookieJarPath());
}
addAccountState(accState);
}
}
Expand Down Expand Up @@ -328,8 +329,9 @@ void AccountManager::saveAccountHelper(Account *acc, QSettings &settings, bool s
settings.setValue(QLatin1String(authTypeC), acc->_credentials->authType());

// HACK: Save http_user also as user
if (acc->_settingsMap.contains(httpUserC))
if (acc->_settingsMap.contains(httpUserC)) {
settings.setValue(userC, acc->_settingsMap.value(httpUserC));
}
}

// Save accepted certificates.
Expand Down Expand Up @@ -372,8 +374,8 @@ AccountPtr AccountManager::loadAccountHelper(QSettings &settings)
auto authType = settings.value(QLatin1String(authTypeC)).toString();

// There was an account-type saving bug when 'skip folder config' was used
// See #5408. This attempts to fix up the "dummy" authType
if (authType == QLatin1String(dummyAuthTypeC)) {
// See owncloud#5408. This attempts to fix up the "dummy" or empty authType
if (authType == QLatin1String(dummyAuthTypeC) || authType.isEmpty()) {
if (settings.contains(QLatin1String(httpUserC))) {
authType = httpAuthTypeC;
} else if (settings.contains(QLatin1String(shibbolethUserC))) {
Expand Down Expand Up @@ -401,8 +403,10 @@ AccountPtr AccountManager::loadAccountHelper(QSettings &settings)

const auto settingsChildKeys = settings.childKeys();
for (const auto &key : settingsChildKeys) {
if (!key.startsWith(httpAuthPrefix))
if (!key.startsWith(httpAuthPrefix)) {
continue;
}

const auto newkey = QString::fromLatin1(webflowAuthPrefix).append(key.mid(5));
settings.setValue(newkey, settings.value((key)));
settings.remove(key);
Expand All @@ -415,14 +419,14 @@ AccountPtr AccountManager::loadAccountHelper(QSettings &settings)
acc->_skipE2eeMetadataChecksumValidation = settings.value(QLatin1String(skipE2eeMetadataChecksumValidationC), {}).toBool();
acc->_davUser = settings.value(QLatin1String(davUserC), "").toString();

// We want to only restore settings for that auth type and the user value
acc->_settingsMap.insert(QLatin1String(userC), settings.value(userC));
acc->_displayName = settings.value(QLatin1String(displayNameC), "").toString();
QString authTypePrefix = authType + "_";
const auto authTypePrefix = authType + "_";
const auto settingsChildKeys = settings.childKeys();
for (const auto &key : settingsChildKeys) {
if (!key.startsWith(authTypePrefix))
if (!key.startsWith(authTypePrefix)) {
continue;
}
acc->_settingsMap.insert(key, settings.value(key));
}

Expand Down

0 comments on commit 88e0c66

Please sign in to comment.