diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/inc/cpsecmodmodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/inc/cpsecmodmodel.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,341 @@ +/* +* Copyright (c) 2002-2009 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the CSecModUIModel class +* +*/ + + +#ifndef CSECMODUIMODEL_H +#define CSECMODUIMODEL_H + +// INCLUDES +#include +#include +#include +#include + +#include +#include +#include +#include + +class QString; +class HbListWidget; + +// CONSTANTS +const TInt KMaxSettItemSize = 200; + +const TInt KPinGSettIndex = 0; +const TInt KPinNrSettIndex = 1; + +const TUid KUidSecMod = { 0x101F8668 }; + +// Panic strings +_LIT(KPanicNullPointer, "SecModUI: invalid pointer"); +_LIT(KPanicIndexOutOfRange, "SecModUI: array indexed out of range"); + +// FORWARD DECLARATIONS +class CUnifiedKeyStore; +class MCTAuthenticationObject; +class MCTAuthenticationObjectList; +class CSecModUISyncWrapper; +class MCTKeyStore; +class MCTToken; + +class QString; + +// FUNCTION PROTOTYPES +GLREF_C void Panic( TInt aPanic ); + +// CLASS DECLARATION + +/** +* class CSecModUIModel +* Model of the application +* +* @lib SecModUI.lib +* @since Series 60 3.0 +*/ +class CSecModUIModel : public CBase + { + public: // Constructors and destructLoadTokenLabelsLor + + /** + * Two-phased constructor. + */ + static CSecModUIModel* NewL(); + + /** + * Destructor. + */ + virtual ~CSecModUIModel(); + + public: // New functions + /** + * Initializes unified keystore + */ + void InitializeKeyStoreL(); + + /** + * Retrieves the description and location of all tokens. + * @return Map containing the label and the appripriate location. + */ + QMap LoadTokenLabelsL(); + + /** + * Shows error note if needed. + * @param aError + * @return void + */ + void ShowErrorNote(TInt aError) const; + + /** + * Retrieves the appropriate token based on the index. + * @param aTokenIndex Index of the token to be opened. + * @return void + */ + void OpenTokenL(TInt aTokenIndex); + + /** + * Initialize the auth objects and return the total count. + * @param aItemArray contains localised stings + * @return void + */ + TInt CheckCodeViewStringsL(); + + /** + * Retrieves description of the token based on UID of the current active keystore. + * @return Description + */ + QString TokenLabelForTitle() const; + + /** + * Returns status of the selected auth object. + * @param index + * @return status + */ + TUint32 AuthStatus(TInt aIndex) const; + + /** + * Returns status of the auth object based on its persistent properties set + * by security module implementation. + * @param aIndex Index of the authentication object + * @param aShowBlockedNote If ETrue, shows code blocked if code is blocked. + * @return status of the pin. + */ + QString PINStatus( TInt aIndex, TBool aShowBlockedNote ) const; + + /** + * Checks whether the Pin is still available. + * @param aIndex Index of the authentication object. + * @return status + */ + TBool PinOpen(TInt aIndex) const; + + /** + * Based on the property of auth object the pin can be + * changed or unblocked. + * @param aIndex Index of the auth object + * @return ?description + */ + void ChangeOrUnblockPinL(TInt aIndex); + + /** + * Changes the value of the PIN. + * @param aIndex Index of the AO + * @return void + */ + void ChangePinL(TInt aIndex); + + /** + * Toggles the value of auth object if possible. + * @param ?arg1 ?description + * @return ?description + */ + TInt ChangeCodeRequest(TInt aIndex); + + /** + * If the auth object is open then closes it. + * @param aIndex Index of the AO to be closed. + * @return void + */ + void CloseAuthObjL(TInt aIndex); + + /** + * Unblocks PIN + * @param aIndex Index of the AO + * @return void + */ + void UnblockPinL(TInt aIndex); + + /** + * Deletes key from the appropriate keystore. + * @param aTokenIndex Index of the token to be deleted. + * @return ETrue if keystore was deleted. + */ + void DeleteKeysL(TInt aTokenIndex); + + /** + * Returns ETrue if PIN is changeable. + * @param aIndex Index of the AO + * @return ETrue / EFalse + */ + TBool PinChangeable(TInt aIndex) const; + + /** + * Displays security module details dialog. + * @param aTokenIndex Index of the token, which details are shown. + * @return void + */ + QVector< QPair > SecModDetailsL(TInt aTokenIndex); + + /** + * Displays details dialog of the active security module . + * @return void + */ + QVector< QPair > GetSecModDetailsL(); + + /** + * Appends the location of the keystore. + * @return void + */ + void AppendLocation( QVector< QPair >& aSecModDetails, + TUid aLocUid, + QString aCertDisplayDetails ); + + /** + * Appends the value of a label if present otherwise appends empty descriotion. + * @return void + */ + void AppendItem( QVector< QPair >& aSecModDetails, + QString aLabel, + const TDesC& aValue, + QString aNullDescription ); + + /** + * Generate details of signing security module. + * @return void + */ + void AppendPinNRs(QVector< QPair >& aSecModDetails); + + QVector< QPair > AuthDetails(); + + /** + * Changes PIN-NR + * @param aIndex Index of the AO + * @return void + */ + void ChangePinNrL(TInt aIndex); + + /** + * Unblocks PIN-NR + * @param aIndex Index of the AO + * @return void + */ + void UnblockPinNrL(TInt aIndex); + + /** + * Retrieves the UID of the current active keystore. + * @return uid + */ + TInt KeyStoreUID(); + + /** + * Retrieves the auth object at the speficied index. + * @return auth object + */ + const MCTAuthenticationObject& AuthObj(TInt aIndex); + + /** + * Returns ETrue if PIN is unblockable. + * @param aIndex Index of the AO + * @return ETrue / EFalse + */ + TBool PinUnblockable(TInt aIndex) const; + + + /** + * Returns ETrue if PIN request can be disabled / enabled. + * @param aIndex Index of the AO + * @return ETrue / EFalse + */ + TBool PinRequestChangeable(TInt aIndex) const; + + /** + * Returns ETrue if token is deletable. + * @param aTokenIndex Index of the token to be deleted. + * @return ETrue / EFalse + */ + TBool IsTokenDeletable(TInt aTokenIndex); + + + private: + + /** + * C++ default constructor. + */ + CSecModUIModel(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + void ResetAndDestroyCTObjects(); + + void ResetAndDestroyAOs(); + + void InitAuthObjectsL(); + + void ListAuthObjectsL(); + + void CreateSettingItem(const TDesC& aTitle, + const TDesC& aValue, + TDes& aItem) const; + + QString Location( TUid aUid ) const; + + void AppendPinNRsL( TDes& aMessage ) const; + + private: + // DATA TYPES + enum TSecModPanicCode + { + EPanicNullPointer, + EPanicIndexOutOfRange + }; + + private: // Data + // Resource file offsets + TInt iResourceFileOffset; + TInt iResourceFileOffset2; + TInt iResourceFileOffset3; + + CSecModUISyncWrapper* iWrapper; // owned + RFs iRfs; + + /** + * Crypto Token objects + */ + CUnifiedKeyStore* iUnifiedKeyStore; // owned + MCTKeyStore* iKeyStore; // not owned + MCTAuthenticationObjectList* iAOList; // owned, items not owned + RMPointerArray iAOArray; // items not owned + + RMPointerArray iAOKeyStores; // items not owned + }; + +#endif // CSECMODUIMODEL_H + +// End of File