Nepomuk-Core
Go to the documentation of this file.
21 #include <TelepathyQt/Account>
22 #include <TelepathyQt/AccountManager>
23 #include <TelepathyQt/PendingContacts>
24 #include <TelepathyQt/ContactManager>
30 class PersistentContact::Private
45 KTp::PersistentContact::PersistentContact(
const QString &accountId,
const QString &contactId)
70 Q_FOREACH(
const Tp::AccountPtr &account, accountManager->allAccounts()) {
71 if (account->uniqueIdentifier() == d->accountId) {
73 connect(account.data(), SIGNAL(connectionChanged(Tp::ConnectionPtr)), SLOT(onAccountConnectionChanged(Tp::ConnectionPtr)));
74 onAccountConnectionChanged(account->connection());
78 kWarning() <<
"Could not find account " << d->accountId;
91 void KTp::PersistentContact::onAccountConnectionChanged(
const Tp::ConnectionPtr &connection)
94 Tp::ContactManagerPtr manager = connection->contactManager();
95 connect(manager->contactsForIdentifiers(QStringList() << d->contactId), SIGNAL(finished(Tp::PendingOperation*)), SLOT(onPendingContactsFinished(Tp::PendingOperation*)));
99 void KTp::PersistentContact::onPendingContactsFinished(Tp::PendingOperation *op)
101 Tp::PendingContacts *pendingContactsOp = qobject_cast<Tp::PendingContacts*>(op);
102 Q_ASSERT(pendingContactsOp);
104 if (pendingContactsOp->contacts().size() == 1) {
105 d->contact = KTp::ContactPtr::qObjectCast(pendingContactsOp->contacts()[0]);
106 Q_EMIT contactChanged(d->contact);
107 connect(d->contact.data(), SIGNAL(invalidated()), SLOT(onContactInvalid()));
111 void KTp::PersistentContact::onContactInvalid()
114 Q_EMIT contactChanged(d->contact);
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Fri Mar 22 2013 10:58:52 by
doxygen 1.8.1.2 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.