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