messagingapp/msgui/appengine/src/conversationsengine_p.cpp
changeset 52 12db4185673b
parent 44 36f374c67aa8
equal deleted inserted replaced
44:36f374c67aa8 52:12db4185673b
    26 #include "conversationsmodel.h"
    26 #include "conversationsmodel.h"
    27 #include "conversationchangehandler.h"
    27 #include "conversationchangehandler.h"
    28 #include "conversationlistchangehandler.h"
    28 #include "conversationlistchangehandler.h"
    29 #include "debugtraces.h"
    29 #include "debugtraces.h"
    30 
    30 
       
    31 
       
    32 //CONSTANTS
       
    33 /**
       
    34  *Max number of conversation that can be exchanged in IPC call
       
    35  */
       
    36 const TInt KMaxConversationIPCLimit =  250;
    31 //---------------------------------------------------------------
    37 //---------------------------------------------------------------
    32 // ConversationsEnginePrivate::ConversationsEnginePrivate
    38 // ConversationsEnginePrivate::ConversationsEnginePrivate
    33 // @see header
    39 // @see header
    34 //---------------------------------------------------------------
    40 //---------------------------------------------------------------
    35 ConversationsEnginePrivate::ConversationsEnginePrivate(
    41 ConversationsEnginePrivate::ConversationsEnginePrivate(
    40     mClientConv(NULL),
    46     mClientConv(NULL),
    41     mConversationMsgStoreHandler(conversationMsgStoreHandler),
    47     mConversationMsgStoreHandler(conversationMsgStoreHandler),
    42     mConversationsSummaryModel(conversationsSummaryModel),
    48     mConversationsSummaryModel(conversationsSummaryModel),
    43     mConversationsModel(conversationsModel)
    49     mConversationsModel(conversationsModel)
    44 {
    50 {
    45         TRAP_IGNORE(initL());
    51         initL();
    46 }
    52 }
    47 
    53 
    48 //---------------------------------------------------------------
    54 //---------------------------------------------------------------
    49 // ConversationsEnginePrivate::~ConversationsEnginePrivate
    55 // ConversationsEnginePrivate::~ConversationsEnginePrivate
    50 // @see header
    56 // @see header
   126         //set dummy entry
   132         //set dummy entry
   127         CCsConversationEntry *entry = CCsConversationEntry::NewL();
   133         CCsConversationEntry *entry = CCsConversationEntry::NewL();
   128         CleanupStack::PushL(entry);
   134         CleanupStack::PushL(entry);
   129         mClientConv->SetConversationEntryL(entry);
   135         mClientConv->SetConversationEntryL(entry);
   130         CleanupStack::PopAndDestroy(entry);
   136         CleanupStack::PopAndDestroy(entry);
       
   137         // Reset the values in change handler before initiating a request
       
   138         mConvChangeHandler->ResetValuesForNewConversation();
       
   139         
   131         //Get the conversations for new conversationId 
   140         //Get the conversations for new conversationId 
   132         mServer->GetConversationsL(mClientConv);
   141         mServer->GetConversationsL(mClientConv,0,KMaxConversationIPCLimit);
   133 
   142 
   134         QCRITICAL_WRITE("ConversationsEnginePrivate::getConversationsL end.");
   143         QCRITICAL_WRITE("ConversationsEnginePrivate::getConversationsL end.");
   135         }   
   144         }   
   136     
   145     
   137 }
   146 }
   308 //---------------------------------------------------------------
   317 //---------------------------------------------------------------
   309 // ConversationsEnginePrivate::Conversations
   318 // ConversationsEnginePrivate::Conversations
   310 // @see header
   319 // @see header
   311 //---------------------------------------------------------------
   320 //---------------------------------------------------------------
   312 void ConversationsEnginePrivate::Conversations(
   321 void ConversationsEnginePrivate::Conversations(
   313     RPointerArray<CCsConversationEntry>& aConversationEntryList)
   322     RPointerArray<CCsConversationEntry>& aConversationEntryList,
       
   323     TInt& aTotalCount)
   314 {
   324 {
   315     int error;
   325     int error;
   316     if (mClientConv)
   326     if (mClientConv)
   317         {
   327         {
   318         QCRITICAL_WRITE("ConversationsEnginePrivate::Conversations start.");
   328         QCRITICAL_WRITE("ConversationsEnginePrivate::Conversations start.");
   319 
   329 
   320         TRAP(error,mConvChangeHandler->ConversationsL(aConversationEntryList));
   330         TRAP(error,mConvChangeHandler->ConversationsL(aConversationEntryList,aTotalCount));
   321 
   331 
   322         QCRITICAL_WRITE("ConversationsEnginePrivate::Conversations end.");
   332         QCRITICAL_WRITE("ConversationsEnginePrivate::Conversations end.");
   323         }
   333         }
   324 }
   334 }
   325 
   335 
   334         {
   344         {
   335         mConvChangeHandler->restartHandleConversations();
   345         mConvChangeHandler->restartHandleConversations();
   336         }
   346         }
   337 }
   347 }
   338 
   348 
       
   349 //---------------------------------------------------------------
       
   350 // ConversationsEngine::fetchRemainingConversations
       
   351 // @see header
       
   352 //---------------------------------------------------------------
       
   353 void ConversationsEnginePrivate::fetchRemainingConversations(TInt& aCount)
       
   354     {
       
   355     if ( mServer && mClientConv )
       
   356             {
       
   357                     
       
   358             // Get conversations from server
       
   359              mServer->GetConversationsL(mClientConv, 
       
   360                      (aCount - 1),
       
   361                     KMaxConversationIPCLimit);
       
   362             }
       
   363     }
   339 //---------------------------------------------------------------
   364 //---------------------------------------------------------------
   340 // ConversationsEnginePrivate::resendMessage()
   365 // ConversationsEnginePrivate::resendMessage()
   341 // @see header
   366 // @see header
   342 //---------------------------------------------------------------
   367 //---------------------------------------------------------------
   343 bool ConversationsEnginePrivate::resendMessage(TMsvId messageId)
   368 bool ConversationsEnginePrivate::resendMessage(TMsvId messageId)