--- a/pkiutilities/SecModUI/src/SecModUISyncWrapper.cpp Tue Feb 02 00:44:34 2010 +0200
+++ b/pkiutilities/SecModUI/src/SecModUISyncWrapper.cpp Fri Feb 19 23:42:03 2010 +0200
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -18,8 +18,6 @@
*/
-
-// INCLUDE FILES
#include "SecModUISyncWrapper.h"
#include <ct/ccttokentypeinfo.h>
#include <ct/mcttokentype.h>
@@ -51,7 +49,7 @@
CSecModUISyncWrapper* CSecModUISyncWrapper::NewLC()
{
CSecModUISyncWrapper* wrap = new (ELeave) CSecModUISyncWrapper();
- CleanupStack::PushL(wrap);
+ CleanupStack::PushL(wrap);
return wrap;
}
@@ -86,14 +84,19 @@
TInt CSecModUISyncWrapper::Initialize(CUnifiedKeyStore& aKeyStore)
{
LOG_ENTERFN("CSecModUISyncWrapper::Initialize");
- iOperation = EOperationInit;
- iObject = STATIC_CAST(TAny*, &aKeyStore);
- aKeyStore.Initialize(iStatus);
- SetActive();
- iWait.Start();
- iOperation = EOperationNone;
- LOG_LEAVEFN("CSecModUISyncWrapper::Initialize");
- return iStatus.Int();
+ if( !IsActive() && !iWait.IsStarted() )
+ {
+ iOperation = EOperationInit;
+ iObject = STATIC_CAST(TAny*, &aKeyStore);
+ aKeyStore.Initialize(iStatus);
+ SetActive();
+ iWait.Start();
+ iOperation = EOperationNone;
+ LOG_LEAVEFN("CSecModUISyncWrapper::Initialize");
+ return iStatus.Int();
+ }
+ LOG_LEAVEFN("CSecModUISyncWrapper::Initialize - KErrInUse");
+ return KErrInUse;
}
// -----------------------------------------------------------------------------
@@ -104,18 +107,23 @@
MCTToken& aToken, MCTTokenInterface*& aTokenInterface)
{
LOG_ENTERFN("CSecModUISyncWrapper::GetAuthObjectInterface");
- iOperation = EOperationGetAOInterface;
- iObject = STATIC_CAST(TAny*, &aToken);
- const TUid KUidInterfaceAO = { KCTInterfaceAuthenticationObject };
- aToken.GetInterface(KUidInterfaceAO, aTokenInterface, iStatus);
- iOperation = EOperationGetAOInterface;
- SetActive();
- iWait.Start();
- iOperation = EOperationNone;
- LOG_LEAVEFN("CSecModUISyncWrapper::GetAuthObjectInterface");
- return iStatus.Int();
+ if( !IsActive() && !iWait.IsStarted() )
+ {
+ iOperation = EOperationGetAOInterface;
+ iObject = STATIC_CAST(TAny*, &aToken);
+ const TUid KUidInterfaceAO = { KCTInterfaceAuthenticationObject };
+ aToken.GetInterface(KUidInterfaceAO, aTokenInterface, iStatus);
+ iOperation = EOperationGetAOInterface;
+ SetActive();
+ iWait.Start();
+ iOperation = EOperationNone;
+ LOG_LEAVEFN("CSecModUISyncWrapper::GetAuthObjectInterface");
+ return iStatus.Int();
+ }
+ LOG_LEAVEFN("CSecModUISyncWrapper::GetAuthObjectInterface - KErrInUse");
+ return KErrInUse;
}
-
+
// -----------------------------------------------------------------------------
// CSecModUISyncWrapper::ListAuthObjects(...)
// -----------------------------------------------------------------------------
@@ -125,56 +133,71 @@
RMPointerArray<MCTAuthenticationObject>& aAuthObjects)
{
LOG_ENTERFN("CSecModUISyncWrapper::ListAuthObjects");
- iOperation = EOperationListAOs;
- iObject = STATIC_CAST(TAny*, &aAuthObjList);
- aAuthObjList.List( aAuthObjects, iStatus );
- iOperation = EOperationListAOs;
- SetActive();
- iWait.Start();
- iOperation = EOperationNone;
- LOG_LEAVEFN("CSecModUISyncWrapper::ListAuthObjects");
- return iStatus.Int();
+ if( !IsActive() && !iWait.IsStarted() )
+ {
+ iOperation = EOperationListAOs;
+ iObject = STATIC_CAST(TAny*, &aAuthObjList);
+ aAuthObjList.List( aAuthObjects, iStatus );
+ iOperation = EOperationListAOs;
+ SetActive();
+ iWait.Start();
+ iOperation = EOperationNone;
+ LOG_LEAVEFN("CSecModUISyncWrapper::ListAuthObjects");
+ return iStatus.Int();
+ }
+ LOG_LEAVEFN("CSecModUISyncWrapper::ListAuthObjects - KErrInUse");
+ return KErrInUse;
}
-
+
// -----------------------------------------------------------------------------
// CSecModUISyncWrapper::ListKeys(...)
// -----------------------------------------------------------------------------
-//
+//
TInt CSecModUISyncWrapper::ListKeys(
- MCTKeyStore& aKeyStore,
- RMPointerArray<CCTKeyInfo>& aKeysInfos,
+ MCTKeyStore& aKeyStore,
+ RMPointerArray<CCTKeyInfo>& aKeysInfos,
const TCTKeyAttributeFilter& aFilter)
{
LOG_ENTERFN("CSecModUISyncWrapper::ListKeys");
- iOperation = EOperationListKeys;
- iObject = STATIC_CAST(TAny*, &aKeyStore);
- aKeyStore.List(aKeysInfos, aFilter, iStatus);
- SetActive();
- iWait.Start();
- iOperation = EOperationNone;
- LOG_LEAVEFN("CSecModUISyncWrapper::ListKeys");
- return iStatus.Int();
+ if( !IsActive() && !iWait.IsStarted() )
+ {
+ iOperation = EOperationListKeys;
+ iObject = STATIC_CAST(TAny*, &aKeyStore);
+ aKeyStore.List(aKeysInfos, aFilter, iStatus);
+ SetActive();
+ iWait.Start();
+ iOperation = EOperationNone;
+ LOG_LEAVEFN("CSecModUISyncWrapper::ListKeys");
+ return iStatus.Int();
+ }
+ LOG_LEAVEFN("CSecModUISyncWrapper::ListKeys - KErrInUse");
+ return KErrInUse;
}
// -----------------------------------------------------------------------------
// CSecModUISyncWrapper::DeleteKey(...)
// -----------------------------------------------------------------------------
-//
+//
TInt CSecModUISyncWrapper::DeleteKey(
- CUnifiedKeyStore& aKeyStore,
+ CUnifiedKeyStore& aKeyStore,
TCTTokenObjectHandle aHandle)
{
LOG_ENTERFN("CSecModUISyncWrapper::DeleteKey");
- iOperation = EOperationDelKey;
- iObject = STATIC_CAST(TAny*, &aKeyStore);
- aKeyStore.DeleteKey(aHandle, iStatus);
- SetActive();
- iWait.Start();
- iOperation = EOperationNone;
- LOG_LEAVEFN("CSecModUISyncWrapper::DeleteKey");
- return iStatus.Int();
+ if( !IsActive() && !iWait.IsStarted() )
+ {
+ iOperation = EOperationDelKey;
+ iObject = STATIC_CAST(TAny*, &aKeyStore);
+ aKeyStore.DeleteKey(aHandle, iStatus);
+ SetActive();
+ iWait.Start();
+ iOperation = EOperationNone;
+ LOG_LEAVEFN("CSecModUISyncWrapper::DeleteKey");
+ return iStatus.Int();
+ }
+ LOG_LEAVEFN("CSecModUISyncWrapper::DeleteKey - KErrInUse");
+ return KErrInUse;
}
-
+
// -----------------------------------------------------------------------------
// CSecModUISyncWrapper::ChangeReferenceData(MCTAuthenticationObject& aAuthObject)
// -----------------------------------------------------------------------------
@@ -183,14 +206,19 @@
MCTAuthenticationObject& aAuthObject)
{
LOG_ENTERFN("CSecModUISyncWrapper::ChangeReferenceData");
- iOperation = EOperationChangeReferenceData;
- iObject = STATIC_CAST(TAny*, &aAuthObject);
- aAuthObject.ChangeReferenceData(iStatus);
- SetActive();
- iWait.Start();
- iOperation = EOperationNone;
- LOG_LEAVEFN("CSecModUISyncWrapper::ChangeReferenceData");
- return iStatus.Int();
+ if( !IsActive() && !iWait.IsStarted() )
+ {
+ iOperation = EOperationChangeReferenceData;
+ iObject = STATIC_CAST(TAny*, &aAuthObject);
+ aAuthObject.ChangeReferenceData(iStatus);
+ SetActive();
+ iWait.Start();
+ iOperation = EOperationNone;
+ LOG_LEAVEFN("CSecModUISyncWrapper::ChangeReferenceData");
+ return iStatus.Int();
+ }
+ LOG_LEAVEFN("CSecModUISyncWrapper::ChangeReferenceData - KErrInUse");
+ return KErrInUse;
}
// -----------------------------------------------------------------------------
@@ -201,53 +229,68 @@
MCTAuthenticationObject& aAuthObject)
{
LOG_ENTERFN("CSecModUISyncWrapper::UnblockAuthObject");
- iOperation = EOperationUnblockAO;
- iObject = STATIC_CAST(TAny*, &aAuthObject);
- aAuthObject.Unblock(iStatus);
- SetActive();
- iWait.Start();
- iOperation = EOperationNone;
- LOG_LEAVEFN("CSecModUISyncWrapper::UnblockAuthObject");
- return iStatus.Int();
+ if( !IsActive() && !iWait.IsStarted() )
+ {
+ iOperation = EOperationUnblockAO;
+ iObject = STATIC_CAST(TAny*, &aAuthObject);
+ aAuthObject.Unblock(iStatus);
+ SetActive();
+ iWait.Start();
+ iOperation = EOperationNone;
+ LOG_LEAVEFN("CSecModUISyncWrapper::UnblockAuthObject");
+ return iStatus.Int();
+ }
+ LOG_LEAVEFN("CSecModUISyncWrapper::UnblockAuthObject - KErrInUse");
+ return KErrInUse;
}
// -----------------------------------------------------------------------------
// CSecModUIModel::EnableAuthObject(MCTAuthenticationObject& aAuthObject)
// -----------------------------------------------------------------------------
-//
-TInt CSecModUISyncWrapper::EnableAuthObject(
+//
+TInt CSecModUISyncWrapper::EnableAuthObject(
MCTAuthenticationObject& aAuthObject)
{
LOG_ENTERFN("CSecModUISyncWrapper::EnableAuthObject");
- iOperation = EOperationEnableAO;
- iObject = STATIC_CAST(TAny*, &aAuthObject);
- aAuthObject.Enable(iStatus);
- iOperation = EOperationUnblockAO;
- SetActive();
- iWait.Start();
- iOperation = EOperationNone;
- LOG_LEAVEFN("CSecModUISyncWrapper::EnableAuthObject");
- return iStatus.Int();
+ if( !IsActive() && !iWait.IsStarted() )
+ {
+ iOperation = EOperationEnableAO;
+ iObject = STATIC_CAST(TAny*, &aAuthObject);
+ aAuthObject.Enable(iStatus);
+ iOperation = EOperationUnblockAO;
+ SetActive();
+ iWait.Start();
+ iOperation = EOperationNone;
+ LOG_LEAVEFN("CSecModUISyncWrapper::EnableAuthObject");
+ return iStatus.Int();
+ }
+ LOG_LEAVEFN("CSecModUISyncWrapper::EnableAuthObject - KErrInUse");
+ return KErrInUse;
}
-
+
// -----------------------------------------------------------------------------
// CSecModUIModel::DisableAuthObject(MCTAuthenticationObject& aAuthObject)
// -----------------------------------------------------------------------------
-//
+//
TInt CSecModUISyncWrapper::DisableAuthObject(
MCTAuthenticationObject& aAuthObject)
{
LOG_ENTERFN("CSecModUISyncWrapper::DisableAuthObject");
- iOperation = EOperationDisableAO;
- iObject = STATIC_CAST(TAny*, &aAuthObject);
- aAuthObject.Disable(iStatus);
- SetActive();
- iWait.Start();
- iOperation = EOperationNone;
- LOG_LEAVEFN("CSecModUISyncWrapper::DisableAuthObject");
- return iStatus.Int();
- }
-
+ if( !IsActive() && !iWait.IsStarted() )
+ {
+ iOperation = EOperationDisableAO;
+ iObject = STATIC_CAST(TAny*, &aAuthObject);
+ aAuthObject.Disable(iStatus);
+ SetActive();
+ iWait.Start();
+ iOperation = EOperationNone;
+ LOG_LEAVEFN("CSecModUISyncWrapper::DisableAuthObject");
+ return iStatus.Int();
+ }
+ LOG_LEAVEFN("CSecModUISyncWrapper::DisableAuthObject - KErrInUse");
+ return KErrInUse;
+ }
+
// -----------------------------------------------------------------------------
// CSecModUISyncWrapper::CloseAuthObject(MCTAuthenticationObject& aAuthObject)
// -----------------------------------------------------------------------------
@@ -256,33 +299,43 @@
MCTAuthenticationObject& aAuthObject)
{
LOG_ENTERFN("CSecModUISyncWrapper::CloseAuthObject");
- iOperation = EOperationCloseAO;
- iObject = STATIC_CAST(TAny*, &aAuthObject);
- aAuthObject.Close(iStatus);
- SetActive();
- iWait.Start();
- iOperation = EOperationNone;
- LOG_LEAVEFN("CSecModUISyncWrapper::CloseAuthObject");
- return iStatus.Int();
+ if( !IsActive() && !iWait.IsStarted() )
+ {
+ iOperation = EOperationCloseAO;
+ iObject = STATIC_CAST(TAny*, &aAuthObject);
+ aAuthObject.Close(iStatus);
+ SetActive();
+ iWait.Start();
+ iOperation = EOperationNone;
+ LOG_LEAVEFN("CSecModUISyncWrapper::CloseAuthObject");
+ return iStatus.Int();
+ }
+ LOG_LEAVEFN("SecModUISyncWrapper::CloseAuthObject - KErrInUse");
+ return KErrInUse;
}
// -----------------------------------------------------------------------------
// CSecModUIModel::TimeRemaining(...)
// -----------------------------------------------------------------------------
-//
-TInt CSecModUISyncWrapper::TimeRemaining(
- MCTAuthenticationObject& aAuthObject,
+//
+TInt CSecModUISyncWrapper::TimeRemaining(
+ MCTAuthenticationObject& aAuthObject,
TInt& aStime )
{
LOG_ENTERFN("CSecModUISyncWrapper::TimeRemaining");
- iOperation = EOperationTimeRemAO;
- iObject = STATIC_CAST(TAny*, &aAuthObject);
- aAuthObject.TimeRemaining(aStime, iStatus);
- SetActive();
- iWait.Start();
- iOperation = EOperationNone;
- LOG_LEAVEFN("CSecModUISyncWrapper::TimeRemaining");
- return iStatus.Int();
+ if( !IsActive() && !iWait.IsStarted() )
+ {
+ iOperation = EOperationTimeRemAO;
+ iObject = STATIC_CAST(TAny*, &aAuthObject);
+ aAuthObject.TimeRemaining(aStime, iStatus);
+ SetActive();
+ iWait.Start();
+ iOperation = EOperationNone;
+ LOG_LEAVEFN("CSecModUISyncWrapper::TimeRemaining");
+ return iStatus.Int();
+ }
+ LOG_LEAVEFN("CSecModUISyncWrapper::TimeRemaining - KErrInUse");
+ return KErrInUse;
}
// -----------------------------------------------------------------------------
@@ -296,72 +349,72 @@
switch ( iOperation )
{
case EOperationInit:
- {
- LOG_WRITE("CSecModUISyncWrapper::DoCancel: EOperationInit");
+ {
+ LOG_WRITE("CSecModUISyncWrapper::DoCancel: EOperationInit");
STATIC_CAST(CUnifiedKeyStore*, iObject)->CancelInitialize();
break;
}
case EOperationGetAOInterface:
- {
- LOG_WRITE("CSecModUISyncWrapper::DoCancel: EOperationGetAOInterface");
+ {
+ LOG_WRITE("CSecModUISyncWrapper::DoCancel: EOperationGetAOInterface");
STATIC_CAST(MCTToken*, iObject)->CancelGetInterface();
break;
- }
+ }
case EOperationListAOs:
{
- LOG_WRITE("CSecModUISyncWrapper::DoCancel: EOperationListAOs");
+ LOG_WRITE("CSecModUISyncWrapper::DoCancel: EOperationListAOs");
STATIC_CAST(MCTAuthenticationObjectList*, iObject)->CancelList();
break;
}
case EOperationListKeys:
{
- LOG_WRITE("CSecModUISyncWrapper::DoCancel: EOperationListKeys");
+ LOG_WRITE("CSecModUISyncWrapper::DoCancel: EOperationListKeys");
STATIC_CAST(MCTKeyStore*, iObject)->CancelList();
break;
- }
+ }
case EOperationDelKey:
{
- LOG_WRITE("CSecModUISyncWrapper::DoCancel: EOperationDelKey");
+ LOG_WRITE("CSecModUISyncWrapper::DoCancel: EOperationDelKey");
STATIC_CAST(CUnifiedKeyStore*, iObject)->CancelDeleteKey();
break;
}
case EOperationChangeReferenceData:
{
- LOG_WRITE("CSecModUISyncWrapper::DoCancel: EOperationChangeReferenceData");
+ LOG_WRITE("CSecModUISyncWrapper::DoCancel: EOperationChangeReferenceData");
STATIC_CAST(MCTAuthenticationObject*, iObject)->
CancelChangeReferenceData();
break;
}
case EOperationUnblockAO:
{
- LOG_WRITE("CSecModUISyncWrapper::DoCancel: EOperationInit");
+ LOG_WRITE("CSecModUISyncWrapper::DoCancel: EOperationInit");
STATIC_CAST(MCTAuthenticationObject*, iObject)->CancelUnblock();
break;
}
case EOperationEnableAO:
{
- LOG_WRITE("CSecModUISyncWrapper::DoCancel: EOperationEnableAO");
+ LOG_WRITE("CSecModUISyncWrapper::DoCancel: EOperationEnableAO");
STATIC_CAST(MCTAuthenticationObject*, iObject)->CancelEnable();
break;
}
case EOperationDisableAO:
{
- LOG_WRITE("CSecModUISyncWrapper::DoCancel: EOperationDisableAO");
+ LOG_WRITE("CSecModUISyncWrapper::DoCancel: EOperationDisableAO");
STATIC_CAST(MCTAuthenticationObject*, iObject)->CancelDisable();
break;
}
case EOperationCloseAO:
{
- LOG_WRITE("CSecModUISyncWrapper::DoCancel: EOperationCloseAO");
+ LOG_WRITE("CSecModUISyncWrapper::DoCancel: EOperationCloseAO");
STATIC_CAST(MCTAuthenticationObject*, iObject)->CancelClose();
break;
}
case EOperationTimeRemAO:
{
- LOG_WRITE("CSecModUISyncWrapper::DoCancel: EOperationTimeRemAO");
+ LOG_WRITE("CSecModUISyncWrapper::DoCancel: EOperationTimeRemAO");
STATIC_CAST(MCTAuthenticationObject*, iObject)->CancelTimeRemaining();
break;
- }
+ }
default:
{
break;
@@ -371,7 +424,7 @@
{
iWait.AsyncStop();
}
- LOG_LEAVEFN("CSecModUISyncWrapper::DoCancel");
+ LOG_LEAVEFN("CSecModUISyncWrapper::DoCancel");
}
// -----------------------------------------------------------------------------
@@ -380,20 +433,7 @@
// -----------------------------------------------------------------------------
//
void CSecModUISyncWrapper::RunL()
- {
- iWait.AsyncStop();
+ {
+ iWait.AsyncStop();
}
-// -----------------------------------------------------------------------------
-// CSecModUISyncWrapper::HandleErrorL()
-// Shows an error note according to status of operation,
-// -----------------------------------------------------------------------------
-//
-void CSecModUISyncWrapper::HandleErrorL()
- {
-
- }
-
-
-// End of File
-