|
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 if (aSettingsName == URL_START_SETTINGS) |
|
386 { |
|
387 return URL_START_SETTINGS_DISPLAY_INDEX; |
|
388 } |
|
389 return LAST_SETTINGS_DISPLAY_INDEX; |
|
390 } |
|
391 |
|
392 int AppMngr2MidletSettingsUtil::findItem(std::vector<LocalizedString> aListItems, std::wstring aListItemId) |
|
393 { |
|
394 for (int i=0; i<aListItems.size(); i++) |
|
395 { |
|
396 if (aListItems[i].getId() == aListItemId) |
|
397 { |
|
398 return i; |
|
399 } |
|
400 } |
|
401 return 0; |
|
402 } |
|
403 |
|
404 |
|
405 TInt AppMngr2MidletSettingsUtil::GetLocalizedSettingsName(wstring aSettingsName) |
|
406 { |
|
407 if (aSettingsName == ON_SCREEN_KEYPAD_SETTINGS) |
|
408 { |
|
409 return R_JAVA_SETTING_ON_SCREEN_KEYPAD_PAGE; |
|
410 } |
|
411 if (aSettingsName == SECURITY_WARNINGS_SETTINGS) |
|
412 { |
|
413 return R_JAVA_SETTING_SECURITY_WARNINGS_PAGE; |
|
414 } |
|
415 if (aSettingsName == NET_ACCESS_SETTINGS) |
|
416 { |
|
417 return R_JAVA_SETTING_NET_ACCESS_PAGE; |
|
418 } |
|
419 if (aSettingsName == LOW_LEVEL_NET_ACCESS_SETTINGS) |
|
420 { |
|
421 return R_JAVA_SETTING_LOW_LEVEL_NET_ACCESS_PAGE; |
|
422 } |
|
423 if (aSettingsName == CALL_CONTROL_SETTINGS) |
|
424 { |
|
425 return R_JAVA_SETTING_CALL_CONTROL_PAGE; |
|
426 } |
|
427 if (aSettingsName == MESSAGING_SETTINGS) |
|
428 { |
|
429 return R_JAVA_SETTING_MESSAGING_PAGE; |
|
430 } |
|
431 if (aSettingsName == RESTRICTED_MESSAGING_SETTINGS) |
|
432 { |
|
433 return R_JAVA_SETTING_RESTRICTED_MESSAGING_PAGE; |
|
434 } |
|
435 if (aSettingsName == APPLICATION_AUTO_INVOCATION_SETTINGS) |
|
436 { |
|
437 return R_JAVA_SETTING_APP_AUTO_INVOCAT_PAGE; |
|
438 } |
|
439 if (aSettingsName == LOCAL_CONNECTIVITY_SETTINGS) |
|
440 { |
|
441 return R_JAVA_SETTING_LOCAL_CONN_PAGE; |
|
442 } |
|
443 if (aSettingsName == MULTIMEDIA_RECORDING_SETTINGS) |
|
444 { |
|
445 return R_JAVA_SETTING_MM_RECORD_PAGE; |
|
446 } |
|
447 if (aSettingsName == READ_USER_DATA_ACCESS_SETTINGS) |
|
448 { |
|
449 return R_JAVA_SETTING_READ_DATA_PAGE; |
|
450 } |
|
451 if (aSettingsName == WRITE_USER_DATA_ACCESS_SETTINGS) |
|
452 { |
|
453 return R_JAVA_SETTING_WRITE_DATA_PAGE; |
|
454 } |
|
455 if (aSettingsName == LOCATION_SETTINGS) |
|
456 { |
|
457 return R_JAVA_SETTING_LOCATION_PAGE; |
|
458 } |
|
459 if (aSettingsName == LANDMARK_SETTINGS) |
|
460 { |
|
461 return R_JAVA_SETTING_LANDMARKS_PAGE; |
|
462 } |
|
463 if (aSettingsName == AUTHENTICATION_SETTINGS) |
|
464 { |
|
465 return R_JAVA_SETTING_AUTH_PAGE; |
|
466 } |
|
467 if (aSettingsName == SMART_CARD_COMMUNICATION_SETTINGS) |
|
468 { |
|
469 return R_JAVA_SETTING_SMARTCARD_PAGE; |
|
470 } |
|
471 if (aSettingsName == BROADCAST_SETTINGS) |
|
472 { |
|
473 return R_JAVA_SETTING_BROADCAST_PAGE; |
|
474 } |
|
475 if (aSettingsName == NFC_WRITE_ACCESS_SETTINGS) |
|
476 { |
|
477 return R_JAVA_SETTING_NFC_WRITE_ACCESS_PAGE; |
|
478 } |
|
479 if (aSettingsName == URL_START_SETTINGS) |
|
480 { |
|
481 return R_JAVA_SETTING_URL_START_PAGE; |
|
482 } |
|
483 return R_JAVA_SETTING_DEFAULT_PAGE; |
|
484 |
|
485 } |
|
486 |
|
487 const wstring AppMngr2MidletSettingsUtil::getLocalizedSettingsName(wstring aSettingsName) |
|
488 { |
|
489 wstring ret = aSettingsName; |
|
490 TRAP_IGNORE( |
|
491 HBufC* localizedName = getLocalizedSettingsNameLC(aSettingsName); |
|
492 if (localizedName != NULL) |
|
493 { |
|
494 ret = wstring((const wchar_t*)localizedName->Ptr(), localizedName->Length()); |
|
495 CleanupStack::PopAndDestroy(localizedName); |
|
496 } |
|
497 ); |
|
498 return ret; |
|
499 } |
|
500 |
|
501 HBufC* AppMngr2MidletSettingsUtil::getLocalizedSettingsNameLC(wstring aSettingsName) |
|
502 { |
|
503 HBufC* localizedName = NULL; |
|
504 if (aSettingsName == ACCESS_POINT_SETTINGS) |
|
505 { |
|
506 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_NETWORK_DESTINATION); |
|
507 } |
|
508 else if (aSettingsName == ON_SCREEN_KEYPAD_SETTINGS) |
|
509 { |
|
510 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_KEYPAD); |
|
511 } |
|
512 else if (aSettingsName == SECURITY_WARNINGS_SETTINGS) |
|
513 { |
|
514 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_SECURITY_WARNINGS); |
|
515 } |
|
516 else if (aSettingsName == NET_ACCESS_SETTINGS) |
|
517 { |
|
518 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_NET_ACCESS); |
|
519 } |
|
520 else if (aSettingsName == LOW_LEVEL_NET_ACCESS_SETTINGS) |
|
521 { |
|
522 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_LOW_LEVEL_NET_ACCESS); |
|
523 } |
|
524 else if (aSettingsName == CALL_CONTROL_SETTINGS) |
|
525 { |
|
526 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_RESTRICTED_CALL_CONTROL); |
|
527 } |
|
528 else if (aSettingsName == MESSAGING_SETTINGS) |
|
529 { |
|
530 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_MESSAGING); |
|
531 } |
|
532 else if (aSettingsName == RESTRICTED_MESSAGING_SETTINGS) |
|
533 { |
|
534 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_RESTRICTED_MESSAGING); |
|
535 } |
|
536 else if (aSettingsName == APPLICATION_AUTO_INVOCATION_SETTINGS) |
|
537 { |
|
538 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_APP_AUTO_INVOCAT); |
|
539 } |
|
540 else if (aSettingsName == LOCAL_CONNECTIVITY_SETTINGS) |
|
541 { |
|
542 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_LOCAL_CONN); |
|
543 } |
|
544 else if (aSettingsName == MULTIMEDIA_RECORDING_SETTINGS) |
|
545 { |
|
546 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_MM_RECORD); |
|
547 } |
|
548 else if (aSettingsName == READ_USER_DATA_ACCESS_SETTINGS) |
|
549 { |
|
550 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_READ_DATA); |
|
551 } |
|
552 else if (aSettingsName == WRITE_USER_DATA_ACCESS_SETTINGS) |
|
553 { |
|
554 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_WRITE_DATA); |
|
555 } |
|
556 else if (aSettingsName == LOCATION_SETTINGS) |
|
557 { |
|
558 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_LOCATION); |
|
559 } |
|
560 else if (aSettingsName == LANDMARK_SETTINGS) |
|
561 { |
|
562 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_LANDMARKS); |
|
563 } |
|
564 else if (aSettingsName == AUTHENTICATION_SETTINGS) |
|
565 { |
|
566 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_AUT); |
|
567 } |
|
568 else if (aSettingsName == SMART_CARD_COMMUNICATION_SETTINGS) |
|
569 { |
|
570 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_SMARTCARD); |
|
571 } |
|
572 else if (aSettingsName == BROADCAST_SETTINGS) |
|
573 { |
|
574 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_BROADCAST); |
|
575 } |
|
576 else if (aSettingsName == NFC_WRITE_ACCESS_SETTINGS) |
|
577 { |
|
578 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_NFC_WRITE_ACCESS); |
|
579 } |
|
580 else if (aSettingsName == URL_START_SETTINGS) |
|
581 { |
|
582 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_NAME_URL_START); |
|
583 } |
|
584 return localizedName; |
|
585 } |
|
586 |
|
587 const wstring AppMngr2MidletSettingsUtil::getLocalizedSettingsInteractionMode(int aInteractionMode) |
|
588 { |
|
589 wstring ret = L""; |
|
590 TRAP_IGNORE( |
|
591 HBufC* localizedName = NULL; |
|
592 switch (aInteractionMode) |
|
593 { |
|
594 case INTERACTION_MODE_BLANKET: |
|
595 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_VALUE_BLANK); |
|
596 break; |
|
597 case INTERACTION_MODE_SESSION: |
|
598 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_VALUE_SESSION); |
|
599 break; |
|
600 case INTERACTION_MODE_ONESHOT: |
|
601 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_VALUE_ONESHOT); |
|
602 break; |
|
603 case INTERACTION_MODE_DENIED: |
|
604 localizedName = StringLoader::LoadLC(R_JAVA_SETTING_VALUE_NO); |
|
605 break; |
|
606 } |
|
607 if (localizedName != NULL) |
|
608 { |
|
609 ret = wstring((const wchar_t*)localizedName->Ptr(), localizedName->Length()); |
|
610 CleanupStack::PopAndDestroy(localizedName); |
|
611 } |
|
612 ); |
|
613 return ret; |
|
614 } |
|
615 |
|
616 const wstring AppMngr2MidletSettingsUtil::getLocalizedSecurityWarningsModeValue(wstring aSecurityWarningsModeValue) |
|
617 { |
|
618 wstring ret = L""; |
|
619 TRAP_IGNORE( |
|
620 HBufC* localizedName = NULL; |
|
621 if (aSecurityWarningsModeValue == SECURITY_WARNINGS_DEFAULT_MODE) |
|
622 { |
|
623 localizedName = StringLoader::LoadLC(R_JAVA_SECURITY_WARNINGS_SETTING_VALUE_DEFAULT); |
|
624 } |
|
625 else if (aSecurityWarningsModeValue == SECURITY_WARNINGS_USER_DEFINED_MODE) |
|
626 { |
|
627 localizedName = StringLoader::LoadLC(R_JAVA_SECURITY_WARNINGS_SETTING_VALUE_USER_DEFINED); |
|
628 } |
|
629 if (localizedName != NULL) |
|
630 { |
|
631 ret = wstring((const wchar_t*)localizedName->Ptr(), localizedName->Length()); |
|
632 CleanupStack::PopAndDestroy(localizedName); |
|
633 } |
|
634 ); |
|
635 return ret; |
|
636 } |
|
637 |
|
638 const wstring AppMngr2MidletSettingsUtil::getLocalizedOnScreenKeypadValue(wstring aOnScreenKeypadValue) |
|
639 { |
|
640 wstring ret = L""; |
|
641 TRAP_IGNORE( |
|
642 HBufC* localizedName = NULL; |
|
643 if (aOnScreenKeypadValue == ON_SCREEN_KEYPAD_VALUE_NO) |
|
644 { |
|
645 localizedName = StringLoader::LoadLC(R_JAVA_KEYPAD_SETTING_VALUE_NO); |
|
646 } |
|
647 else if (aOnScreenKeypadValue == ON_SCREEN_KEYPAD_VALUE_GAMEACTIONS) |
|
648 { |
|
649 localizedName = StringLoader::LoadLC(R_JAVA_KEYPAD_SETTING_VALUE_GAME); |
|
650 } |
|
651 else if (aOnScreenKeypadValue == ON_SCREEN_KEYPAD_VALUE_NAVIGATION) |
|
652 { |
|
653 localizedName = StringLoader::LoadLC(R_JAVA_KEYPAD_SETTING_VALUE_NAVIGATION); |
|
654 } |
|
655 if (localizedName != NULL) |
|
656 { |
|
657 ret = wstring((const wchar_t*)localizedName->Ptr(), localizedName->Length()); |
|
658 CleanupStack::PopAndDestroy(localizedName); |
|
659 } |
|
660 ); |
|
661 return ret; |
|
662 } |