|
1 /* |
|
2 * Copyright (c) 2004-2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <mctkeystore.h> |
|
20 |
|
21 #include "keytool_utils.h" |
|
22 #include "keytool_commands.h" |
|
23 #include "keytool_controller.h" |
|
24 |
|
25 #include <keytool.rsg> |
|
26 |
|
27 /*static*/ CKeytoolRemove* CKeytoolRemove::NewLC(CKeyToolController* aController) |
|
28 { |
|
29 CKeytoolRemove* self = new (ELeave) CKeytoolRemove(aController); |
|
30 CleanupStack::PushL(self); |
|
31 self->ConstructL(); |
|
32 return self; |
|
33 } |
|
34 |
|
35 /*static*/ CKeytoolRemove* CKeytoolRemove::NewL(CKeyToolController* aController) |
|
36 { |
|
37 CKeytoolRemove* self = CKeytoolRemove::NewLC(aController); |
|
38 CleanupStack::Pop(self); |
|
39 return self; |
|
40 } |
|
41 |
|
42 CKeytoolRemove::CKeytoolRemove(CKeyToolController* aController) : CKeytoolList(aController) |
|
43 { |
|
44 } |
|
45 |
|
46 CKeytoolRemove::~CKeytoolRemove() |
|
47 { |
|
48 Cancel(); |
|
49 iKeyList.Close(); |
|
50 } |
|
51 |
|
52 void CKeytoolRemove::RunL() |
|
53 { |
|
54 if (iStatus.Int() != KErrNone) |
|
55 { |
|
56 User::Leave(iStatus.Int()); |
|
57 } |
|
58 |
|
59 switch (iState) |
|
60 { |
|
61 case EListKeys: |
|
62 { |
|
63 iKeyList = KeyToolUtils::MatchKey(iKeys, *iParams->iDefault); |
|
64 if (iKeyList.Count() > 0) |
|
65 { |
|
66 iKeyStore->DeleteKey(iKeyList[idx]->Handle(), iStatus); |
|
67 iState = EFinished; |
|
68 SetActive(); |
|
69 } |
|
70 else |
|
71 { |
|
72 User::Leave(KErrNotFound); |
|
73 } |
|
74 /*CCTKeyInfo* theKey = KeyToolUtils::findKey(iKeys, *iParams->iDefault); |
|
75 if (theKey) |
|
76 { |
|
77 iKeyStore->DeleteKey(theKey->Handle(), iStatus); |
|
78 iState = EFinished; |
|
79 SetActive(); |
|
80 |
|
81 } |
|
82 else |
|
83 { |
|
84 User::Leave(KErrNotFound); |
|
85 }*/ |
|
86 } |
|
87 break; |
|
88 |
|
89 case EFinished: |
|
90 { |
|
91 idx++; |
|
92 if (idx < iKeyList.Count()) |
|
93 { |
|
94 iKeyStore->DeleteKey(iKeyList[idx]->Handle(), iStatus); |
|
95 SetActive(); |
|
96 } |
|
97 else |
|
98 { |
|
99 iController->DisplayLocalisedMsgL(R_KEYTOOL_ERR_DELETESUCCESS); |
|
100 CActiveScheduler::Stop(); |
|
101 } |
|
102 } |
|
103 break; |
|
104 default: |
|
105 { |
|
106 User::Panic(_L("REMOVE action: Illegal state."), 1); |
|
107 } |
|
108 } |
|
109 |
|
110 } |