[SCM] ktp-accounts-kcm packaging branch, master, updated. debian/15.12.1-1-1157-gc4589c5

Maximiliano Curia maxy at moszumanska.debian.org
Fri May 27 23:57:09 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-accounts-kcm.git;a=commitdiff;h=393bef3

The following commit has been merged in the master branch:
commit 393bef3f1bf6bcc2bf12c364e46ada12b5f9a229
Author: George Goldberg <grundleborg at googlemail.com>
Date:   Sat Feb 14 20:14:18 2009 +0000

    Start to implement the internal storage of the AccountsListModel.
    
    svn path=/trunk/playground/network/telepathy-accounts-kcm/; revision=926203
---
 src/account-item.cpp        |  5 ++++
 src/account-item.h          |  1 +
 src/accounts-list-model.cpp | 65 ++++++++++++++++++++++++++++++++++++++++++++-
 src/accounts-list-model.h   | 20 +++++++++++++-
 4 files changed, 89 insertions(+), 2 deletions(-)

diff --git a/src/account-item.cpp b/src/account-item.cpp
index 7e12211..ddaf036 100644
--- a/src/account-item.cpp
+++ b/src/account-item.cpp
@@ -54,6 +54,11 @@ AccountItem::~AccountItem()
     // TODO: Implement me...
 }
 
+Telepathy::Client::Account* AccountItem::account() const
+{
+    return m_account;
+}
+
 void AccountItem::onBecomeReadyFinished(Telepathy::Client::PendingOperation *op)
 {
      Q_ASSERT(op->isFinished());
diff --git a/src/account-item.h b/src/account-item.h
index 32b6da5..9a5dc1b 100644
--- a/src/account-item.h
+++ b/src/account-item.h
@@ -40,6 +40,7 @@ class AccountItem : public QObject
 public:
     explicit AccountItem(Telepathy::Client::Account *account, AccountsListModel *parent = 0);
     virtual ~AccountItem();
+    Telepathy::Client::Account* account() const;
 
 private Q_SLOTS:
     void onBecomeReadyFinished(Telepathy::Client::PendingOperation *op);
diff --git a/src/accounts-list-model.cpp b/src/accounts-list-model.cpp
index 26ce8ca..23fa6d2 100644
--- a/src/accounts-list-model.cpp
+++ b/src/accounts-list-model.cpp
@@ -20,10 +20,17 @@
 
 #include "accounts-list-model.h"
 
+#include "account-item.h"
+
+#include <kdebug.h>
+
+#include <TelepathyQt4/Client/Account>
+
 AccountsListModel::AccountsListModel(QObject *parent)
  : QAbstractListModel(parent)
 {
-    // TODO: Implement me!
+    m_unreadyAccounts.clear();
+    m_readyAccounts.clear();
 }
 
 AccountsListModel::~AccountsListModel()
@@ -43,6 +50,62 @@ QVariant AccountsListModel::data(const QModelIndex &index, int role) const
     return QVariant();
 }
 
+void AccountsListModel::addAccount(Telepathy::Client::Account *account)
+{
+    // Check if the account is already in the model.
+    bool found = false;
+
+    foreach(const AccountItem* ai, m_unreadyAccounts)
+    {
+        if(ai->account() == account)
+        {
+            found = true;
+            break;
+        }
+    }
+    if(!found)
+    {
+        foreach(const AccountItem* ai, m_readyAccounts)
+        {
+            if(ai->account() == account)
+            {
+                found = true;
+                break;
+            }
+        }
+    }
+
+    if(found)
+    {
+       kDebug() << "Requested to add account"
+               << account
+               << "to model, but it is already present. Doing nothing.";
+   }
+   else
+   {
+       AccountItem *item = new AccountItem(account, this);
+       m_unreadyAccounts.append(item);
+       connect(item, SIGNAL(ready()), this, SLOT(onAccountItemReady()));
+       connect(item, SIGNAL(removed()), this, SLOT(onAccountItemRemoved()));
+       connect(item, SIGNAL(updated()), this, SLOT(onAccountItemUpdated()));
+   }
+}
+
+void AccountsListModel::onAccountItemReady()
+{
+    // TODO: Implement me!
+}
+
+void AccountsListModel::onAccountItemRemoved()
+{
+    // TODO: Implement me!
+}
+
+void AccountsListModel::onAccountItemUpdated()
+{
+    // TODO: Implement me!
+}
+
 
 #include "accounts-list-model.moc"
 
diff --git a/src/accounts-list-model.h b/src/accounts-list-model.h
index fdd15b7..f4f0e81 100644
--- a/src/accounts-list-model.h
+++ b/src/accounts-list-model.h
@@ -21,7 +21,15 @@
 #ifndef TELEPATHY_ACCOUNTS_KCM_ACCOUNTS_LIST_MODEL_H
 #define TELEPATHY_ACCOUNTS_KCM_ACCOUNTS_LIST_MODEL_H
 
-#include <QAbstractListModel>
+#include <QtCore/QAbstractListModel>
+
+class AccountItem;
+
+namespace Telepathy {
+    namespace Client {
+        class Account;
+    }
+}
 
 class AccountsListModel : public QAbstractListModel
 {
@@ -33,6 +41,16 @@ public:
     virtual ~AccountsListModel();
     virtual int rowCount(const QModelIndex &index) const;
     virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+    void addAccount(Telepathy::Client::Account *account);
+
+private Q_SLOTS:
+    void onAccountItemReady();
+    void onAccountItemRemoved();
+    void onAccountItemUpdated();
+
+private:
+    QList<AccountItem*> m_unreadyAccounts;
+    QList<AccountItem*> m_readyAccounts;
 
 };
 

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list