messagingapp/msgappfw/server/src/ccsconversationcache.cpp
changeset 44 36f374c67aa8
parent 43 35b64624a9e7
child 47 5b14749788d7
child 52 12db4185673b
equal deleted inserted replaced
43:35b64624a9e7 44:36f374c67aa8
   403                                                                convEntry);
   403                                                                convEntry);
   404         NotifyL(clientConv, KConversationListEventDelete);
   404         NotifyL(clientConv, KConversationListEventDelete);
   405         CleanupStack::PopAndDestroy(clientConv);
   405         CleanupStack::PopAndDestroy(clientConv);
   406     }
   406     }
   407 
   407 
       
   408     // send all CV entry delete events, required in case CV is open
       
   409     // Notify client of conversation change
       
   410     TInt totalEntryCount = conversation->GetEntryCount();
       
   411     for (TInt entryCounter = totalEntryCount - 1; entryCounter >= 0;
       
   412             entryCounter--)
       
   413     {
       
   414         CCsConversationEntry* entryInConversation =
       
   415                 conversation->GetEntryL(entryCounter);
       
   416         CCsClientConversation * clientConv =
       
   417                 CreateClientConvLC(conversation, entryInConversation);
       
   418         NotifyL(clientConv, KConversationEventDelete);
       
   419         CleanupStack::PopAndDestroy(clientConv);
       
   420     }
       
   421 
   408     iConversationList->Remove(aIndex);
   422     iConversationList->Remove(aIndex);
   409     entryList.ResetAndDestroy();
   423     entryList.ResetAndDestroy();
   410 
   424 
   411     delete conversation;
   425     delete conversation;
   412 }
   426 }
   434 
   448 
   435 // ----------------------------------------------------------------------------
   449 // ----------------------------------------------------------------------------
   436 // CCsConversationCache::MarkConversationAsDeleted
   450 // CCsConversationCache::MarkConversationAsDeleted
   437 // ----------------------------------------------------------------------------
   451 // ----------------------------------------------------------------------------
   438 void CCsConversationCache::MarkConversationAsDeleted(TInt aConversationId,
   452 void CCsConversationCache::MarkConversationAsDeleted(TInt aConversationId,
   439                                                      TBool aDeleted)
   453                                                      TBool aDeleted, TInt aCount)
   440 {
   454 {
   441     TInt conversationCount = iConversationList->Count();
   455     TInt conversationCount = iConversationList->Count();
   442 
   456 
   443     for (TInt loop = 0; loop < conversationCount; loop++)
   457     for (TInt loop = 0; loop < conversationCount; loop++)
   444     {
   458     {
   447         TInt id = conversation->GetConversationId();
   461         TInt id = conversation->GetConversationId();
   448 
   462 
   449         if (id == aConversationId)
   463         if (id == aConversationId)
   450         {
   464         {
   451             conversation->MarkDeleted(aDeleted);
   465             conversation->MarkDeleted(aDeleted);
       
   466             if( aCount )
       
   467                 {
       
   468                 CCsClientConversation* clientConversation =
       
   469                                     CreateClientConvLC(conversation,
       
   470                                                        conversation->GetLatestEntryL());
       
   471                 NotifyL(clientConversation, KConversationListEventPartialDelete);
       
   472                 CleanupStack::PopAndDestroy();// clientConversation
       
   473                 }
   452             break;
   474             break;
   453         }
   475         }
   454     }
   476     }
   455 }
   477 }
   456 
   478 
   637     }
   659     }
   638     return -1;
   660     return -1;
   639     }
   661     }
   640 
   662 
   641 // ----------------------------------------------------------------------------
   663 // ----------------------------------------------------------------------------
       
   664 // CCsConversationCache::GetConversationFromConversationId
       
   665 // ----------------------------------------------------------------------------
       
   666 CCsClientConversation* CCsConversationCache::GetConversationFromConversationIdL(TInt aConversationId)
       
   667     {
       
   668 
       
   669     CCsClientConversation* clientConv = NULL;
       
   670 
       
   671     for ( TInt loop = 0; loop < iConversationList->Count(); ++loop )
       
   672        {
       
   673         CCsConversation* conversation =
       
   674             static_cast<CCsConversation*>((*iConversationList)[loop]);
       
   675 
       
   676             if (aConversationId == conversation->GetConversationId())
       
   677               {
       
   678                 clientConv = CreateClientConvLC(conversation, conversation->GetLatestEntryL());
       
   679                 CleanupStack::Pop();
       
   680                 break;
       
   681               }
       
   682        }
       
   683     return clientConv;
       
   684     }
       
   685 
       
   686 // ----------------------------------------------------------------------------
   642 // CCsConversationCache::GetConversationFromMessageIdL
   687 // CCsConversationCache::GetConversationFromMessageIdL
   643 // ---------------------------------------------------------------------------
   688 // ---------------------------------------------------------------------------
   644 CCsClientConversation* CCsConversationCache::GetConversationFromMessageIdL(TInt aMessageId)
   689 CCsClientConversation* CCsConversationCache::GetConversationFromMessageIdL(TInt aMessageId)
   645 {
   690 {
   646     TInt conversationCount = iConversationList->Count();
   691     TInt conversationCount = iConversationList->Count();