messagingapp/msgui/appengine/src/conversationsengine_p.cpp
changeset 44 36f374c67aa8
parent 34 84197e66a4bd
child 47 5b14749788d7
child 52 12db4185673b
--- a/messagingapp/msgui/appengine/src/conversationsengine_p.cpp	Wed Jun 23 18:09:17 2010 +0300
+++ b/messagingapp/msgui/appengine/src/conversationsengine_p.cpp	Tue Jul 06 14:12:40 2010 +0300
@@ -51,13 +51,10 @@
 //---------------------------------------------------------------
 ConversationsEnginePrivate::~ConversationsEnginePrivate()
 {
-    delete mConvChangeHandler;
-    
-    delete mConvListChangeHandler;
-    
+
     if( mClientConv )
     {        
-        if(mServer)
+        if(mServer && mConvChangeHandler)
         {    
         TRAP_IGNORE(mServer->RemoveConversationChangeEventL(
                 mConvChangeHandler,mClientConv));
@@ -65,7 +62,7 @@
         delete mClientConv;
         mClientConv = NULL;
     }
-    if(mServer)
+    if(mServer && mConvListChangeHandler)
     {
         TRAP_IGNORE(mServer->RemoveConversationListChangeEventL(
                 mConvListChangeHandler));
@@ -74,6 +71,11 @@
         delete mServer;
         mServer = NULL;
     }
+    
+    delete mConvChangeHandler;
+    
+    delete mConvListChangeHandler;
+    
 }
 
 //---------------------------------------------------------------
@@ -219,6 +221,14 @@
     return convId;
 }
 
+//---------------------------------------------------------------
+// ConversationsEnginePrivate::getConversationFromConversationId
+// @see header
+//---------------------------------------------------------------
+CCsClientConversation* ConversationsEnginePrivate::getConversationFromConversationIdL(TInt aConversationId)
+{
+     return mServer->GetConversationFromConversationIdL(aConversationId);
+}
 
 //---------------------------------------------------------------
 // ConversationsEnginePrivate::clearConversationsL
@@ -235,10 +245,12 @@
     // Delete old CCsClientConversation object 
     // Remove the old Conversation change observer
     if(mClientConv)
-    {    
-        mServer->RemoveConversationChangeEventL (mConvChangeHandler ,mClientConv);
+    {   
+        int error = KErrNone;
+        TRAP(error, mServer->RemoveConversationChangeEventL (mConvChangeHandler ,mClientConv));
         delete mClientConv;
         mClientConv = NULL;
+        User::LeaveIfError(error);
     }
     
     QCRITICAL_WRITE("ConversationsEnginePrivate::clearConversationsL end.");
@@ -258,6 +270,30 @@
 }
 
 //---------------------------------------------------------------
+// ConversationsEnginePrivate::deRegisterCVUpdatesTemporary
+// @see header
+//---------------------------------------------------------------
+void ConversationsEnginePrivate::deRegisterCVUpdatesTemporary()
+{
+    mServer->RemoveConversationChangeEventL (mConvChangeHandler ,mClientConv);
+}
+
+//---------------------------------------------------------------
+// ConversationsEnginePrivate::registerAgainForConversationUpdatesL
+// @see header
+//---------------------------------------------------------------
+void ConversationsEnginePrivate::registerAgainForConversationUpdatesL(
+        int newConversationId)
+{
+    //Add the Conversation Change for new  conversationId
+    if(mClientConv)
+    {    
+    mClientConv->SetConversationEntryId(newConversationId);
+    mServer->RequestConversationChangeEventL (mConvChangeHandler ,mClientConv);
+    }
+}
+
+//---------------------------------------------------------------
 // ConversationsEnginePrivate::ConversationList
 // @see header
 //---------------------------------------------------------------