emailuis/emailui/src/FreestyleEmailUiMailListVisualiser.cpp
branchRCL_3
changeset 17 67369d1b217f
parent 16 b5fbb9b25d57
child 18 6b8f3b30d0ec
equal deleted inserted replaced
16:b5fbb9b25d57 17:67369d1b217f
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009 - 2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    88 #include "FreestyleEmailUiHtmlViewerView.h"
    88 #include "FreestyleEmailUiHtmlViewerView.h"
    89 #include "FSDelayedLoader.h"
    89 #include "FSDelayedLoader.h"
    90 #include "FSEmail.pan"
    90 #include "FSEmail.pan"
    91 
    91 
    92 #include "ipsplgcommon.h"
    92 #include "ipsplgcommon.h"
       
    93 #include "cemailsettingsextension.h"
    93 
    94 
    94 // CONST VALUES
    95 // CONST VALUES
    95 const TInt KControlBarTransitionTime = 250;
    96 const TInt KControlBarTransitionTime = 250;
    96 const TInt KMaxPreviewPaneLength = 60;
    97 const TInt KMaxPreviewPaneLength = 60;
    97 const TInt KMsgUpdaterTimerDelay = 2500000; // Time to update list, 2,5sec
    98 const TInt KMsgUpdaterTimerDelay = 2500000; // Time to update list, 2,5sec
   682             {
   683             {
   683             iMailList->SetFocusedItemL( iTreeItemArray[0].iListItemId );
   684             iMailList->SetFocusedItemL( iTreeItemArray[0].iListItemId );
   684             }
   685             }
   685         }
   686         }
   686     SetListAndCtrlBarFocusL();
   687     SetListAndCtrlBarFocusL();
   687     iAppUi.StartMonitoringL();
   688     if(!CheckAutoSyncSettingL())
       
   689         {
       
   690         iAppUi.StartMonitoringL();
       
   691         }
   688     TIMESTAMP( "Locally stored messages fetched for message list" );
   692     TIMESTAMP( "Locally stored messages fetched for message list" );
   689     }
   693     }
   690 
   694 
   691 // ---------------------------------------------------------------------------
   695 // ---------------------------------------------------------------------------
   692 // @see CMailListModelUpdater::MObserver::UpdateCancelled
   696 // @see CMailListModelUpdater::MObserver::UpdateCancelled
  1608         }
  1612         }
  1609     // THE CORRECT FOLDER IS ALREADY OPEN. CHECK IF SOME PARTIAL UPDATE IS NEEDED.
  1613     // THE CORRECT FOLDER IS ALREADY OPEN. CHECK IF SOME PARTIAL UPDATE IS NEEDED.
  1610     else
  1614     else
  1611         {
  1615         {
  1612         iMailList->ShowListL();
  1616         iMailList->ShowListL();
  1613         if (forwardNavigation)
  1617         TBool manualSync = CheckAutoSyncSettingL();
       
  1618         if (forwardNavigation && !manualSync)
  1614             {
  1619             {
  1615             iAppUi.StartMonitoringL();
  1620             iAppUi.StartMonitoringL();
  1616             }
  1621             }
  1617         SetListAndCtrlBarFocusL(); // ShowListL() makes list focused and this may need to be reverted
  1622         SetListAndCtrlBarFocusL(); // ShowListL() makes list focused and this may need to be reverted
  1618         if ( aCustomMessageId == TUid::Uid(KMailSettingsReturnFromPluginSettings) )
  1623         if ( aCustomMessageId == TUid::Uid(KMailSettingsReturnFromPluginSettings) )
  1696             iMailList->SetFocusedL( EFalse );
  1701             iMailList->SetFocusedL( EFalse );
  1697   	        } );
  1702   	        } );
  1698   	    iMailTreeListVisualizer->NotifyControlVisibilityChange( EFalse );
  1703   	    iMailTreeListVisualizer->NotifyControlVisibilityChange( EFalse );
  1699   	    }
  1704   	    }
  1700 	iThisViewActive = EFalse;
  1705 	iThisViewActive = EFalse;
  1701 	FadeOut(ETrue);  // hide CAlfVisuals on deactivation
       
  1702 	}
  1706 	}
  1703 
  1707 
  1704 // ---------------------------------------------------------------------------
  1708 // ---------------------------------------------------------------------------
  1705 //
  1709 //
  1706 //
  1710 //
  3019             {
  3023             {
  3020             UpdateThemeL();
  3024             UpdateThemeL();
  3021             }
  3025             }
  3022         else
  3026         else
  3023             {
  3027             {
       
  3028             iAppUi.FsTextureManager()->ClearTextureByIndex( EListControlBarMailboxDefaultIcon );
       
  3029             iFolderListButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( EListControlBarMailboxDefaultIcon ) );
       
  3030             iAppUi.FsTextureManager()->ClearTextureByIndex( EListTextureCreateNewMessageIcon );
       
  3031             iNewEmailButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( EListTextureCreateNewMessageIcon ) );
       
  3032             iAppUi.FsTextureManager()->ClearTextureByIndex( GetSortButtonTextureIndex() );
       
  3033             iSortButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( GetSortButtonTextureIndex() ) );
       
  3034            
  3024             iMailTreeListVisualizer->HideList();
  3035             iMailTreeListVisualizer->HideList();
  3025             // screen layout changed
  3036             // screen layout changed
  3026             iCurrentClientRect = iAppUi.ClientRect();
  3037             iCurrentClientRect = iAppUi.ClientRect();
  3027             iScreenAnchorLayout->SetSize( iCurrentClientRect.Size() );
  3038             iScreenAnchorLayout->SetSize( iCurrentClientRect.Size() );
  3028             SetMailListLayoutAnchors();
  3039             SetMailListLayoutAnchors();
  4280             {
  4291             {
  4281             // If destination folder is not set, it needs to be asked messages are moved after callbak
  4292             // If destination folder is not set, it needs to be asked messages are moved after callbak
  4282             if ( aDestinationFolderId.IsNullId() )
  4293             if ( aDestinationFolderId.IsNullId() )
  4283                 {
  4294                 {
  4284                 // Activate folder selection view and handle moving after callback gets destination
  4295                 // Activate folder selection view and handle moving after callback gets destination
       
  4296                 RemoveMarkingModeTitleTextL();    
  4285                 iMoveToFolderOngoing = ETrue;
  4297                 iMoveToFolderOngoing = ETrue;
  4286                 TFolderListActivationData folderListData;
  4298                 TFolderListActivationData folderListData;
  4287                 folderListData.iCallback = this;
  4299                 folderListData.iCallback = this;
  4288                 if(iMailFolder) // Coverity error fix , assuming that inbox is best bet for safe data. 
  4300                 if(iMailFolder) // Coverity error fix , assuming that inbox is best bet for safe data. 
  4289                     {
  4301                     {
  5615    	iSortButton->SetPos( sortButtonRect.iTl );
  5627    	iSortButton->SetPos( sortButtonRect.iTl );
  5616     iSortButton->SetSize( sortButtonRect.Size() );
  5628     iSortButton->SetSize( sortButtonRect.Size() );
  5617 
  5629 
  5618 	TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
  5630 	TInt var = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
  5619 	TAknLayoutText textLayout;
  5631 	TAknLayoutText textLayout;
  5620 	textLayout.LayoutText(TRect(0,0,0,0), AknLayoutScalable_Apps::main_sp_fs_ctrlbar_ddmenu_pane_t1(var));
  5632 	if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
  5633 		{
       
  5634 	    textLayout.LayoutText(TRect(0,0,0,0), AknLayoutScalable_Apps::cmail_ddmenu_btn02_pane_t2(0));
       
  5635 		}
       
  5636 	else
       
  5637 		{
       
  5638 	    textLayout.LayoutText(TRect(0,0,0,0), AknLayoutScalable_Apps::main_sp_fs_ctrlbar_ddmenu_pane_t1(var));
       
  5639 		}
  5621 	iNewEmailButton->SetTextFontL( textLayout.Font()->FontSpecInTwips() );
  5640 	iNewEmailButton->SetTextFontL( textLayout.Font()->FontSpecInTwips() );
  5622  	iFolderListButton->SetTextFontL( textLayout.Font()->FontSpecInTwips() );
  5641  	iFolderListButton->SetTextFontL( textLayout.Font()->FontSpecInTwips() );
  5623  	iSortButton->SetTextFontL( textLayout.Font()->FontSpecInTwips() );
  5642  	iSortButton->SetTextFontL( textLayout.Font()->FontSpecInTwips() );
  5624 
  5643 
  5625  	UpdateThemeL(EFalse);
  5644  	UpdateThemeL(EFalse);
  5653 		{
  5672 		{
  5654 		iSortButton->SetTextL( *buttonText );
  5673 		iSortButton->SetTextL( *buttonText );
  5655 		}
  5674 		}
  5656 	CleanupStack::PopAndDestroy( buttonText );
  5675 	CleanupStack::PopAndDestroy( buttonText );
  5657 
  5676 
  5658 	// Set icon
  5677 	iSortButton->SetIconL(
       
  5678 			iAppUi.FsTextureManager()->TextureByIndex( GetSortButtonTextureIndex() ),
       
  5679 			ECBElemIconA );
       
  5680 
       
  5681 	}
       
  5682     
       
  5683 // ---------------------------------------------------------------------------
       
  5684 //
       
  5685 //
       
  5686 // ---------------------------------------------------------------------------
       
  5687 //
       
  5688 TFSEmailUiTextures CFSEmailUiMailListVisualiser::GetSortButtonTextureIndex()
       
  5689     {
       
  5690     FUNC_LOG;
       
  5691     
  5659     TFSEmailUiTextures textureIndex( ETextureFirst );
  5692     TFSEmailUiTextures textureIndex( ETextureFirst );
  5660 
  5693     switch ( iCurrentSortCriteria.iField )
  5661 	switch ( iCurrentSortCriteria.iField )
       
  5662 		{
  5694 		{
  5663 		case EFSMailSortBySubject:
  5695 		case EFSMailSortBySubject:
  5664 			{
  5696 			{
  5665 			textureIndex = iCurrentSortCriteria.iOrder == EFSMailAscending ?
  5697 			textureIndex = iCurrentSortCriteria.iOrder == EFSMailAscending ?
  5666 						   ESortListSubjectDescTexture :
  5698 						   ESortListSubjectDescTexture :
  5709 			textureIndex = iCurrentSortCriteria.iOrder == EFSMailAscending ?
  5741 			textureIndex = iCurrentSortCriteria.iOrder == EFSMailAscending ?
  5710 						   ESortListDateDescTexture :
  5742 						   ESortListDateDescTexture :
  5711 						   ESortListDateAscTexture;
  5743 						   ESortListDateAscTexture;
  5712 			}
  5744 			}
  5713 			break;
  5745 			break;
  5714 		}
  5746   		}
  5715 
  5747     return textureIndex;
  5716 	iSortButton->SetIconL(
       
  5717 			iAppUi.FsTextureManager()->TextureByIndex( textureIndex ),
       
  5718 			ECBElemIconA );
       
  5719 	}
  5748 	}
  5720 
  5749 
  5721 // ---------------------------------------------------------------------------
  5750 // ---------------------------------------------------------------------------
  5722 //
  5751 //
  5723 //
  5752 //
  6725 		{
  6754 		{
  6726 		iMoveToFolderOngoing = EFalse;
  6755 		iMoveToFolderOngoing = EFalse;
  6727 		switch ( aResponse )
  6756 		switch ( aResponse )
  6728 			{
  6757 			{
  6729 			case EFSEmailUiCtrlBarResponseCancel:
  6758 			case EFSEmailUiCtrlBarResponseCancel:
       
  6759 			    if ( iMarkingMode )
       
  6760 			        {
       
  6761                     DisplayMarkingModeTitleTextL();
       
  6762 			        }
  6730 			    iMarkingModeWaitingToExit = EFalse;
  6763 			    iMarkingModeWaitingToExit = EFalse;
  6731 			    SetMskL();
  6764 			    SetMskL();
  6732 				return;
  6765 				return;
  6733 			case EFSEmailUiCtrlBarResponseSelect:
  6766 			case EFSEmailUiCtrlBarResponseSelect:
  6734 			    {
  6767 			    {
  7221 				}
  7254 				}
  7222 			}
  7255 			}
  7223 		}
  7256 		}
  7224 
  7257 
  7225 	// Set the position for the popup
  7258 	// Set the position for the popup
  7226 	iStylusPopUpMenu->SetPosition( aPoint );
  7259 	TPoint point(aPoint.iX, aPoint.iY + 45);
       
  7260 	iStylusPopUpMenu->SetPosition( point, CAknStylusPopUpMenu::EPositionTypeRightBottom );
  7227 
  7261 
  7228 	// Display the popup and set the flag to indicate that the menu was
  7262 	// Display the popup and set the flag to indicate that the menu was
  7229 	// launched.
  7263 	// launched.
  7230 	iStylusPopUpMenu->ShowMenu();
  7264 	iStylusPopUpMenu->ShowMenu();
  7231 	iStylusPopUpMenuVisible = ETrue;
  7265 	iStylusPopUpMenuVisible = ETrue;
  7634 	TRAPD( err, mailBoxIcon = brandManager.GetGraphicL( EFSMailboxIcon,  iAppUi.GetActiveMailboxId() ) );
  7668 	TRAPD( err, mailBoxIcon = brandManager.GetGraphicL( EFSMailboxIcon,  iAppUi.GetActiveMailboxId() ) );
  7635 	if ( err == KErrNone && mailBoxIcon )
  7669 	if ( err == KErrNone && mailBoxIcon )
  7636 		{
  7670 		{
  7637 		CleanupStack::PushL( mailBoxIcon );
  7671 		CleanupStack::PushL( mailBoxIcon );
  7638         //<cmail>
  7672         //<cmail>
  7639 		TSize defaultIconSize(iAppUi.LayoutHandler()->GetControlBarMailboxIconRect().Size());
  7673 		TInt iconSize( iAppUi.LayoutHandler()->GetControlBarMailboxIconRect().Width() );
       
  7674 		TSize defaultIconSize ( iconSize, iconSize );
  7640         //</cmail>
  7675         //</cmail>
  7641     	AknIconUtils::SetSize(mailBoxIcon->Bitmap(), defaultIconSize);
  7676     	AknIconUtils::SetSize(mailBoxIcon->Bitmap(), defaultIconSize);
  7642 	    AknIconUtils::SetSize(mailBoxIcon->Mask(), defaultIconSize);
  7677 	    AknIconUtils::SetSize(mailBoxIcon->Mask(), defaultIconSize);
  7643 		// Create texture into TextureManager, If not already existing
  7678 		// Create texture into TextureManager, If not already existing
  7644 	    iAppUi.FsTextureManager()->CreateBrandedMailboxTexture( mailBoxIcon,
  7679 	    iAppUi.FsTextureManager()->CreateBrandedMailboxTexture( mailBoxIcon,
  8053         iExtension = reinterpret_cast<CMailboxStateExtension*>( ext );
  8088         iExtension = reinterpret_cast<CMailboxStateExtension*>( ext );
  8054         iExtension->SetStateDataProvider( this );
  8089         iExtension->SetStateDataProvider( this );
  8055         }
  8090         }
  8056     }
  8091     }
  8057 
  8092 
       
  8093 TBool CFSEmailUiMailListVisualiser::CheckAutoSyncSettingL()
       
  8094     {
       
  8095     CEmailExtension* ext=NULL;
       
  8096     TBool manualSync = EFalse;
       
  8097     CFSMailBox* box = iAppUi.GetActiveMailbox();
       
  8098     if (box)
       
  8099         {
       
  8100         ext = box->ExtensionL( KEmailSettingExtensionUid );
       
  8101         if (ext)
       
  8102             {
       
  8103             CEmailSettingsExtension* extension = reinterpret_cast<CEmailSettingsExtension*>( ext );
       
  8104             extension->SetMailBoxId(box->GetId());
       
  8105             manualSync = extension->IsSetL(EmailSyncInterval);
       
  8106             box->ReleaseExtension(extension);
       
  8107             }
       
  8108         }
       
  8109     return manualSync;
       
  8110     }
       
  8111 
  8058 //////////////////////////////////////////////////////////////////
  8112 //////////////////////////////////////////////////////////////////
  8059 // Class implementation CMailListUpdater
  8113 // Class implementation CMailListUpdater
  8060 ///////////////////////////////////////////////////////////////////
  8114 ///////////////////////////////////////////////////////////////////
  8061 
  8115 
  8062 
  8116