[Telepathy-commits] [telepathy-qt4/master] Expose group flags
Olli Salli
olli.salli at collabora.co.uk
Mon Oct 20 09:13:36 PDT 2008
---
TelepathyQt4/cli-channel.cpp | 10 +++++
TelepathyQt4/cli-channel.h | 88 +++++++++++++++++++++++++++++++++++------
2 files changed, 85 insertions(+), 13 deletions(-)
diff --git a/TelepathyQt4/cli-channel.cpp b/TelepathyQt4/cli-channel.cpp
index 4b4e9b2..571386a 100644
--- a/TelepathyQt4/cli-channel.cpp
+++ b/TelepathyQt4/cli-channel.cpp
@@ -357,6 +357,11 @@ uint Channel::targetHandle() const
return mPriv->targetHandle;
}
+uint Channel::groupFlags() const
+{
+ return mPriv->groupFlags;
+}
+
void Channel::gotMainProperties(QDBusPendingCallWatcher* watcher)
{
QDBusPendingReply<QVariantMap> reply = *watcher;
@@ -588,6 +593,11 @@ void Channel::onGroupFlagsChanged(uint added, uint removed)
mPriv->groupFlags |= added;
mPriv->groupFlags &= ~removed;
+
+ if (added || removed) {
+ debug() << "Emitting groupFlagsChanged with" << mPriv->groupFlags << "value" << added << "added" << removed << "removed";
+ emit groupFlagsChanged(mPriv->groupFlags, added, removed);
+ }
}
void Channel::onMembersChanged(const QString& message, const Telepathy::UIntList& added, const Telepathy::UIntList& removed, const Telepathy::UIntList& localPending, const Telepathy::UIntList& remotePending, uint actor, uint reason)
diff --git a/TelepathyQt4/cli-channel.h b/TelepathyQt4/cli-channel.h
index 998aca3..a9c8509 100644
--- a/TelepathyQt4/cli-channel.h
+++ b/TelepathyQt4/cli-channel.h
@@ -70,10 +70,16 @@ namespace Client
* </ul>
*
* The remote object state accessor functions on this object (interfaces(),
- * channelType(), handleType(), handle()) don't make any DBus calls; instead,
- * they return values cached from a previous introspection run. The introspection
- * process populates their values in the most efficient way possible based on
- * what the service implements.
+ * channelType(), targetHandleType(), targetHandle()) don't make any DBus calls;
+ * instead, they return values cached from a previous introspection run. The
+ * introspection process populates their values in the most efficient way
+ * possible based on what the service implements. However, their value is not
+ * defined unless the object has readiness #ReadinessFull, as returned by
+ * readiness() and indicated by emissions of the readinessChanged() signal.
+ *
+ * Additionally, the state of the Group interface on the remote object (if
+ * present) will be cached in the introspection process, and also tracked for
+ * any changes.
*/
class Channel : public ChannelInterface, private OptionalInterfaceFactory
{
@@ -181,11 +187,55 @@ public:
*/
uint targetHandle() const;
+Q_SIGNALS:
+ /**
+ * Emitted whenever the readiness of the Channel changes.
+ *
+ * \param newReadiness The new readiness, as defined in #Readiness.
+ */
+ void readinessChanged(Telepathy::Client::Channel::Readiness newReadiness);
+
/**
- * \name Group interface helpers
+ * \name Group interface
+ *
+ * Cached access to state of the group interface on the associated remote
+ * object, if the interface is present. All methods return undefined values
+ * if the list returned by interfaces() doesn't include
+ * #TELEPATHY_INTERFACE_CHANNEL_INTERFACE_GROUP or if the object doesn't have
+ * readiness #ReadinessFull.
+ *
+ * As the Group interface state can change freely during the lifetime of the
+ * group due to events like new contacts joining the group, the cached state
+ * is automatically kept in sync with the remote object's state by hooking
+ * to the change notification signals present in the D-Bus interface.
+ *
+ * As the cached value changes, change notification signals are emitted.
+ * However, the value being initially discovered by introspection is still
+ * signaled by a readiness change to #ReadinessFull.
+ *
+ * There is a change notification signal <attribute>Changed corresponding to
+ * each cached attribute. The first parameter for each of these signals is
+ * the new value of the attribute, which is suited for displaying the value
+ * of the attribute in a widget in a model-view fashion. The remaining
+ * arguments depend on the attribute, but in general include at least the
+ * delta from the previous state of the attribute to the new state.
+ *
+ * Check the individual signals' descriptions for details.
*/
//@{
+public:
+
+ /**
+ * Returns a set of flags indicating the capabilities and behaviour of the
+ * group represented by the remote object.
+ *
+ * Change notification is via groupFlagsChanged().
+ *
+ * \return Bitfield combination of flags, as defined in #ChannelGroupFlag.
+ */
+ uint groupFlags() const;
+
class GroupLocalPendingInfo
{
public:
@@ -209,6 +259,24 @@ public:
bool mIsValid;
};
+Q_SIGNALS:
+
+ /**
+ * Emitted when the value returned by groupFlags() changes.
+ *
+ * \param flags The new set of flags.
+ */
+ void groupFlagsHasNewValue(uint flags);
+
+ /**
+ * Emitted when the value returned by groupFlags() changes.
+ *
+ * \param flags New value of the set of flags.
+ * \param added Flags added compared to the previous value.
+ * \param removed Flags removed compared to the previous value.
+ */
+ void groupFlagsChanged(uint flags, uint added, uint removed);
+
//@}
/**
@@ -219,6 +287,8 @@ public:
*/
//@{
+public:
+
/**
* Returns a pointer to a valid instance of a given %Channel optional
* interface class, associated with the same remote object the Channel is
@@ -456,14 +526,6 @@ public:
//@}
-Q_SIGNALS:
- /**
- * Emitted whenever the readiness of the Channel changes.
- *
- * \param newReadiness The new readiness, as defined in #Readiness.
- */
- void readinessChanged(Telepathy::Client::Channel::Readiness newReadiness);
-
private Q_SLOTS:
void gotMainProperties(QDBusPendingCallWatcher* watcher);
void gotChannelType(QDBusPendingCallWatcher* watcher);
--
1.5.6.5
More information about the Telepathy-commits
mailing list