browserui/browser/SettingsSrc/SettingsContainer.cpp
changeset 51 48e827313edd
parent 37 481242ead638
child 53 f427d27b98d8
equal deleted inserted replaced
37:481242ead638 51:48e827313edd
     1 /*
       
     2 * Copyright (c) 2002 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 the License "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 *     Container of the information about the active settings
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <bldvariant.hrh>
       
    22 #include <charconv.h>
       
    23 #include <aknkeys.h>
       
    24 #include <AknTabGrp.h>
       
    25 #include <AknViewAppUi.h>
       
    26 #include <AknTitle.h>
       
    27 #include <aknutils.h>
       
    28 #include <BrowserNG.rsg>
       
    29 #include <AKNLISTS.H>
       
    30 #include <AknRadioButtonSettingPage.h>
       
    31 #include <akntextsettingpage.h>
       
    32 #include <barsread.h> // for TResourceReader
       
    33 #include <gulicon.h>
       
    34 #include <aknnavi.h>
       
    35 #include <aknnavide.h>
       
    36 #include <FeatMgr.h>
       
    37 #include <ApSettingsHandlerUi.h>
       
    38 #include <ApEngineConsts.h>
       
    39 #include <aputils.h>
       
    40 #include <commdb.h>
       
    41 #include <StringLoader.h>
       
    42 #include <downloadmgrclient.h>
       
    43 #include <VpnApItem.h>
       
    44 #include <aknnotewrappers.h>
       
    45 
       
    46 #include "ApiProvider.h"
       
    47 #include "SettingsContainer.h"
       
    48 #include "BrowserPreferences.h"
       
    49 #include "Display.h"
       
    50 #include "CommsModel.h"
       
    51 #include "Browser.hrh"
       
    52 #include "CommonConstants.h"
       
    53 #include "BrowserAppUi.h"
       
    54 #include "BrowserAppViewBase.h"
       
    55 #include "BrowserUtil.h"
       
    56 #include "BrowserUiVariant.hrh"
       
    57 #include "BrowserDialogs.h"
       
    58 #include "Logger.h"
       
    59 
       
    60 #include "BrowserWindowManager.h"
       
    61 #include "BrowserWindow.h"
       
    62 // Browser as a plugin
       
    63 #include <brctlinterface.h>
       
    64 #include <brctldefs.h>
       
    65 
       
    66 #include <browserplugininterface.h>
       
    67 //Zsolt
       
    68 #include <cmmanager.h>
       
    69 #include <cmdestination.h>
       
    70 #include <cmapplicationsettingsui.h>
       
    71 
       
    72 
       
    73 #ifdef __SERIES60_HELP
       
    74 // Context-Sensitve Help File
       
    75 #include "BrowserApplication.h"
       
    76 #include <csxhelp/browser.hlp.hrh>
       
    77 #endif // __SERIES60_HELP
       
    78 
       
    79 // CONSTANTS
       
    80 const TInt KSettingCategoryMaxLength = 50;
       
    81 _LIT( KSettingsCategoryListBoxItemNoIcon, " " );
       
    82 const TInt KDoesntExist = -1;
       
    83 const TInt KGranularity = 1;
       
    84 const TInt KMaxTitleLength = 512;
       
    85 
       
    86 
       
    87 _LIT( KWmlSettingsListBoxItemPrefix, " \t" );
       
    88 _LIT( KWmlSettingsListBoxItemPostfix, "\t\t" );
       
    89 
       
    90 // ========================= MEMBER FUNCTIONS ================================
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 // CSettingsContainer::CSettingsContainer
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 CSettingsContainer::CSettingsContainer( MApiProvider& aApiProvider,
       
    97                                         MObjectProvider& aMopParent )
       
    98     : iApiProvider( aApiProvider ),
       
    99       iMainSettingCurrentIndex( KWmlSettingsIndexNone ),
       
   100       iSubSettingCurrentIndex( KWmlSettingsIndexNone )
       
   101     {
       
   102     SetMopParent( &aMopParent );
       
   103     }
       
   104 
       
   105 // ----------------------------------------------------------------------------
       
   106 // CSettingsContainer::NewLC
       
   107 // ----------------------------------------------------------------------------
       
   108 //
       
   109 CSettingsContainer* CSettingsContainer::NewLC ( const TRect& aRect,
       
   110                                                 MApiProvider& aApiProvider,
       
   111                                                 MObjectProvider& aMopParent )
       
   112     {
       
   113     CSettingsContainer* result;
       
   114     result = new (ELeave) CSettingsContainer( aApiProvider, aMopParent );
       
   115     CleanupStack::PushL( result );
       
   116     result->ConstructL( aRect );
       
   117     return result;
       
   118     }
       
   119 
       
   120 
       
   121 // ----------------------------------------------------------------------------
       
   122 // CSettingsContainer::NewL
       
   123 // ----------------------------------------------------------------------------
       
   124 //
       
   125 CSettingsContainer* CSettingsContainer::NewL (  const TRect &aRect,
       
   126                                                 MApiProvider& aApiProvider,
       
   127                                                 MObjectProvider& aMopParent )
       
   128     {
       
   129     CSettingsContainer* result;
       
   130     result = CSettingsContainer::NewLC( aRect, aApiProvider, aMopParent );
       
   131     CleanupStack::Pop(); // result
       
   132     return result;
       
   133     }
       
   134 
       
   135 
       
   136 // -----------------------------------------------------------------------------
       
   137 // CSettingsContainer::~CSettingsContainer
       
   138 // -----------------------------------------------------------------------------
       
   139 //
       
   140 CSettingsContainer::~CSettingsContainer()
       
   141     {
       
   142     delete iNaviDecorator; // This pops off the Navi Pane (if pushed).
       
   143     delete iSettingListBox;
       
   144     delete iSettingIndex;
       
   145     delete iEncodingArray;
       
   146     }
       
   147 
       
   148 
       
   149 // -----------------------------------------------------------------------------
       
   150 // CSettingsContainer::ConstructL
       
   151 // -----------------------------------------------------------------------------
       
   152 //
       
   153 void CSettingsContainer::ConstructL( const TRect& aRect )
       
   154     {
       
   155     ApiProvider().Display().SetTitleL( R_WMLBROWSER_SETTINGS_TITLE );
       
   156     // Push empty Navi Pane. Do not use PushDefault; that must be popped and
       
   157     // that is problematic on exit (MDisplay may not be available).
       
   158     // Create a blank navi pane control, its destructor handles it safely.
       
   159     CAknNavigationControlContainer* naviPane =
       
   160       ApiProvider().Display().NaviPaneL();
       
   161     iNaviDecorator = naviPane->CreateNavigationLabelL();
       
   162     naviPane->PushL( *iNaviDecorator );
       
   163 
       
   164     iSettingIndex = new (ELeave) CArrayFixFlat<TUint>( 4 );
       
   165 
       
   166     // construct listbox from resources
       
   167     TResourceReader rr;
       
   168 
       
   169     iEikonEnv->CreateResourceReaderLC( rr, R_BROWSER_SETTING_CATEGORIES_LISTBOX );
       
   170 
       
   171     CreateWindowL();
       
   172     iSettingListBox = new( ELeave )CAknSettingStyleListBox;
       
   173     iSettingListBox->SetContainerWindowL( *this ) ;
       
   174     iSettingListBox->ConstructFromResourceL( rr );
       
   175     iPenEnabled = AknLayoutUtils::PenEnabled();
       
   176     if (iPenEnabled)
       
   177         {
       
   178         iSettingListBox->SetListBoxObserver( this );    
       
   179         }
       
   180     CleanupStack::PopAndDestroy(); // resource reader
       
   181     iSettingListBox->CreateScrollBarFrameL( ETrue );
       
   182     iSettingListBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
       
   183 
       
   184     iEncodingArray = new(ELeave) CArrayFixFlat<TEncodingStruct>( KGranularity );
       
   185     CreateEncodingArrayL();
       
   186     RemoveUnsupportedEncodingsL();
       
   187 
       
   188     // Add Unicode
       
   189     AddEncodingL( KCharacterSetIdentifierUCS2, R_WMLBROWSER_SETTINGS_ENCODING_UCS_2 );
       
   190 
       
   191     // Preferences becomes active, WindowsManager is an observer,
       
   192     // it provides some local settings
       
   193     ApiProvider().Preferences().NotifyObserversL( EPreferencesActivate, TBrCtlDefs::ESettingsUnknown );
       
   194 
       
   195     // These settings cause page relayouts and should only be
       
   196     // updated upon leaving the settings page, this is why they are stored as
       
   197     // member data rather than getting the values from CBrowserPreferences
       
   198     iFontSize = ApiProvider().Preferences().FontSize();
       
   199     iEncoding = ApiProvider().Preferences().Encoding();
       
   200     iTextWrap = ApiProvider().Preferences().TextWrap();
       
   201 
       
   202     // Check if flash plugin is present and set variable
       
   203     iFlashPluginPresent = ApiProvider().FlashPresent();
       
   204     
       
   205     // Updating listbox content
       
   206     DisplaySettingCategoriesL();
       
   207 
       
   208     SetRect( aRect );
       
   209     ActivateL();
       
   210     iSettingListBox->ScrollBarFrame()->MoveVertThumbTo( iSettingListBox->CurrentItemIndex() );
       
   211     }
       
   212 
       
   213 // -----------------------------------------------------------------------------
       
   214 // CSettingsContainer::DisplaySettingCategoriesL
       
   215 // -----------------------------------------------------------------------------
       
   216 //
       
   217 void CSettingsContainer::DisplaySettingCategoriesL()
       
   218     {
       
   219     StoreListBoxIndexL();
       
   220     // Flag which setting category we are entering
       
   221     iCurrentSettingCategory = EMain;
       
   222 
       
   223     ApiProvider().Display().SetTitleL( R_WMLBROWSER_SETTINGS_TITLE );
       
   224 
       
   225     ClearListBoxContentL();
       
   226 
       
   227     MDesCArray* itemList = iSettingListBox->Model()->ItemTextArray();
       
   228     CDesCArray* itemArray = ( CDesCArray* ) itemList;
       
   229     TBuf<KSettingCategoryMaxLength> itemText;
       
   230 
       
   231     // General Category item
       
   232     AddCategoryListBoxItemL( R_SETTINGS_CATEGORY_GENERAL, *itemArray );
       
   233     iSettingIndex->AppendL( EWmlSettingsGeneral );
       
   234 
       
   235     // Page Category item
       
   236     AddCategoryListBoxItemL( R_SETTINGS_CATEGORY_PAGE, *itemArray );
       
   237     iSettingIndex->AppendL( EWmlSettingsPage );
       
   238 
       
   239     // Privacy Category item
       
   240     AddCategoryListBoxItemL( R_SETTINGS_CATEGORY_PRIVACY, *itemArray );
       
   241     iSettingIndex->AppendL( EWmlSettingsPrivacy );
       
   242 
       
   243 #ifdef __RSS_FEEDS
       
   244     #if !defined(BRDO_OCC_ENABLED_FF)
       
   245     // Web feeds Category item
       
   246     if (!ApiProvider().IsEmbeddedModeOn())
       
   247         {
       
   248         AddCategoryListBoxItemL( R_SETTINGS_CATEGORY_WEBFEEDS, *itemArray );
       
   249         iSettingIndex->AppendL( EWmlSettingsWebFeeds );
       
   250         }
       
   251     #endif
       
   252 #endif // __RSS_FEEDS
       
   253 
       
   254     
       
   255     if (!iPenEnabled)
       
   256     {
       
   257         // Toolbar Category item
       
   258         AddCategoryListBoxItemL( R_SETTINGS_CATEGORY_TOOLBAR, *itemArray );
       
   259         iSettingIndex->AppendL( EWmlSettingsToolbar );
       
   260 
       
   261         // Shortcut Keys Category item
       
   262         if(!ApiProvider().Preferences().ShortcutKeysForQwerty())
       
   263             {
       
   264             AddCategoryListBoxItemL( R_SETTINGS_CATEGORY_SHORTCUTS, *itemArray );
       
   265             iSettingIndex->AppendL( EWmlSettingsShortcuts );        
       
   266             }
       
   267     }
       
   268         
       
   269 
       
   270     RestoreListBoxIndexL();
       
   271     
       
   272     }
       
   273 
       
   274 // -----------------------------------------------------------------------------
       
   275 // CSettingsContainer::DisplayCorrectSettingCategoryListL
       
   276 // -----------------------------------------------------------------------------
       
   277 //
       
   278 void CSettingsContainer::DisplayCorrectSettingCategoryListL()
       
   279     {
       
   280     switch ( iSettingIndex->At( iSettingListBox->CurrentItemIndex() ) )
       
   281         {
       
   282         // Open General Browser Settings
       
   283         case EWmlSettingsGeneral:
       
   284             {
       
   285             DisplayGeneralSettingsL();
       
   286             break;
       
   287             }
       
   288         // Open Privacy Browser Settings
       
   289         case EWmlSettingsPrivacy:
       
   290             {
       
   291             DisplayPrivacySettingsL();
       
   292             break;
       
   293             }
       
   294 
       
   295         // Open Page Browser Settings
       
   296         case EWmlSettingsPage:
       
   297             {
       
   298             DisplayPageSettingsL();
       
   299             break;
       
   300             }
       
   301 
       
   302         // Open Web Feeds Settings
       
   303         case EWmlSettingsWebFeeds:
       
   304             {
       
   305             DisplayWebFeedsSettingsL();
       
   306             break;
       
   307             }
       
   308             
       
   309         // Open Toolbar Settings
       
   310         case EWmlSettingsToolbar:
       
   311             {
       
   312             DisplayToolbarSettingsL();
       
   313             break;
       
   314             }
       
   315             
       
   316          // Open Shortcuts Settings
       
   317         case EWmlSettingsShortcuts:
       
   318             {
       
   319             DisplayShortcutsSettingsL();
       
   320             break;
       
   321             }           
       
   322 
       
   323         default:
       
   324             {
       
   325             DisplaySettingCategoriesL();    
       
   326             break;
       
   327             }
       
   328         }
       
   329     }
       
   330 
       
   331 // -----------------------------------------------------------------------------
       
   332 // CSettingsContainer::AddCategoryListBoxItemL
       
   333 // -----------------------------------------------------------------------------
       
   334 //
       
   335 void CSettingsContainer::AddCategoryListBoxItemL( TInt aResourceId, CDesCArray& aItemArray )
       
   336     {
       
   337     TBuf<KSettingCategoryMaxLength> itemText;
       
   338     itemText.Zero();
       
   339     itemText.Append( KSettingsCategoryListBoxItemNoIcon );
       
   340     itemText.Append(KWmlSettingsListBoxItemPrefix);
       
   341     HBufC* listItemText = iCoeEnv->AllocReadResourceLC( aResourceId );
       
   342     itemText.Append( *listItemText );
       
   343     CleanupStack::PopAndDestroy(); // listItemText
       
   344     aItemArray.AppendL( itemText );
       
   345     }
       
   346 
       
   347 // -----------------------------------------------------------------------------
       
   348 // CSettingsContainer::DisplayGeneralSettingsL
       
   349 // -----------------------------------------------------------------------------
       
   350 //
       
   351 void CSettingsContainer::DisplayGeneralSettingsL()
       
   352     {
       
   353     StoreListBoxIndexL();
       
   354     // Flag which setting category we are entering
       
   355     iCurrentSettingCategory = EGeneral;
       
   356 
       
   357     ApiProvider().Display().SetTitleL( R_WMLBROWSER_SETTINGS_TITLE_GENERAL );
       
   358 
       
   359     ClearListBoxContentL();
       
   360 
       
   361     CDesCArray* itemArray =
       
   362             ( CDesCArray* ) ( iSettingListBox->Model()->ItemTextArray() );
       
   363 
       
   364     TBuf<KWmlSettingsItemMaxLength> itemText;
       
   365 
       
   366     //=========================================================================
       
   367     // Add individual settings belonging to the 'General' Settings Category
       
   368     //
       
   369 
       
   370     // Default Access Point
       
   371     if ( !ApiProvider().Preferences().CustomAccessPointDefined() )
       
   372         {
       
   373         #if !defined(BRDO_OCC_ENABLED_FF)
       
   374         //Access point setting is not required if OCC is enabled
       
   375         AppendDefaultAccessPointL( itemArray, itemText );
       
   376         #endif
       
   377         }
       
   378 
       
   379     // Home Page
       
   380     if( ApiProvider().Preferences().
       
   381                 UiLocalFeatureSupported( KBrowserUiHomePageSetting ) &&
       
   382                 !ApiProvider().IsEmbeddedModeOn() )
       
   383         {
       
   384         AppendHomePageL( itemArray, itemText );
       
   385         }
       
   386 
       
   387     // Minimap not supported on touch devices
       
   388     if (!iPenEnabled)
       
   389         {
       
   390         //MiniMap feature is determined by the PageScaler dll, not by the preference setting.
       
   391         //We should query webkit for the feature.
       
   392         if(ApiProvider().WindowMgr().CurrentWindow()->IsPageOverviewSupportedL()) 
       
   393             {
       
   394             // Page Overview
       
   395             AppendPageOverviewL( itemArray, itemText );
       
   396             }           
       
   397         }
       
   398 
       
   399 
       
   400     if( iApiProvider.Preferences().UiLocalFeatureSupported( KBrowserGraphicalHistory ))
       
   401         {
       
   402         // Back List
       
   403         AppendBackListL( itemArray, itemText );
       
   404         }
       
   405 
       
   406     if (!ApiProvider().IsEmbeddedModeOn())
       
   407         {
       
   408         AppendURLSuffixListL(itemArray, itemText);
       
   409         }
       
   410     // Http Security Warnings
       
   411     if ( !ApiProvider().Preferences().HttpSecurityWarningsStatSupressed() )
       
   412         {
       
   413         AppendHttpSecurityWarningsL( itemArray, itemText );
       
   414         }
       
   415 
       
   416     // Ecma
       
   417     AppendEcmaL( itemArray, itemText );
       
   418 
       
   419     // Script Logging
       
   420     AppendScriptLogL( itemArray, itemText );
       
   421 
       
   422     // Downloads open settings 
       
   423     if( PROGRESSIVE_DOWNLOAD )
       
   424         {
       
   425         AppendDownloadsOpenL( itemArray, itemText );
       
   426         }
       
   427     
       
   428     if( ApiProvider().Preferences().SearchFeature() )
       
   429         {
       
   430         AppendSearchProviderL( itemArray, itemText );
       
   431         }
       
   432 
       
   433     RestoreListBoxIndexL();
       
   434     iSettingListBox->DrawNow();
       
   435     ActivateL();
       
   436     }
       
   437 
       
   438 // -----------------------------------------------------------------------------
       
   439 // CSettingsContainer::DisplayPageSettingsL
       
   440 // -----------------------------------------------------------------------------
       
   441 //
       
   442 void CSettingsContainer::DisplayPageSettingsL()
       
   443     {
       
   444     StoreListBoxIndexL();
       
   445     // Flag which setting category we are entering
       
   446     iCurrentSettingCategory = EPage;
       
   447 
       
   448     ApiProvider().Display().SetTitleL( R_WMLBROWSER_SETTINGS_TITLE_PAGE );
       
   449 
       
   450     ClearListBoxContentL();
       
   451 
       
   452     CDesCArray* itemArray =
       
   453             ( CDesCArray* ) ( iSettingListBox->Model()->ItemTextArray() );
       
   454 
       
   455     TBuf<KWmlSettingsItemMaxLength> itemText;
       
   456 
       
   457     //=========================================================================
       
   458     // Add individual settings belonging to the 'General' Settings Category
       
   459     //
       
   460 
       
   461     // AutoLoad Content
       
   462     AppendAutoLoadContentL( itemArray, itemText );
       
   463  
       
   464     // Media Volume
       
   465     if( !HAS_SIDE_VOLUME_KEYS )  //some phones don't have side volume keys
       
   466         {
       
   467         AppendAutoMediaVolumeL( itemArray, itemText );
       
   468         }
       
   469 
       
   470     // Encoding
       
   471     AppendEncodingL( itemArray, itemText );
       
   472 
       
   473     // Pop-up Blocking
       
   474     if ( ApiProvider().Preferences().UiLocalFeatureSupported(
       
   475                                     KBrowserMultipleWindows ) &&
       
   476                                     !ApiProvider().IsEmbeddedModeOn() )
       
   477         {
       
   478         AppendPopupBlockingL( itemArray, itemText );
       
   479         }
       
   480 
       
   481     // Auto Refresh
       
   482     AppendAutoRefreshL( itemArray, itemText );
       
   483 
       
   484     // Font Size
       
   485     AppendFontSizeL( itemArray, itemText );
       
   486  
       
   487     RestoreListBoxIndexL();
       
   488     iSettingListBox->DrawNow();
       
   489     ActivateL();
       
   490     }
       
   491 
       
   492 // -----------------------------------------------------------------------------
       
   493 // CSettingsContainer::DisplayPrivacySettingsL
       
   494 // -----------------------------------------------------------------------------
       
   495 //
       
   496 void CSettingsContainer::DisplayPrivacySettingsL()
       
   497     {
       
   498     StoreListBoxIndexL();
       
   499     // Flag which setting category we are entering
       
   500     iCurrentSettingCategory = EPrivacy;
       
   501 
       
   502     ApiProvider().Display().SetTitleL( R_WMLBROWSER_SETTINGS_TITLE_PRIVACY );
       
   503 
       
   504     ClearListBoxContentL();
       
   505 
       
   506     CDesCArray* itemArray =
       
   507             ( CDesCArray* ) ( iSettingListBox->Model()->ItemTextArray() );
       
   508 
       
   509     TBuf<KWmlSettingsItemMaxLength> itemText;
       
   510 
       
   511     //=========================================================================
       
   512     // Add individual settings belonging to the 'General' Settings Category
       
   513     //
       
   514 
       
   515     // Adaptive Bookmarks
       
   516     if ( ADAPTIVEBOOKMARKS )
       
   517         {
       
   518         AppendAdaptiveBookmarksL( itemArray, itemText );
       
   519         }
       
   520 
       
   521     if (iApiProvider.Preferences().UiLocalFeatureSupported(KBrowserAutoFormFill) )
       
   522         {
       
   523         // Form Data Saving
       
   524         AppendFormDataSavingL( itemArray, itemText );
       
   525         }
       
   526 
       
   527     // Cookies
       
   528     AppendCookiesL( itemArray, itemText );
       
   529 
       
   530     // IMEI
       
   531     if ( IMEI_NOTIFICATION && !ApiProvider().IsEmbeddedModeOn() )
       
   532         {
       
   533         AppendIMEIL( itemArray, itemText );
       
   534         }
       
   535 
       
   536     RestoreListBoxIndexL();
       
   537     iSettingListBox->DrawNow();
       
   538     ActivateL();
       
   539     }
       
   540 
       
   541 // -----------------------------------------------------------------------------
       
   542 // CSettingsContainer::DisplayWebFeedsSettingsL
       
   543 // -----------------------------------------------------------------------------
       
   544 //
       
   545 void CSettingsContainer::DisplayWebFeedsSettingsL()
       
   546     {
       
   547     MPreferences& preferences = ApiProvider().Preferences();
       
   548 
       
   549     StoreListBoxIndexL();
       
   550     // Flag which setting category we are entering
       
   551     iCurrentSettingCategory = EWebFeeds;
       
   552     ApiProvider().Display().SetTitleL( R_SETTINGS_CATEGORY_WEBFEEDS );
       
   553     ClearListBoxContentL();
       
   554 
       
   555     CDesCArray* itemArray =
       
   556             ( CDesCArray* ) ( iSettingListBox->Model()->ItemTextArray() );
       
   557     TBuf<KWmlSettingsItemMaxLength> itemText;
       
   558 
       
   559     // Add setting items
       
   560     // Show the "Auto Update AP" option
       
   561     AppendAutomaticUpdatingAPL( itemArray, itemText );
       
   562         
       
   563     // Show the "Automatic update while roaming" option
       
   564     AppendAutomaticUpdatingWhileRoamingL( itemArray, itemText );
       
   565     
       
   566     RestoreListBoxIndexL();
       
   567     iSettingListBox->DrawNow();
       
   568     ActivateL();
       
   569     }
       
   570 
       
   571 // CSettingsContainer::DisplayToolbarSettingsL
       
   572 // -----------------------------------------------------------------------------
       
   573 //
       
   574 void CSettingsContainer::DisplayToolbarSettingsL()
       
   575     {
       
   576     MPreferences& preferences = ApiProvider().Preferences();
       
   577 
       
   578     StoreListBoxIndexL();
       
   579     // Flag which setting category we are entering
       
   580     iCurrentSettingCategory = EToolbar;
       
   581     ApiProvider().Display().SetTitleL( R_SETTINGS_CATEGORY_TOOLBAR );
       
   582     ClearListBoxContentL();
       
   583 
       
   584     CDesCArray* itemArray =
       
   585             ( CDesCArray* ) ( iSettingListBox->Model()->ItemTextArray() );
       
   586     TBuf<KWmlSettingsItemMaxLength> itemText;
       
   587     
       
   588     // Toolbar On/Off Setting
       
   589     AppendToolbarOnOffL(itemArray, itemText );
       
   590     
       
   591     // Toolbar Buttons
       
   592     AppendToolbarButtonsL(itemArray, itemText );
       
   593 
       
   594     RestoreListBoxIndexL();
       
   595     iSettingListBox->DrawNow();
       
   596     ActivateL();
       
   597     }
       
   598 
       
   599 // -----------------------------------------------------------------------------
       
   600 // CSettingsContainer::DisplayShortcutsSettingsL
       
   601 // -----------------------------------------------------------------------------
       
   602 //
       
   603 void CSettingsContainer::DisplayShortcutsSettingsL()
       
   604     {
       
   605     MPreferences& preferences = ApiProvider().Preferences();
       
   606 
       
   607     StoreListBoxIndexL();
       
   608     // Flag which setting category we are entering
       
   609     iCurrentSettingCategory = EShortCuts;
       
   610     ApiProvider().Display().SetTitleL( R_SETTINGS_CATEGORY_SHORTCUTS);
       
   611     ClearListBoxContentL();
       
   612 
       
   613     CDesCArray* itemArray =
       
   614             ( CDesCArray* ) ( iSettingListBox->Model()->ItemTextArray() );
       
   615     TBuf<KWmlSettingsItemMaxLength> itemText;
       
   616     
       
   617     // Shortcut Keys
       
   618     AppendShortcutKeysL (itemArray, itemText );
       
   619 
       
   620     RestoreListBoxIndexL();
       
   621     iSettingListBox->DrawNow();
       
   622     ActivateL();
       
   623     }
       
   624 
       
   625 // -----------------------------------------------------------------------------
       
   626 // CSettingsContainer::CloseSettingsListL
       
   627 // -----------------------------------------------------------------------------
       
   628 //
       
   629 TBool CSettingsContainer::CloseSettingsListL()
       
   630     {
       
   631     TBool ret( EFalse );
       
   632     // Check which list we are in
       
   633     switch ( iCurrentSettingCategory )
       
   634         {
       
   635         // About to leave
       
   636         case EMain:
       
   637             {
       
   638             SaveChangesL();
       
   639             ret = ETrue;
       
   640             break;
       
   641             }
       
   642         // Return to Setting Category List
       
   643         case EGeneral:
       
   644         case EPrivacy:
       
   645         case EWebFeeds:
       
   646         case EPage:
       
   647         case EToolbar:
       
   648         case EShortCuts:
       
   649             {
       
   650             DisplaySettingCategoriesL();
       
   651             ret = EFalse;
       
   652             break;
       
   653             }
       
   654         default:
       
   655             break;
       
   656         }
       
   657     return ret;
       
   658     }
       
   659     
       
   660     
       
   661 // -----------------------------------------------------------------------------
       
   662 // CSettingsContainer::SettingsError
       
   663 // -----------------------------------------------------------------------------
       
   664 //
       
   665 TBool CSettingsContainer::SettingsError()
       
   666     {
       
   667     TBool ret( EFalse );
       
   668     if ( iCurrentSettingCategory == EToolbar )
       
   669         {
       
   670         // Return true is all toolbar buttons set to None for command (which is 0 in value)
       
   671         MPreferences& preferences = ApiProvider().Preferences();
       
   672         if ((preferences.ShowToolbarButton1Cmd() +
       
   673              preferences.ShowToolbarButton2Cmd() +
       
   674              preferences.ShowToolbarButton3Cmd() +
       
   675              preferences.ShowToolbarButton4Cmd() +
       
   676              preferences.ShowToolbarButton5Cmd() +
       
   677              preferences.ShowToolbarButton6Cmd() +
       
   678              preferences.ShowToolbarButton7Cmd() ) == 0 )
       
   679             {
       
   680             ret = ETrue;
       
   681             }
       
   682         }
       
   683     return ret;
       
   684     }    
       
   685 
       
   686 // -----------------------------------------------------------------------------
       
   687 // CSettingsContainer::AppendDefaultAccessPointL
       
   688 // -----------------------------------------------------------------------------
       
   689 //
       
   690 void CSettingsContainer::AppendDefaultAccessPointL( CDesCArray*& aItemArray,
       
   691                                                     TBuf<KWmlSettingsItemMaxLength>& aItemText )
       
   692     {
       
   693     //get the connection identifier based on the connection type
       
   694     switch (ApiProvider().Preferences().AccessPointSelectionMode())
       
   695         {
       
   696         case EAlwaysAsk:
       
   697             {
       
   698             #if !defined(BRDO_BROWSER_50_FF)        
       
   699                 CreateItemFromTwoStringsL( 
       
   700                 R_WMLBROWSER_SETTINGS_DEFAULT_AP, 
       
   701                 R_WML_SETTINGS_ACCESS_POINT_ALWAYS_ASK, 
       
   702                 aItemText );
       
   703             #else
       
   704                 CreateItemFromTwoStringsL( 
       
   705                 R_WMLBROWSER_SETTINGS_DEFAULT_AP, 
       
   706                 R_WML_SETTINGS_ACCESS_POINT_ASK_WHEN_NEEDED, 
       
   707                 aItemText );
       
   708             #endif //BRDO_BROWSER_50_FF
       
   709             break;  
       
   710             }
       
   711             
       
   712         //get the destination identifyer based on the snap Id
       
   713         case EDestination:
       
   714             {
       
   715             aItemText.Zero();
       
   716             aItemText.Append( KWmlSettingsListBoxItemPrefix );
       
   717             HBufC* defaultAp = iCoeEnv->AllocReadResourceLC( 
       
   718                                     R_WMLBROWSER_SETTINGS_DEFAULT_AP );
       
   719             aItemText.Append( *defaultAp );
       
   720             CleanupStack::PopAndDestroy(); // defaultAp
       
   721             aItemText.Append( KWmlSettingsListBoxItemPostfix );
       
   722             
       
   723             RCmManager        cmManager;
       
   724             cmManager.OpenL();
       
   725 
       
   726             TInt snapId = ApiProvider().Preferences().DefaultSnapId();
       
   727             if (snapId != KWmlNoDefaultSnapId)   
       
   728                 {            
       
   729                 TRAPD(err, RCmDestination dest = cmManager.DestinationL( snapId ));
       
   730                 if (err == KErrNone)
       
   731                     {
       
   732                     RCmDestination dest = cmManager.DestinationL( snapId );                 
       
   733                     CleanupClosePushL( dest );                  
       
   734                     HBufC* destName = dest.NameLC();                                        
       
   735                     aItemText.Append(*destName);
       
   736                     CleanupStack::PopAndDestroy( 2 ); // destName, dest
       
   737                     cmManager.Close();
       
   738                     break;
       
   739                     }   
       
   740                 }
       
   741             #if !defined(BRDO_BROWSER_50_FF)
       
   742                 HBufC* name = iCoeEnv->AllocReadResourceLC( R_WML_SETTINGS_ACCESS_POINT_ALWAYS_ASK );
       
   743             #else
       
   744                 HBufC* name = iCoeEnv->AllocReadResourceLC( R_WML_SETTINGS_ACCESS_POINT_ASK_WHEN_NEEDED );
       
   745             #endif // BRDO_BROWSER_50_FF
       
   746             aItemText.Append( *name );
       
   747             CleanupStack::PopAndDestroy(); // name
       
   748                 
       
   749             ApiProvider().Preferences().SetAccessPointSelectionModeL( EAlwaysAsk );
       
   750             cmManager.Close();
       
   751 
       
   752             break;
       
   753             }
       
   754             
       
   755             //if connecting with Iap Id
       
   756         case EConnectionMethod:
       
   757             {
       
   758             aItemText.Zero();
       
   759             aItemText.Append( KWmlSettingsListBoxItemPrefix );
       
   760             HBufC* defaultAp = iCoeEnv->AllocReadResourceLC(
       
   761                                     R_WMLBROWSER_SETTINGS_DEFAULT_AP );
       
   762             aItemText.Append( *defaultAp );
       
   763             CleanupStack::PopAndDestroy(); // defaultAp
       
   764             aItemText.Append( KWmlSettingsListBoxItemPostfix );
       
   765 
       
   766             TUint id = ApiProvider().Preferences().DefaultAccessPoint();
       
   767             if ( id != KWmlNoDefaultAccessPoint )
       
   768                 {
       
   769                 TBuf< KCommsDbSvrMaxFieldLength > name;
       
   770                 CApUtils* au = CApUtils::NewLC( ApiProvider().CommsModel().CommsDb() );
       
   771                 au->NameL( id, name );
       
   772                 aItemText.Append( name );
       
   773                 CleanupStack::PopAndDestroy();  // au
       
   774                 }
       
   775             else
       
   776                 {
       
   777                 #if !defined(BRDO_BROWSER_50_FF)
       
   778                     HBufC* name = iCoeEnv->AllocReadResourceLC( R_WML_SETTINGS_ACCESS_POINT_ALWAYS_ASK );
       
   779                 #else
       
   780                     HBufC* name = iCoeEnv->AllocReadResourceLC( R_WML_SETTINGS_ACCESS_POINT_ASK_WHEN_NEEDED );
       
   781                 #endif // BRDO_BROWSER_50_FF
       
   782                 aItemText.Append( *name );
       
   783                 CleanupStack::PopAndDestroy(); // name
       
   784                 
       
   785                 ApiProvider().Preferences().SetAccessPointSelectionModeL( EAlwaysAsk  );
       
   786                 }
       
   787 
       
   788             break;  
       
   789             }
       
   790 
       
   791         default:
       
   792             {
       
   793             User::Leave( KErrNotSupported); 
       
   794             }
       
   795         }
       
   796     
       
   797     aItemArray->AppendL( aItemText );
       
   798     iSettingIndex->AppendL( EWmlSettingsAccesspoint );
       
   799     }
       
   800 
       
   801 // -----------------------------------------------------------------------------
       
   802 // CSettingsContainer::AppendHomePageL
       
   803 // -----------------------------------------------------------------------------
       
   804 //
       
   805 void CSettingsContainer::AppendHomePageL( CDesCArray*& aItemArray,
       
   806                                           TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
   807     {
       
   808 LOG_ENTERFN( "CSettingsContainer::AppendHomePageL" );
       
   809     aItemText.Zero();
       
   810     aItemText.Append( KWmlSettingsListBoxItemPrefix );
       
   811     HBufC* first = iCoeEnv->AllocReadResourceLC(
       
   812                                  R_WMLBROWSER_SETTINGS_HOMEPAGE );
       
   813     aItemText.Append( first->Des() );
       
   814     CleanupStack::PopAndDestroy(); // first
       
   815     aItemText.Append( KWmlSettingsListBoxItemPostfix );
       
   816 
       
   817     TWmlSettingsHomePage homepageType = ApiProvider().Preferences().HomePageType();
       
   818 BROWSER_LOG( ( _L( " pgtype: %d" ), homepageType ) );
       
   819     if( homepageType == EWmlSettingsHomePageBookmarks )
       
   820         {
       
   821         HBufC* second = iCoeEnv->AllocReadResourceLC(
       
   822                             R_WMLBROWSER_SETTINGS_HOMEPAGE_BOOKMARKS );
       
   823         aItemText.Append( second->Des() );
       
   824         CleanupStack::PopAndDestroy();  // second
       
   825         }
       
   826     else
       
   827         {
       
   828         HBufC* second = HBufC::NewLC( KMaxHomePgUrlLength );
       
   829         TPtr ptr( second->Des() );
       
   830         if( ApiProvider().Preferences().HomePageUrlL( ptr ) == KErrNone )
       
   831             {
       
   832             TInt itemLength( KWmlSettingsItemMaxLength - aItemText.Length() );
       
   833             if( ptr.Length() > itemLength )
       
   834                 {
       
   835                 aItemText.Append( ptr.Left( itemLength ) );
       
   836                 }
       
   837             else
       
   838                 {
       
   839                 aItemText.Append( ptr );
       
   840                 }
       
   841             }
       
   842         else
       
   843             {
       
   844             // If access point homepage is to be used, but no homepage URL is 
       
   845             // defined, then display the bookmarks view instead. 
       
   846             if( homepageType == EWmlSettingsHomePageAccessPoint )
       
   847                 {
       
   848                 iCoeEnv->ReadResourceL( ptr, 
       
   849                                     R_WMLBROWSER_SETTINGS_HOMEPAGE_BOOKMARKS );
       
   850                 aItemText.Append( ptr );
       
   851                 }
       
   852             else 
       
   853                 {
       
   854                 aItemText.Append( KWmlSettingsListBoxItemPostfix );
       
   855                 }
       
   856             }
       
   857         CleanupStack::PopAndDestroy(); // second     
       
   858         }
       
   859     aItemArray->AppendL( aItemText );
       
   860     iSettingIndex->AppendL( EWmlSettingsHomePage );
       
   861     }
       
   862 
       
   863 // -----------------------------------------------------------------------------
       
   864 // CSettingsContainer::AppendPageOverviewL
       
   865 // -----------------------------------------------------------------------------
       
   866 //
       
   867 void CSettingsContainer::AppendPageOverviewL( CDesCArray*& aItemArray,
       
   868                                               TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
   869     {
       
   870     if ( iApiProvider.Preferences().PageOverview() )
       
   871         {
       
   872         CreateItemFromTwoStringsL(
       
   873         R_WMLBROWSER_SETTINGS_PAGEOVERVIEW,
       
   874         R_WMLBROWSER_SETTINGS_PAGEOVERVIEW_ON,
       
   875         aItemText );
       
   876         }
       
   877     else
       
   878         {
       
   879         CreateItemFromTwoStringsL(
       
   880             R_WMLBROWSER_SETTINGS_PAGEOVERVIEW,
       
   881             R_WMLBROWSER_SETTINGS_PAGEOVERVIEW_OFF,
       
   882             aItemText );
       
   883         }
       
   884     aItemArray->AppendL( aItemText );
       
   885     iSettingIndex->AppendL( EWmlSettingsPageOverview );
       
   886     }
       
   887 
       
   888 
       
   889 // -----------------------------------------------------------------------------
       
   890 // CSettingsContainer::AppendToolbarOnOffL
       
   891 // -----------------------------------------------------------------------------
       
   892 //
       
   893 void CSettingsContainer::AppendToolbarOnOffL( CDesCArray*& aItemArray,
       
   894                                               TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
   895     {
       
   896     if ( iApiProvider.Preferences().ShowToolbarOnOff() )
       
   897         {
       
   898         CreateItemFromTwoStringsL(
       
   899         R_BROWSER_SETTING_TOOLBAR_ON_OFF,
       
   900         R_BROWSER_SETTING_TOOLBAR_ON,
       
   901         aItemText );
       
   902         }
       
   903     else
       
   904         {
       
   905         CreateItemFromTwoStringsL(
       
   906             R_BROWSER_SETTING_TOOLBAR_ON_OFF,
       
   907             R_BROWSER_SETTING_TOOLBAR_OFF,
       
   908             aItemText );
       
   909         }
       
   910     aItemArray->AppendL( aItemText );
       
   911     iSettingIndex->AppendL( EWmlSettingsToolbarOnOff );
       
   912     }
       
   913 
       
   914 
       
   915 // -----------------------------------------------------------------------------
       
   916 // CSettingsContainer::AppendBackListL
       
   917 // -----------------------------------------------------------------------------
       
   918 //
       
   919 void CSettingsContainer::AppendBackListL( CDesCArray*& aItemArray,
       
   920                                           TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
   921     {
       
   922     //-------------------------------------------------------------------------
       
   923     // BackList
       
   924    if ( iApiProvider.Preferences().BackList() )
       
   925         {
       
   926         CreateItemFromTwoStringsL(
       
   927         R_WMLBROWSER_SETTINGS_BACK_LIST,
       
   928         R_WMLBROWSER_SETTINGS_BACK_LIST_ON,
       
   929         aItemText );
       
   930         }
       
   931     else
       
   932         {
       
   933         CreateItemFromTwoStringsL(
       
   934             R_WMLBROWSER_SETTINGS_BACK_LIST,
       
   935             R_WMLBROWSER_SETTINGS_BACK_LIST_OFF,
       
   936             aItemText );
       
   937         }
       
   938     aItemArray->AppendL( aItemText );
       
   939     iSettingIndex->AppendL( EWmlSettingsBackList );
       
   940     }
       
   941 
       
   942 void CSettingsContainer::AppendURLSuffixListL( CDesCArray*& aItemArray, 
       
   943                                     TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
   944     {
       
   945         aItemText.Zero();
       
   946         aItemText.Append( KWmlSettingsListBoxItemPrefix );
       
   947         HBufC* first = iCoeEnv->AllocReadResourceLC( R_WMLBROWSER_SETTINGS_URL_SUFFIX );
       
   948         aItemText.Append( first->Des() );
       
   949         CleanupStack::PopAndDestroy(); // first
       
   950         aItemText.Append( KWmlSettingsListBoxItemPostfix );
       
   951 
       
   952         HBufC* buf = iApiProvider.Preferences().URLSuffixList();
       
   953         TPtrC suffix(buf->Des());
       
   954         
       
   955         if ( !suffix.Length() )
       
   956             {
       
   957             // leave line empty
       
   958             aItemText.Append( KWmlSettingsListBoxItemPostfix );
       
   959             }
       
   960         else
       
   961             {
       
   962             TInt itemLength( KWmlSettingsItemMaxLength - aItemText.Length() );
       
   963             if( suffix.Length() > itemLength )
       
   964                 {
       
   965                 aItemText.Append( suffix.Left( itemLength ) );
       
   966                 }
       
   967             else
       
   968                 {
       
   969                 aItemText.Append( suffix );
       
   970                 }
       
   971             }
       
   972         
       
   973         aItemArray->AppendL( aItemText );
       
   974         iSettingIndex->AppendL( EWmlSettingsUrlSuffix );
       
   975     }
       
   976 // -----------------------------------------------------------------------------
       
   977 // CSettingsContainer::AppendHttpSecurityWarningsL
       
   978 // -----------------------------------------------------------------------------
       
   979 //
       
   980 void CSettingsContainer::AppendHttpSecurityWarningsL(
       
   981                                                      CDesCArray*& aItemArray,
       
   982                                                      TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
   983     {
       
   984     CreateItemFromTwoStringsL(
       
   985         R_WMLBROWSER_SETTINGS_HTTP_SEC_WRNS,
       
   986         ApiProvider().Preferences().HttpSecurityWarnings() ?
       
   987         R_WMLBROWSER_SETTINGS_WRN_VALUE_SHOW :
       
   988         R_WMLBROWSER_SETTINGS_WRN_VALUE_HIDE,
       
   989         aItemText );
       
   990     aItemArray->AppendL( aItemText );
       
   991     iSettingIndex->AppendL( EWmlSettingsHttpSecurityWarnings );
       
   992     }
       
   993 
       
   994 // -----------------------------------------------------------------------------
       
   995 // CSettingsContainer::AppendEcmaL
       
   996 // -----------------------------------------------------------------------------
       
   997 //
       
   998 void CSettingsContainer::AppendEcmaL(
       
   999                                      CDesCArray*& aItemArray,
       
  1000                                      TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
  1001     {
       
  1002     // Add Ecma
       
  1003     switch ( ApiProvider().Preferences().Ecma() )
       
  1004         {
       
  1005         case EWmlSettingsECMAEnable:
       
  1006            {
       
  1007            CreateItemFromTwoStringsL(
       
  1008            R_WMLBROWSER_SETTINGS_ECMA,
       
  1009            R_WMLBROWSER_SETTINGS_ECMA_VALUE_ENABLE,
       
  1010            aItemText );
       
  1011            break;
       
  1012            }
       
  1013         case EWmlSettingsECMADisable:
       
  1014            {
       
  1015            CreateItemFromTwoStringsL(
       
  1016            R_WMLBROWSER_SETTINGS_ECMA,
       
  1017            R_WMLBROWSER_SETTINGS_ECMA_VALUE_DISABLE,
       
  1018            aItemText );
       
  1019            break;
       
  1020            }
       
  1021         default:
       
  1022         break;
       
  1023         }
       
  1024     aItemArray->AppendL( aItemText );
       
  1025     iSettingIndex->AppendL( EWmlSettingsEcma );
       
  1026     }
       
  1027 
       
  1028 // -----------------------------------------------------------------------------
       
  1029 // CSettingsContainer::AppendScriptLogL
       
  1030 // -----------------------------------------------------------------------------
       
  1031 //
       
  1032 void CSettingsContainer::AppendScriptLogL(
       
  1033                                          CDesCArray*& aItemArray,
       
  1034                                          TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
  1035     {
       
  1036     TInt scriptLog = ApiProvider().Preferences().ScriptLog();
       
  1037     CRepository*  repo = CRepository::NewLC( KCRUidBrowser );
       
  1038     TInt newVal;
       
  1039     if ( repo )
       
  1040         {
       
  1041         if ( ( repo->Get( KBrowserNGScriptLog, newVal ) == KErrNone ) &&
       
  1042               newVal != scriptLog )
       
  1043             {
       
  1044             ApiProvider().Preferences().SetScriptLogL( newVal );
       
  1045             scriptLog = newVal;
       
  1046             }
       
  1047         }
       
  1048     CleanupStack::PopAndDestroy( repo );
       
  1049 
       
  1050     switch ( scriptLog )
       
  1051         {
       
  1052         case EWmlSettingsScriptLogDisable:
       
  1053             {
       
  1054             CreateItemFromTwoStringsL(
       
  1055                 R_WMLBROWSER_SETTINGS_SCRIPTLOG,
       
  1056                 R_WMLBROWSER_SETTINGS_SCRIPTLOG_VALUE_DISABLE,
       
  1057                 aItemText );
       
  1058             break;
       
  1059             }
       
  1060         case EWmlSettingsScriptLogToFile:
       
  1061             {
       
  1062             CreateItemFromTwoStringsL(
       
  1063                 R_WMLBROWSER_SETTINGS_SCRIPTLOG,
       
  1064                 R_WMLBROWSER_SETTINGS_SCRIPTLOG_VALUE_TO_FILE,
       
  1065                 aItemText );                    
       
  1066             break;
       
  1067             }
       
  1068         case EWmlSettingsScriptLogToConsole:
       
  1069             {
       
  1070             CreateItemFromTwoStringsL(
       
  1071                 R_WMLBROWSER_SETTINGS_SCRIPTLOG,
       
  1072                 R_WMLBROWSER_SETTINGS_SCRIPTLOG_VALUE_TO_CONSOLE,
       
  1073                 aItemText );
       
  1074             break;
       
  1075             }  
       
  1076         case EWmlSettingsScriptLogToConsoleFile:
       
  1077             {
       
  1078                 CreateItemFromTwoStringsL(
       
  1079                     R_WMLBROWSER_SETTINGS_SCRIPTLOG,
       
  1080                     R_WMLBROWSER_SETTINGS_SCRIPTLOG_VALUE_TO_CONSOLE_FILE,
       
  1081                     aItemText );
       
  1082                 break;
       
  1083             }  
       
  1084         default:
       
  1085             CreateItemFromTwoStringsL(
       
  1086                 R_WMLBROWSER_SETTINGS_SCRIPTLOG,
       
  1087                 R_WMLBROWSER_SETTINGS_SCRIPTLOG_VALUE_DISABLE,
       
  1088                 aItemText );
       
  1089             break;
       
  1090         }    
       
  1091 
       
  1092     aItemArray->AppendL( aItemText );
       
  1093     iSettingIndex->AppendL( EWmlSettingsScriptLog );
       
  1094     }
       
  1095 
       
  1096 
       
  1097 // -----------------------------------------------------------------------------
       
  1098 // CSettingsContainer::AppendDownloadsOpenL
       
  1099 // -----------------------------------------------------------------------------
       
  1100 void CSettingsContainer::AppendDownloadsOpenL(
       
  1101                                                      CDesCArray*& aItemArray,
       
  1102                                                      TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
  1103     {
       
  1104     CreateItemFromTwoStringsL(
       
  1105         R_WMLBROWSER_SETTINGS_DOWNLOAD_OPEN,
       
  1106         ApiProvider().Preferences().DownloadsOpen() ?
       
  1107         R_WMLBROWSER_SETTINGS_DOWNLOAD_OPEN_YES :
       
  1108         R_WMLBROWSER_SETTINGS_DOWNLOAD_OPEN_NO,
       
  1109         aItemText );
       
  1110     aItemArray->AppendL( aItemText );
       
  1111     iSettingIndex->AppendL( EWmlSettingsDownloadsOpen );
       
  1112     }
       
  1113 
       
  1114 
       
  1115 
       
  1116 // -----------------------------------------------------------------------------
       
  1117 // CSettingsContainer::AppendSearchProviderL
       
  1118 // -----------------------------------------------------------------------------
       
  1119 void CSettingsContainer::AppendSearchProviderL(
       
  1120                                                       CDesCArray*& aItemArray,
       
  1121                                                       TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
  1122     {
       
  1123     aItemText.Zero();
       
  1124     aItemText.Append( KWmlSettingsListBoxItemPrefix );
       
  1125     HBufC* settingTitle = iCoeEnv->AllocReadResourceLC( R_BROWSERS_SETT_WEB_SEARCH_PROVIDER );
       
  1126     aItemText.Append( *settingTitle );
       
  1127     CleanupStack::PopAndDestroy(); // settingTitle
       
  1128     aItemText.Append( KWmlSettingsListBoxItemPostfix );
       
  1129     
       
  1130     HBufC* searchProvider = HBufC::NewLC( KMaxTitleLength );
       
  1131     TPtr searchProviderPtr = searchProvider->Des();
       
  1132     
       
  1133     ApiProvider().Preferences().GetStringValueL( KBrowserSearchProviderTitle,
       
  1134             KMaxTitleLength , searchProviderPtr);
       
  1135     
       
  1136     if(searchProvider->Compare(KNullDesC()) == 0)
       
  1137         {
       
  1138         CleanupStack::PopAndDestroy(searchProvider);
       
  1139         searchProvider = iCoeEnv->AllocReadResourceLC( R_IS_LABEL_NOT_SELECTED );
       
  1140         }
       
  1141     
       
  1142     aItemText.Append( *searchProvider );
       
  1143     CleanupStack::PopAndDestroy( searchProvider );
       
  1144     
       
  1145     aItemArray->AppendL( aItemText );
       
  1146     iSettingIndex->AppendL( EWmlSettingsSearchProvider );
       
  1147     }
       
  1148 
       
  1149 // -----------------------------------------------------------------------------
       
  1150 // CSettingsContainer::AppendAutoLoadContentL
       
  1151 // -----------------------------------------------------------------------------
       
  1152 //
       
  1153 void CSettingsContainer::AppendAutoLoadContentL(
       
  1154                                                CDesCArray*& aItemArray,
       
  1155                                                TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
  1156     {
       
  1157    
       
  1158     TInt autoLoadContent = ApiProvider().Preferences().AutoLoadContent();
       
  1159       
       
  1160     switch ( autoLoadContent )
       
  1161         {
       
  1162         case EWmlSettingsAutoloadText:
       
  1163             {
       
  1164             CreateItemFromTwoStringsL(
       
  1165                 R_WMLBROWSER_SETTINGS_AUTOLOAD_CONTENT,
       
  1166                 R_WMLBROWSER_SETTINGS_AUTOLOAD_TEXT,
       
  1167                 aItemText );
       
  1168             break;
       
  1169             }
       
  1170         case EWmlSettingsAutoloadImagesNoFlash:
       
  1171             {
       
  1172             if (iFlashPluginPresent)
       
  1173                 {
       
  1174                 CreateItemFromTwoStringsL(
       
  1175                     R_WMLBROWSER_SETTINGS_AUTOLOAD_CONTENT,
       
  1176                     R_WMLBROWSER_SETTINGS_AUTOLOAD_IMAGES_NO_FLASH,
       
  1177                     aItemText );                    
       
  1178                 }
       
  1179             else
       
  1180                 {
       
  1181                 CreateItemFromTwoStringsL(
       
  1182                     R_WMLBROWSER_SETTINGS_AUTOLOAD_CONTENT,
       
  1183                     R_WMLBROWSER_SETTINGS_AUTOLOAD_ALL,
       
  1184                     aItemText );                    
       
  1185                 }
       
  1186             break;
       
  1187             }
       
  1188         case EWmlSettingsAutoloadAll:
       
  1189             {
       
  1190             CreateItemFromTwoStringsL(
       
  1191                 R_WMLBROWSER_SETTINGS_AUTOLOAD_CONTENT,
       
  1192                 R_WMLBROWSER_SETTINGS_AUTOLOAD_ALL,
       
  1193                 aItemText );
       
  1194             break;
       
  1195             }  
       
  1196         default:
       
  1197             break;
       
  1198         }    
       
  1199 
       
  1200     aItemArray->AppendL( aItemText );
       
  1201     iSettingIndex->AppendL( EWmlSettingsAutoLoadContent );
       
  1202     }
       
  1203  
       
  1204 
       
  1205 // -----------------------------------------------------------------------------
       
  1206 // CSettingsContainer::AppendAutoFullScreenL
       
  1207 // -----------------------------------------------------------------------------
       
  1208 //
       
  1209 void CSettingsContainer::AppendAutoFullScreenL(CDesCArray*& aItemArray,
       
  1210                                                TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
  1211     {
       
  1212     switch ( ApiProvider().Preferences().FullScreen() )
       
  1213         {
       
  1214         case EWmlSettingsFullScreenSoftkeysOnly:
       
  1215             {
       
  1216             CreateItemFromTwoStringsL(
       
  1217                     R_WMLBROWSER_SETTINGS_SOFTKEYS,
       
  1218                     R_WMLBROWSER_SETTINGS_SOFTKEYS_ON,
       
  1219                     aItemText );
       
  1220             break;
       
  1221             }
       
  1222         case EWmlSettingsFullScreenFullScreen:
       
  1223             {
       
  1224             CreateItemFromTwoStringsL(
       
  1225                     R_WMLBROWSER_SETTINGS_SOFTKEYS,
       
  1226                     R_WMLBROWSER_SETTINGS_SOFTKEYS_OFF,
       
  1227                     aItemText );
       
  1228             break;
       
  1229             }        
       
  1230         default:
       
  1231             break;
       
  1232         }
       
  1233 
       
  1234     aItemArray->AppendL( aItemText );
       
  1235     iSettingIndex->AppendL( EWmlSettingsFullScreen );
       
  1236     }
       
  1237 
       
  1238 // -----------------------------------------------------------------------------
       
  1239 // CSettingsContainer::AppendAutomaticUpdatingAPL
       
  1240 // -----------------------------------------------------------------------------
       
  1241 //
       
  1242 void CSettingsContainer::AppendAutomaticUpdatingAPL(
       
  1243                                             CDesCArray*& aItemArray,
       
  1244                                             TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
  1245     {
       
  1246     TUint id = ApiProvider().Preferences().AutomaticUpdatingAP();
       
  1247     aItemText.Zero();
       
  1248     aItemText.Append( KWmlSettingsListBoxItemPrefix );
       
  1249     HBufC* defaultAp = iCoeEnv->AllocReadResourceLC(
       
  1250                             R_WMLBROWSER_SETTINGS_AUTOUPDATING_AP );
       
  1251     aItemText.Append( *defaultAp );
       
  1252     CleanupStack::PopAndDestroy(); // defaultAp
       
  1253     aItemText.Append( KWmlSettingsListBoxItemPostfix );
       
  1254     
       
  1255     if ( id == -1 )
       
  1256         {
       
  1257         // If user hasn't selected an AP, show a blank list entry. Once user
       
  1258         // selects an AP, it will be displayed.  Note: The browser's default AP
       
  1259         // is used, until user makes a different AP selection.
       
  1260         aItemText.Append( KNullDesC );
       
  1261         }
       
  1262     else
       
  1263         {
       
  1264         // User (or configuration) has already selected an AP, display its name
       
  1265         TBuf< KCommsDbSvrMaxFieldLength > name;
       
  1266         CApUtils* au = CApUtils::NewLC( ApiProvider().CommsModel().CommsDb() );
       
  1267         TRAP_IGNORE(au->NameL( id, name ));
       
  1268         aItemText.Append( name );
       
  1269         CleanupStack::PopAndDestroy();  // au
       
  1270         }
       
  1271 
       
  1272     aItemArray->AppendL( aItemText );
       
  1273     iSettingIndex->AppendL( EWmlSettingsAutomaticUpdatingAP );
       
  1274     }
       
  1275 
       
  1276 // -----------------------------------------------------------------------------
       
  1277 // CSettingsContainer::AppendAutomaticUpdatingWhileRoamingL
       
  1278 // -----------------------------------------------------------------------------
       
  1279 //
       
  1280 void CSettingsContainer::AppendAutomaticUpdatingWhileRoamingL(
       
  1281                                             CDesCArray*& aItemArray,
       
  1282                                             TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
  1283     {
       
  1284     
       
  1285     if ( iApiProvider.Preferences().AutomaticUpdatingWhileRoaming() )
       
  1286         {
       
  1287         CreateItemFromTwoStringsL(
       
  1288         R_WMLBROWSER_SETTINGS_AUTOUPDATING_ROAMING,
       
  1289         R_WMLBROWSER_SETTINGS_AUTOUPDATING_ROAMING_ON,
       
  1290         aItemText );
       
  1291         }
       
  1292     else
       
  1293         {
       
  1294         CreateItemFromTwoStringsL(
       
  1295             R_WMLBROWSER_SETTINGS_AUTOUPDATING_ROAMING,
       
  1296             R_WMLBROWSER_SETTINGS_AUTOUPDATING_ROAMING_OFF,
       
  1297             aItemText );
       
  1298         }
       
  1299     aItemArray->AppendL( aItemText );
       
  1300     
       
  1301     iSettingIndex->AppendL( EWmlSettingsAutomaticUpdatingWhileRoaming );
       
  1302     }
       
  1303     
       
  1304 // -----------------------------------------------------------------------------
       
  1305 // CSettingsContainer::AppendAutoMediaVolumeL
       
  1306 // -----------------------------------------------------------------------------
       
  1307 //
       
  1308 void CSettingsContainer::AppendAutoMediaVolumeL(
       
  1309                                                 CDesCArray*& aItemArray,
       
  1310                                                 TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
  1311     {
       
  1312     TInt volumeLevel = ApiProvider().Preferences().MediaVolume();
       
  1313 
       
  1314     switch ( volumeLevel )
       
  1315         {
       
  1316         case EWmlSettingsVolumeMuted:
       
  1317             {
       
  1318             CreateItemFromTwoStringsL(
       
  1319                 R_WMLBROWSER_SETTINGS_MEDIA_VOLUME,
       
  1320                 R_WMLBROWSER_SETTINGS_MEDIA_VOLUME_MUTED,
       
  1321                 aItemText );
       
  1322             break;
       
  1323             }
       
  1324         case EWmlSettingsVolume1:
       
  1325             {
       
  1326             CreateItemFromTwoStringsL(
       
  1327                 R_WMLBROWSER_SETTINGS_MEDIA_VOLUME,
       
  1328                 R_WMLBROWSER_SETTINGS_MEDIA_VOLUME_1,
       
  1329                 aItemText );
       
  1330             break;
       
  1331             }
       
  1332         case EWmlSettingsVolume2:
       
  1333             {
       
  1334             CreateItemFromTwoStringsL(
       
  1335                 R_WMLBROWSER_SETTINGS_MEDIA_VOLUME,
       
  1336                 R_WMLBROWSER_SETTINGS_MEDIA_VOLUME_2,
       
  1337                 aItemText );
       
  1338             break;
       
  1339             }
       
  1340         case EWmlSettingsVolume3:
       
  1341             {
       
  1342             CreateItemFromTwoStringsL(
       
  1343                 R_WMLBROWSER_SETTINGS_MEDIA_VOLUME,
       
  1344                 R_WMLBROWSER_SETTINGS_MEDIA_VOLUME_3,
       
  1345                 aItemText );
       
  1346             break;
       
  1347             }
       
  1348         case EWmlSettingsVolume4:
       
  1349             {
       
  1350             CreateItemFromTwoStringsL(
       
  1351                 R_WMLBROWSER_SETTINGS_MEDIA_VOLUME,
       
  1352                 R_WMLBROWSER_SETTINGS_MEDIA_VOLUME_4,
       
  1353                 aItemText );
       
  1354             break;
       
  1355             }
       
  1356         default:
       
  1357             break;
       
  1358         }
       
  1359 
       
  1360     aItemArray->AppendL( aItemText );
       
  1361     iSettingIndex->AppendL( EWmlSettingsMediaVolume );
       
  1362     }
       
  1363 
       
  1364 // -----------------------------------------------------------------------------
       
  1365 // CSettingsContainer::AppendEncodingL
       
  1366 // -----------------------------------------------------------------------------
       
  1367 //
       
  1368 void CSettingsContainer::AppendEncodingL(
       
  1369                                          CDesCArray*& aItemArray,
       
  1370                                          TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
  1371     {
       
  1372     TBool currentEncodingFound = EFalse;
       
  1373     for( int i = 0; i < iEncodingArray->Count(); i++ )
       
  1374         {
       
  1375         if( iEncodingArray->At(i).iSystemId == iEncoding )
       
  1376             {
       
  1377             CreateItemFromTwoStringsL(
       
  1378                         R_WMLBROWSER_SETTINGS_ENCODING,
       
  1379                         iEncodingArray->At(i).iResId,
       
  1380                         aItemText );
       
  1381             currentEncodingFound = ETrue;
       
  1382             break;
       
  1383             }
       
  1384         }
       
  1385 
       
  1386     if( !currentEncodingFound )
       
  1387         {
       
  1388         __ASSERT_DEBUG( EFalse, Util::Panic( Util::EOutOfRange ));
       
  1389         }
       
  1390 
       
  1391     aItemArray->AppendL( aItemText );
       
  1392     iSettingIndex->AppendL( EWmlSettingsEncoding );
       
  1393     }
       
  1394 
       
  1395 // -----------------------------------------------------------------------------
       
  1396 // CSettingsContainer::AppendPopupBlockingL
       
  1397 // -----------------------------------------------------------------------------
       
  1398 //
       
  1399 void CSettingsContainer::AppendPopupBlockingL(
       
  1400                                               CDesCArray*& aItemArray,
       
  1401                                               TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
  1402     {
       
  1403     if ( ApiProvider().Preferences().PopupBlocking() )
       
  1404         {
       
  1405         CreateItemFromTwoStringsL(
       
  1406             R_WMLBROWSER_SETTINGS_POPUP_BLOCKING,
       
  1407             R_WMLBROWSER_SETTINGS_POPUP_BLOCKING_ON,
       
  1408             aItemText );
       
  1409         }
       
  1410     else
       
  1411         {
       
  1412         CreateItemFromTwoStringsL(
       
  1413             R_WMLBROWSER_SETTINGS_POPUP_BLOCKING,
       
  1414             R_WMLBROWSER_SETTINGS_POPUP_BLOCKING_OFF,
       
  1415             aItemText );
       
  1416         }
       
  1417     aItemArray->AppendL( aItemText );
       
  1418     iSettingIndex->AppendL( EWmlSettingsPopupBlocking );
       
  1419     }
       
  1420 
       
  1421 // -----------------------------------------------------------------------------
       
  1422 // CSettingsContainer::AppendAutoRefreshL
       
  1423 // -----------------------------------------------------------------------------
       
  1424 //
       
  1425 void CSettingsContainer::AppendAutoRefreshL(
       
  1426                                             CDesCArray*& aItemArray,
       
  1427                                             TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
  1428     {
       
  1429     if ( iApiProvider.Preferences().AutoRefresh() )
       
  1430         {
       
  1431         CreateItemFromTwoStringsL(
       
  1432         R_WMLBROWSER_SETTINGS_AUTO_REFRESH,
       
  1433         R_WMLBROWSER_SETTINGS_AUTO_REFRESH_ON,
       
  1434         aItemText );
       
  1435         }
       
  1436     else
       
  1437         {
       
  1438         CreateItemFromTwoStringsL(
       
  1439             R_WMLBROWSER_SETTINGS_AUTO_REFRESH,
       
  1440             R_WMLBROWSER_SETTINGS_AUTO_REFRESH_OFF,
       
  1441             aItemText );
       
  1442         }
       
  1443     aItemArray->AppendL( aItemText );
       
  1444     iSettingIndex->AppendL( EWmlSettingsAutoRefresh );
       
  1445     }
       
  1446 
       
  1447 // -----------------------------------------------------------------------------
       
  1448 // CSettingsContainer::AppendAdaptiveBookmarksL
       
  1449 // -----------------------------------------------------------------------------
       
  1450 //
       
  1451 void CSettingsContainer::AppendAdaptiveBookmarksL(
       
  1452                                                   CDesCArray*& aItemArray,
       
  1453                                                   TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
  1454     {
       
  1455     switch ( ApiProvider().Preferences().AdaptiveBookmarks() )
       
  1456         {
       
  1457         case EWmlSettingsAdaptiveBookmarksOn:
       
  1458             {
       
  1459             CreateItemFromTwoStringsL(
       
  1460                 R_WMLBROWSER_SETTINGS_ADAPTIVE_BOOKMARKS,
       
  1461                 R_WMLBROWSER_SETTINGS_ADAPTIVE_BOOKMARKS_VALUE_ON,
       
  1462                 aItemText );
       
  1463             break;
       
  1464             }
       
  1465         case EWmlSettingsAdaptiveBookmarksHideFolder:
       
  1466             {
       
  1467             CreateItemFromTwoStringsL(
       
  1468                     R_WMLBROWSER_SETTINGS_ADAPTIVE_BOOKMARKS,
       
  1469                     R_WMLBROWSER_SETTINGS_ADAPTIVE_BOOKMARKS_VALUE_HIDE_FOLDER,
       
  1470                     aItemText );
       
  1471             break;
       
  1472             }
       
  1473         case EWmlSettingsAdaptiveBookmarksOff:
       
  1474             {
       
  1475             CreateItemFromTwoStringsL(
       
  1476               R_WMLBROWSER_SETTINGS_ADAPTIVE_BOOKMARKS,
       
  1477               R_WMLBROWSER_SETTINGS_ADAPTIVE_BOOKMARKS_VALUE_OFF,
       
  1478               aItemText );
       
  1479             break;
       
  1480             }
       
  1481         default:
       
  1482             break;
       
  1483         }
       
  1484 
       
  1485     aItemArray->AppendL( aItemText );
       
  1486     iSettingIndex->AppendL( EWmlSettingsAdaptiveBookmarks );
       
  1487     }
       
  1488 
       
  1489 // -----------------------------------------------------------------------------
       
  1490 // CSettingsContainer::AppendFormDataSavingL
       
  1491 // -----------------------------------------------------------------------------
       
  1492 //
       
  1493 void CSettingsContainer::AppendFormDataSavingL(
       
  1494                                                CDesCArray*& aItemArray,
       
  1495                                                TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
  1496     {
       
  1497     switch ( ApiProvider().Preferences().FormDataSaving() )
       
  1498         {
       
  1499         case EWmlSettingsFormDataPlusPassword:
       
  1500             {
       
  1501             CreateItemFromTwoStringsL(
       
  1502                 R_WMLBROWSER_SETTINGS_FORM_DATA_SAVING,
       
  1503                 R_WMLBROWSER_SETTINGS_FORM_DATA_SAVING_ON,
       
  1504                 aItemText );
       
  1505             break;
       
  1506             }
       
  1507         case EWmlSettingsFormDataOnly:
       
  1508             {
       
  1509             CreateItemFromTwoStringsL(
       
  1510                 R_WMLBROWSER_SETTINGS_FORM_DATA_SAVING,
       
  1511                 R_WMLBROWSER_SETTINGS_FORM_DATA_SAVING_ONLY,
       
  1512                 aItemText );
       
  1513             break;
       
  1514             }
       
  1515         case EWmlSettingsFormDataOff:
       
  1516             {
       
  1517             CreateItemFromTwoStringsL(
       
  1518                 R_WMLBROWSER_SETTINGS_FORM_DATA_SAVING,
       
  1519                 R_WMLBROWSER_SETTINGS_FORM_DATA_SAVING_OFF,
       
  1520                 aItemText );
       
  1521             break;
       
  1522             }
       
  1523 
       
  1524         default:
       
  1525             break;
       
  1526         }
       
  1527     aItemArray->AppendL( aItemText );
       
  1528     iSettingIndex->AppendL( EWmlSettingsFormDataSaving );
       
  1529     }
       
  1530 
       
  1531 // -----------------------------------------------------------------------------
       
  1532 // CSettingsContainer::AppendCookiesL
       
  1533 // -----------------------------------------------------------------------------
       
  1534 //
       
  1535 void CSettingsContainer::AppendCookiesL(
       
  1536                                         CDesCArray*& aItemArray,
       
  1537                                         TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
  1538     {
       
  1539     switch ( ApiProvider().Preferences().Cookies() )
       
  1540         {
       
  1541         case EWmlSettingsCookieAllow:
       
  1542             {
       
  1543             CreateItemFromTwoStringsL(
       
  1544                   R_WMLBROWSER_SETTINGS_COOKIES,
       
  1545                   R_WMLBROWSER_SETTINGS_C_VALUE_ALLOW,
       
  1546                   aItemText );
       
  1547             break;
       
  1548             }
       
  1549         case EWmlSettingsCookieReject:
       
  1550             {
       
  1551             CreateItemFromTwoStringsL(
       
  1552                   R_WMLBROWSER_SETTINGS_COOKIES,
       
  1553                   R_WMLBROWSER_SETTINGS_C_VALUE_REJECT,
       
  1554                   aItemText );
       
  1555             break;
       
  1556             }
       
  1557         default:
       
  1558             break;
       
  1559         }
       
  1560 
       
  1561     aItemArray->AppendL( aItemText );
       
  1562     iSettingIndex->AppendL( EWmlSettingsCookies );
       
  1563     }
       
  1564 
       
  1565 // -----------------------------------------------------------------------------
       
  1566 // CSettingsContainer::AppendIMEIL
       
  1567 // -----------------------------------------------------------------------------
       
  1568 //
       
  1569 void CSettingsContainer::AppendIMEIL(
       
  1570                                      CDesCArray*& aItemArray,
       
  1571                                      TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
  1572     {
       
  1573     switch ( ApiProvider().Preferences().IMEINotification() )
       
  1574         {
       
  1575         case EWmlSettingsIMEIEnable:
       
  1576             CreateItemFromTwoStringsL(
       
  1577                 R_WMLBROWSER_SETTINGS_IMEI,
       
  1578                 R_WMLBROWSER_SETTINGS_IMEI_VALUE_ENABLED,
       
  1579                 aItemText );
       
  1580             break;
       
  1581         case EWmlSettingsIMEIDisable:
       
  1582             CreateItemFromTwoStringsL(
       
  1583                 R_WMLBROWSER_SETTINGS_IMEI,
       
  1584                 R_WMLBROWSER_SETTINGS_IMEI_VALUE_DISABLED,
       
  1585                 aItemText );
       
  1586             break;
       
  1587         default:
       
  1588             break;
       
  1589         }
       
  1590     aItemArray->AppendL( aItemText );
       
  1591     iSettingIndex->AppendL( EWmlSettingsIMEINotification );
       
  1592 
       
  1593     }
       
  1594 // -----------------------------------------------------------------------------
       
  1595 // CSettingsContainer::AppendFontSize
       
  1596 // -----------------------------------------------------------------------------
       
  1597 //
       
  1598 void CSettingsContainer::AppendFontSizeL( CDesCArray*& aItemArray,
       
  1599                                          TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
  1600     {
       
  1601     CreateItemFromTwoStringsL(R_WMLBROWSER_SETTINGS_FONT_SIZE,
       
  1602                               GetFontSizeString(),
       
  1603                               aItemText );
       
  1604     aItemArray->AppendL( aItemText );
       
  1605     iSettingIndex->AppendL( EWmlSettingsFontSize );
       
  1606     }
       
  1607 
       
  1608 
       
  1609 // -----------------------------------------------------------------------------
       
  1610 // CSettingsContainer::GetFontSizeString
       
  1611 //   Convenience utility. Note that many of the settings duplicate the
       
  1612 //   code to generate this sort od string. This pattern could be applied
       
  1613 //   to many of the settings to reduce the code size. A side effect of this
       
  1614 //   code is that the iFontSize variable may be modified in the Chinese
       
  1615 //   Build case. This code is in one place now and not duplicated.
       
  1616 // -----------------------------------------------------------------------------
       
  1617 //
       
  1618 TInt CSettingsContainer::GetFontSizeString()
       
  1619    {
       
  1620     // China build (__AVKON_APAC__) has only three font sizes.
       
  1621     // If for some reason smaller/larger is selected, display it as "normal"
       
  1622     if (!AVKONAPAC)
       
  1623         {
       
  1624         switch (iFontSize)
       
  1625             {
       
  1626             case 0:
       
  1627               return R_WMLBROWSER_SETTINGS_FS_VALUE_ALL_SMALL;
       
  1628             case 1:
       
  1629               return R_WMLBROWSER_SETTINGS_FS_VALUE_SMALLER;
       
  1630             case 2:
       
  1631               return R_WMLBROWSER_SETTINGS_FS_VALUE_NORMAL;
       
  1632             case 3:
       
  1633               return R_WMLBROWSER_SETTINGS_FS_VALUE_LARGER;
       
  1634             case 4:
       
  1635               return R_WMLBROWSER_SETTINGS_FS_VALUE_ALL_LARGE;
       
  1636             default:
       
  1637               return R_WMLBROWSER_SETTINGS_FS_VALUE_NORMAL;
       
  1638             }
       
  1639         }
       
  1640     else
       
  1641         {
       
  1642         switch (iFontSize)
       
  1643             {
       
  1644             case 0:
       
  1645               return R_WMLBROWSER_SETTINGS_FS_VALUE_ALL_SMALL;
       
  1646             case 1:
       
  1647             case 2:
       
  1648             case 3:
       
  1649               //These three map to same size.
       
  1650               iFontSize = 2;
       
  1651               return R_WMLBROWSER_SETTINGS_FS_VALUE_NORMAL;
       
  1652             case 4:
       
  1653               return R_WMLBROWSER_SETTINGS_FS_VALUE_ALL_LARGE;
       
  1654             default:
       
  1655               return R_WMLBROWSER_SETTINGS_FS_VALUE_NORMAL;
       
  1656             }
       
  1657         }
       
  1658    }
       
  1659 
       
  1660 // -----------------------------------------------------------------------------
       
  1661 // CSettingsContainer::AppendToolbarButtonsL
       
  1662 // -----------------------------------------------------------------------------
       
  1663 //
       
  1664 void CSettingsContainer::AppendToolbarButtonsL( CDesCArray*& aItemArray,
       
  1665                                                 TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
  1666     {
       
  1667    
       
  1668     CreateItemFromTwoStringsL(
       
  1669         R_BROWSER_SETTING_TOOLBAR_BUTTON1,
       
  1670         ToolbarCommandDecodeMatrix[iApiProvider.Preferences().ShowToolbarButton1Cmd()][KToolbarCommandDecodeMatrixStringId],
       
  1671         aItemText );
       
  1672     aItemArray->AppendL( aItemText );
       
  1673     iSettingIndex->AppendL( EWmlSettingsToolbarButton1Cmd );    
       
  1674     
       
  1675     CreateItemFromTwoStringsL(
       
  1676         R_BROWSER_SETTING_TOOLBAR_BUTTON2,
       
  1677         ToolbarCommandDecodeMatrix[iApiProvider.Preferences().ShowToolbarButton2Cmd()][KToolbarCommandDecodeMatrixStringId],
       
  1678         aItemText );
       
  1679     aItemArray->AppendL( aItemText );
       
  1680     iSettingIndex->AppendL( EWmlSettingsToolbarButton2Cmd );     
       
  1681     
       
  1682     CreateItemFromTwoStringsL(
       
  1683         R_BROWSER_SETTING_TOOLBAR_BUTTON3,
       
  1684         ToolbarCommandDecodeMatrix[iApiProvider.Preferences().ShowToolbarButton3Cmd()][KToolbarCommandDecodeMatrixStringId],
       
  1685         aItemText );
       
  1686     aItemArray->AppendL( aItemText );
       
  1687     iSettingIndex->AppendL( EWmlSettingsToolbarButton3Cmd );     
       
  1688     
       
  1689     CreateItemFromTwoStringsL(
       
  1690         R_BROWSER_SETTING_TOOLBAR_BUTTON4,
       
  1691         ToolbarCommandDecodeMatrix[iApiProvider.Preferences().ShowToolbarButton4Cmd()][KToolbarCommandDecodeMatrixStringId],
       
  1692         aItemText );
       
  1693     aItemArray->AppendL( aItemText );
       
  1694     iSettingIndex->AppendL( EWmlSettingsToolbarButton4Cmd );     
       
  1695     
       
  1696     CreateItemFromTwoStringsL(
       
  1697         R_BROWSER_SETTING_TOOLBAR_BUTTON5,
       
  1698         ToolbarCommandDecodeMatrix[iApiProvider.Preferences().ShowToolbarButton5Cmd()][KToolbarCommandDecodeMatrixStringId],
       
  1699         aItemText );
       
  1700     aItemArray->AppendL( aItemText );
       
  1701     iSettingIndex->AppendL( EWmlSettingsToolbarButton5Cmd );     
       
  1702      
       
  1703     
       
  1704     CreateItemFromTwoStringsL(
       
  1705         R_BROWSER_SETTING_TOOLBAR_BUTTON6,
       
  1706         ToolbarCommandDecodeMatrix[iApiProvider.Preferences().ShowToolbarButton6Cmd()][KToolbarCommandDecodeMatrixStringId],
       
  1707         aItemText );
       
  1708     aItemArray->AppendL( aItemText );
       
  1709     iSettingIndex->AppendL( EWmlSettingsToolbarButton6Cmd );     
       
  1710     
       
  1711     
       
  1712     CreateItemFromTwoStringsL(
       
  1713         R_BROWSER_SETTING_TOOLBAR_BUTTON7,
       
  1714         ToolbarCommandDecodeMatrix[iApiProvider.Preferences().ShowToolbarButton7Cmd()][KToolbarCommandDecodeMatrixStringId],
       
  1715         aItemText );
       
  1716     aItemArray->AppendL( aItemText );
       
  1717     iSettingIndex->AppendL( EWmlSettingsToolbarButton7Cmd );
       
  1718     }
       
  1719 
       
  1720 // -----------------------------------------------------------------------------
       
  1721 // CSettingsContainer::AppendShortcutKeysL
       
  1722 // -----------------------------------------------------------------------------
       
  1723 //
       
  1724 void CSettingsContainer::AppendShortcutKeysL( CDesCArray*& aItemArray,
       
  1725                                                 TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
  1726     {
       
  1727    
       
  1728     CreateItemFromTwoStringsL(
       
  1729         R_BROWSER_SETTING_SHORTCUT_KEY1,
       
  1730         ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey1Cmd()][KShortcutsCommandDecodeMatrixStringId],
       
  1731         aItemText );
       
  1732     aItemArray->AppendL( aItemText );
       
  1733     iSettingIndex->AppendL( EWmlSettingsShortCutKey1Cmd );    
       
  1734     
       
  1735 
       
  1736     CreateItemFromTwoStringsL(
       
  1737         R_BROWSER_SETTING_SHORTCUT_KEY2,
       
  1738         ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey2Cmd()][KShortcutsCommandDecodeMatrixStringId],
       
  1739         aItemText );
       
  1740     aItemArray->AppendL( aItemText );
       
  1741     iSettingIndex->AppendL( EWmlSettingsShortCutKey2Cmd );    
       
  1742 
       
  1743 
       
  1744     CreateItemFromTwoStringsL(
       
  1745         R_BROWSER_SETTING_SHORTCUT_KEY3,
       
  1746         ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey3Cmd()][KShortcutsCommandDecodeMatrixStringId],
       
  1747         aItemText );
       
  1748     aItemArray->AppendL( aItemText );
       
  1749     iSettingIndex->AppendL( EWmlSettingsShortCutKey3Cmd );    
       
  1750 
       
  1751     CreateItemFromTwoStringsL(
       
  1752         R_BROWSER_SETTING_SHORTCUT_KEY4,
       
  1753         ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey4Cmd()][KShortcutsCommandDecodeMatrixStringId],
       
  1754         aItemText );
       
  1755     aItemArray->AppendL( aItemText );
       
  1756     iSettingIndex->AppendL( EWmlSettingsShortCutKey4Cmd );    
       
  1757 
       
  1758     CreateItemFromTwoStringsL(
       
  1759         R_BROWSER_SETTING_SHORTCUT_KEY5,
       
  1760         ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey5Cmd()][KShortcutsCommandDecodeMatrixStringId],
       
  1761         aItemText );
       
  1762     aItemArray->AppendL( aItemText );
       
  1763     iSettingIndex->AppendL( EWmlSettingsShortCutKey5Cmd );    
       
  1764 
       
  1765 
       
  1766     CreateItemFromTwoStringsL(
       
  1767         R_BROWSER_SETTING_SHORTCUT_KEY6,
       
  1768         ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey6Cmd()][KShortcutsCommandDecodeMatrixStringId],
       
  1769         aItemText );
       
  1770     aItemArray->AppendL( aItemText );
       
  1771     iSettingIndex->AppendL( EWmlSettingsShortCutKey6Cmd );    
       
  1772 
       
  1773     CreateItemFromTwoStringsL(
       
  1774         R_BROWSER_SETTING_SHORTCUT_KEY7,
       
  1775         ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey7Cmd()][KShortcutsCommandDecodeMatrixStringId],
       
  1776         aItemText );
       
  1777     aItemArray->AppendL( aItemText );
       
  1778     iSettingIndex->AppendL( EWmlSettingsShortCutKey7Cmd );    
       
  1779 
       
  1780     CreateItemFromTwoStringsL(
       
  1781         R_BROWSER_SETTING_SHORTCUT_KEY8,
       
  1782         ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey8Cmd()][KShortcutsCommandDecodeMatrixStringId],
       
  1783         aItemText );
       
  1784     aItemArray->AppendL( aItemText );
       
  1785     iSettingIndex->AppendL( EWmlSettingsShortCutKey8Cmd );    
       
  1786     
       
  1787     CreateItemFromTwoStringsL(
       
  1788         R_BROWSER_SETTING_SHORTCUT_KEY9,
       
  1789         ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey9Cmd()][KShortcutsCommandDecodeMatrixStringId],
       
  1790         aItemText );
       
  1791     aItemArray->AppendL( aItemText );
       
  1792     iSettingIndex->AppendL( EWmlSettingsShortCutKey9Cmd );    
       
  1793 
       
  1794     CreateItemFromTwoStringsL(
       
  1795         R_BROWSER_SETTING_SHORTCUT_KEY0,
       
  1796         ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKey0Cmd()][KShortcutsCommandDecodeMatrixStringId],
       
  1797         aItemText );
       
  1798     aItemArray->AppendL( aItemText );
       
  1799     iSettingIndex->AppendL( EWmlSettingsShortCutKey0Cmd );    
       
  1800 
       
  1801     CreateItemFromTwoStringsL(
       
  1802         R_BROWSER_SETTING_SHORTCUT_KEYSTAR,
       
  1803         ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKeyStarCmd()][KShortcutsCommandDecodeMatrixStringId],
       
  1804         aItemText );
       
  1805     aItemArray->AppendL( aItemText );
       
  1806     iSettingIndex->AppendL( EWmlSettingsShortCutKeyStarCmd );    
       
  1807 
       
  1808     CreateItemFromTwoStringsL(
       
  1809         R_BROWSER_SETTING_SHORTCUT_KEYHASH,
       
  1810         ShortcutsCommandDecodeMatrix[iApiProvider.Preferences().ShortcutKeyHashCmd()][KShortcutsCommandDecodeMatrixStringId],
       
  1811         aItemText );
       
  1812     aItemArray->AppendL( aItemText );
       
  1813     iSettingIndex->AppendL( EWmlSettingsShortCutKeyHashCmd );    
       
  1814    
       
  1815     }
       
  1816 
       
  1817 
       
  1818 // -----------------------------------------------------------------------------
       
  1819 // CSettingsContainer::ClearListBoxContentL
       
  1820 // -----------------------------------------------------------------------------
       
  1821 //
       
  1822 void CSettingsContainer::ClearListBoxContentL()
       
  1823     {
       
  1824     CDesCArray* itemArray =
       
  1825             ( CDesCArray* ) ( iSettingListBox->Model()->ItemTextArray() );
       
  1826 
       
  1827     // Clear out the listbox content - it is reusable
       
  1828     while ( itemArray->Count() )
       
  1829         {
       
  1830         itemArray->Delete( 0 );
       
  1831         }
       
  1832     while ( iSettingIndex->Count() )
       
  1833         {
       
  1834         iSettingIndex->Delete( 0 );
       
  1835         }
       
  1836     }
       
  1837 
       
  1838 // -----------------------------------------------------------------------------
       
  1839 // CSettingsContainer::StoreListBoxIndexL
       
  1840 // -----------------------------------------------------------------------------
       
  1841 //
       
  1842 void CSettingsContainer::StoreListBoxIndexL()
       
  1843     {
       
  1844     // We only use one list box for all of the lists in the Settings,
       
  1845     // we need to keep track of the current & top indices so that focus
       
  1846     // is updated correctly
       
  1847 
       
  1848     if ( iCurrentSettingCategory == EMain )
       
  1849         {
       
  1850         iMainSettingCurrentIndex = iSettingListBox->CurrentItemIndex();
       
  1851         iMainSettingTopPosIndex = iSettingListBox->TopItemIndex();
       
  1852 
       
  1853         // Reinitialise the subsetting indices
       
  1854         iSubSettingCurrentIndex = KWmlSettingsIndexNone;
       
  1855         iSubSettingTopPosIndex = 0;
       
  1856         }
       
  1857     else
       
  1858         {
       
  1859         iSubSettingCurrentIndex = iSettingListBox->CurrentItemIndex();
       
  1860         iSubSettingTopPosIndex = iSettingListBox->TopItemIndex();
       
  1861         }
       
  1862     }
       
  1863 
       
  1864 // -----------------------------------------------------------------------------
       
  1865 // CSettingsContainer::RestoreListBoxIndexL
       
  1866 // -----------------------------------------------------------------------------
       
  1867 //
       
  1868 void CSettingsContainer::RestoreListBoxIndexL()
       
  1869     {
       
  1870     iSettingListBox->Reset();
       
  1871 
       
  1872     // Listbox might not have index
       
  1873     if ( iCurrentSettingCategory == EMain )
       
  1874         {
       
  1875         if ( iMainSettingCurrentIndex != KWmlSettingsIndexNone )
       
  1876             {
       
  1877             iSettingListBox->SetCurrentItemIndex( iMainSettingCurrentIndex );
       
  1878             iSettingListBox->SetTopItemIndex( iMainSettingTopPosIndex );
       
  1879             }
       
  1880         }
       
  1881     else
       
  1882         {
       
  1883         if ( iSubSettingCurrentIndex != KWmlSettingsIndexNone )
       
  1884             {
       
  1885             iSettingListBox->SetCurrentItemIndex( iSubSettingCurrentIndex );
       
  1886             iSettingListBox->SetTopItemIndex( iSubSettingTopPosIndex );
       
  1887             }
       
  1888         }
       
  1889     iSettingListBox->HandleItemAdditionL();
       
  1890     iSettingListBox->DrawNow();
       
  1891     }
       
  1892 
       
  1893 // -----------------------------------------------------------------------------
       
  1894 // CSettingsContainer::ChangeItemL
       
  1895 // -----------------------------------------------------------------------------
       
  1896 //
       
  1897 void CSettingsContainer::ChangeItemL( TBool aSelectKeyWasPressed )
       
  1898     {
       
  1899     LOG_ENTERFN("CSettingsContainer::ChangeItemL");
       
  1900     // item is selected for modification
       
  1901     TInt currentItem( iSettingListBox->CurrentItemIndex() );
       
  1902 
       
  1903 
       
  1904     
       
  1905     // creating array to hold resource ids of options
       
  1906     CArrayFixFlat<TInt> *values=new(ELeave)CArrayFixFlat<TInt>( 4 );
       
  1907 
       
  1908     // creating an array to hold mapping between displayed choices and resource ids
       
  1909     // in the case of Toolbar/Shortcut key assignments
       
  1910     // where some commands (like ROTATE) are not visible.
       
  1911     CArrayFixFlat<TInt> *valueDisplayMapping=new(ELeave)CArrayFixFlat<TInt>(4);
       
  1912 
       
  1913 
       
  1914     CleanupStack::PushL( values );
       
  1915     CleanupStack::PushL( valueDisplayMapping );
       
  1916     TInt value;
       
  1917     MPreferences& preferences = ApiProvider().Preferences();
       
  1918     TInt settingsItem = MapCurrentItem( currentItem );
       
  1919     switch ( settingsItem )
       
  1920         {
       
  1921         case EWmlSettingsAccesspoint:
       
  1922             {
       
  1923             TInt err(KErrNone);
       
  1924             TInt retVal( KErrNone );
       
  1925             //start the connection  dialog
       
  1926             CCmApplicationSettingsUi* settings = CCmApplicationSettingsUi::NewL();
       
  1927             CleanupStack::PushL( settings );
       
  1928             
       
  1929             TCmSettingSelection selection;
       
  1930             
       
  1931             //
       
  1932             // In Avkon tradition,
       
  1933             // set the id of selection from the existing setting in preferences
       
  1934             // so it is shown that way in the selection dialog box.
       
  1935             //
       
  1936             // Note the CCmApplicationSettingsUi API should ensure that if
       
  1937             // "Connection Method" was previously selected, it should show up as
       
  1938             // "Uncategorized" being shown selected
       
  1939             //
       
  1940             switch (preferences.AccessPointSelectionMode())
       
  1941                 {   
       
  1942                 case EAlwaysAsk:
       
  1943                     {                       
       
  1944                     selection.iResult = EAlwaysAsk;
       
  1945                     selection.iId = preferences.DefaultSnapId();
       
  1946                     break;
       
  1947                     }
       
  1948                 case EDestination:
       
  1949                     {                       
       
  1950                     selection.iResult = EDestination;
       
  1951                     selection.iId = preferences.DefaultSnapId();
       
  1952                     break;
       
  1953                     }
       
  1954                 case EConnectionMethod:
       
  1955                     {
       
  1956                     selection.iResult = EConnectionMethod;
       
  1957                     selection.iId = Util::IapIdFromWapIdL( ApiProvider(), preferences.DefaultAccessPoint() );
       
  1958                     break;
       
  1959                     }
       
  1960                 default:
       
  1961                     // default case, set it to nothing
       
  1962                     selection.iResult = EDefaultConnection;
       
  1963                     break;
       
  1964                 }
       
  1965                         
       
  1966             // empty filter array because no filtering is wanted
       
  1967             TBearerFilterArray filterArray;
       
  1968             TRAP ( err, retVal = settings->RunApplicationSettingsL( selection, 
       
  1969                                                 EShowAlwaysAsk | EShowDestinations | EShowConnectionMethods,
       
  1970                                                 // turn off SNAP
       
  1971 //                                                EShowAlwaysAsk | EShowConnectionMethods,
       
  1972                                                 filterArray ) );
       
  1973             CleanupStack::PopAndDestroy();//settings
       
  1974             
       
  1975             //if something has been selected
       
  1976             if (retVal) 
       
  1977                 {
       
  1978                 //set the selection mode
       
  1979                 preferences.SetAccessPointSelectionModeL( 
       
  1980                         STATIC_CAST( TCmSettingSelectionMode, selection.iResult ) );
       
  1981 
       
  1982                 //based on the chosen connection type, store the connection identifier(iapid, snap id, always ask)
       
  1983                 //in the preferences list
       
  1984                 switch (preferences.AccessPointSelectionMode())
       
  1985                     {           
       
  1986                     case EConnectionMethod:
       
  1987                         {
       
  1988                         BROWSER_LOG( ( _L( "CSettingsContainer::ChangeItemL CApSettingsHandler" ) ) );
       
  1989                             
       
  1990                         TUint32 id = preferences.DefaultAccessPoint();
       
  1991                         // CMManager gives us IAPid, need to translate to WAPid
       
  1992                         if (selection.iId != 0)
       
  1993                             {                           
       
  1994                             id = Util::WapIdFromIapIdL( ApiProvider(), selection.iId ); 
       
  1995                             }                               
       
  1996                         preferences.SetDefaultAccessPointL( id );
       
  1997                         BROWSER_LOG( ( _L( " SetDefaultAccessPointL OK" ) ) );
       
  1998                         // Requested AP is preset for PushMtm
       
  1999                         ApiProvider().SetRequestedAP( preferences.DefaultAccessPoint() );
       
  2000                         break;  
       
  2001                         }
       
  2002 
       
  2003                     case EDestination:
       
  2004                         {
       
  2005                         TUint32 snapId = preferences.DefaultSnapId();
       
  2006                         if (selection.iId != 0)
       
  2007                             {                           
       
  2008                             snapId = selection.iId;
       
  2009                             }                   
       
  2010                         preferences.SetDefaultSnapId( snapId );
       
  2011 
       
  2012                         break;  
       
  2013                         }
       
  2014 
       
  2015                     case EAlwaysAsk:
       
  2016                         {
       
  2017                         break;  
       
  2018                         }
       
  2019 
       
  2020                     default:
       
  2021                         {
       
  2022                         LOG_ENTERFN(" Wrong value in CSettingsContainer::ChangeItemL");
       
  2023                         }
       
  2024                     }           
       
  2025                 }
       
  2026 
       
  2027             DisplayGeneralSettingsL();
       
  2028             BROWSER_LOG( ( _L( "DisplayGeneralSettingsL OK" ) ) );
       
  2029 
       
  2030             break;
       
  2031             }
       
  2032 
       
  2033         case EWmlSettingsAutoLoadContent:
       
  2034             {
       
  2035             if(iFlashPluginPresent)
       
  2036                 {
       
  2037                 value = 2 - preferences.AutoLoadContent();
       
  2038                 
       
  2039                 values->AppendL( R_WMLBROWSER_SETTINGS_AUTOLOAD_ALL );              // 2
       
  2040                 values->AppendL( R_WMLBROWSER_SETTINGS_AUTOLOAD_IMAGES_NO_FLASH );  // 1
       
  2041                 values->AppendL( R_WMLBROWSER_SETTINGS_AUTOLOAD_TEXT );             // 0
       
  2042                 
       
  2043                 value = 2 - (ShowRadioButtonSettingPageL(R_WMLBROWSER_SETTINGS_AUTOLOAD_CONTENT,
       
  2044                                                             values,
       
  2045                                                             value ));
       
  2046                 }
       
  2047             else
       
  2048                 {
       
  2049                 // Below is cenrep values for Load Content for cenrep key KBrowserNGImagesEnabled
       
  2050                 // Load Content 
       
  2051                 // Valid values: 
       
  2052                 // If flash plugin is present: 0 = Text only, 1 = Images,No flash, 2 = All
       
  2053                 // If flash plugin is not present 0 = Text only, 1 = All
       
  2054                 
       
  2055                 // Based on this we have to manually translate the value of 1 from Images,No flash to All 
       
  2056                 // in case where the flash plugin is not present.
       
  2057 
       
  2058 
       
  2059                 value = 1 - preferences.AutoLoadContent();
       
  2060 
       
  2061                 if ( value < 0 )
       
  2062                     {
       
  2063                     // for case of EWmlSettingsAutoloadAll value would be negative ;
       
  2064                     // reset to 0 to prevent crash later
       
  2065                     value = 0; 
       
  2066                     }
       
  2067                     
       
  2068                 values->AppendL( R_WMLBROWSER_SETTINGS_AUTOLOAD_ALL );  // 1 (translated from 2 when flash plugin is present)
       
  2069                 values->AppendL( R_WMLBROWSER_SETTINGS_AUTOLOAD_TEXT ); // 0
       
  2070                 
       
  2071                 value = 1 - (ShowRadioButtonSettingPageL(R_WMLBROWSER_SETTINGS_AUTOLOAD_CONTENT,
       
  2072                                                               values,
       
  2073                                                               value ));                
       
  2074                                                               
       
  2075                 if (value == EWmlSettingsAutoloadImagesNoFlash)
       
  2076                     // Flash plugin not present so reset value from 1 to 2
       
  2077                     {
       
  2078                     value = EWmlSettingsAutoloadAll;
       
  2079                     }
       
  2080                 }
       
  2081 
       
  2082             preferences.SetAutoLoadContentL( value );
       
  2083                 DisplayPageSettingsL();
       
  2084             break;
       
  2085             }
       
  2086 
       
  2087         case EWmlSettingsFontSize:
       
  2088              {
       
  2089              //The relationship between index and fontsize is awkward because 
       
  2090              //the radio buttons reverse the order and the routine called tries
       
  2091              //to straighten that out. 
       
  2092              TInt fontIndex = 4 - iFontSize; // (0,1,2,3,4 >> 4,3,2,1,0)
       
  2093              if (!AVKONAPAC)
       
  2094                  {
       
  2095                  values->AppendL( R_WMLBROWSER_SETTINGS_FS_VALUE_ALL_LARGE );
       
  2096                  values->AppendL( R_WMLBROWSER_SETTINGS_FS_VALUE_LARGER );
       
  2097                  values->AppendL( R_WMLBROWSER_SETTINGS_FS_VALUE_NORMAL );
       
  2098                  values->AppendL( R_WMLBROWSER_SETTINGS_FS_VALUE_SMALLER );
       
  2099                  values->AppendL( R_WMLBROWSER_SETTINGS_FS_VALUE_ALL_SMALL );
       
  2100                  //Convert result to (4,3,2,1,0 >> 0,1,2,3,4)
       
  2101                  iFontSize = 4 - (ShowRadioButtonSettingPageL(R_WMLBROWSER_SETTINGS_FONT_SIZE,
       
  2102                                                               values,
       
  2103                                                               fontIndex ));
       
  2104                  }
       
  2105              else
       
  2106                  {
       
  2107                  // China build has only three font sizes.  Radio button
       
  2108                  // indices are 0, 1, 2. Map these to 0, 2, 4 (all small,
       
  2109                  // normal, all large) for preferences.
       
  2110                  values->AppendL( R_WMLBROWSER_SETTINGS_FS_VALUE_ALL_LARGE );
       
  2111                  values->AppendL( R_WMLBROWSER_SETTINGS_FS_VALUE_NORMAL );
       
  2112                  values->AppendL( R_WMLBROWSER_SETTINGS_FS_VALUE_ALL_SMALL );
       
  2113                  //Convert result to (4,3,2,1,0 >> 0,1,2,3,4)
       
  2114                  iFontSize =  4 - (ShowRadioButtonSettingPageL(R_WMLBROWSER_SETTINGS_FONT_SIZE,
       
  2115                                                                values,
       
  2116                                                                fontIndex >> 1 ) << 1);
       
  2117                  }
       
  2118              preferences.SetFontSizeL( iFontSize );
       
  2119              DisplayPageSettingsL();
       
  2120              break;
       
  2121              }
       
  2122 
       
  2123         case EWmlSettingsPageOverview:
       
  2124             {
       
  2125             if( ApiProvider().WindowMgr().CurrentWindow()->IsPageOverviewSupportedL() )
       
  2126                 {
       
  2127                 values->AppendL( R_WMLBROWSER_SETTINGS_PAGEOVERVIEW_OFF );
       
  2128                 values->AppendL( R_WMLBROWSER_SETTINGS_PAGEOVERVIEW_ON );
       
  2129                 value = preferences.PageOverview();
       
  2130                 value = aSelectKeyWasPressed ?
       
  2131                 1 - value :
       
  2132                 ShowRadioButtonSettingPageL(
       
  2133                     R_WMLBROWSER_SETTINGS_PAGEOVERVIEW,
       
  2134                     values,
       
  2135                     value );
       
  2136                 preferences.SetPageOverviewL( value );
       
  2137                 DisplayGeneralSettingsL();
       
  2138                 }
       
  2139             break;
       
  2140             }
       
  2141 
       
  2142         case EWmlSettingsBackList:
       
  2143             {
       
  2144             values->AppendL( R_WMLBROWSER_SETTINGS_BACK_LIST_OFF );
       
  2145             values->AppendL( R_WMLBROWSER_SETTINGS_BACK_LIST_ON );
       
  2146             value = preferences.BackList();
       
  2147             value = aSelectKeyWasPressed ?
       
  2148             1 - value :
       
  2149             ShowRadioButtonSettingPageL(
       
  2150                 R_WMLBROWSER_SETTINGS_BACK_LIST,
       
  2151                 values,
       
  2152                 value );
       
  2153             preferences.SetBackListL( value );
       
  2154                 DisplayGeneralSettingsL();
       
  2155             break;
       
  2156             }
       
  2157         case EWmlSettingsUrlSuffix:
       
  2158             {
       
  2159             TInt ret;
       
  2160 
       
  2161             HBufC* suffixBuf = iApiProvider.Preferences().URLSuffixList();
       
  2162             HBufC* suffixToPass = HBufC::NewLC( KMaxSearchPgUrlLength );
       
  2163             suffixToPass = suffixBuf;
       
  2164             TPtr ptr = suffixToPass->Des();
       
  2165 
       
  2166             TInt resource = R_URL_SUFFIX_PAGE;
       
  2167 
       
  2168             CAknSettingPage* dlg = new ( ELeave ) CAknTextSettingPage( 
       
  2169                     resource, ptr, CAknTextSettingPage::EZeroLengthAllowed );
       
  2170 
       
  2171             ret = dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged );
       
  2172 
       
  2173             if ( ret )
       
  2174                 {
       
  2175                 iApiProvider.Preferences().SetURLSuffixList(suffixToPass);
       
  2176                 }
       
  2177             
       
  2178             CleanupStack::PopAndDestroy(); // suffixToPass
       
  2179             DisplayGeneralSettingsL();
       
  2180             break;
       
  2181             }
       
  2182         case EWmlSettingsAutoRefresh:
       
  2183             {
       
  2184             values->AppendL( R_WMLBROWSER_SETTINGS_AUTO_REFRESH_OFF );
       
  2185             values->AppendL( R_WMLBROWSER_SETTINGS_AUTO_REFRESH_ON );
       
  2186             value = preferences.AutoRefresh();
       
  2187             value = aSelectKeyWasPressed ?
       
  2188             1 - value :
       
  2189             ShowRadioButtonSettingPageL(
       
  2190                 R_WMLBROWSER_SETTINGS_AUTO_REFRESH,
       
  2191                 values,
       
  2192                 value );
       
  2193             preferences.SetAutoRefreshL( value );
       
  2194                 DisplayPageSettingsL();
       
  2195             break;
       
  2196             }
       
  2197 
       
  2198     case EWmlSettingsEncoding:
       
  2199         {
       
  2200         TInt highlightedItemIndex = KDoesntExist;
       
  2201         TInt lathinIndex = KDoesntExist;
       
  2202         for( int i = iEncodingArray->Count() - 1; i >= 0; i-- )
       
  2203             {
       
  2204             TEncodingStruct encoding = iEncodingArray->At(i);
       
  2205 
       
  2206             if ( encoding.iSystemId == KCharacterSetIdentifierIso88591 )
       
  2207                 {
       
  2208                 lathinIndex = i;
       
  2209                 }
       
  2210 
       
  2211             values->AppendL( encoding.iResId );
       
  2212 
       
  2213             if ( encoding.iSystemId == iEncoding )
       
  2214                 {
       
  2215                 highlightedItemIndex = i;
       
  2216                 }
       
  2217             }
       
  2218 
       
  2219         if( highlightedItemIndex == KDoesntExist )
       
  2220             {
       
  2221             if( lathinIndex != KDoesntExist )
       
  2222                 {
       
  2223                 highlightedItemIndex = lathinIndex;
       
  2224                 }
       
  2225             else
       
  2226                 {
       
  2227                 highlightedItemIndex = 0;
       
  2228                 }
       
  2229             }
       
  2230 
       
  2231         TInt selectedIndex =
       
  2232             iEncodingArray->Count() - 1 -
       
  2233                 ShowRadioButtonSettingPageL(
       
  2234                         R_WMLBROWSER_SETTINGS_ENCODING,
       
  2235                         values,
       
  2236                         iEncodingArray->Count() - 1 - highlightedItemIndex );
       
  2237 
       
  2238             TEncodingStruct selectedEncoding =
       
  2239                                         iEncodingArray->At( selectedIndex );
       
  2240 
       
  2241         iEncoding = selectedEncoding.iSystemId;
       
  2242             DisplayPageSettingsL();
       
  2243         break;
       
  2244         }
       
  2245 
       
  2246         case EWmlSettingsAdaptiveBookmarks:
       
  2247             {
       
  2248             values->AppendL(
       
  2249                     R_WMLBROWSER_SETTINGS_ADAPTIVE_BOOKMARKS_VALUE_OFF );
       
  2250             values->AppendL(
       
  2251                     R_WMLBROWSER_SETTINGS_ADAPTIVE_BOOKMARKS_VALUE_HIDE_FOLDER );
       
  2252             values->AppendL(
       
  2253                     R_WMLBROWSER_SETTINGS_ADAPTIVE_BOOKMARKS_VALUE_ON );
       
  2254 
       
  2255             value = 2-preferences.AdaptiveBookmarks();
       
  2256             value = ShowRadioButtonSettingPageL(
       
  2257                 R_WMLBROWSER_SETTINGS_ADAPTIVE_BOOKMARKS,
       
  2258                 values,
       
  2259                 value );
       
  2260             preferences.SetAdaptiveBookmarksL(
       
  2261                                 ( TWmlSettingsAdaptiveBookmarks )(2-value) );
       
  2262             DisplayPrivacySettingsL();
       
  2263             break;
       
  2264             }
       
  2265 
       
  2266         case EWmlSettingsFormDataSaving:
       
  2267             {
       
  2268             values->AppendL( R_WMLBROWSER_SETTINGS_FORM_DATA_SAVING_OFF );
       
  2269             values->AppendL( R_WMLBROWSER_SETTINGS_FORM_DATA_SAVING_ONLY );
       
  2270             values->AppendL( R_WMLBROWSER_SETTINGS_FORM_DATA_SAVING_ON );
       
  2271 
       
  2272             value = preferences.FormDataSaving();
       
  2273             TInt origValue(value);
       
  2274             value = ShowRadioButtonSettingPageL(
       
  2275                     R_WMLBROWSER_SETTINGS_FORM_DATA_SAVING,
       
  2276                     values,
       
  2277                     value );
       
  2278             preferences.SetFormDataSavingL( (TWmlSettingsFormData) value );
       
  2279 
       
  2280             if (origValue > value)
       
  2281                 {
       
  2282                 // query to see if we need to delete stored form data
       
  2283                 if (origValue == EWmlSettingsFormDataPlusPassword && value == EWmlSettingsFormDataOnly)
       
  2284                     {
       
  2285                     // delete password data?
       
  2286                     ShowFormDataDeletePasswordQueryDialogL();
       
  2287                     }
       
  2288                 else if (origValue == EWmlSettingsFormDataPlusPassword && value == EWmlSettingsFormDataOff)
       
  2289                     {
       
  2290                     // delete password and form data
       
  2291                     ShowFormDataDeleteAllQueryDialogL();
       
  2292                     }
       
  2293                 else if (origValue == EWmlSettingsFormDataOnly && value == EWmlSettingsFormDataOff)
       
  2294                     {
       
  2295                     // delete form data
       
  2296                     ShowFormDataDeleteAllQueryDialogL();
       
  2297                     }
       
  2298                 }
       
  2299 
       
  2300             DisplayPrivacySettingsL();
       
  2301             break;
       
  2302             }
       
  2303 
       
  2304         case EWmlSettingsFullScreen:
       
  2305             {
       
  2306             
       
  2307             values->AppendL( R_WMLBROWSER_SETTINGS_SOFTKEYS_OFF );
       
  2308             values->AppendL( R_WMLBROWSER_SETTINGS_SOFTKEYS_ON );
       
  2309             value = preferences.FullScreen(); 
       
  2310             value = aSelectKeyWasPressed ?
       
  2311             1 - value :
       
  2312             ShowRadioButtonSettingPageL(
       
  2313                 R_WMLBROWSER_SETTINGS_SOFTKEYS,
       
  2314                 values,
       
  2315                 value );
       
  2316             preferences.SetFullScreenL( ( TWmlSettingsFullScreen )( value ) );
       
  2317             DisplayPageSettingsL();
       
  2318             break;
       
  2319             }
       
  2320 
       
  2321     case EWmlSettingsHomePage:
       
  2322        {
       
  2323        values->AppendL( R_WMLBROWSER_SETTINGS_HOMEPAGE_BOOKMARKS );
       
  2324 
       
  2325        // "Use current page" is available only if a page is loaded.
       
  2326        // so there might be a hole in the array!
       
  2327        HBufC *url = CBrowserAppUi::Static()->BrCtlInterface().PageInfoLC(
       
  2328            TBrCtlDefs::EPageInfoUrl );
       
  2329                       
       
  2330        TInt useCurrent( 0 );
       
  2331        if( url && url->Length() )
       
  2332            {
       
  2333            values->AppendL( R_WMLBROWSER_SETTINGS_HOMEPAGE_USE_CURRENT );
       
  2334            ++useCurrent;
       
  2335            }
       
  2336 
       
  2337        values->AppendL( R_WMLBROWSER_SETTINGS_HOMEPAGE_NEW_ADDRESS );
       
  2338        values->AppendL( R_WMLBROWSER_SETTINGS_HOMEPAGE_ACCESS_POINT );
       
  2339        TBool dialogCancel( ETrue );
       
  2340        while( dialogCancel )
       
  2341            {
       
  2342            value = preferences.HomePageType();
       
  2343            if( !useCurrent )
       
  2344                 {
       
  2345                 // 'Use current' is not shown as current item
       
  2346                 if( (TWmlSettingsHomePage)value == EWmlSettingsHomePageUseCurrent )
       
  2347                     {
       
  2348                     value = EWmlSettingsHomePageAddress;
       
  2349                     }
       
  2350                 // items behind UseCurrent must be shifted below
       
  2351                 else if( (TWmlSettingsHomePage)value > EWmlSettingsHomePageUseCurrent )
       
  2352                     {
       
  2353                     --value;
       
  2354                     }
       
  2355                 }
       
  2356            // sanity check
       
  2357            if( value >= 7 + useCurrent )
       
  2358                {
       
  2359                value = 7 + useCurrent;
       
  2360                }
       
  2361            if( ShowRadioButtonSettingPageBoolL(
       
  2362                R_WMLBROWSER_SETTINGS_STARTPAGE, values, &value ) )
       
  2363                {  // OK was pressed on RadioSetting
       
  2364                // shift value if needed
       
  2365                if( !useCurrent &&
       
  2366                    ( (TWmlSettingsHomePage)value >= EWmlSettingsHomePageUseCurrent) )
       
  2367                    {
       
  2368                    ++value;
       
  2369                    }
       
  2370                if( (TWmlSettingsHomePage)value == EWmlSettingsHomePageAddress )
       
  2371                    {
       
  2372                    HBufC* prompt = StringLoader::LoadLC( R_BROWSER_PROMPT_HOMEPAGE_URL );
       
  2373                    HBufC* retBuf = HBufC::NewL( KMaxHomePgUrlLength );
       
  2374                    TPtr retString = retBuf->Des();
       
  2375                    retString.Copy( KNullDesC );
       
  2376 
       
  2377                    if( preferences.HomePageUrlL( retString, ETrue ) != KErrNone )
       
  2378                        {
       
  2379                        retString.Zero();
       
  2380                        retString.Copy( KNullDesC );
       
  2381                        }
       
  2382                    TInt result = TBrowserDialogs::DialogPromptReqL(
       
  2383                         prompt->Des(),
       
  2384                         &retString,
       
  2385                         ETrue,
       
  2386                         KMaxHomePgUrlLength );
       
  2387                    CleanupStack::PopAndDestroy();  // prompt
       
  2388                    if( result )  // URL was accepted
       
  2389                        {
       
  2390                        preferences.SetHomePageUrlL( retString );
       
  2391                        preferences.SetHomePageTypeL( (TWmlSettingsHomePage) value );
       
  2392                        dialogCancel = EFalse;
       
  2393                        }
       
  2394                    if( retBuf )
       
  2395                        {
       
  2396                        delete retBuf;
       
  2397                        }
       
  2398                    // else URL was cancelled! one more round
       
  2399                    }
       
  2400                else if( (TWmlSettingsHomePage)value == EWmlSettingsHomePageAccessPoint )
       
  2401                    {
       
  2402                    preferences.SetHomePageTypeL( (TWmlSettingsHomePage) value );
       
  2403                    dialogCancel = EFalse;
       
  2404                    }
       
  2405                else if( (TWmlSettingsHomePage)value == EWmlSettingsHomePageUseCurrent )
       
  2406                    {
       
  2407                    // url was already checked. it exists.
       
  2408                    TPtr urlPtr = url->Des();
       
  2409                    preferences.SetHomePageUrlL( urlPtr );
       
  2410                    preferences.SetHomePageTypeL( (TWmlSettingsHomePage) value );
       
  2411                    dialogCancel = EFalse;
       
  2412                    }
       
  2413                else if( (TWmlSettingsHomePage)value == EWmlSettingsHomePageBookmarks )
       
  2414                    {
       
  2415                    preferences.SetHomePageTypeL( (TWmlSettingsHomePage) value );
       
  2416                    dialogCancel = EFalse;
       
  2417                    }
       
  2418                }
       
  2419            else  // Cancel was pressed on RadioSetting, nothing to do
       
  2420                {
       
  2421                dialogCancel = EFalse;
       
  2422                }
       
  2423            DisplayGeneralSettingsL();
       
  2424            }
       
  2425        CleanupStack::PopAndDestroy( url );  // url
       
  2426        break;
       
  2427        }
       
  2428 
       
  2429     case EWmlSettingsAutomaticUpdatingAP:
       
  2430         {
       
  2431         TUint32 id = preferences.AutomaticUpdatingAP();
       
  2432         SelectUserDefinedAPL( id );
       
  2433 
       
  2434         preferences.SetAutomaticUpdatingApL( id );
       
  2435         BROWSER_LOG( ( _L( "EWmlSettingsAutomaticUpdatingAP SetAutomaticUpdatingApL()" ) ) );
       
  2436 
       
  2437         DisplayWebFeedsSettingsL();
       
  2438         BROWSER_LOG( ( _L( "EWmlSettingsAutomaticUpdatingAP DisplayWebFeedsSettingsL()" ) ) );
       
  2439         break;
       
  2440         }
       
  2441 
       
  2442     case EWmlSettingsMediaVolume:
       
  2443         {
       
  2444         // Add option list items
       
  2445         values->AppendL( R_WMLBROWSER_SETTINGS_MEDIA_VOLUME_4 );
       
  2446         values->AppendL( R_WMLBROWSER_SETTINGS_MEDIA_VOLUME_3 );
       
  2447         values->AppendL( R_WMLBROWSER_SETTINGS_MEDIA_VOLUME_2 );
       
  2448         values->AppendL( R_WMLBROWSER_SETTINGS_MEDIA_VOLUME_1 );
       
  2449         values->AppendL( R_WMLBROWSER_SETTINGS_MEDIA_VOLUME_MUTED );
       
  2450 
       
  2451         TInt itemcount = values->Count();
       
  2452 
       
  2453         // Get Media Volume Value
       
  2454         value = preferences.MediaVolume();
       
  2455 
       
  2456         // Convert volume to list index
       
  2457         switch ( value )
       
  2458             {
       
  2459             case EWmlSettingsVolumeMuted:
       
  2460                 value = EVolumeMute;
       
  2461                 break;
       
  2462             case EWmlSettingsVolume1:
       
  2463                 value = EVolumeLevel1;
       
  2464                 break;
       
  2465             case EWmlSettingsVolume2:
       
  2466                 value = EVolumeLevel2;
       
  2467                 break;
       
  2468             case EWmlSettingsVolume3:
       
  2469                 value = EVolumeLevel3;
       
  2470                 break;
       
  2471             case EWmlSettingsVolume4:
       
  2472                 value = EVolumeLevel4;
       
  2473                 break;
       
  2474             default:
       
  2475                 break;
       
  2476             }
       
  2477 
       
  2478         // Open Volume Option List Page
       
  2479         value = ShowRadioButtonSettingPageL(
       
  2480                     R_WMLBROWSER_SETTINGS_MEDIA_VOLUME, values,
       
  2481                         ( itemcount - 1 ) - value );
       
  2482 
       
  2483         // Reconvert list index to volume
       
  2484         value = ( itemcount - 1 ) - value;
       
  2485         switch ( value )
       
  2486             {
       
  2487             case EVolumeMute:
       
  2488                 value = EWmlSettingsVolumeMuted;
       
  2489                 break;
       
  2490             case EVolumeLevel1:
       
  2491                 value = EWmlSettingsVolume1;
       
  2492                 break;
       
  2493             case EVolumeLevel2:
       
  2494                 value = EWmlSettingsVolume2;
       
  2495                 break;
       
  2496             case EVolumeLevel3:
       
  2497                 value = EWmlSettingsVolume3;
       
  2498                 break;
       
  2499             case EVolumeLevel4:
       
  2500                 value = EWmlSettingsVolume4;
       
  2501                 break;
       
  2502             default:
       
  2503                 break;
       
  2504             }
       
  2505 
       
  2506         // Save Media Volume Value
       
  2507         preferences.SetMediaVolumeL( value );
       
  2508         DisplayPageSettingsL();
       
  2509         break;
       
  2510         }
       
  2511 
       
  2512         case EWmlSettingsCookies:
       
  2513             {
       
  2514             values->AppendL( R_WMLBROWSER_SETTINGS_C_VALUE_REJECT );
       
  2515             values->AppendL( R_WMLBROWSER_SETTINGS_C_VALUE_ALLOW );
       
  2516             value = preferences.Cookies();
       
  2517             value = aSelectKeyWasPressed ? 1 - value : ShowRadioButtonSettingPageL(
       
  2518                 R_WMLBROWSER_SETTINGS_COOKIES,
       
  2519                 values,
       
  2520                 value );
       
  2521             preferences.SetCookiesL( ( TWmlSettingsCookies )value );
       
  2522             DisplayPrivacySettingsL();
       
  2523             break;
       
  2524             }
       
  2525 
       
  2526         case EWmlSettingsEcma:
       
  2527             {
       
  2528             values->AppendL( R_WMLBROWSER_SETTINGS_ECMA_VALUE_DISABLE );
       
  2529             values->AppendL( R_WMLBROWSER_SETTINGS_ECMA_VALUE_ENABLE );
       
  2530             value = preferences.Ecma();//items need to be appended in reverse order
       
  2531             value = aSelectKeyWasPressed ? 1 - value : ShowRadioButtonSettingPageL(
       
  2532                     R_WMLBROWSER_SETTINGS_ECMA,
       
  2533                     values,
       
  2534                     value );
       
  2535             preferences.SetEcmaL( ( TWmlSettingsECMA ) value );
       
  2536             DisplayGeneralSettingsL();
       
  2537             break;
       
  2538             }
       
  2539 
       
  2540         case EWmlSettingsScriptLog:
       
  2541             {
       
  2542             value = 3 - preferences.ScriptLog();
       
  2543             
       
  2544             values->AppendL( R_WMLBROWSER_SETTINGS_SCRIPTLOG_VALUE_TO_CONSOLE_FILE );
       
  2545             values->AppendL( R_WMLBROWSER_SETTINGS_SCRIPTLOG_VALUE_TO_CONSOLE );
       
  2546             values->AppendL( R_WMLBROWSER_SETTINGS_SCRIPTLOG_VALUE_TO_FILE );
       
  2547             values->AppendL( R_WMLBROWSER_SETTINGS_SCRIPTLOG_VALUE_DISABLE );
       
  2548             
       
  2549             value = 3 - (ShowRadioButtonSettingPageL(R_WMLBROWSER_SETTINGS_SCRIPTLOG,
       
  2550                                                         values,
       
  2551                                                         value ));
       
  2552             preferences.SetScriptLogL( value );
       
  2553             DisplayGeneralSettingsL();
       
  2554 
       
  2555             break;
       
  2556             }
       
  2557 
       
  2558         case EWmlSettingsDownloadsOpen:
       
  2559             {
       
  2560             values->AppendL( R_WMLBROWSER_SETTINGS_DOWNLOAD_OPEN_YES );
       
  2561             values->AppendL( R_WMLBROWSER_SETTINGS_DOWNLOAD_OPEN_NO );
       
  2562             value = preferences.DownloadsOpen();
       
  2563             value = aSelectKeyWasPressed ? value :
       
  2564             ShowRadioButtonSettingPageL(
       
  2565                   R_WMLBROWSER_SETTINGS_DOWNLOAD_OPEN,
       
  2566                   values,
       
  2567                   1 - value );
       
  2568             preferences.SetDownloadsOpenL( 1 - value ); 
       
  2569             DisplayGeneralSettingsL();
       
  2570             break;
       
  2571             }
       
  2572 
       
  2573         case EWmlSettingsHttpSecurityWarnings:
       
  2574             {
       
  2575             values->AppendL( R_WMLBROWSER_SETTINGS_WRN_VALUE_SHOW );
       
  2576             values->AppendL( R_WMLBROWSER_SETTINGS_WRN_VALUE_HIDE );
       
  2577             value = preferences.HttpSecurityWarnings();
       
  2578             value = aSelectKeyWasPressed ? value :
       
  2579             ShowRadioButtonSettingPageL(
       
  2580                   R_WMLBROWSER_SETTINGS_HTTP_SEC_WRNS,
       
  2581                   values,
       
  2582                   1 - value );
       
  2583             preferences.SetHttpSecurityWarningsL( 1 - value ); // show=1, hide=0 in preferences
       
  2584             DisplayGeneralSettingsL();
       
  2585             break;
       
  2586             }
       
  2587             
       
  2588         case EWmlSettingsSearchProvider:
       
  2589             {
       
  2590             RunSearchSettingsL();
       
  2591             break;
       
  2592             }
       
  2593 
       
  2594 
       
  2595 
       
  2596         case EWmlSettingsIMEINotification:
       
  2597             {
       
  2598             if ( IMEI_NOTIFICATION )
       
  2599                 {
       
  2600                 values->AppendL( R_WMLBROWSER_SETTINGS_IMEI_VALUE_DISABLED );
       
  2601                 values->AppendL( R_WMLBROWSER_SETTINGS_IMEI_VALUE_ENABLED );
       
  2602                 value = preferences.IMEINotification();
       
  2603                 //items need to be appended in reverse order
       
  2604                 value = aSelectKeyWasPressed ? 1 - value :
       
  2605                                 ShowRadioButtonSettingPageL(
       
  2606                                                 R_WMLBROWSER_SETTINGS_IMEI,
       
  2607                                                 values,
       
  2608                                                 value );
       
  2609                 preferences.SetIMEINotificationL( ( TWmlSettingsIMEI ) value );
       
  2610                 DisplayPrivacySettingsL();
       
  2611                 }
       
  2612             break;
       
  2613             }
       
  2614 
       
  2615         case EWmlSettingsSendReferrer:
       
  2616             {
       
  2617             values->AppendL( R_WMLBROWSER_SETTINGS_SEND_REFERRER_OFF );
       
  2618             values->AppendL( R_WMLBROWSER_SETTINGS_SEND_REFERRER_ON );
       
  2619             value = preferences.SendReferrer();
       
  2620             value = aSelectKeyWasPressed ? 1 - value : ShowRadioButtonSettingPageL(
       
  2621               R_WMLBROWSER_SETTINGS_SEND_REFERRER,
       
  2622               values,
       
  2623               value );
       
  2624             DisplayPrivacySettingsL();
       
  2625             break;
       
  2626         }
       
  2627 
       
  2628         case EWmlSettingsPopupBlocking:
       
  2629             {
       
  2630             values->AppendL( R_WMLBROWSER_SETTINGS_POPUP_BLOCKING_OFF );
       
  2631             values->AppendL( R_WMLBROWSER_SETTINGS_POPUP_BLOCKING_ON );
       
  2632             value = preferences.PopupBlocking();
       
  2633             value = aSelectKeyWasPressed ? 1 - value : ShowRadioButtonSettingPageL(
       
  2634                     R_WMLBROWSER_SETTINGS_POPUP_BLOCKING,
       
  2635                     values,
       
  2636                     value );
       
  2637             preferences.SetPopupBlockingL( value );
       
  2638             DisplayPageSettingsL();
       
  2639             break;
       
  2640             }
       
  2641 
       
  2642 
       
  2643         case EWmlSettingsAutomaticUpdatingWhileRoaming:
       
  2644             {
       
  2645             values->AppendL( R_WMLBROWSER_SETTINGS_AUTOUPDATING_ROAMING_OFF );
       
  2646             values->AppendL( R_WMLBROWSER_SETTINGS_AUTOUPDATING_ROAMING_ON );
       
  2647 
       
  2648             value = preferences.AutomaticUpdatingWhileRoaming();
       
  2649             value = aSelectKeyWasPressed ?
       
  2650             1 - value :
       
  2651             ShowRadioButtonSettingPageL(
       
  2652                 R_WMLBROWSER_SETTINGS_AUTOUPDATING_ROAMING,
       
  2653                 values,
       
  2654                 value );
       
  2655             preferences.SetAutomaticUpdatingWhileRoamingL( value );         
       
  2656 
       
  2657             DisplayWebFeedsSettingsL();
       
  2658             break;
       
  2659             }
       
  2660 
       
  2661 
       
  2662         case EWmlSettingsToolbarOnOff:
       
  2663             {
       
  2664             values->AppendL( R_BROWSER_SETTING_TOOLBAR_OFF );
       
  2665             values->AppendL( R_BROWSER_SETTING_TOOLBAR_ON );
       
  2666 
       
  2667             value = preferences.ShowToolbarOnOff();
       
  2668             value = aSelectKeyWasPressed ?
       
  2669             1 - value :
       
  2670             ShowRadioButtonSettingPageL(
       
  2671                 R_BROWSER_SETTING_TOOLBAR_ON_OFF,
       
  2672                 values,
       
  2673                 value );
       
  2674             preferences.SetToolbarOnOffL( value );          
       
  2675 
       
  2676             DisplayToolbarSettingsL();
       
  2677             break;
       
  2678             }
       
  2679 
       
  2680 
       
  2681         case EWmlSettingsToolbarButton1Cmd:
       
  2682             {
       
  2683             value = preferences.ShowToolbarButton1Cmd();
       
  2684             // set toolbar values will build values into an array to be displayed to the user
       
  2685             // this may mean filtering out some items, so we have to know the mapping between our 
       
  2686             // fixed array of commands as well as the current value from settings
       
  2687             value = SetToolbarButtonValues(values, value, valueDisplayMapping);
       
  2688             value = ShowRadioButtonSettingPageL(    R_BROWSER_SETTING_TOOLBAR_BUTTON1,
       
  2689                                                     values,
       
  2690                                                     value );
       
  2691                                                         
       
  2692             preferences.SetToolbarButton1CmdL( valueDisplayMapping->At(value) );
       
  2693             DisplayToolbarSettingsL();
       
  2694             break;
       
  2695             }
       
  2696 
       
  2697         case EWmlSettingsToolbarButton2Cmd:
       
  2698             {
       
  2699             value = preferences.ShowToolbarButton2Cmd();
       
  2700             // set toolbar values will build values into an array to be displayed to the user
       
  2701             // this may mean filtering out some items, so we have to know the mapping between our 
       
  2702             // fixed array of commands as well as the current value from settings
       
  2703             value = SetToolbarButtonValues(values, value, valueDisplayMapping);            
       
  2704             value = ShowRadioButtonSettingPageL(    R_BROWSER_SETTING_TOOLBAR_BUTTON2,
       
  2705                                                     values,
       
  2706                                                     value );
       
  2707                                                     
       
  2708             preferences.SetToolbarButton2CmdL( valueDisplayMapping->At(value) );
       
  2709             DisplayToolbarSettingsL();
       
  2710             break;
       
  2711             }
       
  2712 
       
  2713         case EWmlSettingsToolbarButton3Cmd:
       
  2714             {
       
  2715             value = preferences.ShowToolbarButton3Cmd();
       
  2716             // set toolbar values will build values into an array to be displayed to the user
       
  2717             // this may mean filtering out some items, so we have to know the mapping between our 
       
  2718             // fixed array of commands as well as the current value from settings
       
  2719             value = SetToolbarButtonValues(values, value, valueDisplayMapping);             
       
  2720             value = ShowRadioButtonSettingPageL(    R_BROWSER_SETTING_TOOLBAR_BUTTON3,
       
  2721                                                     values,
       
  2722                                                     value );
       
  2723                                                     
       
  2724             preferences.SetToolbarButton3CmdL( valueDisplayMapping->At(value) );
       
  2725             DisplayToolbarSettingsL();
       
  2726             break;
       
  2727             }
       
  2728 
       
  2729         case EWmlSettingsToolbarButton4Cmd:
       
  2730             {
       
  2731             value = preferences.ShowToolbarButton4Cmd();
       
  2732             // set toolbar values will build values into an array to be displayed to the user
       
  2733             // this may mean filtering out some items, so we have to know the mapping between our 
       
  2734             // fixed array of commands as well as the current value from settings
       
  2735             value = SetToolbarButtonValues(values, value, valueDisplayMapping);              
       
  2736             value = ShowRadioButtonSettingPageL(    R_BROWSER_SETTING_TOOLBAR_BUTTON4,
       
  2737                                                     values,
       
  2738                                                     value );
       
  2739                                                     
       
  2740             preferences.SetToolbarButton4CmdL( valueDisplayMapping->At(value) );
       
  2741             DisplayToolbarSettingsL();
       
  2742             break;
       
  2743             }
       
  2744 
       
  2745         case EWmlSettingsToolbarButton5Cmd:
       
  2746             {
       
  2747             value = preferences.ShowToolbarButton5Cmd();
       
  2748             // set toolbar values will build values into an array to be displayed to the user
       
  2749             // this may mean filtering out some items, so we have to know the mapping between our 
       
  2750             // fixed array of commands as well as the current value from settings
       
  2751             value = SetToolbarButtonValues(values, value, valueDisplayMapping); 
       
  2752              
       
  2753             value = ShowRadioButtonSettingPageL(    R_BROWSER_SETTING_TOOLBAR_BUTTON5,
       
  2754                                                     values,
       
  2755                                                     value );
       
  2756                                                     
       
  2757             preferences.SetToolbarButton5CmdL( valueDisplayMapping->At(value) );
       
  2758             DisplayToolbarSettingsL();
       
  2759             break;
       
  2760             }
       
  2761 
       
  2762         case EWmlSettingsToolbarButton6Cmd:
       
  2763             {
       
  2764             value = preferences.ShowToolbarButton6Cmd();
       
  2765             // set toolbar values will build values into an array to be displayed to the user
       
  2766             // this may mean filtering out some items, so we have to know the mapping between our 
       
  2767             // fixed array of commands as well as the current value from settings
       
  2768             value = SetToolbarButtonValues(values, value, valueDisplayMapping); 
       
  2769              
       
  2770             value = ShowRadioButtonSettingPageL(    R_BROWSER_SETTING_TOOLBAR_BUTTON6,
       
  2771                                                     values,
       
  2772                                                     value );
       
  2773                                                     
       
  2774             preferences.SetToolbarButton6CmdL( valueDisplayMapping->At(value) );
       
  2775             DisplayToolbarSettingsL();
       
  2776             break;
       
  2777             }
       
  2778 
       
  2779         case EWmlSettingsToolbarButton7Cmd:
       
  2780             {
       
  2781             value = preferences.ShowToolbarButton7Cmd();
       
  2782             // set toolbar values will build values into an array to be displayed to the user
       
  2783             // this may mean filtering out some items, so we have to know the mapping between our 
       
  2784             // fixed array of commands as well as the current value from settings
       
  2785             value = SetToolbarButtonValues(values, value, valueDisplayMapping); 
       
  2786              
       
  2787             value = ShowRadioButtonSettingPageL(    R_BROWSER_SETTING_TOOLBAR_BUTTON7,
       
  2788                                                     values,
       
  2789                                                     value );
       
  2790                                                     
       
  2791             preferences.SetToolbarButton7CmdL( valueDisplayMapping->At(value) );
       
  2792             DisplayToolbarSettingsL();
       
  2793             break;
       
  2794             }
       
  2795 
       
  2796         case EWmlSettingsShortCutKey1Cmd:
       
  2797             {
       
  2798             value = preferences.ShortcutKey1Cmd();
       
  2799             // set toolbar values will build values into an array to be displayed to the user
       
  2800             // this may mean filtering out some items, so we have to know the mapping between our 
       
  2801             // fixed array of commands as well as the current value from settings
       
  2802             value = SetShortcutKeysValues(values, value, valueDisplayMapping); 
       
  2803             value = ShowRadioButtonSettingPageL(    R_BROWSER_SETTING_SHORTCUT_KEY1,
       
  2804                                                     values,
       
  2805                                                     value );
       
  2806             preferences.SetShortcutKey1CmdL( valueDisplayMapping->At(value) );
       
  2807             DisplayShortcutsSettingsL();
       
  2808             break;
       
  2809             }
       
  2810 
       
  2811         case EWmlSettingsShortCutKey2Cmd:
       
  2812             {
       
  2813             value = preferences.ShortcutKey2Cmd();
       
  2814             // set toolbar values will build values into an array to be displayed to the user
       
  2815             // this may mean filtering out some items, so we have to know the mapping between our 
       
  2816             // fixed array of commands as well as the current value from settings
       
  2817             value = SetShortcutKeysValues(values, value, valueDisplayMapping);              
       
  2818             value = ShowRadioButtonSettingPageL(    R_BROWSER_SETTING_SHORTCUT_KEY2,
       
  2819                                                     values,
       
  2820                                                     value );
       
  2821             preferences.SetShortcutKey2CmdL( valueDisplayMapping->At(value) );
       
  2822             DisplayShortcutsSettingsL();
       
  2823             break;
       
  2824             }
       
  2825 
       
  2826         case EWmlSettingsShortCutKey3Cmd:
       
  2827             {
       
  2828             value = preferences.ShortcutKey3Cmd();
       
  2829             // set toolbar values will build values into an array to be displayed to the user
       
  2830             // this may mean filtering out some items, so we have to know the mapping between our 
       
  2831             // fixed array of commands as well as the current value from settings
       
  2832             value = SetShortcutKeysValues(values, value, valueDisplayMapping);              
       
  2833             value = ShowRadioButtonSettingPageL(    R_BROWSER_SETTING_SHORTCUT_KEY3,
       
  2834                                                     values,
       
  2835                                                     value );
       
  2836             preferences.SetShortcutKey3CmdL( valueDisplayMapping->At(value) );
       
  2837             DisplayShortcutsSettingsL();
       
  2838             break;
       
  2839             }
       
  2840 
       
  2841         case EWmlSettingsShortCutKey4Cmd:
       
  2842             {
       
  2843             value = preferences.ShortcutKey4Cmd();
       
  2844             // set toolbar values will build values into an array to be displayed to the user
       
  2845             // this may mean filtering out some items, so we have to know the mapping between our 
       
  2846             // fixed array of commands as well as the current value from settings
       
  2847             value = SetShortcutKeysValues(values, value, valueDisplayMapping);             
       
  2848             value = ShowRadioButtonSettingPageL(    R_BROWSER_SETTING_SHORTCUT_KEY4,
       
  2849                                                     values,
       
  2850                                                     value );
       
  2851             preferences.SetShortcutKey4CmdL( valueDisplayMapping->At(value) );
       
  2852             DisplayShortcutsSettingsL();
       
  2853             break;
       
  2854             }
       
  2855 
       
  2856         case EWmlSettingsShortCutKey5Cmd:
       
  2857             {
       
  2858             value = preferences.ShortcutKey5Cmd();
       
  2859             // set toolbar values will build values into an array to be displayed to the user
       
  2860             // this may mean filtering out some items, so we have to know the mapping between our 
       
  2861             // fixed array of commands as well as the current value from settings
       
  2862             value = SetShortcutKeysValues(values, value, valueDisplayMapping);              
       
  2863             value = ShowRadioButtonSettingPageL(    R_BROWSER_SETTING_SHORTCUT_KEY5,
       
  2864                                                     values,
       
  2865                                                     value );
       
  2866             preferences.SetShortcutKey5CmdL( valueDisplayMapping->At(value) );
       
  2867             DisplayShortcutsSettingsL();
       
  2868             break;
       
  2869             }
       
  2870 
       
  2871         case EWmlSettingsShortCutKey6Cmd:
       
  2872             {
       
  2873             value = preferences.ShortcutKey6Cmd();
       
  2874             // set toolbar values will build values into an array to be displayed to the user
       
  2875             // this may mean filtering out some items, so we have to know the mapping between our 
       
  2876             // fixed array of commands as well as the current value from settings
       
  2877             value = SetShortcutKeysValues(values, value, valueDisplayMapping);              
       
  2878             value = ShowRadioButtonSettingPageL(    R_BROWSER_SETTING_SHORTCUT_KEY6,
       
  2879                                                     values,
       
  2880                                                     value );
       
  2881             preferences.SetShortcutKey6CmdL( valueDisplayMapping->At(value) );
       
  2882             DisplayShortcutsSettingsL();
       
  2883             break;
       
  2884             }
       
  2885 
       
  2886         case EWmlSettingsShortCutKey7Cmd:
       
  2887             {
       
  2888             value = preferences.ShortcutKey7Cmd();
       
  2889             // set toolbar values will build values into an array to be displayed to the user
       
  2890             // this may mean filtering out some items, so we have to know the mapping between our 
       
  2891             // fixed array of commands as well as the current value from settings
       
  2892             value = SetShortcutKeysValues(values, value, valueDisplayMapping);              
       
  2893             value = ShowRadioButtonSettingPageL(    R_BROWSER_SETTING_SHORTCUT_KEY7,
       
  2894                                                     values,
       
  2895                                                     value );
       
  2896             preferences.SetShortcutKey7CmdL( valueDisplayMapping->At(value) );
       
  2897             DisplayShortcutsSettingsL();
       
  2898             break;
       
  2899             }
       
  2900 
       
  2901         case EWmlSettingsShortCutKey8Cmd:
       
  2902             {
       
  2903             value = preferences.ShortcutKey8Cmd();
       
  2904             // set toolbar values will build values into an array to be displayed to the user
       
  2905             // this may mean filtering out some items, so we have to know the mapping between our 
       
  2906             // fixed array of commands as well as the current value from settings
       
  2907             value = SetShortcutKeysValues(values, value, valueDisplayMapping); 
       
  2908             value = ShowRadioButtonSettingPageL(    R_BROWSER_SETTING_SHORTCUT_KEY8,
       
  2909                                                     values,
       
  2910                                                     value );
       
  2911             preferences.SetShortcutKey8CmdL( valueDisplayMapping->At(value) );
       
  2912             DisplayShortcutsSettingsL();
       
  2913             break;
       
  2914             }
       
  2915 
       
  2916         case EWmlSettingsShortCutKey9Cmd:
       
  2917             {
       
  2918             value = preferences.ShortcutKey9Cmd();
       
  2919             // set toolbar values will build values into an array to be displayed to the user
       
  2920             // this may mean filtering out some items, so we have to know the mapping between our 
       
  2921             // fixed array of commands as well as the current value from settings
       
  2922             value = SetShortcutKeysValues(values, value, valueDisplayMapping);              
       
  2923             value = ShowRadioButtonSettingPageL(    R_BROWSER_SETTING_SHORTCUT_KEY9,
       
  2924                                                     values,
       
  2925                                                     value );
       
  2926             preferences.SetShortcutKey9CmdL( valueDisplayMapping->At(value) );
       
  2927             DisplayShortcutsSettingsL();
       
  2928             break;
       
  2929             }
       
  2930 
       
  2931         case EWmlSettingsShortCutKey0Cmd:
       
  2932             {
       
  2933             value = preferences.ShortcutKey0Cmd();
       
  2934             // set toolbar values will build values into an array to be displayed to the user
       
  2935             // this may mean filtering out some items, so we have to know the mapping between our 
       
  2936             // fixed array of commands as well as the current value from settings
       
  2937             value = SetShortcutKeysValues(values, value, valueDisplayMapping);              
       
  2938             value = ShowRadioButtonSettingPageL(    R_BROWSER_SETTING_SHORTCUT_KEY0,
       
  2939                                                     values,
       
  2940                                                     value );
       
  2941             preferences.SetShortcutKey0CmdL( valueDisplayMapping->At(value) );
       
  2942             DisplayShortcutsSettingsL();
       
  2943             break;
       
  2944             }
       
  2945 
       
  2946         case EWmlSettingsShortCutKeyStarCmd:
       
  2947             {
       
  2948             value = preferences.ShortcutKeyStarCmd();
       
  2949             // set toolbar values will build values into an array to be displayed to the user
       
  2950             // this may mean filtering out some items, so we have to know the mapping between our 
       
  2951             // fixed array of commands as well as the current value from settings
       
  2952             value = SetShortcutKeysValues(values, value, valueDisplayMapping);              
       
  2953             value = ShowRadioButtonSettingPageL(    R_BROWSER_SETTING_SHORTCUT_KEYSTAR,
       
  2954                                                     values,
       
  2955                                                     value );
       
  2956             preferences.SetShortcutKeyStarCmdL( valueDisplayMapping->At(value) );
       
  2957             DisplayShortcutsSettingsL();
       
  2958             break;
       
  2959             }
       
  2960 
       
  2961         case EWmlSettingsShortCutKeyHashCmd:
       
  2962             {
       
  2963             value = preferences.ShortcutKeyHashCmd();
       
  2964             // set toolbar values will build values into an array to be displayed to the user
       
  2965             // this may mean filtering out some items, so we have to know the mapping between our 
       
  2966             // fixed array of commands as well as the current value from settings
       
  2967             value = SetShortcutKeysValues(values, value, valueDisplayMapping);              
       
  2968             value = ShowRadioButtonSettingPageL(    R_BROWSER_SETTING_SHORTCUT_KEYHASH,
       
  2969                                                     values,
       
  2970                                                     value );
       
  2971             preferences.SetShortcutKeyHashCmdL( valueDisplayMapping->At(value) );
       
  2972             DisplayShortcutsSettingsL();
       
  2973             break;
       
  2974             }
       
  2975 
       
  2976         default:
       
  2977             break;
       
  2978         }
       
  2979     CleanupStack::PopAndDestroy(2); // values, valueDisplayMapping
       
  2980     }
       
  2981 
       
  2982 
       
  2983 // -----------------------------------------------------------------------------
       
  2984 // CSettingsContainer::SetToolbarButtonValues
       
  2985 // -----------------------------------------------------------------------------
       
  2986 //
       
  2987 TInt CSettingsContainer::SetToolbarButtonValues(CArrayFixFlat<TInt> *values, TInt value, CArrayFixFlat<TInt> *displaymap)
       
  2988     {
       
  2989     TInt valueNewMapping = 0;
       
  2990     
       
  2991     for ( TInt i=0 ; i < KToolbarCommandDecodeMatrixCount ; i++ )      
       
  2992         {        
       
  2993         TInt stringId = ToolbarCommandDecodeMatrix[i][KToolbarCommandDecodeMatrixStringId];
       
  2994 
       
  2995         if ((stringId == R_BROWSER_SETTING_ROTATE_SCREEN) && (!ApiProvider().Preferences().RotateDisplay()) )
       
  2996         {   // Rotate Display is not available so don't show it as a toolbar button command
       
  2997             continue;   
       
  2998         }
       
  2999   
       
  3000 #ifndef __RSS_FEEDS
       
  3001         if (stringId == R_BROWSER_SETTING_SUBSCRIBE_TO_FEEDS)
       
  3002         {   // Subscribe to Feeds is not available so don't show it as a toolbar button command
       
  3003             continue;   
       
  3004         }        
       
  3005 #endif
       
  3006 
       
  3007         // Disable save page until it's officially supported 
       
  3008         if (stringId == R_BROWSER_SETTING_SAVE_PAGE )
       
  3009         {   
       
  3010             continue;   
       
  3011         }        
       
  3012 
       
  3013         // make a note at the index within the new array that the current value is at
       
  3014         // before appending (Count will then correspond to the index, rather than needing to use
       
  3015         // Count() - 1 AFTER we add it
       
  3016         if(i == value)
       
  3017             {
       
  3018             valueNewMapping = displaymap->Count();
       
  3019             }      
       
  3020         displaymap->AppendL( i );
       
  3021         values->AppendL( stringId );
       
  3022         }
       
  3023 
       
  3024     return valueNewMapping;
       
  3025     }
       
  3026 
       
  3027             
       
  3028 // -----------------------------------------------------------------------------
       
  3029 // CSettingsContainer::SetShortcutKeysValues
       
  3030 // -----------------------------------------------------------------------------
       
  3031 //
       
  3032 TInt CSettingsContainer::SetShortcutKeysValues(CArrayFixFlat<TInt> *values, TInt value, CArrayFixFlat<TInt> *displaymap)
       
  3033     {
       
  3034     TInt valueNewMapping = 0;
       
  3035         
       
  3036     for ( TInt i=0 ; i < KShortcutsCommandDecodeMatrixCount ; i++ )      
       
  3037         {
       
  3038         
       
  3039         TInt stringId = ShortcutsCommandDecodeMatrix[i][KShortcutsCommandDecodeMatrixStringId]; 
       
  3040         
       
  3041         if ((stringId == R_BROWSER_SETTING_ROTATE_SCREEN) && (!ApiProvider().Preferences().RotateDisplay()) )
       
  3042         {   // Rotate Display is not available so don't show it as a shortcut key command
       
  3043             continue;   
       
  3044         }
       
  3045   
       
  3046 #ifndef __RSS_FEEDS
       
  3047         if (stringId == R_BROWSER_SETTING_SUBSCRIBE_TO_FEEDS)
       
  3048         {   // Subscribe to Feeds is not available so don't show it as a shortcut key command
       
  3049             continue;   
       
  3050         }        
       
  3051 #endif
       
  3052 
       
  3053 
       
  3054        // Disable save page until it's officially supported 
       
  3055         if (stringId == R_BROWSER_SETTING_SAVE_PAGE )
       
  3056         {   
       
  3057             continue;   
       
  3058         }        
       
  3059 
       
  3060         // make a note at the index within the new array that the current value is at
       
  3061         // before appending (Count will then correspond to the index, rather than needing to use
       
  3062         // Count() - 1 AFTER we add it
       
  3063         if(i == value)
       
  3064             {
       
  3065             valueNewMapping = displaymap->Count();
       
  3066             }      
       
  3067         
       
  3068         displaymap->AppendL( i );
       
  3069         values->AppendL(stringId );
       
  3070         }
       
  3071         
       
  3072     return valueNewMapping;
       
  3073     }
       
  3074 
       
  3075 
       
  3076 // -----------------------------------------------------------------------------
       
  3077 // CSettingsContainer::IsSettingModifiable
       
  3078 // -----------------------------------------------------------------------------
       
  3079 //
       
  3080 TBool CSettingsContainer::IsSettingModifiable() const
       
  3081     {
       
  3082     TBool ret( EFalse );
       
  3083 
       
  3084     switch ( iCurrentSettingCategory )
       
  3085         {
       
  3086         // Only these setting lists contain items which can be modified
       
  3087         case EGeneral:
       
  3088         case EPage:
       
  3089         case EWebFeeds:
       
  3090         case EPrivacy:
       
  3091         case EToolbar:
       
  3092         case EShortCuts:
       
  3093             {
       
  3094             ret = ETrue;
       
  3095             break;
       
  3096             }
       
  3097         default:
       
  3098             break;
       
  3099         }
       
  3100     return ret;
       
  3101     }
       
  3102 
       
  3103 // -----------------------------------------------------------------------------
       
  3104 // CSettingsContainer::ShowRadioButtonSettingPageL
       
  3105 // -----------------------------------------------------------------------------
       
  3106 //
       
  3107 TInt CSettingsContainer::ShowRadioButtonSettingPageL(
       
  3108                                                      TInt aTitle,
       
  3109                                                      CArrayFixFlat<TInt>* aValues,
       
  3110                                                      TInt aCurrentItem )
       
  3111     {
       
  3112     // title of the dialog
       
  3113     HBufC* title = iCoeEnv->AllocReadResourceLC( aTitle );
       
  3114 
       
  3115     __ASSERT_DEBUG( (aValues != NULL), Util::Panic( Util::EUninitializedData ));
       
  3116 
       
  3117 
       
  3118     // options array
       
  3119     CDesCArrayFlat* values = new( ELeave )CDesCArrayFlat(1);
       
  3120     CleanupStack::PushL( values );
       
  3121 
       
  3122     for ( TInt i = aValues->Count() - 1; i >= 0; i-- )
       
  3123         {
       
  3124         HBufC* value = iCoeEnv->AllocReadResourceLC( aValues->At( i ) );
       
  3125         values->AppendL( *value );
       
  3126         CleanupStack::PopAndDestroy(); // value
       
  3127         }
       
  3128 
       
  3129     // index must be turned upside down, because options list is upside down
       
  3130     TInt newItem = aCurrentItem = aValues->Count() - 1 - aCurrentItem;
       
  3131 
       
  3132     // We have everything to create dialog
       
  3133     CAknRadioButtonSettingPage* dlg = new ( ELeave )CAknRadioButtonSettingPage(
       
  3134         R_RADIO_BUTTON_SETTING_PAGE, newItem, values );
       
  3135 
       
  3136     CleanupStack::PushL( dlg );
       
  3137     dlg->SetSettingTextL( *title );
       
  3138     //dlg->ConstructL();
       
  3139     //dlg->ListBoxControl()->SetCurrentItemIndex( newItem );
       
  3140     CleanupStack::Pop(); // dlg
       
  3141     iActionCancelled = EFalse;
       
  3142     if ( !dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
       
  3143         {
       
  3144         // Changes confirmed
       
  3145         newItem = aCurrentItem;
       
  3146         iActionCancelled = ETrue;
       
  3147         }
       
  3148 
       
  3149     CleanupStack::PopAndDestroy( 2 ); // title, values
       
  3150 
       
  3151     // index must be re-turned upside down, because options list is upside down
       
  3152     return aValues->Count() - 1 - newItem;
       
  3153     }
       
  3154 
       
  3155 
       
  3156 // -----------------------------------------------------------------------------
       
  3157 // CSettingsContainer::ShowRadioButtonSettingPageL
       
  3158 // -----------------------------------------------------------------------------
       
  3159 //
       
  3160 TBool CSettingsContainer::ShowRadioButtonSettingPageBoolL(
       
  3161                                                      TInt aTitle,
       
  3162                                                      CArrayFixFlat<TInt>* aValues,
       
  3163                                                      TInt* aCurrentItem )
       
  3164     {
       
  3165     // title of the dialog
       
  3166     HBufC* title = iCoeEnv->AllocReadResourceLC( aTitle );
       
  3167 
       
  3168     __ASSERT_DEBUG( (aValues != NULL), Util::Panic( Util::EUninitializedData ));
       
  3169     __ASSERT_DEBUG( (aCurrentItem != NULL), Util::Panic( Util::EUninitializedData ));
       
  3170 
       
  3171 
       
  3172     // options array
       
  3173     CDesCArrayFlat* values = new( ELeave )CDesCArrayFlat(1);
       
  3174     CleanupStack::PushL( values );
       
  3175 
       
  3176     for ( TInt i = aValues->Count() - 1; i >= 0; i-- )
       
  3177         {
       
  3178         HBufC* value = iCoeEnv->AllocReadResourceLC( aValues->At( i ) );
       
  3179         values->AppendL( *value );
       
  3180         CleanupStack::PopAndDestroy(); // value
       
  3181         }
       
  3182 
       
  3183     TInt newItem = *aCurrentItem;
       
  3184     CAknRadioButtonSettingPage* dlg = new ( ELeave )CAknRadioButtonSettingPage(
       
  3185         R_RADIO_BUTTON_SETTING_PAGE, newItem, values );
       
  3186 
       
  3187     CleanupStack::PushL( dlg );
       
  3188     dlg->SetSettingTextL( *title );
       
  3189     CleanupStack::Pop(); // dlg
       
  3190 
       
  3191     TBool retval = dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged );
       
  3192 
       
  3193     if ( retval )  // OK was selected, store new value
       
  3194         {
       
  3195         *aCurrentItem = newItem;
       
  3196         }
       
  3197     CleanupStack::PopAndDestroy( 2 ); // title, values 
       
  3198     return retval;
       
  3199     }
       
  3200 
       
  3201 
       
  3202 // -----------------------------------------------------------------------------
       
  3203 // CSettingsContainer::SaveChangesL
       
  3204 // -----------------------------------------------------------------------------
       
  3205 //
       
  3206 void CSettingsContainer::SaveChangesL()
       
  3207     {
       
  3208     // These settings result in page layout changes, and changes to these
       
  3209     // settings should only be relayed once the settings page is closed
       
  3210     MPreferences& preferences = ApiProvider().Preferences();
       
  3211 
       
  3212     if ( iFontSize != preferences.FontSize() )
       
  3213         {
       
  3214     preferences.SetFontSizeL( iFontSize );
       
  3215         }
       
  3216 
       
  3217     if ( iEncoding != preferences.Encoding() )
       
  3218         {
       
  3219         preferences.SetEncodingL( iEncoding );
       
  3220         }
       
  3221 
       
  3222     if ( iTextWrap != preferences.TextWrap() )
       
  3223         {
       
  3224         preferences.SetTextWrapL( iTextWrap );
       
  3225         }
       
  3226     preferences.FlushSD();
       
  3227 
       
  3228     preferences.NotifyObserversL( EPreferencesDeactivate, TBrCtlDefs::ESettingsUnknown );
       
  3229     }
       
  3230 
       
  3231 
       
  3232 // -----------------------------------------------------------------------------
       
  3233 // CSettingsContainer::OfferKeyEventL
       
  3234 // -----------------------------------------------------------------------------
       
  3235 //
       
  3236 TKeyResponse CSettingsContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
       
  3237     {
       
  3238     TKeyResponse ret = EKeyWasNotConsumed;
       
  3239     TKeyEvent keyEvent(aKeyEvent);
       
  3240     
       
  3241     // Special case for MSK enabled mode - turn MSK KeyUp to MSK KeyEvent to process Settings toggle function
       
  3242     // This is what is done in BookmarksContainer::OfferKeyEventL
       
  3243     if (( keyEvent.iScanCode == EStdKeyDevice3 ) || (keyEvent.iScanCode == EStdKeyEnter))
       
  3244         {
       
  3245         if( aType == EEventKeyDown )
       
  3246             {
       
  3247             iSelectionKeyDownPressed = ETrue;
       
  3248             ret = EKeyWasConsumed;
       
  3249             }
       
  3250         else if( aType == EEventKeyUp )
       
  3251             {
       
  3252             if( iSelectionKeyDownPressed )
       
  3253                 {
       
  3254                 keyEvent.iCode = EKeyOK;
       
  3255                 ret = EKeyWasNotConsumed;
       
  3256                 iSelectionKeyDownPressed = EFalse;
       
  3257                 }
       
  3258             else
       
  3259                 {
       
  3260                 // long press of Selection key was already processed
       
  3261                 ret = EKeyWasConsumed;
       
  3262                 }
       
  3263             }
       
  3264         }
       
  3265 
       
  3266 
       
  3267     switch ( keyEvent.iCode )
       
  3268         {
       
  3269         // Open List Box item
       
  3270         case EKeyEnter:
       
  3271             {
       
  3272             switch ( iSettingIndex->At( iSettingListBox->CurrentItemIndex() ) )
       
  3273                 {
       
  3274                 case EWmlSettingsGeneral:
       
  3275                 case EWmlSettingsPrivacy:
       
  3276                 case EWmlSettingsPage:
       
  3277                 case EWmlSettingsWebFeeds:
       
  3278                 case EWmlSettingsToolbar:
       
  3279                 case EWmlSettingsShortcuts:
       
  3280                 {
       
  3281                     DisplayCorrectSettingCategoryListL();
       
  3282                     break;
       
  3283                 }
       
  3284                 
       
  3285                 // Individual Settings
       
  3286                 case EWmlSettingsAccesspoint:
       
  3287                 case EWmlSettingsHomePage:
       
  3288                 case EWmlSettingsBackList:
       
  3289                 case EWmlSettingsHttpSecurityWarnings:
       
  3290                 case EWmlSettingsEcma:
       
  3291                 case EWmlSettingsScriptLog:
       
  3292                 case EWmlSettingsDownloadsOpen:
       
  3293                 case EWmlSettingsAutoLoadContent:
       
  3294                 case EWmlSettingsFullScreen:
       
  3295                 case EWmlSettingsPageOverview:
       
  3296                 case EWmlSettingsMediaVolume:
       
  3297                 case EWmlSettingsEncoding:
       
  3298                 case EWmlSettingsPopupBlocking:
       
  3299                 case EWmlSettingsAutoRefresh:
       
  3300                 case EWmlSettingsAdaptiveBookmarks:
       
  3301                 case EWmlSettingsFormDataSaving:
       
  3302 #ifdef __WIM
       
  3303                 case EWmlSettingsSaveReceipt:
       
  3304 #endif
       
  3305                 case EWmlSettingsCookies:
       
  3306                 case EWmlSettingsIMEINotification:
       
  3307                 case EWmlSettingsAutomaticUpdatingAP:
       
  3308                 case EWmlSettingsAutomaticUpdatingWhileRoaming:
       
  3309                 case EWmlSettingsUrlSuffix:
       
  3310                 case EWmlSettingsFontSize:
       
  3311                 case EWmlSettingsToolbarButton1Cmd:
       
  3312                 case EWmlSettingsToolbarButton2Cmd:
       
  3313                 case EWmlSettingsToolbarButton3Cmd:
       
  3314                 case EWmlSettingsToolbarButton4Cmd:
       
  3315                 case EWmlSettingsToolbarButton5Cmd:
       
  3316                 case EWmlSettingsToolbarButton6Cmd:
       
  3317                 case EWmlSettingsToolbarButton7Cmd:
       
  3318                 case EWmlSettingsShortCutKey1Cmd:
       
  3319                 case EWmlSettingsShortCutKey2Cmd:
       
  3320                 case EWmlSettingsShortCutKey3Cmd:
       
  3321                 case EWmlSettingsShortCutKey4Cmd:
       
  3322                 case EWmlSettingsShortCutKey5Cmd:
       
  3323                 case EWmlSettingsShortCutKey6Cmd:
       
  3324                 case EWmlSettingsShortCutKey7Cmd:
       
  3325                 case EWmlSettingsShortCutKey8Cmd:
       
  3326                 case EWmlSettingsShortCutKey9Cmd:
       
  3327                 case EWmlSettingsShortCutKey0Cmd:
       
  3328                 case EWmlSettingsShortCutKeyStarCmd:
       
  3329                 case EWmlSettingsShortCutKeyHashCmd:
       
  3330                 case EWmlSettingsSearchProvider:
       
  3331                 {
       
  3332                     ChangeItemL( ETrue );
       
  3333                     ret = EKeyWasConsumed;
       
  3334                     break;
       
  3335                 }
       
  3336                 default:
       
  3337                     break;
       
  3338                 }
       
  3339             break;
       
  3340             }
       
  3341             
       
  3342         case EKeyOK:
       
  3343             {
       
  3344             // MSK command handles the commands - no need for key handling
       
  3345             ret = EKeyWasConsumed;
       
  3346             break; 
       
  3347             }
       
  3348             
       
  3349           default:
       
  3350             break;
       
  3351         }
       
  3352 
       
  3353     if ( iSettingListBox && ( ret == EKeyWasNotConsumed || iSettingListBox ) )
       
  3354         {
       
  3355         ret = iSettingListBox->OfferKeyEventL( keyEvent, aType );
       
  3356         }
       
  3357     return ret;
       
  3358     }
       
  3359 
       
  3360 
       
  3361 // -----------------------------------------------------------------------------
       
  3362 // CSettingsContainer::HandleListBoxEventL
       
  3363 // -----------------------------------------------------------------------------
       
  3364 //
       
  3365 void CSettingsContainer::HandleListBoxEventL(CEikListBox* aListBox,TListBoxEvent aEventType)
       
  3366     {
       
  3367     TKeyResponse ret = EKeyWasNotConsumed;
       
  3368     if (iPenEnabled)
       
  3369         {
       
  3370         if (iSettingListBox && aListBox == iSettingListBox)
       
  3371             {
       
  3372             switch (aEventType)
       
  3373                 {
       
  3374                 //case MEikListBoxObserver::EEventEnterKeyPressed:
       
  3375                 case MEikListBoxObserver::EEventItemClicked:
       
  3376                     break;
       
  3377                 case MEikListBoxObserver::EEventItemDoubleClicked:
       
  3378                     {
       
  3379                     TKeyEvent keyEvent;
       
  3380                     keyEvent.iModifiers = 0;
       
  3381                     keyEvent.iRepeats = 0;
       
  3382                     keyEvent.iCode = EKeyDevice3;
       
  3383                     keyEvent.iScanCode = EStdKeyDevice3;
       
  3384                     CCoeEnv::Static()->SimulateKeyEventL( keyEvent, EEventKey );
       
  3385                     }
       
  3386                     break;
       
  3387 #ifdef BRDO_SINGLE_CLICK_ENABLED_FF					
       
  3388                 case MEikListBoxObserver::EEventItemSingleClicked:
       
  3389 
       
  3390                     switch ( iSettingIndex->At( iSettingListBox->CurrentItemIndex() ) )
       
  3391                         {
       
  3392                         case EWmlSettingsGeneral:
       
  3393                         case EWmlSettingsPrivacy:
       
  3394                         case EWmlSettingsPage:
       
  3395                         case EWmlSettingsWebFeeds:
       
  3396                         case EWmlSettingsToolbar:
       
  3397                         case EWmlSettingsShortcuts:
       
  3398                         {
       
  3399                             DisplayCorrectSettingCategoryListL();
       
  3400                             break;
       
  3401                         }
       
  3402                         
       
  3403                         // Individual Settings
       
  3404                         case EWmlSettingsAccesspoint:
       
  3405                         case EWmlSettingsHomePage:
       
  3406                         case EWmlSettingsBackList:
       
  3407                         case EWmlSettingsHttpSecurityWarnings:
       
  3408                         case EWmlSettingsEcma:
       
  3409                         case EWmlSettingsScriptLog:
       
  3410                         case EWmlSettingsDownloadsOpen:
       
  3411                         case EWmlSettingsAutoLoadContent:
       
  3412                         case EWmlSettingsFullScreen:
       
  3413                         case EWmlSettingsPageOverview:
       
  3414                         case EWmlSettingsMediaVolume:
       
  3415                         case EWmlSettingsEncoding:
       
  3416                         case EWmlSettingsPopupBlocking:
       
  3417                         case EWmlSettingsAutoRefresh:
       
  3418                         case EWmlSettingsAdaptiveBookmarks:
       
  3419                         case EWmlSettingsFormDataSaving:
       
  3420         #ifdef __WIM
       
  3421                         case EWmlSettingsSaveReceipt:
       
  3422         #endif
       
  3423                         case EWmlSettingsCookies:
       
  3424                         case EWmlSettingsIMEINotification:
       
  3425                         case EWmlSettingsAutomaticUpdatingAP:
       
  3426                         case EWmlSettingsAutomaticUpdatingWhileRoaming:
       
  3427                         case EWmlSettingsUrlSuffix:
       
  3428                         case EWmlSettingsFontSize:
       
  3429                         case EWmlSettingsToolbarButton1Cmd:
       
  3430                         case EWmlSettingsToolbarButton2Cmd:
       
  3431                         case EWmlSettingsToolbarButton3Cmd:
       
  3432                         case EWmlSettingsToolbarButton4Cmd:
       
  3433                         case EWmlSettingsToolbarButton5Cmd:
       
  3434                         case EWmlSettingsToolbarButton6Cmd:
       
  3435                         case EWmlSettingsToolbarButton7Cmd:
       
  3436                         case EWmlSettingsShortCutKey1Cmd:
       
  3437                         case EWmlSettingsShortCutKey2Cmd:
       
  3438                         case EWmlSettingsShortCutKey3Cmd:
       
  3439                         case EWmlSettingsShortCutKey4Cmd:
       
  3440                         case EWmlSettingsShortCutKey5Cmd:
       
  3441                         case EWmlSettingsShortCutKey6Cmd:
       
  3442                         case EWmlSettingsShortCutKey7Cmd:
       
  3443                         case EWmlSettingsShortCutKey8Cmd:
       
  3444                         case EWmlSettingsShortCutKey9Cmd:
       
  3445                         case EWmlSettingsShortCutKey0Cmd:
       
  3446                         case EWmlSettingsShortCutKeyStarCmd:
       
  3447                         case EWmlSettingsShortCutKeyHashCmd:
       
  3448                         case EWmlSettingsSearchProvider:
       
  3449                         {
       
  3450                             ChangeItemL( ETrue );
       
  3451                             ret = EKeyWasConsumed;
       
  3452                             break;
       
  3453                         }
       
  3454                         default:
       
  3455                             break;
       
  3456                         }	
       
  3457 #endif					
       
  3458                 default:
       
  3459                     break;
       
  3460                 }
       
  3461             }
       
  3462         }
       
  3463     }
       
  3464 
       
  3465 
       
  3466 // -----------------------------------------------------------------------------
       
  3467 // CSettingsContainer::HandleGainingForegroundL
       
  3468 // -----------------------------------------------------------------------------
       
  3469 //
       
  3470 void CSettingsContainer::HandleGainingForegroundL()
       
  3471     {
       
  3472     switch(iCurrentSettingCategory)
       
  3473         {
       
  3474         case EGeneral:
       
  3475             DisplayGeneralSettingsL();
       
  3476             break;
       
  3477         default: // do nothing
       
  3478             break;
       
  3479         }
       
  3480     }
       
  3481 
       
  3482 // -----------------------------------------------------------------------------
       
  3483 // CSettingsContainer::CreateItemFromTwoStringsL
       
  3484 // -----------------------------------------------------------------------------
       
  3485 //
       
  3486 void CSettingsContainer::CreateItemFromTwoStringsL(
       
  3487                                                    TInt aFirst,
       
  3488                                                    TInt aSecond,
       
  3489                                                    TBuf<KWmlSettingsItemMaxLength>& aResult )
       
  3490     {
       
  3491     // Appends two text from resources next to each other
       
  3492     aResult.Zero();
       
  3493     aResult.Append( KWmlSettingsListBoxItemPrefix );
       
  3494     HBufC* first = iCoeEnv->AllocReadResourceLC(  aFirst );
       
  3495     aResult.Append( first->Des() );
       
  3496     CleanupStack::PopAndDestroy(); // first
       
  3497     aResult.Append( KWmlSettingsListBoxItemPostfix );
       
  3498     HBufC* second = iCoeEnv->AllocReadResourceLC(  aSecond );
       
  3499     aResult.Append( second->Des() );
       
  3500     CleanupStack::PopAndDestroy(); //second
       
  3501     }
       
  3502 
       
  3503 
       
  3504 // ----------------------------------------------------------------------------
       
  3505 // CSettingsContainer::AddEncodingL()
       
  3506 // ----------------------------------------------------------------------------
       
  3507 //
       
  3508 void CSettingsContainer::AddEncodingL( TUint32 aSystemId, TUint32 aResId )
       
  3509     {
       
  3510     TEncodingStruct encoding;
       
  3511 
       
  3512     encoding.iSystemId = aSystemId;
       
  3513     encoding.iResId = aResId;
       
  3514 
       
  3515     iEncodingArray->AppendL( encoding );
       
  3516     }
       
  3517 
       
  3518 
       
  3519 // -----------------------------------------------------------------------------
       
  3520 // CSettingsContainer::RemoveUnsupportedEncodingsL()
       
  3521 // -----------------------------------------------------------------------------
       
  3522 //
       
  3523 void CSettingsContainer::RemoveUnsupportedEncodingsL()
       
  3524     {
       
  3525     RFs fsSession;
       
  3526     User::LeaveIfError( fsSession.Connect() );
       
  3527     CleanupClosePushL<RFs>( fsSession );
       
  3528 
       
  3529     CCnvCharacterSetConverter* charConv;
       
  3530     charConv = CCnvCharacterSetConverter::NewLC();
       
  3531 
       
  3532     CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* charSets;
       
  3533     charSets = charConv->CreateArrayOfCharacterSetsAvailableLC(fsSession);
       
  3534 
       
  3535     TInt lastIndex = iEncodingArray->Count()-1;
       
  3536 
       
  3537     for ( int i = lastIndex; i >= 0; i-- )
       
  3538         {
       
  3539         TBool remove = ETrue;
       
  3540         TEncodingStruct encoding = iEncodingArray->At(i);
       
  3541         for ( int j = 0; j < charSets->Count(); j++ )
       
  3542             {
       
  3543             TUint32 identifier = charSets->At(j).Identifier();
       
  3544 
       
  3545             if ( identifier == encoding.iSystemId )
       
  3546                 {
       
  3547                 remove = EFalse;
       
  3548                 break;
       
  3549                 }
       
  3550             }
       
  3551 
       
  3552         if ( remove &&
       
  3553             ( encoding.iSystemId != KCharacterSetIdentifierAutomatic ) )
       
  3554             {
       
  3555             iEncodingArray->Delete(i);
       
  3556             }
       
  3557         }
       
  3558 
       
  3559     fsSession.Close();
       
  3560     CleanupStack::PopAndDestroy(3); // charConv, charSets, fsSession
       
  3561     }
       
  3562 
       
  3563 
       
  3564 // -----------------------------------------------------------------------------
       
  3565 // CSettingsContainer::CreateEncodingArrayL()
       
  3566 // -----------------------------------------------------------------------------
       
  3567 //
       
  3568 void CSettingsContainer::CreateEncodingArrayL()
       
  3569     {
       
  3570     AddEncodingL( KCharacterSetIdentifierGb2312,        R_WMLBROWSER_SETTINGS_ENCODING_GB2312 );
       
  3571     AddEncodingL( KCharacterSetIdentifierIso88591,      R_WMLBROWSER_SETTINGS_ENCODING_ISO8859_1 );
       
  3572     AddEncodingL( KCharacterSetIdentifierBig5,          R_WMLBROWSER_SETTINGS_ENCODING_BIG5 );
       
  3573     AddEncodingL( KCharacterSetIdentifierUtf8,          R_WMLBROWSER_SETTINGS_ENCODING_UTF8 );
       
  3574     AddEncodingL( KCharacterSetIdentifierIso88592,      R_WMLBROWSER_SETTINGS_ENCODING_ISO8859_2 );
       
  3575     AddEncodingL( KCharacterSetIdentifierIso88594,      R_WMLBROWSER_SETTINGS_ENCODING_ISO8859_4 );
       
  3576     AddEncodingL( KCharacterSetIdentifierIso88595,      R_WMLBROWSER_SETTINGS_ENCODING_ISO8859_5 );
       
  3577     AddEncodingL( KCharacterSetIdentifierIso88597,      R_WMLBROWSER_SETTINGS_ENCODING_ISO8859_7 );
       
  3578     AddEncodingL( KCharacterSetIdentifierIso88599,      R_WMLBROWSER_SETTINGS_ENCODING_ISO8859_9 );
       
  3579     AddEncodingL( KCharacterSetIdentifierIso88598,      R_WMLBROWSER_SETTINGS_ENCODING_ISO8859_8 );
       
  3580     AddEncodingL( KCharacterSetIdentifierIso88596,      R_WMLBROWSER_SETTINGS_ENCODING_ISO8859_6 );
       
  3581     AddEncodingL( KCharacterSetIdentifierWindows1256,   R_WMLBROWSER_SETTINGS_ENCODING_WINDOWS_1256 );
       
  3582     AddEncodingL( KCharacterSetIdentifierWindows1255,   R_WMLBROWSER_SETTINGS_ENCODING_WINDOWS_1255 );
       
  3583     AddEncodingL( KCharacterSetIdentifierWindows1250,   R_WMLBROWSER_SETTINGS_ENCODING_WINDOWS_1250 );
       
  3584     AddEncodingL( KCharacterSetIdentifierWindows1251,   R_WMLBROWSER_SETTINGS_ENCODING_WINDOWS_1251 );
       
  3585     AddEncodingL( KCharacterSetIdentifierWindows1253,   R_WMLBROWSER_SETTINGS_ENCODING_WINDOWS_1253 );
       
  3586     AddEncodingL( KCharacterSetIdentifierWindows1254,   R_WMLBROWSER_SETTINGS_ENCODING_WINDOWS_1254 );
       
  3587     AddEncodingL( KCharacterSetIdentifierWindows1257,   R_WMLBROWSER_SETTINGS_ENCODING_WINDOWS_1257 );
       
  3588     AddEncodingL( KCharacterSetIdentifierWindows1258,   R_WMLBROWSER_SETTINGS_ENCODING_WINDOWS_1258 );
       
  3589     AddEncodingL( KCharacterSetIdentifierTis620,        R_WMLBROWSER_SETTINGS_ENCODING_TIS_620 );       // Thai
       
  3590     AddEncodingL( KCharacterSetIdentifierWindows874,    R_WMLBROWSER_SETTINGS_ENCODING_WINDOWS_874 );   // Thai
       
  3591     AddEncodingL( KCharacterSetIdentifierEucJpPacked,   R_WMLBROWSER_SETTINGS_ENCODING_EUC_JP );
       
  3592     AddEncodingL( KCharacterSetIdentifierJis,           R_WMLBROWSER_SETTINGS_ENCODING_ISO_2022_JP );
       
  3593     AddEncodingL( KCharacterSetIdentifierShiftJis,      R_WMLBROWSER_SETTINGS_ENCODING_SHIFT_JIS );
       
  3594     AddEncodingL( KCharacterSetIdentifierKoi8_r,        R_WMLBROWSER_SETTINGS_ENCODING_KOI8_R );
       
  3595     AddEncodingL( KCharacterSetIdentifierKoi8_u,        R_WMLBROWSER_SETTINGS_ENCODING_KOI8_U );
       
  3596 	AddEncodingL( KCharacterSetIdentifierIscii_temp,			R_WMLBROWSER_SETTINGS_ENCODING_ISCII);
       
  3597     AddEncodingL( KCharacterSetIdentifierEucKr,         R_WMLBROWSER_SETTINGS_ENCODING_EUC_KR );
       
  3598     AddEncodingL( KCharacterSetIdentifierKsc5601_temp,       R_WMLBROWSER_SETTINGS_ENCODING_KSC_5601 );
       
  3599     AddEncodingL( KCharacterSetIdentifierAutomatic,     R_WMLBROWSER_SETTINGS_ENCODING_AUTOMATIC );
       
  3600     }
       
  3601 
       
  3602 #ifdef __SERIES60_HELP
       
  3603 // -----------------------------------------------------------------------------
       
  3604 // CSettingsContainer::GetHelpContext()
       
  3605 // -----------------------------------------------------------------------------
       
  3606 //
       
  3607 void CSettingsContainer::GetHelpContext( TCoeHelpContext& aContext ) const
       
  3608     {
       
  3609     aContext.iMajor = KUidBrowserApplication;
       
  3610     /*
       
  3611     context is dependent on what Category we are in
       
  3612     enum TSettingCategory
       
  3613             {
       
  3614             EMain = 0,
       
  3615             EGeneral,
       
  3616             EPrivacy,
       
  3617             EPage,
       
  3618             EWebFeeds,
       
  3619             EToolbar,
       
  3620             EShortCuts,
       
  3621             ENone
       
  3622             };
       
  3623     */
       
  3624     switch ( iCurrentSettingCategory )
       
  3625         {
       
  3626         case EMain:
       
  3627             aContext.iContext = KOSS_HLP_SETTINGS_FOLDERS;
       
  3628             break;
       
  3629         case EGeneral:
       
  3630             aContext.iContext = KOSS_HLP_SETTINGS_GENERAL;
       
  3631             break;
       
  3632         case EPrivacy:
       
  3633             aContext.iContext = KOSS_HLP_SETTINGS_PRIVACY;
       
  3634             break;
       
  3635         case EPage:
       
  3636             aContext.iContext = KOSS_HLP_SETTINGS_PAGE;
       
  3637             break;
       
  3638         case EWebFeeds:
       
  3639             aContext.iContext = KOSS_HLP_SETTINGS_RSS;
       
  3640             break;
       
  3641         case ENone:
       
  3642             aContext.iContext = KOSS_HLP_SETTINGS_FOLDERS;
       
  3643             break;
       
  3644         default:
       
  3645             aContext.iContext = KOSS_HLP_SETTINGS_FOLDERS;
       
  3646             break;
       
  3647 
       
  3648 
       
  3649         }
       
  3650 
       
  3651     }
       
  3652 #endif // __SERIES60_HELP
       
  3653 
       
  3654 
       
  3655 // -----------------------------------------------------------------------------
       
  3656 // CSettingsContainer::MapCurrentItem
       
  3657 // -----------------------------------------------------------------------------
       
  3658 //
       
  3659 TInt CSettingsContainer::MapCurrentItem( TUint aCurrentItem ) const
       
  3660     {
       
  3661     return iSettingIndex->At( aCurrentItem );
       
  3662     }
       
  3663 
       
  3664 
       
  3665 // -----------------------------------------------------------------------------
       
  3666 // CSettingsContainer::CountComponentControls
       
  3667 // -----------------------------------------------------------------------------
       
  3668 //
       
  3669 TInt CSettingsContainer::CountComponentControls() const
       
  3670   {
       
  3671   return iSettingListBox ? 1 : 0;
       
  3672   }
       
  3673 
       
  3674 
       
  3675 // -----------------------------------------------------------------------------
       
  3676 // CSettingsContainer::ComponentControl
       
  3677 // -----------------------------------------------------------------------------
       
  3678 //
       
  3679 CCoeControl* CSettingsContainer::ComponentControl( TInt aIndex ) const
       
  3680   {
       
  3681   return ( aIndex ? NULL : iSettingListBox );
       
  3682   }
       
  3683 
       
  3684 
       
  3685 // -----------------------------------------------------------------------------
       
  3686 // CSettingsContainer::SizeChanged
       
  3687 // -----------------------------------------------------------------------------
       
  3688 //
       
  3689 void CSettingsContainer::SizeChanged()
       
  3690     {
       
  3691     if ( iSettingListBox )
       
  3692         {
       
  3693         iSettingListBox->SetRect( Rect() );
       
  3694         }
       
  3695     }
       
  3696 
       
  3697 
       
  3698 // ----------------------------------------------------------------------------
       
  3699 // CSettingsContainer::FocusChanged
       
  3700 // ----------------------------------------------------------------------------
       
  3701 //
       
  3702 void CSettingsContainer::FocusChanged( TDrawNow aDrawNow )
       
  3703     {
       
  3704     if ( iSettingListBox && iSettingListBox->IsVisible() )
       
  3705         {
       
  3706         iSettingListBox->SetFocus( IsFocused(), aDrawNow );
       
  3707         }
       
  3708     }
       
  3709 
       
  3710 // -----------------------------------------------------------------------------
       
  3711 // CSettingsContainer::HandleResourceChange
       
  3712 // -----------------------------------------------------------------------------
       
  3713 //
       
  3714 void CSettingsContainer::HandleResourceChange( TInt aType )
       
  3715     {
       
  3716     if ( iSettingListBox )
       
  3717         {
       
  3718         iSettingListBox->HandleResourceChange( aType );
       
  3719         }
       
  3720         
       
  3721     if (aType == KEikDynamicLayoutVariantSwitch)
       
  3722         {
       
  3723         TRect  rect;
       
  3724         if (AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect))
       
  3725             {
       
  3726             SetRect(rect);
       
  3727             }
       
  3728         DrawDeferred();
       
  3729         }    
       
  3730         
       
  3731     }
       
  3732 
       
  3733 // ---------------------------------------------------------
       
  3734 // CSettingsContainer::ShowFormDataDeleteAllQueryDialogL
       
  3735 // ---------------------------------------------------------
       
  3736 //
       
  3737 void CSettingsContainer::ShowFormDataDeleteAllQueryDialogL( )
       
  3738     {
       
  3739     CAknQueryDialog* dlg = new (ELeave) CAknQueryDialog(CAknQueryDialog::EConfirmationTone);
       
  3740     HBufC* deleteQuery = StringLoader::LoadLC(R_WMLBROWSER_SETTINGS_FORM_DATA_DELETE_ALL);
       
  3741     dlg->SetPromptL(*deleteQuery);
       
  3742     dlg->PrepareLC( R_SETTINGS_QUERY_LINES);
       
  3743     TInt ret = dlg->RunLD();
       
  3744     if( ret == EAknSoftkeyYes )
       
  3745         {
       
  3746         // call brctl to clear data
       
  3747         CBrowserAppUi::Static()->BrCtlInterface().HandleCommandL((TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandClearAutoFormFillData);
       
  3748         CBrowserAppUi::Static()->BrCtlInterface().HandleCommandL((TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandClearAutoFormFillPasswordData);
       
  3749         }
       
  3750     CleanupStack::PopAndDestroy(1); // deleteQuery
       
  3751     }
       
  3752 
       
  3753 // ---------------------------------------------------------
       
  3754 // CSettingsContainer::ShowFormDataDeletePasswordQueryDialogL
       
  3755 // ---------------------------------------------------------
       
  3756 //
       
  3757 void CSettingsContainer::ShowFormDataDeletePasswordQueryDialogL( )
       
  3758     {
       
  3759     CAknQueryDialog* dlg = new (ELeave) CAknQueryDialog(CAknQueryDialog::EConfirmationTone);
       
  3760     HBufC* deleteQuery = StringLoader::LoadLC(R_WMLBROWSER_SETTINGS_FORM_DATA_DELETE_PASSWORD);
       
  3761     dlg->SetPromptL(*deleteQuery);
       
  3762     dlg->PrepareLC( R_SETTINGS_QUERY_LINES);
       
  3763     TInt ret = dlg->RunLD();
       
  3764     if( ret == EAknSoftkeyYes )
       
  3765         {
       
  3766         // call brctl to clear data
       
  3767         CBrowserAppUi::Static()->BrCtlInterface().HandleCommandL((TInt)TBrCtlDefs::ECommandIdBase + (TInt)TBrCtlDefs::ECommandClearAutoFormFillPasswordData);
       
  3768         }
       
  3769     CleanupStack::PopAndDestroy(1); // deleteQuery
       
  3770     }
       
  3771 
       
  3772 // ---------------------------------------------------------
       
  3773 // CSettingsContainer::SelectUserDefinedAPL
       
  3774 // ---------------------------------------------------------
       
  3775 //
       
  3776 void CSettingsContainer::SelectUserDefinedAPL( TUint32& id )
       
  3777     {
       
  3778     LOG_ENTERFN( "CSettingsContainer::SelectUserDefinedAPL" );
       
  3779 
       
  3780     BROWSER_LOG( ( _L( "CApSettingsHandler()" ) ) );
       
  3781     CApSettingsHandler *ApUi = CApSettingsHandler::NewLC(
       
  3782                                 ETrue,
       
  3783                                 EApSettingsSelListIsPopUp,
       
  3784                                 EApSettingsSelMenuSelectNormal,
       
  3785                                 KEApIspTypeAll,
       
  3786                                 EApBearerTypeAll,
       
  3787                                 KEApSortNameAscending,
       
  3788                                 EIPv4 | EIPv6
       
  3789                                 );
       
  3790     BROWSER_LOG( ( _L( "EWmlSettingsAutomaticUpdatingAP RunSettingsL()" ) ) );
       
  3791     TInt ret = ApUi->RunSettingsL( id, id );
       
  3792     CleanupStack::PopAndDestroy( ApUi ); //ApUi
       
  3793     if ( ret & KApUiEventExitRequested ) // & because it is a bit-mask...
       
  3794         {
       
  3795         CBrowserAppUi::Static()->ExitBrowser( EFalse );
       
  3796         }
       
  3797 
       
  3798     CApSelect* ApSel = CApSelect::NewLC(
       
  3799                 iApiProvider.CommsModel().CommsDb(),
       
  3800                 KEApIspTypeAll, //KEApIspTypeWAPMandatory,
       
  3801                 EApBearerTypeAll,
       
  3802                 KEApSortNameAscending,
       
  3803                 EIPv4 | EIPv6 );
       
  3804     TInt apSelCount = ApSel->Count();
       
  3805     BROWSER_LOG( ( _L( " ApSel->Count(): %d" ), apSelCount ) );
       
  3806     CleanupStack::PopAndDestroy( ApSel ); //ApSel
       
  3807 
       
  3808     CApUtils* au = CApUtils::NewLC( iApiProvider.CommsModel().CommsDb() );
       
  3809     TBool apExist = au->WapApExistsL( id );
       
  3810     CleanupStack::PopAndDestroy( au );  // au
       
  3811 
       
  3812     if( ( 0 == apSelCount ) || ( EFalse == apExist ) )
       
  3813         {
       
  3814         id =  KWmlNoDefaultAccessPoint;
       
  3815         }
       
  3816     }
       
  3817 
       
  3818 // -----------------------------------------------------------------------------
       
  3819 // CSettingsContainer::RunSearchSettingsL
       
  3820 // -----------------------------------------------------------------------------
       
  3821 //
       
  3822 void CSettingsContainer::RunSearchSettingsL()
       
  3823     {
       
  3824     // Get Search application UID from CenRep 
       
  3825     TInt id = ApiProvider().Preferences().GetIntValue( KBrowserSearchAppUid );
       
  3826     TUid searchAppId( TUid::Uid( id ) );
       
  3827     id = ApiProvider().Preferences().GetIntValue( KBrowserSearchProviderSettingViewId );
       
  3828     TUid settingViewId( TUid::Uid( id ) );
       
  3829     TVwsViewId viewToOpen(searchAppId, settingViewId);
       
  3830     CBrowserAppUi::Static()->ActivateViewL(viewToOpen);
       
  3831     } 
       
  3832 
       
  3833 // End of File