|         |      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:  | 
|         |     15 *       Class implementation file | 
|         |     16 * | 
|         |     17 */ | 
|         |     18  | 
|         |     19  | 
|         |     20 // INCLUDE FILES | 
|         |     21 #include <e32base.h> | 
|         |     22 #include <msvapi.h>                 // CMsvSession | 
|         |     23 #include <eikfrlb.h>                // CEikFormattedCellListBox | 
|         |     24 #include <eikappui.h> | 
|         |     25 #include <avkon.hrh>                // EAknSoftkeyCancel | 
|         |     26 #include <aknappui.h>               // CAknAppUi | 
|         |     27 #include <AknsDrawUtils.h> | 
|         |     28 #include <eikspane.h>               // CEikStatusPane | 
|         |     29 #include <akntitle.h>               // CAknTitlePane | 
|         |     30 #include <hlplch.h>                 // HlpLauncher | 
|         |     31 #include <msvids.h>                 // KMsvNullIndexEntryId | 
|         |     32 #include <muiuflagger.h>            // CFlags | 
|         |     33 #include <eikrted.h>                // CEikRichTextEditor | 
|         |     34 #include <txtrich.h>                // CRichText | 
|         |     35 #include <f32file.h>                // TParse | 
|         |     36 #include <ImumInSettingsData.h>     // CImumInSettingsData | 
|         |     37 #include <bldvariant.hrh> | 
|         |     38 #include <csxhelp/mce.hlp.hrh> | 
|         |     39 #include <ImumUtils.rsg> | 
|         |     40 #include <AiwServiceHandler.h>      //CAiwServiceHandler | 
|         |     41 #include <AiwCommon.h>              //CAiwCriteriaItem | 
|         |     42 #include <AiwVariant.h>             //TAiwVariant | 
|         |     43 #include <AknIconArray.h> | 
|         |     44 #include <aknlists.h> | 
|         |     45 #include <pathinfo.h> | 
|         |     46 #include <muiu.mbg> | 
|         |     47 #include <data_caging_path_literals.hrh> | 
|         |     48 #include <aknlayoutscalable_apps.cdl.h> | 
|         |     49  | 
|         |     50 #include <aknViewAppUi.h>           //CAknViewAppUi | 
|         |     51 #include <akninputblock.h>          // CAknInputBlock | 
|         |     52 #include <eikapp.h>                 // CEikApplication | 
|         |     53  | 
|         |     54 #include "ImumInternalApiImpl.h"    // CImumInternalApiImpl | 
|         |     55 #include "IMSSettingsUi.h" | 
|         |     56 #include "IMSSettingsBaseUi.h" | 
|         |     57 #include "IMSSettingsWizard.h" | 
|         |     58 #include "IMSSettingsDialog.h" | 
|         |     59 #include "ImumMboxManager.h" | 
|         |     60 #include "ImumPanic.h" | 
|         |     61 #include "EmailFeatureUtils.h" | 
|         |     62 #include "EmailUtils.H" | 
|         |     63 #include "ImumUtilsLogging.h" | 
|         |     64 #include "IMSWizardControl.h" | 
|         |     65  | 
|         |     66 // EXTERNAL DATA STRUCTURES | 
|         |     67 // EXTERNAL FUNCTION PROTOTYPES | 
|         |     68 // CONSTANTS | 
|         |     69 const TInt KIMSOptionsMenuItemCount = 4; | 
|         |     70  | 
|         |     71 const TInt KIMSMaxEmailAddressSize = 100; | 
|         |     72  | 
|         |     73 _LIT( KMuiuBitmapFile, "z:muiu.MBM" ); | 
|         |     74  | 
|         |     75 const TInt KMceUid = 0x100058C5; | 
|         |     76  | 
|         |     77 // MACROS | 
|         |     78 // LOCAL CONSTANTS AND MACROS | 
|         |     79 // MODULE DATA STRUCTURES | 
|         |     80 // LOCAL FUNCTION PROTOTYPES | 
|         |     81 // FORWARD DECLARATIONS | 
|         |     82  | 
|         |     83 // ============================ MEMBER FUNCTIONS =============================== | 
|         |     84  | 
|         |     85 // ---------------------------------------------------------------------------- | 
|         |     86 // CIMSSettingsUi::NewAccountL | 
|         |     87 // ---------------------------------------------------------------------------- | 
|         |     88 // | 
|         |     89 EXPORT_C TMsvId CIMSSettingsUi::NewAccountL( | 
|         |     90     TImumUiExitCodes& aExitCode, | 
|         |     91     CImumInSettingsData& aMailboxSettings, | 
|         |     92     CMsvSession& aMsvSession ) | 
|         |     93     { | 
|         |     94     IMUM_STATIC_CONTEXT( CIMSSettingsUi::NewAccountL, 0, utils, KLogUi ); | 
|         |     95  | 
|         |     96     return NewAccountL( aExitCode, | 
|         |     97 			aMailboxSettings, | 
|         |     98 			aMsvSession, | 
|         |     99 			EFalse ); | 
|         |    100     } | 
|         |    101  | 
|         |    102 // ---------------------------------------------------------------------------- | 
|         |    103 // CIMSSettingsUi::NewAccountL | 
|         |    104 // ---------------------------------------------------------------------------- | 
|         |    105 // | 
|         |    106 EXPORT_C TMsvId CIMSSettingsUi::NewAccountL( | 
|         |    107     TImumUiExitCodes& aExitCode, | 
|         |    108     CImumInSettingsData& aMailboxSettings, | 
|         |    109     CMsvSession& aMsvSession, | 
|         |    110     TBool aDefaultWizOnly ) | 
|         |    111     { | 
|         |    112     CEikApplication* app = reinterpret_cast<CAknViewAppUi*>( | 
|         |    113         CEikonEnv::Static()->EikAppUi())->Application(); | 
|         |    114  | 
|         |    115     TMsvId emailID = 0; | 
|         |    116     TInt err = KErrGeneral; | 
|         |    117     RBuf email; | 
|         |    118     email.Create( KIMSMaxEmailAddressSize ); | 
|         |    119     CleanupClosePushL( email ); | 
|         |    120  | 
|         |    121     if( !aDefaultWizOnly ) | 
|         |    122     	{ | 
|         |    123     	// If tried to launch outside of MCE, external-wizard shouldn't be launched | 
|         |    124     	if ( app->AppDllUid() == TUid::Uid( KMceUid ) ) | 
|         |    125     		{ | 
|         |    126     		TRAP( err, LaunchExtWizardL( email, emailID ) ); | 
|         |    127     		} | 
|         |    128     	} | 
|         |    129  | 
|         |    130     // Check how the launch ended, if no external wizard was found | 
|         |    131     // err is set to KErrGeneral | 
|         |    132     if ( err == KErrCancel ) | 
|         |    133     	{ | 
|         |    134     	aExitCode = EImumUiNoChanges; | 
|         |    135     	} | 
|         |    136     // Red key pressed while in external-wizard | 
|         |    137     else if ( err == KLeaveExit ) | 
|         |    138     	{ | 
|         |    139     	aExitCode = EImumUiExit; | 
|         |    140     	} | 
|         |    141     else if ( err == KErrNone ) | 
|         |    142     	{ | 
|         |    143     	aExitCode = EImumUiExtWizardCreated; | 
|         |    144     	aMailboxSettings.SetAttr( TImumDaSettings::EKeyMailboxId, emailID ); | 
|         |    145     	} | 
|         |    146     else | 
|         |    147     	{ | 
|         |    148     	CAknInputBlock::NewLC(); | 
|         |    149     	StartL( | 
|         |    150     			R_IMAS_SETTINGS_WIZARD_DIALOG, | 
|         |    151                 aExitCode, | 
|         |    152                 aMailboxSettings, | 
|         |    153                 aMsvSession, | 
|         |    154                 email ); | 
|         |    155     	CleanupStack::PopAndDestroy(); // CAknInputBlock | 
|         |    156     	} | 
|         |    157  | 
|         |    158     CleanupStack::PopAndDestroy(); // email | 
|         |    159  | 
|         |    160     return emailID; | 
|         |    161     } | 
|         |    162  | 
|         |    163 // ---------------------------------------------------------------------------- | 
|         |    164 // CIMSSettingsUi::EditAccountL | 
|         |    165 // ---------------------------------------------------------------------------- | 
|         |    166 // | 
|         |    167 EXPORT_C void CIMSSettingsUi::EditAccountL( | 
|         |    168     TImumUiExitCodes& aExitCode, | 
|         |    169     CImumInSettingsData& aMailboxSettings, | 
|         |    170     CMsvSession& aMsvSession ) | 
|         |    171     { | 
|         |    172     IMUM_STATIC_CONTEXT( CIMSSettingsUi::EditAccountL, 0, utils, KLogUi ); | 
|         |    173  | 
|         |    174     TBufC<1> dummy; // CSI: 47 # Dummy TBuf. | 
|         |    175  | 
|         |    176     StartL( | 
|         |    177         R_IMAS_SETTINGS_DIALOG, | 
|         |    178         aExitCode, | 
|         |    179         aMailboxSettings, | 
|         |    180         aMsvSession, | 
|         |    181         dummy ); | 
|         |    182     } | 
|         |    183  | 
|         |    184 // --------------------------------------------------------------------------- | 
|         |    185 // CIMSSettingsUi::StartL() | 
|         |    186 // --------------------------------------------------------------------------- | 
|         |    187 // | 
|         |    188 void CIMSSettingsUi::StartL( | 
|         |    189     TInt aResource, | 
|         |    190     TImumUiExitCodes& aExitCode, | 
|         |    191     CImumInSettingsData& aMailboxSettings, | 
|         |    192     CMsvSession& aMsvSession, | 
|         |    193     const TDesC& aEmailAddress ) | 
|         |    194     { | 
|         |    195     IMUM_STATIC_CONTEXT( CIMSSettingsUi::StartL, 0, utils, KLogUi ); | 
|         |    196  | 
|         |    197     // Create the dialog | 
|         |    198     CIMSSettingsUi* self = | 
|         |    199         new ( ELeave ) CIMSSettingsUi( aExitCode, aMailboxSettings ); | 
|         |    200     CleanupStack::PushL( self ); | 
|         |    201     self->SettingsConstructL( aResource, aMsvSession, aEmailAddress ); | 
|         |    202     CleanupStack::Pop( self ); | 
|         |    203  | 
|         |    204     self->ExecuteLD( aResource ); | 
|         |    205     } | 
|         |    206  | 
|         |    207  | 
|         |    208 // ---------------------------------------------------------------------------- | 
|         |    209 // CIMSSettingsUi::CIMSSettingsUi | 
|         |    210 // ---------------------------------------------------------------------------- | 
|         |    211 // | 
|         |    212 CIMSSettingsUi::CIMSSettingsUi( | 
|         |    213     TImumUiExitCodes& aExitCode, | 
|         |    214     CImumInSettingsData& aMailboxSettings ) | 
|         |    215     : | 
|         |    216     iFlags( NULL ), | 
|         |    217     iExitCode( aExitCode ), | 
|         |    218     iMailboxSettings( aMailboxSettings ), | 
|         |    219     iListBox( NULL ), | 
|         |    220     iSettings( NULL ), | 
|         |    221     iResourceLoader( *iCoeEnv ), | 
|         |    222     iEmailAddress( NULL ), | 
|         |    223     iWizardContainer( NULL ) | 
|         |    224     { | 
|         |    225     IMUM_CONTEXT( CIMSSettingsUi::CIMSSettingsUi, 0, KLogUi ); | 
|         |    226  | 
|         |    227     } | 
|         |    228  | 
|         |    229 // ---------------------------------------------------------------------------- | 
|         |    230 // CIMSSettingsUi::~CIMSSettingsUi() | 
|         |    231 // ---------------------------------------------------------------------------- | 
|         |    232 // | 
|         |    233 CIMSSettingsUi::~CIMSSettingsUi() | 
|         |    234     { | 
|         |    235     IMUM_CONTEXT( CIMSSettingsUi::~CIMSSettingsUi, 0, KLogUi ); | 
|         |    236  | 
|         |    237     iResourceLoader.Close(); | 
|         |    238     delete iSettings; | 
|         |    239     iSettings = NULL; | 
|         |    240  | 
|         |    241     // Prevents CONE 8 panics. | 
|         |    242     if ( iFlags->Flag( EImumSettingsWizard ) ) | 
|         |    243         { | 
|         |    244         // We created the listbox --> we delete it. | 
|         |    245         delete iListBox; | 
|         |    246         iListBox = NULL; | 
|         |    247         } | 
|         |    248     else | 
|         |    249         { | 
|         |    250         // Control function created the listbox | 
|         |    251         // --> we don't own it --> we don't delete it | 
|         |    252         iListBox = NULL; | 
|         |    253         } | 
|         |    254  | 
|         |    255  | 
|         |    256     delete iFlags; | 
|         |    257     iFlags = NULL; | 
|         |    258  | 
|         |    259     delete iMailboxApi; | 
|         |    260     iMailboxApi = NULL; | 
|         |    261     delete iEmailAddress; | 
|         |    262     iEmailAddress = NULL; | 
|         |    263  | 
|         |    264     // not owned: | 
|         |    265     iWizardContainer = NULL; | 
|         |    266     } | 
|         |    267  | 
|         |    268 // ---------------------------------------------------------------------------- | 
|         |    269 // CIMSSettingsUi::SettingsConstructL() | 
|         |    270 // ---------------------------------------------------------------------------- | 
|         |    271 // | 
|         |    272 void CIMSSettingsUi::SettingsConstructL( | 
|         |    273     const TInt aResource, | 
|         |    274     CMsvSession& aMsvSession, | 
|         |    275     const TDesC& aEmailAddress ) | 
|         |    276     { | 
|         |    277     IMUM_CONTEXT( CIMSSettingsUi::SettingsConstructL, 0, KLogUi ); | 
|         |    278  | 
|         |    279     iEmailAddress = aEmailAddress.AllocL(); | 
|         |    280  | 
|         |    281     // Create connection to mailbox interface | 
|         |    282     iMailboxApi = CImumInternalApiImpl::NewL( &aMsvSession ); | 
|         |    283  | 
|         |    284     // Create flags object | 
|         |    285     iFlags = MsvEmailMtmUiFeatureUtils::EmailFeaturesLC( ETrue, ETrue ); | 
|         |    286     CleanupStack::Pop( iFlags ); | 
|         |    287  | 
|         |    288     if ( aResource == R_IMAS_SETTINGS_WIZARD_DIALOG ) | 
|         |    289         { | 
|         |    290         iFlags->SetFlag( EImumSettingsWizard ); | 
|         |    291         iResourceMenuBar = R_IMAS_SETTINGS_WIZARD_MENUBAR; | 
|         |    292         } | 
|         |    293     else | 
|         |    294         { | 
|         |    295         iResourceMenuBar = R_IMAS_MENUBAR; | 
|         |    296         } | 
|         |    297  | 
|         |    298     // Call the base ConstructL | 
|         |    299     ConstructL( iResourceMenuBar ); | 
|         |    300  | 
|         |    301     MsvEmailMtmUiUtils::LoadResourceFileL( iResourceLoader ); | 
|         |    302     } | 
|         |    303  | 
|         |    304 // --------------------------------------------------------------------------- | 
|         |    305 // From class . | 
|         |    306 // CIMSSettingsUi::ExitCode() | 
|         |    307 // --------------------------------------------------------------------------- | 
|         |    308 // | 
|         |    309 TImumUiExitCodes CIMSSettingsUi::ExitCode() | 
|         |    310     { | 
|         |    311     IMUM_CONTEXT( CIMSSettingsUi::ExitCode, 0, KLogUi ); | 
|         |    312  | 
|         |    313     if ( iFlags->Flag( EImumSettingShouldClose ) ) | 
|         |    314         { | 
|         |    315         return iFlags->Flag( EImumSettingSave ) ? | 
|         |    316             EImumUiSaveAndClose : EImumUiClose; | 
|         |    317         } | 
|         |    318     else if ( iFlags->Flag( EImumSettingShouldExit ) ) | 
|         |    319         { | 
|         |    320         return iFlags->Flag( EImumSettingSave ) ? | 
|         |    321             EImumUiSaveAndExit : EImumUiExit; | 
|         |    322         } | 
|         |    323     else | 
|         |    324         { | 
|         |    325         __ASSERT_DEBUG( | 
|         |    326             EFalse, User::Panic( KIMSSettingsDialogPanic, KErrUnknown ) ); | 
|         |    327         return EImumUiNoChanges; | 
|         |    328         } | 
|         |    329     } | 
|         |    330  | 
|         |    331  | 
|         |    332 // ---------------------------------------------------------------------------- | 
|         |    333 // CIMSSettingsUi::OkToExitL | 
|         |    334 // ---------------------------------------------------------------------------- | 
|         |    335 // | 
|         |    336 TBool CIMSSettingsUi::OkToExitL( TInt aButtonId ) | 
|         |    337     { | 
|         |    338     IMUM_CONTEXT( CIMSSettingsUi::OkToExitL, 0, KLogUi ); | 
|         |    339  | 
|         |    340     TBool allowQuit = EFalse; | 
|         |    341  | 
|         |    342     // Exit not issued, forward the call to command processor | 
|         |    343     if ( !iFlags->Flag( EImumSettingShouldExit ) && | 
|         |    344          !iFlags->Flag( EImumSettingShouldClose ) ) | 
|         |    345         { | 
|         |    346         iSettings->ProcessCommandL( aButtonId ); | 
|         |    347         } | 
|         |    348     else | 
|         |    349         { | 
|         |    350         // Should quit | 
|         |    351         allowQuit = iSettings->OkToExitL( aButtonId ); | 
|         |    352  | 
|         |    353         // Clear the flag after usage | 
|         |    354         iFlags->ClearFlag( EImumSettingQueryClose ); | 
|         |    355  | 
|         |    356         // If quit is allowed, store the settings, otherwise clear the flag | 
|         |    357         if ( allowQuit ) | 
|         |    358             { | 
|         |    359             // Failing to store the settings should cause panic, to prevent | 
|         |    360             // the settings to stop into unwanted errors | 
|         |    361             TRAP_IGNORE( iSettings->StoreSettingsToAccountL( | 
|         |    362                 iMailboxSettings ) ); | 
|         |    363  | 
|         |    364             // Set the exitcode | 
|         |    365             iExitCode = ExitCode(); | 
|         |    366             } | 
|         |    367         else | 
|         |    368             { | 
|         |    369             // Clear the flags | 
|         |    370             iFlags->ClearFlag( EImumSettingShouldExit ); | 
|         |    371             iFlags->ClearFlag( EImumSettingShouldClose ); | 
|         |    372             } | 
|         |    373  | 
|         |    374         // Exit, now | 
|         |    375         if ( allowQuit ) | 
|         |    376             { | 
|         |    377             allowQuit = CAknDialog::OkToExitL( EAknSoftkeyCancel ); | 
|         |    378             } | 
|         |    379         } | 
|         |    380  | 
|         |    381     return allowQuit; | 
|         |    382     } | 
|         |    383  | 
|         |    384 // ---------------------------------------------------------------------------- | 
|         |    385 // CIMSSettingsUi::HandleResourceChange | 
|         |    386 // ---------------------------------------------------------------------------- | 
|         |    387 // | 
|         |    388 void CIMSSettingsUi::HandleResourceChange( TInt aType ) | 
|         |    389     { | 
|         |    390     IMUM_CONTEXT( CIMSSettingsUi::HandleResourceChange, 0, KLogUi ); | 
|         |    391  | 
|         |    392     CAknDialog::HandleResourceChange( aType ); | 
|         |    393  | 
|         |    394     if ( iListBox && aType == KEikDynamicLayoutVariantSwitch ) | 
|         |    395         { | 
|         |    396         TRect rect = Rect(); | 
|         |    397         iListBox->SetRect( rect ); | 
|         |    398         iListBox->HandleResourceChange( aType ); | 
|         |    399         } | 
|         |    400     } | 
|         |    401  | 
|         |    402 // ---------------------------------------------------------------------------- | 
|         |    403 //  CIMSSettingsUi::SetSizeAndPosition() | 
|         |    404 // ---------------------------------------------------------------------------- | 
|         |    405 // | 
|         |    406 void CIMSSettingsUi::SetSizeAndPosition( const TSize& aSize ) | 
|         |    407     { | 
|         |    408     CAknDialog::SetSizeAndPosition( aSize ); | 
|         |    409  | 
|         |    410     // this is fail safe check because iWizardContainer is created | 
|         |    411     // in by framework not in constuctors | 
|         |    412     if ( iWizardContainer ) | 
|         |    413         { | 
|         |    414         iWizardContainer->SetRect(Rect()); | 
|         |    415         } | 
|         |    416  | 
|         |    417     } | 
|         |    418  | 
|         |    419 // ---------------------------------------------------------------------------- | 
|         |    420 // CIMSSettingsUi::PreLayoutDynInitL | 
|         |    421 // ---------------------------------------------------------------------------- | 
|         |    422 // | 
|         |    423 void CIMSSettingsUi::PreLayoutDynInitL() | 
|         |    424     { | 
|         |    425     IMUM_CONTEXT( CIMSSettingsUi::PreLayoutDynInitL, 0, KLogUi ); | 
|         |    426  | 
|         |    427  | 
|         |    428     // Get the pointer to titlepane | 
|         |    429     CEikStatusPane* sp = | 
|         |    430         static_cast<CAknAppUi*>( | 
|         |    431             iEikonEnv->EikAppUi() )->StatusPane(); | 
|         |    432     CAknTitlePane* title = static_cast<CAknTitlePane*>( | 
|         |    433         sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); | 
|         |    434  | 
|         |    435     CEikButtonGroupContainer& cba = ButtonGroupContainer(); | 
|         |    436  | 
|         |    437     // In case no email account created, start the wizard, otherwise | 
|         |    438     // launch the normal settings menu | 
|         |    439     if ( iFlags->Flag( EImumSettingsWizard ) ) | 
|         |    440         { | 
|         |    441         // Prepare the dummy listbox, needed by CIMSSettingsWizard and its | 
|         |    442         // super classes. | 
|         |    443         iListBox = new (ELeave) CEikFormattedCellListBox; | 
|         |    444         iListBox->ConstructL( this, EAknListBoxSelectionList ); | 
|         |    445  | 
|         |    446         iSettings = CIMSSettingsWizard::NewL( | 
|         |    447             *this, *iMailboxApi, | 
|         |    448             *iListBox, *iWizardContainer, *title, cba, *iFlags, *iEmailAddress ); | 
|         |    449  | 
|         |    450         MAknsControlContext* context = | 
|         |    451             AknsDrawUtils::ControlContext( iListBox ); | 
|         |    452  | 
|         |    453         // iWizardContainer is created by framework not in constructors | 
|         |    454         // leave if it not created | 
|         |    455         if ( iWizardContainer == NULL ) | 
|         |    456             { | 
|         |    457             User::Leave(0); | 
|         |    458             } | 
|         |    459         iWizardContainer->SetBackgroundContext( context ); | 
|         |    460         } | 
|         |    461     else | 
|         |    462         { | 
|         |    463         // Prepare the listbox | 
|         |    464         iListBox = static_cast<CEikFormattedCellListBox*>( | 
|         |    465             Control( EImasCIDListBox ) ); | 
|         |    466  | 
|         |    467         //Check if mail settings are locked | 
|         |    468         if( iFlags->GF( EMailFeatureIdSapPolicyManagement ) ) | 
|         |    469             { | 
|         |    470             LoadListboxIconArrayL(); | 
|         |    471             } | 
|         |    472  | 
|         |    473         iSettings = CIMSSettingsDialog::NewL( | 
|         |    474             *this, *iMailboxApi, | 
|         |    475             *iListBox, *title, cba, *iFlags, iMailboxSettings ); | 
|         |    476         } | 
|         |    477     } | 
|         |    478  | 
|         |    479 // ---------------------------------------------------------------------------- | 
|         |    480 // CIMSSettingsUi::LaunchExtWizardL | 
|         |    481 // ---------------------------------------------------------------------------- | 
|         |    482 // | 
|         |    483 void CIMSSettingsUi::LaunchExtWizardL( TDes& aEmailAddress, TMsvId& aMailboxId ) | 
|         |    484     { | 
|         |    485     CAiwGenericParamList* outParamList = CAiwGenericParamList::NewLC(); | 
|         |    486  | 
|         |    487     // Create AIW service handler | 
|         |    488     CAiwServiceHandler* serviceHandler = CAiwServiceHandler::NewLC(); | 
|         |    489  | 
|         |    490     // Attach the interest to the AIW framework. | 
|         |    491     serviceHandler->AttachL( R_AIW_EMAIL_CRITERIA ); | 
|         |    492  | 
|         |    493     serviceHandler->ExecuteServiceCmdL( | 
|         |    494         KAiwCmdSettingWizardEmailView, | 
|         |    495         serviceHandler->InParamListL(), | 
|         |    496         *outParamList ); | 
|         |    497  | 
|         |    498     TInt error = KErrGeneral; | 
|         |    499     if ( outParamList->Count() ) | 
|         |    500         { | 
|         |    501         TInt paramPos = 0; //Just to send something | 
|         |    502         const TAiwGenericParam* errorParam = | 
|         |    503             outParamList->FindFirst( paramPos, EGenericParamError ); | 
|         |    504  | 
|         |    505         error = errorParam->Value().AsTInt32(); | 
|         |    506         if ( error == KErrGeneral ) | 
|         |    507             { | 
|         |    508             const TAiwGenericParam* emailParam = outParamList->FindFirst( | 
|         |    509                 paramPos, | 
|         |    510                 EGenericParamEmailAddress ); | 
|         |    511 			if ( emailParam ) | 
|         |    512 				{ | 
|         |    513 	            aEmailAddress = emailParam->Value().AsDes(); | 
|         |    514 				} | 
|         |    515             } | 
|         |    516         else if ( error == KErrNone ) | 
|         |    517             { | 
|         |    518             const TAiwGenericParam* idParam = outParamList->FindNext( paramPos, | 
|         |    519                 EGenericParamMessageItemMbox ); | 
|         |    520             aMailboxId = idParam->Value().AsTInt32(); | 
|         |    521             } | 
|         |    522         } | 
|         |    523  | 
|         |    524     CleanupStack::PopAndDestroy( 2, outParamList ); // CSI: 47 # serviceHandler, outParamList. | 
|         |    525     serviceHandler = NULL; | 
|         |    526     outParamList = NULL; | 
|         |    527  | 
|         |    528     User::LeaveIfError( error ); | 
|         |    529     } | 
|         |    530  | 
|         |    531 // ---------------------------------------------------------------------------- | 
|         |    532 // CIMSSettingsUi::ProcessCommandL | 
|         |    533 // ---------------------------------------------------------------------------- | 
|         |    534 // | 
|         |    535 void CIMSSettingsUi::ProcessCommandL( TInt aCommandId ) | 
|         |    536     { | 
|         |    537     IMUM_CONTEXT( CIMSSettingsUi::ProcessCommandL, 0, KLogUi ); | 
|         |    538  | 
|         |    539     // Forward the commands | 
|         |    540     CAknDialog::ProcessCommandL( aCommandId ); | 
|         |    541  | 
|         |    542     // Forward command either to wizard or setting dialog | 
|         |    543     iSettings->ProcessCommandL( aCommandId ); | 
|         |    544     } | 
|         |    545  | 
|         |    546 // ---------------------------------------------------------------------------- | 
|         |    547 // CIMSSettingsUi::OfferKeyEventL | 
|         |    548 // ---------------------------------------------------------------------------- | 
|         |    549 // | 
|         |    550 TKeyResponse CIMSSettingsUi::OfferKeyEventL( | 
|         |    551     const TKeyEvent& aKeyEvent, | 
|         |    552     TEventCode aType ) | 
|         |    553     { | 
|         |    554     IMUM_CONTEXT( CIMSSettingsUi::OfferKeyEventL, 0, KLogUi ); | 
|         |    555  | 
|         |    556  | 
|         |    557     // Offer the key event to existing mailbox setting handler | 
|         |    558     TKeyResponse ret = iSettings->OfferKeyEventL( aKeyEvent, aType ); | 
|         |    559  | 
|         |    560     if ( ret != EKeyWasConsumed ) | 
|         |    561         { | 
|         |    562         ret = CAknDialog::OfferKeyEventL( aKeyEvent, aType ); | 
|         |    563         } | 
|         |    564  | 
|         |    565     return ret; | 
|         |    566     } | 
|         |    567  | 
|         |    568 // ---------------------------------------------------------------------------- | 
|         |    569 // CIMSSettingsUi::DynInitMenuPaneL() | 
|         |    570 // ---------------------------------------------------------------------------- | 
|         |    571 // | 
|         |    572 void CIMSSettingsUi::DynInitMenuPaneL( | 
|         |    573     TInt /* aResourceId */, | 
|         |    574     CEikMenuPane* aMenuPane ) | 
|         |    575     { | 
|         |    576     IMUM_CONTEXT( CIMSSettingsUi::DynInitMenuPaneL, 0, KLogUi ); | 
|         |    577  | 
|         |    578     if ( aMenuPane->NumberOfItemsInPane() == KIMSOptionsMenuItemCount ) | 
|         |    579         { | 
|         |    580         aMenuPane->SetItemDimmed( | 
|         |    581             EAknSoftkeyOpen, !iFlags->Flag( EImumSettingPositionSubMenu ) ); | 
|         |    582         aMenuPane->SetItemDimmed( | 
|         |    583             EAknSoftkeySelect, iFlags->Flag( EImumSettingPositionSubMenu ) ); | 
|         |    584         aMenuPane->SetItemDimmed( | 
|         |    585             EAknCmdHelp, !iFlags->GF( EMailFeatureHelp ) ); | 
|         |    586         } | 
|         |    587     } | 
|         |    588  | 
|         |    589 // ---------------------------------------------------------------------------- | 
|         |    590 // CIMSSettingsUi::DoQuitL() | 
|         |    591 // ---------------------------------------------------------------------------- | 
|         |    592 // | 
|         |    593 void CIMSSettingsUi::DoQuitL() | 
|         |    594     { | 
|         |    595     IMUM_CONTEXT( CIMSSettingsUi::DoQuitL, 0, KLogUi ); | 
|         |    596  | 
|         |    597     // Start the exit process, the query is shown during TryExitL call | 
|         |    598     if ( iFlags->Flag( EImumSettingShouldExit ) ) | 
|         |    599         { | 
|         |    600         TryExitL( EAknSoftkeyExit ); | 
|         |    601         } | 
|         |    602     else | 
|         |    603         { | 
|         |    604         TryExitL( EAknSoftkeyCancel ); | 
|         |    605         } | 
|         |    606     } | 
|         |    607  | 
|         |    608  | 
|         |    609 // ---------------------------------------------------------------------------- | 
|         |    610 // CIMSSettingsUi::GetHelpContext() | 
|         |    611 // ---------------------------------------------------------------------------- | 
|         |    612 // | 
|         |    613 void CIMSSettingsUi::GetHelpContext( TCoeHelpContext& aContext ) const | 
|         |    614     { | 
|         |    615     IMUM_CONTEXT( CIMSSettingsUi::GetHelpContext, 0, KLogUi ); | 
|         |    616  | 
|         |    617     iSettings->GetHelpContext( aContext ); | 
|         |    618     } | 
|         |    619  | 
|         |    620 // ---------------------------------------------------------------------------- | 
|         |    621 // CIMSSettingsUi::LaunchHelp() | 
|         |    622 // ---------------------------------------------------------------------------- | 
|         |    623 // | 
|         |    624 void CIMSSettingsUi::LaunchHelp() | 
|         |    625     { | 
|         |    626     IMUM_CONTEXT( CIMSSettingsUi::LaunchHelp, 0, KLogUi ); | 
|         |    627  | 
|         |    628     CCoeAppUi* appUi = static_cast<CCoeAppUi*>( ControlEnv()->AppUi() ); | 
|         |    629     // codescanner gives false positive here for leaving function called in | 
|         |    630     // non-leaving function as it does not detect the trap in previous line | 
|         |    631     TRAP_IGNORE( HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), | 
|         |    632     		appUi->AppHelpContextL() ) ); // CSI: 42 # see comment above | 
|         |    633     } | 
|         |    634  | 
|         |    635 // ---------------------------------------------------------------------------- | 
|         |    636 // CFindItemDialog::CreateCustomControlL | 
|         |    637 // from MEikDialogPageObserver | 
|         |    638 // ---------------------------------------------------------------------------- | 
|         |    639 // | 
|         |    640 SEikControlInfo CIMSSettingsUi::CreateCustomControlL( TInt aControlType ) | 
|         |    641     { | 
|         |    642     SEikControlInfo info = { 0, 0, 0 }; | 
|         |    643     if ( aControlType == EIMSWizardRichTxtEditorContainer ) | 
|         |    644         { | 
|         |    645         iWizardContainer = new (ELeave) CIMSWizardControl; | 
|         |    646         info.iControl = iWizardContainer; | 
|         |    647         } | 
|         |    648     return info; | 
|         |    649     } | 
|         |    650  | 
|         |    651 // ---------------------------------------------------------------------------- | 
|         |    652 // CIMSSettingsUi::ExecFlags() | 
|         |    653 // ---------------------------------------------------------------------------- | 
|         |    654 // | 
|         |    655 void CIMSSettingsUi::ExecFlags() | 
|         |    656     { | 
|         |    657     IMUM_CONTEXT( CIMSSettingsUi::ExecFlags, 0, KLogUi ); | 
|         |    658     IMUM_IN(); | 
|         |    659  | 
|         |    660     // Execute commands requested by flags | 
|         |    661  | 
|         |    662     // Show the menu, if asked | 
|         |    663     if ( iFlags->Flag( EImumSettingOpenOptionsMenu ) ) | 
|         |    664         { | 
|         |    665         iFlags->ClearFlag( EImumSettingOpenOptionsMenu ); | 
|         |    666         TMuiuDynSettingsType type = iSettings->CurrentItem()->iItemType; | 
|         |    667         iFlags->ChangeFlag( | 
|         |    668             EImumSettingPositionSubMenu, ( type == EMuiuDynSetMenuArray ) ); | 
|         |    669  | 
|         |    670         TRAP_IGNORE( DisplayMenuL() ); | 
|         |    671         } | 
|         |    672     else if ( iFlags->Flag( EImumSettingShouldExit ) || | 
|         |    673         iFlags->Flag( EImumSettingShouldClose ) ) | 
|         |    674         { | 
|         |    675         // Exit has been issued | 
|         |    676         TRAP_IGNORE( iSettings->DoQuitL() ); | 
|         |    677         } | 
|         |    678     else | 
|         |    679         { | 
|         |    680         // lint | 
|         |    681         } | 
|         |    682     IMUM_OUT(); | 
|         |    683     } | 
|         |    684  | 
|         |    685 // ----------------------------------------------------------------------------- | 
|         |    686 // CIMSSettingsUi::LoadListboxIconArrayL | 
|         |    687 // | 
|         |    688 // (other items were commented in a header). | 
|         |    689 // ----------------------------------------------------------------------------- | 
|         |    690 // | 
|         |    691 void CIMSSettingsUi::LoadListboxIconArrayL() | 
|         |    692 	{ | 
|         |    693 	IMUM_CONTEXT( CIMSSettingsUi::LoadListboxIconArrayL, 0, KLogUi ); | 
|         |    694 	IMUM_IN(); | 
|         |    695  | 
|         |    696 	// Create array for listbox graphics | 
|         |    697 	CAknIconArray* icons = new ( ELeave ) CAknIconArray( 1 ); // one icon in array | 
|         |    698 	CleanupStack::PushL( icons ); | 
|         |    699  | 
|         |    700     TFileName bitmapfilepath; | 
|         |    701     TParse tp; | 
|         |    702     tp.Set( KMuiuBitmapFile, &KDC_APP_BITMAP_DIR, NULL ); | 
|         |    703     bitmapfilepath.Copy( tp.FullName() ); | 
|         |    704  | 
|         |    705     CFbsBitmap* bitmap = NULL; | 
|         |    706     CFbsBitmap* mask = NULL; | 
|         |    707     TAknsItemID aid; | 
|         |    708  | 
|         |    709     aid.Set( KAknsIIDQgnIndiSettProtectedAdd ); | 
|         |    710     AknsUtils::CreateIconLC( AknsUtils::SkinInstance(), | 
|         |    711         aid, bitmap, mask, bitmapfilepath, | 
|         |    712         EMbmMuiuQgn_indi_sett_protected_add, | 
|         |    713         EMbmMuiuQgn_indi_sett_protected_add_mask ); | 
|         |    714  | 
|         |    715     icons->AppendL( CGulIcon::NewL( bitmap, mask ) ); | 
|         |    716     CleanupStack::Pop( 2, bitmap ); // CSI: 47 # mask, bitmap | 
|         |    717     bitmap = NULL; | 
|         |    718     mask = NULL; | 
|         |    719  | 
|         |    720     iListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons ); | 
|         |    721  | 
|         |    722     CleanupStack::Pop( icons ); | 
|         |    723     icons = NULL; | 
|         |    724  | 
|         |    725     IMUM_OUT(); | 
|         |    726 	} | 
|         |    727  | 
|         |    728 //  End of File |