browserui/browser/BrowserAppSrc/BrowserPreferences.cpp
changeset 51 48e827313edd
parent 37 481242ead638
child 53 f427d27b98d8
equal deleted inserted replaced
37:481242ead638 51:48e827313edd
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *     It manages WmlBrowser's preferences
       
    16 *
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include <s32stor.h>
       
    24 #include <eikappui.h>
       
    25 #include <eikapp.h>
       
    26 #include <eikenv.h>
       
    27 
       
    28 #include <ApSettingsHandlerUi.h>
       
    29 
       
    30 #include <ApEngineConsts.h>
       
    31 #include <aputils.h>
       
    32 #include <ApDataHandler.h>
       
    33 #include <ApDataHandler.h>
       
    34 #include <ApAccessPointItem.h>
       
    35 #include <ApSelect.h>
       
    36 #include <ApListItem.h>
       
    37 #include <ApListItemList.h>
       
    38 #include <VpnAPEngine.h>
       
    39 #include <VpnApItem.h>
       
    40 #include <aknutils.h>
       
    41 
       
    42 #include <COEMAIN.H>
       
    43 #include <FeatMgr.h>
       
    44 #include <brctldefs.h>
       
    45 
       
    46 #include "CommsModel.h"
       
    47 #include "ApiProvider.h"
       
    48 #include "BrowserApplication.h"
       
    49 #include "BrowserPreferences.h"
       
    50 #include "Browser.hrh"
       
    51 #include "BrowserUiVariant.hrh"
       
    52 #include <bldvariant.hrh>
       
    53 #include "commonconstants.h"
       
    54 #include "BrowserAppUi.h"
       
    55 #include <browseroverriddensettings.h>
       
    56 #include "SettingsContainer.h"  // for TEncoding
       
    57 #include "BrowserUtil.h" // for Util::AllocateUrlWithSchemeL
       
    58 #include "logger.h"
       
    59 
       
    60 #include "CmApplicationSettingsUi.h"
       
    61 #include <cmmanager.h>
       
    62 #include <cmdestination.h>
       
    63 
       
    64 // CONSTANTS
       
    65 
       
    66 //Shared data values for Full Screen setting
       
    67 const TInt KBrowserFullScreenSettingDataSoftkeysOff			 = 0; //full screen
       
    68 const TInt KBrowserFullScreenSettingDataSoftkeysOn			 = 1; //softkeys displayed
       
    69 
       
    70 //Shared data values for Adaptive Bookmarks setting
       
    71 const TInt KBrowserAdaptiveBookmarksSettingDataOn            = 0;
       
    72 const TInt KBrowserAdaptiveBookmarksSettingDataHideFolder    = 1;
       
    73 const TInt KBrowserAdaptiveBookmarksSettingDataOff           = 2;
       
    74 
       
    75 // ========================= MEMBER FUNCTIONS ================================
       
    76 
       
    77 // ----------------------------------------------------------------------------
       
    78 // CBrowserPreferences::ConstructL
       
    79 // ----------------------------------------------------------------------------
       
    80 //
       
    81 void CBrowserPreferences::ConstructL( TBrowserOverriddenSettings* aSettings )
       
    82     {
       
    83     LOG_ENTERFN("CBrowserPreferences::ConstructL");
       
    84     iObservers = new ( ELeave ) CArrayPtrFlat< MPreferencesObserver >( 1 );
       
    85     iCommsModel.ApDb().AddObserverL( this );
       
    86 
       
    87 	iApDH = CApDataHandler::NewLC( iCommsModel.CommsDb() );
       
    88 	CleanupStack::Pop();
       
    89 
       
    90     iVpnEngine = CVpnApEngine::NewLC( &(iCommsModel.CommsDb()) );
       
    91     CleanupStack::Pop();
       
    92 
       
    93  	CRepository* repository = CRepository::NewL( KCRUidBrowserUiLV );
       
    94 
       
    95     if ( repository->Get(
       
    96          KBrowserUiCommonFlags, iEngineLocalFeaturesBitmask ) != KErrNone )
       
    97         {
       
    98         // in case of problems, assume everything is off
       
    99         iEngineLocalFeaturesBitmask = 0;
       
   100         }
       
   101     if ( repository->Get(
       
   102         KBrowserUiCommonFlags, iUiLocalFeaturesBitmask ) != KErrNone )
       
   103         {
       
   104         // in case of problems, assume everything is off
       
   105         iUiLocalFeaturesBitmask = 0;
       
   106         }
       
   107     if ( repository->Get(
       
   108         KBrowserUiCdmaFlags, iCdmaUiLocalFeaturesBitmask ) != KErrNone )
       
   109         {
       
   110         // in case of problems, assume everything is off
       
   111         iCdmaUiLocalFeaturesBitmask = 0;
       
   112         }
       
   113 
       
   114     delete repository;
       
   115 
       
   116     iRepository = CRepository::NewL( KCRUidBrowser );
       
   117 
       
   118     iEmbeddedMode = ApiProvider().IsEmbeddedModeOn(); // EFalse;
       
   119     if( iEmbeddedMode )
       
   120         {
       
   121         // embedded mode doesn't allow multiple windows feature
       
   122         iUiLocalFeaturesBitmask &= ~KBrowserMultipleWindows;
       
   123         }
       
   124     iOverriden = EFalse;
       
   125 
       
   126     SetIntValueL( KBrowserConfirmedDTMFOnce, EFalse );
       
   127 
       
   128     //Read ini values to local variables.
       
   129     TRAP_IGNORE( RestoreSettingsL() );
       
   130 
       
   131     // and overwrite some of them if needed
       
   132     if ( aSettings )
       
   133         {
       
   134         SetOverriddenSettingsL( aSettings );
       
   135         }
       
   136     }
       
   137 
       
   138 // ----------------------------------------------------------------------------
       
   139 // CBrowserPreferences::EngineLocalFeatureSupported
       
   140 // ----------------------------------------------------------------------------
       
   141 //
       
   142 TBool CBrowserPreferences::EngineLocalFeatureSupported( const TInt aFeature ) const
       
   143     {
       
   144 LOG_ENTERFN("CBrowserPreferences::EngineLocalFeatureSupported");
       
   145 BROWSER_LOG( ( _L( "EnginLocalFeatureSupported returns %d" ),
       
   146         (iEngineLocalFeaturesBitmask & aFeature) ) );
       
   147     return (iEngineLocalFeaturesBitmask & aFeature);
       
   148     }
       
   149 
       
   150 // ----------------------------------------------------------------------------
       
   151 // CBrowserPreferences::UiLocalFeatureSupported
       
   152 // ----------------------------------------------------------------------------
       
   153 //
       
   154 TBool CBrowserPreferences::UiLocalFeatureSupported( const TInt aFeature ) const
       
   155     {
       
   156 LOG_ENTERFN("CBrowserPreferences::UiLocalFeatureSupported");
       
   157 BROWSER_LOG( ( _L( "UiLocalFeatureSupported returns %d" ),
       
   158         (iUiLocalFeaturesBitmask & aFeature) ) );
       
   159     return (iUiLocalFeaturesBitmask & aFeature);
       
   160     }
       
   161 
       
   162 
       
   163 
       
   164 
       
   165 // ----------------------------------------------------------------------------
       
   166 // CBrowserPreferences::NewLC
       
   167 // ----------------------------------------------------------------------------
       
   168 //
       
   169 CBrowserPreferences* CBrowserPreferences::NewLC
       
   170     ( MCommsModel& aCommsModel, MApiProvider& aApiProvider , TBrowserOverriddenSettings* aSettings)
       
   171 	{
       
   172 LOG_ENTERFN("CBrowserPreferences::NewLC");
       
   173 	CBrowserPreferences* result;
       
   174 	result = new ( ELeave ) CBrowserPreferences( aCommsModel, aApiProvider );
       
   175 	CleanupStack::PushL( result );
       
   176 	result->ConstructL( aSettings );
       
   177 	return result;
       
   178 	}
       
   179 
       
   180 // ----------------------------------------------------------------------------
       
   181 // CBrowserPreferences::NewL
       
   182 // ----------------------------------------------------------------------------
       
   183 //
       
   184 CBrowserPreferences* CBrowserPreferences::NewL
       
   185 	( MCommsModel& aCommsModel, MApiProvider& aApiProvider, TBrowserOverriddenSettings* aSettings )
       
   186 	{
       
   187 LOG_ENTERFN("CBrowserPreferences::NewL");
       
   188 	CBrowserPreferences* result;
       
   189 	result = CBrowserPreferences::NewLC( aCommsModel, aApiProvider, aSettings );
       
   190 	CleanupStack::Pop();
       
   191 	return result;
       
   192 	}
       
   193 
       
   194 // ----------------------------------------------------------------------------
       
   195 // CBrowserPreferences::CBrowserPreferences
       
   196 // ----------------------------------------------------------------------------
       
   197 //
       
   198 CBrowserPreferences::CBrowserPreferences( MCommsModel& aCommsModel,
       
   199                                             MApiProvider& aApiProvider) :
       
   200     iApiProvider( aApiProvider ),
       
   201     iCommsModel( aCommsModel ),
       
   202     iEmbeddedMode( EFalse )
       
   203     {
       
   204     LOG_ENTERFN("CBrowserPreferences::CBrowserPreferences");
       
   205     iAllPreferences.iCookies = EWmlSettingsCookieAllow;
       
   206     iAllPreferences.iHttpSecurityWarnings = ETrue;
       
   207     iAllPreferences.iDownloadsOpen = ETrue;
       
   208     iAllPreferences.iConnDialogs = ETrue;
       
   209     iAllPreferences.iHomePgURL = NULL;
       
   210     iAllPreferences.iSearchPgURL = NULL;
       
   211     iAllPreferences.iQueryOnExit = EFalse;
       
   212     iAllPreferences.iSendReferrer = EFalse;
       
   213     iAllPreferences.iAssocVpn = KWmlNoDefaultAccessPoint;
       
   214     iAllPreferences.iDefaultAccessPoint = KWmlNoDefaultAccessPoint;
       
   215     iAllPreferences.iDefaultSnapId = KWmlNoDefaultSnapId;
       
   216     iAllPreferences.iDefaultAPDetails = NULL;
       
   217     iAllPreferences.iShortCutFuncHomePg = NULL;
       
   218     iAllPreferences.iShortCutFuncBkMark = NULL;
       
   219     iAllPreferences.iShortCutFuncFindKeyWord = NULL;
       
   220     iAllPreferences.iShortCutFuncPrePage = NULL;
       
   221     iAllPreferences.iShortCutFuncSwitchWin = NULL;
       
   222     iAllPreferences.iShortCutFuncMiniImage = NULL;
       
   223     iAllPreferences.iShortCutFuncFullScreen = NULL;
       
   224     iAllPreferences.iShortCutFuncGoAddr = NULL;
       
   225     iAllPreferences.iShortCutFuncZoomIn = NULL;
       
   226     iAllPreferences.iShortCutFuncZoomOut = NULL;
       
   227     iAllPreferences.iShortCutFuncZoomMode = NULL;
       
   228 	iAllPreferences.iSearch = EFalse;
       
   229     iAllPreferences.iService = EFalse;
       
   230     }
       
   231 
       
   232 // ----------------------------------------------------------------------------
       
   233 // CBrowserPreferences::~CBrowserPreferences
       
   234 // ----------------------------------------------------------------------------
       
   235 //
       
   236 CBrowserPreferences::~CBrowserPreferences()
       
   237     {
       
   238     LOG_ENTERFN("CBrowserPreferences::~CBrowserPreferences");
       
   239     delete iObservers;
       
   240     delete iApDH;
       
   241     delete iVpnEngine;
       
   242     delete iVpnItem;
       
   243     iCommsModel.ApDb().RemoveObserver( this );
       
   244     delete iSelfDownloadContentTypes;
       
   245     iSelfDownloadContentTypes = 0;
       
   246 
       
   247     // All Settings struct - for observers
       
   248     delete iAllPreferences.iSearchPgURL;
       
   249     iAllPreferences.iSearchPgURL = NULL;
       
   250     delete iAllPreferences.iHomePgURL;
       
   251     iAllPreferences.iHomePgURL = NULL;
       
   252 	delete iAllPreferences.iDefaultAPDetails;
       
   253     delete iRepository;
       
   254 
       
   255     // For short cut functions
       
   256     delete iAllPreferences.iShortCutFuncHomePg;
       
   257     iAllPreferences.iShortCutFuncHomePg = NULL;
       
   258 
       
   259     delete iAllPreferences.iShortCutFuncBkMark;
       
   260     iAllPreferences.iShortCutFuncBkMark = NULL;
       
   261 
       
   262     delete iAllPreferences.iShortCutFuncFindKeyWord;
       
   263     iAllPreferences.iShortCutFuncFindKeyWord = NULL;
       
   264 
       
   265     delete iAllPreferences.iShortCutFuncPrePage;
       
   266     iAllPreferences.iShortCutFuncPrePage = NULL;
       
   267 
       
   268     delete iAllPreferences.iShortCutFuncSwitchWin;
       
   269     iAllPreferences.iShortCutFuncSwitchWin = NULL;
       
   270 
       
   271     delete iAllPreferences.iShortCutFuncMiniImage;
       
   272     iAllPreferences.iShortCutFuncMiniImage = NULL;
       
   273 
       
   274     delete iAllPreferences.iShortCutFuncFullScreen;
       
   275     iAllPreferences.iShortCutFuncFullScreen = NULL;
       
   276 
       
   277     delete iAllPreferences.iShortCutFuncGoAddr;
       
   278     iAllPreferences.iShortCutFuncGoAddr = NULL;
       
   279 
       
   280     delete iAllPreferences.iShortCutFuncZoomIn;
       
   281     iAllPreferences.iShortCutFuncZoomIn = NULL;
       
   282 
       
   283     delete iAllPreferences.iShortCutFuncZoomOut;
       
   284     iAllPreferences.iShortCutFuncZoomOut = NULL;
       
   285 
       
   286     delete iAllPreferences.iShortCutFuncZoomMode;
       
   287     iAllPreferences.iShortCutFuncZoomMode = NULL;
       
   288 
       
   289     delete iAllPreferences.iUrlSuffixList;
       
   290     iAllPreferences.iUrlSuffixList = NULL;
       
   291     }
       
   292 
       
   293 // ----------------------------------------------------------------------------
       
   294 // CBrowserPreferences::AddObserverL
       
   295 // ----------------------------------------------------------------------------
       
   296 //
       
   297 void CBrowserPreferences::AddObserverL( MPreferencesObserver* anObserver )
       
   298     {
       
   299     LOG_ENTERFN("CBrowserPreferences::AddObserverL");
       
   300     iObservers->AppendL( anObserver );
       
   301     }
       
   302 
       
   303 // ----------------------------------------------------------------------------
       
   304 // CBrowserPreferences::RemoveObserver
       
   305 // ----------------------------------------------------------------------------
       
   306 //
       
   307 void CBrowserPreferences::RemoveObserver( MPreferencesObserver* anObserver )
       
   308     {
       
   309     LOG_ENTERFN("CBrowserPreferences::RemoveObserver");
       
   310     TInt i( 0 );
       
   311     TInt count = iObservers->Count();
       
   312     for ( i = 0; i < count; i++ )
       
   313         {
       
   314         if ( iObservers->At( i ) == anObserver )
       
   315             {
       
   316             iObservers->Delete( i );
       
   317             break;
       
   318             }
       
   319         }
       
   320     }
       
   321 
       
   322 // ----------------------------------------------------------------------------
       
   323 // CBrowserPreferences::NotifyObserversL
       
   324 // ----------------------------------------------------------------------------
       
   325 //
       
   326 void CBrowserPreferences::NotifyObserversL( TPreferencesEvent aEvent,
       
   327         TBrCtlDefs::TBrCtlSettings aSettingType = TBrCtlDefs::ESettingsUnknown )
       
   328     {
       
   329     LOG_ENTERFN("CBrowserPreferences::NotifyObserversL");
       
   330     TInt i;
       
   331     TInt count = iObservers->Count();
       
   332 
       
   333     // Passed struct of all preferences to observers
       
   334     for ( i = 0; i < count; i++ )
       
   335         {
       
   336         iObservers->At( i )->HandlePreferencesChangeL(
       
   337                                                     aEvent,
       
   338                                                     iAllPreferences,
       
   339                                                     aSettingType );
       
   340         }
       
   341     }
       
   342 
       
   343 // ----------------------------------------------------------------------------
       
   344 // CBrowserPreferences::RestoreSettingsL
       
   345 // ----------------------------------------------------------------------------
       
   346 //
       
   347 void CBrowserPreferences::RestoreSettingsL()
       
   348     {
       
   349     LOG_ENTERFN("CBrowserPreferences::RestoreSettingsL");
       
   350 //
       
   351 //  READ USER VARIATED SETTINGS
       
   352 //
       
   353 
       
   354 	//Read auto load content setting
       
   355     iAllPreferences.iAutoLoadContent = GetIntValue( KBrowserNGImagesEnabled );
       
   356 
       
   357     //Read font size
       
   358     iAllPreferences.iFontSize = GetIntValue( KBrowserNGFontSize );
       
   359 
       
   360 	// Read Allow Cookies setting
       
   361     if ( GetIntValue( KBrowserNGCookiesEnabled ) )
       
   362         {
       
   363         iAllPreferences.iCookies = EWmlSettingsCookieAllow;
       
   364         }
       
   365     else
       
   366         {
       
   367         iAllPreferences.iCookies = EWmlSettingsCookieReject;
       
   368         }
       
   369 
       
   370     // Read ECMA Setting
       
   371     if ( GetIntValue( KBrowserNGECMAScriptSupport ) )
       
   372         {
       
   373         iAllPreferences.iEcma = EWmlSettingsECMAEnable;
       
   374         }
       
   375     else
       
   376         {
       
   377         iAllPreferences.iEcma = EWmlSettingsECMADisable;
       
   378         }
       
   379 
       
   380     // Read IMEI Setting
       
   381     if ( IMEI_NOTIFICATION )
       
   382         {
       
   383         if ( GetIntValue( KBrowserIMEINotification ) )
       
   384             {
       
   385             iAllPreferences.iIMEINotification = EWmlSettingsIMEIEnable;
       
   386             }
       
   387         else
       
   388             {
       
   389             iAllPreferences.iIMEINotification = EWmlSettingsIMEIDisable;
       
   390             }
       
   391         }
       
   392 
       
   393     TInt encoding;
       
   394 	iRepository->Get( KBrowserNGEncoding, encoding );
       
   395     iAllPreferences.iEncoding = ( TUint32 ) encoding;
       
   396 
       
   397     iAllPreferences.iScriptLog = GetIntValue( KBrowserNGScriptLog ) ;
       
   398 
       
   399     //Read Fullscreen setting
       
   400     TInt value;
       
   401     value = GetIntValue ( KBrowserNGFullScreen );
       
   402 
       
   403     switch ( value )
       
   404         {
       
   405         case KBrowserFullScreenSettingDataSoftkeysOff:
       
   406         	{
       
   407             iAllPreferences.iFullScreen = EWmlSettingsFullScreenFullScreen;
       
   408             break;
       
   409         	}
       
   410 
       
   411         case KBrowserFullScreenSettingDataSoftkeysOn:
       
   412             {
       
   413             iAllPreferences.iFullScreen = EWmlSettingsFullScreenSoftkeysOnly;
       
   414             break;
       
   415             }
       
   416 
       
   417         default:
       
   418             {
       
   419             break;
       
   420             }
       
   421         }
       
   422 
       
   423 	  iAllPreferences.iSendReferrer = (TBool) GetIntValue( KBrowserSendReferrerHeader );
       
   424 
       
   425 
       
   426     //Read adaptive bookmarks setting
       
   427     if (ADAPTIVEBOOKMARKS)
       
   428         {
       
   429         TInt adBm;
       
   430         adBm = GetIntValue ( KBrowserNGAdaptiveBookmarks );
       
   431 
       
   432         switch(adBm)
       
   433             {
       
   434             case (KBrowserAdaptiveBookmarksSettingDataOn):
       
   435                 {
       
   436                 iAllPreferences.iAdaptiveBookmarks =
       
   437                                             EWmlSettingsAdaptiveBookmarksOn;
       
   438                 break;
       
   439                 }
       
   440             case (KBrowserAdaptiveBookmarksSettingDataHideFolder):
       
   441                 {
       
   442                 iAllPreferences.iAdaptiveBookmarks =
       
   443                                     EWmlSettingsAdaptiveBookmarksHideFolder;
       
   444                 break;
       
   445                 }
       
   446             case (KBrowserAdaptiveBookmarksSettingDataOff):
       
   447                 {
       
   448                 iAllPreferences.iAdaptiveBookmarks =
       
   449                                     EWmlSettingsAdaptiveBookmarksOff;
       
   450                 break;
       
   451                 }
       
   452             default:
       
   453                 {
       
   454                 break;
       
   455                 }
       
   456             }
       
   457         }
       
   458 
       
   459 //
       
   460 //  READ OPERATOR VARIATED SETTINGS
       
   461 //
       
   462 
       
   463 	iAllPreferences.iHomePgType =
       
   464                 ( TWmlSettingsHomePage ) GetIntValue( KBrowserNGHomepageType );
       
   465     iAllPreferences.iPageOverview = GetIntValue (
       
   466 		                                    KBrowserNGPageOverview );
       
   467 	iAllPreferences.iBackList = GetIntValue (
       
   468 		                                    KBrowserNGBackList );
       
   469 	iAllPreferences.iAutoRefresh = GetIntValue (
       
   470 		                                    KBrowserNGAutoRefresh );
       
   471 
       
   472     if(PROGRESSIVE_DOWNLOAD)
       
   473 	    {
       
   474     	iAllPreferences.iDownloadsOpen = GetIntValue ( KBrowserNGOpenDownloads );
       
   475     	}
       
   476     else
       
   477     	{
       
   478     	iAllPreferences.iDownloadsOpen = EFalse;
       
   479     	}
       
   480 
       
   481     //Read suppress security UI setting
       
   482     iAllPreferences.iHTTPSecuritySupressed = GetIntValue ( KBrowserSecurityUI );
       
   483 
       
   484     //Read show connection queries setting
       
   485     iAllPreferences.iConnDialogs = GetIntValue( KBrowserConnectionDialogs );
       
   486 
       
   487     if( !iAllPreferences.iHTTPSecuritySupressed )
       
   488         {
       
   489         // Read HTTP security warnings setting
       
   490 	    iAllPreferences.iHttpSecurityWarnings = GetIntValue (
       
   491 		                            KBrowserNGShowSecurityWarnings );
       
   492         }
       
   493     else
       
   494         {
       
   495         //we don't want to see sec warning because they're supressed
       
   496         iAllPreferences.iHttpSecurityWarnings = EFalse;
       
   497         }
       
   498 
       
   499     // Media Volume uses different SD ini. Revert to Browser SD ini after use
       
   500     iAllPreferences.iMediaVolume = GetIntValue( KBrowserMediaVolumeControl );
       
   501 
       
   502     // Pop up Blocking
       
   503     iAllPreferences.iPopupBlocking = GetIntValue( KBrowserNGPopupBlocking );
       
   504 
       
   505     // Form Data Saving
       
   506     iAllPreferences.iFormDataSaving = (TWmlSettingsFormData) GetIntValue( KBrowserFormDataSaving );
       
   507 
       
   508     // Access Keys
       
   509     iAllPreferences.iAccessKeys = (TBool) GetIntValue( KBrowserNGAccessKeys );
       
   510 
       
   511     // The leaving functions come at the end
       
   512 
       
   513     // Search Page
       
   514     if ( iAllPreferences.iSearchPgURL )
       
   515         {
       
   516         delete iAllPreferences.iSearchPgURL;
       
   517         iAllPreferences.iSearchPgURL = NULL;
       
   518         }
       
   519 
       
   520     // Web reed feeds settings - begin
       
   521     iAllPreferences.iAutomaticUpdatingAP = GetIntValue( KBrowserNGAutomaticUpdatingAccessPoint );
       
   522 
       
   523     iAllPreferences.iAutomaticUpdatingWhileRoaming = GetIntValue( KBrowserNGAutomaticUpdatingWhileRoaming );
       
   524 
       
   525     // Web reed feeds settings - end
       
   526     if (CBrowserAppUi::Static()->OrientationCanBeChanged() )
       
   527         {
       
   528         iAllPreferences.iRotateDisplay = GetIntValue( KBrowserNGRotateDisplay );
       
   529         }
       
   530     else
       
   531         {
       
   532         iAllPreferences.iRotateDisplay = 0;
       
   533         }
       
   534       if ( iAllPreferences.iUrlSuffixList )
       
   535         {
       
   536         delete iAllPreferences.iUrlSuffixList;
       
   537         iAllPreferences.iUrlSuffixList = NULL;
       
   538         }
       
   539     iAllPreferences.iUrlSuffixList = HBufC::NewL( KUrlSuffixMaxLength );
       
   540     TPtr suffix = iAllPreferences.iUrlSuffixList->Des();
       
   541     GetStringValueL( KBrowserUrlSuffix, KBrowserUrlSuffix, suffix );
       
   542 
       
   543     // If something fails for an option, the default value will be used
       
   544     TInt ap;
       
   545 
       
   546     // Read Accesss point selection mode for advanced settings
       
   547     const TInt selectionMode = GetIntValue( KBrowserAccessPointSelectionMode );
       
   548     switch ( selectionMode )
       
   549         {
       
   550         case EBrowserCenRepApSelModeUserDefined:
       
   551              {
       
   552              iAllPreferences.iAccessPointSelectionMode = EConnectionMethod;
       
   553              break;
       
   554              }
       
   555         case EBrowserCenRepApSelModeAlwaysAsk:
       
   556              {
       
   557              iAllPreferences.iAccessPointSelectionMode = EAlwaysAsk;
       
   558              break;
       
   559              }
       
   560         case EBrowserCenRepApSelModeDestination:
       
   561              {
       
   562              iAllPreferences.iAccessPointSelectionMode = EDestination;
       
   563              break;
       
   564              }
       
   565         default: // Default to Always ask.
       
   566              {
       
   567              iAllPreferences.iAccessPointSelectionMode = EAlwaysAsk;
       
   568              break;
       
   569              }
       
   570         }
       
   571 
       
   572     //we differentiate by connecting with a Snap or an access point
       
   573    if (iAllPreferences.iAccessPointSelectionMode == EConnectionMethod)
       
   574    	    {
       
   575         //Read default AP setting
       
   576         ap = GetIntValue( KBrowserDefaultAccessPoint );
       
   577 
       
   578         SetDefaultAccessPointL( ap );
       
   579 		}
       
   580     else if (iAllPreferences.iAccessPointSelectionMode == EDestination)
       
   581 		{
       
   582    		iAllPreferences.iDefaultSnapId = GetIntValue( KBrowserNGDefaultSnapId );
       
   583 		}
       
   584 
       
   585     // For Short Cut keys
       
   586     if ( iAllPreferences.iShortCutFuncHomePg )
       
   587         {
       
   588         delete iAllPreferences.iShortCutFuncHomePg;
       
   589         iAllPreferences.iShortCutFuncHomePg = NULL;
       
   590         }
       
   591     iAllPreferences.iShortCutFuncHomePg = HBufC::NewL( KShortCutFuncStringLength );
       
   592     TPtr func1 = iAllPreferences.iShortCutFuncHomePg->Des();
       
   593     GetStringValueL( KBrowserNGShortCutFuncHomePg, KShortCutFuncStringLength, func1 );
       
   594 
       
   595     if ( iAllPreferences.iShortCutFuncBkMark )
       
   596         {
       
   597         delete iAllPreferences.iShortCutFuncBkMark;
       
   598         iAllPreferences.iShortCutFuncBkMark = NULL;
       
   599         }
       
   600     iAllPreferences.iShortCutFuncBkMark = HBufC::NewL( KShortCutFuncStringLength );
       
   601     TPtr func2 = iAllPreferences.iShortCutFuncBkMark->Des();
       
   602     GetStringValueL( KBrowserNGShortCutFuncBkMark, KShortCutFuncStringLength, func2 );
       
   603 
       
   604     if ( iAllPreferences.iShortCutFuncFindKeyWord )
       
   605         {
       
   606         delete iAllPreferences.iShortCutFuncFindKeyWord;
       
   607         iAllPreferences.iShortCutFuncFindKeyWord = NULL;
       
   608         }
       
   609     iAllPreferences.iShortCutFuncFindKeyWord = HBufC::NewL( KShortCutFuncStringLength );
       
   610     TPtr func3 = iAllPreferences.iShortCutFuncFindKeyWord->Des();
       
   611     GetStringValueL( KBrowserNGShortCutFuncFindKeyWord, KShortCutFuncStringLength, func3 );
       
   612 
       
   613     if ( iAllPreferences.iShortCutFuncPrePage )
       
   614         {
       
   615         delete iAllPreferences.iShortCutFuncPrePage;
       
   616         iAllPreferences.iShortCutFuncPrePage = NULL;
       
   617         }
       
   618     iAllPreferences.iShortCutFuncPrePage = HBufC::NewL( KShortCutFuncStringLength );
       
   619     TPtr func4 = iAllPreferences.iShortCutFuncPrePage->Des();
       
   620     GetStringValueL( KBrowserNGShortCutFuncPrePage, KShortCutFuncStringLength, func4 );
       
   621 
       
   622     if ( iAllPreferences.iShortCutFuncSwitchWin )
       
   623         {
       
   624         delete iAllPreferences.iShortCutFuncSwitchWin;
       
   625         iAllPreferences.iShortCutFuncSwitchWin = NULL;
       
   626         }
       
   627     iAllPreferences.iShortCutFuncSwitchWin = HBufC::NewL( KShortCutFuncStringLength );
       
   628     TPtr func5 = iAllPreferences.iShortCutFuncSwitchWin->Des();
       
   629     GetStringValueL( KBrowserNGShortCutFuncSwitchWin, KShortCutFuncStringLength, func5 );
       
   630 
       
   631     if ( iAllPreferences.iShortCutFuncMiniImage )
       
   632         {
       
   633         delete iAllPreferences.iShortCutFuncMiniImage;
       
   634         iAllPreferences.iShortCutFuncMiniImage = NULL;
       
   635         }
       
   636     iAllPreferences.iShortCutFuncMiniImage = HBufC::NewL( KShortCutFuncStringLength );
       
   637     TPtr func6 = iAllPreferences.iShortCutFuncMiniImage->Des();
       
   638     GetStringValueL( KBrowserNGShortCutFuncMiniImage, KShortCutFuncStringLength, func6 );
       
   639 
       
   640     if ( iAllPreferences.iShortCutFuncGoAddr )
       
   641         {
       
   642         delete iAllPreferences.iShortCutFuncGoAddr;
       
   643         iAllPreferences.iShortCutFuncGoAddr = NULL;
       
   644         }
       
   645     iAllPreferences.iShortCutFuncGoAddr = HBufC::NewL( KShortCutFuncStringLength );
       
   646     TPtr func7 = iAllPreferences.iShortCutFuncGoAddr->Des();
       
   647     GetStringValueL( KBrowserNGShortCutFuncGoAddr, KShortCutFuncStringLength, func7 );
       
   648 
       
   649     if ( iAllPreferences.iShortCutFuncZoomIn )
       
   650         {
       
   651         delete iAllPreferences.iShortCutFuncZoomIn;
       
   652         iAllPreferences.iShortCutFuncZoomIn = NULL;
       
   653         }
       
   654     iAllPreferences.iShortCutFuncZoomIn = HBufC::NewL( KShortCutFuncStringLength );
       
   655     TPtr func8 = iAllPreferences.iShortCutFuncZoomIn->Des();
       
   656     GetStringValueL( KBrowserNGShortCutFuncZoomIn, KShortCutFuncStringLength, func8 );
       
   657 
       
   658     if ( iAllPreferences.iShortCutFuncZoomOut )
       
   659         {
       
   660         delete iAllPreferences.iShortCutFuncZoomOut;
       
   661         iAllPreferences.iShortCutFuncZoomOut = NULL;
       
   662         }
       
   663     iAllPreferences.iShortCutFuncZoomOut = HBufC::NewL( KShortCutFuncStringLength );
       
   664     TPtr func9 = iAllPreferences.iShortCutFuncZoomOut->Des();
       
   665     GetStringValueL( KBrowserNGShortCutFuncZoomOut, KShortCutFuncStringLength, func9 );
       
   666 
       
   667 /*
       
   668     if ( iAllPreferences.iShortCutFuncZoomMode )
       
   669         {
       
   670         delete iAllPreferences.iShortCutFuncZoomMode;
       
   671         iAllPreferences.iShortCutFuncZoomMode = NULL;
       
   672         }
       
   673     iAllPreferences.iShortCutFuncZoomMode = HBufC::NewL( KShortCutFuncStringLength );
       
   674     TPtr func11 = iAllPreferences.iShortCutFuncZoomMode->Des();
       
   675     GetStringValueL( KBrowserNGShortCutFuncZoomMode, KShortCutFuncStringLength, func11 );
       
   676 */
       
   677 
       
   678     if ( iAllPreferences.iShortCutFuncFullScreen )
       
   679         {
       
   680         delete iAllPreferences.iShortCutFuncFullScreen;
       
   681         iAllPreferences.iShortCutFuncFullScreen = NULL;
       
   682         }
       
   683     iAllPreferences.iShortCutFuncFullScreen = HBufC::NewL( KShortCutFuncStringLength );
       
   684     TPtr func10 = iAllPreferences.iShortCutFuncFullScreen->Des();
       
   685     GetStringValueL( KBrowserNGShortCutFuncFullScreen, KShortCutFuncStringLength, func10 );
       
   686 
       
   687     // For Configuring Toolbar Buttons
       
   688     iAllPreferences.iToolbarOnOff       = GetIntValue( KToolbarOnOff );
       
   689 
       
   690     iAllPreferences.iToolbarButton1Cmd  = GetIntValue( KToolbarButton1Cmd );
       
   691     iAllPreferences.iToolbarButton2Cmd  = GetIntValue( KToolbarButton2Cmd );
       
   692     iAllPreferences.iToolbarButton3Cmd  = GetIntValue( KToolbarButton3Cmd );
       
   693     iAllPreferences.iToolbarButton4Cmd  = GetIntValue( KToolbarButton4Cmd );
       
   694     iAllPreferences.iToolbarButton5Cmd  = GetIntValue( KToolbarButton5Cmd );
       
   695     iAllPreferences.iToolbarButton6Cmd  = GetIntValue( KToolbarButton6Cmd );
       
   696     iAllPreferences.iToolbarButton7Cmd  = GetIntValue( KToolbarButton7Cmd );
       
   697 
       
   698     // For configuring Shortcut Keys
       
   699     iAllPreferences.iShortcutKeysForQwerty  = GetIntValue( KShortcutKeysForQwerty );
       
   700 
       
   701     iAllPreferences.iShortcutKey1Cmd  = GetIntValue( KShortcutKey1Cmd );
       
   702     iAllPreferences.iShortcutKey2Cmd  = GetIntValue( KShortcutKey2Cmd );
       
   703     iAllPreferences.iShortcutKey3Cmd  = GetIntValue( KShortcutKey3Cmd );
       
   704     iAllPreferences.iShortcutKey4Cmd  = GetIntValue( KShortcutKey4Cmd );
       
   705     iAllPreferences.iShortcutKey5Cmd  = GetIntValue( KShortcutKey5Cmd );
       
   706     iAllPreferences.iShortcutKey6Cmd  = GetIntValue( KShortcutKey6Cmd );
       
   707     iAllPreferences.iShortcutKey7Cmd  = GetIntValue( KShortcutKey7Cmd );
       
   708     iAllPreferences.iShortcutKey8Cmd  = GetIntValue( KShortcutKey8Cmd );
       
   709     iAllPreferences.iShortcutKey9Cmd  = GetIntValue( KShortcutKey9Cmd );
       
   710     iAllPreferences.iShortcutKey0Cmd  = GetIntValue( KShortcutKey0Cmd );
       
   711     iAllPreferences.iShortcutKeyStarCmd  = GetIntValue( KShortcutKeyStarCmd );
       
   712     iAllPreferences.iShortcutKeyHashCmd  = GetIntValue( KShortcutKeyHashCmd );
       
   713 
       
   714 
       
   715     iAllPreferences.iZoomLevelMin = GetIntValue( KBrowserNGZoomMin );
       
   716     iAllPreferences.iZoomLevelMax = GetIntValue( KBrowserNGZoomMax );
       
   717     iAllPreferences.iZoomLevelDefault = GetIntValue( KBrowserNGZoomDefault );
       
   718 
       
   719     iAllPreferences.iMaxRecentUrlsToShow = GetIntValue( KBrowserNGMaxRecentUrls );
       
   720 
       
   721     iAllPreferences.iSearch = GetIntValue( KBrowserSearch );
       
   722     iAllPreferences.iService = GetIntValue( KBrowserServices );
       
   723     iAllPreferences.iCursorShowMode = (TBrCtlDefs::TCursorSettings)GetIntValue( KBrowserCursorShowMode );
       
   724     iAllPreferences.iEnterKeyMode = (TBrCtlDefs::TEnterKeySettings)GetIntValue( KBrowserEnterKeyMode );
       
   725     }
       
   726 
       
   727 
       
   728 // ----------------------------------------------------------------------------
       
   729 // CBrowserPreferences::AllPreferencesL
       
   730 // ----------------------------------------------------------------------------
       
   731 //
       
   732 const TPreferencesValues& CBrowserPreferences::AllPreferencesL()
       
   733     {
       
   734     return iAllPreferences;
       
   735     }
       
   736 
       
   737 // ----------------------------------------------------------------------------
       
   738 // CBrowserPreferences::VpnDataL
       
   739 // ----------------------------------------------------------------------------
       
   740 //
       
   741 TBool CBrowserPreferences::VpnDataL( TUint aDefaultAccessPoint, CVpnApItem& aVpnItem )
       
   742     {
       
   743     TBool ret( EFalse );
       
   744 
       
   745     if( iVpnEngine->IsVpnApL( aDefaultAccessPoint ) )
       
   746         {
       
   747         iVpnEngine->VpnDataL( aDefaultAccessPoint, aVpnItem );
       
   748         ret = ETrue;
       
   749         }
       
   750 
       
   751     return ret;
       
   752     }
       
   753 
       
   754 // ----------------------------------------------------------------------------
       
   755 // CBrowserPreferences::SetDefaultAccessPointL
       
   756 // ----------------------------------------------------------------------------
       
   757 //
       
   758 void CBrowserPreferences::SetDefaultAccessPointL( TUint aDefaultAccessPoint, TUint aAssocVpn )
       
   759 	{
       
   760     LOG_ENTERFN("CBrowserPreferences::SetDefaultAccessPointL");
       
   761 	BROWSER_LOG( ( _L( " aDefaultAccessPoint: %u" ), aDefaultAccessPoint ) );
       
   762 
       
   763     //get the connection identifier based on the connection type
       
   764     switch ( AccessPointSelectionMode() )
       
   765         {
       
   766         //get the destination identifyer based on the snap Id
       
   767         case EDestination:
       
   768         	{
       
   769 		    RCmManager        cmManager;
       
   770 		    cmManager.OpenL();
       
   771 
       
   772             // if user-defined destination then check that destination still exists.
       
   773             // if it doesn't, reset access point to always ask and homepage to blank access point home page.
       
   774             TUint snapId = iAllPreferences.iDefaultSnapId;
       
   775             if (snapId != KWmlNoDefaultSnapId)
       
   776                 {
       
   777     			TRAPD(err, RCmDestination dest = cmManager.DestinationL( snapId ));
       
   778     			if (err != KErrNone)
       
   779     			    {
       
   780     			    aDefaultAccessPoint = KWmlNoDefaultAccessPoint;
       
   781         	    	aAssocVpn = KWmlNoDefaultAccessPoint;
       
   782 
       
   783         			SetAccessPointSelectionModeL(EAlwaysAsk );
       
   784         			if (iAllPreferences.iHomePgType == EWmlSettingsHomePageAccessPoint)
       
   785         				{
       
   786         				HBufC* buf = HBufC::NewLC( KMaxHomePgUrlLength );  // cleanupstack
       
   787             			TPtr ptr( buf->Des() );
       
   788             			// read user defined home page from SD shouldn't get any error
       
   789                         HomePageUrlL( ptr, ETrue );
       
   790                         SetHomePageUrlL(ptr);
       
   791             			CleanupStack::PopAndDestroy( buf );
       
   792         				}
       
   793     			    }
       
   794                 }
       
   795  		    cmManager.Close();
       
   796 
       
   797 			break;
       
   798         	}
       
   799 
       
   800         //if connecting with Iap Id
       
   801         case EConnectionMethod:
       
   802             {
       
   803             // if user-defined access point then check that access point still exists.
       
   804             // if it doesn't, reset access point to always ask and homepage to blank access point home page.
       
   805   	        CApListItem* apItem = iCommsModel.AccessPointsL()->ItemForUid( aDefaultAccessPoint );
       
   806 	        if (apItem == NULL)
       
   807                 {
       
   808                 TBool isVpn = EFalse;
       
   809                 TRAPD(leaveCode, isVpn = iVpnEngine->IsVpnApL( aDefaultAccessPoint ))
       
   810                 if ( leaveCode == KErrNone )
       
   811                 {
       
   812                     if ( isVpn )
       
   813                         {
       
   814                         BROWSER_LOG( ( _L( " This is VPN AP which has a snap in it" ) ) );
       
   815                         break;
       
   816                         }
       
   817                 }
       
   818     	    	aDefaultAccessPoint = KWmlNoDefaultAccessPoint;
       
   819     	    	aAssocVpn = KWmlNoDefaultAccessPoint;
       
   820     	    	delete iAllPreferences.iDefaultAPDetails;
       
   821     			iAllPreferences.iDefaultAPDetails = NULL;
       
   822     			SetAccessPointSelectionModeL(EAlwaysAsk );
       
   823     			if (iAllPreferences.iHomePgType == EWmlSettingsHomePageAccessPoint)
       
   824     				{
       
   825     				HBufC* buf = HBufC::NewLC( KMaxHomePgUrlLength );  // cleanupstack
       
   826         			TPtr ptr( buf->Des() );
       
   827         			// read user defined home page from SD shouldn't get any error
       
   828                     HomePageUrlL( ptr, ETrue );
       
   829                     SetHomePageUrlL(ptr);
       
   830         			CleanupStack::PopAndDestroy( buf );
       
   831     				}
       
   832 		    	}
       
   833 
       
   834 		    break;
       
   835         	}
       
   836 
       
   837         default:
       
   838         	{
       
   839         	break;
       
   840         	}
       
   841         }
       
   842 
       
   843 
       
   844 	// check web feeds for deleted access point
       
   845 	CApListItem* apItem = iCommsModel.AccessPointsL()->ItemForUid( iAllPreferences.iAutomaticUpdatingAP );
       
   846 	if (apItem == NULL)
       
   847 		{
       
   848         SetAutomaticUpdatingApL( KWmlNoDefaultAccessPoint );
       
   849 		}
       
   850     bool checkAPMode = ( (iAllPreferences.iAccessPointSelectionMode != EDestination) && (iAllPreferences.iAccessPointSelectionMode != EAlwaysAsk) );
       
   851     if( ( KWmlNoDefaultAccessPoint != aDefaultAccessPoint ) && ( checkAPMode ) && iVpnEngine->IsVpnApL( aDefaultAccessPoint ) )
       
   852         {
       
   853         delete iVpnItem;
       
   854         iVpnItem = NULL;
       
   855 
       
   856         iVpnItem = CVpnApItem::NewLC();
       
   857         CleanupStack::Pop();
       
   858 
       
   859         iVpnEngine->VpnDataL( aDefaultAccessPoint, *iVpnItem );
       
   860 
       
   861         TUint32 ass( aDefaultAccessPoint );
       
   862         iVpnItem->ReadUint( EApVpnWapAccessPointID, ass );
       
   863         aAssocVpn = ass;
       
   864 
       
   865         // get real WAP id
       
   866         TUint32 ap( aDefaultAccessPoint );
       
   867         iVpnItem->ReadUint( EApVpnRealWapID, ap );
       
   868         aDefaultAccessPoint = ap;
       
   869         }
       
   870     BROWSER_LOG( ( _L( "VPN OK" ) ) );
       
   871 	iAllPreferences.iDefaultAccessPoint = aDefaultAccessPoint;
       
   872 	iAllPreferences.iAssocVpn = aAssocVpn;
       
   873 
       
   874 	CApAccessPointItem* api = CApAccessPointItem::NewLC();//maybe we can optimise this too
       
   875 	BROWSER_LOG( ( _L( "CApAccessPointItem OK" ) ) );
       
   876     TInt err;
       
   877     if  ( iOverridenSettings )
       
   878         {
       
   879         iCustomAp = iOverridenSettings->GetBrowserSetting(
       
   880                                                 EBrowserOverSettingsCustomAp );
       
   881         }
       
   882     if ( ( iOverridenSettings ) &&  iCustomAp  )
       
   883         {
       
   884 	    TRAP( err, iApDH->AccessPointDataL( iCustomAp, *api ) );
       
   885         if ( err != KErrNone )
       
   886             {
       
   887             iCustomAp = 0;
       
   888 	        TRAP( err, iApDH->AccessPointDataL( iAllPreferences.iDefaultAccessPoint, *api ) );
       
   889             }
       
   890         }
       
   891     else
       
   892         {
       
   893 	    TRAP( err, iApDH->AccessPointDataL(
       
   894 	                            iAllPreferences.iDefaultAccessPoint, *api ) );
       
   895         }
       
   896     BROWSER_LOG( ( _L( " AccessPointDataL: %d" ), err ) );
       
   897 	//Reset default AP pointer and delete the data
       
   898 	delete iAllPreferences.iDefaultAPDetails;
       
   899 	iAllPreferences.iDefaultAPDetails = NULL;
       
   900 	if  ( err != KErrNone )//Let's select the first
       
   901 		{
       
   902 #ifndef __WINSCW__ //we will not select on Wins (defaultap will be assigned a uid indicating that there is
       
   903 					//no default ap) but rather let ConnMan show the Conn Dlg
       
   904 		// The first valid access point has to be selected if exists
       
   905 		LOG_WRITE("WE SHOULD NOT BE HERE!!!");
       
   906 		CApSelect* apSelect = CApSelect::NewLC
       
   907 			(
       
   908 			iCommsModel.CommsDb(),
       
   909 			KEApIspTypeAll, //KEApIspTypeWAPMandatory,
       
   910 			EApBearerTypeAll,
       
   911 			KEApSortNameAscending,
       
   912 			EIPv4 | EIPv6
       
   913 			);
       
   914 		if ( apSelect->MoveToFirst() )
       
   915 			{
       
   916 			iAllPreferences.iDefaultAccessPoint = apSelect->Uid();
       
   917 			iApDH->AccessPointDataL( iAllPreferences.iDefaultAccessPoint, *api );
       
   918 			iAllPreferences.iDefaultAPDetails = api;//save the ap details
       
   919 			}
       
   920 		else
       
   921 			{
       
   922 			iAllPreferences.iDefaultAccessPoint = KWmlNoDefaultAccessPoint;
       
   923 			iAllPreferences.iDefaultAPDetails = NULL;
       
   924 			delete api;
       
   925 			}
       
   926 		CleanupStack::PopAndDestroy(); // apSelect
       
   927 		CleanupStack::Pop();//api
       
   928 #else
       
   929 		iAllPreferences.iDefaultAccessPoint = KWmlNoDefaultAccessPoint;
       
   930 		iAllPreferences.iDefaultAPDetails = NULL;
       
   931 		CleanupStack::PopAndDestroy( api );
       
   932 #endif//WINSCW
       
   933 		}
       
   934 	else
       
   935 		{
       
   936 		iAllPreferences.iDefaultAPDetails = api;//store new default accesspoint details
       
   937 		CleanupStack::Pop( ); // api
       
   938 		}
       
   939 	/*
       
   940 	* If VPN set VPN AP ID to default access point!
       
   941 	*/
       
   942 	if( KWmlNoDefaultAccessPoint != iAllPreferences.iAssocVpn )
       
   943 	    {
       
   944 	    iAllPreferences.iDefaultAccessPoint = iAllPreferences.iAssocVpn;
       
   945 	    }
       
   946     if( !iEmbeddedMode )
       
   947         {
       
   948 	    //Store ini value / gateway
       
   949         SetIntValueL ( KBrowserDefaultAccessPoint,
       
   950                                         iAllPreferences.iDefaultAccessPoint );
       
   951         }
       
   952     NotifyObserversL( EPreferencesItemChange );
       
   953 
       
   954 	//  LOG_LEAVEFN("CBrowserPreferences::SetDefaultAccessPointL");
       
   955 	}
       
   956 
       
   957 
       
   958 // ----------------------------------------------------------------------------
       
   959 // CBrowserPreferences::SetDefaultSnapId: DestNetChange
       
   960 // ----------------------------------------------------------------------------
       
   961 //
       
   962  void CBrowserPreferences::SetDefaultSnapId (TUint aSnapId)
       
   963 		{
       
   964 
       
   965 		//storing the value of the default snap ID
       
   966 		iAllPreferences.iDefaultSnapId = aSnapId;
       
   967 
       
   968         SetIntValueL ( KBrowserNGDefaultSnapId,
       
   969                                         iAllPreferences.iDefaultSnapId );
       
   970 
       
   971 		}
       
   972 
       
   973 
       
   974 // ----------------------------------------------------------------------------
       
   975 // CBrowserPreferences::SetAutoLoadContentL
       
   976 // ----------------------------------------------------------------------------
       
   977 //
       
   978 void CBrowserPreferences::SetAutoLoadContentL( TInt aAutoLoadContent )
       
   979     {
       
   980     LOG_ENTERFN("CBrowserPreferences::SetAutoLoadContentL");
       
   981     if ( aAutoLoadContent != iAllPreferences.iAutoLoadContent )
       
   982         {
       
   983         iAllPreferences.iAutoLoadContent = aAutoLoadContent;
       
   984 
       
   985         // Store value in Shared Data and forward new setting to BrCtl
       
   986         if( !iEmbeddedMode )
       
   987             {
       
   988             SetIntValueL( KBrowserNGImagesEnabled,
       
   989                                     iAllPreferences.iAutoLoadContent );
       
   990             }
       
   991         NotifyObserversL( EPreferencesItemChange,
       
   992                                         TBrCtlDefs::ESettingsAutoLoadImages );
       
   993         }
       
   994     }
       
   995 
       
   996 // ----------------------------------------------------------------------------
       
   997 // CBrowserPreferences::SetPageOverviewL
       
   998 // ----------------------------------------------------------------------------
       
   999 //
       
  1000 void CBrowserPreferences::SetPageOverviewL( TBool aPageOverview )
       
  1001     {
       
  1002     LOG_ENTERFN("CBrowserPreferences::SetPageOverviewL");
       
  1003     if ( aPageOverview != iAllPreferences.iPageOverview )
       
  1004         {
       
  1005         iAllPreferences.iPageOverview = aPageOverview;
       
  1006 
       
  1007         // Store value in Shared Data and forward new setting to BrCtl
       
  1008         if( !iEmbeddedMode )
       
  1009             {
       
  1010             SetIntValueL( KBrowserNGPageOverview,
       
  1011                                         iAllPreferences.iPageOverview );
       
  1012             }
       
  1013         NotifyObserversL( EPreferencesItemChange,
       
  1014                             TBrCtlDefs::ESettingsPageOverview);
       
  1015         }
       
  1016     }
       
  1017 
       
  1018 // ----------------------------------------------------------------------------
       
  1019 // CBrowserPreferences::SetBackListL
       
  1020 // ----------------------------------------------------------------------------
       
  1021 //
       
  1022 void CBrowserPreferences::SetBackListL( TBool aBackList )
       
  1023     {
       
  1024     LOG_ENTERFN("CBrowserPreferences::SetBackListL");
       
  1025     if ( aBackList != iAllPreferences.iBackList )
       
  1026         {
       
  1027         iAllPreferences.iBackList = aBackList;
       
  1028 
       
  1029         // Store value in Shared Data and forward new setting to BrCtl
       
  1030         if( !iEmbeddedMode )
       
  1031             {
       
  1032             SetIntValueL( KBrowserNGBackList,
       
  1033                                         iAllPreferences.iBackList );
       
  1034             }
       
  1035         NotifyObserversL( EPreferencesItemChange,
       
  1036                             TBrCtlDefs::ESettingsBackList);
       
  1037         }
       
  1038     }
       
  1039 
       
  1040 // ----------------------------------------------------------------------------
       
  1041 // CBrowserPreferences::SetAutoRefreshL
       
  1042 // ----------------------------------------------------------------------------
       
  1043 //
       
  1044 void CBrowserPreferences::SetAutoRefreshL( TBool aAutoRefresh )
       
  1045     {
       
  1046     LOG_ENTERFN("CBrowserPreferences::SetAutoRefreshL");
       
  1047     if ( aAutoRefresh != iAllPreferences.iAutoRefresh )
       
  1048         {
       
  1049         iAllPreferences.iAutoRefresh = aAutoRefresh;
       
  1050 
       
  1051         // Store value in Shared Data and forward new setting to BrCtl
       
  1052         if( !iEmbeddedMode )
       
  1053             {
       
  1054             SetIntValueL( KBrowserNGAutoRefresh,
       
  1055                                         iAllPreferences.iAutoRefresh );
       
  1056             }
       
  1057         NotifyObserversL( EPreferencesItemChange,
       
  1058                             TBrCtlDefs::ESettingsAutoRefresh);
       
  1059         }
       
  1060     }
       
  1061 
       
  1062 // ----------------------------------------------------------------------------
       
  1063 // CBrowserPreferences::SetTextWrapL
       
  1064 // ----------------------------------------------------------------------------
       
  1065 //
       
  1066 void CBrowserPreferences::SetTextWrapL( TBool aTextWrap )
       
  1067     {
       
  1068     LOG_ENTERFN("CBrowserPreferences::SetTextWrapL");
       
  1069     if ( aTextWrap != iAllPreferences.iTextWrap )
       
  1070         {
       
  1071         iAllPreferences.iTextWrap = aTextWrap;
       
  1072 
       
  1073         // Store value in Shared Data and forward new setting to BrCtl
       
  1074         if ( !iEmbeddedMode )
       
  1075             {
       
  1076             SetIntValueL( KBrowserTextWrapEnabled, iAllPreferences.iTextWrap );
       
  1077             }
       
  1078         NotifyObserversL( EPreferencesItemChange,
       
  1079                                         TBrCtlDefs::ESettingsTextWrapEnabled );
       
  1080         }
       
  1081     }
       
  1082 
       
  1083 // ----------------------------------------------------------------------------
       
  1084 // CBrowserPreferences::SetFontSizeL
       
  1085 // ----------------------------------------------------------------------------
       
  1086 //
       
  1087 void CBrowserPreferences::SetFontSizeL( TInt aFontSize )
       
  1088     {
       
  1089     LOG_ENTERFN("CBrowserPreferences::SetFontSizeL");
       
  1090     if ( aFontSize != iAllPreferences.iFontSize )
       
  1091         {
       
  1092         iAllPreferences.iFontSize = aFontSize;
       
  1093 
       
  1094         // Store value in Shared Data and forward new setting to BrCtl
       
  1095         if( !iEmbeddedMode )
       
  1096             {
       
  1097             SetIntValueL( KBrowserNGFontSize, iAllPreferences.iFontSize );
       
  1098             }
       
  1099         NotifyObserversL( EPreferencesItemChange,
       
  1100                                             TBrCtlDefs::ESettingsFontSize );
       
  1101         }
       
  1102     }
       
  1103 
       
  1104 // ----------------------------------------------------------------------------
       
  1105 // CBrowserPreferences::SetEncodingL
       
  1106 // ----------------------------------------------------------------------------
       
  1107 //
       
  1108 void CBrowserPreferences::SetEncodingL( TUint32 aEncoding )
       
  1109     {
       
  1110     LOG_ENTERFN("CBrowserPreferences::SetEncodingL");
       
  1111     if ( aEncoding != iAllPreferences.iEncoding )
       
  1112         {
       
  1113         iAllPreferences.iEncoding = aEncoding;
       
  1114 
       
  1115         // Store value in Shared Data and forward new setting to BrCtl
       
  1116         if( !iEmbeddedMode )
       
  1117             {
       
  1118             SetIntValueL ( KBrowserNGEncoding,
       
  1119                             ( TInt ) iAllPreferences.iEncoding );
       
  1120             }
       
  1121         NotifyObserversL( EPreferencesItemChange,
       
  1122                                         TBrCtlDefs::ESettingsCharacterset );
       
  1123         }
       
  1124     }
       
  1125 
       
  1126 // ----------------------------------------------------------------------------
       
  1127 // CBrowserPreferences::SetScriptLogL
       
  1128 // ----------------------------------------------------------------------------
       
  1129 //
       
  1130 void CBrowserPreferences::SetScriptLogL( TUint32 aScriptLog )
       
  1131     {
       
  1132     LOG_ENTERFN("CBrowserPreferences::SetScriptLogL");
       
  1133     if ( aScriptLog != iAllPreferences.iScriptLog )
       
  1134         {
       
  1135         iAllPreferences.iScriptLog = aScriptLog;
       
  1136 
       
  1137         // Store value in Shared Data and forward new setting to BrCtl
       
  1138         if( !iEmbeddedMode )
       
  1139             {
       
  1140             TBool ret = SetIntValueL ( KBrowserNGScriptLog,
       
  1141                             ( TInt ) iAllPreferences.iScriptLog );
       
  1142             }
       
  1143         NotifyObserversL( EPreferencesItemChange,
       
  1144                                         TBrCtlDefs::ESettingsScriptLog );
       
  1145         }
       
  1146     }
       
  1147 
       
  1148 // ----------------------------------------------------------------------------
       
  1149 // CBrowserPreferences::SetAdaptiveBookmarksL
       
  1150 // ----------------------------------------------------------------------------
       
  1151 //
       
  1152 void CBrowserPreferences::SetAdaptiveBookmarksL(
       
  1153                             TWmlSettingsAdaptiveBookmarks aAdaptiveBookmarks )
       
  1154     {
       
  1155     LOG_ENTERFN( "CBrowserPreferences::SetAdaptiveBookmarksL" );
       
  1156 
       
  1157     if ( ADAPTIVEBOOKMARKS )
       
  1158         {
       
  1159         if ( aAdaptiveBookmarks != iAllPreferences.iAdaptiveBookmarks )
       
  1160             {
       
  1161             iAllPreferences.iAdaptiveBookmarks = aAdaptiveBookmarks;
       
  1162 
       
  1163             if( !iEmbeddedMode )
       
  1164                 {
       
  1165 
       
  1166             switch( iAllPreferences.iAdaptiveBookmarks )
       
  1167                 {
       
  1168 				case (EWmlSettingsAdaptiveBookmarksOn):
       
  1169                     {
       
  1170 
       
  1171        				SetIntValueL ( KBrowserNGAdaptiveBookmarks,
       
  1172        					KBrowserAdaptiveBookmarksSettingDataOn );
       
  1173                     break;
       
  1174                     }
       
  1175                 case (EWmlSettingsAdaptiveBookmarksHideFolder):
       
  1176                     {
       
  1177                     SetIntValueL ( KBrowserNGAdaptiveBookmarks,
       
  1178                     	KBrowserAdaptiveBookmarksSettingDataHideFolder );
       
  1179                     break;
       
  1180                     }
       
  1181                 case (EWmlSettingsAdaptiveBookmarksOff):
       
  1182                     {
       
  1183                     SetIntValueL ( KBrowserNGAdaptiveBookmarks,
       
  1184                     	KBrowserAdaptiveBookmarksSettingDataOff );
       
  1185                     break;
       
  1186                     }
       
  1187                     default:
       
  1188                         {
       
  1189                         break;
       
  1190                         }
       
  1191                     }
       
  1192                 }
       
  1193             NotifyObserversL( EPreferencesItemChange ); // Bookmarks View is interested
       
  1194             }
       
  1195         }
       
  1196     }
       
  1197 
       
  1198 // ---------------------------------------------------------
       
  1199 // CBrowserPreferences::SetFullScreenL
       
  1200 // ---------------------------------------------------------
       
  1201 //
       
  1202 void CBrowserPreferences::SetFullScreenL( TWmlSettingsFullScreen aFullScreen )
       
  1203     {
       
  1204     LOG_ENTERFN("CBrowserPreferences::SetFullScreenL");
       
  1205 
       
  1206     if ( aFullScreen != iAllPreferences.iFullScreen )
       
  1207         {
       
  1208         iAllPreferences.iFullScreen = aFullScreen;
       
  1209         if( !iEmbeddedMode )
       
  1210             {
       
  1211             switch ( iAllPreferences.iFullScreen )
       
  1212                 {
       
  1213 				case EWmlSettingsFullScreenSoftkeysOnly:
       
  1214                     {
       
  1215                     SetIntValueL ( KBrowserNGFullScreen,
       
  1216                     	KBrowserFullScreenSettingDataSoftkeysOn );
       
  1217                     break;
       
  1218                     }
       
  1219                 case EWmlSettingsFullScreenFullScreen:
       
  1220                     {
       
  1221                     SetIntValueL ( KBrowserNGFullScreen,
       
  1222                     	KBrowserFullScreenSettingDataSoftkeysOff );
       
  1223                     break;
       
  1224                     }
       
  1225                 default:
       
  1226                     {
       
  1227                     break;
       
  1228                     }
       
  1229                 }
       
  1230             }
       
  1231         NotifyObserversL( EPreferencesItemChange ); // ContentView is interested
       
  1232         }
       
  1233     }
       
  1234 
       
  1235 // ----------------------------------------------------------------------------
       
  1236 // CBrowserPreferences::SetCookiesL
       
  1237 // ----------------------------------------------------------------------------
       
  1238 //
       
  1239 void CBrowserPreferences::SetCookiesL( TWmlSettingsCookies aCookies )
       
  1240     {
       
  1241     LOG_ENTERFN("CBrowserPreferences::SetCookiesL");
       
  1242     if ( aCookies != iAllPreferences.iCookies )
       
  1243         {
       
  1244         iAllPreferences.iCookies = aCookies;
       
  1245 
       
  1246         // Store value in Shared Data and forward new setting to BrCtl
       
  1247         if( !iEmbeddedMode )
       
  1248             {
       
  1249             SetIntValueL( KBrowserNGCookiesEnabled,
       
  1250                                             iAllPreferences.iCookies );
       
  1251             }
       
  1252         NotifyObserversL( EPreferencesItemChange,
       
  1253                                         TBrCtlDefs::ESettingsCookiesEnabled );
       
  1254         }
       
  1255     }
       
  1256 
       
  1257 // ----------------------------------------------------------------------------
       
  1258 // CBrowserPreferences::SetEcmaL
       
  1259 // ----------------------------------------------------------------------------
       
  1260 //
       
  1261 void CBrowserPreferences::SetEcmaL( TWmlSettingsECMA aEcma )
       
  1262     {
       
  1263     LOG_ENTERFN("CBrowserPreferences::SetEcmaL");
       
  1264     if ( aEcma != iAllPreferences.iEcma )
       
  1265         {
       
  1266         iAllPreferences.iEcma = aEcma;
       
  1267 
       
  1268         // Store value in Shared Data and forward new setting to BrCtl
       
  1269         if( !iEmbeddedMode )
       
  1270             {
       
  1271 			SetIntValueL( KBrowserNGECMAScriptSupport,
       
  1272 			                                    iAllPreferences.iEcma );
       
  1273             }
       
  1274         NotifyObserversL( EPreferencesItemChange,
       
  1275                                     TBrCtlDefs::ESettingsECMAScriptEnabled );
       
  1276         }
       
  1277     }
       
  1278 
       
  1279 // ----------------------------------------------------------------------------
       
  1280 // CBrowserPreferences::SetDownloadsOpen
       
  1281 // ----------------------------------------------------------------------------
       
  1282 //
       
  1283 void CBrowserPreferences::SetDownloadsOpenL( TBool aOpen )
       
  1284     {
       
  1285     LOG_ENTERFN("CBrowserPreferences::SetDownloadsOpenL");
       
  1286     if ( aOpen != iAllPreferences.iDownloadsOpen )
       
  1287         {
       
  1288         iAllPreferences.iDownloadsOpen = aOpen;
       
  1289         if( !iEmbeddedMode )
       
  1290             {
       
  1291 			SetIntValueL ( KBrowserNGOpenDownloads,
       
  1292 				        (TInt) iAllPreferences.iDownloadsOpen );
       
  1293             }
       
  1294         NotifyObserversL( EPreferencesItemChange,
       
  1295                                     TBrCtlDefs::ESettingsAutoOpenDownloads );
       
  1296         }
       
  1297     }
       
  1298 
       
  1299 
       
  1300 // ----------------------------------------------------------------------------
       
  1301 // CBrowserPreferences::SetHttpSecurityWarningsL
       
  1302 // ----------------------------------------------------------------------------
       
  1303 //
       
  1304 void CBrowserPreferences::SetHttpSecurityWarningsL( TBool aWarningsOn )
       
  1305     {
       
  1306     LOG_ENTERFN("CBrowserPreferences::SetHttpSecurityWarningsL");
       
  1307     if ( aWarningsOn != iAllPreferences.iHttpSecurityWarnings )
       
  1308         {
       
  1309         iAllPreferences.iHttpSecurityWarnings = aWarningsOn;
       
  1310         if( !iEmbeddedMode )
       
  1311             {
       
  1312 			SetIntValueL ( KBrowserNGShowSecurityWarnings,
       
  1313 				        (TInt) iAllPreferences.iHttpSecurityWarnings );
       
  1314             }
       
  1315         NotifyObserversL( EPreferencesItemChange,
       
  1316                                     TBrCtlDefs::ESettingsSecurityWarnings );
       
  1317         }
       
  1318     }
       
  1319 
       
  1320 // ----------------------------------------------------------------------------
       
  1321 // CBrowserPreferences::SetIMEINotification
       
  1322 // ----------------------------------------------------------------------------
       
  1323 //
       
  1324 void CBrowserPreferences::SetIMEINotificationL(
       
  1325                                         TWmlSettingsIMEI aIMEINotification )
       
  1326     {
       
  1327     LOG_ENTERFN("CBrowserPreferences::SetIMEINotificationL");
       
  1328     if ( IMEI_NOTIFICATION )
       
  1329         {
       
  1330         if ( aIMEINotification != iAllPreferences.iIMEINotification )
       
  1331             {
       
  1332             iAllPreferences.iIMEINotification = aIMEINotification;
       
  1333 
       
  1334             // Store value in Shared Data and forward new setting to BrCtl
       
  1335             if( !iEmbeddedMode )
       
  1336                 {
       
  1337                 SetIntValueL( KBrowserIMEINotification,
       
  1338                                         iAllPreferences.iIMEINotification );
       
  1339                 }
       
  1340             NotifyObserversL( EPreferencesItemChange,
       
  1341                                     TBrCtlDefs::ESettingsIMEINotifyEnabled );
       
  1342             }
       
  1343         }
       
  1344     }
       
  1345 
       
  1346 // ----------------------------------------------------------------------------
       
  1347 // CBrowserPreferences::HandleApDbEventL
       
  1348 // ----------------------------------------------------------------------------
       
  1349 //
       
  1350 void CBrowserPreferences::HandleApDbEventL( TEvent anEvent )
       
  1351     {
       
  1352     LOG_ENTERFN("CBrowserPreferences::HandleApDbEventL");
       
  1353     if ( anEvent == EDbChanged )//maybe somebody has modified the AP (not very likely though)
       
  1354         {
       
  1355         SetDefaultAccessPointL( iAllPreferences.iDefaultAccessPoint );
       
  1356         }
       
  1357     }
       
  1358 
       
  1359 // ----------------------------------------------------------------------------
       
  1360 // CBrowserPreferences::HomePageUrlL
       
  1361 // Get the user defined home page URL from shared data file.
       
  1362 // ----------------------------------------------------------------------------
       
  1363 //
       
  1364 TInt CBrowserPreferences::HomePageUrlL( TDes& aUrl, TBool aForceLoadFromSD ) const
       
  1365     {
       
  1366 LOG_ENTERFN("CBrowserPreferences::HomePageUrlL");
       
  1367     TInt homePgFound( KErrNotFound );
       
  1368     TBool homepage = UiLocalFeatureSupported( KBrowserUiHomePageSetting );
       
  1369     TWmlSettingsHomePage pgtype = HomePageType();
       
  1370 BROWSER_LOG( ( _L( " pgtype: %d" ), pgtype ) );
       
  1371 
       
  1372 	if (homepage)
       
  1373 		{
       
  1374 		if (aForceLoadFromSD || (pgtype != EWmlSettingsHomePageAccessPoint))
       
  1375 			{
       
  1376 			// if we are requiring a force load from the shared data, or our homepage
       
  1377 		    // is set to be something other than the access point's home page, get
       
  1378 		    // the value of the home page from the shared data
       
  1379 			homePgFound = GetStringValueL( KBrowserNGHomepageURL, KMaxHomePgUrlLength, aUrl );
       
  1380 			}
       
  1381 		else if ((iAllPreferences.iAccessPointSelectionMode == EConnectionMethod) &&
       
  1382 				 (pgtype == EWmlSettingsHomePageAccessPoint))
       
  1383         {
       
  1384 			// The user has a defined access point, and wants to use the access point's
       
  1385     		// home page
       
  1386 BROWSER_LOG( ( _L( "HomePageUrl, Access Point" ) ) );
       
  1387 
       
  1388         TUint defaultAp = DefaultAccessPoint();
       
  1389         if ( defaultAp != KWmlNoDefaultAccessPoint ) // There is an access point defined
       
  1390             {
       
  1391             CApAccessPointItem* apItem = iAllPreferences.iDefaultAPDetails;
       
  1392             if ( apItem )
       
  1393                 {
       
  1394                 const HBufC* defaultHP = apItem->ReadConstLongTextL( EApWapStartPage );
       
  1395                 if ( defaultHP->Length() )
       
  1396                     {
       
  1397                     aUrl.Zero();
       
  1398                     aUrl.Append( *defaultHP );
       
  1399                     homePgFound = KErrNone;
       
  1400                     }
       
  1401                 }
       
  1402             else
       
  1403             	{
       
  1404 BROWSER_LOG( ( _L( "HomePageUrl, Read from Central Repository" ) ) );
       
  1405             	homePgFound = GetStringValueL( KBrowserNGHomepageURL, KMaxHomePgUrlLength, aUrl );
       
  1406             	}
       
  1407             }
       
  1408         }
       
  1409         }
       
  1410 BROWSER_LOG( ( _L( "CBrowserPreferences::HomePageUrlL returns %d" ), homePgFound ) );
       
  1411     return homePgFound;
       
  1412     }
       
  1413 
       
  1414 // ----------------------------------------------------------------------------
       
  1415 // CBrowserPreferences::HomePageFromIapL
       
  1416 // Get the home page URL from belongs to the access point.
       
  1417 // ----------------------------------------------------------------------------
       
  1418 //
       
  1419 TInt CBrowserPreferences::HomePageFromIapL( TDes& aUrl, TUint aIap ) const
       
  1420     {
       
  1421 LOG_ENTERFN("CBrowserPreferences::HomePageFromIapL");
       
  1422     TInt homePgFound( KErrNotFound );
       
  1423 
       
  1424     CApListItem* apItem = iCommsModel.AccessPointsL()->ItemForUid( aIap );
       
  1425     if ( apItem )
       
  1426         {
       
  1427         TPtrC defaultHP( apItem->StartPage() );
       
  1428         if ( defaultHP.Length() )
       
  1429             {
       
  1430             aUrl.Zero();
       
  1431             aUrl.Append( defaultHP );
       
  1432             homePgFound = KErrNone;
       
  1433             }
       
  1434         }
       
  1435 BROWSER_LOG( ( _L( "CBrowserPreferences::HomePageFromIapL returns %d" ), homePgFound ) );
       
  1436     return homePgFound;
       
  1437     }
       
  1438 
       
  1439 // ----------------------------------------------------------------------------
       
  1440 // CBrowserPreferences::SearchPageUrlL
       
  1441 // Get the user defined search page URL from shared data file.
       
  1442 // ----------------------------------------------------------------------------
       
  1443 //
       
  1444 TPtrC CBrowserPreferences::SearchPageUrlL()
       
  1445     {
       
  1446 LOG_ENTERFN("CBrowserPreferences::SearchPageUrlL");
       
  1447     TBool urlTooBig = EFalse;
       
  1448     TInt error = KErrTooBig;
       
  1449     TInt length = 512;
       
  1450 
       
  1451     do
       
  1452         {
       
  1453         HBufC* temp = HBufC::NewL( length );
       
  1454         if ( iAllPreferences.iSearchPgURL )
       
  1455             {
       
  1456             delete iAllPreferences.iSearchPgURL;
       
  1457             iAllPreferences.iSearchPgURL = NULL;
       
  1458             }
       
  1459 
       
  1460         iAllPreferences.iSearchPgURL = temp;
       
  1461         TPtr ptr = iAllPreferences.iSearchPgURL->Des();
       
  1462         // Here should handle the error variable, but its still not clear
       
  1463         // how big can a CenRep string be.( KMaxUnicodeStringLength )
       
  1464 		error = iRepository->Get( KBrowserNGSearchPageURL, ptr);
       
  1465 
       
  1466         if ( error == KErrTooBig )
       
  1467             {
       
  1468             if ( length >= KMaxSearchPgUrlLength )
       
  1469                 {
       
  1470                 urlTooBig = ETrue;
       
  1471                 break;
       
  1472                 }
       
  1473             else
       
  1474                 length = length * 2;
       
  1475             }
       
  1476         } while ( error == KErrTooBig );
       
  1477 
       
  1478     // If the URL exceeds the limit, return NULL.
       
  1479     if ( urlTooBig )
       
  1480         {
       
  1481         delete iAllPreferences.iSearchPgURL;
       
  1482         iAllPreferences.iSearchPgURL = NULL;
       
  1483         iAllPreferences.iSearchPgURL = KNullDesC().AllocL();
       
  1484         }
       
  1485 
       
  1486     NotifyObserversL( EPreferencesItemChange );
       
  1487 
       
  1488 #ifdef _DEBUG
       
  1489     TPtrC logString = *iAllPreferences.iSearchPgURL;
       
  1490     BROWSER_LOG( ( _L( "CBrowserPreferences::SearchPageUrlL returns %S" ), &logString ) );
       
  1491 #endif // _DEBUG
       
  1492     return iAllPreferences.iSearchPgURL->Des();
       
  1493     }
       
  1494 
       
  1495 // ----------------------------------------------------------------------------
       
  1496 // CBrowserPreferences::SetPopupBlockingL
       
  1497 // ----------------------------------------------------------------------------
       
  1498 //
       
  1499 void CBrowserPreferences::SetPopupBlockingL( TBool aPopupBlocking )
       
  1500     {
       
  1501     LOG_ENTERFN("CBrowserPreferences::SetPopupBlockingL");
       
  1502     if ( aPopupBlocking != iAllPreferences.iPopupBlocking )
       
  1503         {
       
  1504         iAllPreferences.iPopupBlocking = aPopupBlocking;
       
  1505         SetIntValueL( KBrowserNGPopupBlocking, iAllPreferences.iPopupBlocking );
       
  1506         }
       
  1507     }
       
  1508 
       
  1509 // ----------------------------------------------------------------------------
       
  1510 // CBrowserPreferences::SetFormDataSavingL
       
  1511 // ----------------------------------------------------------------------------
       
  1512 //
       
  1513 void CBrowserPreferences::SetFormDataSavingL( TWmlSettingsFormData aFormDataSaving )
       
  1514     {
       
  1515     LOG_ENTERFN("CBrowserPreferences::SetFormDataSavingL");
       
  1516     if ( aFormDataSaving != iAllPreferences.iFormDataSaving )
       
  1517         {
       
  1518         iAllPreferences.iFormDataSaving = aFormDataSaving;
       
  1519 
       
  1520 
       
  1521         // TO DO: Add to cenrep
       
  1522         SetIntValueL( KBrowserFormDataSaving,
       
  1523                         iAllPreferences.iFormDataSaving );
       
  1524         }
       
  1525     NotifyObserversL( EPreferencesItemChange,
       
  1526                             TBrCtlDefs::ESettingsAutoFormFillEnabled );
       
  1527     }
       
  1528 
       
  1529 // ----------------------------------------------------------------------------
       
  1530 // CBrowserPreferences::GetIntValue
       
  1531 // ----------------------------------------------------------------------------
       
  1532 //
       
  1533 TInt CBrowserPreferences::GetIntValue( TUint32 aKey) const
       
  1534     {
       
  1535 LOG_ENTERFN("CBrowserPreferences::GetIntValue");
       
  1536     TInt retVal = 0;
       
  1537 
       
  1538 	if ( iRepository )
       
  1539 	   	{
       
  1540     	iRepository->Get(aKey, retVal);
       
  1541     	}
       
  1542 
       
  1543 BROWSER_LOG( ( _L( "CBrowserPreferences::GetIntValue returns %d" ), retVal ) );
       
  1544     return retVal;
       
  1545     }
       
  1546 
       
  1547 // ----------------------------------------------------------------------------
       
  1548 // CBrowserPreferences::SetIntValueL
       
  1549 // ----------------------------------------------------------------------------
       
  1550 //
       
  1551 TBool CBrowserPreferences::SetIntValueL ( TUint32 aKey, const TInt& aValue )
       
  1552     {
       
  1553 LOG_ENTERFN("CBrowserPreferences::SetIntValueL");
       
  1554 BROWSER_LOG( ( _L( "aValue: %d" ), aValue ) );
       
  1555 
       
  1556     // Log setting value BEFORE the change
       
  1557     #ifdef I__BROWSER_LOG_ENABLED
       
  1558         TInt preValue;
       
  1559     	iRepository->Get( aKey, preValue );
       
  1560         BROWSER_LOG( ( _L( "Prechange CenRep setting value: %d" ), preValue ) );
       
  1561     #endif // I__BROWSER_LOG_ENABLED
       
  1562 
       
  1563     TBool retVal=EFalse;
       
  1564 	if ( iRepository && ( KErrNone == iRepository->Set( aKey, aValue ) ) )
       
  1565     	{
       
  1566     	retVal = ETrue;
       
  1567     	}
       
  1568 
       
  1569     // Log setting value AFTER the change
       
  1570     #ifdef I__BROWSER_LOG_ENABLED
       
  1571         TInt postValue;
       
  1572     	iRepository->Get( aKey, postValue );
       
  1573         BROWSER_LOG( ( _L( "Postchange CenRep setting value: %d" ), postValue ) );
       
  1574     #endif // I__BROWSER_LOG_ENABLED
       
  1575 
       
  1576     BROWSER_LOG( ( _L( "CBrowserPreferences::SetIntValueL returns %d" ), retVal ) );
       
  1577     return retVal;
       
  1578     }
       
  1579 
       
  1580 // ----------------------------------------------------------------------------
       
  1581 // CBrowserPreferences::GetStringValueL
       
  1582 // ----------------------------------------------------------------------------
       
  1583 //
       
  1584 HBufC* CBrowserPreferences::GetStringValueL ( TUint32 aKey ) const
       
  1585     {
       
  1586 LOG_ENTERFN("CBrowserPreferences::GetStringValueL(TUint32)");
       
  1587     HBufC* retVal = NULL;
       
  1588     TFileName value;
       
  1589     TInt err( KErrNotFound );
       
  1590 
       
  1591 
       
  1592 	if( iRepository )
       
  1593 		{
       
  1594 		err = iRepository->Get( aKey, value );
       
  1595 		}
       
  1596 
       
  1597     if ( err == KErrNone )
       
  1598        	{
       
  1599        	retVal = HBufC::NewL( value.Length() );
       
  1600        	TPtr ptr = retVal->Des();
       
  1601        	ptr.Copy ( value );
       
  1602        	}
       
  1603 
       
  1604     #ifdef _DEBUG
       
  1605         TPtrC logString = *retVal;
       
  1606         BROWSER_LOG( ( _L( "CBrowserPreferences::GetStringValueL returns %S" ), &logString ) );
       
  1607     #endif // _DEBUG
       
  1608 
       
  1609     return retVal;
       
  1610     }
       
  1611 
       
  1612 // ----------------------------------------------------------------------------
       
  1613 // CBrowserPreferences::GetStringValueL
       
  1614 // ----------------------------------------------------------------------------
       
  1615 //
       
  1616 TInt CBrowserPreferences::GetStringValueL(
       
  1617 		TUint32 aKey, TInt aMaxBufSize,
       
  1618 		TDes& aBuf) const
       
  1619     {
       
  1620 LOG_ENTERFN("CBrowserPreferences::GetStringValueL(TUint32,TInt,TDes&)");
       
  1621     // Not sure this works, but CRepository has no information about the return
       
  1622     // values of the methods.
       
  1623     // So dont know if iRepository->Get returns with an errorid on error,therefore
       
  1624     // error = iRepository->Get( aKey, ptr ) may not work.
       
  1625     TInt length( 256 );
       
  1626     HBufC* value = HBufC::NewL( length );
       
  1627     TPtr ptr = value->Des();
       
  1628     TInt error;
       
  1629 
       
  1630 	error = iRepository->Get( aKey, ptr );
       
  1631 
       
  1632     for( length=length*2; (error==KErrTooBig) && (length<aMaxBufSize); length=length*2)
       
  1633         {
       
  1634         delete value;
       
  1635         value = HBufC::NewL( length );
       
  1636         ptr = value->Des();
       
  1637 
       
  1638 		error = iRepository->Get( aKey, ptr );
       
  1639         }
       
  1640     if( error == KErrNone )
       
  1641         {
       
  1642         aBuf.Zero();
       
  1643         aBuf.Append( ptr );
       
  1644         }
       
  1645     delete value;
       
  1646 
       
  1647     BROWSER_LOG( ( _L( "CBrowserPreferences::GetStringValueL(TUint32,TInt,TDes&) returns %d" ),
       
  1648         error ) );
       
  1649     return error;
       
  1650     }
       
  1651 
       
  1652 
       
  1653 // ----------------------------------------------------------------------------
       
  1654 // CBrowserPreferences::SetStringValueL
       
  1655 // ----------------------------------------------------------------------------
       
  1656 //
       
  1657 TBool CBrowserPreferences::SetStringValueL( TUint32 aKey, const TDesC& aValue )
       
  1658     {
       
  1659 LOG_ENTERFN("CBrowserPreferences::SetStringValueL");
       
  1660 
       
  1661     // Log setting value BEFORE the change
       
  1662     #ifdef _DEBUG
       
  1663         TPtrC paramVal = aValue;
       
  1664         BROWSER_LOG( ( _L( "aValue %S" ), &paramVal ) );
       
  1665         HBufC* doNothing = HBufC::NewL( 512 );
       
  1666         TPtr preChange = doNothing->Des();
       
  1667     	iRepository->Get( aKey, preChange );
       
  1668         BROWSER_LOG( ( _L( "Prechange CenRep setting value: %S" ), &preChange ) );
       
  1669         delete doNothing;
       
  1670     #endif // _DEBUG
       
  1671 
       
  1672     TBool retVal=EFalse;
       
  1673 
       
  1674 	if ( iRepository && ( KErrNone == iRepository->Set( aKey, aValue ) ) )
       
  1675     	{
       
  1676     	retVal = ETrue;
       
  1677     	}
       
  1678     // Log setting value AFTER the change
       
  1679     #ifdef _DEBUG
       
  1680         HBufC* doNothing2 = HBufC::NewL( 512 );
       
  1681         TPtr postChange = doNothing2->Des();
       
  1682    		iRepository->Get( aKey, postChange );
       
  1683 
       
  1684         BROWSER_LOG( ( _L( "Postchange CenRep setting value: %S" ), &postChange ) );
       
  1685         delete doNothing2;
       
  1686     #endif // _DEBUG
       
  1687 
       
  1688     BROWSER_LOG( ( _L( "CBrowserPreferences::SetStringValueL returns %d" ), retVal) );
       
  1689     return retVal;
       
  1690     }
       
  1691 
       
  1692 // ----------------------------------------------------------------------------
       
  1693 // CBrowserPreferences::SetOverridenSettingsL
       
  1694 // ----------------------------------------------------------------------------
       
  1695 //
       
  1696 void CBrowserPreferences::SetOverriddenSettingsL(TBrowserOverriddenSettings* aSettings)
       
  1697     {
       
  1698 LOG_ENTERFN("CBrowserPreferences::SetOverriddenSettingsL");
       
  1699 
       
  1700     if( aSettings != NULL )
       
  1701         {
       
  1702         TUint tempValue;
       
  1703         iOverriden = ETrue;
       
  1704         iOverridenSettings = aSettings;
       
  1705 
       
  1706         // Check overridden settings by looking at their default values
       
  1707         // (see how Launcher2 sets them in the OverriddenSettings constructor)
       
  1708         tempValue = iOverridenSettings->GetBrowserSetting( EBrowserOverSettingsCustomAp );
       
  1709         if( tempValue != 0 )
       
  1710             {
       
  1711             iAllPreferences.iAccessPointSelectionMode = EConnectionMethod;
       
  1712             iCustomAp = tempValue;
       
  1713           	SetDefaultAccessPointL( iCustomAp );
       
  1714             }
       
  1715         tempValue = iOverridenSettings->GetBrowserSetting( EBrowserOverSettingsAutoLoadImages );
       
  1716         if( tempValue != KMaxTUint )
       
  1717             {
       
  1718             iAllPreferences.iAutoLoadContent = tempValue;
       
  1719             }
       
  1720 
       
  1721         tempValue = iOverridenSettings->GetBrowserSetting( EBrowserOverSettingsFontSize );
       
  1722         if( tempValue != EBrowserOverFontSizeLevelUndefined )
       
  1723             {
       
  1724             iAllPreferences.iFontSize = tempValue;
       
  1725             }
       
  1726         tempValue = iOverridenSettings->GetBrowserSetting( EBrowserOverSettingsFullScreen );
       
  1727         switch( tempValue )
       
  1728             {
       
  1729             case KBrowserFullScreenSettingDataSoftkeysOff:
       
  1730                 {
       
  1731                 iAllPreferences.iFullScreen = EWmlSettingsFullScreenFullScreen;
       
  1732                 break;
       
  1733                 }
       
  1734             case KBrowserFullScreenSettingDataSoftkeysOn:
       
  1735             default:
       
  1736                 {
       
  1737                 iAllPreferences.iFullScreen = EWmlSettingsFullScreenSoftkeysOnly;
       
  1738                 break;
       
  1739                 }
       
  1740             }
       
  1741         }
       
  1742     return;
       
  1743     }
       
  1744 
       
  1745 // ----------------------------------------------------------------------------
       
  1746 // CBrowserPreferences::SetEmbeddedModeL(TBool aEmbeddedMode)
       
  1747 // ----------------------------------------------------------------------------
       
  1748 //
       
  1749 void CBrowserPreferences::SetEmbeddedModeL(TBool aEmbeddedMode)
       
  1750     {
       
  1751     LOG_ENTERFN("CBrowserPreferences::SetEmbeddedModeL");
       
  1752 
       
  1753     iEmbeddedMode = aEmbeddedMode;
       
  1754     if( iEmbeddedMode /* && ApiProvider().StartedUp()*/ )
       
  1755         {
       
  1756         NotifyObserversL( EPreferencesItemChange,
       
  1757                                             TBrCtlDefs::ESettingsEmbedded );
       
  1758         }
       
  1759     return;
       
  1760     }
       
  1761 
       
  1762 // ----------------------------------------------------------------------------
       
  1763 // CBrowserPreferences::SetMediaVolumeL( TInt aMediaVolume )
       
  1764 // ----------------------------------------------------------------------------
       
  1765 //
       
  1766 void CBrowserPreferences::SetMediaVolumeL( TInt aMediaVolume )
       
  1767     {
       
  1768     LOG_ENTERFN("CBrowserPreferences::SetMediaVolumeL");
       
  1769 
       
  1770     // Media Volume uses different SD ini. Revert to Browser SD ini after use
       
  1771     iAllPreferences.iMediaVolume = aMediaVolume;
       
  1772     SetIntValueL ( KBrowserMediaVolumeControl, iAllPreferences.iMediaVolume );
       
  1773     }
       
  1774 
       
  1775 // ----------------------------------------------------------------------------
       
  1776 // CBrowserPreferences::SetHomePageTypeL( TWmlSettingsHomePage aHomePageType )
       
  1777 // ----------------------------------------------------------------------------
       
  1778 //
       
  1779 void CBrowserPreferences::SetHomePageTypeL( TWmlSettingsHomePage aHomePageType )
       
  1780     {
       
  1781     LOG_ENTERFN("CBrowserPreferences::SetHomePageTypeL");
       
  1782 	SetIntValueL( KBrowserNGHomepageType, aHomePageType );
       
  1783     iAllPreferences.iHomePgType = aHomePageType;
       
  1784     }
       
  1785 
       
  1786 // ----------------------------------------------------------------------------
       
  1787 // CBrowserPreferences::SetHomePageUrlL( TDesC& aHomePageURL )
       
  1788 // ----------------------------------------------------------------------------
       
  1789 //
       
  1790 void CBrowserPreferences::SetHomePageUrlL( const TDesC& aHomePageURL )
       
  1791     {
       
  1792     LOG_ENTERFN("CBrowserPreferences::SetHomePageUrlL");
       
  1793 
       
  1794     if( aHomePageURL.Length() )
       
  1795         {
       
  1796         // Save the homepage with a scheme (default is http if not specified).
       
  1797         HBufC* temp = Util::AllocateUrlWithSchemeL( aHomePageURL );
       
  1798         delete iAllPreferences.iHomePgURL;
       
  1799         iAllPreferences.iHomePgURL = temp;
       
  1800         SetStringValueL( KBrowserNGHomepageURL,
       
  1801                                         iAllPreferences.iHomePgURL->Des() );
       
  1802         }
       
  1803     }
       
  1804 
       
  1805 // ----------------------------------------------------------------------------
       
  1806 // CBrowserPreferences::SetSearchPageUrlL( TDesC& aSearchPageURL )
       
  1807 // ----------------------------------------------------------------------------
       
  1808 //
       
  1809 void CBrowserPreferences::SetSearchPageUrlL( const TDesC& aSearchPageURL )
       
  1810     {
       
  1811     LOG_ENTERFN("CBrowserPreferences::SetSearchPageUrlL");
       
  1812 
       
  1813     // Save the searchpage with a scheme (default is http if not specified).
       
  1814     HBufC* temp = Util::AllocateUrlWithSchemeL( aSearchPageURL );
       
  1815     delete iAllPreferences.iSearchPgURL;
       
  1816     iAllPreferences.iSearchPgURL = temp;
       
  1817     SetStringValueL( KBrowserNGSearchPageURL,
       
  1818 	                            iAllPreferences.iSearchPgURL->Des() );
       
  1819     }
       
  1820 
       
  1821 // ----------------------------------------------------------------------------
       
  1822 // CBrowserPreferences::FlushSD()
       
  1823 // ----------------------------------------------------------------------------
       
  1824 //
       
  1825 void CBrowserPreferences::FlushSD()
       
  1826     {
       
  1827     }
       
  1828 
       
  1829 // ----------------------------------------------------------------------------
       
  1830 // CBrowserPreferences::CustomAccessPointDefined()
       
  1831 // ----------------------------------------------------------------------------
       
  1832 //
       
  1833 TBool CBrowserPreferences::CustomAccessPointDefined()
       
  1834     {
       
  1835 LOG_ENTERFN("CBrowserPreferences::CustomAccessPointDefined");
       
  1836     TBool retval( iOverridenSettings && iCustomAp );
       
  1837     BROWSER_LOG( ( _L( "CBrowserPreferences::CustomAccessPointDefined returns %d" ),
       
  1838         (TInt)retval ) );
       
  1839     return retval;
       
  1840     }
       
  1841 
       
  1842 // ----------------------------------------------------------------------------
       
  1843 // CBrowserPreferences::SelfDownloadContentTypesL
       
  1844 // ----------------------------------------------------------------------------
       
  1845 //
       
  1846 TPtrC CBrowserPreferences::SelfDownloadContentTypesL()
       
  1847     {
       
  1848 LOG_ENTERFN("CBrowserPreferences::SelfDownloadContentTypesL");
       
  1849 
       
  1850     TInt error = KErrNone;
       
  1851     const TInt KLengthIncrement = 32; // 32 characters
       
  1852     TInt length = KLengthIncrement; // Initially KLengthIncrement
       
  1853 
       
  1854     do
       
  1855         {
       
  1856         HBufC* temp = HBufC::NewL( length );
       
  1857         delete iSelfDownloadContentTypes;
       
  1858         iSelfDownloadContentTypes = temp;
       
  1859         TPtr ptr = iSelfDownloadContentTypes->Des();
       
  1860 		error = iRepository->Get( KBrowserSelfDownloadContentTypes, ptr );
       
  1861 
       
  1862         if ( error == KErrOverflow )
       
  1863             {
       
  1864             // Increase the size of the placeholder
       
  1865             length += KLengthIncrement;
       
  1866             }
       
  1867         } while ( error == KErrOverflow );
       
  1868 
       
  1869     #ifdef _DEBUG
       
  1870         TPtrC logString = *iSelfDownloadContentTypes;
       
  1871         BROWSER_LOG( ( _L( "CBrowserPreferences::SelfDownloadContentTypesL returns %S" ),
       
  1872             &logString ) );
       
  1873     #endif // _DEBUG
       
  1874 
       
  1875     return (*iSelfDownloadContentTypes);
       
  1876     }
       
  1877 
       
  1878 // ----------------------------------------------------------------------------
       
  1879 // CBrowserPreferences::AccessPointAlwaysAsk()
       
  1880 // ----------------------------------------------------------------------------
       
  1881 //
       
  1882 TCmSettingSelectionMode CBrowserPreferences::AccessPointSelectionMode()
       
  1883     {
       
  1884 LOG_ENTERFN("CBrowserPreferences::AccessPointSelectionMode");
       
  1885 BROWSER_LOG( ( _L( "CBrowserPreferences::AccessPointSelectionMode returns %d" ),
       
  1886         iAllPreferences.iAccessPointSelectionMode ) );
       
  1887     return iAllPreferences.iAccessPointSelectionMode;
       
  1888     }
       
  1889 
       
  1890 // ----------------------------------------------------------------------------
       
  1891 // CBrowserPreferences::SetAccessPointSelectionModeL
       
  1892 // ----------------------------------------------------------------------------
       
  1893 //
       
  1894 void CBrowserPreferences::SetAccessPointSelectionModeL(
       
  1895                 TCmSettingSelectionMode aAccessPointSelectionMode )
       
  1896     {
       
  1897     LOG_ENTERFN("CBrowserPreferences::SetAccessPointSelectionModeL");
       
  1898 
       
  1899 	if ( aAccessPointSelectionMode != iAllPreferences.iAccessPointSelectionMode )
       
  1900 		{
       
  1901 		iAllPreferences.iAccessPointSelectionMode = aAccessPointSelectionMode;
       
  1902 
       
  1903         switch ( aAccessPointSelectionMode )
       
  1904             {
       
  1905             case EAlwaysAsk:
       
  1906                 {
       
  1907                 SetIntValueL ( KBrowserAccessPointSelectionMode, EBrowserCenRepApSelModeAlwaysAsk );
       
  1908                 break;
       
  1909                 }
       
  1910             case EDestination:
       
  1911                 {
       
  1912                 SetIntValueL ( KBrowserAccessPointSelectionMode, EBrowserCenRepApSelModeDestination );
       
  1913                 break;
       
  1914                 }
       
  1915             case EConnectionMethod:
       
  1916                 {
       
  1917                 SetIntValueL ( KBrowserAccessPointSelectionMode, EBrowserCenRepApSelModeUserDefined );
       
  1918                 break;
       
  1919                 }
       
  1920             default:
       
  1921                 {
       
  1922                 SetIntValueL ( KBrowserAccessPointSelectionMode, EBrowserCenRepApSelModeAlwaysAsk );
       
  1923                 break;
       
  1924                 }
       
  1925             }
       
  1926 		}
       
  1927     }
       
  1928 
       
  1929 // ----------------------------------------------------------------------------
       
  1930 // CBrowserPreferences::SetAutomaticUpdatingApL
       
  1931 // ----------------------------------------------------------------------------
       
  1932 //
       
  1933 void CBrowserPreferences::SetAutomaticUpdatingApL( TUint aSetting )
       
  1934     {
       
  1935     LOG_ENTERFN("CBrowserPreferences::SetAutomaticUpdatingApL");
       
  1936 
       
  1937     iAllPreferences.iAutomaticUpdatingAP = aSetting;
       
  1938     SetIntValueL ( KBrowserNGAutomaticUpdatingAccessPoint, aSetting );
       
  1939     }
       
  1940 
       
  1941 
       
  1942 void CBrowserPreferences::SetAutomaticUpdatingWhileRoamingL( TBool aAutoUpdateRoaming )
       
  1943     {
       
  1944     LOG_ENTERFN("CBrowserPreferences::SetAutomaticUpdatingWhileRoamingL");
       
  1945     if ( aAutoUpdateRoaming != iAllPreferences.iAutomaticUpdatingWhileRoaming )
       
  1946         {
       
  1947         iAllPreferences.iAutomaticUpdatingWhileRoaming = aAutoUpdateRoaming;
       
  1948         SetIntValueL( KBrowserNGAutomaticUpdatingWhileRoaming,
       
  1949                                         iAllPreferences.iAutomaticUpdatingWhileRoaming );
       
  1950     	}
       
  1951 
       
  1952     }
       
  1953 
       
  1954 
       
  1955 
       
  1956 // ---------------------------------------------------------
       
  1957 // CBrowserPreferences::SetToolbarOnOffL()
       
  1958 // ---------------------------------------------------------
       
  1959 //
       
  1960 void CBrowserPreferences::SetToolbarOnOffL(TInt aCommand)
       
  1961     {
       
  1962     if ( aCommand != iAllPreferences.iToolbarOnOff )
       
  1963         {
       
  1964         iAllPreferences.iToolbarOnOff = aCommand;
       
  1965         SetIntValueL( KToolbarOnOff, iAllPreferences.iToolbarOnOff );
       
  1966 
       
  1967         NotifyObserversL( EPreferencesItemChange,
       
  1968                           TBrCtlDefs::ESettingsToolbarOnOff );
       
  1969         }
       
  1970     }
       
  1971 
       
  1972 
       
  1973 
       
  1974 // ---------------------------------------------------------
       
  1975 // CBrowserPreferences::SetToolbarButton1CmdL()
       
  1976 // ---------------------------------------------------------
       
  1977 //
       
  1978 void CBrowserPreferences::SetToolbarButton1CmdL(TInt aCommand)
       
  1979     {
       
  1980     if ( aCommand != iAllPreferences.iToolbarButton1Cmd )
       
  1981         {
       
  1982         iAllPreferences.iToolbarButton1Cmd = aCommand;
       
  1983         SetIntValueL( KToolbarButton1Cmd, iAllPreferences.iToolbarButton1Cmd );
       
  1984 
       
  1985         NotifyObserversL( EPreferencesItemChange,
       
  1986                           TBrCtlDefs::ESettingsToolbarButton1Cmd );
       
  1987         }
       
  1988     }
       
  1989 
       
  1990 
       
  1991 // ---------------------------------------------------------
       
  1992 // CBrowserPreferences::SetToolbarButton2CmdL()
       
  1993 // ---------------------------------------------------------
       
  1994 //
       
  1995 void CBrowserPreferences::SetToolbarButton2CmdL(TInt aCommand)
       
  1996     {
       
  1997     if ( aCommand != iAllPreferences.iToolbarButton2Cmd )
       
  1998         {
       
  1999         iAllPreferences.iToolbarButton2Cmd = aCommand;
       
  2000         SetIntValueL( KToolbarButton2Cmd, iAllPreferences.iToolbarButton2Cmd );
       
  2001 
       
  2002         NotifyObserversL( EPreferencesItemChange,
       
  2003                           TBrCtlDefs::ESettingsToolbarButton2Cmd );
       
  2004         }
       
  2005     }
       
  2006 
       
  2007 // ---------------------------------------------------------
       
  2008 // CBrowserPreferences::SetToolbarButton3CmdL()
       
  2009 // ---------------------------------------------------------
       
  2010 //
       
  2011 void CBrowserPreferences::SetToolbarButton3CmdL(TInt aCommand)
       
  2012     {
       
  2013     if ( aCommand != iAllPreferences.iToolbarButton3Cmd )
       
  2014         {
       
  2015         iAllPreferences.iToolbarButton3Cmd = aCommand;
       
  2016         SetIntValueL( KToolbarButton3Cmd, iAllPreferences.iToolbarButton3Cmd );
       
  2017 
       
  2018         NotifyObserversL( EPreferencesItemChange,
       
  2019                           TBrCtlDefs::ESettingsToolbarButton3Cmd );
       
  2020         }
       
  2021     }
       
  2022 
       
  2023 // ---------------------------------------------------------
       
  2024 // CBrowserPreferences::SetToolbarButton4CmdL()
       
  2025 // ---------------------------------------------------------
       
  2026 //
       
  2027 void CBrowserPreferences::SetToolbarButton4CmdL(TInt aCommand)
       
  2028     {
       
  2029     if ( aCommand != iAllPreferences.iToolbarButton4Cmd )
       
  2030         {
       
  2031         iAllPreferences.iToolbarButton4Cmd = aCommand;
       
  2032         SetIntValueL( KToolbarButton4Cmd, iAllPreferences.iToolbarButton4Cmd );
       
  2033 
       
  2034         NotifyObserversL( EPreferencesItemChange,
       
  2035                           TBrCtlDefs::ESettingsToolbarButton4Cmd );
       
  2036         }
       
  2037     }
       
  2038 
       
  2039 // ---------------------------------------------------------
       
  2040 // CBrowserPreferences::SetToolbarButton5CmdL()
       
  2041 // ---------------------------------------------------------
       
  2042 //
       
  2043 void CBrowserPreferences::SetToolbarButton5CmdL(TInt aCommand)
       
  2044     {
       
  2045     if ( aCommand != iAllPreferences.iToolbarButton5Cmd )
       
  2046         {
       
  2047         iAllPreferences.iToolbarButton5Cmd = aCommand;
       
  2048         SetIntValueL( KToolbarButton5Cmd, iAllPreferences.iToolbarButton5Cmd );
       
  2049 
       
  2050         NotifyObserversL( EPreferencesItemChange,
       
  2051                           TBrCtlDefs::ESettingsToolbarButton5Cmd );
       
  2052         }
       
  2053     }
       
  2054 
       
  2055 // ---------------------------------------------------------
       
  2056 // CBrowserPreferences::SetToolbarButton6CmdL()
       
  2057 // ---------------------------------------------------------
       
  2058 //
       
  2059 void CBrowserPreferences::SetToolbarButton6CmdL(TInt aCommand)
       
  2060     {
       
  2061     if ( aCommand != iAllPreferences.iToolbarButton6Cmd )
       
  2062         {
       
  2063         iAllPreferences.iToolbarButton6Cmd = aCommand;
       
  2064         SetIntValueL( KToolbarButton6Cmd, iAllPreferences.iToolbarButton6Cmd );
       
  2065 
       
  2066         NotifyObserversL( EPreferencesItemChange,
       
  2067                           TBrCtlDefs::ESettingsToolbarButton6Cmd );
       
  2068         }
       
  2069     }
       
  2070 
       
  2071 // ---------------------------------------------------------
       
  2072 // CBrowserPreferences::SetToolbarButton7CmdL()
       
  2073 // ---------------------------------------------------------
       
  2074 //
       
  2075 void CBrowserPreferences::SetToolbarButton7CmdL(TInt aCommand)
       
  2076     {
       
  2077     if ( aCommand != iAllPreferences.iToolbarButton7Cmd )
       
  2078         {
       
  2079         iAllPreferences.iToolbarButton7Cmd = aCommand;
       
  2080         SetIntValueL( KToolbarButton7Cmd, iAllPreferences.iToolbarButton7Cmd );
       
  2081 
       
  2082         NotifyObserversL( EPreferencesItemChange,
       
  2083                           TBrCtlDefs::ESettingsToolbarButton7Cmd );
       
  2084         }
       
  2085     }
       
  2086 
       
  2087 // ---------------------------------------------------------
       
  2088 // CBrowserPreferences::SetShortcutKey1CmdL()
       
  2089 // ---------------------------------------------------------
       
  2090 //
       
  2091 void CBrowserPreferences::SetShortcutKey1CmdL(TInt aCommand)
       
  2092     {
       
  2093     if ( aCommand != iAllPreferences.iShortcutKey1Cmd )
       
  2094         {
       
  2095         iAllPreferences.iShortcutKey1Cmd = aCommand;
       
  2096         SetIntValueL( KShortcutKey1Cmd, iAllPreferences.iShortcutKey1Cmd );
       
  2097         }
       
  2098     }
       
  2099 
       
  2100 // ---------------------------------------------------------
       
  2101 // CBrowserPreferences::SetShortcutKey2CmdL()
       
  2102 // ---------------------------------------------------------
       
  2103 //
       
  2104 void CBrowserPreferences::SetShortcutKey2CmdL(TInt aCommand)
       
  2105     {
       
  2106     if ( aCommand != iAllPreferences.iShortcutKey2Cmd )
       
  2107         {
       
  2108         iAllPreferences.iShortcutKey2Cmd = aCommand;
       
  2109         SetIntValueL( KShortcutKey2Cmd, iAllPreferences.iShortcutKey2Cmd );
       
  2110         }
       
  2111     }
       
  2112 
       
  2113 // ---------------------------------------------------------
       
  2114 // CBrowserPreferences::SetShortcutKey3CmdL()
       
  2115 // ---------------------------------------------------------
       
  2116 //
       
  2117 void CBrowserPreferences::SetShortcutKey3CmdL(TInt aCommand)
       
  2118     {
       
  2119     if ( aCommand != iAllPreferences.iShortcutKey3Cmd )
       
  2120         {
       
  2121         iAllPreferences.iShortcutKey3Cmd = aCommand;
       
  2122         SetIntValueL( KShortcutKey3Cmd, iAllPreferences.iShortcutKey3Cmd );
       
  2123         }
       
  2124     }
       
  2125 
       
  2126 // ---------------------------------------------------------
       
  2127 // CBrowserPreferences::SetShortcutKey4CmdL()
       
  2128 // ---------------------------------------------------------
       
  2129 //
       
  2130 void CBrowserPreferences::SetShortcutKey4CmdL(TInt aCommand)
       
  2131     {
       
  2132     if ( aCommand != iAllPreferences.iShortcutKey4Cmd )
       
  2133         {
       
  2134         iAllPreferences.iShortcutKey4Cmd = aCommand;
       
  2135         SetIntValueL( KShortcutKey4Cmd, iAllPreferences.iShortcutKey4Cmd );
       
  2136         }
       
  2137     }
       
  2138 
       
  2139 // ---------------------------------------------------------
       
  2140 // CBrowserPreferences::SetShortcutKey5CmdL()
       
  2141 // ---------------------------------------------------------
       
  2142 //
       
  2143 void CBrowserPreferences::SetShortcutKey5CmdL(TInt aCommand)
       
  2144     {
       
  2145     if ( aCommand != iAllPreferences.iShortcutKey5Cmd )
       
  2146         {
       
  2147         iAllPreferences.iShortcutKey5Cmd = aCommand;
       
  2148         SetIntValueL( KShortcutKey5Cmd, iAllPreferences.iShortcutKey5Cmd );
       
  2149         }
       
  2150     }
       
  2151 
       
  2152 // ---------------------------------------------------------
       
  2153 // CBrowserPreferences::SetShortcutKey6CmdL()
       
  2154 // ---------------------------------------------------------
       
  2155 //
       
  2156 void CBrowserPreferences::SetShortcutKey6CmdL(TInt aCommand)
       
  2157     {
       
  2158     if ( aCommand != iAllPreferences.iShortcutKey6Cmd )
       
  2159         {
       
  2160         iAllPreferences.iShortcutKey6Cmd = aCommand;
       
  2161         SetIntValueL( KShortcutKey6Cmd, iAllPreferences.iShortcutKey6Cmd );
       
  2162         }
       
  2163     }
       
  2164 
       
  2165 // ---------------------------------------------------------
       
  2166 // CBrowserPreferences::SetShortcutKey7CmdL()
       
  2167 // ---------------------------------------------------------
       
  2168 //
       
  2169 void CBrowserPreferences::SetShortcutKey7CmdL(TInt aCommand)
       
  2170     {
       
  2171     if ( aCommand != iAllPreferences.iShortcutKey7Cmd )
       
  2172         {
       
  2173         iAllPreferences.iShortcutKey7Cmd = aCommand;
       
  2174         SetIntValueL( KShortcutKey7Cmd, iAllPreferences.iShortcutKey7Cmd );
       
  2175         }
       
  2176     }
       
  2177 
       
  2178 // ---------------------------------------------------------
       
  2179 // CBrowserPreferences::SetShortcutKey8CmdL()
       
  2180 // ---------------------------------------------------------
       
  2181 //
       
  2182 void CBrowserPreferences::SetShortcutKey8CmdL(TInt aCommand)
       
  2183     {
       
  2184     if ( aCommand != iAllPreferences.iShortcutKey8Cmd )
       
  2185         {
       
  2186         iAllPreferences.iShortcutKey8Cmd = aCommand;
       
  2187         SetIntValueL( KShortcutKey8Cmd, iAllPreferences.iShortcutKey8Cmd );
       
  2188         }
       
  2189     }
       
  2190 
       
  2191 // ---------------------------------------------------------
       
  2192 // CBrowserPreferences::SetShortcutKey9CmdL()
       
  2193 // ---------------------------------------------------------
       
  2194 //
       
  2195 void CBrowserPreferences::SetShortcutKey9CmdL(TInt aCommand)
       
  2196     {
       
  2197     if ( aCommand != iAllPreferences.iShortcutKey9Cmd )
       
  2198         {
       
  2199         iAllPreferences.iShortcutKey9Cmd = aCommand;
       
  2200         SetIntValueL( KShortcutKey9Cmd, iAllPreferences.iShortcutKey9Cmd );
       
  2201         }
       
  2202     }
       
  2203 
       
  2204 // ---------------------------------------------------------
       
  2205 // CBrowserPreferences::SetShortcutKey0CmdL()
       
  2206 // ---------------------------------------------------------
       
  2207 //
       
  2208 void CBrowserPreferences::SetShortcutKey0CmdL(TInt aCommand)
       
  2209     {
       
  2210     if ( aCommand != iAllPreferences.iShortcutKey0Cmd )
       
  2211         {
       
  2212         iAllPreferences.iShortcutKey0Cmd = aCommand;
       
  2213         SetIntValueL( KShortcutKey0Cmd, iAllPreferences.iShortcutKey0Cmd );
       
  2214         }
       
  2215     }
       
  2216 
       
  2217 // ---------------------------------------------------------
       
  2218 // CBrowserPreferences::SetShortcutKeyStarCmdL()
       
  2219 // ---------------------------------------------------------
       
  2220 //
       
  2221 void CBrowserPreferences::SetShortcutKeyStarCmdL(TInt aCommand)
       
  2222     {
       
  2223     if ( aCommand != iAllPreferences.iShortcutKeyStarCmd )
       
  2224         {
       
  2225         iAllPreferences.iShortcutKeyStarCmd = aCommand;
       
  2226         SetIntValueL( KShortcutKeyStarCmd, iAllPreferences.iShortcutKeyStarCmd );
       
  2227         }
       
  2228     }
       
  2229 
       
  2230 // ---------------------------------------------------------
       
  2231 // CBrowserPreferences::SetShortcutKeyHashCmdL()
       
  2232 // ---------------------------------------------------------
       
  2233 //
       
  2234 void CBrowserPreferences::SetShortcutKeyHashCmdL(TInt aCommand)
       
  2235     {
       
  2236     if ( aCommand != iAllPreferences.iShortcutKeyHashCmd )
       
  2237         {
       
  2238         iAllPreferences.iShortcutKeyHashCmd = aCommand;
       
  2239         SetIntValueL( KShortcutKeyHashCmd, iAllPreferences.iShortcutKeyHashCmd );
       
  2240         }
       
  2241     }
       
  2242 
       
  2243 
       
  2244 // ----------------------------------------------------------------------------
       
  2245 // CBrowserPreferences::SetURLSuffixList
       
  2246 // ----------------------------------------------------------------------------
       
  2247 //
       
  2248 void CBrowserPreferences::SetURLSuffixList( HBufC* aSetting )
       
  2249     {
       
  2250     LOG_ENTERFN("CBrowserPreferences::SetUpdateHoursDefined");
       
  2251 
       
  2252     SetStringValueL ( KBrowserUrlSuffix, aSetting->Des() );
       
  2253 
       
  2254     TPtr ptr = iAllPreferences.iUrlSuffixList->Des();
       
  2255     ptr.Copy( aSetting->Des() );
       
  2256     }
       
  2257 
       
  2258 // End of File