messagingapp/msgui/appengine/src/conversationlistchangehandler.cpp
changeset 44 36f374c67aa8
parent 23 238255e8b033
equal deleted inserted replaced
43:35b64624a9e7 44:36f374c67aa8
    97     mClientConversationList.ResetAndDestroy();
    97     mClientConversationList.ResetAndDestroy();
    98     
    98     
    99     for (TInt i = 0; i < aClientConversationList.Count(); ++i)
    99     for (TInt i = 0; i < aClientConversationList.Count(); ++i)
   100     {        
   100     {        
   101         CCsClientConversation *entry = aClientConversationList[i]->CloneL();
   101         CCsClientConversation *entry = aClientConversationList[i]->CloneL();
   102         mClientConversationList.AppendL(entry);
   102         mClientConversationList.InsertInOrderAllowRepeats( entry,
       
   103                 ConversationsListChangeHandler::CompareByConvTimeStamp );
   103     }
   104     }
   104 
   105 
   105     if (aClientConversationList.Count() > 0)
   106     if (aClientConversationList.Count() > 0)
   106     {
   107     {
   107         mCurrentIndex = 0;
   108         mCurrentIndex = 0;
   135 {
   136 {
   136     mConvSummaryModel->deleteRow(aClientConversation.GetConversationEntryId());
   137     mConvSummaryModel->deleteRow(aClientConversation.GetConversationEntryId());
   137 }
   138 }
   138 
   139 
   139 //-----------------------------------------------------------------------
   140 //-----------------------------------------------------------------------
       
   141 // This is for handling partial delete conversation event asynchronusly from the server
       
   142 //-----------------------------------------------------------------------
       
   143 //
       
   144 
       
   145 void ConversationsListChangeHandler::PartialDeleteConversationList(
       
   146             const CCsClientConversation& aClientConversation)
       
   147 {
       
   148     ConversationsEngine::instance()->emitConversationListModelEntryDeleted( aClientConversation.GetConversationEntryId() );
       
   149 }
       
   150 
       
   151 //-----------------------------------------------------------------------
   140 // This is for handling modify conversation event asynchronusly from the server
   152 // This is for handling modify conversation event asynchronusly from the server
   141 //-----------------------------------------------------------------------
   153 //-----------------------------------------------------------------------
   142 //
   154 //
   143 void ConversationsListChangeHandler::ModifyConversationList(
   155 void ConversationsListChangeHandler::ModifyConversationList(
   144     const CCsClientConversation& aClientConversation)
   156     const CCsClientConversation& aClientConversation)
   178     for (int i = 0; i < ListWindowSize; ++i)
   190     for (int i = 0; i < ListWindowSize; ++i)
   179     {
   191     {
   180         if (mCurrentIndex < mClientConversationList.Count())
   192         if (mCurrentIndex < mClientConversationList.Count())
   181         {
   193         {
   182             mConvSummaryModel->addRow(
   194             mConvSummaryModel->addRow(
   183                 * (mClientConversationList[mCurrentIndex]));
   195                 * (mClientConversationList[mCurrentIndex]),true);
   184             mCurrentIndex++;
   196             mCurrentIndex++;
   185         }
   197         }
   186         else
   198         else
   187         {
   199         {
   188             break;
   200             break;
   211         mCurrentState = EListenToEvents;
   223         mCurrentState = EListenToEvents;
   212     }
   224     }
   213 
   225 
   214 }
   226 }
   215 
   227 
       
   228 // ----------------------------------------------------------------------------
       
   229 // ConversationsListChangeHandler::CompareByConvTimeStamp
       
   230 // ---------------------------------------------------------------------------
       
   231 TInt ConversationsListChangeHandler::CompareByConvTimeStamp(const CCsClientConversation& aObj1,
       
   232         const CCsClientConversation& aObj2)
       
   233     {
       
   234     TInt64 timestamp1 = aObj1.GetConversationEntry()->TimeStamp();
       
   235     TInt64 timestamp2 = aObj2.GetConversationEntry()->TimeStamp();
       
   236 
       
   237     if (timestamp1 == timestamp2)
       
   238         {
       
   239         return 0;
       
   240         }
       
   241     else if (timestamp1 < timestamp2)
       
   242         {
       
   243         return 1;
       
   244         }
       
   245     return -1;
       
   246     }
       
   247 
   216 // EOF
   248 // EOF