messagingapp/msgui/appengine/src/conversationchangehandler.cpp
changeset 48 4f501b74aeb1
parent 37 518b245aa84c
--- a/messagingapp/msgui/appengine/src/conversationchangehandler.cpp	Tue Jul 13 22:09:22 2010 +0530
+++ b/messagingapp/msgui/appengine/src/conversationchangehandler.cpp	Sun Jul 25 18:59:19 2010 +0530
@@ -61,9 +61,10 @@
 // ---------------------------------------------------------------------------
 //
 void ConversationsChangeHandler::ConversationsL(RPointerArray<
-        CCsConversationEntry>& aConversationEntryList)
+        CCsConversationEntry>& aConversationEntryList, TInt& aTotalCount)
 {
-    mConversationEntryList.ResetAndDestroy();
+    
+    mTotalCount = aTotalCount;
 
     for (TInt i = 0; i < aConversationEntryList.Count(); ++i)
     {
@@ -72,8 +73,6 @@
     }
     if (aConversationEntryList.Count() > 0)
     {
-        mFirstWindowCached = EFalse;
-        mCurrentIndex = 0;
         mCurrentState = EInitialCache;
         IssueRequest();
     }
@@ -84,6 +83,20 @@
         mCurrentState = EListenToEvents;
     }
 }
+// ---------------------------------------------------------------------------
+// This is for resetting the values before initiating a request 
+// for fetching entries for a new conversation
+// ---------------------------------------------------------------------------
+//
+void ConversationsChangeHandler::ResetValuesForNewConversation()
+{
+	mConvEnginePrivate->registerForConversationUpdatesL();
+    mCurrentIndex = 0;
+    mFirstWindowCached = EFalse;
+    mConversationEntryList.ResetAndDestroy();
+    
+
+}
 
 // ---------------------------------------------------------------------------
 // Handling addition of new conversation entry from the server
@@ -147,6 +160,9 @@
         case EInitialCache:
             HandleConversationsL();
             break;
+        case EFetchMoreConversations:
+            FetchRemainingConversations(mConversationEntryList.Count());
+            break;
     }
 }
 
@@ -202,6 +218,15 @@
             return;
         }
         IssueRequest();
+        return;
+    }
+    //if more entries have to be fetched , issue a request,
+    // else listen for events.
+    if(mCurrentIndex < mTotalCount )
+    {
+        //fetch more
+        mCurrentState = EFetchMoreConversations;
+        IssueRequest();
     }
     else
     {
@@ -211,12 +236,20 @@
             mFirstWindowCached = ETrue;
         }
         mConversationEntryList.ResetAndDestroy();
-        mConvEnginePrivate->registerForConversationUpdatesL();
         mCurrentState = EListenToEvents;
     }
 }
 
 // ---------------------------------------------------------------------------
+//  Fetches remaining conversations from the server 
+// ---------------------------------------------------------------------------
+//
+void ConversationsChangeHandler::FetchRemainingConversations(TInt aTotalCount)
+{
+    mConvEnginePrivate->fetchRemainingConversations(aTotalCount);
+    
+}
+// ---------------------------------------------------------------------------
 //  Starts fetching remaining conversations
 // ---------------------------------------------------------------------------
 //