63
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 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 the License "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: Symbian specific advanced security settings certificate model
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "advsecsettingscertificatemodel_symbian_p.h"
|
|
19 |
#include "advsecsettingscertificatemodel.h"
|
|
20 |
#include "advsecsettingscertificate.h"
|
|
21 |
#include "advsecsettingstrustedcertusageuids.h"
|
|
22 |
#include "advsecsettingsstoreuids.h"
|
|
23 |
#include "advsecsettingscertlistbuilder_symbian.h"
|
|
24 |
#include "advsecsettingscertdetailsbuilder_symbian.h"
|
|
25 |
#include "advsecsettingscertmover_symbian.h"
|
|
26 |
#include <cctcertinfo.h> // CCTCertInfo
|
|
27 |
#include <certificateapps.h> // CCertificateAppInfoManager
|
|
28 |
#include <HbTextResolverSymbian>
|
|
29 |
|
|
30 |
_LIT(KTranslationFile, "z:\\resource\\qt\\translations");
|
|
31 |
_LIT(KTranslationPath, "certificate_manager_");
|
|
32 |
|
|
33 |
_LIT(KLocNativeInstallationUsage, "txt_certificate_manager_formlabel_symbian_instal");
|
|
34 |
_LIT(KLocJavaInstallationUsage, "txt_certificate_manager_formlabel_java_installing");
|
|
35 |
_LIT(KLocWidgetInstallationUsage, "txt_certificate_manager_formlabel_widget_installat");
|
|
36 |
_LIT(KLocInternetUsage, "txt_certificate_manager_formlabel_internet");
|
|
37 |
_LIT(KLocOcspUsage, "txt_certificate_manager_formlabel_online_certifica");
|
|
38 |
_LIT(KLocVPNUsage, "txt_certificate_manager_formlabel_vpn");
|
|
39 |
|
|
40 |
#define TRAP_HANDLE_AND_RETURN_IF_ERROR(_f) \
|
|
41 |
{ \
|
|
42 |
TInt __thr_error = KErrNone; \
|
|
43 |
TRAP(__thr_error, _f); \
|
|
44 |
if (__thr_error) { \
|
|
45 |
q_ptr->handleError(__thr_error); \
|
|
46 |
return; \
|
|
47 |
} \
|
|
48 |
}
|
|
49 |
|
|
50 |
|
|
51 |
// ======== LOCAL FUNCTIONS ========
|
|
52 |
|
|
53 |
// ---------------------------------------------------------------------------
|
|
54 |
// CopyStringL()
|
|
55 |
// ---------------------------------------------------------------------------
|
|
56 |
//
|
|
57 |
QString CopyStringL(const TDesC16 &aDes16)
|
|
58 |
{
|
|
59 |
QString string;
|
|
60 |
QT_TRYCATCH_LEAVING(string = QString::fromUtf16(aDes16.Ptr(), aDes16.Length()));
|
|
61 |
return string;
|
|
62 |
}
|
|
63 |
|
|
64 |
// ---------------------------------------------------------------------------
|
|
65 |
// CopyStringL()
|
|
66 |
// ---------------------------------------------------------------------------
|
|
67 |
//
|
|
68 |
QString CopyStringL(const TDesC8 &aDes8)
|
|
69 |
{
|
|
70 |
QString string;
|
|
71 |
QT_TRYCATCH_LEAVING(string = QString::fromUtf8(
|
|
72 |
reinterpret_cast<const char*>(aDes8.Ptr()), aDes8.Length()));
|
|
73 |
return string;
|
|
74 |
}
|
|
75 |
|
|
76 |
|
|
77 |
// ======== MEMBER FUNCTIONS ========
|
|
78 |
|
|
79 |
// ---------------------------------------------------------------------------
|
|
80 |
// AdvSecSettingsCertificateModelPrivate::AdvSecSettingsCertificateModelPrivate()
|
|
81 |
// ---------------------------------------------------------------------------
|
|
82 |
//
|
|
83 |
AdvSecSettingsCertificateModelPrivate::AdvSecSettingsCertificateModelPrivate(
|
|
84 |
AdvSecSettingsCertificateModel *q) : CActive(CActive::EPriorityLow), q_ptr(q),
|
|
85 |
iState(ENotInitialized)
|
|
86 |
{
|
|
87 |
CActiveScheduler::Add(this);
|
|
88 |
}
|
|
89 |
|
|
90 |
// ---------------------------------------------------------------------------
|
|
91 |
// AdvSecSettingsCertificateModelPrivate::~AdvSecSettingsCertificateModelPrivate()
|
|
92 |
// ---------------------------------------------------------------------------
|
|
93 |
//
|
|
94 |
AdvSecSettingsCertificateModelPrivate::~AdvSecSettingsCertificateModelPrivate()
|
|
95 |
{
|
|
96 |
Cancel();
|
|
97 |
|
|
98 |
delete iMover;
|
|
99 |
delete iCertAppInfoManager;
|
|
100 |
delete iCertStore;
|
|
101 |
iFs.Close();
|
|
102 |
|
|
103 |
iCertInfo = NULL;
|
|
104 |
iCertInfoArray.Close();
|
|
105 |
delete iCertListBuilder;
|
|
106 |
delete iDetailsBuilder;
|
|
107 |
|
|
108 |
iTrustedUids = NULL;
|
|
109 |
iApplications.Reset();
|
|
110 |
}
|
|
111 |
|
|
112 |
// ---------------------------------------------------------------------------
|
|
113 |
// AdvSecSettingsCertificateModelPrivate::initialize()
|
|
114 |
// ---------------------------------------------------------------------------
|
|
115 |
//
|
|
116 |
void AdvSecSettingsCertificateModelPrivate::initialize()
|
|
117 |
{
|
|
118 |
if (!IsActive() && (iState == ENotInitialized)) {
|
|
119 |
TRAP_HANDLE_AND_RETURN_IF_ERROR(ConstructL());
|
|
120 |
iCertStore->Initialize(iStatus);
|
|
121 |
iState = EInitializing;
|
|
122 |
SetActive();
|
|
123 |
} else {
|
|
124 |
q_ptr->handleError(KErrAlreadyExists);
|
|
125 |
}
|
|
126 |
}
|
|
127 |
|
|
128 |
// ---------------------------------------------------------------------------
|
|
129 |
// AdvSecSettingsCertificateModelPrivate::getCertificates()
|
|
130 |
// ---------------------------------------------------------------------------
|
|
131 |
//
|
|
132 |
void AdvSecSettingsCertificateModelPrivate::getCertificates(
|
|
133 |
QList<AdvSecSettingsCertificate*> &certList)
|
|
134 |
{
|
|
135 |
if (!IsActive() && (iState == EIdle)) {
|
|
136 |
if (!iCertListBuilder) {
|
|
137 |
TRAP_HANDLE_AND_RETURN_IF_ERROR(iCertListBuilder =
|
|
138 |
CAdvSecSettingsCertListBuilder::NewL(iFs, *iCertStore));
|
|
139 |
}
|
|
140 |
iCertListBuilder->GetCertificateList(certList, iCertInfoArray, iStatus);
|
|
141 |
iState = EGettingCertificatesList;
|
|
142 |
SetActive();
|
|
143 |
} else {
|
|
144 |
q_ptr->handleError(KErrInUse);
|
|
145 |
}
|
|
146 |
}
|
|
147 |
|
|
148 |
// ---------------------------------------------------------------------------
|
|
149 |
// AdvSecSettingsCertificateModelPrivate::getCertificateDetails()
|
|
150 |
// ---------------------------------------------------------------------------
|
|
151 |
//
|
|
152 |
void AdvSecSettingsCertificateModelPrivate::getCertificateDetails(
|
|
153 |
const AdvSecSettingsCertificate &cert, QMap<int,QString> &details)
|
|
154 |
{
|
|
155 |
if (!IsActive() && (iState == EIdle)) {
|
|
156 |
iCertInfo = CertificateInfo(cert);
|
|
157 |
if (iCertInfo) {
|
|
158 |
if (!iDetailsBuilder) {
|
|
159 |
TRAP_HANDLE_AND_RETURN_IF_ERROR(iDetailsBuilder =
|
|
160 |
CAdvSecSettingsCertDetailsBuilder::NewL(iFs, *iCertStore));
|
|
161 |
}
|
|
162 |
TRAP_HANDLE_AND_RETURN_IF_ERROR(
|
|
163 |
iDetailsBuilder->GetDetailsL(*iCertInfo, details, iStatus));
|
|
164 |
iState = EBuildingCertificateDetails;
|
|
165 |
SetActive();
|
|
166 |
}
|
|
167 |
} else {
|
|
168 |
q_ptr->handleError(KErrInUse);
|
|
169 |
}
|
|
170 |
}
|
|
171 |
|
|
172 |
// ---------------------------------------------------------------------------
|
|
173 |
// AdvSecSettingsCertificateModelPrivate::isDeletable()
|
|
174 |
// ---------------------------------------------------------------------------
|
|
175 |
//
|
|
176 |
bool AdvSecSettingsCertificateModelPrivate::isDeletable(
|
|
177 |
const AdvSecSettingsCertificate &cert) const
|
|
178 |
{
|
|
179 |
const CCTCertInfo* certInfo = CertificateInfo(cert);
|
|
180 |
if (certInfo) {
|
|
181 |
return certInfo->IsDeletable();
|
|
182 |
}
|
|
183 |
return false;
|
|
184 |
}
|
|
185 |
|
|
186 |
// ---------------------------------------------------------------------------
|
|
187 |
// AdvSecSettingsCertificateModelPrivate::deleteCertificate()
|
|
188 |
// ---------------------------------------------------------------------------
|
|
189 |
//
|
|
190 |
void AdvSecSettingsCertificateModelPrivate::deleteCertificate(
|
|
191 |
const AdvSecSettingsCertificate &cert)
|
|
192 |
{
|
|
193 |
if (!IsActive() && (iState == EIdle)) {
|
|
194 |
iCertInfo = CertificateInfo(cert);
|
|
195 |
if (iCertInfo) {
|
|
196 |
iCertStore->Remove(*iCertInfo, iStatus);
|
|
197 |
iState = EDeletingCertificate;
|
|
198 |
SetActive();
|
|
199 |
}
|
|
200 |
} else {
|
|
201 |
q_ptr->handleError(KErrInUse);
|
|
202 |
}
|
|
203 |
}
|
|
204 |
|
|
205 |
// ---------------------------------------------------------------------------
|
|
206 |
// AdvSecSettingsCertificateModelPrivate::getTrustSettings()
|
|
207 |
// ---------------------------------------------------------------------------
|
|
208 |
//
|
|
209 |
void AdvSecSettingsCertificateModelPrivate::getTrustSettings(
|
|
210 |
const AdvSecSettingsCertificate &cert, QMap<int,bool> &usageIdAndTrust)
|
|
211 |
{
|
|
212 |
if (!IsActive() && (iState == EIdle)) {
|
|
213 |
iCertInfo = CertificateInfo(cert);
|
|
214 |
if (iCertInfo) {
|
|
215 |
iTrustedUids = &usageIdAndTrust;
|
|
216 |
iApplications.Reset();
|
|
217 |
iCertStore->Applications(*iCertInfo, iApplications, iStatus);
|
|
218 |
iState = EReadingApplications;
|
|
219 |
SetActive();
|
|
220 |
}
|
|
221 |
} else {
|
|
222 |
q_ptr->handleError(KErrInUse);
|
|
223 |
}
|
|
224 |
}
|
|
225 |
|
|
226 |
// ---------------------------------------------------------------------------
|
|
227 |
// AdvSecSettingsCertificateModelPrivate::setTrustSettings()
|
|
228 |
// ---------------------------------------------------------------------------
|
|
229 |
//
|
|
230 |
void AdvSecSettingsCertificateModelPrivate::setTrustSettings(
|
|
231 |
const AdvSecSettingsCertificate &cert, const QMap<int,bool> &usageIdAndTrust)
|
|
232 |
{
|
|
233 |
if (!IsActive() && (iState == EIdle)) {
|
|
234 |
iCertInfo = CertificateInfo(cert);
|
|
235 |
if (iCertInfo) {
|
|
236 |
iApplications.Reset();
|
|
237 |
QMapIterator<int,bool> usageIter(usageIdAndTrust);
|
|
238 |
while (usageIter.hasNext()) {
|
|
239 |
usageIter.next();
|
|
240 |
if (usageIter.value()) {
|
|
241 |
iApplications.Append(TUid::Uid(usageIter.key()));
|
|
242 |
}
|
|
243 |
}
|
|
244 |
|
|
245 |
iCertStore->SetApplicability(*iCertInfo, iApplications, iStatus);
|
|
246 |
iState = EWritingApplications;
|
|
247 |
SetActive();
|
|
248 |
}
|
|
249 |
} else {
|
|
250 |
q_ptr->handleError(KErrInUse);
|
|
251 |
}
|
|
252 |
}
|
|
253 |
|
|
254 |
// ---------------------------------------------------------------------------
|
|
255 |
// AdvSecSettingsCertificateModelPrivate::getCertificateUsageNames()
|
|
256 |
// ---------------------------------------------------------------------------
|
|
257 |
//
|
|
258 |
void AdvSecSettingsCertificateModelPrivate::getCertificateUsageNames(
|
|
259 |
QMap<int,QString> &usageIdAndName)
|
|
260 |
{
|
|
261 |
usageIdAndName.clear();
|
|
262 |
QT_TRAP_THROWING(DoGetCertificateUsageNamesL(usageIdAndName));
|
|
263 |
}
|
|
264 |
|
|
265 |
// ---------------------------------------------------------------------------
|
|
266 |
// AdvSecSettingsCertificateModelPrivate::moveToPersonalCertificates()
|
|
267 |
// ---------------------------------------------------------------------------
|
|
268 |
//
|
|
269 |
void AdvSecSettingsCertificateModelPrivate::moveToPersonalCertificates(
|
|
270 |
const AdvSecSettingsCertificate &cert)
|
|
271 |
{
|
|
272 |
if (!IsActive() && (iState == EIdle)) {
|
|
273 |
iCertInfo = CertificateInfo(cert);
|
|
274 |
if (iCertInfo) {
|
|
275 |
if (!iMover) {
|
|
276 |
TRAP_HANDLE_AND_RETURN_IF_ERROR(iMover =
|
|
277 |
CAdvSecSettingsCertMover::NewL(iFs));
|
|
278 |
}
|
|
279 |
// personal certificate store == file certificate store
|
|
280 |
iMover->Move(*iCertInfo, KAdvSecSettingsDeviceCertStore,
|
|
281 |
KAdvSecSettingsFileCertStore, iStatus);
|
|
282 |
iState = EMovingCertificateToPersonalStore;
|
|
283 |
SetActive();
|
|
284 |
}
|
|
285 |
} else {
|
|
286 |
q_ptr->handleError(KErrInUse);
|
|
287 |
}
|
|
288 |
}
|
|
289 |
|
|
290 |
// ---------------------------------------------------------------------------
|
|
291 |
// AdvSecSettingsCertificateModelPrivate::moveToDeviceCertificates()
|
|
292 |
// ---------------------------------------------------------------------------
|
|
293 |
//
|
|
294 |
void AdvSecSettingsCertificateModelPrivate::moveToDeviceCertificates(
|
|
295 |
const AdvSecSettingsCertificate &cert)
|
|
296 |
{
|
|
297 |
if (!IsActive() && (iState == EIdle)) {
|
|
298 |
iCertInfo = CertificateInfo(cert);
|
|
299 |
if (iCertInfo) {
|
|
300 |
if (!iMover) {
|
|
301 |
TRAP_HANDLE_AND_RETURN_IF_ERROR(iMover =
|
|
302 |
CAdvSecSettingsCertMover::NewL(iFs));
|
|
303 |
}
|
|
304 |
iMover->Move(*iCertInfo, KAdvSecSettingsFileCertStore,
|
|
305 |
KAdvSecSettingsDeviceCertStore, iStatus);
|
|
306 |
iState = EMovingCertificateToDeviceStore;
|
|
307 |
SetActive();
|
|
308 |
}
|
|
309 |
} else {
|
|
310 |
q_ptr->handleError(KErrInUse);
|
|
311 |
}
|
|
312 |
}
|
|
313 |
|
|
314 |
// ---------------------------------------------------------------------------
|
|
315 |
// AdvSecSettingsCertificateModelPrivate::DoCancel()
|
|
316 |
// ---------------------------------------------------------------------------
|
|
317 |
//
|
|
318 |
void AdvSecSettingsCertificateModelPrivate::DoCancel()
|
|
319 |
{
|
|
320 |
switch (iState) {
|
|
321 |
case EInitializing:
|
|
322 |
iCertStore->CancelInitialize();
|
|
323 |
break;
|
|
324 |
case EGettingCertificatesList:
|
|
325 |
delete iCertListBuilder;
|
|
326 |
iCertListBuilder = NULL;
|
|
327 |
break;
|
|
328 |
case EBuildingCertificateDetails:
|
|
329 |
delete iDetailsBuilder;
|
|
330 |
iDetailsBuilder = NULL;
|
|
331 |
break;
|
|
332 |
case EDeletingCertificate:
|
|
333 |
iCertStore->CancelRemove();
|
|
334 |
break;
|
|
335 |
case EReadingApplications:
|
|
336 |
iCertStore->CancelApplications();
|
|
337 |
break;
|
|
338 |
case EWritingApplications:
|
|
339 |
iCertStore->CancelSetApplicability();
|
|
340 |
break;
|
|
341 |
case EMovingCertificateToPersonalStore:
|
|
342 |
case EMovingCertificateToDeviceStore:
|
|
343 |
delete iMover;
|
|
344 |
iMover = NULL;
|
|
345 |
break;
|
|
346 |
default:
|
|
347 |
break;
|
|
348 |
}
|
|
349 |
if (iState == EInitializing) {
|
|
350 |
iState = ENotInitialized;
|
|
351 |
} else {
|
|
352 |
iState = EIdle;
|
|
353 |
}
|
|
354 |
q_ptr->handleError(KErrCancel);
|
|
355 |
}
|
|
356 |
|
|
357 |
// ---------------------------------------------------------------------------
|
|
358 |
// AdvSecSettingsCertificateModelPrivate::RunL()
|
|
359 |
// ---------------------------------------------------------------------------
|
|
360 |
//
|
|
361 |
void AdvSecSettingsCertificateModelPrivate::RunL()
|
|
362 |
{
|
|
363 |
User::LeaveIfError(iStatus.Int());
|
|
364 |
|
|
365 |
switch (iState) {
|
|
366 |
case EInitializing:
|
|
367 |
iState = EIdle;
|
|
368 |
q_ptr->handleInitializeCompleted();
|
|
369 |
break;
|
|
370 |
case EGettingCertificatesList:
|
|
371 |
iState = EIdle;
|
|
372 |
q_ptr->handleGetCertificatesCompleted();
|
|
373 |
break;
|
|
374 |
case EBuildingCertificateDetails:
|
|
375 |
iState = EIdle;
|
|
376 |
q_ptr->handleGetCertificateDetailsCompleted();
|
|
377 |
break;
|
|
378 |
case EDeletingCertificate:
|
|
379 |
iState = EIdle;
|
|
380 |
q_ptr->handleDeleteCertificateCompleted();
|
|
381 |
break;
|
|
382 |
case EReadingApplications:
|
|
383 |
ReturnTrustSettingsDetails();
|
|
384 |
iState = EIdle;
|
|
385 |
q_ptr->handleGetTrustSettingsCompleted();
|
|
386 |
break;
|
|
387 |
case EWritingApplications:
|
|
388 |
iState = EIdle;
|
|
389 |
q_ptr->handleSetTrustSettingsCompleted();
|
|
390 |
break;
|
|
391 |
case EMovingCertificateToPersonalStore:
|
|
392 |
iState = EIdle;
|
|
393 |
q_ptr->handleMoveToPersonalCertificateCompleted();
|
|
394 |
break;
|
|
395 |
case EMovingCertificateToDeviceStore:
|
|
396 |
iState = EIdle;
|
|
397 |
q_ptr->handleMoveToDeviceCertificatesCompleted();
|
|
398 |
break;
|
|
399 |
default:
|
|
400 |
ASSERT(EFalse);
|
|
401 |
break;
|
|
402 |
}
|
|
403 |
}
|
|
404 |
|
|
405 |
// ---------------------------------------------------------------------------
|
|
406 |
// AdvSecSettingsCertificateModelPrivate::RunError()
|
|
407 |
// ---------------------------------------------------------------------------
|
|
408 |
//
|
|
409 |
TInt AdvSecSettingsCertificateModelPrivate::RunError(TInt aError)
|
|
410 |
{
|
|
411 |
if (iState == EInitializing) {
|
|
412 |
iState = ENotInitialized;
|
|
413 |
} else {
|
|
414 |
iState = EIdle;
|
|
415 |
}
|
|
416 |
q_ptr->handleError(aError);
|
|
417 |
return KErrNone;
|
|
418 |
}
|
|
419 |
|
|
420 |
// ---------------------------------------------------------------------------
|
|
421 |
// AdvSecSettingsCertificateModelPrivate::ConstructL()
|
|
422 |
// ---------------------------------------------------------------------------
|
|
423 |
//
|
|
424 |
void AdvSecSettingsCertificateModelPrivate::ConstructL()
|
|
425 |
{
|
|
426 |
User::LeaveIfError(iFs.Connect());
|
|
427 |
const TBool KWriteMode = ETrue;
|
|
428 |
iCertStore = CUnifiedCertStore::NewL(iFs, KWriteMode);
|
|
429 |
iCertAppInfoManager = CCertificateAppInfoManager::NewL();
|
|
430 |
if (!HbTextResolverSymbian::Init(KTranslationFile, KTranslationPath)) {
|
|
431 |
// TODO: text resolver initialisation failed
|
|
432 |
}
|
|
433 |
}
|
|
434 |
|
|
435 |
// ---------------------------------------------------------------------------
|
|
436 |
// AdvSecSettingsCertificateModelPrivate::ReturnTrustSettingsDetails()
|
|
437 |
// ---------------------------------------------------------------------------
|
|
438 |
//
|
|
439 |
void AdvSecSettingsCertificateModelPrivate::ReturnTrustSettingsDetails()
|
|
440 |
{
|
|
441 |
if (iTrustedUids && iCertInfo) {
|
|
442 |
iTrustedUids->clear();
|
|
443 |
|
|
444 |
// Set applicable trusted usages for different kinds of certs.
|
|
445 |
TUid tokenType(iCertInfo->Token().TokenType().Type());
|
|
446 |
if (tokenType.iUid == KAdvSecSettingsSWICertStore) {
|
|
447 |
iTrustedUids->insert(KAdvSecSettingsTrustedUsageSwInstallNativeSis, false);
|
|
448 |
iTrustedUids->insert(KAdvSecSettingsTrustedUsageSwInstallSisOcsp, false);
|
|
449 |
} else if (tokenType.iUid == KAdvSecSettingsMidpCertStore) {
|
|
450 |
iTrustedUids->insert(KAdvSecSettingsTrustedUsageSwInstallJava, false);
|
|
451 |
} else {
|
|
452 |
const RArray<TCertificateAppInfo> &apps(iCertAppInfoManager->Applications());
|
|
453 |
for (TInt index = 0; index < apps.Count(); ++index) {
|
|
454 |
const TCertificateAppInfo &appInfo = apps[index];
|
|
455 |
int usageId = appInfo.Id().iUid;
|
|
456 |
iTrustedUids->insert(usageId, false);
|
|
457 |
}
|
|
458 |
}
|
|
459 |
|
|
460 |
// Set trusted usages, usually this just replaces some of the values set above.
|
|
461 |
TInt count = iApplications.Count();
|
|
462 |
for (TInt index = 0; index < count; ++index ) {
|
|
463 |
iTrustedUids->insert(iApplications[index].iUid, true);
|
|
464 |
}
|
|
465 |
|
|
466 |
// Native and Java installation use certs only from SWI and MIDP cert stores.
|
|
467 |
// Hence, native and Java install usages are not displayed for certs in file
|
|
468 |
// cert store.
|
|
469 |
if (tokenType.iUid == KAdvSecSettingsFileCertStore) {
|
|
470 |
iTrustedUids->remove(KAdvSecSettingsTrustedUsageSwInstallNativeSis);
|
|
471 |
iTrustedUids->remove(KAdvSecSettingsTrustedUsageSwInstallJava);
|
|
472 |
}
|
|
473 |
}
|
|
474 |
}
|
|
475 |
|
|
476 |
// ---------------------------------------------------------------------------
|
|
477 |
// AdvSecSettingsCertificateModelPrivate::DoGetCertificateUsageNamesL()
|
|
478 |
// ---------------------------------------------------------------------------
|
|
479 |
//
|
|
480 |
void AdvSecSettingsCertificateModelPrivate::DoGetCertificateUsageNamesL(
|
|
481 |
QMap<int,QString> &usageIdAndName)
|
|
482 |
{
|
|
483 |
// Pre-defined localized usage names
|
|
484 |
HBufC* usageName = HbTextResolverSymbian::LoadLC(KLocNativeInstallationUsage);
|
|
485 |
usageIdAndName[KAdvSecSettingsTrustedUsageSwInstallNativeSis] = CopyStringL(*usageName);
|
|
486 |
CleanupStack::PopAndDestroy(usageName);
|
|
487 |
|
|
488 |
usageName = HbTextResolverSymbian::LoadLC(KLocJavaInstallationUsage);
|
|
489 |
usageIdAndName[KAdvSecSettingsTrustedUsageSwInstallJava] = CopyStringL(*usageName);
|
|
490 |
CleanupStack::PopAndDestroy(usageName);
|
|
491 |
|
|
492 |
usageName = HbTextResolverSymbian::LoadLC(KLocWidgetInstallationUsage);
|
|
493 |
usageIdAndName[KAdvSecSettingsTrustedUsageSwInstallWidget] = CopyStringL(*usageName);
|
|
494 |
CleanupStack::PopAndDestroy(usageName);
|
|
495 |
|
|
496 |
usageName = HbTextResolverSymbian::LoadLC(KLocInternetUsage);
|
|
497 |
usageIdAndName[KAdvSecSettingsTrustedUsageInternet] = CopyStringL(*usageName);
|
|
498 |
CleanupStack::PopAndDestroy(usageName);
|
|
499 |
|
|
500 |
usageName = HbTextResolverSymbian::LoadLC(KLocOcspUsage);
|
|
501 |
usageIdAndName[KAdvSecSettingsTrustedUsageSwInstallSisOcsp] = CopyStringL(*usageName);
|
|
502 |
CleanupStack::PopAndDestroy(usageName);
|
|
503 |
|
|
504 |
usageName = HbTextResolverSymbian::LoadLC(KLocVPNUsage);
|
|
505 |
usageIdAndName[KAdvSecSettingsTrustedUsageVPN] = CopyStringL(*usageName);
|
|
506 |
CleanupStack::PopAndDestroy(usageName);
|
|
507 |
|
|
508 |
// TODO: localized UI string needed
|
|
509 |
usageIdAndName[KAdvSecSettingsTrustedUsageWap] = QString("Wap");
|
|
510 |
|
|
511 |
// Possible additional usage names defined in system databases
|
|
512 |
if (iCertAppInfoManager) {
|
|
513 |
const RArray<TCertificateAppInfo> &apps(iCertAppInfoManager->Applications());
|
|
514 |
for(TInt index = 0; index < apps.Count(); ++index) {
|
|
515 |
const TCertificateAppInfo &appInfo = apps[index];
|
|
516 |
|
|
517 |
int usageId = appInfo.Id().iUid;
|
|
518 |
if (!usageIdAndName.contains(usageId)) {
|
|
519 |
QString usageName = CopyStringL(appInfo.Name());
|
|
520 |
usageIdAndName.insert(usageId, usageName);
|
|
521 |
}
|
|
522 |
}
|
|
523 |
}
|
|
524 |
}
|
|
525 |
|
|
526 |
// ---------------------------------------------------------------------------
|
|
527 |
// AdvSecSettingsCertificateModelPrivate::CertificateInfo()
|
|
528 |
// ---------------------------------------------------------------------------
|
|
529 |
//
|
|
530 |
const CCTCertInfo *AdvSecSettingsCertificateModelPrivate::CertificateInfo(
|
|
531 |
const AdvSecSettingsCertificate &cert) const
|
|
532 |
{
|
|
533 |
TInt index = cert.modelIndex();
|
|
534 |
if (index >= 0 && index < iCertInfoArray.Count()) {
|
|
535 |
return iCertInfoArray[index];
|
|
536 |
}
|
|
537 |
return NULL;
|
|
538 |
}
|
|
539 |
|