messagingappbase/mce/src/MceMessageListView.cpp
branchRCL_3
changeset 19 7e4e4bcc75b6
parent 15 52d61119153d
child 24 696bfeff199e
equal deleted inserted replaced
18:fbb813aef148 19:7e4e4bcc75b6
   219 
   219 
   220     // Save the sort ordering in the message store
   220     // Save the sort ordering in the message store
   221     // Set the default sort order
   221     // Set the default sort order
   222     iSortOrder = EMceCmdSortByDate;
   222     iSortOrder = EMceCmdSortByDate;
   223     iOrdering = EFalse;
   223     iOrdering = EFalse;
   224 	    if ( iMsgListContainer )
   224     if ( iMsgListContainer )
   225 	        {
   225         {
   226             TMsvId fId = iMsgListContainer->CurrentFolderId();
   226         TMsvId fId = iMsgListContainer->CurrentFolderId();
   227             for( TInt loop = 0; loop < iFolderItemArray->Count() ; loop++ )
   227         for( TInt loop = 0; loop < iFolderItemArray->Count() ; loop++ )
   228                 {
   228             {
   229                 TMceFolderItem item = ((*iFolderItemArray)[loop]);
   229             TMceFolderItem item = ((*iFolderItemArray)[loop]);
   230                 if ( item.iFolderId == fId && aPrevViewId == TDRVIEWID)
   230             if ( item.iFolderId == fId && aPrevViewId == TDRVIEWID)
   231                     {        
   231                 {        
   232                     iSortOrder = item.iSortOrder;
   232                 iSortOrder = item.iSortOrder;
   233                     iOrdering = item.iOrdering;
   233                 iOrdering = item.iOrdering;
   234                     }
   234                 }
   235                 }
   235             }
   236 	        }
   236         }
   237 	    if (aPrevViewId != TDRVIEWID ) 
   237     if (aPrevViewId != TDRVIEWID ) 
   238         {
   238         {
   239     // Reset the sort order
   239         // Reset the sort order
   240     iFolderItemArray->Reset();
   240     	iFolderItemArray->Reset();
   241        }
   241         }
   242 	    
   242 	    
   243     if ( iMsgListContainer )
   243     if ( iMsgListContainer )
   244         {
   244         {
   245         iMsgListContainer->SetSortTypeL( iSortOrder, iOrdering );
   245         iMsgListContainer->SetSortTypeL( iSortOrder, iOrdering );
   246         }
   246         }
   247         
   247         
   248     TMsvId id = 0;
   248     TMsvId id = 0;
   249     TBool editorLaunched = EFalse;
   249     TBool editorLaunched = EFalse;
   250     TBool launchingFromOutside = EFalse;  
   250     TBool launchingFromOutside = EFalse;  
   251     TMsvId service = KMsvLocalServiceIndexEntryId;
   251     TMsvId service = KMsvLocalServiceIndexEntryId;
   252     TMsvEntry entry;
   252     TMsvEntry entry;    
       
   253     TInt msgMtmUid = 0;
   253     
   254     
   254     if ( aCustomMessageId.iUid > KMsvRootIndexEntryId )
   255     if ( aCustomMessageId.iUid > KMsvRootIndexEntryId )
   255         {
   256         {
   256         
   257 
   257         if ( iSession->GetEntry( aCustomMessageId.iUid, service, entry ) != KErrNone )
   258         if ( iSession->GetEntry( aCustomMessageId.iUid, service, entry ) != KErrNone )
   258             {
   259             {
   259             iSession->GetEntry( KMsvGlobalInBoxIndexEntryId, service, entry ); // this should always succeed!
   260             iSession->GetEntry( KMsvGlobalInBoxIndexEntryId, service, entry ); // this should always succeed!
   260             }
   261             }
   261         
   262 
   262         // outside the app.
   263         // outside the app.
   263         launchingFromOutside = ETrue;
   264         launchingFromOutside = ETrue;
   264         //check, if message store has been changed from MMC to phone
       
   265         iMceUi->ToPhoneMemoryQueryL( ETrue );
       
   266 
       
   267         // Set the forder containing the entry
   265         // Set the forder containing the entry
   268     	if ( entry.iType == KUidMsvMessageEntry )
   266         if ( entry.iType == KUidMsvMessageEntry )
   269         	{
   267             {
   270         // The aCustomMessageId is an ID of a message, set Inbox
   268             // The aCustomMessageId is an ID of a message, set Inbox
   271         	SetFolderL( entry.Parent() );
   269             SetFolderL( entry.Parent() );
   272         	id = aCustomMessageId.iUid;
   270             id = aCustomMessageId.iUid;
   273         	}
   271             }
   274     	else
   272         else
   275         	{
   273             {
   276             // Set the folder based on the given ID
   274             // Set the folder based on the given ID
   277             iFolderId = aCustomMessageId.iUid;
   275             iFolderId = aCustomMessageId.iUid;
   278 
   276             // this is performance optimization, start to launch viewer before container creation
   279         	}
   277             if ( !iMsgListContainer && entry.Id() == KMsvGlobalInBoxIndexEntryId )
       
   278                 {
       
   279                 if ( LaunchViewerWhenOneUnreadL( msgMtmUid ) > KErrNotFound )
       
   280                     {
       
   281                     editorLaunched = ETrue;
       
   282                     }
       
   283                 }
       
   284             }
   280         iMceUi->SetDontExitOnNextOperationComplete();
   285         iMceUi->SetDontExitOnNextOperationComplete();
   281         }
   286         }
   282 	if ( iMsgListContainer &&
   287     
   283 	     iCurrentListType != GetFolderListBoxType())
   288     if ( iMsgListContainer &&
   284 	    {
   289             iCurrentListType != GetFolderListBoxType())
   285 	    ListboxTypeChangedL();
   290         {
   286 	    }
   291         ListboxTypeChangedL();
   287 	else
   292         }
   288 	    {
   293     else
   289 	    CreateListboxL();        
   294         {
   290 	    }
   295         CreateListboxL();        
   291     
   296         }           
   292     
       
   293     if ( iMsgListContainer && aPrevViewId == TDRVIEWID )
   297     if ( iMsgListContainer && aPrevViewId == TDRVIEWID )
   294         {
   298         {
   295         // Save the sort ordering in the message store
   299         // Save the sort ordering in the message store
   296         // Set the default sort order
   300         // Set the default sort order
   297         iSortOrder = EMceCmdSortByDate;
   301         iSortOrder = EMceCmdSortByDate;
   975 
   979 
   976 void CMceMessageListView::DynInitMenuPaneL(
   980 void CMceMessageListView::DynInitMenuPaneL(
   977     TInt aResourceId,
   981     TInt aResourceId,
   978     CEikMenuPane* aMenuPane )
   982     CEikMenuPane* aMenuPane )
   979     {
   983     {
       
   984     TInt listPopulated = 1;
       
   985     //Get the value, accordingly we can dim/undim mark/unmark for one row list only
       
   986     if ( iCurrentListType == EMceListTypeOneRow )
       
   987         {
       
   988         TInt r = RProperty::Get(KPSUidMuiu, KMuiuOneRowListPopulated,listPopulated);
       
   989         if ( r!= KErrNone )
       
   990             {
       
   991             User::LeaveIfError(r);
       
   992             }
       
   993         }
   980     if ( !iMceViewActivated )
   994     if ( !iMceViewActivated )
   981         {
   995         {
   982         return;
   996         return;
   983         }
   997         }
   984         
   998         
   999 		}
  1013 		}
  1000         
  1014         
  1001     switch ( aResourceId )
  1015     switch ( aResourceId )
  1002         {
  1016         {
  1003         case R_MCE_FOLDER_MENU:
  1017         case R_MCE_FOLDER_MENU:
       
  1018             if(!listPopulated)
       
  1019                 {
       
  1020             	aMenuPane->SetItemDimmed( EMceCmdEditList, ETrue );
       
  1021                 }
  1004             aMenuPane->SetItemDimmed( EAknCmdHelp,
  1022             aMenuPane->SetItemDimmed( EAknCmdHelp,
  1005                 !FeatureManager::FeatureSupported( KFeatureIdHelp ) );
  1023                 !FeatureManager::FeatureSupported( KFeatureIdHelp ) );
  1006 
  1024 
  1007             iMsgListContainer->MarkItemSelectionL();
  1025             iMsgListContainer->MarkItemSelectionL();
  1008             if ( !iHideExitCommand &&
  1026             if ( !iHideExitCommand &&
  1832                 //check also open               
  1850                 //check also open               
  1833                 CBaseMtmUiData* uiData = iMceUi->GetMtmUiDataL( KUidMsgMMSNotification );
  1851                 CBaseMtmUiData* uiData = iMceUi->GetMtmUiDataL( KUidMsgMMSNotification );
  1834                 // Coverty change, NULL Return, http://ousrv057/cov.cgi?cid=101800
  1852                 // Coverty change, NULL Return, http://ousrv057/cov.cgi?cid=101800
  1835                 if ( uiData )
  1853                 if ( uiData )
  1836                     {
  1854                     {
  1837                     aMenuPane->SetItemDimmed( EAknCmdOpen, 
       
  1838                      uiData->OperationSupportedL( KMtmUiFunctionOpenMessage, currentEntry ) );
       
  1839                     aMenuPane->SetItemDimmed( EMceCmdDelete, 
  1855                     aMenuPane->SetItemDimmed( EMceCmdDelete, 
  1840                      uiData->OperationSupportedL( KMtmUiFunctionDeleteMessage, currentEntry ) );
  1856                      uiData->OperationSupportedL( KMtmUiFunctionDeleteMessage, currentEntry ) );
  1841                     }                 
  1857                     }                 
  1842                 }
  1858                 }
  1843 
  1859 
  2292 // ----------------------------------------------------
  2308 // ----------------------------------------------------
  2293 // CMceMessageListView::EditMenuL
  2309 // CMceMessageListView::EditMenuL
  2294 // ----------------------------------------------------
  2310 // ----------------------------------------------------
  2295 void CMceMessageListView::EditMenuL( CEikMenuPane* aMenuPane ) const
  2311 void CMceMessageListView::EditMenuL( CEikMenuPane* aMenuPane ) const
  2296     {
  2312     {
  2297     TInt listPopulated =1;
  2313     // This function is not called if empty folder/list is yet to be populated
  2298     //Get the value, accordingly we can dim/undim mark all for one row list only
  2314     // because in that case EditMenu is hidden
  2299     if(!iCurrentListType)
       
  2300         {
       
  2301         TInt r = RProperty::Get( KPSUidMuiu, KMuiuOneRowListPopulated, listPopulated );
       
  2302         if ( r != KErrNone )
       
  2303         	{
       
  2304             User::LeaveIfError( r );
       
  2305             }
       
  2306         }
       
  2307     // This function is not called if empty folder because in that case
       
  2308     // EditMenu is hidden
       
  2309     aMenuPane->SetItemDimmed( EAknCmdMarkReadMsgs, ETrue );
  2315     aMenuPane->SetItemDimmed( EAknCmdMarkReadMsgs, ETrue );
  2310 
  2316 
  2311     TInt count = iMsgListContainer->SelectionCount();
  2317     TInt count = iMsgListContainer->SelectionCount();
  2312 
  2318 
  2313     if ( count == 0 )
  2319     if ( count == 0 )
  2324             {
  2330             {
  2325             aMenuPane->SetItemDimmed( EAknCmdMarkReadMsgs, EFalse );
  2331             aMenuPane->SetItemDimmed( EAknCmdMarkReadMsgs, EFalse );
  2326             }
  2332             }
  2327        }   
  2333        }   
  2328 
  2334 
  2329     if ( ( count + SubfolderCount() ) == iMsgListContainer->Count() || !listPopulated)
  2335     if ( ( count + SubfolderCount() ) == iMsgListContainer->Count())
  2330        {
  2336        {
  2331        //if all selected, disable markall
  2337        //if all selected, disable markall
  2332        aMenuPane->SetItemDimmed( EAknMarkAll, ETrue );
  2338        aMenuPane->SetItemDimmed( EAknMarkAll, ETrue );
  2333        } 
  2339        } 
  2334 
  2340