[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:08 UTC 2016


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

The following commit has been merged in the master branch:
commit 33a5290d725e3b82b591caa58ee68fcde5b95c05
Author: George Goldberg <grundleborg at googlemail.com>
Date:   Sat Feb 14 17:50:43 2009 +0000

    Telepathy Accounts are now becomeReady()'ed by the AccountItem wrapping them.
    
    This is approximately implemented up to the state it was in before, but is STILL NOT COMPLETE. Don't forget to finish it!
    
    svn path=/trunk/playground/network/telepathy-accounts-kcm/; revision=926129
---
 src/account-item.cpp           | 43 ++++++++++++++++++++++++++++++++++++++++--
 src/account-item.h             | 11 +++++++++--
 src/kcm-telepathy-accounts.cpp | 27 ++------------------------
 src/kcm-telepathy-accounts.h   |  1 -
 4 files changed, 52 insertions(+), 30 deletions(-)

diff --git a/src/account-item.cpp b/src/account-item.cpp
index 1e572ef..7e5a1eb 100644
--- a/src/account-item.cpp
+++ b/src/account-item.cpp
@@ -22,11 +22,31 @@
 
 #include "accounts-list-model.h"
 
-AccountItem::AccountItem(const Telepathy::Client::Account *account, AccountsListModel *parent)
+#include <kdebug.h>
+
+#include <QtCore/QTimer>
+
+#include <TelepathyQt4/Client/Account>
+#include <TelepathyQt4/Client/PendingOperation>
+#include <TelepathyQt4/Client/PendingReadyAccount>
+
+AccountItem::AccountItem(Telepathy::Client::Account *account, AccountsListModel *parent)
  : QObject(parent),
    m_account(account)
 {
-    // TODO: Implement me...
+    // We should look to see if the "account" instance we are passed is ready
+    // yet. If not, we should get it ready now.
+    // FIXME: What features should we check are ready?
+    if(m_account->isReady())
+    {
+        QTimer::singleShot(0, this, SIGNAL(ready()));
+    }
+    else
+    {
+        // FIXME: What features should we get ready with?
+        connect(m_account->becomeReady(), SIGNAL(finished(Telepathy::Client::PendingOperation*)),
+                this, SLOT(onBecomeReadyFinished(Telepathy::Client::PendingOperation*)), Qt::QueuedConnection);
+    }
 }
 
 AccountItem::~AccountItem()
@@ -34,5 +54,24 @@ AccountItem::~AccountItem()
     // TODO: Implement me...
 }
 
+void AccountItem::onBecomeReadyFinished(Telepathy::Client::PendingOperation *op)
+{
+     Q_ASSERT(op->isFinished());
+
+    Telepathy::Client::PendingReadyAccount *pra = qobject_cast<Telepathy::Client::PendingReadyAccount*>(op);
+    Q_ASSERT(0 != pra);
+
+    if(pra->isError())
+    {
+        kDebug() << "An error occurred in making and Account ready.";
+        return;
+    }
+    else
+    {
+        kDebug() << "An Account became ready successfully.";
+        Q_EMIT ready();
+    }
+}
+
 #include "account-item.moc"
 
diff --git a/src/account-item.h b/src/account-item.h
index 13dd9be..32b6da5 100644
--- a/src/account-item.h
+++ b/src/account-item.h
@@ -28,6 +28,7 @@ class AccountsListModel;
 namespace Telepathy {
     namespace Client {
         class Account;
+        class PendingOperation;
     }
 }
 
@@ -37,11 +38,17 @@ class AccountItem : public QObject
     Q_DISABLE_COPY(AccountItem);
 
 public:
-    explicit AccountItem(const Telepathy::Client::Account *account, AccountsListModel *parent = 0);
+    explicit AccountItem(Telepathy::Client::Account *account, AccountsListModel *parent = 0);
     virtual ~AccountItem();
 
+private Q_SLOTS:
+    void onBecomeReadyFinished(Telepathy::Client::PendingOperation *op);
+
+Q_SIGNALS:
+    void ready();
+
 private:
-    const Telepathy::Client::Account *m_account;
+    Telepathy::Client::Account *m_account;
 
 };
 
diff --git a/src/kcm-telepathy-accounts.cpp b/src/kcm-telepathy-accounts.cpp
index c2eeea2..308ea3b 100644
--- a/src/kcm-telepathy-accounts.cpp
+++ b/src/kcm-telepathy-accounts.cpp
@@ -28,7 +28,6 @@
 #include <TelepathyQt4/Client/Account>
 #include <TelepathyQt4/Client/AccountManager>
 #include <TelepathyQt4/Client/PendingOperation>
-#include <TelepathyQt4/Client/PendingReadyAccount>
 
 
 K_PLUGIN_FACTORY(KCMTelepathyAccountsFactory, registerPlugin<KCMTelepathyAccounts>();)
@@ -90,30 +89,8 @@ void KCMTelepathyAccounts::startAccountManagerFinished(Telepathy::Client::Pendin
     QList<Telepathy::Client::Account*> accounts = m_accountManager->allAccounts();
     foreach(Telepathy::Client::Account* account, accounts)
     {
-        connect(account->becomeReady(), SIGNAL(finished(Telepathy::Client::PendingOperation*)),
-                this, SLOT(onAccountReady(Telepathy::Client::PendingOperation*)));
-    }
-}
-
-void KCMTelepathyAccounts::onAccountReady(Telepathy::Client::PendingOperation *op)
-{
-    disconnect(op, SIGNAL(finished(Telepathy::Client::PendingOperation*)),
-            this, SLOT(onAccountReady(Telepathy::Client::PendingOperation*)));
-
-    Q_ASSERT(op->isFinished());
-
-    Telepathy::Client::PendingReadyAccount *pra = qobject_cast<Telepathy::Client::PendingReadyAccount*>(op);
-    Q_ASSERT(0 != pra);
-
-    if(pra->isError())
-    {
-        kDebug() << "An error occurred in making and Account ready.";
-        return;
-    }
-    else
-    {
-        kDebug() << "An Account became ready successfully.";
-        // TODO: Add the account to the model.
+        // TODO: We should add them all to the model (which will create an
+        // AccountItem for each of them).
     }
 }
 
diff --git a/src/kcm-telepathy-accounts.h b/src/kcm-telepathy-accounts.h
index f36efa1..f1b9797 100644
--- a/src/kcm-telepathy-accounts.h
+++ b/src/kcm-telepathy-accounts.h
@@ -52,7 +52,6 @@ public Q_SLOTS:
 private Q_SLOTS:
     void startAccountManager();
     void startAccountManagerFinished(Telepathy::Client::PendingOperation *op);
-    void onAccountReady(Telepathy::Client::PendingOperation *op);
 
 private:
     KCategorizedSortFilterProxyModel *m_accountsListProxyModel;

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list