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