sl@0: /* sl@0: * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: #include sl@0: sl@0: #include "keytool_utils.h" sl@0: #include "keytool_commands.h" sl@0: #include "keytool_controller.h" sl@0: sl@0: #include sl@0: sl@0: /*static*/ CKeytoolRemove* CKeytoolRemove::NewLC(CKeyToolController* aController) sl@0: { sl@0: CKeytoolRemove* self = new (ELeave) CKeytoolRemove(aController); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: return self; sl@0: } sl@0: sl@0: /*static*/ CKeytoolRemove* CKeytoolRemove::NewL(CKeyToolController* aController) sl@0: { sl@0: CKeytoolRemove* self = CKeytoolRemove::NewLC(aController); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: CKeytoolRemove::CKeytoolRemove(CKeyToolController* aController) : CKeytoolList(aController) sl@0: { sl@0: } sl@0: sl@0: CKeytoolRemove::~CKeytoolRemove() sl@0: { sl@0: Cancel(); sl@0: iKeyList.Close(); sl@0: } sl@0: sl@0: void CKeytoolRemove::RunL() sl@0: { sl@0: if (iStatus.Int() != KErrNone) sl@0: { sl@0: User::Leave(iStatus.Int()); sl@0: } sl@0: sl@0: switch (iState) sl@0: { sl@0: case EListKeys: sl@0: { sl@0: iKeyList = KeyToolUtils::MatchKey(iKeys, *iParams->iDefault); sl@0: if (iKeyList.Count() > 0) sl@0: { sl@0: iKeyStore->DeleteKey(iKeyList[idx]->Handle(), iStatus); sl@0: iState = EFinished; sl@0: SetActive(); sl@0: } sl@0: else sl@0: { sl@0: User::Leave(KErrNotFound); sl@0: } sl@0: /*CCTKeyInfo* theKey = KeyToolUtils::findKey(iKeys, *iParams->iDefault); sl@0: if (theKey) sl@0: { sl@0: iKeyStore->DeleteKey(theKey->Handle(), iStatus); sl@0: iState = EFinished; sl@0: SetActive(); sl@0: sl@0: } sl@0: else sl@0: { sl@0: User::Leave(KErrNotFound); sl@0: }*/ sl@0: } sl@0: break; sl@0: sl@0: case EFinished: sl@0: { sl@0: idx++; sl@0: if (idx < iKeyList.Count()) sl@0: { sl@0: iKeyStore->DeleteKey(iKeyList[idx]->Handle(), iStatus); sl@0: SetActive(); sl@0: } sl@0: else sl@0: { sl@0: iController->DisplayLocalisedMsgL(R_KEYTOOL_ERR_DELETESUCCESS); sl@0: CActiveScheduler::Stop(); sl@0: } sl@0: } sl@0: break; sl@0: default: sl@0: { sl@0: User::Panic(_L("REMOVE action: Illegal state."), 1); sl@0: } sl@0: } sl@0: sl@0: } sl@0: