[Pkg-owncloud-commits] [owncloud-client] 19/33: Fix Wizard when returning from later steps
Sandro Knauß
hefee-guest at moszumanska.debian.org
Thu Feb 27 19:44:25 UTC 2014
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch upstream
in repository owncloud-client.
commit 45a7d4ff4cac758f1e4333a213ad08407be443f6
Author: Daniel Molkentin <danimo at owncloud.com>
Date: Sun Feb 23 11:02:03 2014 +0100
Fix Wizard when returning from later steps
We need to reset the credential type when
returning to the first page from later steps.
Otherwise, unfinished credential instances
and their NAM will try to fetch data, which
will fail with weird symptoms.
---
src/CMakeLists.txt | 2 ++
src/mirall/account.cpp | 6 +++++-
src/wizard/abstractcredswizardpage.cpp | 34 ++++++++++++++++++++++++++++++++++
src/wizard/abstractcredswizardpage.h | 3 ++-
4 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2b9c5d4..f9eea20 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -256,6 +256,7 @@ set(mirall_SRCS
wizard/owncloudwizard.cpp
wizard/owncloudsetuppage.cpp
wizard/owncloudhttpcredspage.cpp
+ wizard/abstractcredswizardpage.cpp
wizard/owncloudwizardresultpage.cpp
wizard/owncloudwizardcommon.cpp
wizard/owncloudshibbolethcredspage.cpp
@@ -281,6 +282,7 @@ set(mirall_HEADERS
wizard/owncloudwizard.h
wizard/owncloudsetuppage.h
wizard/owncloudhttpcredspage.h
+ wizard/abstractcredswizardpage.h
wizard/owncloudwizardresultpage.h
wizard/owncloudwizardcommon.h
wizard/owncloudshibbolethcredspage.h
diff --git a/src/mirall/account.cpp b/src/mirall/account.cpp
index 14843f9..c80e3e4 100644
--- a/src/mirall/account.cpp
+++ b/src/mirall/account.cpp
@@ -158,11 +158,15 @@ AbstractCredentials *Account::credentials() const
void Account::setCredentials(AbstractCredentials *cred)
{
- _credentials = cred;
// set active credential manager
if (_am) {
_am->deleteLater();
}
+
+ if (_credentials) {
+ credentials()->deleteLater();
+ }
+ _credentials = cred;
_am = _credentials->getQNAM();
connect(_am, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),
SLOT(slotHandleErrors(QNetworkReply*,QList<QSslError>)));
diff --git a/src/wizard/abstractcredswizardpage.cpp b/src/wizard/abstractcredswizardpage.cpp
new file mode 100644
index 0000000..83d1a92
--- /dev/null
+++ b/src/wizard/abstractcredswizardpage.cpp
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) by Daniel Molkentin <danimo at owncloud.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "creds/abstractcredentials.h"
+#include "creds/credentialsfactory.h"
+#include "mirall/account.h"
+#include "wizard/owncloudwizard.h"
+
+#include "wizard/abstractcredswizardpage.h"
+
+namespace Mirall {
+
+void AbstractCredentialsWizardPage::cleanupPage()
+{
+ Account *account = static_cast<OwncloudWizard*>(wizard())->account();
+ AbstractCredentials *creds = account->credentials();
+ if (creds) {
+ if (!creds->inherits("DummyCredentials")) {
+ account->setCredentials(CredentialsFactory::create("dummy"));
+ }
+ }
+}
+
+}
diff --git a/src/wizard/abstractcredswizardpage.h b/src/wizard/abstractcredswizardpage.h
index 0579f0c..f79fae4 100644
--- a/src/wizard/abstractcredswizardpage.h
+++ b/src/wizard/abstractcredswizardpage.h
@@ -24,7 +24,8 @@ class AbstractCredentials;
class AbstractCredentialsWizardPage : public QWizardPage
{
public:
- virtual AbstractCredentials* getCredentials() const = 0;
+ void cleanupPage();
+ virtual AbstractCredentials* getCredentials() const = 0;
};
} // ns Mirall
--
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