[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9

Maximiliano Curia maxy at moszumanska.debian.org
Mon May 9 09:06:15 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=3901a5d

The following commit has been merged in the master branch:
commit 3901a5d6208421c8b885e7953e077684ab98a427
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Tue Jan 22 19:26:49 2013 +0000

    Add a method to AccountsComboBox to pre-select an account
    
    REVIEW: 108558
---
 KTp/Widgets/accounts-combo-box.cpp | 14 ++++++++++++++
 KTp/Widgets/accounts-combo-box.h   | 23 ++++++++++++++++++++++-
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/KTp/Widgets/accounts-combo-box.cpp b/KTp/Widgets/accounts-combo-box.cpp
index d1ffbac..903b034 100644
--- a/KTp/Widgets/accounts-combo-box.cpp
+++ b/KTp/Widgets/accounts-combo-box.cpp
@@ -49,6 +49,20 @@ Tp::AccountPtr KTp::AccountsComboBox::currentAccount()
     return itemData(currentIndex(), AccountsListModel::AccountRole).value<Tp::AccountPtr>();
 }
 
+void KTp::AccountsComboBox::setCurrentAccount(const QString &selectedAccountId)
+{
+    for (int i=0;i<count();i++) {
+        if (itemData(i, AccountsListModel::AccountRole).value<Tp::AccountPtr>()->uniqueIdentifier() == selectedAccountId) {
+            setCurrentIndex(i);
+            break;
+        }
+    }
+}
+
+void KTp::AccountsComboBox::setCurrentAccount(const Tp::AccountPtr &selectedAccount)
+{
+    setCurrentAccount(selectedAccount->uniqueIdentifier());
+}
 
 
 
diff --git a/KTp/Widgets/accounts-combo-box.h b/KTp/Widgets/accounts-combo-box.h
index b5a17da..068dfdf 100644
--- a/KTp/Widgets/accounts-combo-box.h
+++ b/KTp/Widgets/accounts-combo-box.h
@@ -23,9 +23,11 @@
 #include <QComboBox>
 #include <TelepathyQt/Types>
 
+#include <KTp/ktp-export.h>
+
 namespace KTp {
 
-class AccountsComboBox : public QComboBox
+class KTP_EXPORT AccountsComboBox : public QComboBox
 {
     Q_OBJECT
     Q_DISABLE_COPY(AccountsComboBox)
@@ -33,9 +35,28 @@ public:
     explicit AccountsComboBox(QWidget *parent = 0);
 
 public:
+    /** A set of accounts to show.
+     * See AccountsListModel::setAccountSet for details
+     */
     void setAccountSet(const Tp::AccountSetPtr &accountSet);
+
+    /** The currently selected account
+     * @return the select account this pointer will be null if no account is selected
+     */
     Tp::AccountPtr currentAccount();
 
+
+    /** Sets the index to the account with the specified ID, provided it exists in the account set
+     *  This may be used to save/restore the last used account when showing the combo box
+     * @param selectedAccountId the account id as found from Tp::Account::uniqueIdentifier
+     */
+    void setCurrentAccount(const QString &selectedAccountId);
+
+    /** Sets the index to the specified account, provided it exists in the account set
+        @param selectedAccount the account to select
+     */
+    void setCurrentAccount(const Tp::AccountPtr &selectedAccount);
+
 private:
     class Private;
     Private * const d;

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list