mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-28 11:48:56 +03:00
acc => account.
Signed-off-by: Camila Ayres <hello@camilasan.com>
This commit is contained in:
parent
9649bd99f6
commit
77597af3ae
1 changed files with 36 additions and 36 deletions
|
@ -328,36 +328,36 @@ void AccountManager::saveAccountState(AccountState *a)
|
||||||
qCDebug(lcAccountManager) << "Saved account state settings, status:" << settings->status();
|
qCDebug(lcAccountManager) << "Saved account state settings, status:" << settings->status();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccountManager::saveAccountHelper(Account *acc, QSettings &settings, bool saveCredentials)
|
void AccountManager::saveAccountHelper(Account *account, QSettings &settings, bool saveCredentials)
|
||||||
{
|
{
|
||||||
qCDebug(lcAccountManager) << "Saving settings to" << settings.fileName();
|
qCDebug(lcAccountManager) << "Saving settings to" << settings.fileName();
|
||||||
settings.setValue(QLatin1String(versionC), maxAccountVersion);
|
settings.setValue(QLatin1String(versionC), maxAccountVersion);
|
||||||
settings.setValue(QLatin1String(urlC), acc->_url.toString());
|
settings.setValue(QLatin1String(urlC), account->_url.toString());
|
||||||
settings.setValue(QLatin1String(davUserC), acc->_davUser);
|
settings.setValue(QLatin1String(davUserC), account->_davUser);
|
||||||
settings.setValue(QLatin1String(displayNameC), acc->davDisplayName());
|
settings.setValue(QLatin1String(displayNameC), account->davDisplayName());
|
||||||
settings.setValue(QLatin1String(serverVersionC), acc->_serverVersion);
|
settings.setValue(QLatin1String(serverVersionC), account->_serverVersion);
|
||||||
settings.setValue(QLatin1String(serverColorC), acc->_serverColor);
|
settings.setValue(QLatin1String(serverColorC), account->_serverColor);
|
||||||
settings.setValue(QLatin1String(serverTextColorC), acc->_serverTextColor);
|
settings.setValue(QLatin1String(serverTextColorC), account->_serverTextColor);
|
||||||
settings.setValue(QLatin1String(serverHasValidSubscriptionC), acc->serverHasValidSubscription());
|
settings.setValue(QLatin1String(serverHasValidSubscriptionC), account->serverHasValidSubscription());
|
||||||
|
|
||||||
if (!acc->_skipE2eeMetadataChecksumValidation) {
|
if (!account->_skipE2eeMetadataChecksumValidation) {
|
||||||
settings.remove(QLatin1String(skipE2eeMetadataChecksumValidationC));
|
settings.remove(QLatin1String(skipE2eeMetadataChecksumValidationC));
|
||||||
} else {
|
} else {
|
||||||
settings.setValue(QLatin1String(skipE2eeMetadataChecksumValidationC), acc->_skipE2eeMetadataChecksumValidation);
|
settings.setValue(QLatin1String(skipE2eeMetadataChecksumValidationC), account->_skipE2eeMetadataChecksumValidation);
|
||||||
}
|
}
|
||||||
settings.setValue(networkProxySettingC, static_cast<std::underlying_type_t<Account::AccountNetworkProxySetting>>(acc->networkProxySetting()));
|
settings.setValue(networkProxySettingC, static_cast<std::underlying_type_t<Account::AccountNetworkProxySetting>>(account->networkProxySetting()));
|
||||||
settings.setValue(networkProxyTypeC, acc->proxyType());
|
settings.setValue(networkProxyTypeC, account->proxyType());
|
||||||
settings.setValue(networkProxyHostNameC, acc->proxyHostName());
|
settings.setValue(networkProxyHostNameC, account->proxyHostName());
|
||||||
settings.setValue(networkProxyPortC, acc->proxyPort());
|
settings.setValue(networkProxyPortC, account->proxyPort());
|
||||||
settings.setValue(networkProxyNeedsAuthC, acc->proxyNeedsAuth());
|
settings.setValue(networkProxyNeedsAuthC, account->proxyNeedsAuth());
|
||||||
settings.setValue(networkProxyUserC, acc->proxyUser());
|
settings.setValue(networkProxyUserC, account->proxyUser());
|
||||||
settings.setValue(networkUploadLimitSettingC, static_cast<std::underlying_type_t<Account::AccountNetworkTransferLimitSetting>>(acc->uploadLimitSetting()));
|
settings.setValue(networkUploadLimitSettingC, static_cast<std::underlying_type_t<Account::AccountNetworkTransferLimitSetting>>(account->uploadLimitSetting()));
|
||||||
settings.setValue(networkDownloadLimitSettingC, static_cast<std::underlying_type_t<Account::AccountNetworkTransferLimitSetting>>(acc->downloadLimitSetting()));
|
settings.setValue(networkDownloadLimitSettingC, static_cast<std::underlying_type_t<Account::AccountNetworkTransferLimitSetting>>(account->downloadLimitSetting()));
|
||||||
settings.setValue(networkUploadLimitC, acc->uploadLimit());
|
settings.setValue(networkUploadLimitC, account->uploadLimit());
|
||||||
settings.setValue(networkDownloadLimitC, acc->downloadLimit());
|
settings.setValue(networkDownloadLimitC, account->downloadLimit());
|
||||||
|
|
||||||
const auto proxyPasswordKey = QString(acc->userIdAtHostWithPort() + networkProxyPasswordKeychainKeySuffixC);
|
const auto proxyPasswordKey = QString(account->userIdAtHostWithPort() + networkProxyPasswordKeychainKeySuffixC);
|
||||||
if (const auto proxyPassword = acc->proxyPassword(); proxyPassword.isEmpty()) {
|
if (const auto proxyPassword = account->proxyPassword(); proxyPassword.isEmpty()) {
|
||||||
const auto job = new QKeychain::DeletePasswordJob(Theme::instance()->appName(), this);
|
const auto job = new QKeychain::DeletePasswordJob(Theme::instance()->appName(), this);
|
||||||
job->setKey(proxyPasswordKey);
|
job->setKey(proxyPasswordKey);
|
||||||
connect(job, &QKeychain::Job::finished, this, [](const QKeychain::Job *const incomingJob) {
|
connect(job, &QKeychain::Job::finished, this, [](const QKeychain::Job *const incomingJob) {
|
||||||
|
@ -384,27 +384,27 @@ void AccountManager::saveAccountHelper(Account *acc, QSettings &settings, bool s
|
||||||
job->start();
|
job->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (acc->_credentials) {
|
if (account->_credentials) {
|
||||||
if (saveCredentials) {
|
if (saveCredentials) {
|
||||||
// Only persist the credentials if the parameter is set, on migration from 1.8.x
|
// Only persist the credentials if the parameter is set, on migration from 1.8.x
|
||||||
// we want to save the accounts but not overwrite the credentials
|
// we want to save the accounts but not overwrite the credentials
|
||||||
// (This is easier than asynchronously fetching the credentials from keychain and then
|
// (This is easier than asynchronously fetching the credentials from keychain and then
|
||||||
// re-persisting them)
|
// re-persisting them)
|
||||||
acc->_credentials->persist();
|
account->_credentials->persist();
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto settingsMapKeys = acc->_settingsMap.keys();
|
const auto settingsMapKeys = account->_settingsMap.keys();
|
||||||
for (const auto &key : settingsMapKeys) {
|
for (const auto &key : settingsMapKeys) {
|
||||||
if (!acc->_settingsMap.value(key).isValid()) {
|
if (!account->_settingsMap.value(key).isValid()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.setValue(key, acc->_settingsMap.value(key));
|
settings.setValue(key, account->_settingsMap.value(key));
|
||||||
}
|
}
|
||||||
settings.setValue(QLatin1String(authTypeC), acc->_credentials->authType());
|
settings.setValue(QLatin1String(authTypeC), account->_credentials->authType());
|
||||||
|
|
||||||
// HACK: Save http_user also as user
|
// HACK: Save http_user also as user
|
||||||
const auto settingsMap = acc->_settingsMap;
|
const auto settingsMap = account->_settingsMap;
|
||||||
if (settingsMap.contains(httpUserC) && settingsMap.value(httpUserC).isValid()) {
|
if (settingsMap.contains(httpUserC) && settingsMap.value(httpUserC).isValid()) {
|
||||||
settings.setValue(userC, settingsMap.value(httpUserC));
|
settings.setValue(userC, settingsMap.value(httpUserC));
|
||||||
}
|
}
|
||||||
|
@ -412,9 +412,9 @@ void AccountManager::saveAccountHelper(Account *acc, QSettings &settings, bool s
|
||||||
|
|
||||||
// Save accepted certificates.
|
// Save accepted certificates.
|
||||||
settings.beginGroup(QLatin1String(generalC));
|
settings.beginGroup(QLatin1String(generalC));
|
||||||
qCInfo(lcAccountManager) << "Saving " << acc->approvedCerts().count() << " unknown certs.";
|
qCInfo(lcAccountManager) << "Saving " << account->approvedCerts().count() << " unknown certs.";
|
||||||
QByteArray certs;
|
QByteArray certs;
|
||||||
const auto approvedCerts = acc->approvedCerts();
|
const auto approvedCerts = account->approvedCerts();
|
||||||
for (const auto &cert : approvedCerts) {
|
for (const auto &cert : approvedCerts) {
|
||||||
certs += cert.toPem() + '\n';
|
certs += cert.toPem() + '\n';
|
||||||
}
|
}
|
||||||
|
@ -424,13 +424,13 @@ void AccountManager::saveAccountHelper(Account *acc, QSettings &settings, bool s
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
// Save cookies.
|
// Save cookies.
|
||||||
if (acc->_networkAccessManager) {
|
if (account->_networkAccessManager) {
|
||||||
auto *jar = qobject_cast<CookieJar *>(acc->_networkAccessManager->cookieJar());
|
const auto jar = qobject_cast<CookieJar *>(account->_networkAccessManager->cookieJar());
|
||||||
if (jar) {
|
if (jar) {
|
||||||
qCInfo(lcAccountManager) << "Saving cookies." << acc->cookieJarPath();
|
qCInfo(lcAccountManager) << "Saving cookies." << account->cookieJarPath();
|
||||||
if (!jar->save(acc->cookieJarPath()))
|
if (!jar->save(account->cookieJarPath()))
|
||||||
{
|
{
|
||||||
qCWarning(lcAccountManager) << "Failed to save cookies to" << acc->cookieJarPath();
|
qCWarning(lcAccountManager) << "Failed to save cookies to" << account->cookieJarPath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue