[Pkg-owncloud-commits] [owncloud-client] 59/498: Wizard: Setup the folder in the right account
Sandro Knauß
hefee-guest at moszumanska.debian.org
Tue Aug 11 14:48:34 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 4006bcdaed4e26176328a9311e25b51da5cafc77
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Mon Apr 27 17:43:07 2015 +0200
Wizard: Setup the folder in the right account
---
src/gui/accountmanager.cpp | 3 ++-
src/gui/accountmanager.h | 5 ++++-
src/gui/owncloudsetupwizard.cpp | 9 ++++-----
src/gui/owncloudsetupwizard.h | 4 +++-
4 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/gui/accountmanager.cpp b/src/gui/accountmanager.cpp
index 5d84ebf..b17de5d 100644
--- a/src/gui/accountmanager.cpp
+++ b/src/gui/accountmanager.cpp
@@ -193,7 +193,7 @@ AccountPtr AccountManager::load(QSettings& settings)
return acc;
}
-void AccountManager::addAccount(const AccountPtr& newAccount)
+AccountState *AccountManager::addAccount(const AccountPtr& newAccount)
{
auto id = newAccount->id();
if (id.isEmpty() || !isAccountIdAvailable(id)) {
@@ -204,6 +204,7 @@ void AccountManager::addAccount(const AccountPtr& newAccount)
AccountStatePtr newAccountState(new AccountState(newAccount));
_accounts << newAccountState;
emit accountAdded(newAccountState.data());
+ return newAccountState.data();
}
void AccountManager::shutdown()
diff --git a/src/gui/accountmanager.h b/src/gui/accountmanager.h
index 44ef48f..6cf4434 100644
--- a/src/gui/accountmanager.h
+++ b/src/gui/accountmanager.h
@@ -41,13 +41,16 @@ public:
* Add this account in the list of saved account.
* Typically called from the wizard
*/
- void addAccount(const AccountPtr &newAccount);
+ AccountState *addAccount(const AccountPtr &newAccount);
/**
* remove all accounts
*/
void shutdown();
+ /**
+ * Return a list of all accounts.
+ */
QList<AccountStatePtr> accounts() { return _accounts; }
private:
diff --git a/src/gui/owncloudsetupwizard.cpp b/src/gui/owncloudsetupwizard.cpp
index 70ae2a2..c62da09 100644
--- a/src/gui/owncloudsetupwizard.cpp
+++ b/src/gui/owncloudsetupwizard.cpp
@@ -461,7 +461,7 @@ void OwncloudSetupWizard::slotAssistantFinished( int result )
// This may or may not wipe all folder definitions, depending
// on whether a new account is activated or the existing one
// is changed.
- applyAccountChanges();
+ auto account = applyAccountChanges();
// But if the user went through with the folder config wizard,
// we assume they always want to have only that folder configured.
@@ -480,8 +480,6 @@ void OwncloudSetupWizard::slotAssistantFinished( int result )
folderDefinition.localPath = localFolder;
folderDefinition.targetPath = _remoteFolder;
folderDefinition.selectiveSyncBlackList = _ocWizard->selectiveSyncBlacklist();
-#warning fixme: which account? save the one from addAccount below?
- AccountState* account = AccountManager::instance()->accounts().value(0).data();
folderMan->addFolder(account, folderDefinition);
_ocWizard->appendToConfigurationLog(tr("<font color=\"green\"><b>Local sync folder %1 successfully created!</b></font>").arg(localFolder));
}
@@ -501,13 +499,14 @@ void OwncloudSetupWizard::slotSkipFolderConfiguration()
emit ownCloudWizardDone( QDialog::Accepted );
}
-void OwncloudSetupWizard::applyAccountChanges()
+AccountState *OwncloudSetupWizard::applyAccountChanges()
{
AccountPtr newAccount = _ocWizard->account();
auto manager = AccountManager::instance();
- manager->addAccount(newAccount);
+ auto newState = manager->addAccount(newAccount);
manager->save();
+ return newState;
}
diff --git a/src/gui/owncloudsetupwizard.h b/src/gui/owncloudsetupwizard.h
index fc5b850..6c246b3 100644
--- a/src/gui/owncloudsetupwizard.h
+++ b/src/gui/owncloudsetupwizard.h
@@ -29,6 +29,8 @@
namespace OCC {
+class AccountState;
+
class OwncloudWizard;
class DetermineAuthTypeJob : public AbstractNetworkJob {
@@ -78,7 +80,7 @@ private:
void createRemoteFolder();
void finalizeSetup( bool );
bool ensureStartFromScratch(const QString &localFolder);
- void applyAccountChanges();
+ AccountState *applyAccountChanges();
bool checkDowngradeAdvised(QNetworkReply* reply);
OwncloudWizard* _ocWizard;
--
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