From 5597ebe455cc4f6cd39758682a16dfa4697973e0 Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Thu, 12 Jun 2014 11:38:39 +0200 Subject: [PATCH] Account: Add a scoped pointer to the ownCloud theme. --- src/mirall/account.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/mirall/account.cpp b/src/mirall/account.cpp index a41369197..ac7208eab 100644 --- a/src/mirall/account.cpp +++ b/src/mirall/account.cpp @@ -18,6 +18,7 @@ #include "mirall/mirallconfigfile.h" #include "mirall/mirallaccessmanager.h" #include "mirall/quotainfo.h" +#include "mirall/owncloudtheme.h" #include "creds/abstractcredentials.h" #include "creds/credentialsfactory.h" @@ -113,9 +114,19 @@ void Account::save() Account* Account::restore() { QScopedPointer settings(settingsWithGroup(Theme::instance()->appName())); + QScopedPointer ocTheme(new ownCloudTheme); + + Account *acc = 0; + MirallConfigFile cfg; + + if( settings->childKeys().isEmpty() ) { + // Now try to open the original ownCloud settings to see if they exist. + cfg.setTheme(ocTheme.data()); + } + if (!settings->childKeys().isEmpty()) { - Account *acc = new Account; - MirallConfigFile cfg; + acc = new Account; + acc->setApprovedCerts(QSslCertificate::fromData(cfg.caCerts())); acc->setUrl(settings->value(QLatin1String(urlC)).toUrl()); acc->setCredentials(CredentialsFactory::create(settings->value(QLatin1String(authTypeC)).toString()));