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 |
|
|
247 |
if (value.size() > 0
|
|
248 |
&& ((value == L"no")
|
|
249 |
|| (value == L"navigationkeys")
|
|
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 |
|
|
309 |
const std::wstring CAppMngr2MidletSettingsHandler::GetSecurityDomainCategory()
|
|
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);
|
|
328 |
}
|
|
329 |
|
|
330 |
findEntry(queryResult, SECURITY_DOMAIN_CATEGORY, securityDomainCategory);
|
|
331 |
|
|
332 |
return securityDomainCategory;
|
|
333 |
|
|
334 |
}
|
|
335 |
|
|
336 |
const std::wstring CAppMngr2MidletSettingsHandler::GetSecurityDomainName()
|
|
337 |
{
|
|
338 |
wstring securityDomainName = L"";
|
|
339 |
|
|
340 |
JavaStorageApplicationEntry_t query;
|
|
341 |
JavaStorageApplicationList_t queryResult;
|
|
342 |
JavaStorageEntry attr;
|
|
343 |
attr.setEntry(ID, iMidletSuiteUid.toString());
|
|
344 |
query.insert(attr);
|
|
345 |
attr.setEntry(SECURITY_DOMAIN, L"");
|
|
346 |
query.insert(attr);
|
|
347 |
|
|
348 |
try
|
|
349 |
{
|
|
350 |
iStorage->search(MIDP_PACKAGE_TABLE, query, queryResult);
|
|
351 |
}
|
|
352 |
catch (JavaStorageException& aJse)
|
|
353 |
{
|
|
354 |
ELOG1(EJavaAppMngrPlugin, "SECURITY_DOMAIN value read failed: %d", aJse.mStatus);
|
|
355 |
}
|
|
356 |
|
|
357 |
findEntry(queryResult, SECURITY_DOMAIN, securityDomainName);
|
|
358 |
|
|
359 |
return securityDomainName;
|
|
360 |
|
|
361 |
}
|
|
362 |
|
|
363 |
const wstring CAppMngr2MidletSettingsHandler::GetSecurityWarningsMode()
|
|
364 |
{
|
|
365 |
wstring warningsMode = L"";
|
|
366 |
|
|
367 |
JavaStorageApplicationEntry_t query;
|
|
368 |
JavaStorageApplicationList_t queryResult;
|
|
369 |
JavaStorageEntry attr;
|
|
370 |
attr.setEntry(ID, iMidletSuiteUid.toString());
|
|
371 |
query.insert(attr);
|
|
372 |
attr.setEntry(SECURITY_WARNINGS, L"");
|
|
373 |
query.insert(attr);
|
|
374 |
|
|
375 |
try
|
|
376 |
{
|
|
377 |
iStorage->search(MIDP_PACKAGE_TABLE, query, queryResult);
|
|
378 |
}
|
|
379 |
catch (JavaStorageException& aJse)
|
|
380 |
{
|
|
381 |
ELOG1(EJavaAppMngrPlugin, "ON_SCREEN_KEYPAD value read failed: %d", aJse.mStatus);
|
|
382 |
// Don't leave. Set defaults.
|
|
383 |
}
|
|
384 |
|
|
385 |
findEntry(queryResult, SECURITY_WARNINGS, warningsMode);
|
|
386 |
if (warningsMode.size() == 0)
|
|
387 |
{
|
|
388 |
warningsMode = SECURITY_WARNINGS_DEFAULT_MODE;
|
|
389 |
}
|
|
390 |
|
|
391 |
return warningsMode;
|
|
392 |
}
|
|
393 |
|
|
394 |
int CAppMngr2MidletSettingsHandler::SetSecurityWarningsMode(const wstring& aSecurityWarningsMode)
|
|
395 |
{
|
|
396 |
JavaStorageApplicationEntry_t oldEntry;
|
|
397 |
JavaStorageEntry attr;
|
|
398 |
attr.setEntry(ID, iMidletSuiteUid.toString());
|
|
399 |
oldEntry.insert(attr);
|
|
400 |
JavaStorageApplicationEntry_t entry;
|
|
401 |
attr.setEntry(SECURITY_WARNINGS, aSecurityWarningsMode);
|
|
402 |
entry.insert(attr);
|
|
403 |
|
|
404 |
try
|
|
405 |
{
|
|
406 |
iStorage->update(MIDP_PACKAGE_TABLE, entry, oldEntry);
|
|
407 |
}
|
|
408 |
catch (JavaStorageException& aJse)
|
|
409 |
{
|
|
410 |
ELOG1(EJavaAppMngrPlugin, "Failed to set SECURITY_WARNINGS: %d", aJse.mStatus);
|
|
411 |
return KErrNotFound;
|
|
412 |
}
|
|
413 |
return KErrNone;
|
|
414 |
}
|
|
415 |
|
|
416 |
void CAppMngr2MidletSettingsHandler::GetSecuritySettings(std::vector<MidletSuiteSecuritySettings>& aMidletSuiteSecuritySettings)
|
|
417 |
{
|
|
418 |
try
|
|
419 |
{
|
|
420 |
JavaStorageApplicationEntry_t query;
|
|
421 |
JavaStorageApplicationList_t queryResult;
|
|
422 |
JavaStorageEntry attr;
|
|
423 |
attr.setEntry(ID, iMidletSuiteUid.toString());
|
|
424 |
query.insert(attr);
|
|
425 |
attr.setEntry(FUNCTION_GROUP, L"");
|
|
426 |
query.insert(attr);
|
|
427 |
iStorage->search(MIDP_PERMISSIONS_TABLE, query, queryResult);
|
|
428 |
JavaStorageApplicationList_t::const_iterator iterator;
|
|
429 |
JavaStorageApplicationList_t settingsQueryResult;
|
|
430 |
MidletSuiteSecuritySettings settings;
|
|
431 |
for (iterator = queryResult.begin(); iterator != queryResult.end(); iterator++)
|
|
432 |
{
|
|
433 |
std::wstring settingsName = L"";
|
|
434 |
JavaStorageApplicationEntry_t entry = (*iterator);
|
|
435 |
findColumn(entry, FUNCTION_GROUP, settingsName);
|
|
436 |
if (settingsName.size() > 0)
|
|
437 |
{
|
|
438 |
// go on only if the setting does not exist already
|
|
439 |
bool found = false;
|
|
440 |
for(int j=0; j<aMidletSuiteSecuritySettings.size(); j++)
|
|
441 |
{
|
|
442 |
if (settingsName == aMidletSuiteSecuritySettings[j].getName())
|
|
443 |
{
|
|
444 |
found = true;
|
|
445 |
break;
|
|
446 |
}
|
|
447 |
}
|
|
448 |
if (!found)
|
|
449 |
{
|
|
450 |
entry.clear();
|
|
451 |
query.clear();
|
|
452 |
attr.setEntry(ID, iMidletSuiteUid.toString());
|
|
453 |
query.insert(attr);
|
|
454 |
attr.setEntry(FUNCTION_GROUP, settingsName);
|
|
455 |
query.insert(attr);
|
|
456 |
attr.setEntry(CURRENT_SETTING, L"");
|
|
457 |
query.insert(attr);
|
|
458 |
attr.setEntry(ALLOWED_SETTINGS , L"");
|
|
459 |
query.insert(attr);
|
|
460 |
settingsQueryResult.clear();
|
|
461 |
iStorage->search(MIDP_FUNC_GRP_SETTINGS_TABLE, query, settingsQueryResult);
|
|
462 |
if (settingsQueryResult.size() > 0)
|
|
463 |
{
|
|
464 |
wstring currentInteractionMode = L"";
|
|
465 |
wstring allowedInteractionModes = L"";
|
|
466 |
findEntry(settingsQueryResult,CURRENT_SETTING , currentInteractionMode);
|
|
467 |
findEntry(settingsQueryResult,ALLOWED_SETTINGS , allowedInteractionModes);
|
|
468 |
if (currentInteractionMode.size() > 0 && allowedInteractionModes.size() > 0)
|
|
469 |
{
|
|
470 |
settings = MidletSuiteSecuritySettings(
|
|
471 |
settingsName,
|
|
472 |
currentInteractionMode,
|
|
473 |
allowedInteractionModes);
|
|
474 |
aMidletSuiteSecuritySettings.push_back(settings);
|
|
475 |
}
|
|
476 |
}
|
|
477 |
}
|
|
478 |
}
|
|
479 |
}
|
|
480 |
}
|
|
481 |
catch (JavaStorageException& aJse)
|
|
482 |
{
|
|
483 |
}
|
|
484 |
}
|
|
485 |
|
|
486 |
int CAppMngr2MidletSettingsHandler::SetSecuritySettings(const std::wstring& aSettingsName, const std::wstring& aCurrentInteractionMode)
|
|
487 |
{
|
|
488 |
try
|
|
489 |
{
|
|
490 |
JavaStorageApplicationEntry_t entry;
|
|
491 |
JavaStorageApplicationEntry_t oldEntry;
|
|
492 |
JavaStorageEntry attr;
|
|
493 |
attr.setEntry(ID, iMidletSuiteUid.toString());
|
|
494 |
oldEntry.insert(attr);
|
|
495 |
attr.setEntry(FUNCTION_GROUP, aSettingsName);
|
|
496 |
oldEntry.insert(attr);
|
|
497 |
attr.setEntry(CURRENT_SETTING, aCurrentInteractionMode);
|
|
498 |
entry.insert(attr);
|
|
499 |
iStorage->update(MIDP_FUNC_GRP_SETTINGS_TABLE, entry, oldEntry);
|
|
500 |
}
|
|
501 |
catch (JavaStorageException& aJse)
|
|
502 |
{
|
|
503 |
return KErrNotFound;
|
|
504 |
}
|
|
505 |
return KErrNone;
|
|
506 |
}
|
|
507 |
|
|
508 |
int CAppMngr2MidletSettingsHandler::SetUserSecuritySettingsPromptFlag(const std::wstring& aSettingsName, bool aPromptFlag)
|
|
509 |
{
|
|
510 |
try
|
|
511 |
{
|
|
512 |
JavaStorageApplicationEntry_t entry;
|
|
513 |
JavaStorageApplicationEntry_t oldEntry;
|
|
514 |
JavaStorageEntry attr;
|
|
515 |
attr.setEntry(ID, iMidletSuiteUid.toString());
|
|
516 |
oldEntry.insert(attr);
|
|
517 |
attr.setEntry(FUNCTION_GROUP, aSettingsName);
|
|
518 |
oldEntry.insert(attr);
|
|
519 |
std::wstring blanketPrompt;
|
|
520 |
if (aPromptFlag)
|
|
521 |
{
|
|
522 |
blanketPrompt = L"1";
|
|
523 |
}
|
|
524 |
else
|
|
525 |
{
|
|
526 |
blanketPrompt = L"0";
|
|
527 |
}
|
|
528 |
attr.setEntry(BLANKET_PROMPT, blanketPrompt);
|
|
529 |
entry.insert(attr);
|
|
530 |
iStorage->update(MIDP_FUNC_GRP_SETTINGS_TABLE, entry, oldEntry);
|
|
531 |
}
|
|
532 |
catch (JavaStorageException& aJse)
|
|
533 |
{
|
|
534 |
return KErrNotFound;
|
|
535 |
}
|
|
536 |
return KErrNone;
|
|
537 |
}
|
|
538 |
|
|
539 |
void CAppMngr2MidletSettingsHandler::findColumn(const JavaStorageApplicationEntry_t& aEntry,
|
|
540 |
const wstring& aColName, wstring& aColValue)
|
|
541 |
{
|
|
542 |
JavaStorageEntry findPattern;
|
|
543 |
findPattern.setEntry(aColName, L"");
|
|
544 |
JavaStorageApplicationEntry_t::const_iterator findIterator =
|
|
545 |
aEntry.find(findPattern);
|
|
546 |
if (findIterator != aEntry.end())
|
|
547 |
{
|
|
548 |
aColValue = findIterator->entryValue();
|
|
549 |
}
|
|
550 |
}
|
|
551 |
|
|
552 |
void CAppMngr2MidletSettingsHandler::findEntry(const JavaStorageApplicationList_t& queryResult,
|
|
553 |
const std::wstring& eName,
|
|
554 |
std::wstring& eValue)
|
|
555 |
{
|
|
556 |
if (queryResult.size() > 0)
|
|
557 |
{
|
|
558 |
JavaStorageApplicationEntry_t entry = queryResult.front();
|
|
559 |
JavaStorageEntry findPattern;
|
|
560 |
findPattern.setEntry(eName, L"");
|
|
561 |
JavaStorageApplicationEntry_t::const_iterator findIterator =
|
|
562 |
entry.find(findPattern);
|
|
563 |
if (findIterator != entry.end())
|
|
564 |
{
|
|
565 |
eValue = findIterator->entryValue();
|
|
566 |
}
|
|
567 |
}
|
|
568 |
}
|
|
569 |
|
|
570 |
// End of file
|