[Pkg-owncloud-commits] [owncloud-client] 313/484: AccountManager: new method to return AccountStatePtr from the name.

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Dec 16 00:37:57 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 81296fae9dfe9d142a18a6ffd96324700bb7b08f
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Thu Nov 12 17:50:00 2015 +0100

    AccountManager: new method to return AccountStatePtr from the name.
    
    It uses the Account displayName to destinguish.
---
 src/gui/accountmanager.cpp | 10 ++++++++++
 src/gui/accountmanager.h   |  5 +++++
 2 files changed, 15 insertions(+)

diff --git a/src/gui/accountmanager.cpp b/src/gui/accountmanager.cpp
index 28a0b78..0b5eed4 100644
--- a/src/gui/accountmanager.cpp
+++ b/src/gui/accountmanager.cpp
@@ -215,6 +215,16 @@ AccountPtr AccountManager::load(QSettings& settings)
     return acc;
 }
 
+AccountStatePtr AccountManager::account(const QString& name)
+{
+    foreach (const auto& acc, _accounts) {
+        if (acc->account()->displayName() == name) {
+            return acc;
+        }
+    }
+    return AccountStatePtr();
+}
+
 AccountState *AccountManager::addAccount(const AccountPtr& newAccount)
 {
     auto id = newAccount->id();
diff --git a/src/gui/accountmanager.h b/src/gui/accountmanager.h
index eed8e43..296b3b3 100644
--- a/src/gui/accountmanager.h
+++ b/src/gui/accountmanager.h
@@ -59,6 +59,11 @@ public:
     QList<AccountStatePtr> accounts() { return _accounts; }
 
     /**
+     * Return the account state pointer for an account identified by its display name
+     */
+    AccountStatePtr account(const QString& name);
+
+    /**
      * Delete the AccountState
      */
     void deleteAccount(AccountState *account);

-- 
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