[Pkg-owncloud-commits] [owncloud-client] 59/218: AccountSettings: Restore from legacy only once #3565

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 17 14:30:44 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 419deff861d5eec7835fa1ec111e897e78ecb6a0
Author: Christian Kamm <mail at ckamm.de>
Date:   Thu Sep 3 06:23:19 2015 +0200

    AccountSettings: Restore from legacy only once #3565
    
    And also introduce a Accounts/version int at the same time. That
    may make future account settings migrations easier to manage.
---
 src/gui/accountmanager.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gui/accountmanager.cpp b/src/gui/accountmanager.cpp
index c4c4b4c..39b7367 100644
--- a/src/gui/accountmanager.cpp
+++ b/src/gui/accountmanager.cpp
@@ -29,6 +29,7 @@ static const char userC[] = "user";
 static const char httpUserC[] = "http_user";
 static const char caCertsKeyC[] = "CaCertificates";
 static const char accountsC[] = "Accounts";
+static const char versionC[] = "version";
 }
 
 
@@ -45,7 +46,8 @@ bool AccountManager::restore()
     auto settings = Account::settingsWithGroup(QLatin1String(accountsC));
 
     // If there are no accounts, check the old format.
-    if (settings->childGroups().isEmpty()) {
+    if (settings->childGroups().isEmpty()
+            && !settings->contains(QLatin1String(versionC))) {
         return restoreFromLegacySettings();
     }
 
@@ -122,6 +124,7 @@ bool AccountManager::restoreFromLegacySettings()
 void AccountManager::save(bool saveCredentials)
 {
     auto settings = Account::settingsWithGroup(QLatin1String(accountsC));
+    settings->setValue(QLatin1String(versionC), 2);
     foreach (const auto &acc, _accounts) {
         settings->beginGroup(acc->account()->id());
         save(acc->account(), *settings, saveCredentials);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list