browserui/browser/SettingsSrc/SettingsContainer.cpp
changeset 10 57d5b8e231c4
parent 0 84ad3b177aa3
child 18 4530440261a8
equal deleted inserted replaced
0:84ad3b177aa3 10:57d5b8e231c4
    79 // CONSTANTS
    79 // CONSTANTS
    80 const TInt KSettingCategoryMaxLength = 50;
    80 const TInt KSettingCategoryMaxLength = 50;
    81 _LIT( KSettingsCategoryListBoxItemNoIcon, " " );
    81 _LIT( KSettingsCategoryListBoxItemNoIcon, " " );
    82 const TInt KDoesntExist = -1;
    82 const TInt KDoesntExist = -1;
    83 const TInt KGranularity = 1;
    83 const TInt KGranularity = 1;
       
    84 const TInt KMaxTitleLength = 512;
    84 
    85 
    85 
    86 
    86 _LIT( KWmlSettingsListBoxItemPrefix, " \t" );
    87 _LIT( KWmlSettingsListBoxItemPrefix, " \t" );
    87 _LIT( KWmlSettingsListBoxItemPostfix, "\t\t" );
    88 _LIT( KWmlSettingsListBoxItemPostfix, "\t\t" );
    88 
    89 
   416     // Downloads open settings 
   417     // Downloads open settings 
   417     if( PROGRESSIVE_DOWNLOAD )
   418     if( PROGRESSIVE_DOWNLOAD )
   418     	{
   419     	{
   419     	AppendDownloadsOpenL( itemArray, itemText );
   420     	AppendDownloadsOpenL( itemArray, itemText );
   420     	}
   421     	}
       
   422     
       
   423     if( ApiProvider().Preferences().SearchFeature() )
       
   424     	{
       
   425     	AppendSearchProviderL( itemArray, itemText );
       
   426     	}
   421 
   427 
   422     RestoreListBoxIndexL();
   428     RestoreListBoxIndexL();
   423     iSettingListBox->DrawNow();
   429     iSettingListBox->DrawNow();
   424     ActivateL();
   430     ActivateL();
   425     }
   431     }
   684         {
   690         {
   685         case EAlwaysAsk:
   691         case EAlwaysAsk:
   686         	{
   692         	{
   687 		    CreateItemFromTwoStringsL( 
   693 		    CreateItemFromTwoStringsL( 
   688 		    R_WMLBROWSER_SETTINGS_DEFAULT_AP, 
   694 		    R_WMLBROWSER_SETTINGS_DEFAULT_AP, 
   689 		    R_WML_SETTINGS_ACCESS_POINT_ALWAYS_ASK, 
   695 		    R_WML_SETTINGS_ACCESS_POINT_ASK_WHEN_NEEDED, 
   690 		    aItemText );
   696 		    aItemText );
   691 		        
   697 		        
   692 		    break;	
   698 		    break;	
   693         	}
   699         	}
   694         	
   700         	
   720         			cmManager.Close();
   726         			cmManager.Close();
   721         			break;
   727         			break;
   722                     }   
   728                     }   
   723                 }
   729                 }
   724             
   730             
   725             HBufC* name = iCoeEnv->AllocReadResourceLC( R_WML_SETTINGS_ACCESS_POINT_ALWAYS_ASK );
   731             HBufC* name = iCoeEnv->AllocReadResourceLC( R_WML_SETTINGS_ACCESS_POINT_ASK_WHEN_NEEDED );
   726             aItemText.Append( *name );
   732             aItemText.Append( *name );
   727             CleanupStack::PopAndDestroy(); // name
   733             CleanupStack::PopAndDestroy(); // name
   728                 
   734                 
   729             ApiProvider().Preferences().SetAccessPointSelectionModeL( EAlwaysAsk );
   735             ApiProvider().Preferences().SetAccessPointSelectionModeL( EAlwaysAsk );
   730 		    cmManager.Close();
   736 		    cmManager.Close();
   752                 aItemText.Append( name );
   758                 aItemText.Append( name );
   753                 CleanupStack::PopAndDestroy();  // au
   759                 CleanupStack::PopAndDestroy();  // au
   754                 }
   760                 }
   755             else
   761             else
   756                 {
   762                 {
   757                 HBufC* name = iCoeEnv->AllocReadResourceLC( R_WML_SETTINGS_ACCESS_POINT_ALWAYS_ASK );
   763                 HBufC* name = iCoeEnv->AllocReadResourceLC( R_WML_SETTINGS_ACCESS_POINT_ASK_WHEN_NEEDED );
   758                 aItemText.Append( *name );
   764                 aItemText.Append( *name );
   759                 CleanupStack::PopAndDestroy(); // name
   765                 CleanupStack::PopAndDestroy(); // name
   760                 
   766                 
   761                 ApiProvider().Preferences().SetAccessPointSelectionModeL( EAlwaysAsk  );
   767                 ApiProvider().Preferences().SetAccessPointSelectionModeL( EAlwaysAsk  );
   762                 }
   768                 }
  1085         aItemText );
  1091         aItemText );
  1086     aItemArray->AppendL( aItemText );
  1092     aItemArray->AppendL( aItemText );
  1087     iSettingIndex->AppendL( EWmlSettingsDownloadsOpen );
  1093     iSettingIndex->AppendL( EWmlSettingsDownloadsOpen );
  1088     }
  1094     }
  1089 
  1095 
       
  1096 
       
  1097 
       
  1098 // -----------------------------------------------------------------------------
       
  1099 // CSettingsContainer::AppendSearchProviderL
       
  1100 // -----------------------------------------------------------------------------
       
  1101 void CSettingsContainer::AppendSearchProviderL(
       
  1102                                                       CDesCArray*& aItemArray,
       
  1103                                                       TBuf<KWmlSettingsItemMaxLength>& aItemText)
       
  1104 	{
       
  1105 	aItemText.Zero();
       
  1106     aItemText.Append( KWmlSettingsListBoxItemPrefix );
       
  1107     HBufC* settingTitle = iCoeEnv->AllocReadResourceLC( R_BROWSERS_SETT_WEB_SEARCH_PROVIDER );
       
  1108     aItemText.Append( *settingTitle );
       
  1109     CleanupStack::PopAndDestroy(); // settingTitle
       
  1110     aItemText.Append( KWmlSettingsListBoxItemPostfix );
       
  1111     
       
  1112     HBufC* searchProvider = HBufC::NewLC( KMaxTitleLength );
       
  1113     TPtr searchProviderPtr = searchProvider->Des();
       
  1114     
       
  1115     ApiProvider().Preferences().GetStringValueL( KBrowserSearchProviderTitle,
       
  1116             KMaxTitleLength , searchProviderPtr);
       
  1117     
       
  1118     if(searchProvider->Compare(KNullDesC()) == 0)
       
  1119     	{
       
  1120     	CleanupStack::PopAndDestroy(searchProvider);
       
  1121     	searchProvider = iCoeEnv->AllocReadResourceLC( R_IS_LABEL_NOT_SELECTED );
       
  1122     	}
       
  1123     
       
  1124     aItemText.Append( *searchProvider );
       
  1125     CleanupStack::PopAndDestroy( searchProvider );
       
  1126     
       
  1127     aItemArray->AppendL( aItemText );
       
  1128     iSettingIndex->AppendL( EWmlSettingsSearchProvider );
       
  1129 	}
  1090 
  1130 
  1091 // -----------------------------------------------------------------------------
  1131 // -----------------------------------------------------------------------------
  1092 // CSettingsContainer::AppendAutoLoadContentL
  1132 // CSettingsContainer::AppendAutoLoadContentL
  1093 // -----------------------------------------------------------------------------
  1133 // -----------------------------------------------------------------------------
  1094 //
  1134 //
  2513                   1 - value );
  2553                   1 - value );
  2514             preferences.SetHttpSecurityWarningsL( 1 - value ); // show=1, hide=0 in preferences
  2554             preferences.SetHttpSecurityWarningsL( 1 - value ); // show=1, hide=0 in preferences
  2515             DisplayGeneralSettingsL();
  2555             DisplayGeneralSettingsL();
  2516             break;
  2556             break;
  2517     		}
  2557     		}
       
  2558     		
       
  2559         case EWmlSettingsSearchProvider:
       
  2560         	{
       
  2561  			RunSearchSettingsL();
       
  2562         	break;
       
  2563         	}
  2518 
  2564 
  2519 
  2565 
  2520 
  2566 
  2521     	case EWmlSettingsIMEINotification:
  2567     	case EWmlSettingsIMEINotification:
  2522     		{
  2568     		{
  3250             	case EWmlSettingsShortCutKey8Cmd:
  3296             	case EWmlSettingsShortCutKey8Cmd:
  3251             	case EWmlSettingsShortCutKey9Cmd:
  3297             	case EWmlSettingsShortCutKey9Cmd:
  3252             	case EWmlSettingsShortCutKey0Cmd:
  3298             	case EWmlSettingsShortCutKey0Cmd:
  3253             	case EWmlSettingsShortCutKeyStarCmd:
  3299             	case EWmlSettingsShortCutKeyStarCmd:
  3254             	case EWmlSettingsShortCutKeyHashCmd:
  3300             	case EWmlSettingsShortCutKeyHashCmd:
       
  3301             	case EWmlSettingsSearchProvider:
  3255                 {
  3302                 {
  3256                 	ChangeItemL( ETrue );
  3303                 	ChangeItemL( ETrue );
  3257                     ret = EKeyWasConsumed;
  3304                     ret = EKeyWasConsumed;
  3258                     break;
  3305                     break;
  3259                 }
  3306                 }
  3279         ret = iSettingListBox->OfferKeyEventL( keyEvent, aType );
  3326         ret = iSettingListBox->OfferKeyEventL( keyEvent, aType );
  3280         }
  3327         }
  3281     return ret;
  3328     return ret;
  3282     }
  3329     }
  3283 
  3330 
       
  3331 
       
  3332 // -----------------------------------------------------------------------------
       
  3333 // CSettingsContainer::HandleListBoxEventL
       
  3334 // -----------------------------------------------------------------------------
       
  3335 //
  3284 void CSettingsContainer::HandleListBoxEventL(CEikListBox* aListBox,TListBoxEvent aEventType)
  3336 void CSettingsContainer::HandleListBoxEventL(CEikListBox* aListBox,TListBoxEvent aEventType)
  3285     {
  3337     {
  3286     if (iPenEnabled)
  3338     if (iPenEnabled)
  3287         {
  3339         {
  3288         if (iSettingListBox && aListBox == iSettingListBox)
  3340         if (iSettingListBox && aListBox == iSettingListBox)
  3307                 }
  3359                 }
  3308             }
  3360             }
  3309         }
  3361         }
  3310     }
  3362     }
  3311 
  3363 
       
  3364 
       
  3365 // -----------------------------------------------------------------------------
       
  3366 // CSettingsContainer::HandleGainingForegroundL
       
  3367 // -----------------------------------------------------------------------------
       
  3368 //
       
  3369 void CSettingsContainer::HandleGainingForegroundL()
       
  3370 	{
       
  3371 	switch(iCurrentSettingCategory)
       
  3372 		{
       
  3373 		case EGeneral:
       
  3374 			DisplayGeneralSettingsL();
       
  3375 			break;
       
  3376 		default: // do nothing
       
  3377 			break;
       
  3378 		}
       
  3379 	}
  3312 
  3380 
  3313 // -----------------------------------------------------------------------------
  3381 // -----------------------------------------------------------------------------
  3314 // CSettingsContainer::CreateItemFromTwoStringsL
  3382 // CSettingsContainer::CreateItemFromTwoStringsL
  3315 // -----------------------------------------------------------------------------
  3383 // -----------------------------------------------------------------------------
  3316 //
  3384 //
  3642         {
  3710         {
  3643         id =  KWmlNoDefaultAccessPoint;
  3711         id =  KWmlNoDefaultAccessPoint;
  3644         }
  3712         }
  3645     }
  3713     }
  3646 
  3714 
       
  3715 // -----------------------------------------------------------------------------
       
  3716 // CSettingsContainer::RunSearchSettingsL
       
  3717 // -----------------------------------------------------------------------------
       
  3718 //
       
  3719 void CSettingsContainer::RunSearchSettingsL()
       
  3720     {
       
  3721     // Get Search application UID from CenRep 
       
  3722     TInt id = ApiProvider().Preferences().GetIntValue( KBrowserSearchAppUid );
       
  3723     TUid searchAppId( TUid::Uid( id ) );
       
  3724     id = ApiProvider().Preferences().GetIntValue( KBrowserSearchProviderSettingViewId );
       
  3725     TUid settingViewId( TUid::Uid( id ) );
       
  3726     TVwsViewId viewToOpen(searchAppId, settingViewId);
       
  3727     CBrowserAppUi::Static()->ActivateViewL(viewToOpen);
       
  3728     } 
       
  3729 
  3647 // End of File
  3730 // End of File