Account: Add a scoped pointer to the ownCloud theme.

This commit is contained in:
Klaas Freitag 2014-06-12 11:38:39 +02:00
parent a7d251f8fc
commit 5597ebe455

View file

@ -18,6 +18,7 @@
#include "mirall/mirallconfigfile.h" #include "mirall/mirallconfigfile.h"
#include "mirall/mirallaccessmanager.h" #include "mirall/mirallaccessmanager.h"
#include "mirall/quotainfo.h" #include "mirall/quotainfo.h"
#include "mirall/owncloudtheme.h"
#include "creds/abstractcredentials.h" #include "creds/abstractcredentials.h"
#include "creds/credentialsfactory.h" #include "creds/credentialsfactory.h"
@ -113,9 +114,19 @@ void Account::save()
Account* Account::restore() Account* Account::restore()
{ {
QScopedPointer<QSettings> settings(settingsWithGroup(Theme::instance()->appName())); QScopedPointer<QSettings> settings(settingsWithGroup(Theme::instance()->appName()));
QScopedPointer<ownCloudTheme> 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()) { if (!settings->childKeys().isEmpty()) {
Account *acc = new Account; acc = new Account;
MirallConfigFile cfg;
acc->setApprovedCerts(QSslCertificate::fromData(cfg.caCerts())); acc->setApprovedCerts(QSslCertificate::fromData(cfg.caCerts()));
acc->setUrl(settings->value(QLatin1String(urlC)).toUrl()); acc->setUrl(settings->value(QLatin1String(urlC)).toUrl());
acc->setCredentials(CredentialsFactory::create(settings->value(QLatin1String(authTypeC)).toString())); acc->setCredentials(CredentialsFactory::create(settings->value(QLatin1String(authTypeC)).toString()));