emailuis/emailui/sendasmtm/fsmtms/uidata/src/cfsuidatamtm.cpp
branchRCL_3
changeset 8 e1b6206813b4
parent 0 8466d47a6819
child 11 0396474f30f5
equal deleted inserted replaced
4:e7aa27f58ae1 8:e1b6206813b4
    31 #include <fsuidatamtm.rsg>
    31 #include <fsuidatamtm.rsg>
    32 #include "fsmtmsconstants.h"
    32 #include "fsmtmsconstants.h"
    33 #include "cfsuidatamtm.h"
    33 #include "cfsuidatamtm.h"
    34 
    34 
    35 // FREESTYLE EMAIL FRAMEWORK INCLUDES
    35 // FREESTYLE EMAIL FRAMEWORK INCLUDES
    36 #include "CFSMailCommon.h"
    36 #include "cfsmailcommon.h"
    37 #include "CFSMailClient.h"
    37 #include "cfsmailclient.h"
    38 #include "CFSMailBox.h"
    38 #include "cfsmailbox.h"
    39 
    39 
    40 
    40 
    41 #include <gulicon.h>
    41 #include <gulicon.h>
    42 #include "MFSMailBrandManager.h"
    42 #include "mfsmailbrandmanager.h"
    43 
    43 
    44 // GLOBAL EXPORTS.
    44 // GLOBAL EXPORTS.
    45 
    45 
    46 // ---------------------------------------------------------------------------
    46 // ---------------------------------------------------------------------------
    47 // Panic
    47 // Panic
   137     TFileName bitmapFileName= parse.FullName();     
   137     TFileName bitmapFileName= parse.FullName();     
   138     
   138     
   139     // Support for White label branding added
   139     // Support for White label branding added
   140     CFSMailClient* mailClient = CFSMailClient::NewL();
   140     CFSMailClient* mailClient = CFSMailClient::NewL();
   141     CleanupClosePushL(*mailClient);
   141     CleanupClosePushL(*mailClient);
   142 	MFSMailBrandManager& brandManager = mailClient->GetBrandManagerL();
   142     MFSMailBrandManager& brandManager = mailClient->GetBrandManagerL();
   143 	RPointerArray<CFSMailBox> mailboxes;
   143     RPointerArray<CFSMailBox> mailboxes;
   144 	CleanupResetAndDestroyClosePushL( mailboxes );
   144     CleanupResetAndDestroyClosePushL( mailboxes );
   145 	TFSMailMsgId id;
   145     TFSMailMsgId id;
   146 
   146 
   147 	mailClient->ListMailBoxes( id, mailboxes );
   147     mailClient->ListMailBoxes( id, mailboxes );
   148 
   148 
   149 	iIconArrays->Reset();
   149     iIconArrays->Reset();
   150 	iMailboxIds.Reset();
   150     iMailboxIds.Reset();
   151 
   151 
   152 	for ( TInt i = 0; i <= mailboxes.Count(); i++ ) // Last round is for setting the default mb icon at the end of the list
   152     for ( TInt i = 0; i <= mailboxes.Count(); i++ ) // Last round is for setting the default mb icon at the end of the list
   153 		{
   153         {
   154 	    CFbsBitmap* bitmap(0);
   154         CFbsBitmap* bitmap(0);
   155 	    CFbsBitmap* bitmapMask(0);
   155         CFbsBitmap* bitmapMask(0);
   156 	    CArrayPtrFlat<CFbsBitmap>* array = new (ELeave) CArrayPtrFlat<CFbsBitmap>( 2 );
   156         CArrayPtrFlat<CFbsBitmap>* array = new (ELeave) CArrayPtrFlat<CFbsBitmap>( 2 );
   157 		CleanupStack::PushL( array ); // +2 array
   157         CleanupStack::PushL( array ); // +2 array
   158 		array->SetReserveL( 2 ); // AppendLs will not LEAVE
   158         array->SetReserveL( 2 ); // AppendLs will not LEAVE
   159 		
   159         
   160 		CGulIcon* brandedIcon( NULL );
   160         CGulIcon* brandedIcon( NULL );
   161 		TInt err;
   161         TInt err;
   162 
   162 
   163 		if ( i < mailboxes.Count() ) // Do not execute for the last round
   163         if ( i < mailboxes.Count() ) // Do not execute for the last round
   164 			{
   164             {
   165 			TRAP( err, brandedIcon = brandManager.GetGraphicL( EFSMailboxIcon, mailboxes[i]->GetId() ) );
   165             TRAP( err, brandedIcon = brandManager.GetGraphicL( EFSMailboxIcon, mailboxes[i]->GetId() ) );
   166 			}
       
   167 		if ( err == KErrNone && brandedIcon )
       
   168 			{
       
   169 			bitmap = brandedIcon->Bitmap();
       
   170 			bitmapMask = brandedIcon->Mask();
       
   171 			brandedIcon->SetBitmapsOwnedExternally( ETrue );
       
   172 		    CleanupStack::PushL( bitmap );
       
   173 		    array->AppendL( bitmap );
       
   174 		    CleanupStack::Pop( bitmap );
       
   175 			bitmap = 0;
       
   176 		    CleanupStack::PushL( bitmapMask );
       
   177 			array->AppendL( bitmapMask );
       
   178 		    CleanupStack::Pop( bitmapMask );
       
   179 			bitmapMask = 0;
       
   180 			iIconArrays->AppendL( array );
       
   181 			iMailboxIds.Append( (mailboxes[i]->GetId()).Id() );
       
   182             }
   166             }
   183 		else
   167         if ( err == KErrNone && brandedIcon )
   184 			{
   168             {
   185 			// Icon was not found from the branding manager or last round for the default icon
   169             bitmap = brandedIcon->Bitmap();
   186 			TRAPD( err, AknIconUtils::CreateIconL( bitmap, bitmapMask, bitmapFileName,
   170             bitmapMask = brandedIcon->Mask();
   187 					EMbmFsuidatamtmQgn_prop_cmail_inbox_small, EMbmFsuidatamtmQgn_prop_cmail_inbox_small + 1 ));
   171             brandedIcon->SetBitmapsOwnedExternally( ETrue );
   188 			if( err != KErrNone )
   172             CleanupStack::PushL( bitmap );
   189 				{
   173             array->AppendL( bitmap );
   190 				}
   174             CleanupStack::Pop( bitmap );
   191 		    CleanupStack::PushL( bitmap );
   175             bitmap = 0;
   192 		    array->AppendL( bitmap );
   176             CleanupStack::PushL( bitmapMask );
   193 		    CleanupStack::Pop( bitmap );
   177             array->AppendL( bitmapMask );
   194 			bitmap = 0;
   178             CleanupStack::Pop( bitmapMask );
   195 		    CleanupStack::PushL( bitmapMask );
   179             bitmapMask = 0;
   196 			array->AppendL( bitmapMask );
   180             iIconArrays->AppendL( array );
   197 		    CleanupStack::Pop( bitmapMask );
   181             iMailboxIds.Append( (mailboxes[i]->GetId()).Id() );
   198 			bitmapMask = 0;
   182             }
   199 			// INFO: This is not working for some reason, otherwise above code is not required.
   183         else
   200 			// CreateBitmapsL(2, KFsUiDataMtmUdBitmapFile, EMbmFsuidatamtmFsmailbox, 
   184             {
   201 			// EMbmFsuidatamtmLastElement);
   185             // Icon was not found from the branding manager or last round for the default icon
   202 			iIconArrays->AppendL( array );
   186             TRAPD( err, AknIconUtils::CreateIconL( bitmap, bitmapMask, bitmapFileName,
   203 			iMailboxIds.Append(0);
   187                     EMbmFsuidatamtmQgn_prop_cmail_inbox_small, EMbmFsuidatamtmQgn_prop_cmail_inbox_small + 1 ));
   204 			}
   188             if( err != KErrNone )
   205 		if ( brandedIcon )
   189                 {
   206 			{
   190                 }
   207 			delete brandedIcon;
   191             CleanupStack::PushL( bitmap );
   208 			}
   192             array->AppendL( bitmap );
   209 		CleanupStack::Pop( array );  
   193             CleanupStack::Pop( bitmap );
   210 		}
   194             bitmap = 0;
   211 	
   195             CleanupStack::PushL( bitmapMask );
   212 	CleanupStack::PopAndDestroy( &mailboxes );
   196             array->AppendL( bitmapMask );
       
   197             CleanupStack::Pop( bitmapMask );
       
   198             bitmapMask = 0;
       
   199             // INFO: This is not working for some reason, otherwise above code is not required.
       
   200             // CreateBitmapsL(2, KFsUiDataMtmUdBitmapFile, EMbmFsuidatamtmFsmailbox, 
       
   201             // EMbmFsuidatamtmLastElement);
       
   202             iIconArrays->AppendL( array );
       
   203             iMailboxIds.Append(0);
       
   204             }
       
   205         if ( brandedIcon )
       
   206             {
       
   207             delete brandedIcon;
       
   208             }
       
   209         CleanupStack::Pop( array );  
       
   210         }
       
   211     
       
   212     CleanupStack::PopAndDestroy( &mailboxes );
   213     CleanupStack::PopAndDestroy( mailClient );
   213     CleanupStack::PopAndDestroy( mailClient );
   214 
   214 
   215 }
   215 }
   216 
   216 
   217 // ---------------------------------------------------------------------------
   217 // ---------------------------------------------------------------------------
   249 const CBaseMtmUiData::CBitmapArray& CFsUiDataMtm::ContextIcon( 
   249 const CBaseMtmUiData::CBitmapArray& CFsUiDataMtm::ContextIcon( 
   250     const TMsvEntry& aContext, TInt /*aStateFlags*/ ) const
   250     const TMsvEntry& aContext, TInt /*aStateFlags*/ ) const
   251 {
   251 {
   252     FUNC_LOG;
   252     FUNC_LOG;
   253     for ( TInt i = 0; i < iIconArrays->Count() - 1; i++ )
   253     for ( TInt i = 0; i < iIconArrays->Count() - 1; i++ )
   254     	{
   254         {
   255         if ( iMailboxIds[i] == aContext.iMtmData2 )
   255         if ( iMailboxIds[i] == aContext.iMtmData2 )
   256         	{    	
   256             {       
   257         	return *(iIconArrays->At( i ));
   257             return *(iIconArrays->At( i ));
   258         	}
   258             }
   259     	}
   259         }
   260     return *(iIconArrays->At( iIconArrays->Count() - 1)); // Default icon
   260     return *(iIconArrays->At( iIconArrays->Count() - 1)); // Default icon
   261 }
   261 }
   262 
   262 
   263 // ---------------------------------------------------------------------------
   263 // ---------------------------------------------------------------------------
   264 // CFsUiDataMtm::MtmSpecificFunctions
   264 // CFsUiDataMtm::MtmSpecificFunctions
   337     TMsvEntry &aNewEntry, TInt &aReasonResourceId ) const
   337     TMsvEntry &aNewEntry, TInt &aReasonResourceId ) const
   338 {
   338 {
   339     FUNC_LOG;
   339     FUNC_LOG;
   340     if ((aNewEntry.iMtm == KUidMsgValTypeFsMtmVal) && 
   340     if ((aNewEntry.iMtm == KUidMsgValTypeFsMtmVal) && 
   341         (aNewEntry.iType == KUidMsvServiceEntry) )
   341         (aNewEntry.iType == KUidMsvServiceEntry) )
   342     	{
   342         {
   343     	aReasonResourceId=0;
   343         aReasonResourceId=0;
   344         // --- Can create services if they are off root ---
   344         // --- Can create services if they are off root ---
   345         return (aParent.Id() == KMsvRootIndexEntryIdValue);
   345         return (aParent.Id() == KMsvRootIndexEntryIdValue);
   346     	}
   346         }
   347     aReasonResourceId = R_FS_NOT_SUPPORTED;
   347     aReasonResourceId = R_FS_NOT_SUPPORTED;
   348     
   348     
   349     return EFalse;
   349     return EFalse;
   350 }
   350 }
   351 
   351 
   530         // is compiled.               
   530         // is compiled.               
   531         // Solution - Compare with sid.iID EAknsMinorQgnMenuMceLst = 0x100058C5
   531         // Solution - Compare with sid.iID EAknsMinorQgnMenuMceLst = 0x100058C5
   532         // defined in aknsconstants.hrh.
   532         // defined in aknsconstants.hrh.
   533 
   533 
   534             //Disabling SendAs for Calendar is removed.
   534             //Disabling SendAs for Calendar is removed.
   535        	    aResponse=ETrue;
   535             aResponse=ETrue;
   536             break;
   536             break;
   537 
   537 
   538         default:
   538         default:
   539             rc = KErrNotSupported;
   539             rc = KErrNotSupported;
   540      }
   540      }