[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:05:40 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=fb2e24d
The following commit has been merged in the master branch:
commit fb2e24dfa6d0b4bb84328e0f8969b5cde2b2d458
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
---
KTp/Models/accounts-list-model.cpp | 65 +++++++++++++++++++++++++++++++++++++-
KTp/Models/accounts-list-model.h | 20 +++++++++++-
2 files changed, 83 insertions(+), 2 deletions(-)
diff --git a/KTp/Models/accounts-list-model.cpp b/KTp/Models/accounts-list-model.cpp
index 26ce8ca..23fa6d2 100644
--- a/KTp/Models/accounts-list-model.cpp
+++ b/KTp/Models/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/KTp/Models/accounts-list-model.h b/KTp/Models/accounts-list-model.h
index fdd15b7..f4f0e81 100644
--- a/KTp/Models/accounts-list-model.h
+++ b/KTp/Models/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-common-internals packaging
More information about the pkg-kde-commits
mailing list