emailuis/emailui/src/FreestyleEmailUiMailListModel.cpp
branchRCL_3
changeset 20 efd4f1afd43e
parent 10 f5907b1a1053
equal deleted inserted replaced
18:6b8f3b30d0ec 20:efd4f1afd43e
   248     {
   248     {
   249     FUNC_LOG;
   249     FUNC_LOG;
   250     CFSEmailUiMailListModelItem* item = 
   250     CFSEmailUiMailListModelItem* item = 
   251         static_cast< CFSEmailUiMailListModelItem* >( Item(aIndex) );
   251         static_cast< CFSEmailUiMailListModelItem* >( Item(aIndex) );
   252     
   252     
   253     // Mail type items own the message. Delete the existing message first.
   253     if ( item ) // Safety
   254     if ( item->ModelItemType() == ETypeMailItem )
   254         {
   255         {
   255         // Mail type items own the message. Delete the existing message first.
   256         delete &item->MessagePtr();
   256         if ( item->ModelItemType() == ETypeMailItem )
   257         }
   257             {
   258     item->SetMessagePtr( aNewPtr );
   258             delete &item->MessagePtr();
   259     
   259             }
   260     // If the item was the first child of a node, then also message pointer in the parent
   260         item->SetMessagePtr( aNewPtr );
   261     // node needs to be updated
   261         
   262     if ( aIndex > 0 &&
   262         // If the item was the first child of a node, then also message pointer in the parent
   263          item->ModelItemType() == ETypeMailItem &&
   263         // node needs to be updated
   264          iItems[aIndex-1]->ModelItemType() == ETypeSeparator )
   264         if ( aIndex > 0 &&
   265         {
   265              item->ModelItemType() == ETypeMailItem &&
   266         iItems[aIndex-1]->SetMessagePtr( aNewPtr );
   266              iItems[aIndex-1]->ModelItemType() == ETypeSeparator )
       
   267             {
       
   268             iItems[aIndex-1]->SetMessagePtr( aNewPtr );
       
   269             }
   267         }
   270         }
   268     }
   271     }
   269 
   272 
   270 TInt CFSEmailUiMailListModel::GetInsertionPointL( const CFSEmailUiMailListModelItem& aItemToInsert ) const
   273 TInt CFSEmailUiMailListModel::GetInsertionPointL( const CFSEmailUiMailListModelItem& aItemToInsert ) const
   271     {
   274     {