[Telepathy-commits] [telepathy-qt4/master] Split signals for removed contacts - signalAboutToRemoveContact() is emmitted before it is removed from the internal lists. - signalContactRemoved() is emmitted if the contact is removed internally..

Stefan Eilers stefan.eilers at basyskom.de
Wed Jan 28 02:45:36 PST 2009


---
 TelepathyQt4/Prototype/ContactManager.cpp |    4 +++-
 TelepathyQt4/Prototype/ContactManager.h   |   17 ++++++++++++++---
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/TelepathyQt4/Prototype/ContactManager.cpp b/TelepathyQt4/Prototype/ContactManager.cpp
index 79cd0a6..fb5f52b 100644
--- a/TelepathyQt4/Prototype/ContactManager.cpp
+++ b/TelepathyQt4/Prototype/ContactManager.cpp
@@ -1095,7 +1095,7 @@ void ContactManager::slotMembersChanged(const QString& message,
 #ifdef ENABLE_DEBUG_OUTPUT_
                         qDebug() << "Remove Contact";
 #endif                        
-                        emit signalContactRemoved( this, current_contact );
+                        emit signalAboutToRemoveContact( this, current_contact );
                         
                         d->m_members.remove(handle);
                         d->m_subscribed.remove(handle);
@@ -1103,6 +1103,8 @@ void ContactManager::slotMembersChanged(const QString& message,
                         d->m_localPending.remove(handle);
                         d->m_known.remove(handle);
 
+                        emit signalContactRemoved( this );
+
 #ifdef ENABLE_DEBUG_OUTPUT_
                         qDebug() << "delete Contact object: " << current_contact->name();
 #endif
diff --git a/TelepathyQt4/Prototype/ContactManager.h b/TelepathyQt4/Prototype/ContactManager.h
index 26a7cb2..4496946 100644
--- a/TelepathyQt4/Prototype/ContactManager.h
+++ b/TelepathyQt4/Prototype/ContactManager.h
@@ -221,11 +221,22 @@ signals:
     void signalContactSubscribed( TpPrototype ::ContactManager* contactManager, TpPrototype ::Contact* contact );
     
     /**
-     * A Contact was removed.
-     * This signal is emitted if a contact was removed.
+     * A Contact will be removed.
+     * This signal is emitted after the contact was removed but immediately before the account is removed from the internal lists.<br>
+     * Use this signal to obtain all necessary information to handle this remove operation properly. The signal <i>signalContactRemoved()</i>
+     * will be called immediately after cleaning the internal lists.
+     * <br>
      * @param contact The removed contact. This object is deleted after this call!
+     * @see signalContactRemoved()
      */
-    void signalContactRemoved( TpPrototype ::ContactManager* contactManager, TpPrototype ::Contact* contact );
+    void signalAboutToRemoveContact( TpPrototype ::ContactManager* contactManager, TpPrototype ::Contact* contact );
+
+    /**
+     * A contact is removed.
+     * This signal is emmited immediately after <i>signalAboutToRemoveContact()</i> if all internal lists are updated.
+     * @see signalAboutToRemoveContact()
+     */
+    void signalContactRemoved( TpPrototype ::ContactManager* contactManager );
     
     /**
      * @todo: Add doc! (seil)
-- 
1.5.6.5




More information about the telepathy-commits mailing list