emailuis/emailui/src/FreestyleEmailUiMailListVisualiser.cpp
branchRCL_3
changeset 26 968773a0b6ef
parent 25 3533d4323edc
equal deleted inserted replaced
25:3533d4323edc 26:968773a0b6ef
  1278                 {
  1278                 {
  1279                 if( !iNewMailTimer->IsActive() && iNewMailTimer->iStatus != KErrInUse )
  1279                 if( !iNewMailTimer->IsActive() && iNewMailTimer->iStatus != KErrInUse )
  1280         	{
  1280         	{
  1281                     // Size sorting does not use nodes, so disable those, otherwise check from CR
  1281                     // Size sorting does not use nodes, so disable those, otherwise check from CR
  1282                     iNodesInUse = iAppUi.GetCRHandler()->TitleDividers();
  1282                     iNodesInUse = iAppUi.GetCRHandler()->TitleDividers();
  1283                     SetSortButtonTextAndIconL();
  1283                     SetSortButtonIconL();
  1284 
  1284 
  1285                     iFocusedControl = EControlBarComponent;
  1285                     iFocusedControl = EControlBarComponent;
  1286                     iMailList->SetFocusedL( EFalse );
  1286                     iMailList->SetFocusedL( EFalse );
  1287                     iControlBarControl->SetFocusByIdL( iSortButtonId );
  1287                     iControlBarControl->SetFocusByIdL( iSortButtonId );
  1288 
  1288 
  1358             }
  1358             }
  1359         }
  1359         }
  1360     
  1360     
  1361     if( aTriggeredTimer == iNewMailTimer )
  1361     if( aTriggeredTimer == iNewMailTimer )
  1362         {
  1362         {
       
  1363         if ( ! iThisViewActive ) // don't proceed if view is not active 
       
  1364             { 
       
  1365             iNewMailTimer->Stop();
       
  1366             return;
       
  1367             }
       
  1368         
  1363         TInt count = Min( KNewMailMaxBatch, iNewMailIds.Count() );
  1369         TInt count = Min( KNewMailMaxBatch, iNewMailIds.Count() );
  1364         CFSMailClient* mailClient = iAppUi.GetMailClient();
  1370         CFSMailClient* mailClient = iAppUi.GetMailClient();
  1365 
  1371 
  1366         // Enter critical section
  1372         // Enter critical section
  1367         // Because CFSMailClient::GetMessageByUidL can use CActiveSchedulerWait
  1373         // Because CFSMailClient::GetMessageByUidL can use CActiveSchedulerWait
  1378                 iNewMailTimer->iStatus = KErrNone;
  1384                 iNewMailTimer->iStatus = KErrNone;
  1379                 iNewMailTimer->Stop();
  1385                 iNewMailTimer->Stop();
  1380                 return; // leave  method
  1386                 return; // leave  method
  1381                 }
  1387                 }
  1382     
  1388     
  1383             CFSMailMessage* msgPtr = mailClient->GetMessageByUidL( iAppUi.GetActiveMailboxId(),
  1389             CFSMailMessage* msgPtr(NULL);
       
  1390             TRAPD( err, msgPtr = mailClient->GetMessageByUidL( iAppUi.GetActiveMailboxId(),
  1384                                                                iMailFolder->GetFolderId(),
  1391                                                                iMailFolder->GetFolderId(),
  1385                                                                iNewMailIds[ 0 ],
  1392                                                                iNewMailIds[ 0 ],
  1386                                                                EFSMsgDataEnvelope );
  1393                                                                EFSMsgDataEnvelope ) );
       
  1394             if ( KErrNone != err ) 
       
  1395                 {
       
  1396                 iNewMailTimer->iStatus = KErrNone;
       
  1397                 User::Leave(err);
       
  1398                 }
  1387             if ( msgPtr != NULL )
  1399             if ( msgPtr != NULL )
  1388  {
  1400  {
  1389                 __ASSERT_DEBUG( FolderId() == msgPtr->GetFolderId(), User::Invariant() );
  1401                 __ASSERT_DEBUG( FolderId() == msgPtr->GetFolderId(), User::Invariant() );
  1390                 CleanupStack::PushL( msgPtr );
  1402                 CleanupStack::PushL( msgPtr );
  1391                 //first item - show scrollbar
  1403                 //first item - show scrollbar
  1656         {
  1668         {
  1657         iAppUi.FolderList().HidePopupL();
  1669         iAppUi.FolderList().HidePopupL();
  1658         }
  1670         }
  1659     DisableMailList( EFalse );
  1671     DisableMailList( EFalse );
  1660 
  1672 
       
  1673     UpdateFolderAndMarkingModeTextsL();
       
  1674     
  1661 	// inform baseView if view entered with forward navigation
  1675 	// inform baseView if view entered with forward navigation
  1662 	TBool forwardNavigation = EFalse;
  1676 	TBool forwardNavigation = EFalse;
  1663 	if ( aCustomMessageId != KStartListReturnToPreviousFolder &&
  1677 	if ( aCustomMessageId != KStartListReturnToPreviousFolder &&
  1664 	     aCustomMessageId != TUid::Uid(KMailSettingsReturnFromPluginSettings) )
  1678 	     aCustomMessageId != TUid::Uid(KMailSettingsReturnFromPluginSettings) )
  1665 	    {
  1679 	    {
  1676     TRect clientRect = iAppUi.ClientRect();
  1690     TRect clientRect = iAppUi.ClientRect();
  1677     iScreenAnchorLayout->SetSize( clientRect.Size() );
  1691     iScreenAnchorLayout->SetSize( clientRect.Size() );
  1678     SetMailListLayoutAnchors();
  1692     SetMailListLayoutAnchors();
  1679     //if the view is already active don't update the icons so they won't "blink" 
  1693     //if the view is already active don't update the icons so they won't "blink" 
  1680     //when the view is activated.
  1694     //when the view is activated.
  1681     if(!iThisViewActive)
  1695     if(!iThisViewActive && !iMarkingMode)
  1682         {     
  1696         {     
  1683         ScaleControlBarL();
  1697         ScaleControlBarL();
  1684         
  1698         
  1685         // Set icons on toolbar
  1699         // Set icons on toolbar
  1686         iAppUi.FsTextureManager()->ClearTextureByIndex( EListControlBarMailboxDefaultIcon );
  1700         iAppUi.FsTextureManager()->ClearTextureByIndex( EListControlBarMailboxDefaultIcon );
  1856          {
  1870          {
  1857          iForceRefresh = EFalse;
  1871          iForceRefresh = EFalse;
  1858          // Set initial sort criteria when folder is changed
  1872          // Set initial sort criteria when folder is changed
  1859          iCurrentSortCriteria.iField = EFSMailSortByDate;
  1873          iCurrentSortCriteria.iField = EFSMailSortByDate;
  1860          iCurrentSortCriteria.iOrder = EFSMailDescending;
  1874          iCurrentSortCriteria.iOrder = EFSMailDescending;
  1861          SetSortButtonTextAndIconL();
  1875          SetSortButtonIconL();
  1862 
  1876 
  1863          SafeDelete(iMailFolder);
  1877          SafeDelete(iMailFolder);
  1864          TRAP_IGNORE( iMailFolder = iAppUi.GetMailClient()->GetFolderByUidL(
  1878          TRAP_IGNORE( iMailFolder = iAppUi.GetMailClient()->GetFolderByUidL(
  1865                  activationData.iMailBoxId, activationData.iFolderId ) );
  1879                  activationData.iMailBoxId, activationData.iFolderId ) );
  1866          if ( !iMailFolder )
  1880          if ( !iMailFolder )
  1871                  }
  1885                  }
  1872              // Safety, try to revert back to standard folder inbox
  1886              // Safety, try to revert back to standard folder inbox
  1873              TFSMailMsgId inboxId = iAppUi.GetActiveMailbox()->GetStandardFolderId( EFSInbox );
  1887              TFSMailMsgId inboxId = iAppUi.GetActiveMailbox()->GetStandardFolderId( EFSInbox );
  1874              iMailFolder = iAppUi.GetMailClient()->GetFolderByUidL( activationData.iMailBoxId, inboxId );
  1888              iMailFolder = iAppUi.GetMailClient()->GetFolderByUidL( activationData.iMailBoxId, inboxId );
  1875              }
  1889              }
  1876          HBufC* newFolderName = CreateFolderNameLC( iMailFolder );
       
  1877          iFolderListButton->SetTextL( *newFolderName );
       
  1878          CleanupStack::PopAndDestroy( newFolderName );
       
  1879          iMailList->SetFocusedItemL( KFsTreeNoneID );
  1890          iMailList->SetFocusedItemL( KFsTreeNoneID );
  1880          refreshState = EFullRefreshNeeded;
  1891          refreshState = EFullRefreshNeeded;
  1881          }
  1892          }
  1882 
  1893 
  1883     // Set mailbox name to status pane
  1894     // Set mailbox name to status pane
  1974 	else
  1985 	else
  1975 	    {
  1986 	    {
  1976 	    SetControlBarFocusedL();
  1987 	    SetControlBarFocusedL();
  1977 	    iControlBarControl->MakeSelectorVisible( iAppUi.IsFocusShown() );
  1988 	    iControlBarControl->MakeSelectorVisible( iAppUi.IsFocusShown() );
  1978 	    }
  1989 	    }
  1979 	UpdateButtonTextsL();
       
  1980 	FocusVisibilityChange( iAppUi.IsFocusShown() );
  1990 	FocusVisibilityChange( iAppUi.IsFocusShown() );
  1981 	iAppUi.ShowTitlePaneConnectionStatus();
  1991 	iAppUi.ShowTitlePaneConnectionStatus();
       
  1992 
       
  1993     // if timer stoped when quitting view then restart if more messages available
       
  1994     if ( iNewMailIds.Count() && ( ! iNewMailTimer->IsActive() ) && iSortState == ESortNone )
       
  1995         {
       
  1996         iNewMailTimer->Start( KNewMailTimerDelay );
       
  1997         }
       
  1998 
  1982 	TIMESTAMP( "Message list view opened" );
  1999 	TIMESTAMP( "Message list view opened" );
  1983 	}
  2000 	}  // CFSEmailUiMailListVisualiser::ChildDoActivateL
  1984 
  2001 
  1985 // ---------------------------------------------------------------------------
  2002 // ---------------------------------------------------------------------------
  1986 // Sets status bar layout
  2003 // Sets status bar layout
  1987 // ---------------------------------------------------------------------------
  2004 // ---------------------------------------------------------------------------
  1988 //
  2005 //
  2020   	    TRAP_IGNORE( {
  2037   	    TRAP_IGNORE( {
  2021             iMailList->HideListL();
  2038             iMailList->HideListL();
  2022             iMailList->SetFocusedL( EFalse );
  2039             iMailList->SetFocusedL( EFalse );
  2023   	        } );
  2040   	        } );
  2024   	    iMailTreeListVisualizer->NotifyControlVisibilityChange( EFalse );
  2041   	    iMailTreeListVisualizer->NotifyControlVisibilityChange( EFalse );
       
  2042   	    TRAP_IGNORE( UpdateFolderAndMarkingModeTextsL() );
  2025   	    }
  2043   	    }
  2026 	iThisViewActive = EFalse;
  2044 	iThisViewActive = EFalse;
  2027 	}
  2045 	}
  2028 
  2046 
  2029 // ---------------------------------------------------------------------------
  2047 // ---------------------------------------------------------------------------
  2516 //
  2534 //
  2517 // ---------------------------------------------------------------------------
  2535 // ---------------------------------------------------------------------------
  2518 //
  2536 //
  2519 void CFSEmailUiMailListVisualiser::ExitMarkingModeL()
  2537 void CFSEmailUiMailListVisualiser::ExitMarkingModeL()
  2520     {
  2538     {
  2521     FUNC_LOG;	
  2539     FUNC_LOG;
       
  2540     iMarkingMode = EFalse;    
  2522     // Hide marking mode text on the place of drop down menus
  2541     // Hide marking mode text on the place of drop down menus
  2523     RemoveMarkingModeTitleTextL();	
  2542     UpdateFolderAndMarkingModeTextsL();
  2524     iMarkingMode = EFalse;
       
  2525     UnmarkAllItemsL();
  2543     UnmarkAllItemsL();
  2526     // Change softkeys back to normal
  2544     // Change softkeys back to normal
  2527     SetViewSoftkeysL( R_FREESTYLE_EMAUIL_UI_SK_OPTIONS_BACK );
  2545     SetViewSoftkeysL( R_FREESTYLE_EMAUIL_UI_SK_OPTIONS_BACK );
  2528     // Change options menu back to normal
  2546     // Change options menu back to normal
  2529     CEikMenuBar* menu = iAppUi.CurrentActiveView()->MenuBar();
  2547     CEikMenuBar* menu = iAppUi.CurrentActiveView()->MenuBar();
  2535     iControlBarControl->SetRectL( iAppUi.LayoutHandler()->GetControlBarRect() );
  2553     iControlBarControl->SetRectL( iAppUi.LayoutHandler()->GetControlBarRect() );
  2536     iNewEmailButton->SetDimmed( EFalse );
  2554     iNewEmailButton->SetDimmed( EFalse );
  2537     iFolderListButton->SetDimmed( EFalse );   
  2555     iFolderListButton->SetDimmed( EFalse );   
  2538     iSortButton->SetDimmed( EFalse );
  2556     iSortButton->SetDimmed( EFalse );
  2539     ScaleControlBarL();
  2557     ScaleControlBarL();
       
  2558 
       
  2559     iMailTreeListVisualizer->HideList();   
       
  2560     SetMailListLayoutAnchors();
       
  2561     iMailTreeListVisualizer->ShowListL();
  2540     }
  2562     }
  2541 
  2563 
  2542 // ---------------------------------------------------------------------------
  2564 // ---------------------------------------------------------------------------
  2543 //
  2565 //
  2544 //
  2566 //
  2554     SetViewSoftkeysL( R_FREESTYLE_EMAUIL_UI_SK_OPTIONS_CANCEL );
  2576     SetViewSoftkeysL( R_FREESTYLE_EMAUIL_UI_SK_OPTIONS_CANCEL );
  2555     // Change options menu for marking mode
  2577     // Change options menu for marking mode
  2556     CEikMenuBar* menu = iAppUi.CurrentActiveView()->MenuBar();
  2578     CEikMenuBar* menu = iAppUi.CurrentActiveView()->MenuBar();
  2557     menu->StopDisplayingMenuBar();
  2579     menu->StopDisplayingMenuBar();
  2558     menu->SetMenuTitleResourceId(R_FSEMAILUI_MAILLIST_MENUBAR_MARKING_MODE);
  2580     menu->SetMenuTitleResourceId(R_FSEMAILUI_MAILLIST_MENUBAR_MARKING_MODE);
  2559     // Change background to marking mode
       
  2560     DisplayMarkingModeBgL( ETrue );       
       
  2561     // Hide drop down menu buttons
  2581     // Hide drop down menu buttons
  2562     iNewEmailButton->SetDimmed();
  2582     iNewEmailButton->SetDimmed();
  2563     iFolderListButton->SetDimmed();   
  2583     iFolderListButton->SetDimmed();   
  2564     iSortButton->SetDimmed();
  2584     iSortButton->SetDimmed();
  2565     if( !Layout_Meta_Data::IsLandscapeOrientation() )
  2585     TRect rect(0,0,0,0);
  2566         {
  2586     iControlBarControl->SetRectL( rect );
       
  2587     UpdateFolderAndMarkingModeTextsL();
       
  2588     
       
  2589     iMailTreeListVisualizer->HideList();   
       
  2590     SetMailListLayoutAnchors();
       
  2591     iMailTreeListVisualizer->ShowListL();
       
  2592     // Change background to marking mode
       
  2593     DisplayMarkingModeBgL( ETrue );    
       
  2594     }
       
  2595 
       
  2596 // ---------------------------------------------------------------------------
       
  2597 //
       
  2598 //
       
  2599 // ---------------------------------------------------------------------------
       
  2600 //
       
  2601 void CFSEmailUiMailListVisualiser::RefreshMarkingModeL()
       
  2602     {
       
  2603     FUNC_LOG;
       
  2604     if ( iMarkingMode )
       
  2605         {
       
  2606         // Hide drop down menu buttons    
  2567         TRect rect(0,0,0,0);
  2607         TRect rect(0,0,0,0);
  2568         iControlBarControl->SetRectL( rect );
  2608         iControlBarControl->SetRectL( rect );
  2569         // Display marking mode text on the place of drop down menus   
  2609         iNewEmailButton->SetDimmed();
  2570         DisplayMarkingModeTitleTextL();
  2610         iFolderListButton->SetDimmed();
  2571         }
  2611         iSortButton->SetDimmed();
  2572     }
  2612         UpdateFolderAndMarkingModeTextsL();
  2573 
  2613         }
  2574 // ---------------------------------------------------------------------------
  2614     }
  2575 //
  2615 
  2576 //
  2616 // ---------------------------------------------------------------------------
  2577 // ---------------------------------------------------------------------------
  2617 //
  2578 //
  2618 //
  2579 void CFSEmailUiMailListVisualiser::RefreshMarkingModeL()
  2619 // ---------------------------------------------------------------------------
  2580     {
  2620 //
  2581     FUNC_LOG;
  2621 void CFSEmailUiMailListVisualiser::DisplayMarkingModeTextOnButtonsL()
  2582     if ( iMarkingMode )
       
  2583         {
       
  2584         // Hide drop down menu buttons    
       
  2585         if( !Layout_Meta_Data::IsLandscapeOrientation() )
       
  2586             {
       
  2587             TRect rect(0,0,0,0);
       
  2588             iControlBarControl->SetRectL( rect );
       
  2589             DisplayMarkingModeTitleTextL();
       
  2590             }
       
  2591         else
       
  2592             {
       
  2593             iControlBarControl->SetRectL( iAppUi.LayoutHandler()->GetControlBarRect() );
       
  2594             iNewEmailButton->SetDimmed();
       
  2595             iFolderListButton->SetDimmed();
       
  2596             iSortButton->SetDimmed();
       
  2597             RemoveMarkingModeTitleTextL();
       
  2598             }
       
  2599         }
       
  2600     }
       
  2601 
       
  2602 // ---------------------------------------------------------------------------
       
  2603 //
       
  2604 //
       
  2605 // ---------------------------------------------------------------------------
       
  2606 //
       
  2607 void CFSEmailUiMailListVisualiser::DisplayMarkingModeTitleTextL()
       
  2608     {
  2622     {
  2609     FUNC_LOG;     
  2623     FUNC_LOG;     
  2610     if (!iMarkingModeTextVisual)
  2624     if (!iMarkingModeTextVisual)
  2611         {
  2625         {
  2612         const TRect sortButtonRect( iAppUi.LayoutHandler()->GetControlBarSortButtonRect() );
  2626         const TRect sortButtonRect( iAppUi.LayoutHandler()->GetControlBarSortButtonRect() );
  2640             }
  2654             }
  2641         else
  2655         else
  2642             {
  2656             {
  2643             iMarkingModeTextVisual->SetTextL( KNullDesC );
  2657             iMarkingModeTextVisual->SetTextL( KNullDesC );
  2644             }
  2658             }
  2645         }        
  2659         }
  2646     }
  2660     }
  2647 
  2661 
  2648 // ---------------------------------------------------------------------------
  2662 // ---------------------------------------------------------------------------
  2649 //
  2663 //
  2650 //
  2664 //
  2651 // ---------------------------------------------------------------------------
  2665 // ---------------------------------------------------------------------------
  2652 //
  2666 //
  2653 void CFSEmailUiMailListVisualiser::RemoveMarkingModeTitleTextL()
  2667 void CFSEmailUiMailListVisualiser::RemoveMarkingModeTextOnButtonsL()
  2654     {
  2668     {
  2655     FUNC_LOG;
  2669     FUNC_LOG;
  2656     if (iMarkingModeTextVisual)
  2670     if (iMarkingModeTextVisual)
  2657         {
  2671         {
  2658         iMarkingModeTextVisual->SetTextL( KNullDesC );
  2672         iMarkingModeTextVisual->SetTextL( KNullDesC );
  3355     if ( iFirstStartCompleted ) // Safety
  3369     if ( iFirstStartCompleted ) // Safety
  3356         {
  3370         {
  3357         if ( aType == EScreenLayoutChanged )
  3371         if ( aType == EScreenLayoutChanged )
  3358         	{
  3372         	{
  3359             SetStatusBarLayout();
  3373             SetStatusBarLayout();
  3360             UpdateButtonTextsL();
       
  3361         	}
  3374         	}
  3362 
  3375 
  3363         if ( aType == ESkinChanged )
  3376         if ( aType == ESkinChanged )
  3364             {
  3377             {
  3365             UpdateThemeL();
  3378             UpdateThemeL();
  3392             }
  3405             }
  3393         }
  3406         }
  3394     if (iMarkingMode)
  3407     if (iMarkingMode)
  3395         {
  3408         {
  3396         RefreshMarkingModeL();
  3409         RefreshMarkingModeL();
  3397         }    
  3410         }
       
  3411     UpdateFolderAndMarkingModeTextsL();
  3398 	}
  3412 	}
  3399 
  3413 
  3400 // ---------------------------------------------------------------------------
  3414 // ---------------------------------------------------------------------------
  3401 //
  3415 //
  3402 //
  3416 //
  3408     FUNC_LOG;
  3422     FUNC_LOG;
  3409     CFsEmailUiViewBase::HandleDynamicVariantSwitchOnBackgroundL( aType );
  3423     CFsEmailUiViewBase::HandleDynamicVariantSwitchOnBackgroundL( aType );
  3410     if ( aType == ESkinChanged )
  3424     if ( aType == ESkinChanged )
  3411         {
  3425         {
  3412         UpdateThemeL();
  3426         UpdateThemeL();
  3413         }
       
  3414     else if ( aType == EScreenLayoutChanged )
       
  3415         {
       
  3416         UpdateButtonTextsL();
       
  3417         }
       
  3418     }
       
  3419 
       
  3420 // ---------------------------------------------------------------------------
       
  3421 // Update texts for command area buttons
       
  3422 // ---------------------------------------------------------------------------
       
  3423 //
       
  3424 void CFSEmailUiMailListVisualiser::UpdateButtonTextsL()
       
  3425     {
       
  3426     if ( !Layout_Meta_Data::IsLandscapeOrientation() )
       
  3427         {
       
  3428         // No texts in portrait mode
       
  3429         iNewEmailButton->SetTextL( KNullDesC() );
       
  3430         iSortButton->SetTextL( KNullDesC() );
       
  3431         }
       
  3432     else
       
  3433         {
       
  3434         // Set button text if necessary
       
  3435         HBufC* buttonText = GetSortButtonTextLC();
       
  3436         if ( buttonText )
       
  3437             {
       
  3438             iSortButton->SetTextL( *buttonText );
       
  3439             CleanupStack::PopAndDestroy( buttonText );
       
  3440             }
       
  3441 
       
  3442         iNewEmailButton->SetTextL( *iNewEmailText );
       
  3443         }
  3427         }
  3444     }
  3428     }
  3445 
  3429 
  3446 // ---------------------------------------------------------------------------
  3430 // ---------------------------------------------------------------------------
  3447 //
  3431 //
  3949     	   aCommand == EFsEmailUiCmdMarkAsUnread ||
  3933     	   aCommand == EFsEmailUiCmdMarkAsUnread ||
  3950     	   aCommand == EFsEmailUiCmdActionsMove ||
  3934     	   aCommand == EFsEmailUiCmdActionsMove ||
  3951     	   aCommand == EFsEmailUiCmdActionsMoveMessage ||
  3935     	   aCommand == EFsEmailUiCmdActionsMoveMessage ||
  3952     	   aCommand == EFsEmailUiCmdMarkingModeFromPopUp ||
  3936     	   aCommand == EFsEmailUiCmdMarkingModeFromPopUp ||
  3953     	   aCommand == EFsEmailUiCmdActionsCollapseAll ||
  3937     	   aCommand == EFsEmailUiCmdActionsCollapseAll ||
  3954     	   aCommand == EFsEmailUiCmdActionsExpandAll ) )
  3938     	   aCommand == EFsEmailUiCmdActionsExpandAll ||
       
  3939            aCommand == EFsEmailUiCmdActionsFlag ) )
  3955     	{
  3940     	{
  3956    		// We end up here if the user selects an option from the pop up menu
  3941    		// We end up here if the user selects an option from the pop up menu
  3957     	// or exits the menu by tapping outside of it's area.
  3942     	// or exits the menu by tapping outside of it's area.
  3958     	// Remove the focus from a list item if an item is focused.
  3943     	// Remove the focus from a list item if an item is focused.
  3959     	iStylusPopUpMenuVisible = EFalse;
  3944     	iStylusPopUpMenuVisible = EFalse;
  4646             {
  4631             {
  4647             // If destination folder is not set, it needs to be asked messages are moved after callbak
  4632             // If destination folder is not set, it needs to be asked messages are moved after callbak
  4648             if ( aDestinationFolderId.IsNullId() )
  4633             if ( aDestinationFolderId.IsNullId() )
  4649                 {
  4634                 {
  4650                 // Activate folder selection view and handle moving after callback gets destination
  4635                 // Activate folder selection view and handle moving after callback gets destination
  4651                 RemoveMarkingModeTitleTextL();    
       
  4652                 iMoveToFolderOngoing = ETrue;
  4636                 iMoveToFolderOngoing = ETrue;
  4653                 TFolderListActivationData folderListData;
  4637                 TFolderListActivationData folderListData;
  4654                 folderListData.iCallback = this;
  4638                 folderListData.iCallback = this;
  4655                 if(iMailFolder) // Coverity error fix , assuming that inbox is best bet for safe data. 
  4639                 if(iMailFolder) // Coverity error fix , assuming that inbox is best bet for safe data. 
  4656                     {
  4640                     {
  5919     TAlfAlignHorizontal horizontalAlign = EAlfAlignHLeft;
  5903     TAlfAlignHorizontal horizontalAlign = EAlfAlignHLeft;
  5920     if ( AknLayoutUtils::LayoutMirrored() )
  5904     if ( AknLayoutUtils::LayoutMirrored() )
  5921         {
  5905         {
  5922         horizontalAlign = EAlfAlignHRight;
  5906         horizontalAlign = EAlfAlignHRight;
  5923         }
  5907         }
  5924 
       
  5925     // Icons and sort button text
  5908     // Icons and sort button text
  5926     iFolderListButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( EListControlBarMailboxDefaultIcon ) );
  5909     iFolderListButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( EListControlBarMailboxDefaultIcon ) );
  5927     iNewEmailButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( EListTextureCreateNewMessageIcon ) );
  5910     iNewEmailButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( EListTextureCreateNewMessageIcon ) );
  5928     SetSortButtonTextAndIconL();
  5911     SetSortButtonIconL();
  5929 
  5912 
  5930     iNewEmailButton->SetElemAlignL(
  5913     iNewEmailButton->SetElemAlignL(
  5931         ECBElemIconA,
  5914         ECBElemIconA,
  5932         EAlfAlignHCenter,
  5915         EAlfAlignHCenter,
  5933         EAlfAlignVCenter );
  5916         EAlfAlignVCenter );
  6009 // ---------------------------------------------------------------------------
  5992 // ---------------------------------------------------------------------------
  6010 //
  5993 //
  6011 //
  5994 //
  6012 // ---------------------------------------------------------------------------
  5995 // ---------------------------------------------------------------------------
  6013 //
  5996 //
  6014 void CFSEmailUiMailListVisualiser::SetSortButtonTextAndIconL()
  5997 void CFSEmailUiMailListVisualiser::SetSortButtonIconL()
  6015 	{
  5998 	{
  6016     FUNC_LOG;
  5999     FUNC_LOG;
  6017 
       
  6018     // Set button text if necessary
       
  6019     HBufC* buttonText = GetSortButtonTextLC();
       
  6020 
       
  6021 	if ( !Layout_Meta_Data::IsLandscapeOrientation() )
       
  6022 		{
       
  6023 		if ( buttonText )
       
  6024 			{
       
  6025 			buttonText->Des().Zero();
       
  6026 			}
       
  6027 		}
       
  6028 
       
  6029 	if ( buttonText )
       
  6030 		{
       
  6031 		iSortButton->SetTextL( *buttonText );
       
  6032 		}
       
  6033 	CleanupStack::PopAndDestroy( buttonText );
       
  6034 
       
  6035 	iSortButton->SetIconL(
  6000 	iSortButton->SetIconL(
  6036 			iAppUi.FsTextureManager()->TextureByIndex( GetSortButtonTextureIndex() ),
  6001 			iAppUi.FsTextureManager()->TextureByIndex( GetSortButtonTextureIndex() ),
  6037 			ECBElemIconA );
  6002 			ECBElemIconA );
  6038 
  6003 
  6039 	}
  6004 	}
  6191     iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 0,
  6156     iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 0,
  6192         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
  6157         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
  6193         EAlfAnchorMetricRelativeToSize, EAlfAnchorMetricAbsolute,
  6158         EAlfAnchorMetricRelativeToSize, EAlfAnchorMetricAbsolute,
  6194         TAlfTimedPoint(1, iAppUi.LayoutHandler()->ControlBarHeight() ));
  6159         TAlfTimedPoint(1, iAppUi.LayoutHandler()->ControlBarHeight() ));
  6195 
  6160 
  6196     // <cmail> Platform layout changes
       
  6197     TRect listRect = iAppUi.LayoutHandler()->GetListRect();
  6161     TRect listRect = iAppUi.LayoutHandler()->GetListRect();
  6198 	// Set anchors so that list leaves space for control bar
  6162 	// Set anchors so that list leaves space for control bar
  6199     if( Layout_Meta_Data::IsMirrored() ) 
  6163     if( Layout_Meta_Data::IsMirrored() ) 
  6200         { 
  6164         { 
  6201         TInt tlX = listRect.iTl.iX; 
  6165         TInt tlX = listRect.iTl.iX; 
  6206         } 
  6170         } 
  6207     iScreenAnchorLayout->SetAnchor(EAlfAnchorTopLeft, 1,
  6171     iScreenAnchorLayout->SetAnchor(EAlfAnchorTopLeft, 1,
  6208         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
  6172         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
  6209         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
  6173         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
  6210         TAlfTimedPoint(listRect.iTl.iX, listRect.iTl.iY));
  6174         TAlfTimedPoint(listRect.iTl.iX, listRect.iTl.iY));
  6211     iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 1,
  6175     
  6212         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
  6176     if (iMarkingMode && Layout_Meta_Data::IsLandscapeOrientation())
  6213         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
  6177         {
  6214         TAlfTimedPoint(listRect.iBr.iX, listRect.iBr.iY));
  6178         iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 1,
  6215     // </cmail> Platform layout changes
  6179                 EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  6180                 EAlfAnchorMetricRelativeToSize, EAlfAnchorMetricAbsolute,
       
  6181                 TAlfTimedPoint(1, listRect.iBr.iY));
       
  6182         }
       
  6183     else
       
  6184         {
       
  6185         iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 1,
       
  6186                 EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
       
  6187                 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
       
  6188                 TAlfTimedPoint(listRect.iBr.iX, listRect.iBr.iY));    
       
  6189         }
  6216 
  6190 
  6217  	// Set anchors for connection icon
  6191  	// Set anchors for connection icon
  6218 
       
  6219     // <cmail> Platform layout changes
       
  6220     TRect connectionIconRect( iAppUi.LayoutHandler()->GetControlBarConnectionIconRect() );
  6192     TRect connectionIconRect( iAppUi.LayoutHandler()->GetControlBarConnectionIconRect() );
  6221     const TPoint& tl( connectionIconRect.iTl );
  6193     const TPoint& tl( connectionIconRect.iTl );
  6222  	iScreenAnchorLayout->SetAnchor(EAlfAnchorTopLeft, 2,
  6194  	iScreenAnchorLayout->SetAnchor(EAlfAnchorTopLeft, 2,
  6223         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
  6195         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
  6224         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
  6196         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
  6226     const TPoint& br( connectionIconRect.iBr );
  6198     const TPoint& br( connectionIconRect.iBr );
  6227     iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 2,
  6199     iScreenAnchorLayout->SetAnchor(EAlfAnchorBottomRight, 2,
  6228         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
  6200         EAlfAnchorOriginLeft, EAlfAnchorOriginTop,
  6229         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
  6201         EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute,
  6230         TAlfTimedPoint( br.iX, br.iY ));
  6202         TAlfTimedPoint( br.iX, br.iY ));
  6231     // </cmail> Platform layout changes
       
  6232 
  6203 
  6233     iScreenAnchorLayout->UpdateChildrenLayout();
  6204     iScreenAnchorLayout->UpdateChildrenLayout();
  6234     }
  6205     }
  6235 
  6206 
  6236 // ---------------------------------------------------------------------------
  6207 // ---------------------------------------------------------------------------
  7128 		{
  7099 		{
  7129 		iMoveToFolderOngoing = EFalse;
  7100 		iMoveToFolderOngoing = EFalse;
  7130 		switch ( aResponse )
  7101 		switch ( aResponse )
  7131 			{
  7102 			{
  7132 			case EFSEmailUiCtrlBarResponseCancel:
  7103 			case EFSEmailUiCtrlBarResponseCancel:
  7133 			    if ( iMarkingMode )
       
  7134 			        {
       
  7135                     DisplayMarkingModeTitleTextL();
       
  7136 			        }
       
  7137 			    iMarkingModeWaitingToExit = EFalse;
  7104 			    iMarkingModeWaitingToExit = EFalse;
  7138 			    SetMskL();
  7105 			    SetMskL();
  7139 				return;
  7106 				return;
  7140 			case EFSEmailUiCtrlBarResponseSelect:
  7107 			case EFSEmailUiCtrlBarResponseSelect:
  7141 			    {
  7108 			    {
  7175 				}
  7142 				}
  7176 				return;
  7143 				return;
  7177 			case EFSEmailUiCtrlBarResponseCancel:
  7144 			case EFSEmailUiCtrlBarResponseCancel:
  7178 			    iMarkingModeWaitingToExit = EFalse;
  7145 			    iMarkingModeWaitingToExit = EFalse;
  7179 			    SetMskL();
  7146 			    SetMskL();
  7180 			    // <cmail> Touch
       
  7181                 //Set touchmanager back to active
  7147                 //Set touchmanager back to active
  7182                 DisableMailList(EFalse);
  7148                 DisableMailList(EFalse);
  7183                 // </cmail>
       
  7184 				return;
  7149 				return;
  7185 			case EFSEmailUiCtrlBarResponseSelect:
  7150 			case EFSEmailUiCtrlBarResponseSelect:
  7186 			    SetMskL();
  7151 			    SetMskL();
  7187 			    // <cmail> Touch
       
  7188                 //Set touchmanager back to active
  7152                 //Set touchmanager back to active
  7189                 DisableMailList(EFalse);
  7153                 DisableMailList(EFalse);
  7190                 // </cmail>
       
  7191 			default:
  7154 			default:
  7192 				break;
  7155 				break;
  7193 			}
  7156 			}
  7194 
  7157 
  7195 		if ( !iMailFolder || ( iMailFolder && iMailFolder->GetFolderId() != aSelectedFolderId ) )
  7158 		if ( !iMailFolder || ( iMailFolder && iMailFolder->GetFolderId() != aSelectedFolderId ) )
  7204                 {
  7167                 {
  7205                 // Do nothing if can't get the folder object
  7168                 // Do nothing if can't get the folder object
  7206                 return;
  7169                 return;
  7207                 }
  7170                 }
  7208 
  7171 
  7209             // Set new text to folder button in control bar
  7172             UpdateFolderAndMarkingModeTextsL();
  7210             HBufC* newFolderName = CreateFolderNameLC( iMailFolder );
       
  7211             iFolderListButton->SetTextL( *newFolderName );
       
  7212             CleanupStack::PopAndDestroy( newFolderName );
       
  7213 
  7173 
  7214             // Set initial sort criteria when folder has changed
  7174             // Set initial sort criteria when folder has changed
  7215             iCurrentSortCriteria.iField = EFSMailSortByDate;
  7175             iCurrentSortCriteria.iField = EFSMailSortByDate;
  7216             iCurrentSortCriteria.iOrder = EFSMailDescending;
  7176             iCurrentSortCriteria.iOrder = EFSMailDescending;
  7217             // reload node state because in file sort mode this is disabled even when globally enabled
  7177             // reload node state because in file sort mode this is disabled even when globally enabled
  7218             iNodesInUse = iAppUi.GetCRHandler()->TitleDividers();
  7178             iNodesInUse = iAppUi.GetCRHandler()->TitleDividers();
  7219             SetSortButtonTextAndIconL();
  7179             SetSortButtonIconL();
  7220 
  7180 
  7221             // Update the mail list contents
  7181             // Update the mail list contents
  7222             UpdateMailListModelL();
  7182             UpdateMailListModelL();
  7223             RefreshL();
  7183             RefreshL();
  7224 		    }
  7184 		    }
  7248 	// Set initial sort criteria when folder has changed
  7208 	// Set initial sort criteria when folder has changed
  7249     iCurrentSortCriteria.iField = EFSMailSortByDate;
  7209     iCurrentSortCriteria.iField = EFSMailSortByDate;
  7250     iCurrentSortCriteria.iOrder = EFSMailDescending;
  7210     iCurrentSortCriteria.iOrder = EFSMailDescending;
  7251     // reload node state because in file sort mode this is disabled even when globally enabled
  7211     // reload node state because in file sort mode this is disabled even when globally enabled
  7252     iNodesInUse = iAppUi.GetCRHandler()->TitleDividers();
  7212     iNodesInUse = iAppUi.GetCRHandler()->TitleDividers();
  7253     SetSortButtonTextAndIconL();
  7213     SetSortButtonIconL();
  7254 
  7214 
  7255     // Set folder name to the control bar button
  7215     // Set folder name to the control bar button
  7256     HBufC* newFolderName = CreateFolderNameLC( iMailFolder );
  7216     UpdateFolderAndMarkingModeTextsL();
  7257     iFolderListButton->SetTextL( *newFolderName );
       
  7258     CleanupStack::PopAndDestroy( newFolderName );
       
  7259 
  7217 
  7260     // Set mailbox name and icons
  7218     // Set mailbox name and icons
  7261     SetMailboxNameToStatusPaneL();
  7219     SetMailboxNameToStatusPaneL();
  7262     SetBrandedListWatermarkL();
  7220     SetBrandedListWatermarkL();
  7263     SetBrandedMailBoxIconL();
  7221     SetBrandedMailBoxIconL();
  7749 						if ( !inboxId.IsNullId() )
  7707 						if ( !inboxId.IsNullId() )
  7750 						    {
  7708 						    {
  7751 						    iMailFolder = iAppUi.GetMailClient()->GetFolderByUidL( aMailboxId, inboxId );
  7709 						    iMailFolder = iAppUi.GetMailClient()->GetFolderByUidL( aMailboxId, inboxId );
  7752 						    UpdateMailListModelL();
  7710 						    UpdateMailListModelL();
  7753 					        RefreshL();
  7711 					        RefreshL();
  7754 							HBufC* newFolderName = CreateFolderNameLC( iMailFolder );
  7712 						    UpdateFolderAndMarkingModeTextsL();
  7755 						    iFolderListButton->SetTextL( *newFolderName );
       
  7756 							CleanupStack::PopAndDestroy( newFolderName );
       
  7757 						    }
  7713 						    }
  7758 						else
  7714 						else
  7759 							{
  7715 							{
  7760 							// No standard folder inbox, go back to grid as a last option
  7716 							// No standard folder inbox, go back to grid as a last option
  7761 							HandleCommandL( EAknSoftkeyBack );
  7717 							HandleCommandL( EAknSoftkeyBack );
  7806 				    {
  7762 				    {
  7807 				    iMailFolder = iAppUi.GetMailClient()->GetFolderByUidL( aMailboxId, inboxId );
  7763 				    iMailFolder = iAppUi.GetMailClient()->GetFolderByUidL( aMailboxId, inboxId );
  7808 				    // Check that mailfolder fetching succeeded
  7764 				    // Check that mailfolder fetching succeeded
  7809 				    if ( iMailFolder )
  7765 				    if ( iMailFolder )
  7810 				    	{
  7766 				    	{
  7811 						HBufC* newFolderName = CreateFolderNameLC( iMailFolder );
  7767 					    UpdateFolderAndMarkingModeTextsL();
  7812 					    iFolderListButton->SetTextL( *newFolderName );
       
  7813 						CleanupStack::PopAndDestroy( newFolderName );
       
  7814 				    	}
  7768 				    	}
  7815 				    }
  7769 				    }
  7816 				}
  7770 				}
  7817 			// Null pointer check is needed here because of special cases such as new mail
  7771 			// Null pointer check is needed here because of special cases such as new mail
  7818 			// creation in POP/IMAP before first sync where folder does not exists
  7772 			// creation in POP/IMAP before first sync where folder does not exists
  8400         }
  8354         }
  8401     }
  8355     }
  8402 
  8356 
  8403 void CFSEmailUiMailListVisualiser::GetParentLayoutsL( RPointerArray<CAlfVisual>& aLayoutArray ) const
  8357 void CFSEmailUiMailListVisualiser::GetParentLayoutsL( RPointerArray<CAlfVisual>& aLayoutArray ) const
  8404     {
  8358     {
  8405     aLayoutArray.AppendL( iScreenAnchorLayout );
  8359     if ( iScreenAnchorLayout )
  8406     aLayoutArray.AppendL( iControlBarControl->Visual() );
  8360         {
       
  8361         aLayoutArray.AppendL( iScreenAnchorLayout );
       
  8362         }
       
  8363     if ( iControlBarControl )
       
  8364         {
       
  8365         aLayoutArray.AppendL( iControlBarControl->Visual() );
       
  8366         }
  8407     }
  8367     }
  8408 
  8368 
  8409 // hide or show CAlfVisuals ( used for activation or deactivation )
  8369 // hide or show CAlfVisuals ( used for activation or deactivation )
  8410 void CFSEmailUiMailListVisualiser::FadeOut(TBool aDirectionOut)
  8370 void CFSEmailUiMailListVisualiser::FadeOut(TBool aDirectionOut)
  8411 	{
  8371 	{
  8470             manualSync = extension->IsSetL(EmailSyncInterval);
  8430             manualSync = extension->IsSetL(EmailSyncInterval);
  8471             box->ReleaseExtension(extension);
  8431             box->ReleaseExtension(extension);
  8472             }
  8432             }
  8473         }
  8433         }
  8474     return manualSync;
  8434     return manualSync;
       
  8435     }
       
  8436 
       
  8437 
       
  8438 void CFSEmailUiMailListVisualiser::UpdateFolderAndMarkingModeTextsL()
       
  8439     {
       
  8440     if ( iAppUi.CurrentActiveView()->Id() == MailListId )
       
  8441         {
       
  8442         HBufC* folder = CreateFolderNameLC( iMailFolder );
       
  8443         if( Layout_Meta_Data::IsLandscapeOrientation() )
       
  8444             {
       
  8445             iFolderListButton->SetTextL( KNullDesC );
       
  8446             if (iMarkingMode)
       
  8447                 {
       
  8448                 RemoveMarkingModeTextOnButtonsL();
       
  8449                 HBufC* txt = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MARKINGMODE );
       
  8450                 iAppUi.SetNaviPaneTextL( *txt );
       
  8451                 CleanupStack::PopAndDestroy( txt );
       
  8452                 }
       
  8453             else
       
  8454                 {
       
  8455                 iAppUi.SetNaviPaneTextL( *folder );
       
  8456                 }
       
  8457             }
       
  8458         else // Portrait orientation
       
  8459             {
       
  8460             iAppUi.SetNaviPaneTextL( KNullDesC );        
       
  8461             if (iMarkingMode)
       
  8462                 {
       
  8463                 DisplayMarkingModeTextOnButtonsL();
       
  8464                 }
       
  8465             else
       
  8466                 {
       
  8467                 RemoveMarkingModeTextOnButtonsL();
       
  8468                 iFolderListButton->SetTextL( *folder );
       
  8469                 }        
       
  8470             }
       
  8471         CleanupStack::PopAndDestroy( folder );
       
  8472         }
       
  8473     else
       
  8474         {
       
  8475         iAppUi.SetNaviPaneTextL( KNullDesC );
       
  8476         RemoveMarkingModeTextOnButtonsL();
       
  8477         }
  8475     }
  8478     }
  8476 
  8479 
  8477 //////////////////////////////////////////////////////////////////
  8480 //////////////////////////////////////////////////////////////////
  8478 // Class implementation CMailListUpdater
  8481 // Class implementation CMailListUpdater
  8479 ///////////////////////////////////////////////////////////////////
  8482 ///////////////////////////////////////////////////////////////////