emailuis/emailui/src/FreestyleEmailUiMailListVisualiser.cpp
branchRCL_3
changeset 16 b5fbb9b25d57
parent 14 b13141f05c3d
child 17 67369d1b217f
equal deleted inserted replaced
14:b13141f05c3d 16:b5fbb9b25d57
   554 // ---------------------------------------------------------------------------
   554 // ---------------------------------------------------------------------------
   555 //
   555 //
   556 CFSEmailUiMailListVisualiser::~CFSEmailUiMailListVisualiser()
   556 CFSEmailUiMailListVisualiser::~CFSEmailUiMailListVisualiser()
   557     {
   557     {
   558     FUNC_LOG;
   558     FUNC_LOG;
       
   559 /*
   559     if (iExtension)
   560     if (iExtension)
   560         {
   561         {
   561         iAppUi.GetMailClient()->ReleaseExtension(iExtension);
   562         iAppUi.GetMailClient()->ReleaseExtension(iExtension);
   562         }
   563         }
       
   564 */
   563     SafeDelete(iMailListModelUpdater);
   565     SafeDelete(iMailListModelUpdater);
   564     SafeDelete(iMailFolder);
   566     SafeDelete(iMailFolder);
   565     delete iTouchManager;
   567     delete iTouchManager;
   566     delete iStylusPopUpMenu;
   568     delete iStylusPopUpMenu;
   567     delete iMailList;
   569     delete iMailList;
  1368 
  1370 
  1369     // Set control bar and list layout size always in activation
  1371     // Set control bar and list layout size always in activation
  1370     TRect clientRect = iAppUi.ClientRect();
  1372     TRect clientRect = iAppUi.ClientRect();
  1371     iScreenAnchorLayout->SetSize( clientRect.Size() );
  1373     iScreenAnchorLayout->SetSize( clientRect.Size() );
  1372     SetMailListLayoutAnchors();
  1374     SetMailListLayoutAnchors();
  1373     ScaleControlBarL();
  1375     //if the view is already active don't update the icons so they won't "blink" 
  1374     SetListAndCtrlBarFocusL();
  1376     //when the view is activated.
  1375 
  1377     if(!iThisViewActive)
       
  1378         { 
       
  1379         ScaleControlBarL();
       
  1380         SetListAndCtrlBarFocusL();
       
  1381         }
       
  1382 
       
  1383 	FadeOut(EFalse); // we can show now CAlfVisuals from CurrentView (to show Folders before updating emails)
       
  1384     
  1376 	// Update mail list settings and date formats, is done every time
  1385 	// Update mail list settings and date formats, is done every time
  1377 	// the user might have changed these in settings, so the list needs to refresh
  1386 	// the user might have changed these in settings, so the list needs to refresh
  1378 	// Store previous modes
  1387 	// Store previous modes
  1379 	TInt prevListMode = iListMode;
  1388 	TInt prevListMode = iListMode;
  1380 	TInt prevNodesmode = iNodesInUse;
  1389 	TInt prevNodesmode = iNodesInUse;
  1385     CAknEnv::Static()->GetCurrentGlobalUiZoom( iCurrentZoomLevel );
  1394     CAknEnv::Static()->GetCurrentGlobalUiZoom( iCurrentZoomLevel );
  1386 	UpdateMailListSettingsL();
  1395 	UpdateMailListSettingsL();
  1387 	UpdateMailListTimeDateSettings();
  1396 	UpdateMailListTimeDateSettings();
  1388 
  1397 
  1389 	// Check for changed settings, in that case a complete list refresh is needed
  1398 	// Check for changed settings, in that case a complete list refresh is needed
  1390 	TBool refreshNeeded(EFalse);
  1399 	TRefreshState refreshState = ERefreshNone;
  1391 	if ( aCustomMessageId == KStartListWithFolderIdFromHomeScreen
  1400 	if (aCustomMessageId == KStartListWithFolderIdFromHomeScreen)
  1392 	     || iSkinChanged
  1401 	    {
       
  1402             refreshState = EFocusChangeNeeded;
       
  1403 	    }
       
  1404 	
       
  1405 	if ( iSkinChanged
  1393 	     || iDateChanged
  1406 	     || iDateChanged
  1394 	     || iListMode != prevListMode
  1407 	     || iListMode != prevListMode
  1395 		 || iNodesInUse != prevNodesmode
  1408 		 || iNodesInUse != prevNodesmode
  1396 		 || iCurrentZoomLevel != prevZoomLevel
  1409 		 || iCurrentZoomLevel != prevZoomLevel
  1397 		 || prevDateFormats.iDateFormat != iDateFormats.iDateFormat
  1410 		 || prevDateFormats.iDateFormat != iDateFormats.iDateFormat
  1398 		 || prevDateFormats.iTimeFormat != iDateFormats.iTimeFormat
  1411 		 || prevDateFormats.iTimeFormat != iDateFormats.iTimeFormat
  1399 		 || prevDateFormats.iAmPmPosition != iDateFormats.iAmPmPosition
  1412 		 || prevDateFormats.iAmPmPosition != iDateFormats.iAmPmPosition
  1400 		 || prevDateFormats.iDateSeparator.GetNumericValue() != iDateFormats.iDateSeparator.GetNumericValue()
  1413 		 || prevDateFormats.iDateSeparator.GetNumericValue() != iDateFormats.iDateSeparator.GetNumericValue()
  1401 		 || prevDateFormats.iTimeSeparator.GetNumericValue() != iDateFormats.iTimeSeparator.GetNumericValue() )
  1414 		 || prevDateFormats.iTimeSeparator.GetNumericValue() != iDateFormats.iTimeSeparator.GetNumericValue() )
  1402 		{
  1415 		{
  1403 		refreshNeeded = ETrue;
  1416         refreshState = EFullRefreshNeeded;
  1404 		iSkinChanged = EFalse;
  1417 		iSkinChanged = EFalse;
  1405 		iDateChanged = EFalse;
  1418 		iDateChanged = EFalse;
  1406 		}
  1419 		}
  1407 
  1420 
  1408 	// Store previously used mailbox and folder IDs
  1421 	// Store previously used mailbox and folder IDs
  1541              }
  1554              }
  1542          HBufC* newFolderName = CreateFolderNameLC( iMailFolder );
  1555          HBufC* newFolderName = CreateFolderNameLC( iMailFolder );
  1543          iFolderListButton->SetTextL( *newFolderName );
  1556          iFolderListButton->SetTextL( *newFolderName );
  1544          CleanupStack::PopAndDestroy( newFolderName );
  1557          CleanupStack::PopAndDestroy( newFolderName );
  1545          iMailList->SetFocusedItemL( KFsTreeNoneID );
  1558          iMailList->SetFocusedItemL( KFsTreeNoneID );
  1546          refreshNeeded = ETrue;
  1559          refreshState = EFullRefreshNeeded;
  1547          }
  1560          }
  1548 
  1561 
  1549     // Set mailbox name to status pane
  1562     // Set mailbox name to status pane
  1550     SetMailboxNameToStatusPaneL();
  1563     SetMailboxNameToStatusPaneL();
  1551 
  1564 
  1555 
  1568 
  1556     // Check sync icon timer and sync status
  1569     // Check sync icon timer and sync status
  1557     ConnectionIconHandling();
  1570     ConnectionIconHandling();
  1558 
  1571 
  1559     // REBUILD TREE LIST IF NECESSARY
  1572     // REBUILD TREE LIST IF NECESSARY
  1560     if ( refreshNeeded )
  1573     if ( refreshState == EFullRefreshNeeded )
  1561         {
  1574         {
  1562         // Try to maintain previously active item if possible.
  1575         // Try to maintain previously active item if possible.
  1563         // This is of course not possible if folder has changed.
  1576         // This is of course not possible if folder has changed.
  1564         TFSMailMsgId focused = MsgIdFromListId( iMailList->FocusedItem() );
  1577         TFSMailMsgId focused = MsgIdFromListId( iMailList->FocusedItem() );
  1565 
  1578 
  1578             }
  1591             }
  1579         else
  1592         else
  1580             {
  1593             {
  1581             UpdateMailListModelAsyncL();
  1594             UpdateMailListModelAsyncL();
  1582             }
  1595             }
       
  1596         }
       
  1597     else if(refreshState == EFocusChangeNeeded)
       
  1598         {//Move focus to the beginning of the list
       
  1599         TInt firstIndex(0);
       
  1600         TFsTreeItemId firstItemId = iMailList->Child( KFsTreeRootID, firstIndex );
       
  1601         iMailTreeListVisualizer->SetFocusedItemL( firstItemId, EFalse );
       
  1602         //if the view is already active don't update the list so it won't "blink" 
       
  1603         //when the view is activated.
       
  1604         if(!iThisViewActive)
       
  1605           {
       
  1606             iMailList->ShowListL();
       
  1607           }
  1583         }
  1608         }
  1584     // THE CORRECT FOLDER IS ALREADY OPEN. CHECK IF SOME PARTIAL UPDATE IS NEEDED.
  1609     // THE CORRECT FOLDER IS ALREADY OPEN. CHECK IF SOME PARTIAL UPDATE IS NEEDED.
  1585     else
  1610     else
  1586         {
  1611         {
  1587         iMailList->ShowListL();
  1612         iMailList->ShowListL();
  1671             iMailList->SetFocusedL( EFalse );
  1696             iMailList->SetFocusedL( EFalse );
  1672   	        } );
  1697   	        } );
  1673   	    iMailTreeListVisualizer->NotifyControlVisibilityChange( EFalse );
  1698   	    iMailTreeListVisualizer->NotifyControlVisibilityChange( EFalse );
  1674   	    }
  1699   	    }
  1675 	iThisViewActive = EFalse;
  1700 	iThisViewActive = EFalse;
       
  1701 	FadeOut(ETrue);  // hide CAlfVisuals on deactivation
  1676 	}
  1702 	}
  1677 
  1703 
  1678 // ---------------------------------------------------------------------------
  1704 // ---------------------------------------------------------------------------
  1679 //
  1705 //
  1680 //
  1706 //
  1778 	    }
  1804 	    }
  1779 	
  1805 	
  1780     // MAIN MENU ***************************************************************************
  1806     // MAIN MENU ***************************************************************************
  1781 	if ( aResourceId == R_FSEMAILUI_MAILLIST_MENUPANE )
  1807 	if ( aResourceId == R_FSEMAILUI_MAILLIST_MENUPANE )
  1782 	    {
  1808 	    {
  1783             // Sync/cancel sync
       
  1784 	    CFSMailBox* activeMailbox = iAppUi.GetActiveMailbox();
       
  1785 	    TBool supportsSync = activeMailbox->HasCapability( EFSMBoxCapaSupportsSync );
       
  1786         TFSMailBoxStatus onlineStatus = activeMailbox->GetMailBoxStatus();
       
  1787          if ( onlineStatus == EFSMailBoxOnline && 
       
  1788 		      KIpsPlgImap4PluginUid == activeMailbox->GetId().PluginId() )
       
  1789         	{
       
  1790             aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, ETrue );
       
  1791         	}
       
  1792 
       
  1793             // flag to hide or show SyncButton
       
  1794             TBool hideSync = GetLatestSyncState();
       
  1795             if(activeMailbox->CurrentSyncState()==StartingSync) hideSync=EFalse;
       
  1796 
       
  1797             // hide or show options: Sync/cancel sync
       
  1798         if ( !supportsSync )
       
  1799         {
       
  1800 				// POP3 behaviour
       
  1801 				if( onlineStatus == EFSMailBoxOnline || iMailListModelUpdater->IsUpdating() )
       
  1802 				  {
       
  1803 					aMenuPane->SetItemDimmed( EFsEmailUiCmdCancelSync, EFalse );
       
  1804 					aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, ETrue );
       
  1805 				  }
       
  1806 				else
       
  1807 					{
       
  1808 					aMenuPane->SetItemDimmed( EFsEmailUiCmdCancelSync, ETrue );
       
  1809 					aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, EFalse );
       
  1810 					}
       
  1811         }
       
  1812       else if ( hideSync || iMailListModelUpdater->IsUpdating() )
       
  1813         {
       
  1814         aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, ETrue );
       
  1815         }
       
  1816       else
       
  1817         {
       
  1818         aMenuPane->SetItemDimmed( EFsEmailUiCmdCancelSync, ETrue );
       
  1819         }
       
  1820 
       
  1821 		// Saves a focus visibility.
  1809 		// Saves a focus visibility.
  1822 		iLastFocus = EFalse;
  1810 		iLastFocus = EFalse;
  1823 		if( iFocusedControl == EMailListComponent && IsFocusShown() )
  1811 		if( iFocusedControl == EMailListComponent && IsFocusShown() )
  1824 		    {
  1812 		    {
  1825 		    iLastFocus = ETrue;
  1813 		    iLastFocus = ETrue;
  2224     menu->StopDisplayingMenuBar();
  2212     menu->StopDisplayingMenuBar();
  2225     menu->SetMenuTitleResourceId(R_FSEMAILUI_MAILLIST_MENUBAR_MARKING_MODE);
  2213     menu->SetMenuTitleResourceId(R_FSEMAILUI_MAILLIST_MENUBAR_MARKING_MODE);
  2226     // Change background to marking mode
  2214     // Change background to marking mode
  2227     DisplayMarkingModeBgL( ETrue );       
  2215     DisplayMarkingModeBgL( ETrue );       
  2228     // Hide drop down menu buttons
  2216     // Hide drop down menu buttons
  2229     if( Layout_Meta_Data::IsLandscapeOrientation() )
  2217     iNewEmailButton->SetDimmed();
  2230         {
  2218     iFolderListButton->SetDimmed();   
  2231         iNewEmailButton->SetDimmed();
  2219     iSortButton->SetDimmed();
  2232         iFolderListButton->SetDimmed();   
  2220     if( !Layout_Meta_Data::IsLandscapeOrientation() )
  2233         iSortButton->SetDimmed();
       
  2234         }
       
  2235     else
       
  2236         {
  2221         {
  2237         TRect rect(0,0,0,0);
  2222         TRect rect(0,0,0,0);
  2238         iControlBarControl->SetRectL( rect );
  2223         iControlBarControl->SetRectL( rect );
  2239         // Display marking mode text on the place of drop down menus   
  2224         // Display marking mode text on the place of drop down menus   
  2240         DisplayMarkingModeTitleTextL();
  2225         DisplayMarkingModeTitleTextL();
  4057        	case EFsEmailUiCmdSync:
  4042        	case EFsEmailUiCmdSync:
  4058 			{
  4043 			{
  4059 			TBool supportsSync = iAppUi.GetActiveMailbox()->HasCapability( EFSMBoxCapaSupportsSync );
  4044 			TBool supportsSync = iAppUi.GetActiveMailbox()->HasCapability( EFSMBoxCapaSupportsSync );
  4060 			if ( supportsSync )
  4045 			if ( supportsSync )
  4061 			    {
  4046 			    {
  4062 			    //If synchronizing is ongoing and a new sync is started we ignore it
  4047 			    // If synchronizing is ongoing and a new sync is started we ignore it
  4063 			    if(!GetLatestSyncState())
  4048 			    if( !GetLatestSyncState() )
  4064 			        {
  4049 			        {
  4065 			        iAppUi.SyncActiveMailBoxL();
  4050 			        iAppUi.SyncActiveMailBoxL();
  4066 			        // Sync was started by the user
  4051 			        // Sync was started by the user
  4067 			        ManualMailBoxSync(ETrue);
  4052 			        ManualMailBoxSync( ETrue );
  4068                     iAppUi.ManualMailBoxSync( ETrue );
       
  4069 			        }
  4053 			        }
  4070 			    }
  4054 			    }
  4071 			  else
  4055 			  else
  4072 			    {
  4056 			    {
  4073 			    //POP3 synchronise
  4057 			    //POP3 synchronise
  4074 				iAppUi.DoAutoConnectL();
  4058 				iAppUi.DoAutoConnectL();
  4075 				}
  4059 				}
  4076 			}
  4060 			}
  4077 			break;
  4061 			break;
  4078        	case EFsEmailUiCmdCancelSync:
  4062        	case EFsEmailUiCmdGoOffline:
  4079        		{
       
  4080             TBool supportsSync = iAppUi.GetActiveMailbox()->HasCapability( EFSMBoxCapaSupportsSync );
       
  4081             if ( supportsSync )
       
  4082 		       {
       
  4083 	            iAppUi.StopActiveMailBoxSyncL();
       
  4084 	            // Sync was started by the user
       
  4085 	            ManualMailBoxSync(ETrue);
       
  4086 	            iAppUi.ManualMailBoxSync( ETrue );
       
  4087                 }
       
  4088 		     else
       
  4089 		        {
       
  4090 		         //POP3
       
  4091                  iAppUi.GetActiveMailbox()->GoOfflineL();
       
  4092                 }
       
  4093        		}
       
  4094        		break;
       
  4095         case EFsEmailUiCmdGoOffline:
       
  4096         	{
  4063         	{
  4097     	   	iAppUi.GetActiveMailbox()->GoOfflineL();
  4064     	   	iAppUi.GetActiveMailbox()->GoOfflineL();
  4098         	}
  4065         	}
  4099         	break;
  4066         	break;
  4100         case EFsEmailUiCmdGoOnline:
  4067         case EFsEmailUiCmdGoOnline:
  4101         	{
  4068         	{
  4102 			CFSMailBox* mb = iAppUi.GetActiveMailbox();
  4069 			CFSMailBox* mb = iAppUi.GetActiveMailbox();
  4103             iAppUi.ManualMailBoxSync( ETrue );
       
  4104         	mb->GoOnlineL();
  4070         	mb->GoOnlineL();
  4105         	}
  4071         	}
  4106         	break;
  4072         	break;
  4107        	case EFsEmailUiCmdHelp:
  4073        	case EFsEmailUiCmdHelp:
  4108 			{
  4074 			{
  7218 			// Add mark as read / unread options
  7184 			// Add mark as read / unread options
  7219 			iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdMarkAsUnread, !IsMarkAsUnreadAvailableL() );
  7185 			iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdMarkAsUnread, !IsMarkAsUnreadAvailableL() );
  7220 			iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdMarkAsRead, !IsMarkAsReadAvailableL() );
  7186 			iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdMarkAsRead, !IsMarkAsReadAvailableL() );
  7221 
  7187 
  7222 			// Check support for object mail iten moving
  7188 			// Check support for object mail iten moving
  7223 			TBool supportsMoving = iAppUi.GetActiveMailbox()->HasCapability( EFSMBoxCapaMoveToFolder );
  7189 			iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdActionsMoveMessage,
  7224 			iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdActionsMoveMessage, !supportsMoving );
  7190          !(iAppUi.GetActiveMailbox()->HasCapability( EFSMBoxCapaMoveToFolder )
       
  7191          && iMailFolder->SupportsMoveFromL( iMailFolder->GetFolderType() ) ) );
  7225 
  7192 
  7226 			// Hide / show follow up
  7193 			// Hide / show follow up
  7227 			TBool supportsFlag = TFsEmailUiUtility::IsFollowUpSupported( *iAppUi.GetActiveMailbox() );
  7194 			TBool supportsFlag = TFsEmailUiUtility::IsFollowUpSupported( *iAppUi.GetActiveMailbox() );
  7228 			iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdActionsFlag, !supportsFlag );
  7195 			iStylusPopUpMenu->SetItemDimmed( EFsEmailUiCmdActionsFlag, !supportsFlag );
  7229 
  7196 
  8037     {
  8004     {
  8038     aLayoutArray.AppendL( iScreenAnchorLayout );
  8005     aLayoutArray.AppendL( iScreenAnchorLayout );
  8039     aLayoutArray.AppendL( iControlBarControl->Visual() );
  8006     aLayoutArray.AppendL( iControlBarControl->Visual() );
  8040     }
  8007     }
  8041 
  8008 
       
  8009 // hide or show CAlfVisuals ( used for activation or deactivation )
       
  8010 void CFSEmailUiMailListVisualiser::FadeOut(TBool aDirectionOut)
       
  8011 	{
       
  8012     FUNC_LOG;
       
  8013 	TAlfTimedValue timedValue( 0, 0 );
       
  8014 	if ( !aDirectionOut )
       
  8015         {
       
  8016 		timedValue.SetTarget( 1, 0 );
       
  8017 		}
       
  8018 	if ( iScreenAnchorLayout != NULL )
       
  8019 		{
       
  8020 	    iScreenAnchorLayout->SetOpacity( timedValue );
       
  8021 		}
       
  8022 	if (iControlBarControl && iControlBarControl->Visual() != NULL )
       
  8023         {
       
  8024 	    iControlBarControl->Visual()->SetOpacity( timedValue );
       
  8025         }  
       
  8026 	}
       
  8027 
  8042 // Sets aActiveMailboxId and aActiveFolderId from iMailFolder if available
  8028 // Sets aActiveMailboxId and aActiveFolderId from iMailFolder if available
  8043 TInt CFSEmailUiMailListVisualiser::GetActiveFolderId(TFSMailMsgId& aActiveMailboxId, TFSMailMsgId& aActiveFolderId) const
  8029 TInt CFSEmailUiMailListVisualiser::GetActiveFolderId(TFSMailMsgId& aActiveMailboxId, TFSMailMsgId& aActiveFolderId) const
  8044     {
  8030     {
  8045     if (iMailFolder != NULL)
  8031     if (iMailFolder != NULL)
  8046         {
  8032         {