author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 21:06:50 +0300 | |
branch | RCL_3 |
changeset 71 | d5e927d5853b |
parent 66 | 2455ef1f5bbc |
child 83 | 26b2b12093af |
permissions | -rw-r--r-- |
66 | 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: CAppMngr2MidletSettingsHandler implementation |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// INCLUDE FILES |
|
20 |
#include <featmgr.h> |
|
21 |
#include <StringLoader.h> // StringLoader |
|
22 |
#include <cmmanagerext.h> // RCmManagerExt |
|
23 |
#include <cmdestinationext.h> // RCmDestinationExt |
|
24 |
#include "appmngr2midletsettingshandler.h" |
|
25 |
#include "appmngr2midletconstants.h" |
|
26 |
#include "securitystoragedatadefs.h" |
|
27 |
||
28 |
#include <javaapplicationsettings.rsg> // Midlet resource IDs |
|
29 |
||
30 |
#include "connectionmanager.h" // ConnectionManager. |
|
31 |
#include "javastoragenames.h" // Storage constants. |
|
32 |
#include "javasymbianoslayer.h" // STL <-- --> Symbian conv. |
|
33 |
#include "javauid.h" // Uid. |
|
34 |
#include "logger.h" // LOG. |
|
35 |
#include "appmngr2midletresourcehandler.h" // CAppMngr2MidletResourceHandler |
|
36 |
||
37 |
using namespace java::storage; |
|
38 |
using namespace std; |
|
39 |
using namespace java::util; |
|
40 |
||
41 |
// ================= MEMBER FUNCTIONS ======================= |
|
42 |
||
43 |
// ----------------------------------------------------------------------------- |
|
44 |
// CAppMngr2MidletSettingsHandler::NewL |
|
45 |
// |
|
46 |
// Two-phased constructor. |
|
47 |
// ----------------------------------------------------------------------------- |
|
48 |
// |
|
49 |
CAppMngr2MidletSettingsHandler* CAppMngr2MidletSettingsHandler::NewL(const TDesC& aMidletSuiteName,TUid aMidletSuiteUid, CAppMngr2MidletResourceHandler& aResourceHandler) |
|
50 |
{ |
|
51 |
LOG(EJavaAppMngrPlugin, EInfo, " + CAppMngr2MidletSettingsHandler::NewL "); |
|
52 |
CAppMngr2MidletSettingsHandler* self |
|
53 |
= new(ELeave) CAppMngr2MidletSettingsHandler(aResourceHandler); |
|
54 |
CleanupStack::PushL(self); |
|
55 |
self->ConstructL(aMidletSuiteName,aMidletSuiteUid); |
|
56 |
CleanupStack::Pop(self); |
|
57 |
||
58 |
LOG(EJavaAppMngrPlugin, EInfo, " - CAppMngr2MidletSettingsHandler::NewL "); |
|
59 |
||
60 |
return self; |
|
61 |
} |
|
62 |
||
63 |
// ----------------------------------------------------------------------------- |
|
64 |
// Destructor |
|
65 |
// |
|
66 |
// Deletes database and ApUtils and cleans and deletes Midlet User Preferences. |
|
67 |
// ----------------------------------------------------------------------------- |
|
68 |
// |
|
69 |
CAppMngr2MidletSettingsHandler::~CAppMngr2MidletSettingsHandler() |
|
70 |
{ |
|
71 |
LOG(EJavaAppMngrPlugin, EInfo, " + CAppMngr2MidletSettingsHandler::~CAppMngr2MidletSettingsHandler "); |
|
72 |
||
73 |
delete iMidletSuiteName; |
|
74 |
LOG(EJavaAppMngrPlugin, EInfo, " - CAppMngr2MidletSettingsHandler::~CAppMngr2MidletSettingsHandler "); |
|
75 |
} |
|
76 |
||
77 |
// --------------------------------------------------------------------------- |
|
78 |
// C++ constructor |
|
79 |
// --------------------------------------------------------------------------- |
|
80 |
CAppMngr2MidletSettingsHandler::CAppMngr2MidletSettingsHandler(CAppMngr2MidletResourceHandler& aResourceHandler) |
|
81 |
: iMidletSuiteName(NULL), iResourceHandler(aResourceHandler) |
|
82 |
{ |
|
83 |
} |
|
84 |
||
85 |
// ----------------------------------------------------------------------------- |
|
86 |
// CAppMngr2MidletSettingsHandler::ConstructL |
|
87 |
// |
|
88 |
// Symbian OS two phased constructor |
|
89 |
// ----------------------------------------------------------------------------- |
|
90 |
// |
|
91 |
void CAppMngr2MidletSettingsHandler::ConstructL(const TDesC& aMidletSuiteName,TUid aMidletSuiteUid) |
|
92 |
{ |
|
93 |
LOG(EJavaAppMngrPlugin, EInfo, " + CAppMngr2MidletSettingsHandler::ConstructL "); |
|
94 |
||
95 |
iStorage.reset(JavaStorage::createInstance()); |
|
96 |
||
97 |
try |
|
98 |
{ |
|
99 |
iStorage->open(); |
|
100 |
} |
|
101 |
catch (JavaStorageException& aJse) |
|
102 |
{ |
|
103 |
ELOG1(EJavaAppMngrPlugin, "SettingsHandler: Cannot open storage: %d", |
|
104 |
aJse.mStatus); |
|
105 |
User::Leave(aJse.mStatus); |
|
106 |
} |
|
107 |
iMidletSuiteName = aMidletSuiteName.AllocL(); |
|
108 |
TUidToUid(aMidletSuiteUid, iMidletSuiteUid); |
|
109 |
LOG(EJavaAppMngrPlugin, EInfo, " - CAppMngr2MidletSettingsHandler::ConstructL "); |
|
110 |
} |
|
111 |
||
112 |
// ----------------------------------------------------------------------------- |
|
113 |
// CAppMngr2MidletSettingsHandler::GetCurrentSuiteSnapL |
|
114 |
// |
|
115 |
// Reads the current Midlet destination network from DB. |
|
116 |
// ----------------------------------------------------------------------------- |
|
117 |
// |
|
118 |
CAppMngr2SuiteSnapItem* CAppMngr2MidletSettingsHandler::GetSnapL() |
|
119 |
{ |
|
120 |
LOG(EJavaAppMngrPlugin, EInfo, " + CAppMngr2MidletSettingsHandler::GetCurrentSuiteSnapL "); |
|
121 |
||
122 |
CAppMngr2SuiteSnapItem* snap = new(ELeave) CAppMngr2SuiteSnapItem; |
|
123 |
unsigned int apnId = ConnectionManager::getDestinationNetworkIdL(iMidletSuiteUid); |
|
124 |
snap->iId = apnId; |
|
125 |
||
126 |
HBufC* name = NULL; |
|
127 |
TInt resourceOffset = iResourceHandler.AddResourceFileL(); |
|
128 |
switch (apnId) |
|
129 |
{ |
|
130 |
case(TUint)KAlwaysAskId: |
|
131 |
{ |
|
132 |
name = StringLoader::LoadL(R_JAVA_CONSET_SETT_ALWAYS_ASK); |
|
133 |
break; |
|
134 |
} |
|
135 |
case(TUint)KJavaNetworkAccessNotSpecified: |
|
136 |
case(TUint)KDefaultConnection: |
|
137 |
{ |
|
138 |
name = StringLoader::LoadL(R_JAVA_CONSET_SETT_DEFAULT_CONNECTION); |
|
139 |
break; |
|
140 |
} |
|
141 |
default: |
|
142 |
{ |
|
143 |
TRAPD(err, |
|
144 |
RCmManagerExt manager; |
|
145 |
manager.OpenLC(); |
|
146 |
RCmDestinationExt destination = manager.DestinationL(apnId); |
|
147 |
CleanupClosePushL(destination); |
|
148 |
name = destination.NameLC(); |
|
149 |
CleanupStack::Pop(name); |
|
150 |
CleanupStack::PopAndDestroy(&destination); |
|
151 |
CleanupStack::PopAndDestroy(&manager); |
|
152 |
); |
|
153 |
if (err != KErrNone) |
|
154 |
{ |
|
155 |
// reset it back to default |
|
156 |
snap->iId = (TUint)KDefaultConnection; |
|
157 |
name = StringLoader::LoadL(R_JAVA_CONSET_SETT_DEFAULT_CONNECTION); |
|
158 |
ConnectionManager::setDestinationNetworkIdL(iMidletSuiteUid, snap->iId); |
|
159 |
} |
|
160 |
} |
|
161 |
} |
|
162 |
if (resourceOffset > 0) |
|
163 |
{ |
|
164 |
iResourceHandler.DeleteResourceFile(resourceOffset); |
|
165 |
} |
|
166 |
snap->iName = wstring((const wchar_t*)name->Ptr(), name->Length()); |
|
167 |
delete name; |
|
168 |
name = NULL; |
|
169 |
||
170 |
LOG(EJavaAppMngrPlugin, EInfo, " - CAppMngr2MidletSettingsHandler::GetCurrentSuiteSnapL "); |
|
171 |
||
172 |
return snap; |
|
173 |
} |
|
174 |
||
175 |
||
176 |
// --------------------------------------------------------------------------- |
|
177 |
// CAppMngr2MidletSettingsHandler::GetOnScreenKeyboardValueL() |
|
178 |
// |
|
179 |
// Reads custom attribute value KOnScreenKeyboardAttribute |
|
180 |
// --------------------------------------------------------------------------- |
|
181 |
// |
|
182 |
const std::wstring CAppMngr2MidletSettingsHandler::GetOnScreenKeypadValueL() |
|
183 |
{ |
|
184 |
LOG(EJavaAppMngrPlugin, EInfo, " + CAppMngr2MidletSettingsHandler::GetOnScreenKeyboardValueL "); |
|
185 |
||
186 |
wstring value = L""; |
|
187 |
||
188 |
JavaStorageApplicationEntry_t query; |
|
189 |
JavaStorageApplicationList_t queryResult; |
|
190 |
JavaStorageEntry attr; |
|
191 |
attr.setEntry(ID, iMidletSuiteUid.toString()); |
|
192 |
query.insert(attr); |
|
193 |
attr.setEntry(ON_SCREEN_KEYPAD, L""); |
|
194 |
query.insert(attr); |
|
195 |
||
196 |
try |
|
197 |
{ |
|
198 |
iStorage->search(MIDP_PACKAGE_TABLE, query, queryResult); |
|
199 |
} |
|
200 |
catch (JavaStorageException& aJse) |
|
201 |
{ |
|
202 |
ELOG1(EJavaAppMngrPlugin, "ON_SCREEN_KEYPAD value read failed: %d", aJse.mStatus); |
|
203 |
// Don't leave. Set defaults. |
|
204 |
} |
|
205 |
||
206 |
findEntry(queryResult, ON_SCREEN_KEYPAD, value); |
|
207 |
||
208 |
if (value.size() <= 0) |
|
209 |
{ |
|
210 |
// default is KValueGameactions if value is not defined |
|
211 |
value = ON_SCREEN_KEYPAD_VALUE_GAMEACTIONS; |
|
212 |
} |
|
213 |
LOG(EJavaAppMngrPlugin, EInfo, " - CAppMngr2MidletSettingsHandler::GetOnScreenKeyboardValueL "); |
|
214 |
||
215 |
return value; |
|
216 |
} |
|
217 |
||
218 |
bool CAppMngr2MidletSettingsHandler::OnScreenKeypadValuePreDefinedL() |
|
219 |
{ |
|
220 |
LOG(EJavaAppMngrPlugin, EInfo, " + CAppMngr2MidletSettingsHandler::OnScreenKeypadValuePreDefinedL "); |
|
221 |
||
222 |
wstring value = L""; |
|
223 |
bool predefined = false; |
|
224 |
||
225 |
JavaStorageApplicationEntry_t query; |
|
226 |
JavaStorageApplicationList_t queryResult; |
|
227 |
JavaStorageEntry attr; |
|
228 |
attr.setEntry(ID, iMidletSuiteUid.toString()); |
|
229 |
query.insert(attr); |
|
230 |
attr.setEntry(NAME, L"Nokia-MIDlet-On-Screen-Keypad"); |
|
231 |
query.insert(attr); |
|
232 |
attr.setEntry(VALUE, L""); |
|
233 |
query.insert(attr); |
|
234 |
||
235 |
try |
|
236 |
{ |
|
237 |
iStorage->search(APPLICATION_PACKAGE_ATTRIBUTES_TABLE, query, queryResult); |
|
238 |
} |
|
239 |
catch (JavaStorageException& aJse) |
|
240 |
{ |
|
241 |
ELOG1(EJavaAppMngrPlugin, "Nokia-MIDlet-On-Screen-Keypad value read failed: %d", aJse.mStatus); |
|
242 |
// Don't leave. Set defaults. |
|
243 |
} |
|
244 |
||
245 |
findEntry(queryResult, VALUE, value); |
|
246 |
||
71
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
247 |
if (value.size() > 0 |
66 | 248 |
&& ((value == L"no") |
71
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
249 |
|| (value == L"navigationkeys") |
66 | 250 |
|| (value == L"gameactions"))) |
251 |
{ |
|
252 |
predefined = true; |
|
253 |
} |
|
254 |
LOG(EJavaAppMngrPlugin, EInfo, " - CAppMngr2MidletSettingsHandler::OnScreenKeypadValuePreDefinedL "); |
|
255 |
||
256 |
return predefined; |
|
257 |
} |
|
258 |
||
259 |
// --------------------------------------------------------------------------- |
|
260 |
// CAppMngr2MidletSettingsHandler::SetOnScreenKeyboardValueL() |
|
261 |
// |
|
262 |
// Writes custom attribute value KOnScreenKeyboardAttribute |
|
263 |
// --------------------------------------------------------------------------- |
|
264 |
// |
|
265 |
int CAppMngr2MidletSettingsHandler::SetOnScreenKeypadValueL(const std::wstring& aValue) |
|
266 |
{ |
|
267 |
LOG(EJavaAppMngrPlugin, EInfo, " + CAppMngr2MidletSettingsHandler::SetOnScreenKeyboardValueL "); |
|
268 |
||
269 |
JavaStorageApplicationEntry_t oldEntry; |
|
270 |
JavaStorageEntry attr; |
|
271 |
attr.setEntry(ID, iMidletSuiteUid.toString()); |
|
272 |
oldEntry.insert(attr); |
|
273 |
JavaStorageApplicationEntry_t entry; |
|
274 |
attr.setEntry(ON_SCREEN_KEYPAD, aValue); |
|
275 |
entry.insert(attr); |
|
276 |
||
277 |
try |
|
278 |
{ |
|
279 |
iStorage->update(MIDP_PACKAGE_TABLE, entry, oldEntry); |
|
280 |
} |
|
281 |
catch (JavaStorageException& aJse) |
|
282 |
{ |
|
283 |
ELOG1(EJavaAppMngrPlugin, "Failed to set ON_SCREEN_KEYPAD: %d", aJse.mStatus); |
|
284 |
return KErrNotFound; |
|
285 |
} |
|
286 |
||
287 |
LOG(EJavaAppMngrPlugin, EInfo, " - CAppMngr2MidletSettingsHandler::SetOnScreenKeyboardValueL "); |
|
288 |
||
289 |
return KErrNone; |
|
290 |
||
291 |
} |
|
292 |
||
293 |
||
294 |
// ----------------------------------------------------------------------------- |
|
295 |
// CAppMngr2MidletSettingsHandler::SetCurrentSuiteSnapL |
|
296 |
// |
|
297 |
// Set selected access point to DB |
|
298 |
// ----------------------------------------------------------------------------- |
|
299 |
// |
|
300 |
void CAppMngr2MidletSettingsHandler::SetSnapL(const CAppMngr2SuiteSnapItem& aSnap) |
|
301 |
{ |
|
302 |
LOG(EJavaAppMngrPlugin, EInfo, " + CAppMngr2MidletSettingsHandler::SetCurrentSuiteSnapL "); |
|
303 |
||
304 |
ConnectionManager::setDestinationNetworkIdL(iMidletSuiteUid, aSnap.iId); |
|
305 |
||
306 |
LOG(EJavaAppMngrPlugin, EInfo, " - CAppMngr2MidletSettingsHandler::SetCurrentSuiteSnapL "); |
|
307 |
} |
|
308 |
||
71
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
309 |
const std::wstring CAppMngr2MidletSettingsHandler::GetSecurityDomainCategoryL() |
66 | 310 |
{ |
311 |
wstring securityDomainCategory = L""; |
|
312 |
||
313 |
JavaStorageApplicationEntry_t query; |
|
314 |
JavaStorageApplicationList_t queryResult; |
|
315 |
JavaStorageEntry attr; |
|
316 |
attr.setEntry(ID, iMidletSuiteUid.toString()); |
|
317 |
query.insert(attr); |
|
318 |
attr.setEntry(SECURITY_DOMAIN_CATEGORY, L""); |
|
319 |
query.insert(attr); |
|
320 |
||
321 |
try |
|
322 |
{ |
|
323 |
iStorage->search(MIDP_PACKAGE_TABLE, query, queryResult); |
|
324 |
} |
|
325 |
catch (JavaStorageException& aJse) |
|
326 |
{ |
|
327 |
ELOG1(EJavaAppMngrPlugin, "SECURITY_DOMAIN_CATEGORY value read failed: %d", aJse.mStatus); |
|
71
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
328 |
User::Leave(KErrLocked); |
66 | 329 |
} |
330 |
||
331 |
findEntry(queryResult, SECURITY_DOMAIN_CATEGORY, securityDomainCategory); |
|
332 |
||
333 |
return securityDomainCategory; |
|
334 |
||
335 |
} |
|
336 |
||
71
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
337 |
const std::wstring CAppMngr2MidletSettingsHandler::GetSecurityDomainNameL() |
66 | 338 |
{ |
339 |
wstring securityDomainName = L""; |
|
340 |
||
341 |
JavaStorageApplicationEntry_t query; |
|
342 |
JavaStorageApplicationList_t queryResult; |
|
343 |
JavaStorageEntry attr; |
|
344 |
attr.setEntry(ID, iMidletSuiteUid.toString()); |
|
345 |
query.insert(attr); |
|
346 |
attr.setEntry(SECURITY_DOMAIN, L""); |
|
347 |
query.insert(attr); |
|
348 |
||
349 |
try |
|
350 |
{ |
|
351 |
iStorage->search(MIDP_PACKAGE_TABLE, query, queryResult); |
|
352 |
} |
|
353 |
catch (JavaStorageException& aJse) |
|
354 |
{ |
|
355 |
ELOG1(EJavaAppMngrPlugin, "SECURITY_DOMAIN value read failed: %d", aJse.mStatus); |
|
71
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
356 |
User::Leave(KErrLocked); |
66 | 357 |
} |
358 |
||
359 |
findEntry(queryResult, SECURITY_DOMAIN, securityDomainName); |
|
360 |
||
361 |
return securityDomainName; |
|
362 |
||
363 |
} |
|
364 |
||
365 |
const wstring CAppMngr2MidletSettingsHandler::GetSecurityWarningsMode() |
|
366 |
{ |
|
367 |
wstring warningsMode = L""; |
|
368 |
||
369 |
JavaStorageApplicationEntry_t query; |
|
370 |
JavaStorageApplicationList_t queryResult; |
|
371 |
JavaStorageEntry attr; |
|
372 |
attr.setEntry(ID, iMidletSuiteUid.toString()); |
|
373 |
query.insert(attr); |
|
374 |
attr.setEntry(SECURITY_WARNINGS, L""); |
|
375 |
query.insert(attr); |
|
376 |
||
377 |
try |
|
378 |
{ |
|
379 |
iStorage->search(MIDP_PACKAGE_TABLE, query, queryResult); |
|
380 |
} |
|
381 |
catch (JavaStorageException& aJse) |
|
382 |
{ |
|
383 |
ELOG1(EJavaAppMngrPlugin, "ON_SCREEN_KEYPAD value read failed: %d", aJse.mStatus); |
|
384 |
// Don't leave. Set defaults. |
|
385 |
} |
|
386 |
||
387 |
findEntry(queryResult, SECURITY_WARNINGS, warningsMode); |
|
388 |
if (warningsMode.size() == 0) |
|
389 |
{ |
|
390 |
warningsMode = SECURITY_WARNINGS_DEFAULT_MODE; |
|
391 |
} |
|
392 |
||
393 |
return warningsMode; |
|
394 |
} |
|
395 |
||
396 |
int CAppMngr2MidletSettingsHandler::SetSecurityWarningsMode(const wstring& aSecurityWarningsMode) |
|
397 |
{ |
|
398 |
JavaStorageApplicationEntry_t oldEntry; |
|
399 |
JavaStorageEntry attr; |
|
400 |
attr.setEntry(ID, iMidletSuiteUid.toString()); |
|
401 |
oldEntry.insert(attr); |
|
402 |
JavaStorageApplicationEntry_t entry; |
|
403 |
attr.setEntry(SECURITY_WARNINGS, aSecurityWarningsMode); |
|
404 |
entry.insert(attr); |
|
405 |
||
406 |
try |
|
407 |
{ |
|
408 |
iStorage->update(MIDP_PACKAGE_TABLE, entry, oldEntry); |
|
409 |
} |
|
410 |
catch (JavaStorageException& aJse) |
|
411 |
{ |
|
412 |
ELOG1(EJavaAppMngrPlugin, "Failed to set SECURITY_WARNINGS: %d", aJse.mStatus); |
|
413 |
return KErrNotFound; |
|
414 |
} |
|
415 |
return KErrNone; |
|
416 |
} |
|
417 |
||
418 |
void CAppMngr2MidletSettingsHandler::GetSecuritySettings(std::vector<MidletSuiteSecuritySettings>& aMidletSuiteSecuritySettings) |
|
419 |
{ |
|
420 |
try |
|
421 |
{ |
|
422 |
JavaStorageApplicationEntry_t query; |
|
423 |
JavaStorageApplicationList_t queryResult; |
|
424 |
JavaStorageEntry attr; |
|
425 |
attr.setEntry(ID, iMidletSuiteUid.toString()); |
|
426 |
query.insert(attr); |
|
427 |
attr.setEntry(FUNCTION_GROUP, L""); |
|
428 |
query.insert(attr); |
|
429 |
iStorage->search(MIDP_PERMISSIONS_TABLE, query, queryResult); |
|
430 |
JavaStorageApplicationList_t::const_iterator iterator; |
|
431 |
JavaStorageApplicationList_t settingsQueryResult; |
|
432 |
MidletSuiteSecuritySettings settings; |
|
433 |
for (iterator = queryResult.begin(); iterator != queryResult.end(); iterator++) |
|
434 |
{ |
|
435 |
std::wstring settingsName = L""; |
|
436 |
JavaStorageApplicationEntry_t entry = (*iterator); |
|
437 |
findColumn(entry, FUNCTION_GROUP, settingsName); |
|
438 |
if (settingsName.size() > 0) |
|
439 |
{ |
|
440 |
// go on only if the setting does not exist already |
|
441 |
bool found = false; |
|
442 |
for(int j=0; j<aMidletSuiteSecuritySettings.size(); j++) |
|
443 |
{ |
|
444 |
if (settingsName == aMidletSuiteSecuritySettings[j].getName()) |
|
445 |
{ |
|
446 |
found = true; |
|
447 |
break; |
|
448 |
} |
|
449 |
} |
|
450 |
if (!found) |
|
451 |
{ |
|
452 |
entry.clear(); |
|
453 |
query.clear(); |
|
454 |
attr.setEntry(ID, iMidletSuiteUid.toString()); |
|
455 |
query.insert(attr); |
|
456 |
attr.setEntry(FUNCTION_GROUP, settingsName); |
|
457 |
query.insert(attr); |
|
458 |
attr.setEntry(CURRENT_SETTING, L""); |
|
459 |
query.insert(attr); |
|
460 |
attr.setEntry(ALLOWED_SETTINGS , L""); |
|
461 |
query.insert(attr); |
|
462 |
settingsQueryResult.clear(); |
|
463 |
iStorage->search(MIDP_FUNC_GRP_SETTINGS_TABLE, query, settingsQueryResult); |
|
464 |
if (settingsQueryResult.size() > 0) |
|
465 |
{ |
|
466 |
wstring currentInteractionMode = L""; |
|
467 |
wstring allowedInteractionModes = L""; |
|
468 |
findEntry(settingsQueryResult,CURRENT_SETTING , currentInteractionMode); |
|
469 |
findEntry(settingsQueryResult,ALLOWED_SETTINGS , allowedInteractionModes); |
|
470 |
if (currentInteractionMode.size() > 0 && allowedInteractionModes.size() > 0) |
|
471 |
{ |
|
472 |
settings = MidletSuiteSecuritySettings( |
|
473 |
settingsName, |
|
474 |
currentInteractionMode, |
|
475 |
allowedInteractionModes); |
|
476 |
aMidletSuiteSecuritySettings.push_back(settings); |
|
477 |
} |
|
478 |
} |
|
479 |
} |
|
480 |
} |
|
481 |
} |
|
482 |
} |
|
483 |
catch (JavaStorageException& aJse) |
|
484 |
{ |
|
485 |
} |
|
486 |
} |
|
487 |
||
488 |
int CAppMngr2MidletSettingsHandler::SetSecuritySettings(const std::wstring& aSettingsName, const std::wstring& aCurrentInteractionMode) |
|
489 |
{ |
|
490 |
try |
|
491 |
{ |
|
492 |
JavaStorageApplicationEntry_t entry; |
|
493 |
JavaStorageApplicationEntry_t oldEntry; |
|
494 |
JavaStorageEntry attr; |
|
495 |
attr.setEntry(ID, iMidletSuiteUid.toString()); |
|
496 |
oldEntry.insert(attr); |
|
497 |
attr.setEntry(FUNCTION_GROUP, aSettingsName); |
|
498 |
oldEntry.insert(attr); |
|
499 |
attr.setEntry(CURRENT_SETTING, aCurrentInteractionMode); |
|
500 |
entry.insert(attr); |
|
501 |
iStorage->update(MIDP_FUNC_GRP_SETTINGS_TABLE, entry, oldEntry); |
|
502 |
} |
|
503 |
catch (JavaStorageException& aJse) |
|
504 |
{ |
|
505 |
return KErrNotFound; |
|
506 |
} |
|
507 |
return KErrNone; |
|
508 |
} |
|
509 |
||
510 |
int CAppMngr2MidletSettingsHandler::SetUserSecuritySettingsPromptFlag(const std::wstring& aSettingsName, bool aPromptFlag) |
|
511 |
{ |
|
512 |
try |
|
513 |
{ |
|
514 |
JavaStorageApplicationEntry_t entry; |
|
515 |
JavaStorageApplicationEntry_t oldEntry; |
|
516 |
JavaStorageEntry attr; |
|
517 |
attr.setEntry(ID, iMidletSuiteUid.toString()); |
|
518 |
oldEntry.insert(attr); |
|
519 |
attr.setEntry(FUNCTION_GROUP, aSettingsName); |
|
520 |
oldEntry.insert(attr); |
|
521 |
std::wstring blanketPrompt; |
|
522 |
if (aPromptFlag) |
|
523 |
{ |
|
524 |
blanketPrompt = L"1"; |
|
525 |
} |
|
526 |
else |
|
527 |
{ |
|
528 |
blanketPrompt = L"0"; |
|
529 |
} |
|
530 |
attr.setEntry(BLANKET_PROMPT, blanketPrompt); |
|
531 |
entry.insert(attr); |
|
532 |
iStorage->update(MIDP_FUNC_GRP_SETTINGS_TABLE, entry, oldEntry); |
|
533 |
} |
|
534 |
catch (JavaStorageException& aJse) |
|
535 |
{ |
|
536 |
return KErrNotFound; |
|
537 |
} |
|
538 |
return KErrNone; |
|
539 |
} |
|
540 |
||
541 |
void CAppMngr2MidletSettingsHandler::findColumn(const JavaStorageApplicationEntry_t& aEntry, |
|
542 |
const wstring& aColName, wstring& aColValue) |
|
543 |
{ |
|
544 |
JavaStorageEntry findPattern; |
|
545 |
findPattern.setEntry(aColName, L""); |
|
546 |
JavaStorageApplicationEntry_t::const_iterator findIterator = |
|
547 |
aEntry.find(findPattern); |
|
548 |
if (findIterator != aEntry.end()) |
|
549 |
{ |
|
550 |
aColValue = findIterator->entryValue(); |
|
551 |
} |
|
552 |
} |
|
553 |
||
554 |
void CAppMngr2MidletSettingsHandler::findEntry(const JavaStorageApplicationList_t& queryResult, |
|
555 |
const std::wstring& eName, |
|
556 |
std::wstring& eValue) |
|
557 |
{ |
|
558 |
if (queryResult.size() > 0) |
|
559 |
{ |
|
560 |
JavaStorageApplicationEntry_t entry = queryResult.front(); |
|
561 |
JavaStorageEntry findPattern; |
|
562 |
findPattern.setEntry(eName, L""); |
|
563 |
JavaStorageApplicationEntry_t::const_iterator findIterator = |
|
564 |
entry.find(findPattern); |
|
565 |
if (findIterator != entry.end()) |
|
566 |
{ |
|
567 |
eValue = findIterator->entryValue(); |
|
568 |
} |
|
569 |
} |
|
570 |
} |
|
571 |
||
572 |
// End of file |