[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/network/telepathy-accounts-kcm/src
From: George Goldberg <grundleborg () googlemail ! com>
Date: 2009-02-14 17:50:54
Message-ID: 1234633854.764152.17768.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 926129 by gberg:
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!
M +41 -2 account-item.cpp
M +9 -2 account-item.h
M +2 -25 kcm-telepathy-accounts.cpp
M +0 -1 kcm-telepathy-accounts.h
--- trunk/playground/network/telepathy-accounts-kcm/src/account-item.cpp \
#926128:926129 @@ -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 @@
// 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"
--- trunk/playground/network/telepathy-accounts-kcm/src/account-item.h #926128:926129
@@ -28,6 +28,7 @@
namespace Telepathy {
namespace Client {
class Account;
+ class PendingOperation;
}
}
@@ -37,11 +38,17 @@
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;
};
--- trunk/playground/network/telepathy-accounts-kcm/src/kcm-telepathy-accounts.cpp \
#926128:926129 @@ -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,33 +89,11 @@
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*)));
+ // TODO: We should add them all to the model (which will create an
+ // AccountItem for each of them).
}
}
-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.
- }
-}
-
-
#include "kcm-telepathy-accounts.moc"
--- trunk/playground/network/telepathy-accounts-kcm/src/kcm-telepathy-accounts.h \
#926128:926129 @@ -52,7 +52,6 @@
private Q_SLOTS:
void startAccountManager();
void startAccountManagerFinished(Telepathy::Client::PendingOperation *op);
- void onAccountReady(Telepathy::Client::PendingOperation *op);
private:
KCategorizedSortFilterProxyModel *m_accountsListProxyModel;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic