os/security/cryptoservices/filebasedcertificateandkeystores/test/certtool/certtool_remove.cpp
First public contribution.
2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #include "certtool_commands.h"
20 #include "certtool_controller.h"
22 /*static*/ CCertToolRemove* CCertToolRemove::NewLC(CCertToolController* aController)
24 CCertToolRemove* self = new (ELeave) CCertToolRemove(aController);
25 CleanupStack::PushL(self);
30 /*static*/ CCertToolRemove* CCertToolRemove::NewL(CCertToolController* aController)
32 CCertToolRemove* self = CCertToolRemove::NewLC(aController);
33 CleanupStack::Pop(self);
37 CCertToolRemove::CCertToolRemove(CCertToolController* aController) : CCertToolList(aController)
42 CCertToolRemove::~CCertToolRemove()
47 void CCertToolRemove::RunL()
49 if (iStatus.Int() != KErrNone)
51 User::Leave(iStatus.Int());
57 // Look for a specific certificate
59 for (TInt j = 0; j < iCertInfos.Count(); j++)
61 if (iCertInfos[j]->Label() == *iParams->iDefault)
72 iCertStore->Remove(*iCertInfos[certIndex], iStatus);
76 User::Leave(KErrNotFound);
83 User::LeaveIfError(iStatus.Int());
86 iController->DisplayLocalisedMsgL(R_CERTTOOL_ERR_REMOVE_SUCCESS);
88 CActiveScheduler::Stop();
93 User::Panic(_L("REMOVE action: Illegal state."), 1);
98 TInt CCertToolRemove::RunError(TInt aError)
100 CActiveScheduler::Stop();
106 TRAP_IGNORE(iController->DisplayLocalisedMsgL(R_CERTTOOL_ERR_NOTFOUND));
111 TRAP_IGNORE(iController->DisplayLocalisedMsgL(R_CERTTOOL_ERR_REMOVE_FAILURE, aError));
115 TRAP_IGNORE(iController->DisplayErrorL(_L("\n"), iParams->iPageWise));