[telepathy-qt4/master] ContactManager: Added groupRemoved signal.
Andre Moreira Magalhaes (andrunko)
andre.magalhaes at collabora.co.uk
Wed Jul 22 00:17:46 PDT 2009
---
TelepathyQt4/contact-manager.cpp | 26 ++++++++++++++++++++++----
TelepathyQt4/contact-manager.h | 4 ++++
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/TelepathyQt4/contact-manager.cpp b/TelepathyQt4/contact-manager.cpp
index 412204f..173d2fa 100644
--- a/TelepathyQt4/contact-manager.cpp
+++ b/TelepathyQt4/contact-manager.cpp
@@ -707,6 +707,22 @@ void ContactManager::onDenyChannelMembersChanged(
}
}
+void ContactManager::onContactListGroupRemoved(Tp::DBusProxy *proxy,
+ const QString &errorName, const QString &errorMessage)
+{
+ Q_UNUSED(errorName);
+ Q_UNUSED(errorMessage);
+
+ // Is it correct to assume that if a user-defined contact list
+ // gets invalidated it means it was removed? Spec states that if a
+ // user-defined contact list gets closed it was removed, and Channel
+ // invalidates itself when it gets closed.
+ ChannelPtr contactListGroupChannel = ChannelPtr(qobject_cast<Channel*>(proxy));
+ QString id = contactListGroupChannel->immutableProperties().value(
+ QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetID")).toString();
+ emit groupRemoved(id);
+}
+
ContactManager::ContactManager(const ConnectionPtr &connection)
: QObject(connection.data()),
mPriv(new Private(connection))
@@ -817,8 +833,9 @@ void ContactManager::setContactListGroupsChannels(
id = contactListGroupChannel->immutableProperties().value(
QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetID")).toString();
mPriv->contactListGroupsChannels.insert(id, contactListGroupChannel);
-
- // TODO connect to closed signal
+ connect(contactListGroupChannel.data(),
+ SIGNAL(invalidated(Tp::DBusProxy *, const QString &, const QString &)),
+ SLOT(onContactListGroupRemoved(Tp::DBusProxy *, const QString &, const QString &)));
}
}
@@ -828,8 +845,9 @@ void ContactManager::addContactListGroupChannel(
QString id = contactListGroupChannel->immutableProperties().value(
QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetID")).toString();
mPriv->contactListGroupsChannels.insert(id, contactListGroupChannel);
-
- // TODO connect to closed signal
+ connect(contactListGroupChannel.data(),
+ SIGNAL(invalidated(Tp::DBusProxy *, const QString &, const QString &)),
+ SLOT(onContactListGroupRemoved(Tp::DBusProxy *, const QString &, const QString &)));
emit groupAdded(id);
}
diff --git a/TelepathyQt4/contact-manager.h b/TelepathyQt4/contact-manager.h
index 9190a1d..1180b68 100644
--- a/TelepathyQt4/contact-manager.h
+++ b/TelepathyQt4/contact-manager.h
@@ -102,6 +102,7 @@ public:
Q_SIGNALS:
void presencePublicationRequested(const Tp::Contacts &contacts);
void groupAdded(const QString &group);
+ void groupRemoved(const QString &group);
private Q_SLOTS:
void onAliasesChanged(const Tp::AliasPairList &);
@@ -127,6 +128,9 @@ private Q_SLOTS:
const Tp::Contacts &groupMembersRemoved,
const Tp::Channel::GroupMemberChangeDetails &details);
+ void onContactListGroupRemoved(Tp::DBusProxy *,
+ const QString &, const QString &);
+
private:
friend class Connection;
friend class PendingContacts;
--
1.5.6.5
More information about the telepathy-commits
mailing list