email/imum/Utils/Src/ImumInternalApiImpl.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  ImumInternalApiImpl.cpp
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <e32base.h>
       
    21 #include <msvapi.h>                     // CMsvSession
       
    22 #include <MuiuMsvUiServiceUtilities.h>  // MsvUiServiceUtilities
       
    23 #include <cemailaccounts.h>             // CEmailAccounts
       
    24 #include <ImumInternalApi.h>
       
    25 
       
    26 #include "ImumDaErrorCodes.h"
       
    27 #include "EmailUtils.H"
       
    28 #include "IMSSettingsNoteUi.h"
       
    29 #include "ImumInternalApiImpl.h"
       
    30 #include "ImumInHealthServicesImpl.h"
       
    31 #include "ImumInMailboxUtilitiesImpl.h"
       
    32 #include "ImumInMailboxServicesImpl.h"
       
    33 #include "ImumMboxManager.h"
       
    34 #include "EmailFeatureUtils.h"
       
    35 #include "ImumUtilsLogging.h"
       
    36 #include "ComDbUtl.h"                   // CMsvCommDbUtilities
       
    37 #include "ImumPanic.h"
       
    38 
       
    39 // EXTERNAL DATA STRUCTURES
       
    40 // EXTERNAL FUNCTION PROTOTYPES
       
    41 // CONSTANTS
       
    42 // MACROS
       
    43 // LOCAL CONSTANTS AND MACROS
       
    44 // MODULE DATA STRUCTURES
       
    45 // LOCAL FUNCTION PROTOTYPES
       
    46 // FORWARD DECLARATIONS
       
    47 
       
    48 // ============================ LOCAL FUNCTIONS ===============================
       
    49 
       
    50 // ----------------------------------------------------------------------------
       
    51 // CreateEmailApiL()
       
    52 // ----------------------------------------------------------------------------
       
    53 //
       
    54 EXPORT_C CImumInternalApi* CreateEmailApiL( CMsvSession* aMsvSession )
       
    55     {
       
    56     IMUM_STATIC_CONTEXT( CreateEmailApiL, 0, utils, KLogInApi );
       
    57     IMUM1_IN( "aMsvSession: 0x%x", aMsvSession );
       
    58     IMUM_OUT();
       
    59 
       
    60     return CImumInternalApiImpl::NewL( aMsvSession );
       
    61     }
       
    62 
       
    63 // ----------------------------------------------------------------------------
       
    64 // CreateEmailApiLC()
       
    65 // ----------------------------------------------------------------------------
       
    66 //
       
    67 EXPORT_C CImumInternalApi* CreateEmailApiLC( CMsvSession* aMsvSession )
       
    68     {
       
    69     IMUM_STATIC_CONTEXT( CreateEmailApiLC, 0, utils, KLogInApi );
       
    70     IMUM1_IN( "aMsvSession: 0x%x", aMsvSession );
       
    71     IMUM_OUT();
       
    72 
       
    73     return CImumInternalApiImpl::NewLC( aMsvSession );
       
    74     }
       
    75 
       
    76 // ============================ MEMBER FUNCTIONS ===============================
       
    77 
       
    78 // ----------------------------------------------------------------------------
       
    79 // CImumInternalApiImpl::NewL()
       
    80 // ----------------------------------------------------------------------------
       
    81 //
       
    82 CImumInternalApiImpl* CImumInternalApiImpl::NewL( CMsvSession* aMsvSession )
       
    83     {
       
    84     IMUM_STATIC_CONTEXT( CImumInternalApiImpl::NewL, 0, utils, KLogInApi );
       
    85     IMUM1_IN( "aMsvSession: 0x%x", aMsvSession );
       
    86 
       
    87     CImumInternalApiImpl* self = NewLC( aMsvSession );
       
    88     CleanupStack::Pop( self );
       
    89 
       
    90     IMUM_OUT();
       
    91 
       
    92     return self;
       
    93     }
       
    94 
       
    95 // ----------------------------------------------------------------------------
       
    96 // CImumInternalApiImpl::NewLC()
       
    97 // ----------------------------------------------------------------------------
       
    98 //
       
    99 CImumInternalApiImpl* CImumInternalApiImpl::NewLC( CMsvSession* aMsvSession )
       
   100     {
       
   101     IMUM_STATIC_CONTEXT( CImumInternalApiImpl::NewLC, 0, utils, KLogInApi );
       
   102     IMUM1_IN( "aMsvSession: 0x%x", aMsvSession );
       
   103 
       
   104     CImumInternalApiImpl* self =
       
   105         new ( ELeave ) CImumInternalApiImpl( aMsvSession );
       
   106     CleanupStack::PushL( self );
       
   107     self->ConstructL();
       
   108 
       
   109     IMUM_OUT();
       
   110 
       
   111     return self;
       
   112     }
       
   113 
       
   114 // ----------------------------------------------------------------------------
       
   115 // CImumInternalApiImpl::ConstructL()
       
   116 // ----------------------------------------------------------------------------
       
   117 //
       
   118 void CImumInternalApiImpl::ConstructL()
       
   119     {
       
   120     IMUM_CONTEXT( CImumInternalApiImpl::ConstructL, 0, KLogInApi );
       
   121     IMUM_IN();
       
   122 
       
   123     // Retrieve all the feature flags
       
   124     iFlags = MsvEmailMtmUiFeatureUtils::EmailFeaturesL( ETrue, ETrue );
       
   125 
       
   126     // Make sure the message server session is open
       
   127     CreateMsvSession();
       
   128 
       
   129     CCoeEnv* env = CCoeEnv::Static();
       
   130 
       
   131     //Resourceloader won't be needed if CCoeEnv not present
       
   132     if( env )
       
   133         {
       
   134         iFlags->SetFlag( EHasUi );
       
   135         iResourceLoader = new (ELeave) RConeResourceLoader( *env );
       
   136         MsvEmailMtmUiUtils::LoadResourceFileL( *iResourceLoader );
       
   137         }
       
   138 
       
   139     IMUM_OUT();
       
   140     }
       
   141 
       
   142 // ----------------------------------------------------------------------------
       
   143 // CImumInternalApiImpl::CImumInternalApiImpl()
       
   144 // ----------------------------------------------------------------------------
       
   145 //
       
   146 CImumInternalApiImpl::CImumInternalApiImpl( CMsvSession* aMsvSession )
       
   147     :
       
   148     iFlags( NULL ),
       
   149     iMsvSession( aMsvSession ),
       
   150     iMailboxManager( NULL ),
       
   151     iHealthServices( NULL ),
       
   152     iMboxSettingsCtrl( NULL ),
       
   153     iAccounts( NULL ),
       
   154     iMailboxUtilities( NULL ),
       
   155     iMailboxServices( NULL ),
       
   156     iResourceLoader( NULL )
       
   157     {
       
   158     IMUM_CONTEXT( CImumInternalApiImpl::CImumInternalApiImpl, 0, KLogInApi );
       
   159     IMUM1_IN( "aMsvSession: 0x%x", aMsvSession );
       
   160     IMUM_OUT();
       
   161     }
       
   162 
       
   163 // ----------------------------------------------------------------------------
       
   164 // CImumInternalApiImpl::
       
   165 // ----------------------------------------------------------------------------
       
   166 //
       
   167 CImumInternalApiImpl::~CImumInternalApiImpl()
       
   168     {
       
   169     IMUM_CONTEXT( CImumInternalApiImpl::~CImumInternalApiImpl, 0, KLogInApi );
       
   170     IMUM_IN();
       
   171 
       
   172     // Remove the observer here since incoming events are not interesting at
       
   173     // this point
       
   174     if ( iMsvSession )
       
   175         {
       
   176         iMsvSession->RemoveObserver( *this );
       
   177         }
       
   178 
       
   179     if ( iResourceLoader )
       
   180         {
       
   181         iResourceLoader->Close();
       
   182         delete iResourceLoader;
       
   183         }
       
   184     iResourceLoader = NULL;
       
   185 
       
   186     delete iMailboxManager;
       
   187     delete iHealthServices;
       
   188     delete iMboxSettingsCtrl;
       
   189     delete iAccounts;
       
   190     delete iMailboxUtilities;
       
   191     delete iMailboxServices;
       
   192     delete iCommDbUtils;
       
   193 
       
   194     // Destroy the session here since there is a chance that some of the
       
   195     // above objects may have used this session to create objects, so now
       
   196     // they can do cleanup in peace.
       
   197     if ( iFlags && iFlags->Flag( ESessionOwned ) )
       
   198         {
       
   199         delete iMsvSession;
       
   200         }
       
   201     delete iFlags;
       
   202 
       
   203     IMUM_OUT();
       
   204     }
       
   205 
       
   206 // ---------------------------------------------------------------------------
       
   207 // CImumInternalApiImpl::ServiceExceptionL()
       
   208 // ---------------------------------------------------------------------------
       
   209 //
       
   210 void CImumInternalApiImpl::ServiceExceptionL(
       
   211     const TInt aErrorCode ) const
       
   212     {
       
   213     IMUM_CONTEXT( CImumInternalApiImpl::ServiceExceptionL, 0, KLogInApi );
       
   214     IMUM_IN();
       
   215 
       
   216     IMUM1( 0, "*!!!!!* EXCEPTION %d *!!!!!*", aErrorCode );
       
   217 
       
   218     __ASSERT_DEBUG( EFalse,
       
   219         User::Panic( KImumInternalApi, aErrorCode ) );
       
   220 
       
   221     IMUM_OUT();
       
   222     User::Leave( aErrorCode );
       
   223     }
       
   224 
       
   225 /******************************************************************************
       
   226 
       
   227     Get Methods
       
   228 
       
   229 ******************************************************************************/
       
   230 
       
   231 void CImumInternalApiImpl::Reset()
       
   232     {
       
   233     IMUM_CONTEXT( CImumInternalApiImpl::Reset, 0, KLogInApi );
       
   234     IMUM_IN();
       
   235 
       
   236     delete iMailboxManager;
       
   237     iMailboxManager = NULL;
       
   238     delete iHealthServices;
       
   239     iHealthServices = NULL;
       
   240     delete iMboxSettingsCtrl;
       
   241     iMboxSettingsCtrl = NULL;
       
   242     delete iAccounts;
       
   243     iAccounts = NULL;
       
   244     delete iMailboxUtilities;
       
   245     iMailboxUtilities = NULL;
       
   246 
       
   247     // Delete the session when owned, but don't touch it, when delivered
       
   248     // from outside. The component outside should take care of updating
       
   249     // the session.
       
   250     if ( iFlags && iFlags->Flag( ESessionOwned ) )
       
   251         {
       
   252         iFlags->ClearFlag( EObserverSet );
       
   253         delete iMsvSession;
       
   254         iMsvSession = NULL;
       
   255         }
       
   256 
       
   257     iFlags->ClearFlag( EServicesReady );
       
   258 
       
   259     IMUM_OUT();
       
   260     }
       
   261 
       
   262 // ----------------------------------------------------------------------------
       
   263 // CImumInternalApiImpl::EmailAccountsL()
       
   264 // ----------------------------------------------------------------------------
       
   265 //
       
   266 CEmailAccounts& CImumInternalApiImpl::EmailAccountsL()
       
   267     {
       
   268     if ( !iAccounts )
       
   269         {
       
   270         iAccounts = CEmailAccounts::NewL();
       
   271         }
       
   272 
       
   273     return *iAccounts;
       
   274     }
       
   275 
       
   276 // ----------------------------------------------------------------------------
       
   277 // CImumInternalApiImpl::MailboxDoctorL()
       
   278 // ----------------------------------------------------------------------------
       
   279 //
       
   280 CImumInHealthServicesImpl& CImumInternalApiImpl::MailboxDoctorL()
       
   281     {
       
   282     if ( !iHealthServices )
       
   283         {
       
   284         iHealthServices = CImumInHealthServicesImpl::NewL( *this );
       
   285         }
       
   286 
       
   287     return *iHealthServices;
       
   288     }
       
   289 
       
   290 // ----------------------------------------------------------------------------
       
   291 // CImumInternalApiImpl::SettingsManagerL()
       
   292 // ----------------------------------------------------------------------------
       
   293 //
       
   294 CImumMboxManager& CImumInternalApiImpl::SettingsManagerL()
       
   295     {
       
   296     if ( !iMailboxManager )
       
   297         {
       
   298         iMailboxManager = CImumMboxManager::NewL( *this );
       
   299         }
       
   300 
       
   301     return *iMailboxManager;
       
   302     }
       
   303 
       
   304 // ----------------------------------------------------------------------------
       
   305 // CImumInternalApiImpl::SettingsStorerL()
       
   306 // ----------------------------------------------------------------------------
       
   307 //
       
   308 CImumMboxSettingsCtrl& CImumInternalApiImpl::SettingsStorerL()
       
   309     {
       
   310     if ( !iMboxSettingsCtrl )
       
   311         {
       
   312         iMboxSettingsCtrl = CImumMboxSettingsCtrl::NewL( *this );
       
   313         }
       
   314 
       
   315     return *iMboxSettingsCtrl;
       
   316     }
       
   317 
       
   318 // ---------------------------------------------------------------------------
       
   319 // CImumInternalApiImpl::MailboxServicesImplL()
       
   320 // ---------------------------------------------------------------------------
       
   321 //
       
   322 CImumInMailboxServicesImpl& CImumInternalApiImpl::MailboxServicesImplL()
       
   323     {
       
   324     if ( !iMailboxServices )
       
   325         {
       
   326         iMailboxServices = CImumInMailboxServicesImpl::NewL( *this );
       
   327         }
       
   328 
       
   329     return *iMailboxServices;
       
   330     }
       
   331 
       
   332 // ---------------------------------------------------------------------------
       
   333 // CImumInternalApiImpl::Flags()
       
   334 // ---------------------------------------------------------------------------
       
   335 //
       
   336 const CMuiuFlags& CImumInternalApiImpl::Flags()
       
   337     {
       
   338     return *iFlags;
       
   339     }
       
   340 
       
   341 // ---------------------------------------------------------------------------
       
   342 // CImumInternalApiImpl::CommDbUtils2L()
       
   343 // ---------------------------------------------------------------------------
       
   344 //
       
   345 CMsvCommDbUtilities& CImumInternalApiImpl::CommDbUtilsL()
       
   346     {
       
   347     if ( !iCommDbUtils )
       
   348         {
       
   349         iCommDbUtils = CMsvCommDbUtilities::NewL();
       
   350         iCommDbUtils->InitializeSelectionL();
       
   351         }
       
   352 
       
   353     return *iCommDbUtils;
       
   354     }
       
   355 
       
   356 
       
   357 /******************************************************************************
       
   358 
       
   359     Message Server functionality
       
   360 
       
   361 ******************************************************************************/
       
   362 
       
   363 // ---------------------------------------------------------------------------
       
   364 // CImumInternalApiImpl::HandleSessionEventL()
       
   365 // ---------------------------------------------------------------------------
       
   366 //
       
   367 void CImumInternalApiImpl::HandleSessionEventL(
       
   368     TMsvSessionEvent aEvent,
       
   369     TAny* /*aArg1*/,
       
   370     TAny* /*aArg2*/,
       
   371     TAny* /*aArg3*/ )
       
   372     {
       
   373     IMUM_CONTEXT( CImumInternalApiImpl::HandleSessionEventL, 0, KLogInApi );
       
   374     IMUM1_IN( "aEvent: %d", aEvent );
       
   375 
       
   376     // Handle the events
       
   377     switch ( aEvent )
       
   378         {
       
   379         // On media changed and server termination, remove reset all of the
       
   380         // API's objects.
       
   381         case EMsvServerTerminated:
       
   382             Reset();
       
   383             break;
       
   384 
       
   385         // When ready, recreate the API objects
       
   386         case EMsvMediaAvailable:
       
   387         case EMsvServerReady:
       
   388         case EMsvMediaChanged:
       
   389             ReloadL();
       
   390             break;
       
   391         }
       
   392 
       
   393     IMUM_OUT();
       
   394     }
       
   395 
       
   396 // ---------------------------------------------------------------------------
       
   397 // CImumInternalApiImpl::ReloadL()
       
   398 // ---------------------------------------------------------------------------
       
   399 //
       
   400 void CImumInternalApiImpl::ReloadL()
       
   401     {
       
   402     IMUM_CONTEXT( CImumInternalApiImpl::ReloadL, 0, KLogInApi );
       
   403     IMUM_IN();
       
   404 
       
   405     Reset();
       
   406     DoCreateMsvSessionL();
       
   407 
       
   408     // Make sure that if for some reason default mailbox information
       
   409     // is lost, find a valid mailbox from the system and set it as a default.
       
   410     // This kind of situation may occur after swapping the message storage
       
   411     // between phone and memory card.
       
   412     if ( iFlags->Flag( EHasUi ) )
       
   413         {
       
   414         MailboxUtilitiesL().DefaultMailboxId( ETrue );
       
   415         }
       
   416 
       
   417     IMUM_OUT();
       
   418     }
       
   419 
       
   420 // ---------------------------------------------------------------------------
       
   421 // CImumInternalApiImpl::CreateMsvSession()
       
   422 // ---------------------------------------------------------------------------
       
   423 //
       
   424 CMsvSession* CImumInternalApiImpl::CreateMsvSession()
       
   425     {
       
   426     IMUM_CONTEXT( CImumInternalApiImpl::CreateMsvSession, 0, KLogInApi );
       
   427     IMUM_IN();
       
   428 
       
   429     // Catch leaves. The method should not leave and there just
       
   430     // is no possibility that this would fail...
       
   431     TRAP_IGNORE( iMsvSession = DoCreateMsvSessionL() );
       
   432 
       
   433     IMUM_OUT();
       
   434 
       
   435     return iMsvSession;
       
   436     }
       
   437 
       
   438 // ---------------------------------------------------------------------------
       
   439 // CImumInternalApiImpl::DoCreateMsvSessionL()
       
   440 // ---------------------------------------------------------------------------
       
   441 //
       
   442 CMsvSession* CImumInternalApiImpl::DoCreateMsvSessionL()
       
   443     {
       
   444     IMUM_CONTEXT( CImumInternalApiImpl::DoCreateMsvSessionL, 0, KLogInApi );
       
   445     IMUM_IN();
       
   446 
       
   447     if ( !iMsvSession )
       
   448         {
       
   449         IMUM0( 0, "No session, create new" );
       
   450 
       
   451         iFlags->SetFlag( ESessionOwned );
       
   452         iMsvSession = CMsvSession::OpenSyncL( *this );
       
   453         iFlags->ClearFlag( EObserverSet );
       
   454         }
       
   455 
       
   456     // To prevent adding multiple observers to list, check if
       
   457     // already assigned
       
   458     if ( !iFlags->Flag( EObserverSet ) )
       
   459         {
       
   460         IMUM0( 0, "Not an observer, make it so" );
       
   461 
       
   462         iMsvSession->AddObserverL( *this );
       
   463         iFlags->SetFlag( EObserverSet );
       
   464         }
       
   465 
       
   466     iFlags->SetFlag( EServicesReady );
       
   467 
       
   468     IMUM_OUT();
       
   469 
       
   470     return iMsvSession;
       
   471     }
       
   472 
       
   473 /******************************************************************************
       
   474 
       
   475     Interface Methods
       
   476 
       
   477 ******************************************************************************/
       
   478 
       
   479 // ----------------------------------------------------------------------------
       
   480 // CImumInternalApiImpl::HealthServicesL()
       
   481 // ----------------------------------------------------------------------------
       
   482 //
       
   483 CMsvSession& CImumInternalApiImpl::MsvSession()
       
   484     {
       
   485     IMUM_CONTEXT( CImumInternalApiImpl::MsvSession, 0, KLogInApi );
       
   486     IMUM_IN();
       
   487 
       
   488     // It is possible, that session is destroyed outside, but to the API.
       
   489     // Here it must be made sure, that working session is provided.
       
   490     if ( !iMsvSession )
       
   491         {
       
   492         // It should be made sure that session exists... wait if have to
       
   493         CreateMsvSession();
       
   494         }
       
   495 
       
   496     IMUM_OUT();
       
   497 
       
   498     return *iMsvSession;
       
   499     }
       
   500 
       
   501 // ----------------------------------------------------------------------------
       
   502 // CImumInternalApiImpl::HealthServicesL()
       
   503 // ----------------------------------------------------------------------------
       
   504 //
       
   505 const MImumInHealthServices& CImumInternalApiImpl::HealthServicesL()
       
   506     {
       
   507     IMUM_CONTEXT( CImumInternalApiImpl::HealthServicesL, 0, KLogInApi );
       
   508     IMUM_IN();
       
   509 
       
   510     if ( !iFlags->Flag( EServicesReady ) )
       
   511         {
       
   512         ServiceExceptionL( TImumDaErrorCode::EServicesNotReady );
       
   513         }
       
   514 
       
   515     IMUM_OUT();
       
   516 
       
   517     return MailboxDoctorL();
       
   518     }
       
   519 
       
   520 // ----------------------------------------------------------------------------
       
   521 // CImumInternalApiImpl::HealthApiL()
       
   522 // ----------------------------------------------------------------------------
       
   523 //
       
   524 const MImumInHealthServices& CImumInternalApiImpl::HealthApiL()
       
   525     {
       
   526     IMUM_CONTEXT( CImumInternalApiImpl::HealthApiL, 0, KLogInApi );
       
   527     IMUM_IN();
       
   528 
       
   529     IMUM0( 0, "THIS IS DEPRECATED METHOD" );
       
   530 
       
   531     IMUM_OUT();
       
   532     return HealthServicesL();
       
   533     }
       
   534 
       
   535 // ---------------------------------------------------------------------------
       
   536 // CImumInternalApiImpl::MailboxUtilities()
       
   537 // ---------------------------------------------------------------------------
       
   538 //
       
   539 const MImumInMailboxUtilities& CImumInternalApiImpl::MailboxUtilitiesL()
       
   540     {
       
   541     IMUM_CONTEXT( CImumInternalApiImpl::MailboxUtilitiesL, 0, KLogInApi );
       
   542     IMUM_IN();
       
   543 
       
   544     if ( !iFlags->Flag( EServicesReady ) )
       
   545         {
       
   546         ServiceExceptionL( TImumDaErrorCode::EServicesNotReady );
       
   547         }
       
   548 
       
   549     if ( !iMailboxUtilities )
       
   550         {
       
   551         iMailboxUtilities = CImumInMailboxUtilitiesImpl::NewL( *this );
       
   552         }
       
   553 
       
   554     IMUM_OUT();
       
   555 
       
   556     return *iMailboxUtilities;
       
   557     }
       
   558 
       
   559 // ---------------------------------------------------------------------------
       
   560 // CImumInternalApiImpl::MailboxUtilities()
       
   561 // ---------------------------------------------------------------------------
       
   562 //
       
   563 const MImumInMailboxServices& CImumInternalApiImpl::MailboxServicesL()
       
   564     {
       
   565     IMUM_CONTEXT( CImumInternalApiImpl::MailboxServicesL, 0, KLogInApi );
       
   566     IMUM_IN();
       
   567 
       
   568     if ( !iFlags->Flag( EServicesReady ) )
       
   569         {
       
   570         ServiceExceptionL( TImumDaErrorCode::EServicesNotReady );
       
   571         }
       
   572 
       
   573     IMUM_OUT();
       
   574 
       
   575     return MailboxServicesImplL();
       
   576     }
       
   577 
       
   578 // ---------------------------------------------------------------------------
       
   579 // CImumInternalApiImpl::IsEmailFeatureSupported()
       
   580 // ---------------------------------------------------------------------------
       
   581 //
       
   582 TBool CImumInternalApiImpl::IsEmailFeatureSupportedL(
       
   583     const TEmailFeatures aFlag,
       
   584     const TUint aFeatureOnResource,
       
   585     const TUint aFeatureOffResource )
       
   586     {
       
   587     IMUM_CONTEXT( CImumInternalApiImpl::IsEmailFeatureSupportedL, 0, KLogInApi );
       
   588     IMUM3_IN( "aFlag = %d, aFeatureOnResource = 0x%x, aFeatureOffResource = 0x%x",
       
   589         aFlag, aFeatureOnResource, aFeatureOffResource );
       
   590     TBool ret = EFalse;
       
   591 
       
   592     switch ( aFlag )
       
   593         {
       
   594         case EMailLockedSettings :
       
   595             ret = iFlags->GF( EMailFeatureIdSapPolicyManagement );
       
   596             break;
       
   597         default :
       
   598             break;
       
   599         }
       
   600 
       
   601     if( ret && aFeatureOnResource )
       
   602         {
       
   603         CIMSSettingsNoteUi::ShowNoteL(
       
   604             aFeatureOnResource,
       
   605             EIMSInformationNote );
       
   606         }
       
   607     else if( ret == EFalse && aFeatureOffResource )
       
   608         {
       
   609         CIMSSettingsNoteUi::ShowNoteL(
       
   610             aFeatureOffResource,
       
   611             EIMSInformationNote );
       
   612         }
       
   613     else
       
   614         {
       
   615         //Do not show notes.
       
   616         }
       
   617 
       
   618     IMUM_OUT();
       
   619 
       
   620     return ret;
       
   621     }
       
   622 
       
   623 // End of File