javamanager/javasettings/appmngrplugin/src/appmngr2midletsettingsutil.cpp
branchRCL_3
changeset 19 04becd199f91
child 34 71c436fe3ce0
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2008 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 "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:  MidletAppInfo implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "appmngr2midletsettingsutil.h"
       
    20 
       
    21 #include "javacommonutils.h"
       
    22 #include "securitystoragedatadefs.h"
       
    23 #include <StringLoader.h>                       // StringLoader
       
    24 #include <javaapplicationsettings.rsg>                   // Midlet resource IDs
       
    25 #include <cmmanager.rsg>                   // Midlet resource IDs
       
    26 #include "connectionmanager.h"
       
    27 #include <algorithm>
       
    28 
       
    29 #include "appmngr2midletconstants.h"
       
    30 
       
    31 const wchar_t* const ON_SCREEN_KEYPAD_SETTINGS = L"On screen keypad";
       
    32 const wchar_t* const SECURITY_WARNINGS_SETTINGS = L"Security warnings";
       
    33 const wchar_t* const ACCESS_POINT_SETTINGS = L"Access Point";
       
    34 
       
    35 using namespace std;
       
    36 using namespace java::util;
       
    37 
       
    38 // ======== MEMBER FUNCTIONS ========
       
    39 LocalizedString::LocalizedString(const std::wstring& aId,const std::wstring& aValue)
       
    40         : iId(aId), iValue(aValue), iIndex(-1)
       
    41 {
       
    42 }
       
    43 
       
    44 LocalizedString::LocalizedString(const std::wstring& aId,const std::wstring& aValue, int aIndex)
       
    45         : iId(aId), iValue(aValue), iIndex(aIndex)
       
    46 {
       
    47 }
       
    48 
       
    49 LocalizedString::LocalizedString(TUint aId,const std::wstring& aValue)
       
    50         : iValue(aValue),iIndex(-1)
       
    51 {
       
    52     iId = JavaCommonUtils::intToWstring(aId);
       
    53 }
       
    54 
       
    55 LocalizedString& LocalizedString::operator=(const LocalizedString& aLocalizedString)
       
    56 {
       
    57     iId = aLocalizedString.iId;
       
    58     iValue = aLocalizedString.iValue;
       
    59     iIndex = aLocalizedString.iIndex;
       
    60     return *this;
       
    61 }
       
    62 
       
    63 LocalizedString::LocalizedString(const LocalizedString& aLocalizedString)
       
    64 {
       
    65     iId = aLocalizedString.iId;
       
    66     iValue = aLocalizedString.iValue;
       
    67     iIndex = aLocalizedString.iIndex;
       
    68 }
       
    69 
       
    70 LocalizedString::LocalizedString()
       
    71         : iId(L""), iValue(L""), iIndex(-1)
       
    72 {
       
    73 }
       
    74 
       
    75 const std::wstring& LocalizedString::getId() const
       
    76 {
       
    77     return iId;
       
    78 }
       
    79 
       
    80 int LocalizedString::getIndex() const
       
    81 {
       
    82     return iIndex;
       
    83 }
       
    84 
       
    85 const std::wstring& LocalizedString::getValue() const
       
    86 {
       
    87     return iValue;
       
    88 }
       
    89 
       
    90 ListItem::ListItem(const LocalizedString& aName, const vector<LocalizedString>& aPossibleValues)
       
    91         : iName(aName), iPossibleValues(aPossibleValues), iCurrentValueIndex(0), iEnabled(true), iIndex(-1)
       
    92 {
       
    93 }
       
    94 
       
    95 ListItem::ListItem(const LocalizedString& aName, const vector<LocalizedString>& aPossibleValues, bool aEnabled)
       
    96         : iName(aName), iPossibleValues(aPossibleValues), iCurrentValueIndex(0), iEnabled(aEnabled), iIndex(-1)
       
    97 {
       
    98 }
       
    99 
       
   100 ListItem::ListItem(const LocalizedString& aName,
       
   101                    const vector<LocalizedString>& aPossibleValues,
       
   102                    bool aEnabled,
       
   103                    int aCurrentValueIndex)
       
   104         : iName(aName), iPossibleValues(aPossibleValues), iCurrentValueIndex(aCurrentValueIndex), iEnabled(aEnabled), iIndex(-1)
       
   105 {
       
   106 }
       
   107 
       
   108 ListItem::ListItem(const LocalizedString& aName,
       
   109                    const vector<LocalizedString>& aPossibleValues,
       
   110                    bool aEnabled,
       
   111                    int aCurrentValueIndex,
       
   112                    int aIndex)
       
   113         : iName(aName), iPossibleValues(aPossibleValues), iCurrentValueIndex(aCurrentValueIndex), iEnabled(aEnabled), iIndex(aIndex)
       
   114 {
       
   115 }
       
   116 
       
   117 ListItem& ListItem::operator=(const ListItem& aListItem)
       
   118 {
       
   119     iName = aListItem.iName;
       
   120     iPossibleValues = aListItem.iPossibleValues;
       
   121     iCurrentValueIndex = aListItem.iCurrentValueIndex;
       
   122     iEnabled = aListItem.iEnabled;
       
   123     iIndex = aListItem.iIndex;
       
   124     return *this;
       
   125 }
       
   126 
       
   127 ListItem::ListItem(const ListItem& aListItem)
       
   128 {
       
   129     iName = aListItem.iName;
       
   130     iPossibleValues = aListItem.iPossibleValues;
       
   131     iCurrentValueIndex = aListItem.iCurrentValueIndex;
       
   132     iEnabled = aListItem.iEnabled;
       
   133     iIndex = aListItem.iIndex;
       
   134 }
       
   135 
       
   136 ListItem::ListItem()
       
   137         : /*iName(LocalizedString()),*/ iCurrentValueIndex(-1), iIndex(-1)
       
   138 {
       
   139 }
       
   140 
       
   141 const LocalizedString& ListItem::getName() const
       
   142 {
       
   143     return iName;
       
   144 }
       
   145 
       
   146 const std::vector<LocalizedString>& ListItem::getValues() const
       
   147 {
       
   148     return iPossibleValues;
       
   149 }
       
   150 
       
   151 const LocalizedString& ListItem::getValue() const
       
   152 {
       
   153     return iPossibleValues[iCurrentValueIndex];
       
   154 }
       
   155 
       
   156 const LocalizedString& ListItem::getValue(int aValueIndex) const
       
   157 {
       
   158     return iPossibleValues[aValueIndex];
       
   159 }
       
   160 
       
   161 void ListItem::setCurrentValue(int aCurrentValueIndex)
       
   162 {
       
   163     iCurrentValueIndex = aCurrentValueIndex;
       
   164 }
       
   165 
       
   166 int ListItem::getCurrentValue() const
       
   167 {
       
   168     return iCurrentValueIndex;
       
   169 }
       
   170 
       
   171 int ListItem::getIndex() const
       
   172 {
       
   173     return iIndex;
       
   174 }
       
   175 
       
   176 bool ListItem::getEnabled() const
       
   177 {
       
   178     return iEnabled;
       
   179 }
       
   180 
       
   181 void ListItem::setEnabled(bool aEnabled)
       
   182 {
       
   183     iEnabled = aEnabled;
       
   184 }
       
   185 
       
   186 MidletSuiteSecuritySettings::MidletSuiteSecuritySettings(const std::wstring& aSettingsName,
       
   187         const std::wstring& aCurrentInteractionMode,
       
   188         const std::wstring& aAllowedInteractionModes)
       
   189         : iSettingsName(aSettingsName), iCurrentInteractionMode(aCurrentInteractionMode), iAllowedInteractionModes(aAllowedInteractionModes)
       
   190 {
       
   191 }
       
   192 
       
   193 MidletSuiteSecuritySettings& MidletSuiteSecuritySettings::operator=(const MidletSuiteSecuritySettings& aMidletSuiteSecuritySettings)
       
   194 {
       
   195     iSettingsName = aMidletSuiteSecuritySettings.iSettingsName;
       
   196     iCurrentInteractionMode = aMidletSuiteSecuritySettings.iCurrentInteractionMode;
       
   197     iAllowedInteractionModes = aMidletSuiteSecuritySettings.iAllowedInteractionModes;
       
   198     return *this;
       
   199 }
       
   200 
       
   201 MidletSuiteSecuritySettings::MidletSuiteSecuritySettings(const MidletSuiteSecuritySettings& aMidletSuiteSecuritySettings)
       
   202 {
       
   203     iSettingsName = aMidletSuiteSecuritySettings.iSettingsName;
       
   204     iCurrentInteractionMode = aMidletSuiteSecuritySettings.iCurrentInteractionMode;
       
   205     iAllowedInteractionModes = aMidletSuiteSecuritySettings.iAllowedInteractionModes;
       
   206 }
       
   207 
       
   208 MidletSuiteSecuritySettings::MidletSuiteSecuritySettings()
       
   209         : iSettingsName(L""), iCurrentInteractionMode(L""), iAllowedInteractionModes(L"")
       
   210 {
       
   211 }
       
   212 
       
   213 const std::wstring MidletSuiteSecuritySettings::getName() const
       
   214 {
       
   215     return iSettingsName;
       
   216 }
       
   217 
       
   218 const std::wstring MidletSuiteSecuritySettings::getCurrentInteractionMode() const
       
   219 {
       
   220     return iCurrentInteractionMode;
       
   221 }
       
   222 
       
   223 const std::wstring MidletSuiteSecuritySettings::getAllowedInteractionModes() const
       
   224 {
       
   225     return iAllowedInteractionModes;
       
   226 }
       
   227 
       
   228 CAppMngr2SuiteSnapItem::CAppMngr2SuiteSnapItem()
       
   229         : iId(0), iName(L"")
       
   230 {
       
   231 }
       
   232 
       
   233 CAppMngr2SuiteSnapItem::CAppMngr2SuiteSnapItem(const CAppMngr2SuiteSnapItem& aSnap)
       
   234 {
       
   235     iId = aSnap.iId;
       
   236     iName = aSnap.iName;
       
   237 }
       
   238 
       
   239 const ListItem AppMngr2MidletSettingsUtil::SettingsToListItem(MidletSuiteSecuritySettings aSettings, bool aSettingsEnabled)
       
   240 {
       
   241     // The allowed modes info is stored as a 4-bit constant:
       
   242     //    X(oneshot)X(session)X(blanket)X(no)
       
   243     // e.g. 1011 (=11) means that oneshot, blanket and no are allowed.
       
   244     // The following constants are used to encode/decode the allowed modes
       
   245     // into/from a 4-bit number
       
   246     TInt currentInteractionMode = JavaCommonUtils::wstringToInt(aSettings.getCurrentInteractionMode());
       
   247     TInt allowedInteractionModes = JavaCommonUtils::wstringToInt(aSettings.getAllowedInteractionModes());
       
   248     vector<LocalizedString> itemValues;
       
   249     int tmp = allowedInteractionModes & INTERACTION_MODE_ONESHOT;
       
   250     if (tmp > 0)
       
   251     {
       
   252         itemValues.push_back(LocalizedString(ONESHOT_INTERACTION_MODE,getLocalizedSettingsInteractionMode(INTERACTION_MODE_ONESHOT),ONESHOT_INTERACTION_MODE_DISPLAY_INDEX));
       
   253     }
       
   254     tmp = allowedInteractionModes & INTERACTION_MODE_SESSION;
       
   255     if (tmp > 0)
       
   256     {
       
   257         itemValues.push_back(LocalizedString(SESSION_INTERACTION_MODE,getLocalizedSettingsInteractionMode(INTERACTION_MODE_SESSION),SESSION_INTERACTION_MODE_DISPLAY_INDEX));
       
   258     }
       
   259     tmp = allowedInteractionModes & INTERACTION_MODE_BLANKET;
       
   260     if (tmp > 0)
       
   261     {
       
   262         itemValues.push_back(LocalizedString(BLANKET_INTERACTION_MODE,getLocalizedSettingsInteractionMode(INTERACTION_MODE_BLANKET), BLANKET_INTERACTION_MODE_DISPLAY_INDEX));
       
   263     }
       
   264     tmp = allowedInteractionModes & INTERACTION_MODE_DENIED;
       
   265     if (tmp > 0)
       
   266     {
       
   267         itemValues.push_back(LocalizedString(DENIED_INTERACTION_MODE,getLocalizedSettingsInteractionMode(INTERACTION_MODE_DENIED),DENIED_INTERACTION_MODE_DISPLAY_INDEX));
       
   268     }
       
   269     // sort the vector
       
   270     std::sort(itemValues.begin(), itemValues.end(), AscendingLocalizedStringSort());
       
   271     LocalizedString itemName = LocalizedString(aSettings.getName(), getLocalizedSettingsName(aSettings.getName()));
       
   272     return ListItem(itemName, itemValues, aSettingsEnabled, findItem(itemValues, aSettings.getCurrentInteractionMode()), getSettingsDisplayIndex(aSettings.getName()));
       
   273 }
       
   274 
       
   275 const MidletSuiteSecuritySettings AppMngr2MidletSettingsUtil::ListItemToSettings(const ListItem& aListItem)
       
   276 {
       
   277     return MidletSuiteSecuritySettings(aListItem.getName().getId(), aListItem.getValue().getId(), L"");
       
   278 }
       
   279 
       
   280 const ListItem AppMngr2MidletSettingsUtil::OnScreenKeypadToListItem(wstring aOnScreenKeypadValue, bool aOnScreenKeypadEnabled)
       
   281 {
       
   282     LocalizedString onScreenKeypadName = LocalizedString(ON_SCREEN_KEYPAD_SETTINGS,getLocalizedSettingsName(ON_SCREEN_KEYPAD_SETTINGS));
       
   283     vector<LocalizedString> onScreenKeypadValues;
       
   284     onScreenKeypadValues.push_back(LocalizedString(ON_SCREEN_KEYPAD_VALUE_NO,getLocalizedOnScreenKeypadValue(ON_SCREEN_KEYPAD_VALUE_NO), ON_SCREEN_KEYPAD_VALUE_NO_DISPLAY_INDEX));
       
   285     onScreenKeypadValues.push_back(LocalizedString(ON_SCREEN_KEYPAD_VALUE_GAMEACTIONS, getLocalizedOnScreenKeypadValue(ON_SCREEN_KEYPAD_VALUE_GAMEACTIONS), ON_SCREEN_KEYPAD_VALUE_GAMEACTIONS_DISPLAY_INDEX));
       
   286     onScreenKeypadValues.push_back(LocalizedString(ON_SCREEN_KEYPAD_VALUE_NAVIGATION,getLocalizedOnScreenKeypadValue(ON_SCREEN_KEYPAD_VALUE_NAVIGATION), ON_SCREEN_KEYPAD_VALUE_NAVIGATION_DISPLAY_INDEX));
       
   287     // sort the vector
       
   288     std::sort(onScreenKeypadValues.begin(), onScreenKeypadValues.end(), AscendingLocalizedStringSort());
       
   289     return ListItem(onScreenKeypadName, onScreenKeypadValues, aOnScreenKeypadEnabled, findItem(onScreenKeypadValues, aOnScreenKeypadValue));
       
   290 }
       
   291 
       
   292 const ListItem AppMngr2MidletSettingsUtil::SecurityWarningsModeToListItem(wstring aSecurityWarningsModeValue, bool aSecurityWarningsModeEnabled)
       
   293 {
       
   294     LocalizedString securityWarningsModeName = LocalizedString(SECURITY_WARNINGS_SETTINGS,getLocalizedSettingsName(SECURITY_WARNINGS_SETTINGS));
       
   295     vector<LocalizedString> securityWarningsModeValues;
       
   296     securityWarningsModeValues.push_back(LocalizedString(SECURITY_WARNINGS_DEFAULT_MODE, getLocalizedSecurityWarningsModeValue(SECURITY_WARNINGS_DEFAULT_MODE), SECURITY_WARNINGS_DEFAULT_MODE_DISPLAY_INDEX));
       
   297     securityWarningsModeValues.push_back(LocalizedString(SECURITY_WARNINGS_USER_DEFINED_MODE,getLocalizedSecurityWarningsModeValue(SECURITY_WARNINGS_USER_DEFINED_MODE), SECURITY_WARNINGS_USER_DEFINED_MODE_DISPLAY_INDEX));
       
   298     // sort the vector
       
   299     std::sort(securityWarningsModeValues.begin(), securityWarningsModeValues.end(), AscendingLocalizedStringSort());
       
   300     return ListItem(securityWarningsModeName, securityWarningsModeValues, aSecurityWarningsModeEnabled, findItem(securityWarningsModeValues, aSecurityWarningsModeValue));
       
   301 }
       
   302 
       
   303 const ListItem AppMngr2MidletSettingsUtil::SnapToListItem(CAppMngr2SuiteSnapItem aSnap, bool aSnapEnabled)
       
   304 {
       
   305     LocalizedString snapName = LocalizedString(ACCESS_POINT_SETTINGS,getLocalizedSettingsName(ACCESS_POINT_SETTINGS));
       
   306     vector<LocalizedString> snapValues;
       
   307     snapValues.push_back(LocalizedString(aSnap.iId, aSnap.iName));
       
   308     return ListItem(snapName, snapValues, aSnapEnabled);
       
   309 }
       
   310 
       
   311 int AppMngr2MidletSettingsUtil::getSettingsDisplayIndex(std::wstring aSettingsName)
       
   312 {
       
   313     if (aSettingsName == ON_SCREEN_KEYPAD_SETTINGS)
       
   314     {
       
   315         return ON_SCREEN_KEYPAD_SETTINGS_DISPLAY_INDEX;
       
   316     }
       
   317     if (aSettingsName == SECURITY_WARNINGS_SETTINGS)
       
   318     {
       
   319         return SECURITY_WARNINGS_SETTINGS_DISPLAY_INDEX;
       
   320     }
       
   321     if (aSettingsName == NET_ACCESS_SETTINGS)
       
   322     {
       
   323         return NET_ACCESS_SETTINGS_DISPLAY_INDEX;
       
   324     }
       
   325     if (aSettingsName == LOW_LEVEL_NET_ACCESS_SETTINGS)
       
   326     {
       
   327         return LOW_LEVEL_NET_ACCESS_SETTINGS_DISPLAY_INDEX;
       
   328     }
       
   329     if (aSettingsName == CALL_CONTROL_SETTINGS)
       
   330     {
       
   331         return CALL_CONTROL_SETTINGS_DISPLAY_INDEX;
       
   332     }
       
   333     if (aSettingsName == MESSAGING_SETTINGS)
       
   334     {
       
   335         return MESSAGING_SETTINGS_DISPLAY_INDEX;
       
   336     }
       
   337     if (aSettingsName == RESTRICTED_MESSAGING_SETTINGS)
       
   338     {
       
   339         return RESTRICTED_MESSAGING_SETTINGS_DISPLAY_INDEX;
       
   340     }
       
   341     if (aSettingsName == APPLICATION_AUTO_INVOCATION_SETTINGS)
       
   342     {
       
   343         return APPLICATION_AUTO_INVOCATION_SETTINGS_DISPLAY_INDEX;
       
   344     }
       
   345     if (aSettingsName == LOCAL_CONNECTIVITY_SETTINGS)
       
   346     {
       
   347         return LOCAL_CONNECTIVITY_SETTINGS_DISPLAY_INDEX;
       
   348     }
       
   349     if (aSettingsName == MULTIMEDIA_RECORDING_SETTINGS)
       
   350     {
       
   351         return MULTIMEDIA_RECORDING_SETTINGS_DISPLAY_INDEX;
       
   352     }
       
   353     if (aSettingsName == READ_USER_DATA_ACCESS_SETTINGS)
       
   354     {
       
   355         return READ_USER_DATA_ACCESS_SETTINGS_DISPLAY_INDEX;
       
   356     }
       
   357     if (aSettingsName == WRITE_USER_DATA_ACCESS_SETTINGS)
       
   358     {
       
   359         return WRITE_USER_DATA_ACCESS_SETTINGS_DISPLAY_INDEX;
       
   360     }
       
   361     if (aSettingsName == LOCATION_SETTINGS)
       
   362     {
       
   363         return LOCATION_SETTINGS_DISPLAY_INDEX;
       
   364     }
       
   365     if (aSettingsName == LANDMARK_SETTINGS)
       
   366     {
       
   367         return LANDMARK_SETTINGS_DISPLAY_INDEX;
       
   368     }
       
   369     if (aSettingsName == AUTHENTICATION_SETTINGS)
       
   370     {
       
   371         return AUTHENTICATION_SETTINGS_DISPLAY_INDEX;
       
   372     }
       
   373     if (aSettingsName == SMART_CARD_COMMUNICATION_SETTINGS)
       
   374     {
       
   375         return SMART_CARD_COMMUNICATION_SETTINGS_DISPLAY_INDEX;
       
   376     }
       
   377     if (aSettingsName == BROADCAST_SETTINGS)
       
   378     {
       
   379         return BROADCAST_SETTINGS_DISPLAY_INDEX;
       
   380     }
       
   381     if (aSettingsName == NFC_WRITE_ACCESS_SETTINGS)
       
   382     {
       
   383         return NFC_WRITE_ACCESS_SETTINGS_DISPLAY_INDEX;
       
   384     }
       
   385     return LAST_SETTINGS_DISPLAY_INDEX;
       
   386 }
       
   387 
       
   388 int AppMngr2MidletSettingsUtil::findItem(std::vector<LocalizedString> aListItems, std::wstring aListItemId)
       
   389 {
       
   390     for (int i=0; i<aListItems.size(); i++)
       
   391     {
       
   392         if (aListItems[i].getId() == aListItemId)
       
   393         {
       
   394             return i;
       
   395         }
       
   396     }
       
   397     return 0;
       
   398 }
       
   399 
       
   400 
       
   401 TInt AppMngr2MidletSettingsUtil::GetLocalizedSettingsName(wstring aSettingsName)
       
   402 {
       
   403     if (aSettingsName == ON_SCREEN_KEYPAD_SETTINGS)
       
   404     {
       
   405         return R_JAVA_SETTING_ON_SCREEN_KEYPAD_PAGE;
       
   406     }
       
   407     if (aSettingsName == SECURITY_WARNINGS_SETTINGS)
       
   408     {
       
   409         return R_JAVA_SETTING_SECURITY_WARNINGS_PAGE;
       
   410     }
       
   411     if (aSettingsName == NET_ACCESS_SETTINGS)
       
   412     {
       
   413         return R_JAVA_SETTING_NET_ACCESS_PAGE;
       
   414     }
       
   415     if (aSettingsName == LOW_LEVEL_NET_ACCESS_SETTINGS)
       
   416     {
       
   417         return R_JAVA_SETTING_LOW_LEVEL_NET_ACCESS_PAGE;
       
   418     }
       
   419     if (aSettingsName == CALL_CONTROL_SETTINGS)
       
   420     {
       
   421         return R_JAVA_SETTING_CALL_CONTROL_PAGE;
       
   422     }
       
   423     if (aSettingsName == MESSAGING_SETTINGS)
       
   424     {
       
   425         return R_JAVA_SETTING_MESSAGING_PAGE;
       
   426     }
       
   427     if (aSettingsName == RESTRICTED_MESSAGING_SETTINGS)
       
   428     {
       
   429         return R_JAVA_SETTING_RESTRICTED_MESSAGING_PAGE;
       
   430     }
       
   431     if (aSettingsName == APPLICATION_AUTO_INVOCATION_SETTINGS)
       
   432     {
       
   433         return R_JAVA_SETTING_APP_AUTO_INVOCAT_PAGE;
       
   434     }
       
   435     if (aSettingsName == LOCAL_CONNECTIVITY_SETTINGS)
       
   436     {
       
   437         return R_JAVA_SETTING_LOCAL_CONN_PAGE;
       
   438     }
       
   439     if (aSettingsName == MULTIMEDIA_RECORDING_SETTINGS)
       
   440     {
       
   441         return R_JAVA_SETTING_MM_RECORD_PAGE;
       
   442     }
       
   443     if (aSettingsName == READ_USER_DATA_ACCESS_SETTINGS)
       
   444     {
       
   445         return R_JAVA_SETTING_READ_DATA_PAGE;
       
   446     }
       
   447     if (aSettingsName == WRITE_USER_DATA_ACCESS_SETTINGS)
       
   448     {
       
   449         return R_JAVA_SETTING_WRITE_DATA_PAGE;
       
   450     }
       
   451     if (aSettingsName == LOCATION_SETTINGS)
       
   452     {
       
   453         return R_JAVA_SETTING_LOCATION_PAGE;
       
   454     }
       
   455     if (aSettingsName == LANDMARK_SETTINGS)
       
   456     {
       
   457         return R_JAVA_SETTING_LANDMARKS_PAGE;
       
   458     }
       
   459     if (aSettingsName == AUTHENTICATION_SETTINGS)
       
   460     {
       
   461         return R_JAVA_SETTING_AUTH_PAGE;
       
   462     }
       
   463     if (aSettingsName == SMART_CARD_COMMUNICATION_SETTINGS)
       
   464     {
       
   465         return R_JAVA_SETTING_SMARTCARD_PAGE;
       
   466     }
       
   467     if (aSettingsName == BROADCAST_SETTINGS)
       
   468     {
       
   469         return R_JAVA_SETTING_BROADCAST_PAGE;
       
   470     }
       
   471     if (aSettingsName == NFC_WRITE_ACCESS_SETTINGS)
       
   472     {
       
   473         return R_JAVA_SETTING_NFC_WRITE_ACCESS_PAGE;
       
   474     }
       
   475     return R_JAVA_SETTING_DEFAULT_PAGE;
       
   476 
       
   477 }
       
   478 
       
   479 const wstring AppMngr2MidletSettingsUtil::getLocalizedSettingsName(wstring aSettingsName)
       
   480 {
       
   481     HBufC* localizedName = NULL;
       
   482     if (aSettingsName == ACCESS_POINT_SETTINGS)
       
   483     {
       
   484         localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_NETWORK_DESTINATION);
       
   485     }
       
   486     else if (aSettingsName == ON_SCREEN_KEYPAD_SETTINGS)
       
   487     {
       
   488         localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_KEYPAD);
       
   489     }
       
   490     else if (aSettingsName == SECURITY_WARNINGS_SETTINGS)
       
   491     {
       
   492         localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_SECURITY_WARNINGS);
       
   493     }
       
   494     else if (aSettingsName == NET_ACCESS_SETTINGS)
       
   495     {
       
   496         localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_NET_ACCESS);
       
   497     }
       
   498     else if (aSettingsName == LOW_LEVEL_NET_ACCESS_SETTINGS)
       
   499     {
       
   500         localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_LOW_LEVEL_NET_ACCESS);
       
   501     }
       
   502     else if (aSettingsName == CALL_CONTROL_SETTINGS)
       
   503     {
       
   504         localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_RESTRICTED_CALL_CONTROL);
       
   505     }
       
   506     else if (aSettingsName == MESSAGING_SETTINGS)
       
   507     {
       
   508         localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_MESSAGING);
       
   509     }
       
   510     else if (aSettingsName == RESTRICTED_MESSAGING_SETTINGS)
       
   511     {
       
   512         localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_RESTRICTED_MESSAGING);
       
   513     }
       
   514     else if (aSettingsName == APPLICATION_AUTO_INVOCATION_SETTINGS)
       
   515     {
       
   516         localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_APP_AUTO_INVOCAT);
       
   517     }
       
   518     else if (aSettingsName == LOCAL_CONNECTIVITY_SETTINGS)
       
   519     {
       
   520         localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_LOCAL_CONN);
       
   521     }
       
   522     else if (aSettingsName == MULTIMEDIA_RECORDING_SETTINGS)
       
   523     {
       
   524         localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_MM_RECORD);
       
   525     }
       
   526     else if (aSettingsName == READ_USER_DATA_ACCESS_SETTINGS)
       
   527     {
       
   528         localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_READ_DATA);
       
   529     }
       
   530     else if (aSettingsName == WRITE_USER_DATA_ACCESS_SETTINGS)
       
   531     {
       
   532         localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_WRITE_DATA);
       
   533     }
       
   534     else if (aSettingsName == LOCATION_SETTINGS)
       
   535     {
       
   536         localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_LOCATION);
       
   537     }
       
   538     else if (aSettingsName == LANDMARK_SETTINGS)
       
   539     {
       
   540         localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_LANDMARKS);
       
   541     }
       
   542     else if (aSettingsName == AUTHENTICATION_SETTINGS)
       
   543     {
       
   544         localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_AUT);
       
   545     }
       
   546     else if (aSettingsName == SMART_CARD_COMMUNICATION_SETTINGS)
       
   547     {
       
   548         localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_SMARTCARD);
       
   549     }
       
   550     else if (aSettingsName == BROADCAST_SETTINGS)
       
   551     {
       
   552         localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_BROADCAST);
       
   553     }
       
   554     else if (aSettingsName == NFC_WRITE_ACCESS_SETTINGS)
       
   555     {
       
   556         localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_NFC_WRITE_ACCESS);
       
   557     }
       
   558     if (localizedName != NULL)
       
   559     {
       
   560         wstring ret = wstring((const wchar_t*)localizedName->Ptr(), localizedName->Length());
       
   561         CleanupStack::PopAndDestroy(localizedName);
       
   562         return ret;
       
   563     }
       
   564     else
       
   565     {
       
   566         return aSettingsName;
       
   567     }
       
   568 }
       
   569 
       
   570 const wstring AppMngr2MidletSettingsUtil::getLocalizedSettingsInteractionMode(int aInteractionMode)
       
   571 {
       
   572     HBufC* localizedName = NULL;
       
   573     switch (aInteractionMode)
       
   574     {
       
   575     case INTERACTION_MODE_BLANKET:
       
   576         localizedName = StringLoader::LoadLC(R_JAVA_SETTING_VALUE_BLANK);
       
   577         break;
       
   578     case INTERACTION_MODE_SESSION:
       
   579         localizedName = StringLoader::LoadLC(R_JAVA_SETTING_VALUE_SESSION);
       
   580         break;
       
   581     case INTERACTION_MODE_ONESHOT:
       
   582         localizedName = StringLoader::LoadLC(R_JAVA_SETTING_VALUE_ONESHOT);
       
   583         break;
       
   584     case INTERACTION_MODE_DENIED:
       
   585         localizedName = StringLoader::LoadLC(R_JAVA_SETTING_VALUE_NO);
       
   586         break;
       
   587     default:
       
   588         return L"";
       
   589     }
       
   590     wstring ret = wstring((const wchar_t*)localizedName->Ptr(), localizedName->Length());
       
   591     CleanupStack::PopAndDestroy(localizedName);
       
   592     return ret;
       
   593 }
       
   594 
       
   595 const wstring AppMngr2MidletSettingsUtil::getLocalizedSecurityWarningsModeValue(wstring aSecurityWarningsModeValue)
       
   596 {
       
   597     HBufC* localizedName = NULL;
       
   598     if (aSecurityWarningsModeValue == SECURITY_WARNINGS_DEFAULT_MODE)
       
   599     {
       
   600         localizedName = StringLoader::LoadLC(R_JAVA_SECURITY_WARNINGS_SETTING_VALUE_DEFAULT);
       
   601     }
       
   602     else if (aSecurityWarningsModeValue == SECURITY_WARNINGS_USER_DEFINED_MODE)
       
   603     {
       
   604         localizedName = StringLoader::LoadLC(R_JAVA_SECURITY_WARNINGS_SETTING_VALUE_USER_DEFINED);
       
   605     }
       
   606     else
       
   607     {
       
   608         return L"";
       
   609     }
       
   610     wstring ret = wstring((const wchar_t*)localizedName->Ptr(), localizedName->Length());
       
   611     CleanupStack::PopAndDestroy(localizedName);
       
   612     return ret;
       
   613 }
       
   614 
       
   615 const wstring AppMngr2MidletSettingsUtil::getLocalizedOnScreenKeypadValue(wstring aOnScreenKeypadValue)
       
   616 {
       
   617     HBufC* localizedName = NULL;
       
   618     if (aOnScreenKeypadValue == ON_SCREEN_KEYPAD_VALUE_NO)
       
   619     {
       
   620         localizedName = StringLoader::LoadLC(R_JAVA_KEYPAD_SETTING_VALUE_NO);
       
   621     }
       
   622     else if (aOnScreenKeypadValue == ON_SCREEN_KEYPAD_VALUE_GAMEACTIONS)
       
   623     {
       
   624         localizedName = StringLoader::LoadLC(R_JAVA_KEYPAD_SETTING_VALUE_GAME);
       
   625     }
       
   626     else if (aOnScreenKeypadValue == ON_SCREEN_KEYPAD_VALUE_NAVIGATION)
       
   627     {
       
   628         localizedName = StringLoader::LoadLC(R_JAVA_KEYPAD_SETTING_VALUE_NAVIGATION);
       
   629     }
       
   630     else
       
   631     {
       
   632         return L"";
       
   633     }
       
   634     wstring ret = wstring((const wchar_t*)localizedName->Ptr(), localizedName->Length());
       
   635     CleanupStack::PopAndDestroy(localizedName);
       
   636     return ret;
       
   637 }