# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1283259880 -10800 # Node ID 09b1ac925e3fb05e4059fab245cb579ef61f0eec # Parent 63339781d1797646148dccb830e85a00035b94f6 Revision: 201033 Kit: 201035 diff -r 63339781d179 -r 09b1ac925e3f boottimeintegritycheck/TrkDummy/group/TrkDummy.mmp --- a/boottimeintegritycheck/TrkDummy/group/TrkDummy.mmp Thu Aug 19 10:45:23 2010 +0300 +++ b/boottimeintegritycheck/TrkDummy/group/TrkDummy.mmp Tue Aug 31 16:04:40 2010 +0300 @@ -12,7 +12,7 @@ * Contributors: * * Description: Dummy exe to prevent installing too liberal TrkApp -* Version : %version: tr1sido#9 % +* Version : %version: tr1sido#10 % * */ @@ -26,9 +26,9 @@ // This component is built-in'. -#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) - #include -#endif + +#include + CAPABILITY None @@ -45,13 +45,9 @@ SOURCE TrkDummy.cpp SOURCE TrkDummyApplication.cpp -USERINCLUDE ../inc -#if defined (__SERIES60_30__) || defined(__SERIES60_31__) - SYSTEMINCLUDE /epoc32/include -#else - MW_LAYER_SYSTEMINCLUDE -#endif +USERINCLUDE ../inc +MW_LAYER_SYSTEMINCLUDE LIBRARY euser.lib LIBRARY apparc.lib diff -r 63339781d179 -r 09b1ac925e3f boottimeintegritycheck/TrkDummy/group/TrkDummy1.mmp --- a/boottimeintegritycheck/TrkDummy/group/TrkDummy1.mmp Thu Aug 19 10:45:23 2010 +0300 +++ b/boottimeintegritycheck/TrkDummy/group/TrkDummy1.mmp Tue Aug 31 16:04:40 2010 +0300 @@ -12,7 +12,7 @@ * Contributors: * * Description: Dummy exe to prevent installing too liberal TrkApp -* Version : %version: 7 % +* Version : %version: 8 % * */ @@ -26,9 +26,9 @@ // This component is built-in'. -#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) - #include -#endif + +#include + CAPABILITY None @@ -45,12 +45,9 @@ SOURCE TrkDummy.cpp SOURCE TrkDummyApplication.cpp -USERINCLUDE ../inc -#if defined (__SERIES60_30__) || defined(__SERIES60_31__) - SYSTEMINCLUDE /epoc32/include -#else - MW_LAYER_SYSTEMINCLUDE -#endif +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE LIBRARY euser.lib LIBRARY apparc.lib diff -r 63339781d179 -r 09b1ac925e3f boottimeintegritycheck/TrkDummy/group/TrkDummy2.mmp --- a/boottimeintegritycheck/TrkDummy/group/TrkDummy2.mmp Thu Aug 19 10:45:23 2010 +0300 +++ b/boottimeintegritycheck/TrkDummy/group/TrkDummy2.mmp Tue Aug 31 16:04:40 2010 +0300 @@ -12,7 +12,7 @@ * Contributors: * * Description: Dummy exe to prevent installing too liberal TrkApp -* Version : %version: 7 % +* Version : %version: 8 % * */ @@ -26,9 +26,8 @@ // This component is built-in'. -#if(!defined __SERIES60_30__ && !defined __SERIES60_31__) - #include -#endif + +#include CAPABILITY None @@ -46,13 +45,9 @@ SOURCE TrkDummy.cpp SOURCE TrkDummyApplication.cpp -USERINCLUDE ../inc -#if defined (__SERIES60_30__) || defined(__SERIES60_31__) - SYSTEMINCLUDE /epoc32/include -#else - MW_LAYER_SYSTEMINCLUDE -#endif +USERINCLUDE ../inc +MW_LAYER_SYSTEMINCLUDE LIBRARY euser.lib LIBRARY apparc.lib diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/common.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/common.pri Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,66 @@ +# +# Copyright (c) 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: controlpanel project - common qmake settings +# + +CONFIG += debug_and_release + +# On win32 and mac, debug and release libraries are named differently. +# We must follow the debug and release settings Qt was compiled with: +# build debug iff Qt built debug, build release iff Qt built release. + +win32|mac { + !contains(QT_CONFIG,debug)|!contains(QT_CONFIG,release) { + CONFIG -= debug_and_release debug release + contains(QT_CONFIG,debug): CONFIG+=debug + contains(QT_CONFIG,release):CONFIG+=release + } +} + +CONFIG(debug, debug|release) { + SUBDIRPART = debug +} else { + SUBDIRPART = release +} + +win32 { + DESTDIR = C:/ControlPanel/$$SUBDIRPART/bin + OBJECTS_DIR = $$PWD/../$$SUBDIRPART/tmp/$$TARGET +} + +# Add the output dirs to the link path too +LIBS += -L$$DESTDIR + +MOC_DIR = moc +OBJECT_DIR = obj +RCC_DIR = rcc + +#For some reason the default include path doesn't include MOC_DIR on symbian +symbian { + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MW_LAYER_PLATFORM_EXPORT_PATH(cplogger) + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + INCLUDEPATH += $$MOC_DIR + TARGET.CAPABILITY = ALL -TCB + TARGET.EPOCALLOWDLLDATA = 1 +} + +INCLUDEPATH += $$PWD/inc +win32 { + # add platfrom API for windows + INCLUDEPATH += $$PWD/../../controlpanel/controlpanel_plat/inc +} + + + diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/group/advancedsecplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/group/advancedsecplugin.pri Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,39 @@ +# Copyright (c) 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" +# 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: advancedsecplugin source files + +# Input +HEADERS += ../inc/cpcertdatacontainer.h \ + ../inc/cpcertdetailview.h \ + ../inc/cpcertmanuisyncwrapper.h \ + ../inc/cpcerttrustview.h \ + ../inc/cpcertview.h \ + ../inc/cpcertpluginloader.h \ + ../inc/cpsecurityview.h \ + ../inc/cpuitrustids.h \ + ../inc/cpsecmodview.h \ + ../inc/cpsecmodmodel.h \ + ../inc/cpsecmodsyncwrapper.h \ + ../inc/cpmoduleview.h \ + ../inc/cpsecmoduleinfoview.h + +SOURCES += ../src/cpcertdatacontainer.cpp \ + ../src/cpcertdetailview.cpp \ + ../src/cpcertmanuisyncwrapper.cpp \ + ../src/cpcerttrustview.cpp \ + ../src/cpcertview.cpp \ + ../src/cpcertpluginloader.cpp \ + ../src/cpsecurityview.cpp \ + ../src/cpsecmodview.cpp \ + ../src/cpsecmodsyncwrapper.cpp \ + ../src/cpsecmodmodel.cpp \ + ../src/cpmoduleview.cpp \ + ../src/cpsecmoduleinfoview.cpp + diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/group/advancedsecplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/group/advancedsecplugin.pro Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,58 @@ + +# +# Copyright (c) 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: +# + +TEMPLATE = lib +TARGET = cpadvancedsecplugin + +CONFIG += hb plugin + +LIBS += -lcpframework + +include ( advancedsecplugin.pri ) +include ( ../rom/cpsecplugins_rom.pri ) + +symbian: { + TARGET.CAPABILITY = CAP_ECOM_PLUGIN + TARGET.UID3 = 0X2002E684 + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + INCLUDEPATH += ../inc + TARGET.EPOCALLOWDLLDATA = 1 + LIBS += -lcertstore + LIBS += -lCTFramework + LIBS += -lX509 + LIBS += -lpkixcert + LIBS += -lx509certnameparser + LIBS += -lhash + LIBS += -lcryptography + LIBS += -lDevTokenClient + LIBS += -lcrypto + LIBS += -lefsrv + + PLUGIN_STUB_PATH = /resource/qt/plugins/controlpanel + + deploy.path = C: + pluginstub.sources = $${TARGET}.dll + pluginstub.path = $$PLUGIN_STUB_PATH + DEPLOYMENT += pluginstub + + qtplugins.path = $$PLUGIN_STUB_PATH + qtplugins.sources += qmakepluginstubs/$${TARGET}.qtplugin + + for(qtplugin, qtplugins.sources):BLD_INF_RULES.prj_exports += "./$$qtplugin $$deploy.path$$qtplugins.path/$$basename(qtplugin)" + } + +TRANSLATIONS= certificate_manager.ts diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/inc/cpcertdatacontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/inc/cpcertdatacontainer.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,216 @@ +/* +* Copyright (c) 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" +* 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 CCertManUIKeeper class +* +*/ + +#ifndef CPCERTDATACONTAINER_H +#define CPCERTDATACONTAINER_H + +// INCLUDES +#include +#include +#include + +// FORWARD DECLARATIONS +class CpCertManUISyncWrapper; +class CpCertManUICertData; + +// CONSTANTS +const TUid KCMDeviceCertStoreTokenUid = { 0x101FB668 }; +const TUid KCMDeviceKeyStoreTokenUid = { 0x101FB66A }; +const TUid KCMTrustedServerTokenUid = { 0x101FB66F }; +const TUid KCMFileKeyStoreTokenUid = { 0x101F7333 }; +const TUid KCMFileCertStoreTokenUid = { 0x101F501A }; + + +// CLASS DECLARATION + +/** +* CpCertDataContainer retrieves and holds certificates. +* +*/ +class CpCertDataContainer : public CBase + { + public: // functions + + /** + * Default constructor + */ + CpCertDataContainer(); + + /** + * Destructor. + */ + ~CpCertDataContainer(); + + /** + * NewL + */ + static class CpCertDataContainer* NewL(); + + /** + * NewLC + */ + static class CpCertDataContainer* NewLC(); + + CUnifiedCertStore*& CertManager(); + + CUnifiedKeyStore*& KeyManager(); + + /** + * Checks that cacerts.dat file is not corrupt + * and returns CA certificates from it. + */ + void RefreshCAEntriesL(); + + /** + * Checks that cacerts.dat file is not corrupt + * and returns user certificates from it. + */ + void RefreshUserCertEntriesL(); + + /** + * Returns peer certificates. + */ + void RefreshPeerCertEntriesL(); + + /** + * Returns peer certificates. + */ + void RefreshDeviceCertEntriesL(); + + /** + * Shows error note + */ + void ShowErrorNoteL(TInt aError); + + public: //data + + /** + * To store CA certificate entries for Authority and Trust view + * Includes label from x509certnameparser. + */ + RMPointerArray iCALabelEntries; + + /** + * To store CA certificate entries for Authority and Trust view + * Includes label from x509certnameparser. + */ + RMPointerArray iUserLabelEntries; + + /** + * To store Peer certificate entries for Trusted Site view + * Includes label from x509certnameparser. + */ + RMPointerArray iPeerLabelEntries; + + /** + * To store Peer certificate entries for Device certificate view + * Includes label from x509certnameparser. + */ + RMPointerArray iDeviceLabelEntries; + + /** + * Used to wrap asynchronous calls + */ + CpCertManUISyncWrapper* iWrapper; + + /** + * File session handle. + */ + RFs iRfs; + + private: // functions + + void ConstructL(); + + private: //data + + /** + * To list certificates with criteria. + */ + CCertAttributeFilter* iFilter; + + /** + * To list keys with criteria. + */ + + TCTKeyAttributeFilter* iKeyFilter; + + /** + * UnifiedCertStore + */ + CUnifiedCertStore* iStore; + + /** + * UnifiedKeyStore + */ + CUnifiedKeyStore* iKeyStore; + + /** + * To store CA certificate entries. + */ + RMPointerArray iCAEntries; + + /** + * To store User certificate entries. + */ + RMPointerArray iUserEntries; + + /** + * To store Peer certificate entries. + */ + RMPointerArray iPeerEntries; + + /** + * To store Device certificate entries. + */ + RMPointerArray iDeviceEntries; + + /** + * To store Key entries + */ + RMPointerArray iKeyEntries; + + }; + +/** +* Small helper class to put label and certificate in same class. +* +*/ +class CpCertManUICertData : public CBase + { + public: + + CpCertManUICertData(); + + void Release(); + + HBufC* iCAEntryLabel; + HBufC* iUserEntryLabel; + HBufC* iPeerEntryLabel; + HBufC* iDeviceEntryLabel; + CCTCertInfo* iCAEntry; + CCTCertInfo* iUserEntry; + CCTCertInfo* iPeerEntry; + CCTCertInfo* iDeviceEntry; + + private: + ~CpCertManUICertData(); + + }; + + +#endif // CPCERTDATACONTAINER_H diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/inc/cpcertdetailview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/inc/cpcertdetailview.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 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"" +* 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: +* +*/ + +#ifndef CPCERTDETAILVIEW_H +#define CPCERTDETAILVIEW_H + +#include +#include +#include +#include + +class CpCertDataContainer; +class CX509Certificate; +class CCertificate; +class HbListWidget; +class HbAbstractViewItem; +class CCTCertInfo; + +class QString; +class QSizeF; + +class CpCertDetailView : public CpBaseSettingView +{ + Q_OBJECT +public: + explicit CpCertDetailView( CpCertView::TCertificateViews currentView, TInt pos, + CpCertDataContainer& certDataContainer, + QGraphicsItem *parent = 0 ); + virtual ~CpCertDetailView(); + +private: + void viewCertificateDetailsL( TInt index, CpCertView::TCertificateViews type ); + void validateCertificateL(TInt index, const CCertificate& certDetails, const CCTCertInfo& certInfo, CpCertView::TCertificateViews type ); + CArrayFixFlat* validateX509CertificateL( const CX509Certificate& certDetails ); + TKeyUsagePKCS15 keyUsageAndLocationL( const CCTCertInfo& certEntry, TUid* keyLocation ); + void setLocationInfo( TBool certificate, TUid locUid, HbListWidget& certDisplayDetails ); + void divideIntoBlocks( const TDesC8& input, TPtr& output ); + + void addToListWidget( HbListWidget& certDisplayDetails, const QString& data ); + void addToListWidget( HbListWidget& certDisplayDetails, + const QString& displayString, const QString& displayDetails ); + + const CCTCertInfo* certInfo( TInt index, CpCertView::TCertificateViews certView ); + void addTrustedSitesL( const CCertificate& certDetails, HbListWidget& certDisplayDetails); + void addLabel( const CCTCertInfo& certInfo, HbListWidget& certDisplayDetails); + void addIssuerL( const CCertificate& certDetails, HbListWidget& certDisplayDetails ); + void addSubjectL( const CCertificate& certDetails, HbListWidget& certDisplayDetails ); + void addCertUsage( TKeyUsagePKCS15 usage, HbListWidget& certDisplayDetails ); + void addValidityPeriod( const CCertificate& certDetails, HbListWidget& certDisplayDetails); + void setURLLocation( HBufC8& urlDetails, HbListWidget& certDisplayDetails ); + void addCertFormat( TCertificateFormat certFormat, HbListWidget& certDisplayDetails ); + void addAlgoDetails( const CCertificate& certificate, HbListWidget& certDisplayDetails ); + void addSerialNo( const CCertificate& certificate, HbListWidget& certDisplayDetails ); + void addFingerprint( const CCertificate& certificate, HbListWidget& certDisplayDetails ); + void addPublicKeyDetailsL( const CCertificate& certificate, HbListWidget& certDisplayDetails ); + QString asymmetricAlgoId( const CCertificate& certificate ); + +private: + CpCertDataContainer& mCertDataContainer; + +}; + +#endif // CPCERTDETAILVIEW_H diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/inc/cpcertmanuisyncwrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/inc/cpcertmanuisyncwrapper.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,319 @@ +/* +* Copyright (c) 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" +* 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: Wrapper class for Symbian's Security Framework's calls +* +*/ + + +#ifndef CPCERTMANUISYNCWRAPPER_H +#define CPCERTMANUISYNCWRAPPER_H + + +// INCLUDES +#include + +// FORWARD DECLERATIONS +class CCertificate; +class CPKIXValidationResult; +class CPKIXCertChain; +class CUnifiedCertStore; + +// CLASS DECLARATION + +/** +* Wrapper class for Symbian's Security Framework's calls. +* Shows error notes if an error happenes. +* +* @lib certmanui.dll +* @since S60 2.0 +*/ +class CpCertManUISyncWrapper : public CActive + { + public: + + /** + * Two-phased constructor. + */ + static CpCertManUISyncWrapper* NewLC(); + + /** + * Two-phased constructor. + */ + static CpCertManUISyncWrapper* NewL(); + + /** + * Destructor. + */ + ~CpCertManUISyncWrapper(); + + public: // New functions + + /** + * TInt ListL + * @param aStore reference to store where operation is done. + * @param aArray Keys are stored here. + * @param aFilter Information on what kind keys are looked. + */ + + void ListL( CUnifiedKeyStore*& aStore, + RMPointerArray* aArray, + const TCTKeyAttributeFilter& aFilter ); + + /** + * TInt ListL + * @param aStore reference to store where operation is done. + * @param aArray Keys are stored here. + * @param aFilter Information on what kind keys are looked. + * @param aTokenUid Token UID of key store + */ + + void ListL( CUnifiedKeyStore*& aStore, + RMPointerArray* aArray, + const TCTKeyAttributeFilter& aFilter, + const TUid aTokenUid ); + + /** + * TInt ListL + * @param aStore reference to store where operation is done. + * @param aArray certificates are stored here. + * @param aFilter Information on what kind certificates are looked. + */ + void ListL( CUnifiedCertStore*& aStore, + RMPointerArray* aArray, + const CCertAttributeFilter& aFilter ); + + /** + * TInt ListL + * @param aStore reference to store where operation is done. + * @param aArray certificates are stored here. + * @param aFilter Information on what kind certificates are looked. + * @param aTokenUid Token UID of certificate store + */ + void ListL( CUnifiedCertStore*& aStore, + RMPointerArray* aArray, + const CCertAttributeFilter& aFilter, + const TUid aTokenUid ); + + + /** + * TInt GetCertificateL + * @param aStore reference to store where operation is done. + * @param aCertInfo Certificate that's detailed information is fetched. + * @param aCert Fetched certificate. + */ + void GetCertificateL( CUnifiedCertStore*& aStore, + const CCTCertInfo& aCertInfo, CCertificate*& aCert ); + + /** + * TInt GetCertificateL + * @param aStore reference to store where operation is done. + * @param aCertInfo Certificate that's detailed information is fetched. + * @param aCert Fetched certificate. + */ + void GetCertificateL( CUnifiedCertStore*& aStore, + const CCTCertInfo& aCertInfo, CCertificate*& aCert, TUid aTokenUid ); + + + /** + * TInt GetUrlCertificateL + * @param aStore reference to store where operation is done. + * @param aCertInfo Certificate that's detailed information is fetched. + * @param aUrl Fetched URL. + */ + void GetUrlCertificateL( + CUnifiedCertStore*& aStore, + const CCTCertInfo& aCertInfo, + TDes8& aUrl) ; + + /** + * TInt GetApplicationsL + * @param aStore reference to store where operation is done. + * @param aCertInfo Certificate that applications are fetched. + * @param Certificates applications are stoted here. + */ + void GetApplicationsL( CUnifiedCertStore*& aStore, + const CCTCertInfo& aCertInfo, RArray& aApps ); + + /** + * TInt ValidateX509RootCertificateL + * @param aValidationResult Result of validation. + * @param aValidationTime Time of validation. + * @param aChain Chain to be validated. + */ + void ValidateX509RootCertificateL( + CPKIXValidationResult*& aValidationResult, + const TTime& aValidationTime, CPKIXCertChain*& aChain ); + + /** + * TInt InitStoreL + * @param aStore reference to store to be initialized. + */ + void InitStoreL( CUnifiedCertStore*& aStore ); + + /** + * void InitStoreL + * @param aStore reference to store to be initialized. + */ + void InitStoreL( CUnifiedKeyStore*& aStore ); + + /** + * TInt DeleteCertL + * @param aStore reference to store where operation is done. + * @param aCertInfo Certificate to be deleted. + */ + void DeleteCertL( CUnifiedCertStore*& aStore, + const CCTCertInfo& aCertInfo ); + + /** + * TInt DeleteCertL + * @param aStore reference to store where operation is done. + * @param aCertInfo Certificate to be deleted. + */ + void DeleteCertL( CUnifiedCertStore*& aStore, + const CCTCertInfo& aCertInfo, + TUid aTokenUid ); + + /** + * TInt IsApplicableL + * @since S60 2.0 + * @param aStore reference to store where operation is done. + * @param aCertInfo Certificate thats applicability is queried. + * @param aApplication Application that's status is queried. + * @param aIsApplicable ETrue if applcable. + * @return TInt Status Symbian's API's call. + */ + TInt IsApplicableL( CUnifiedCertStore*& aStore, + const CCTCertInfo& aCertInfo, TUid aApplication, + TBool& aIsApplicable ); + + /** + * TInt IsTrustedL + * @since S60 2.0 + * @param aStore reference to store where operation is done. + * @param aCertInfo Certificate that's trust status is queried. + * @param aTrusted ETrue if trusted. + * @return TInt Status Symbian's API's call. + */ + TInt IsTrustedL( CUnifiedCertStore*& aStore, + const CCTCertInfo& aCertInfo, TBool& aTrusted ); + + /** + * TInt SetApplicabilityL + * @param aStore reference to store where operation is done. + * @param aCertInfo Certificate thats applicability is set. + * @param aApplications New applicability settings. + */ + void SetApplicabilityL( CUnifiedCertStore*& aStore, + const CCTCertInfo& aCertInfo, + RArray& aApplications ); + + /** + * void MoveCertL + * @since S60 3.2 + * @param aStore reference to store where operation is done + * @param aCertInfo Certificate info + * @param aSourceStore UID of source certificate store + * @param aTargetStore UID of source certificate store + * @return TInt Number of moved certificates + */ + TInt MoveCertL( CUnifiedCertStore*& aStore, + const CCTCertInfo& aCertInfo, + const TUid aSourceTokenId, + const TUid aTargetTokenId ); + + /** + * void MoveKeyL + * @param aStore reference to store where operation is done + * @param CCTKeyInfo Key info + * @param aSourceStore UID of source key store + * @param aTargetStore UID of source key store + */ + void MoveKeyL( CUnifiedKeyStore*& aStore, + const TCTKeyAttributeFilter& aFilter, + const TUid aSourceTokenId, + const TUid aTargetTokenId ); + + /** + * TInt GetInterface + * @since S60 3.0 + * @param aToken reference to token + * @param aTokenInterface Pointer to returned interface + * @return TInt Status Symbian's API's call. + */ + TInt GetInterface( TUid aRequiredInterface, + MCTToken& aToken, + MCTTokenInterface*& aReturnedInterface ); + + protected: + + void DoCancel(); + void RunL(); + + private: + + CpCertManUISyncWrapper(); + void ConstructL(); + + void HandleErrorL(); + + private: //Data + + // Internal operation states. + enum TOperation + { + EOperationNone, + EOperationInit, + EOperationList, + EGetCertificate, + EAddCertificate, + ERetriveURLCertificate, + EOperationDelete, + EOperationGetApps, + EOperationIsApplicable, + EOperationIsTrusted, + EOperationSetApplicability, + EOperationSetToTrusted, + EOperationValidateX509Root, + EShowErrorNote, + EOperationInitKeyStore, + EOperationKeyList, + EOperationGetInterface, + EOperationExportKey, + EOperationImportKey, + EOperationDeleteKey + }; + + // For wrapping asynchronous calls. + CActiveSchedulerWait iWait; + + // Internal state of operation. + TOperation iOperation; + + // Just for cancelling a operation. Does not own. + CUnifiedCertStore* iStore; + + // Just for cancelling a operation. Does not own. + CUnifiedKeyStore* iKeyStore; + + // Just for cancelling a operation. Does not own. + CPKIXCertChain* iChain; + + // For retrieving a certificate. + TPtr8 iCertPtr; + + }; + +#endif // CPCERTMANUISYNCWRAPPER_H + +// End of File diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/inc/cpcertpluginloader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/inc/cpcertpluginloader.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 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"" + * 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: + * + */ +#ifndef CPCERTPLUGINLOADER_H +#define CPCERTPLUGINLOADER_H + +#include +#include +#include +class CpCertPluginLoader : public QObject, public CpPluginInterface +{ + Q_OBJECT + Q_INTERFACES(CpPluginInterface) +public: + CpCertPluginLoader(); + virtual ~CpCertPluginLoader(); + virtual QListcreateSettingFormItemData(CpItemDataHelper &itemDataHelper) const; +private: + QTranslator* mTranslator; +}; + +#endif //CPCERTPLUGINLOADER_H diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/inc/cpcerttrustview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/inc/cpcerttrustview.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 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" +* 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 CCertManUIContainerTrust class +* Maintains correct list of trusted clients depending +* on the certificate that was in focus in Authority +* certificates view when Trust Settings view was entered. +* Shows and changes correct Yes/No text for the Trusted client. +* +*/ + + +#ifndef CPCERTTRUSTVIEW_H +#define CPCERTTRUSTVIEW_H + +// INCLUDES +#include +#include + +// CONSTANTS +const TInt KTrustSettingsResourceIndexWAP = 0; +const TInt KTrustSettingsResourceIndexMailAndImageConn = 1; +const TInt KTrustSettingsResourceIndexAppCtrl = 2; +const TInt KTrustSettingsResourceIndexJavaInstall = 3; +const TInt KTrustSettingsResourceIndexOCSPCheck = 4; +const TInt KTrustSettingsResourceIndexVPN = 5; +const TInt KTrustSettingsResourceIndexWidget = 6; +const TInt KTrustSettingsResourceIndexValueYes = 0; +const TInt KTrustSettingsResourceIndexValueNo = 1; + +// FORWARD DECLARATIONS +class CCertificateAppInfoManager; +class CpCertDataContainer; +class TCertificateAppInfo; +class CCTCertInfo; + +class QString; + +class HbDataFormModel; + +// CLASS DECLARATION +class CpCertTrustView : public CpBaseSettingView + { + Q_OBJECT + + public: + explicit CpCertTrustView( TInt certificateIndex, + CpCertDataContainer& certDataContainer, + QGraphicsItem *parent = 0 ); + virtual ~CpCertTrustView(); + void saveTrustSettings(); + + private: + void viewTrustSettings(); + void updateListBoxL(); + TInt trustIdIndex( TUid aTrusterUid ) const; + TBool checkCertificateClientTrustL( const TUid clientUid, const CCTCertInfo& entry ) const; + TUid trusterId(const QString& clientDescription) const; + + private: + CpCertDataContainer& mCertDataContainer; + /** + * Application manager class, used to get applications in system. + */ + CCertificateAppInfoManager* mAppInfoManager; + + /** + * Client Uids of the certstore + */ + RArray mClientUids; + + /** + * To get the names of the trusted clients from the resources + */ + QList mTrustedClients; + + /** + * To get the yes/no trust texts from the resources + */ + QList mTrustValues; + + TInt mCertificateIndex; + + HbDataFormModel* mFormModel; + + }; + +#endif // CPCERTTRUSTVIEW_H + +// End of File diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/inc/cpcertview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/inc/cpcertview.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 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"" +* 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: +* +*/ + +#ifndef CPCERTVIEW_H +#define CPCERTVIEW_H + +#include + +class HbAbstractViewItem; +class CpCertDataContainer; +class CCTCertInfo; +class HbListView; +class HbAction; +class HbDialog; +class HbMessageBox; +class CpCertView : public CpBaseSettingView + { + Q_OBJECT + + public: + explicit CpCertView(const QModelIndex& index, QGraphicsItem *parent = 0); + virtual ~CpCertView(); + + public: + enum TCertificateViews + { + EAuthorityView=0, + ETrustedView, + EPersonalView, + EDeviceView + }; + + public slots: + void displayPreviousView(); + + private slots: + void openCertificate(); + void openCertFromList(const QModelIndex& modelIndex); + void showTrustSettings(); + void saveTrustSettings(); + void indicateLongPress(HbAbstractViewItem*, QPointF); + + void deleteCertificate(); + TInt refreshListL(); + void refreshView( TInt aCount ); + + void moveSelectedCert(); + void deleteList(); + void selectAll(); + void moveCert(); + void viewDone(); + void handleMultipleDelete(HbAction* action); + void handleMoveDialog(HbAction* action); + void handleDeleteDialog(HbAction* action); + void handleMoveCertDialog(HbAction* action); + private: + const CCTCertInfo* certAt(TInt index) const; + QString certLabel(TInt index) const; + void deleteCertsL( RArray& indexList ); + void setDetails(CpCertView::TCertificateViews currentView); + void moveCertList( RArray& indexList ); + + private: + CpCertView::TCertificateViews mCertView; + TInt mPos; + CpCertDataContainer* mCertDataContainer; + TBool mSelectAll; + RArray mSelectionIndex; + RArray mIndexList; + + HbDialog* mPopup; + HbView* mPrevView; + HbView* mCurrentView; + CpBaseSettingView* mRefreshedView; + HbListView* mListView; + HbListView* mSelectAllView; + HbView* mOriginalView; + HbMessageBox* mNote; + HbMenu* mContextMenu; + }; + +#endif /* CPCERTVIEW_H */ diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/inc/cpmoduleview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/inc/cpmoduleview.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 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"" +* 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: +* +*/ + +#ifndef CPMODULEVIEW_H +#define CPMODULEVIEW_H + +#include +#include "cpsecmodview.h" + +class HbAbstractViewItem; +class CpItemDataHelper; +class CSecModUIModel; +class CpSecModView; + +class CpModuleView : public CpBaseSettingView +{ + Q_OBJECT +public: + explicit CpModuleView( CpSecModView::TSecModViews currentView, + CSecModUIModel& secModUIModel, + QGraphicsItem *parent = 0 ); + virtual ~CpModuleView(); + +private slots: + void handleAccessView( const QModelIndex& modelIndex ); + void handleAccessView(); + void handleSigView(); + void handleSigViewCommand(); + void indicateLongPress(HbAbstractViewItem *item,QPointF coords); + +private: + void showAccessView(); + void showSignatureView(TBool showBlockedNote); + +private: + enum TSecModAccessCodeCommandIds + { + EIndexCodeLabel = 0, + EIndexCodeRequest, + EIndexCodeStatus + }; + + enum TSecModSignatureCommandIds + { + ESecModUICmdOpen = 0, + ESecModUICmdModuleInfo, + ESecModUICmdDelKeyStore, + ESecModUICmdChange, + ESecModUICmdUnblock, + ESecModUICmdClose, + ESecModUICmdAppTest + }; + +private: + CpSecModView::TSecModViews mCurrentView; + CSecModUIModel& mSecModUIModel; + TInt mPos; + HbMenu* mContextMenu; +}; + +#endif /* CPMODULEVIEW_H */ 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 diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/inc/cpsecmodsyncwrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/inc/cpsecmodsyncwrapper.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,125 @@ +/* +* 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" +* 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: Wrapper class for Symbian's Security Framework's calls. +* +*/ + +#ifndef CPSECMODUISYNCWRAPPER_H +#define CPSECMODUISYNCWRAPPER_H + +#include +#include +#include +#include +#include + +class MCTToken; +class MCTAuthenticationObject; +class MCTAuthenticationObjectList; +class CUnifiedKeyStore; +class MCTTokenInterface; +class TCTTokenObjectHandle; + + + +/** +* class CSecModUISyncWrapper +* Wrapper class for Symbian's Security Framework's calls. +* +* @lib wimmanui.dll +* @since Series 60 2.0 +*/ +class CSecModUISyncWrapper : public CActive + { + public: // Constructors and destructor + + static CSecModUISyncWrapper* NewLC(); + static CSecModUISyncWrapper* NewL(); + virtual ~CSecModUISyncWrapper(); + + public: // New functions + + TInt Initialize(CUnifiedKeyStore& aKeyStore ); + + TInt OpenWIM(); + + TInt GetAuthObjectInterface( + MCTToken& aToken, + MCTTokenInterface*& aTokenInterface); + + TInt ListAuthObjects( + MCTAuthenticationObjectList& aAuthObjList, + RMPointerArray& aAuthObjects ); + + TInt ListKeys( + MCTKeyStore& aKeyStore, + RMPointerArray& aKeysInfos, + const TCTKeyAttributeFilter& aFilter); + + TInt DeleteKey( + CUnifiedKeyStore& aKeyStore, + TCTTokenObjectHandle aHandle); + + TInt ChangeReferenceData( MCTAuthenticationObject& aAuthObject ); + + TInt UnblockAuthObject( MCTAuthenticationObject& aAuthObject ); + + TInt EnableAuthObject( MCTAuthenticationObject& aAuthObject ); + + TInt DisableAuthObject( MCTAuthenticationObject& aAuthObject ); + + TInt CloseAuthObject( MCTAuthenticationObject& aAuthObject ); + + TInt TimeRemaining( MCTAuthenticationObject& aAuthObject, TInt& aStime ); + + protected: // From CActive + + void DoCancel(); + void RunL(); + + private: // New functions + + CSecModUISyncWrapper(); + + private: // Data + + // Internal operation states. + enum TOperation + { + EOperationInit, + EOperationGetAOInterface, + EOperationListAOs, + EOperationListKeys, + EOperationDelKey, + EOperationChangeReferenceData, + EOperationUnblockAO, + EOperationEnableAO, + EOperationDisableAO, + EOperationCloseAO, + EOperationTimeRemAO, + EOperationNone + }; + + // For wrapping asynchronous calls. + CActiveSchedulerWait iWait; + + // Internal state of operation. + TOperation iOperation; + + // CT objects + TAny* iObject; + }; + + +#endif // CPSECMODUISYNCWRAPPER_H diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/inc/cpsecmoduleinfoview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/inc/cpsecmoduleinfoview.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 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"" +* 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: +* +*/ + +#ifndef CPSECMODULEINFOIEW_H +#define CPSECMODULEINFOIEW_H + +#include + + + +class CpSecmoduleInfoView : public CpBaseSettingView +{ + Q_OBJECT +public: + explicit CpSecmoduleInfoView(const QVector< QPair >& securityDetails,QGraphicsItem *parent = 0); + virtual ~CpSecmoduleInfoView(); + +public slots: + + +private: + + +}; + +#endif // CPSECMODULEINFOIEW_H diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/inc/cpsecmodview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/inc/cpsecmodview.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 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"" +* 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: +* +*/ + +#ifndef CPSECMODVIEW_H +#define CPSECMODVIEW_H + +#include + +class HbAbstractViewItem; +class CpItemDataHelper; +class CSecModUIModel; + +class CpSecModView : public CpBaseSettingView +{ + Q_OBJECT +public: + explicit CpSecModView(TInt aCurrentPos, CSecModUIModel& aSecModUIModel, QGraphicsItem *parent = 0); + virtual ~CpSecModView(); + +private slots: + void displayPrevious(); + void showNextView( const QModelIndex& modelIndex ); + +public: + enum TSecModViews + { + EAccessView=0, + ESignatureView + }; + + +private: + CSecModUIModel& mSecModUIModel; + TInt mPos; + TSecModViews mCurrentView; + HbView* mAccessView; + HbView* mPrevView; + +}; + +#endif /* CPPLACEHOLDERENTRYITEMDATA_H */ diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/inc/cpsecurityview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/inc/cpsecurityview.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 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"" +* 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: +* +*/ + +#ifndef CPSECURITYVIEW_H +#define CPSECURITYVIEW_H + +#include + +class HbAbstractViewItem; +class CpItemDataHelper; +class CpSecModView; +class CpCertView; +class CSecModUIModel; +class QModelIndex; +class CpSecmoduleInfoView; +class HbMessageBox; +class CpSecurityView : public CpBaseSettingView +{ + Q_OBJECT +public: + explicit CpSecurityView(QGraphicsItem *parent = 0); + virtual ~CpSecurityView(); + +public slots: + void viewDone(); + void showWIMview(); + void displayCert(const QModelIndex& modelIndex); + void displayPrevious(); + void showCodeView(); + void showCodeView( const QModelIndex& modelIndex); + void indicateLongPress(HbAbstractViewItem *item,QPointF coords); + void deleteModule(); + void moduleDetails(); + void displayPreviousFromModInfo(); + void dialogClosed(HbAction* action); +private: + CSecModUIModel* mSecModUIModel; + CpSecModView* mSecModView; + HbView* mPreView; + CpCertView* mCertView; + CpSecmoduleInfoView* mModuleinfoView; + HbView* mCurrentView; + TInt mPos; + HbMessageBox* mNote; + HbMenu* mContextMenu; + +}; + +#endif // CPSECURITYVIEW_H diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/inc/cpuitrustids.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/inc/cpuitrustids.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 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" +* 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: Contains the TUids of supported clients for certificate's Trust Setting View +* +*/ + + +#ifndef CPUITRUSTIDS_H +#define CPUITRUSTIDS_H + +// CONSTANTS +const TUid KCertManUINullId = {0}; +const TUid KCertManUIViewTrustWapConnectionId = {268479059}; +const TUid KCertManUIViewTrustApplicationControllerId = {268452523}; +const TUid KCertManUIViewTrustMailAndImageConnId = {268441661}; +const TUid KCertManUIViewTrustJavaInstallingId = {270506792}; +const TUid KCertManUIViewOCSPCheckInstallingId = {268478646}; +const TUid KCertManUIViewTrustVPNId = {270498195}; +const TUid KCertManUIViewTrustWidgetInstallId = {537028562}; + +#endif // CPUITRUSTIDS_H + +// End of File diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/rom/advancedsecurity_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/rom/advancedsecurity_resources.iby Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,21 @@ +/* +* Copyright (c) 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" +* 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: Translation string details +* +*/ + + +#include + +data=DATAZ_\QT_TRANSLATIONS_DIR\certificate_management.qm QT_TRANSLATIONS_DIR\certificate_management.qm \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/rom/cpsecplugins.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/rom/cpsecplugins.iby Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 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" +* 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: +* +*/ + +#ifndef CPSECPLUGINS_IBY +#define CPSECPLUGINS_IBY + +file=ABI_DIR\BUILD_DIR\cpadvancedsecplugin.dll SHARED_LIB_DIR\cpadvancedsecplugin.dll + +data=\epoc32\data\c\resource\qt\plugins\controlpanel\cpadvancedsecplugin.qtplugin resource\qt\plugins\controlpanel\cpadvancedsecplugin.qtplugin + +#endif diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/rom/cpsecplugins_rom.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/rom/cpsecplugins_rom.pri Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,21 @@ +# +# Copyright (c) 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" +# 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: +# + + +symbian { +BLD_INF_RULES.prj_exports += "../rom/cpsecplugins.iby CORE_APP_LAYER_IBY_EXPORT_PATH(cpsecplugins.iby)" +BLD_INF_RULES.prj_exports += "../rom/advancedsecurity_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(advancedsecurity_resources.iby )" +} \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/src/cpcertdatacontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/src/cpcertdatacontainer.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,757 @@ +/* +* Copyright (c) 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" +* 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: Implementation of class CCertManUIKeeper +* Creates and destroys all the views CertManUI uses. +* Handles changing CertManUI views. +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include + +#include + +#include +#include <../../inc/cpsecplugins.h> +#include "cpcertdatacontainer.h" +#include "cpcertmanuisyncwrapper.h" + +// CONSTANTS +_LIT( KNameSeparator, " " ); + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// TInt CompareCALabels( const CCTCertInfo& cert1, const CCTCertInfo& cert2 ) +// Compares two labels. +// ----------------------------------------------------------------------------- +// +TInt CompareCALabels( + const CpCertManUICertData& cert1, + const CpCertManUICertData& cert2 ) + { + return ( (cert1.iCAEntryLabel->Des()). + CompareF( cert2.iCAEntryLabel->Des() ) ); + } + +// ----------------------------------------------------------------------------- +// TInt CompareUserLabels( const CCTCertInfo& cert1, const CCTCertInfo& cert2 ) +// Compares two labels. +// ----------------------------------------------------------------------------- +// +TInt CompareUserLabels( + const CpCertManUICertData& cert1, + const CpCertManUICertData& cert2 ) + { + return ( (cert1.iUserEntryLabel->Des()). + CompareF( cert2.iUserEntryLabel->Des() ) ); + } + +// ----------------------------------------------------------------------------- +// TInt ComparePeerLabels( const CCTCertInfo& cert1, const CCTCertInfo& cert2 ) +// Compares two labels. +// ----------------------------------------------------------------------------- +// +TInt ComparePeerLabels( + const CpCertManUICertData& cert1, + const CpCertManUICertData& cert2 ) + { + return ( (cert1.iPeerEntryLabel->Des()). + CompareF( cert2.iPeerEntryLabel->Des() ) ); + } + +// ----------------------------------------------------------------------------- +// TInt CompareDeviceLabels( const CCTCertInfo& cert1, const CCTCertInfo& cert2 ) +// Compares two labels. +// ----------------------------------------------------------------------------- +// +TInt CompareDeviceLabels( + const CpCertManUICertData& cert1, + const CpCertManUICertData& cert2 ) + { + return ( (cert1.iDeviceEntryLabel->Des()). + CompareF( cert2.iDeviceEntryLabel->Des() ) ); + } + + +// ================= HELPER CLASS =========================== + +// Constructor. +CpCertManUICertData::CpCertManUICertData() + { + } + +// Destructor. +CpCertManUICertData::~CpCertManUICertData() + { + delete iCAEntryLabel; + delete iUserEntryLabel; + delete iPeerEntryLabel; + delete iDeviceEntryLabel; + } + +// Releases Certificate entries. +void CpCertManUICertData::Release() + { + RDEBUG("0", 0); + if ( iCAEntry ) + { + iCAEntry->Release(); + } + + if ( iUserEntry ) + { + iUserEntry->Release(); + } + + if ( iPeerEntry ) + { + iPeerEntry->Release(); + } + + if ( iDeviceEntry ) + { + iDeviceEntry->Release(); + } + + delete this; + } + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CCertManUIKeeper::CCertManUIKeeper() +// Constructor with parent +// --------------------------------------------------------- +// +CpCertDataContainer::CpCertDataContainer() + { + } + +// --------------------------------------------------------- +// CCertManUIKeeper::~CCertManUIKeeper() +// Destructor +// --------------------------------------------------------- +// +CpCertDataContainer::~CpCertDataContainer() + { + iCALabelEntries.Close(); + iUserLabelEntries.Close(); + iPeerLabelEntries.Close(); + iDeviceLabelEntries.Close(); + + if ( iWrapper ) + { + iWrapper->Cancel(); + } + delete iWrapper; + + delete iFilter; + delete iKeyFilter; + delete iStore; + delete iKeyStore; + + iCAEntries.Close(); + iUserEntries.Close(); + iPeerEntries.Close(); + iDeviceEntries.Close(); + iKeyEntries.Close(); + + iRfs.Close(); + } + +// --------------------------------------------------------- +// CCertManUIKeeper* CCertManUIKeeper::NewL(const TRect& aRect, TUid aViewId) +// --------------------------------------------------------- +// + +CpCertDataContainer* CpCertDataContainer::NewL() + { + CpCertDataContainer* self = new ( ELeave ) CpCertDataContainer; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------- +// CCertManUIKeeper* CCertManUIKeeper::NewLC( +// const TRect& aRect, TUid aViewId) +// --------------------------------------------------------- +// +CpCertDataContainer* CpCertDataContainer::NewLC() + { + CpCertDataContainer* self = new ( ELeave ) CpCertDataContainer; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------- +// CCertManUIKeeper::ConstructL( + // const TRect& aRect, TUid aViewId +// +// --------------------------------------------------------- +// +void CpCertDataContainer::ConstructL() + { + RDEBUG("0", 0); + // Ensure that file server session is succesfully created + User::LeaveIfError( iRfs.Connect() ); + + TRAPD ( error, iStore = CUnifiedCertStore::NewL( iRfs, ETrue ) ); + + if ( error == KErrNotSupported || error == KErrNotReady + || error == KErrArgument || error == KErrNotFound ) + { + // Something may be wrong with the databases + ShowErrorNoteL( error ); + } + + User::LeaveIfError( error ); + + iWrapper = CpCertManUISyncWrapper::NewL(); + iWrapper->InitStoreL( iStore ); + + iFilter = CCertAttributeFilter::NewL(); + + TRAP( error, iKeyStore = CUnifiedKeyStore::NewL( iRfs ) ); + + if (error == KErrNotSupported || error == KErrNotReady + || error == KErrArgument || error == KErrNotFound) + { + // Something is wrong with key stores + ShowErrorNoteL( error ); + } + + User::LeaveIfError( error ); + + iWrapper->InitStoreL( iKeyStore ); + iKeyEntries.Close(); + + } + + +// --------------------------------------------------------- +// CCertManUIKeeper::CertManager() +// --------------------------------------------------------- +// +CUnifiedCertStore*& CpCertDataContainer::CertManager() + { + return iStore; + } + +// --------------------------------------------------------- +// CCertManUIKeeper::KeyManager() +// --------------------------------------------------------- +// +CUnifiedKeyStore*& CpCertDataContainer::KeyManager() + { + return iKeyStore; + } + +// --------------------------------------------------------- +// CCertManUIKeeper::RefreshCAEntriesL() +// Checks that cacerts.dat file is not corrupted and +// returns CA certificates from it +// --------------------------------------------------------- +// +void CpCertDataContainer::RefreshCAEntriesL() + { + RDEBUG("0", 0); + iFilter->SetOwnerType( ECACertificate ); + iCAEntries.Close(); + CUnifiedCertStore*& store = CertManager(); + iWrapper->ListL( store, &iCAEntries, *iFilter ); + + iCALabelEntries.Close(); + for ( TInt ii = 0; ii < iCAEntries.Count(); ii++ ) + { + switch ( iCAEntries[ii]->CertificateFormat() ) + { + case EX509Certificate: + { + CpCertManUICertData* data = new ( ELeave ) CpCertManUICertData(); + CleanupStack::PushL( data ); + data->iCAEntry = CCTCertInfo::NewL( *iCAEntries[ii] ); + + HBufC* pri = NULL; + HBufC* sec = NULL; + + CCertificate* cert; + + TRAPD(err, iWrapper->GetCertificateL( CertManager(), *iCAEntries[ii], cert )); + if (( err == KErrArgument ) || ( err == KErrCorrupt )) + { + // This indicates that certificate is not according to X509 + // specification or it is corrupted. Ignore certificate + if(data->iCAEntry) + { + data->iCAEntry->Release(); + } + CleanupStack::PopAndDestroy( data ); // data + continue; + } + else + { + User::LeaveIfError( err ); + } + + CleanupStack::PushL( cert ); + + X509CertNameParser::PrimaryAndSecondaryNameL + ( *((CX509Certificate*)cert), pri, sec, iCAEntries[ii]->Label()); + + CleanupStack::PushL( pri ); + CleanupStack::PushL( sec ); + + TInt lenght = 0; + + lenght += iCAEntries[ii]->Label().Length(); + + if ( pri ) + { + lenght += pri->Length(); + } + if ( sec && !(iCAEntries[ii]->Label().Length()) ) + { + lenght += sec->Length(); + } + lenght += KNameSeparator.iTypeLength; + + HBufC* label = HBufC::NewL( lenght ); + label->Des().Append( iCAEntries[ii]->Label() ); + + if ( pri ) + { + label->Des().Append( KNameSeparator ); + label->Des().Append( pri->Des() ); + } + if ( sec && !(iCAEntries[ii]->Label().Length()) ) + { + label->Des().Append( sec->Des() ); + } + + data->iCAEntryLabel = label; + iCALabelEntries.Append( data ); + + CleanupStack::PopAndDestroy( 3, cert ); // pri, sec + CleanupStack::Pop( data ); + break; + } // EX509Certificate + + case EWTLSCertificate: + // Do nothing for wtls certificates + break; + default: + { + User::Leave( KErrNotSupported ); + } + } // switch + + } // for + + // Sort the certificates. + TLinearOrder order( CompareCALabels ); + iCALabelEntries.Sort( order ); + + } + +// --------------------------------------------------------- +// CCertManUIKeeper::RefreshPeerCertEntriesL() +// Checks that Trusted site certificate store is +// not corrupted and returns Peer certificates from it +// --------------------------------------------------------- +// +void CpCertDataContainer::RefreshPeerCertEntriesL() + { + RDEBUG("0", 0); + iFilter->SetOwnerType( EPeerCertificate ); + iPeerEntries.Close(); + CUnifiedCertStore*& store = CertManager(); + + iWrapper->ListL( store, &iPeerEntries, *iFilter, KCMTrustedServerTokenUid ); + + iPeerLabelEntries.Close(); + + for ( TInt ii = 0; ii < iPeerEntries.Count(); ii++ ) + { + switch ( iPeerEntries[ii]->CertificateFormat() ) + { + case EX509Certificate: + { + CpCertManUICertData* data = new (ELeave) CpCertManUICertData(); + CleanupStack::PushL( data ); + data->iPeerEntry = CCTCertInfo::NewL( *iPeerEntries[ii] ); + + CCertificate* cert; + + TRAPD( err, iWrapper->GetCertificateL( CertManager(), *iPeerEntries[ii], cert, KCMTrustedServerTokenUid )); + if (( err == KErrArgument ) || ( err == KErrCorrupt )) + { + // This indicates that certificate is not according to X509 + // specification or it is corrupted. Ignore certificate + if( data->iPeerEntry ) + { + data->iPeerEntry->Release(); + } + CleanupStack::PopAndDestroy( data ); // data + continue; + } + else + { + User::LeaveIfError( err ); + } + + CleanupStack::PushL( cert ); + + TInt lenght = 0; + + lenght += iPeerEntries[ii]->Label().Length(); + + HBufC* label = HBufC::NewL( lenght ); + label->Des().Append( iPeerEntries[ii]->Label() ); + + data->iPeerEntryLabel = label; + iPeerLabelEntries.Append( data ); + + CleanupStack::PopAndDestroy( cert ); // cert + CleanupStack::Pop( data ); // data + break; + } // EX509Certificate + + case EWTLSCertificate: + // Do nothing for wtls certificates + break; + default: + { + User::Leave( KErrNotSupported ); + } + } // switch + + } // for + + // Sort the certificates. + TLinearOrder order( ComparePeerLabels ); + iPeerLabelEntries.Sort( order ); + + } + + +// --------------------------------------------------------- +// CCertManUIKeeper::RefreshUserCertEntriesL() +// Checks that cacerts.dat file is not corrupted and +// returns User certificates from it +// --------------------------------------------------------- +// +void CpCertDataContainer::RefreshUserCertEntriesL() + { + RDEBUG("0", 0); + iFilter->SetOwnerType( EUserCertificate ); + iUserEntries.Close(); + CUnifiedCertStore*& store = CertManager(); + iWrapper->ListL( store, &iUserEntries, *iFilter ); + + iUserLabelEntries.Close(); + + for ( TInt i = 0; i < iUserEntries.Count(); i++ ) + { + + if ( iUserEntries[i]->Handle().iTokenHandle.iTokenTypeUid == KCMDeviceCertStoreTokenUid ) + { + // User certificates from DeviceCertStore are not + // shown in Personal certificate view. Ignore this certificate. + break; + } + + switch ( iUserEntries[i]->CertificateFormat() ) + { + case EX509Certificate: + { + CpCertManUICertData* data = new (ELeave) CpCertManUICertData(); + CleanupStack::PushL( data ); + data->iUserEntry = CCTCertInfo::NewL( *iUserEntries[i] ); + + HBufC* pri = NULL; + HBufC* sec = NULL; + + CCertificate* cert = NULL; + TRAPD(error, iWrapper->GetCertificateL( CertManager(), *iUserEntries[i], cert )); + + if( error == KErrArgument) + { + CleanupStack::PopAndDestroy( data ); + break; + } + else if ( error != KErrNone ) + { + User::Leave( error ); + } + else + { + CleanupStack::PushL( cert ); + } + + X509CertNameParser::PrimaryAndSecondaryNameL + ( *((CX509Certificate*)cert), pri, sec, iUserEntries[i]->Label()); + + CleanupStack::PushL( pri ); + CleanupStack::PushL( sec ); + + TInt lenght = 0; + + lenght += iUserEntries[i]->Label().Length(); + + if ( pri ) + { + lenght += pri->Length(); + } + if ( sec && !(iUserEntries[i]->Label().Length()) ) + { + lenght += sec->Length(); + } + lenght += KNameSeparator.iTypeLength; + + HBufC* label = HBufC::NewL( lenght ); + label->Des().Append( iUserEntries[i]->Label() ); + + if ( pri ) + { + label->Des().Append( KNameSeparator ); + label->Des().Append( pri->Des() ); + } + if ( sec && !(iUserEntries[i]->Label().Length()) ) + { + label->Des().Append( sec->Des() ); + } + + data->iUserEntryLabel = label; + iUserLabelEntries.Append( data ); + + CleanupStack::PopAndDestroy( 3, cert ); // pri, sec + CleanupStack::Pop( data ); // data + break; + } // EX509Certificate + + case EX509CertificateUrl: + { + CpCertManUICertData* urlCertData = new (ELeave) CpCertManUICertData(); + CleanupStack::PushL( urlCertData ); + urlCertData->iUserEntry = CCTCertInfo::NewL( *iUserEntries[i] ); + + CCertificate* cert = NULL; + TRAPD(error, iWrapper->GetCertificateL( CertManager(), *iUserEntries[i], cert )); + if( error == KErrArgument ) + { + CleanupStack::PopAndDestroy( urlCertData ); // urlCertData + break; + } + else if ( error != KErrNone ) + { + User::Leave(error); + } + else + { + CleanupStack::PushL( cert ); + } + + _LIT(KUrlUserCert, "URL UserCert"); + HBufC* UrlLabel = HBufC::NewL( KUrlUserCert().Length() ); + UrlLabel->Des().Append( KUrlUserCert()); + + urlCertData->iUserEntryLabel = UrlLabel; + iUserLabelEntries.Append( urlCertData ); + + CleanupStack::PopAndDestroy( cert ); // cert + CleanupStack::Pop( urlCertData ); // data + break; + } + } // switch + + } // for + + // Sort the certificates. + TLinearOrder order( CompareUserLabels ); + iUserLabelEntries.Sort( order ); + + } + +// --------------------------------------------------------- +// CCertManUIKeeper::RefreshDeviceCertEntriesL() +// returns device certificates +// --------------------------------------------------------- +// +void CpCertDataContainer::RefreshDeviceCertEntriesL() + { + RDEBUG("0", 0); + iFilter->SetOwnerType( EUserCertificate ); + iDeviceEntries.Close(); + CUnifiedCertStore*& store = CertManager(); + + iWrapper->ListL( store, &iDeviceEntries, *iFilter, KCMDeviceCertStoreTokenUid ); + + iDeviceLabelEntries.Close(); + for ( TInt i = 0; i < iDeviceEntries.Count(); i++ ) + { + switch ( iDeviceEntries[i]->CertificateFormat() ) + { + case EX509Certificate: + { + CpCertManUICertData* data = new (ELeave) CpCertManUICertData(); + CleanupStack::PushL( data ); + data->iDeviceEntry = CCTCertInfo::NewL( *iDeviceEntries[i] ); + + HBufC* pri = NULL; + HBufC* sec = NULL; + + CCertificate* cert = NULL; + TRAPD(error, iWrapper->GetCertificateL( CertManager(), *iDeviceEntries[i], cert, KCMDeviceCertStoreTokenUid )); + + if( error == KErrArgument) + { + CleanupStack::PopAndDestroy( data ); + break; + } + else if ( error != KErrNone ) + { + User::Leave( error ); + } + else + { + CleanupStack::PushL( cert ); + } + + X509CertNameParser::PrimaryAndSecondaryNameL + ( *((CX509Certificate*)cert), pri, sec, iDeviceEntries[i]->Label()); + + CleanupStack::PushL( pri ); + CleanupStack::PushL( sec ); + + TInt lenght = 0; + + lenght += iDeviceEntries[i]->Label().Length(); + + if ( pri ) + { + lenght += pri->Length(); + } + if ( sec && !(iDeviceEntries[i]->Label().Length()) ) + { + lenght += sec->Length(); + } + lenght += KNameSeparator.iTypeLength; + + HBufC* label = HBufC::NewL( lenght ); + label->Des().Append( iDeviceEntries[i]->Label() ); + + if ( pri ) + { + label->Des().Append( KNameSeparator ); + label->Des().Append( pri->Des() ); + } + if ( sec && !(iDeviceEntries[i]->Label().Length()) ) + { + label->Des().Append( sec->Des() ); + } + + data->iDeviceEntryLabel = label; + iDeviceLabelEntries.Append( data ); + + CleanupStack::PopAndDestroy( 3, cert ); // pri, sec + CleanupStack::Pop( data ); // data + break; + } // EX509Certificate + + case EX509CertificateUrl: + { + CpCertManUICertData* urlCertData = new (ELeave) CpCertManUICertData(); + CleanupStack::PushL( urlCertData ); + urlCertData->iDeviceEntry = CCTCertInfo::NewL( *iDeviceEntries[i] ); + + CCertificate* cert = NULL; + TRAPD(error, iWrapper->GetCertificateL( CertManager(), *iDeviceEntries[i], cert, KCMDeviceCertStoreTokenUid )); + if( error == KErrArgument) + { + CleanupStack::PopAndDestroy( urlCertData ); // urlCertData + break; + } + else if ( error != KErrNone ) + { + User::Leave(error); + } + else + { + CleanupStack::PushL( cert ); + } + + _LIT(KUrlUserCert, "URL UserCert"); + HBufC* UrlLabel = HBufC::NewL( KUrlUserCert().Length() ); + UrlLabel->Des().Append( KUrlUserCert()); + + + urlCertData->iDeviceEntryLabel = UrlLabel; + iDeviceLabelEntries.Append( urlCertData ); + + CleanupStack::PopAndDestroy( cert ); // cert + CleanupStack::Pop( urlCertData ); // data + break; + } + } // switch + + } // for + + // Sort the certificates. + TLinearOrder order( CompareDeviceLabels ); + iDeviceLabelEntries.Sort( order ); + + } + +// --------------------------------------------------------- +// CCertManUIKeeper::ShowErrorNoteL( TInt aError ) +// Shows error note +// --------------------------------------------------------- +// +void CpCertDataContainer::ShowErrorNoteL( TInt aError ) + { + QString sError; + switch ( aError ) + { + case KErrCorrupt: + { + sError = "Database corrupted. Some data might have been lost."; + break; + } + case KErrCancel: + { + // Show nothing + break; + } + default: + { + sError = "Internal error"; + break; + } + } + + if ( sError.length() != 0 ) + { + HbMessageBox::information(sError); + } + } + diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/src/cpcertdetailview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/src/cpcertdetailview.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,887 @@ +/* +* Copyright (c) 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"" +* 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: +* +*/ +#include +#include +#include +#include +#include +#include // MD5 fingerprint +#include + +#include // Pow +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include <../../inc/cpsecplugins.h> +#include "cpcertdetailview.h" +#include "cpcertview.h" +#include "cpcertdatacontainer.h" +#include "cpcertmanuisyncwrapper.h" +#include "../../../pkiutilities/DeviceToken/Inc/TrustedSitesStore.h" + +const TInt KFileCertStoreUid( 0x101F501A ); +const TInt KTrustedServerCertStoreUid( 0x101FB66F ); +const TInt KDeviceCertStoreUid( 0x101FB668 ); +const TInt KDeviceKeyStoreUid( 0x101FB66A ); +const TInt KWIMCertStoreUid ( 0x101F79D9 ); + +const TInt KMaxLengthTextSerialNumberFormatting = 3; +_LIT( KCertManUIDetailsViewHexaFormat, "%02X" ); +_LIT( KBlockSeparator, " " ); + +template +class CleanupResetAndDestroy + { +public: + inline static void PushL( T& aRef ); +private: + static void ResetAndDestroy( TAny *aPtr ); + }; + +template +inline void CleanupResetAndDestroyPushL( T& aRef ); + +template +inline void CleanupResetAndDestroy::PushL( T& aRef ) + { + CleanupStack::PushL( TCleanupItem( &ResetAndDestroy, &aRef ) ); + } + +template +void CleanupResetAndDestroy::ResetAndDestroy( TAny *aPtr ) + { + if( aPtr ) + { + static_cast( aPtr )->ResetAndDestroy(); + } + } + +template +inline void CleanupResetAndDestroyPushL( T& aRef ) + { + CleanupResetAndDestroy::PushL( aRef ); + } + +CpCertDetailView::CpCertDetailView(CpCertView::TCertificateViews aCurrentView,TInt aPos, CpCertDataContainer& aCertDataContainer, QGraphicsItem *parent /*= 0*/) +: CpBaseSettingView(0,parent), mCertDataContainer(aCertDataContainer) + { + setTitle(tr("Certificate Details")); + + try + { + QT_TRAP_THROWING(viewCertificateDetailsL(aPos, aCurrentView)); + } + catch(const std::exception& exception) + { + HbMessageBox::information(exception.what()); + throw(exception); + } + } + + +CpCertDetailView::~CpCertDetailView() + {} + +void CpCertDetailView::viewCertificateDetailsL( TInt aIndex, CpCertView::TCertificateViews aType ) + { + RDEBUG("0", 0); + QGraphicsLinearLayout *layout = q_check_ptr(new QGraphicsLinearLayout(Qt::Vertical)); + setLayout(layout); + + HbListWidget* mCertDetails = q_check_ptr(new HbListWidget(this)); + + HBufC8* urlBuf = NULL; + CCertificate* details = NULL; + CUnifiedCertStore*& store = mCertDataContainer.CertManager(); + + const CCTCertInfo* entry = certInfo(aIndex, aType); + TCertificateFormat certificateFormat = entry->CertificateFormat(); + + if( certificateFormat != EX509CertificateUrl ) + { + mCertDataContainer.iWrapper->GetCertificateL( store, *entry, details ); + CleanupStack::PushL( details ); + validateCertificateL( aIndex, *details, *entry, aType ); + } + else + { + urlBuf = HBufC8::NewLC( entry->Size() ); + TPtr8 urlPtr = urlBuf->Des(); + mCertDataContainer.iWrapper->GetUrlCertificateL( store, *entry, urlPtr ); + } + + if( aType == CpCertView::ETrustedView ) + { + addTrustedSitesL(*details, *mCertDetails); + } + else + { + addLabel(*entry, *mCertDetails); + } + RDEBUG("0", 0); + // certificate issuer and owner + if( certificateFormat == EX509Certificate ) + { + addIssuerL(*details, *mCertDetails); + addSubjectL(*details, *mCertDetails); + } + + // Get key usage and location. This is done only client certificates. + const TInt KLocationUnknown = 0; + TUid keyLocation = { KLocationUnknown }; + + if(( aType == CpCertView::EPersonalView ) || ( aType == CpCertView::EDeviceView )) + { + TKeyUsagePKCS15 usage = keyUsageAndLocationL( *entry, &keyLocation ); + addCertUsage(usage, *mCertDetails); + } + RDEBUG("0", 0); + if( certificateFormat == EX509Certificate ) + { + addValidityPeriod( *details, *mCertDetails ); + TUid certLoc; + certLoc.iUid = entry->Token().TokenType().Type().iUid; + // add the location of the certificate + setLocationInfo( ETrue, certLoc, *mCertDetails ); + } + else if( certificateFormat == EX509CertificateUrl ) + { + setURLLocation( *urlBuf, *mCertDetails ); + } + else + { + // nothing + } + + addCertFormat(certificateFormat, *mCertDetails); + + // Private key location, only for user and device certicates + if(( aType == CpCertView::EPersonalView ) || ( aType == CpCertView::EDeviceView )) + { + setLocationInfo( EFalse, keyLocation, *mCertDetails ); + } + + if( certificateFormat == EX509Certificate ) + { + addAlgoDetails( *details, *mCertDetails); + addSerialNo( *details, *mCertDetails ); + addFingerprint( *details, *mCertDetails); + addPublicKeyDetailsL( *details, *mCertDetails ); + } + else + { + // SetUrlCertAlgorihm() + } + RDEBUG("0", 0); + if( certificateFormat != EX509CertificateUrl ) + { + CleanupStack::PopAndDestroy( details ); + } + else + { + CleanupStack::PopAndDestroy( urlBuf ); + } + + layout->addItem(mCertDetails); + } + +const CCTCertInfo* CpCertDetailView::certInfo( TInt index, CpCertView::TCertificateViews certView ) + { + RDEBUG("0", 0); + const CCTCertInfo* certinfo = NULL; + + if( certView == CpCertView::EAuthorityView ) + { + certinfo = ( mCertDataContainer.iCALabelEntries )[ index ]->iCAEntry; + } + else if( certView == CpCertView::ETrustedView ) + { + certinfo = ( mCertDataContainer.iPeerLabelEntries )[ index ]->iPeerEntry; + } + else if( certView == CpCertView::EDeviceView ) + { + certinfo = ( mCertDataContainer.iDeviceLabelEntries )[ index ]->iDeviceEntry; + } + else if( certView == CpCertView::EPersonalView ) + { + certinfo = ( mCertDataContainer.iUserLabelEntries )[ index ]->iUserEntry; + } + return certinfo; + } + +void CpCertDetailView::addTrustedSitesL( const CCertificate& certDetails, HbListWidget& certDisplayDetails ) + { + RDEBUG("0", 0); + CTrustSitesStore* trustedSitesStore = CTrustSitesStore::NewL(); + CleanupStack::PushL( trustedSitesStore ); + + RPointerArray trustedSites; + CleanupResetAndDestroyPushL( trustedSites ); + trustedSitesStore->GetTrustedSitesL( certDetails.Encoding(), trustedSites ); + + QString sTrustedSites = "Site:"; + if( trustedSites.Count() > 0 ) + { + // display trusted sites + sTrustedSites = "Site:"; + } + addToListWidget(certDisplayDetails, sTrustedSites); + + for(int index=0;indexPtr()), trustedSites[index]->Length()); + addToListWidget(certDisplayDetails, trustedSiteDetail); + } + + CleanupStack::PopAndDestroy( &trustedSites ); + CleanupStack::PopAndDestroy( trustedSitesStore ); + + } + +void CpCertDetailView::addLabel( const CCTCertInfo& aCertInfo, HbListWidget& certDisplayDetails ) + { + RDEBUG("0", 0); + QString sLabel("Label:"); + QString sLabelDetails = "(No label)"; + if(aCertInfo.Label().Length() != 0) + { + sLabelDetails = QString((QChar*)(aCertInfo.Label().Ptr()),aCertInfo.Label().Length()); + } + addToListWidget(certDisplayDetails, sLabel, sLabelDetails); + } + +void CpCertDetailView::addIssuerL( const CCertificate& aCertDetails, + HbListWidget& certDisplayDetails ) + { + HBufC* issuer = NULL; + X509CertNameParser::IssuerFullNameL( (CX509Certificate&)aCertDetails, issuer ); + CleanupStack::PushL( issuer ); + + QString sIssuer = "Issuer:"; + QString sIssuerDetails = "(Not defined)"; + if(issuer->Des().Length() != 0) + { + sIssuerDetails = QString((QChar*)issuer->Des().Ptr(),issuer->Des().Length()); + } + addToListWidget(certDisplayDetails, sIssuer, sIssuerDetails); + + CleanupStack::PopAndDestroy( issuer ); + } + +void CpCertDetailView::addSubjectL( const CCertificate& aCertDetails, + HbListWidget& certDisplayDetails ) + { + RDEBUG("0", 0); + HBufC* subject = NULL; + X509CertNameParser::SubjectFullNameL( (CX509Certificate&)aCertDetails, subject ); + CleanupStack::PushL( subject ); + + QString sSubject = "Subject:"; + QString sSubjectDetails = "(No subject)"; + if(subject->Des().Length() != 0) + { + sSubjectDetails = QString((QChar*)subject->Des().Ptr(),subject->Des().Length()); + } + + addToListWidget(certDisplayDetails, sSubject, sSubjectDetails); + + CleanupStack::PopAndDestroy( subject ); + } + +void CpCertDetailView::addCertUsage( TKeyUsagePKCS15 usage, HbListWidget& certDisplayDetails ) + { + RDEBUG("0", 0); + QString strUsage; + switch( usage ) + { + case EPKCS15UsageSignSignRecover: + case EPKCS15UsageSignDecrypt: + case EPKCS15UsageSign: + strUsage = "Client authentication"; + break; + case EPKCS15UsageNonRepudiation: + strUsage = "Digital signing"; + break; + default: + strUsage = "(Not defined)"; + break; + } + addToListWidget(certDisplayDetails, strUsage ); + } + + +void CpCertDetailView::addValidityPeriod( const CCertificate& aCertDetails, + HbListWidget& certDisplayDetails) + { + RDEBUG("0", 0); + // Certificate validity period + // Hometime's offset to UTC + TLocale locale; + TTimeIntervalSeconds offSet = locale.UniversalTimeOffset(); + + QString sValidFrom("Valid from: "); + const CValidityPeriod& validityPeriod = aCertDetails.ValidityPeriod(); + TTime startValue = validityPeriod.Start(); + startValue += offSet; + TDateTime dateTime = startValue.DateTime(); + TMonth month = dateTime.Month(); + TInt day = dateTime.Day(); + TInt year = dateTime.Year(); + QDateTime qValidityPeriod(QDate(year, month, day)); + QString sValidFromDetail = qValidityPeriod.toString("MM\\dd\\yyyy"); + + addToListWidget(certDisplayDetails, sValidFrom, sValidFromDetail); + + QString sValidUntil("Valid until: "); + TTime finishValue = validityPeriod.Finish(); + finishValue += offSet; + dateTime = finishValue.DateTime(); + month = dateTime.Month(); + day = dateTime.Day(); + year = dateTime.Year(); + qValidityPeriod.setDate(QDate(year, month, day)); + QString sValidUntilDetail = qValidityPeriod.toString("MM\\dd\\yyyy"); + + addToListWidget(certDisplayDetails, sValidUntil, sValidUntilDetail); + + } + +void CpCertDetailView::setURLLocation( HBufC8& urlDetails, HbListWidget& certDisplayDetails ) + { + RDEBUG("0", 0); + TPtr8 urlPtr = urlDetails.Des(); + + QString certUrl = "Location:"; + QString certURLDetail = "(Not defined)"; + TInt length = urlPtr.Length(); + if(length != 0) + { + certURLDetail = QString((QChar*)urlPtr.Ptr(),urlPtr.Length()); + } + addToListWidget(certDisplayDetails, certUrl, certURLDetail); + } + +void CpCertDetailView::addCertFormat( TCertificateFormat aCertFormat, HbListWidget& certDisplayDetails ) + { + RDEBUG("0", 0); + // certificate format + QString certFormat = "Certificate format:"; + QString certFormatDetails = "(Not defined)"; + if( aCertFormat == EX509Certificate || aCertFormat == EX509CertificateUrl) + { + certFormatDetails = "X509"; + } + addToListWidget(certDisplayDetails, certFormat, certFormatDetails); + } + +void CpCertDetailView::addAlgoDetails( const CCertificate& certificate, + HbListWidget& certDisplayDetails ) + { + RDEBUG("0", 0); + // certificate algorithms + QString sDgstAlgoDetails = "Unknown"; + // digest algorithm + TAlgorithmId algorithmId = certificate.SigningAlgorithm().DigestAlgorithm().Algorithm(); + switch( algorithmId ) + { + case EMD2: + { + sDgstAlgoDetails = "MD2"; + break; + } + case EMD5: + { + sDgstAlgoDetails = "MD5"; + break; + } + case ESHA1: + { + sDgstAlgoDetails = "SHA1"; + break; + } + } + + QString sAsymmetricAlgoDetails = asymmetricAlgoId(certificate); + QString sAlgorithm("Algorithm:"); + QString sAlgoDetails = "Unknown"; + // If other algorithm is unknown + if( sDgstAlgoDetails != "Unknown" && sAsymmetricAlgoDetails != "Unknown" ) + { + sAlgoDetails = sDgstAlgoDetails; + sAlgoDetails.append(sAsymmetricAlgoDetails); + } + addToListWidget(certDisplayDetails, sAlgorithm, sAlgoDetails); + } + +void CpCertDetailView::addSerialNo( const CCertificate& certificate, + HbListWidget& certDisplayDetails ) + { + RDEBUG("0", 0); + // certificate serial number + QString sCertSerialNo("Serial number:"); + QString sCertSerialNoDetails = 0; + TPtrC8 serialNumber = certificate.SerialNumber(); + TBuf buf2; + + for( TInt i = 0; i < serialNumber.Length(); i++ ) + { + buf2.Format( KCertManUIDetailsViewHexaFormat, serialNumber[i] ); + sCertSerialNoDetails.append( QString( (QChar*)buf2.Ptr(),buf2.Length() ) ); + } + addToListWidget(certDisplayDetails, sCertSerialNo, sCertSerialNoDetails); + } + +void CpCertDetailView::addFingerprint( const CCertificate& certificate, + HbListWidget& certDisplayDetails) + { + RDEBUG("0", 0); + // certificate fingerprint SHA-1 + QString sSha1("Fingerprint (SHA1):"); + TPtrC8 sha1_fingerprint = certificate.Fingerprint(); + HBufC* finalSha1 = NULL; + QString sSha1Details = NULL; + + QT_TRAP_THROWING + ( + finalSha1 = HBufC::NewLC(100); + TPtr finalShaPtr = finalSha1->Des(); + divideIntoBlocks( sha1_fingerprint, finalShaPtr ); + sSha1Details = QString( (QChar*)finalShaPtr.Ptr(), finalShaPtr.Length() ); + CleanupStack::PopAndDestroy(finalSha1); + ) + + addToListWidget(certDisplayDetails, sSha1, sSha1Details); + + // certificate fingerprint MD5 + QString sMd5("Fingerprint (MD5):"); + CMD5* md5= NULL; + QT_TRAP_THROWING + ( + md5 = CMD5::NewL(); + CleanupStack::PushL( md5 ); + TBuf8<20> fingerprint = md5->Hash( certificate.Encoding() ); + CleanupStack::PopAndDestroy( md5 ); + HBufC* finalMd5 = NULL; + finalMd5 = HBufC::NewLC(100); + TPtr finalMd5Ptr = finalMd5->Des(); + divideIntoBlocks( fingerprint, finalMd5Ptr ); + QString sMd5Details = QString( (QChar*)finalMd5Ptr.Ptr(), finalMd5Ptr.Length()); + CleanupStack::PopAndDestroy(finalMd5); + addToListWidget(certDisplayDetails, sMd5, sMd5Details); + ) + } + +void CpCertDetailView::addPublicKeyDetailsL( const CCertificate& certificate, + HbListWidget& certDisplayDetails ) + { + RDEBUG("0", 0); + // Public key + // Should look like: "Public key (%0U %1N bit):" + + QString sPublicKey("Public key ("); // %S %d bits):"); + sPublicKey.append(asymmetricAlgoId(certificate)); + + // Get public key already here to get length of it for string loader. + const CSubjectPublicKeyInfo& publicKey = certificate.PublicKey(); + TPtrC8 keyData = publicKey.KeyData(); + TInt size = keyData.Size(); // %1N + + // To get key size decode DER encoded key got from the certificate. + TX509KeyFactory key; + + // There doesn't seem to be definition of MAX_INT anywhere so calculate it. + TReal maxInt; + TReal intBits = sizeof( TInt ) * 8; + Math::Pow( maxInt, 2, intBits ); + maxInt = ( maxInt / 2 ) - 1; + + TAlgorithmId algorithmId = certificate.SigningAlgorithm().AsymmetricAlgorithm().Algorithm(); + switch( algorithmId ) + { + case ERSA: + { + const CRSAPublicKey* keyRSA = key.RSAPublicKeyL( keyData ); + + const TInteger& n = keyRSA->N(); + + TUint keySizeN = n.BitCount(); + + // Play it safe. + if( keySizeN < maxInt ) + { + size = keySizeN; + } + + delete keyRSA; + + break; + } + case EDSA: + { + TPtrC8 params = publicKey.EncodedParams(); + const CDSAPublicKey* keyDSA = key.DSAPublicKeyL( params, keyData ); + + const TInteger& y = keyDSA->Y(); + + TUint keySizeY = y.BitCount(); + + // Play it safe. + if( keySizeY < maxInt ) + { + size = keySizeY; + } + + delete keyDSA; + + break; + } + // There doesn't seem to be TX509KeyFactory function for DH keys. + // If the key is DH or unknown, just multiply length of the key + // in bytes with 8. It is not correct but at least gives an idea. + // Without setting something to size 'unknown' text should be used + // below for the string which is much more error prone than setting + // at least something. + case EDH: + default: + { + size = 8 * keyData.Size(); + } + } + + sPublicKey.append(" ").append(QString::number(size)).append(" bits):"); + + // Finally append the public key. + HBufC* pubKey = HBufC::NewLC(size*3); + TPtr pubKeyPtr = pubKey->Des(); + divideIntoBlocks( keyData, pubKeyPtr ); + QString sPublicKeyDetails = QString ( (QChar*)pubKeyPtr.Ptr(), pubKeyPtr.Length()); + CleanupStack::PopAndDestroy(pubKey); + addToListWidget(certDisplayDetails, sPublicKey, sPublicKeyDetails); + } + +QString CpCertDetailView::asymmetricAlgoId( const CCertificate& certificate ) + { + RDEBUG("0", 0); + QString sAsymmetricAlgoId = 0; + // public-key algorithm + TAlgorithmId algorithmId = certificate.SigningAlgorithm().AsymmetricAlgorithm().Algorithm(); + switch( algorithmId ) + { + case ERSA: + { + sAsymmetricAlgoId = "RSA"; + break; + } + case EDSA: + { + sAsymmetricAlgoId = "DSA"; + break; + } + case EDH: + { + sAsymmetricAlgoId = "DH"; + break; + } + default: + { + sAsymmetricAlgoId = "Unknown"; + } + } + return sAsymmetricAlgoId; + } + +void CpCertDetailView::addToListWidget(HbListWidget& certDisplayDetails, const QString& data ) + { + HbListWidgetItem* wItem = q_check_ptr(new HbListWidgetItem()); + wItem->setText(data); + certDisplayDetails.addItem(wItem); + } + +void CpCertDetailView::addToListWidget( HbListWidget& certDisplayDetails, + const QString& displayString, + const QString& displayDetails ) + { + HbListWidgetItem* wDisplayString = q_check_ptr(new HbListWidgetItem()); + wDisplayString->setText(displayString); + certDisplayDetails.addItem(wDisplayString); + + HbListWidgetItem* wDisplayDetails = q_check_ptr(new HbListWidgetItem()); + wDisplayDetails->setText(displayDetails); + certDisplayDetails.addItem(wDisplayDetails); + } + +void CpCertDetailView::validateCertificateL( + TInt aIndex, const CCertificate& certDetails, const CCTCertInfo& aCertInfo, CpCertView::TCertificateViews aType ) + { + RDEBUG("0", 0); + TInt poppableItems = 0; + // Check allways first the validity period + // Show Expired/Not yet valid notes + const CValidityPeriod& validityPeriod = certDetails.ValidityPeriod(); + const TTime& startValue = validityPeriod.Start(); + const TTime& finishValue = validityPeriod.Finish(); + TTime current; + current.UniversalTime(); + + if ( startValue > current ) + { + // certificate is not valid yet + HbMessageBox::warning("The certificate is not valid yet"); + } + else if ( finishValue < current ) + { + // certificate is expired + HbMessageBox::warning("The certificate has expired"); + } + else + { + // put here check for certificate status, show warning notes if needed + TBool noValidationError = ETrue; + CArrayFixFlat* validationError = NULL; + // set it to the most common cert format + TCertificateFormat certificateFormat = EX509Certificate; + + if ( aType == CpCertView::EAuthorityView ) + { + certificateFormat = mCertDataContainer.iCALabelEntries[aIndex]-> + iCAEntry->CertificateFormat(); + } + else if ( aType == CpCertView::ETrustedView ) + { + certificateFormat = mCertDataContainer.iPeerLabelEntries[aIndex]-> + iPeerEntry->CertificateFormat(); + } + else if ( aType == CpCertView::EDeviceView ) + { + certificateFormat = mCertDataContainer.iDeviceLabelEntries[aIndex]-> + iDeviceEntry->CertificateFormat(); + } + else if( aType == CpCertView::EPersonalView ) + { + certificateFormat = mCertDataContainer.iUserLabelEntries[aIndex]-> + iUserEntry->CertificateFormat(); + } + + switch ( certificateFormat ) + { + case EX509Certificate: + { + validationError = validateX509CertificateL((CX509Certificate&)certDetails ); + break; + } + default: + { + validationError = new ( ELeave) CArrayFixFlat( 1 ); + break; + } + } + CleanupStack::PushL( validationError ); + poppableItems++; + + TInt errorCount = validationError->Count(); + TBool ready = EFalse; + for ( TInt i = 0; i < errorCount && !ready; i++ ) + { + TValidationError errorType = validationError->At(i); + + switch ( errorType ) + { + case EValidatedOK: + case EChainHasNoRoot: + case EBadKeyUsage: + // Ignore these errors + //LOG_WRITE( "Ignored certificate validation error" ); + break; + + default: + // certificate is corrupted + noValidationError = EFalse; + HbMessageBox::warning("The certificate is corrupted"); + ready = ETrue; + break; + } + } + + if ( noValidationError && (aType == CpCertView::EAuthorityView )) + // Check for last if the CA certificate has no clients, + // ie. the trust state of every client is No + // For user certificates we don't do the check + { + + RArray trusterUids; + CleanupClosePushL( trusterUids ); + poppableItems++; + + mCertDataContainer.iWrapper->GetApplicationsL( + mCertDataContainer.CertManager(), aCertInfo, trusterUids ); + + if ( trusterUids.Count() == 0) + { + HbMessageBox::warning("Certificate not trusted"); + } + } + } + CleanupStack::PopAndDestroy( poppableItems ); + } + +CArrayFixFlat* CpCertDetailView::validateX509CertificateL( const CX509Certificate& certDetails ) + { + RDEBUG("0", 0); + TInt poppableItems = 0; + CArrayFixFlat* validationError = + new ( ELeave ) CArrayFixFlat( 1 ); + CleanupStack::PushL( validationError ); //This is returned, so it isn't destroyed at the end. + + TTime GMTTime; + GMTTime.UniversalTime(); // Get Universal Time + RPointerArray certArray; + certArray.Append( &certDetails ); + + CPKIXCertChain* chain = CPKIXCertChain::NewLC( + mCertDataContainer.iRfs, certDetails.Encoding(), certArray ); + ++poppableItems; + + CPKIXValidationResult* result = CPKIXValidationResult::NewLC(); + ++poppableItems; + mCertDataContainer.iWrapper->ValidateX509RootCertificateL( result, GMTTime, chain ); + + TValidationStatus validationStatus = result->Error(); + //Set reserve space. One for error, other for warnings. + validationError->SetReserveL( 1 + result->Warnings().Count() ); + validationError->AppendL(validationStatus.iReason); + for ( TUint8 i = 0; i < result->Warnings().Count(); i++ ) + { + validationError->AppendL( result->Warnings().At(0).iReason ); + } + + CleanupStack::PopAndDestroy( poppableItems, chain ); // All but validationError. + CleanupStack::Pop(validationError); + return validationError; + } + +TKeyUsagePKCS15 CpCertDetailView::keyUsageAndLocationL( const CCTCertInfo& certEntry, + TUid* keyLocation ) + { + TKeyUsagePKCS15 keyUsage; + RDEBUG("0", 0); + // Check whether we have key for this certificate + RMPointerArray keyEntry; + TCTKeyAttributeFilter filter; + filter.iKeyId = certEntry.SubjectKeyId(); + + mCertDataContainer.iWrapper->ListL( mCertDataContainer.KeyManager(), &keyEntry, filter ); + + if (keyEntry.Count()) + { + keyUsage = keyEntry[0]->Usage(); + // Get Location + keyLocation->iUid = keyEntry[0]->Token().TokenType().Type().iUid ; + } + else + { + keyUsage = EPKCS15UsageNone; + } + + keyEntry.Close(); + return keyUsage; + } + +// --------------------------------------------------------- +// CCertManUICertificateHelper::setLocationInfo( (HBufC& aMessage, +// TBool certificate, +// TUid* aLocUid) +// Adds certificate/private key's location info to certificate details +// --------------------------------------------------------- +// +void CpCertDetailView::setLocationInfo(TBool certificate, TUid locUid, HbListWidget& certDisplayDetails) + { + RDEBUG("0", 0); + QString locationDetails = "(Not defined)"; + + switch ( locUid.iUid ) + { + case KFileCertStoreUid: + case KTrustedServerCertStoreUid: + case KDeviceCertStoreUid: + case KDeviceKeyStoreUid: + case KTokenTypeFileKeystore: + locationDetails = "Phone memory"; + break; + + case KWIMCertStoreUid: + locationDetails = "Smart card"; + break; + + default: + if ( !certificate ) + { + locationDetails = "No private key"; + } + break; + } + + QString location = "Location:"; + if ( !certificate ) + { + location = "Private key location:"; + } + + addToListWidget(certDisplayDetails, location, locationDetails ); + + } + +// --------------------------------------------------------- +// CCertManUICertificateHelper::divideIntoBlocks +// --------------------------------------------------------- +// +void CpCertDetailView::divideIntoBlocks( const TDesC8& input, TPtr& output ) + { + RDEBUG("0", 0); + const TInt KBlockLength = 2; + TInt blockIndex = 0; + for ( TInt j = 0 ; j < input.Length() ; j++ ) + { + if ( blockIndex == KBlockLength ) + { + output.Append( KBlockSeparator ); + blockIndex = 0; + } + output.AppendNumFixedWidthUC( (TUint)(input[ j ]), EHex, 2 ); + ++blockIndex; + } + } + + diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/src/cpcertmanuisyncwrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/src/cpcertmanuisyncwrapper.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,777 @@ +/* +* Copyright (c) 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" +* 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: Implements a synchronous wrapper for easier use of Symbian's +* Security Frameworks's API's. +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include <../../inc/cpsecplugins.h> +#include "cpcertmanuisyncwrapper.h" + +// CONSTANTS +_LIT_SECURITY_POLICY_C1( KKeyStoreUsePolicy, ECapabilityReadUserData ); +// Maximum length of a certificate +const TInt KMaxCertificateLength = 5000; +const TInt KMaxKeyLength = 10000; + +// ----------------------------------------------------------------------------- +// CpCertManUISyncWrapper::ListL +// ----------------------------------------------------------------------------- +// +void CpCertManUISyncWrapper::ListL( + CUnifiedCertStore*& aStore, + RMPointerArray* aArray, + const CCertAttributeFilter& aFilter, + const TUid aTokenUid ) + { + RDEBUG("0", 0); + if ( IsActive() ) + { + // Wrapper is active. Don't go further + User::Leave(KErrGeneral); + } + + TInt count = aStore->CertStoreCount(); + for ( TInt ii = 0; ii < count; ii++ ) + { + MCTCertStore& certstore = aStore->CertStore( ii ); + MCTToken& token = certstore.Token(); + TUid tokenuid = token.Handle().iTokenTypeUid; + if ( tokenuid == aTokenUid ) + { + certstore.List( *aArray, aFilter, iStatus ); + iOperation = EOperationList; + iStore = aStore; + SetActive(); + iWait.Start(); + User::LeaveIfError( iStatus.Int() ); + break; + } + } + iOperation = EOperationNone; + } + +// ----------------------------------------------------------------------------- +// CpCertManUISyncWrapper::ListL +// ----------------------------------------------------------------------------- +// +void CpCertManUISyncWrapper::ListL( + CUnifiedKeyStore*& aStore, + RMPointerArray* aArray, + const TCTKeyAttributeFilter& aFilter ) + { + RDEBUG("0", 0); + if ( IsActive() ) + { + // Wrapper is active. Don't go further + User::Leave(KErrGeneral); + } + + aStore->List( *aArray, aFilter, iStatus ); + iOperation = EOperationKeyList; + iKeyStore = aStore; + SetActive(); + iWait.Start(); + User::LeaveIfError( iStatus.Int() ); + iOperation = EOperationNone; + } + +// ----------------------------------------------------------------------------- +// CpCertManUISyncWrapper::GetCertificateL +// ----------------------------------------------------------------------------- +// +void CpCertManUISyncWrapper::GetCertificateL( CUnifiedCertStore*& aStore, + const CCTCertInfo& aCertInfo, + CCertificate*& aCert, + TUid aTokenUid ) + { + aCert = NULL; + RDEBUG("0", 0); + HBufC8* buf = HBufC8::NewLC( KMaxCertificateLength ); + iCertPtr.Set( buf->Des() ); + + TInt count = aStore->CertStoreCount(); + for (TInt i = 0; i < count; i++) + { + MCTCertStore& certstore = aStore->CertStore( i ); + MCTToken& token = certstore.Token(); + TUid tokenuid = token.Handle().iTokenTypeUid; + if ( tokenuid == aTokenUid ) + { + certstore.Retrieve( aCertInfo, iCertPtr, iStatus ); + iOperation = EGetCertificate; + iStore = aStore; + SetActive(); + iWait.Start(); + User::LeaveIfError( iStatus.Int() ); + break; + } + } + + + switch ( aCertInfo.CertificateFormat() ) + { + case EX509Certificate: + { + aCert = CX509Certificate::NewL( iCertPtr ); + break; + } + case EX509CertificateUrl: + { + break; + } + default: + { + break; + } + } + + CleanupStack::PopAndDestroy(buf); + iOperation = EOperationNone; + + } + +// ----------------------------------------------------------------------------- +// CpCertManUISyncWrapper::DeleteCertL +// ----------------------------------------------------------------------------- +// +void CpCertManUISyncWrapper::DeleteCertL( CUnifiedCertStore*& aStore, + const CCTCertInfo& aCertInfo ) + { + RDEBUG("0", 0); + aStore->Remove( aCertInfo, iStatus ); + iOperation = EOperationDelete; + iStore = aStore; + SetActive(); + iWait.Start(); + User::LeaveIfError( iStatus.Int() ); + iOperation = EOperationNone; + } + +// ----------------------------------------------------------------------------- +// CpCertManUISyncWrapper::DeleteCertL +// ----------------------------------------------------------------------------- +// +void CpCertManUISyncWrapper::DeleteCertL( CUnifiedCertStore*& aStore, + const CCTCertInfo& aCertInfo, + TUid aTokenUid ) + { + RDEBUG("0", 0); + TInt count = aStore->WritableCertStoreCount(); + for (TInt i = 0; i < count; i++) + { + MCTWritableCertStore& writablestore = aStore->WritableCertStore( i ); + MCTToken& token = writablestore.Token(); + TUid tokenuid = token.Handle().iTokenTypeUid; + if ( tokenuid == aTokenUid ) + { + writablestore.Remove( aCertInfo, iStatus ); + iOperation = EOperationDelete; + iStore = aStore; + SetActive(); + iWait.Start(); + User::LeaveIfError( iStatus.Int() ); + break; + } + } + iOperation = EOperationNone; + } + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CpCertManUISyncWrapper::CpCertManUISyncWrapper() +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CpCertManUISyncWrapper::CpCertManUISyncWrapper() : CActive( EPriorityStandard ), iCertPtr(0,0) + { + CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// CpCertManUISyncWrapper::ConstructL() +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CpCertManUISyncWrapper::ConstructL() + { + } + + +// ----------------------------------------------------------------------------- +// CpCertManUISyncWrapper::NewLC +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CpCertManUISyncWrapper* CpCertManUISyncWrapper::NewLC() + { + CpCertManUISyncWrapper* wrap = new ( ELeave ) CpCertManUISyncWrapper(); + CleanupStack::PushL( wrap ); + wrap->ConstructL(); + return wrap; + } + +// ----------------------------------------------------------------------------- +// CpCertManUISyncWrapper::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CpCertManUISyncWrapper* CpCertManUISyncWrapper::NewL() + { + CpCertManUISyncWrapper* wrap = CpCertManUISyncWrapper::NewLC(); + CleanupStack::Pop(wrap); + return wrap; + } + +// Destructor +CpCertManUISyncWrapper::~CpCertManUISyncWrapper() + { + } + +// ----------------------------------------------------------------------------- +// CpCertManUISyncWrapper::RunL +// If no errors happened, stop. Show an error note if needed. +// ----------------------------------------------------------------------------- +// + +void CpCertManUISyncWrapper::RunL() + { + RDEBUG("0", 0); + if ( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + + } + +// ----------------------------------------------------------------------------- +// CpCertManUISyncWrapper::DoCancel +// Cancels the ongoing operation if possible. +// ----------------------------------------------------------------------------- +// +void CpCertManUISyncWrapper::DoCancel() + { + RDEBUG("iOperation", iOperation); + switch ( iOperation ) + { + case EOperationInit: + { + iStore->CancelInitialize(); + break; + } + case EOperationList: + { + iStore->CancelList(); + break; + } + case EGetCertificate: + { + iStore->CancelRetrieve(); + break; + } + case EAddCertificate: + { + iStore->Cancel(); + break; + } + case ERetriveURLCertificate: + { + iStore->CancelRetrieve(); + break; + } + case EOperationDelete: + { + iStore->CancelRemove(); + break; + } + case EOperationGetApps: + { + iStore->CancelApplications(); + break; + } + case EOperationValidateX509Root: + { + iChain->CancelValidate(); + break; + } + case EShowErrorNote: + { + break; + } + case EOperationInitKeyStore: + { + iKeyStore->CancelInitialize(); + break; + } + case EOperationKeyList: + { + iKeyStore->CancelList(); + break; + } + case EOperationExportKey: + { + iKeyStore->CancelExportKey(); + break; + } + case EOperationImportKey: + { + iKeyStore->CancelImportKey(); + break; + } + case EOperationDeleteKey: + { + iKeyStore->CancelDeleteKey(); + break; + } + default: + { + break; + } + } + } + +// ----------------------------------------------------------------------------- +// CpCertManUISyncWrapper::InitStoreL +// ----------------------------------------------------------------------------- +// +void CpCertManUISyncWrapper::InitStoreL( CUnifiedCertStore*& aStore ) + { + aStore->Initialize( iStatus ); + iOperation = EOperationInit; + iStore = aStore; + SetActive(); + iWait.Start(); + User::LeaveIfError( iStatus.Int() ); + iOperation = EOperationNone; + } + +// ----------------------------------------------------------------------------- +// CpCertManUISyncWrapper::InitStoreL +// ----------------------------------------------------------------------------- +// +void CpCertManUISyncWrapper::InitStoreL( CUnifiedKeyStore*& aStore ) + { + aStore->Initialize( iStatus ); + iOperation = EOperationInitKeyStore; + iKeyStore = aStore; + SetActive(); + iWait.Start(); + User::LeaveIfError( iStatus.Int() ); + iOperation = EOperationNone; + } + +// ----------------------------------------------------------------------------- +// CpCertManUISyncWrapper::ListL +// ----------------------------------------------------------------------------- +// +void CpCertManUISyncWrapper::ListL( + CUnifiedCertStore*& aStore, + RMPointerArray* aArray, + const CCertAttributeFilter& aFilter ) + { + + if ( IsActive() ) + { + // Wrapper is active. Don't go further + User::Leave(KErrGeneral); + } + + aStore->List( *aArray, aFilter, iStatus ); + iOperation = EOperationList; + iStore = aStore; + SetActive(); + iWait.Start(); + User::LeaveIfError( iStatus.Int() ); + iOperation = EOperationNone; + } + +// ----------------------------------------------------------------------------- +// CpCertManUISyncWrapper::ListL +// ----------------------------------------------------------------------------- +// +void CpCertManUISyncWrapper::ListL( + CUnifiedKeyStore*& aStore, + RMPointerArray* aArray, + const TCTKeyAttributeFilter& aFilter, + const TUid aTokenUid ) + { + + if ( IsActive() ) + { + // Wrapper is active. Don't go further + User::Leave(KErrGeneral); + } + + TInt count = aStore->KeyStoreManagerCount(); + for ( TInt ii = 0; ii < count; ii++ ) + { + MCTKeyStoreManager& keystoremanager = aStore->KeyStoreManager( ii ); + MCTToken& token = keystoremanager.Token(); + TUid tokenuid = token.Handle().iTokenTypeUid; + if ( tokenuid == aTokenUid ) + { + keystoremanager.List( *aArray, aFilter, iStatus ); + iOperation = EOperationKeyList; + iKeyStore = aStore; + SetActive(); + iWait.Start(); + User::LeaveIfError( iStatus.Int() ); + break; + } + } + iOperation = EOperationNone; + } + +// ----------------------------------------------------------------------------- +// CpCertManUISyncWrapper::GetCertificateL +// ----------------------------------------------------------------------------- +// +void CpCertManUISyncWrapper::GetCertificateL( + CUnifiedCertStore*& aStore, + const CCTCertInfo& aCertInfo, + CCertificate*& aCert ) + { + aCert = NULL; + HBufC8* buf = HBufC8::NewLC( KMaxCertificateLength ); + iCertPtr.Set( buf->Des() ); + aStore->Retrieve( aCertInfo, iCertPtr, iStatus); + iOperation = EGetCertificate; + iStore = aStore; + SetActive(); + iWait.Start(); + User::LeaveIfError( iStatus.Int() ); + + switch ( aCertInfo.CertificateFormat() ) + { + case EX509Certificate: + { + aCert = CX509Certificate::NewL( iCertPtr ); + break; + } + case EX509CertificateUrl: + { + break; + } + default: + { + break; + } + } + CleanupStack::PopAndDestroy(buf); + iOperation = EOperationNone; + } + +// ----------------------------------------------------------------------------- +// CpCertManUISyncWrapper::ValidateX509RootCertificateL +// ----------------------------------------------------------------------------- +// +void CpCertManUISyncWrapper::ValidateX509RootCertificateL( + CPKIXValidationResult*& aValidationResult, + const TTime& aValidationTime, CPKIXCertChain*& aChain ) + { + + aChain->ValidateL( *aValidationResult, aValidationTime, iStatus ); + iOperation = EOperationValidateX509Root; + iChain = aChain; + SetActive(); + iWait.Start(); + iOperation = EOperationNone; + User::LeaveIfError(iStatus.Int()); + } + +// ----------------------------------------------------------------------------- +// CpCertManUISyncWrapper::GetUrlCertificateL +// ----------------------------------------------------------------------------- +// +void CpCertManUISyncWrapper::GetUrlCertificateL( + CUnifiedCertStore*& aStore, + const CCTCertInfo& aCertInfo, + TDes8& aUrl ) + { + + aStore->Retrieve( aCertInfo, aUrl, iStatus); + iOperation = ERetriveURLCertificate; + iStore = aStore; + SetActive(); + iWait.Start(); + User::LeaveIfError( iStatus.Int() ); + iOperation = EOperationNone; + } + +// ----------------------------------------------------------------------------- +// CpCertManUISyncWrapper::GetApplicationsL +// ----------------------------------------------------------------------------- +// +void CpCertManUISyncWrapper::GetApplicationsL( CUnifiedCertStore*& aStore, + const CCTCertInfo& aCertInfo, RArray& aApps ) + { + + aStore->Applications( aCertInfo, aApps, iStatus ); + iOperation = EOperationGetApps; + iStore = aStore; + SetActive(); + iWait.Start(); + User::LeaveIfError( iStatus.Int() ); + iOperation = EOperationNone; + } + +// ----------------------------------------------------------------------------- +// CpCertManUISyncWrapper::SetApplicabilityL +// ----------------------------------------------------------------------------- +// +void CpCertManUISyncWrapper::SetApplicabilityL( CUnifiedCertStore*& aStore, + const CCTCertInfo& aCertInfo, + RArray& aApplications ) + { + + aStore->SetApplicability( aCertInfo, aApplications, iStatus ); + iOperation = EOperationSetApplicability; + iStore = aStore; + SetActive(); + iWait.Start(); + User::LeaveIfError( iStatus.Int() ); + aStore->SetTrust( aCertInfo, ETrue, iStatus ); + iOperation = EOperationSetToTrusted; + SetActive(); + iWait.Start(); + User::LeaveIfError( iStatus.Int() ); + iOperation = EOperationNone; + } + +// ----------------------------------------------------------------------------- +// CpCertManUISyncWrapper::MoveKeyL +// ----------------------------------------------------------------------------- +// +void CpCertManUISyncWrapper::MoveKeyL( + CUnifiedKeyStore*& aStore, + const TCTKeyAttributeFilter& aFilter, + const TUid aSourceTokenId, + const TUid aTargetTokenId ) + { + + TInt sourceIndex(-1); + TInt targetIndex(-1); + + // Find the index of key stores + TInt count = aStore->KeyStoreManagerCount(); + + for (TInt ii = 0; ii < count; ii++) + { + MCTKeyStoreManager& keystoremanager = aStore->KeyStoreManager( ii ); + MCTToken& token = keystoremanager.Token(); + TUid tokenuid = token.Handle().iTokenTypeUid; + + if ( tokenuid == aSourceTokenId ) + { + sourceIndex = ii; + } + + if ( tokenuid == aTargetTokenId ) + { + targetIndex = ii; + } + } + + if (( sourceIndex == -1 ) || ( targetIndex == -1 )) + { + // Key store(s) doesn't exist + User::Leave( KErrNotFound ); + } + + RMPointerArray keyEntries; + + MCTKeyStoreManager& sourcekeystore = + aStore->KeyStoreManager( sourceIndex ); + + MCTKeyStoreManager& targetkeystore = + aStore->KeyStoreManager( targetIndex ); + + + ListL( aStore, &keyEntries, aFilter, aSourceTokenId ); + + // Go through all matching keys and move them to + // target store + for ( TInt ii = 0; ii < keyEntries.Count(); ii++ ) + { + HBufC8* keyData = HBufC8::NewLC( KMaxKeyLength ); + + // Retrieve key from source key store + sourcekeystore.ExportKey( (*keyEntries[ii]).Handle(), keyData, iStatus ); + iOperation = EOperationExportKey; + SetActive(); + iWait.Start(); + User::LeaveIfError( iStatus.Int() ); + + TCTTokenObjectHandle sourceKeyHandle = (*keyEntries[ii]).Handle(); + + // Import key to target key store + + // If key info access type indicates that key is local, then importing is + // not possible. The following is the workarround. Almost identical + // copy of keyinfo is created without CCTKeyInfo::ELocal access type flag. + // UsePolicy is also updated + TInt accessType = (*keyEntries[ii]).AccessType(); + if ( accessType & CCTKeyInfo::ELocal ) + { + // CCTKeyInfo::ELocal is set in key info + HBufC* label = (*keyEntries[ii]).Label().AllocLC(); + + // The following XOR operation will clear local bit if it is on. + accessType ^= CCTKeyInfo::ELocal; + + CCTKeyInfo* keyInfo = CCTKeyInfo::NewL( (*keyEntries[ii]).ID(), + (*keyEntries[ii]).Usage(), + (*keyEntries[ii]).Size(), + NULL, + label, + (*keyEntries[ii]).Token(), + (*keyEntries[ii]).HandleID(), + KKeyStoreUsePolicy, + (*keyEntries[ii]).ManagementPolicy(), + (*keyEntries[ii]).Algorithm(), + accessType, + (*keyEntries[ii]).Native(), + (*keyEntries[ii]).StartDate(), + (*keyEntries[ii]).EndDate() ); + + CleanupStack::Pop(label); + targetkeystore.ImportKey( *keyData, keyInfo, iStatus ); + } + else + { + targetkeystore.ImportKey( *keyData, keyEntries[ii], iStatus ); + } + + iOperation = EOperationImportKey; + SetActive(); + iWait.Start(); + User::LeaveIfError( iStatus.Int() ); + + // Delete key from source key store + sourcekeystore.DeleteKey( sourceKeyHandle, iStatus ); + iOperation = EOperationDeleteKey; + SetActive(); + iWait.Start(); + User::LeaveIfError( iStatus.Int() ); + + CleanupStack::PopAndDestroy(keyData); + } + + } + +// ----------------------------------------------------------------------------- +// CpCertManUISyncWrapper::MoveCertL +// ----------------------------------------------------------------------------- +// +TInt CpCertManUISyncWrapper::MoveCertL( + CUnifiedCertStore*& aStore, + const CCTCertInfo& aCertInfo, + const TUid aSourceTokenId, + const TUid aTargetTokenId ) + { + + TInt sourceIndex(-1); + TInt targetIndex(-1); + TInt certCount (0); + + // Find the index of certificate stores + TInt count = aStore->WritableCertStoreCount(); + for (TInt ii = 0; ii < count; ii++) + { + MCTWritableCertStore& writablestore = aStore->WritableCertStore( ii ); + MCTToken& token = writablestore.Token(); + TUid tokenuid = token.Handle().iTokenTypeUid; + + if ( tokenuid == aSourceTokenId ) + { + sourceIndex = ii; + } + + if ( tokenuid == aTargetTokenId ) + { + targetIndex = ii; + } + } + + if (( sourceIndex == -1 ) || ( targetIndex == -1 )) + { + // Certificate store(s) doesn't exist + User::Leave( KErrNotFound ); + } + + + MCTWritableCertStore& sourcewritablestore = + aStore->WritableCertStore( sourceIndex ); + + // All of the certificates that are associated with same + // private key will be moved to target certificate store. + CCertAttributeFilter* filter = CCertAttributeFilter::NewL(); + filter->SetOwnerType( EUserCertificate ); + filter->SetSubjectKeyId( aCertInfo.SubjectKeyId() ); + RMPointerArray certEntries; + + // List certificates from source certificate store + ListL( aStore, &certEntries, *filter, aSourceTokenId ); + + delete filter; + + for ( TInt ii = 0; ii < certEntries.Count(); ii++ ) + { + // Retrieve certificate from source certificate store + HBufC8* buf = HBufC8::NewLC( KMaxCertificateLength ); + iCertPtr.Set( buf->Des() ); + sourcewritablestore.Retrieve( *certEntries[ii], iCertPtr, iStatus ); + iOperation = EGetCertificate; + SetActive(); + iWait.Start(); + User::LeaveIfError( iStatus.Int() ); + + // Add certificate to target certificate store + MCTWritableCertStore& targetwritablestore = + aStore->WritableCertStore( targetIndex ); + + targetwritablestore.Add( (*certEntries[ii]).Label(), EX509Certificate, + EUserCertificate, &((*certEntries[ii]).SubjectKeyId()), + &((*certEntries[ii]).IssuerKeyId()), *buf, iStatus ); + + iOperation = EAddCertificate; + SetActive(); + iWait.Start(); + User::LeaveIfError( iStatus.Int() ); + + // Delete certificate from source certificate store + sourcewritablestore.Remove( *certEntries[ii], iStatus ); + iOperation = EOperationDelete; + iStore = aStore; + SetActive(); + iWait.Start(); + User::LeaveIfError( iStatus.Int() ); + iOperation = EOperationNone; + certCount++; + CleanupStack::PopAndDestroy(buf); + } + + return certCount; + } + + diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/src/cpcertpluginloader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/src/cpcertpluginloader.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 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"" + * 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: + * + */ + +#include + +#include "cpcertpluginloader.h" +#include "cpsecurityview.h" +#include +#include <../../inc/cpsecplugins.h> + +CpCertPluginLoader::CpCertPluginLoader() + { + RDEBUG("0", 0); + mTranslator = q_check_ptr( new QTranslator()); + QString path = "z:/resource/qt/translations/"; + QString appName = "certificate_manager_"; + QString lang = QLocale::system().name(); + mTranslator->load(path + appName + lang); + qApp->installTranslator(mTranslator); + } + +CpCertPluginLoader::~CpCertPluginLoader() + { + if (mTranslator) + { + if (mTranslator->isEmpty() == false) + qApp->removeTranslator(mTranslator); + delete mTranslator; + } + } + +QList CpCertPluginLoader::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const + { + RDEBUG("0", 0); + return QList() + << new CpSettingFormEntryItemDataImpl(itemDataHelper,tr("Advanced Security"), QString()); + } + +Q_EXPORT_PLUGIN2(cpcertpluginloader, CpCertPluginLoader); diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/src/cpcerttrustview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/src/cpcerttrustview.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,379 @@ +/* +* Copyright (c) 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" +* 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: Implementation of class CCertManUIContainerTrust. +* Maintains correct list of trusted clients depending +* on the certificate that was in focus in Authority +* certificates view when Trust Settings view was entered. +* Shows and changes correct Yes/No text for the Trusted client. +* +*/ + +// INCLUDE FILES +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include <../../inc/cpsecplugins.h> +#include "cpcerttrustview.h" +#include "cpcertdatacontainer.h" +#include "cpcertmanuisyncwrapper.h" +#include "cpuitrustids.h" + +const TInt KMidpCertStoreUid = 0x101F5B71; + +// ============================= LOCAL FUNCTIONS =============================== + +// ================= MEMBER FUNCTIONS ======================= + +CpCertTrustView::CpCertTrustView( TInt certificateIndex, CpCertDataContainer& certDataContainer, QGraphicsItem *parent /*= 0*/) + : CpBaseSettingView(0,parent), mCertDataContainer(certDataContainer), mCertificateIndex(certificateIndex) + { + setTitle(tr("Trust Settings")); + viewTrustSettings(); + } + +// --------------------------------------------------------- +// CpCertTrustView::~CpCertTrustView() +// Destructor +// --------------------------------------------------------- +// +CpCertTrustView::~CpCertTrustView() + { + delete mAppInfoManager; + mClientUids.Close(); + delete mFormModel; + mTrustedClients.erase(mTrustedClients.begin(), mTrustedClients.end()); + mTrustValues.erase(mTrustValues.begin(), mTrustValues.end()); + } + + +void CpCertTrustView::viewTrustSettings() + { + RDEBUG("0", 0); + mTrustedClients << " \tWAP connection\t\t"; + mTrustedClients << " \tMail and Image conn.\t\t"; + mTrustedClients << " \tNative installing\t\t"; + mTrustedClients << " \tJava installing\t\t"; + mTrustedClients << " \tOCSP validation\t\t"; + mTrustedClients << " \tVPN\t\t"; + mTrustedClients << " \tWidget Installation\t\t"; + + mTrustValues << "On"; + mTrustValues << "Off"; + + try + { + QT_TRAP_THROWING( mAppInfoManager = + CCertificateAppInfoManager::NewL( mCertDataContainer.iRfs, EFalse ); + updateListBoxL();) + } + catch(std::exception& exception) + { + QString error(exception.what()); + QT_TRAP_THROWING( mCertDataContainer.ShowErrorNoteL( error.toInt()) ); + throw(exception); + } + } + + +// --------------------------------------------------------------------------- +// CpCertTrustView::UpdateListBoxL() +// Puts correct Trust Settings text to listbox and correct value (yes/no) +// to the setting, asks the value from CheckCertificateClientTrust +// For X509 certificates, only one Application is currently supported +// (Application controller), more applications maybe added later however, +// so one additional application has been left in comments as an example. +// WAP connection and Application installer have their names from resources +// and thus localized, other additional application get their names from +// TCertificateAppInfo's Name() function. +// --------------------------------------------------------------------------- +// + +void CpCertTrustView::updateListBoxL() + { + RDEBUG("0", 0); + mClientUids.Reset(); + + TInt clientCount = 0; + + // Use certificate index from previous view + CCTCertInfo* entry = mCertDataContainer.iCALabelEntries[ mCertificateIndex ]->iCAEntry; + + // Here MCTCertApps should be used to get client options, but it is not properly + // supported in any cert store. It should be possible to get the MCTCertApps + // through token's GetInterface function. + if ( entry->Token().TokenType().Type() == TUid::Uid( KTokenTypeFileCertstore ) ) + { + if ( !mAppInfoManager ) + { + User::Leave( KErrArgument ); + } + RArray apps; + apps = mAppInfoManager->Applications(); + for ( TInt i = 0; i < apps.Count(); i++ ) + { + if ( apps[i].Id() != KCertManUIViewTrustJavaInstallingId && + apps[i].Id() != KCertManUIViewTrustApplicationControllerId ) + { + mClientUids.Append( apps[i].Id() ); + } + } + } + else + { + mCertDataContainer.iWrapper->GetApplicationsL( + mCertDataContainer.CertManager(), *entry, mClientUids ); + } + + // This is needed because MIDPCertStore does not support MCTCertApps + if ( mClientUids.Count() == 0 && + entry->Token().TokenType().Type() == TUid::Uid( KMidpCertStoreUid ) ) + { + mClientUids.Append( KCertManUIViewTrustJavaInstallingId ); + } + + if ( EX509Certificate != entry->CertificateFormat() ) + { + return; + } + TInt resIndex = KErrNotFound; + QList itemArray; + QList trustValue; + clientCount = mClientUids.Count(); + if ( clientCount > 0 ) + { + for ( TInt k = 0; k < clientCount; k++ ) + { + resIndex = trustIdIndex( mClientUids[k] ); + if ( resIndex == KErrNotFound ) + { + continue; + } + + // based on the trust list update the array + TBool trustState = EFalse; + QString item = mTrustedClients[ resIndex ]; + trustState = checkCertificateClientTrustL( mClientUids[k], *entry ); + // insert the index which would be used to retrieve the value from mTrustedClients + itemArray.insert(k,resIndex); + + if ( trustState ) + { + trustValue.insert(k,1); + } + else + { + trustValue.insert(k,0); + } + } + } + // display the list + QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); + setLayout(layout); + std::auto_ptr form(new HbDataForm()); + mFormModel = new HbDataFormModel(); + + HbListWidget* mCertLabelList = new HbListWidget(this); + std::auto_ptr certLabel(q_check_ptr(new HbListWidgetItem())); + const TDesC& label = entry->Label(); + certLabel->setText(QString( (QChar*)label.Ptr(),label.Length() ) ); + mCertLabelList->addItem(certLabel.get()); + certLabel.release(); + + RDEBUG("0", 0); + + int count = itemArray.size(); + for( int index = 0 ;index < count; ++index) + { + std::auto_ptr item (q_check_ptr(new HbDataFormModelItem( + HbDataFormModelItem::ToggleValueItem, + mTrustedClients[itemArray[index]] ) )); + + if( trustValue[index] == 1) + { + item->setContentWidgetData("text",mTrustValues[0]); + item->setContentWidgetData("additionalText",mTrustValues[1]); + } + else + { + item->setContentWidgetData("text",mTrustValues[1]); + item->setContentWidgetData("additionalText",mTrustValues[0]); + } + mFormModel->appendDataFormItem(item.get()); + item.release(); + } + + form->setModel(mFormModel); + layout->addItem(mCertLabelList); + layout->addItem(form.get()); + form.release(); + } + + +void CpCertTrustView::saveTrustSettings() + { + RDEBUG("0", 0); + CCTCertInfo& entry = *( mCertDataContainer.iCALabelEntries[ mCertificateIndex ]->iCAEntry ); + if ( entry.IsDeletable() ) + { + TInt itemCount = mFormModel->rowCount(); + RArray newUids; + QT_TRAP_THROWING + ( + CleanupClosePushL( newUids ); + + for(int index = 0;indexitem(index); + QString trustValue = item->contentWidgetData("text").toString(); + if(trustValue == "On") + { + newUids.Append(trusterId(mTrustedClients[index])); + } + } + if(newUids.Count() > 0 ) + { + mCertDataContainer.iWrapper->SetApplicabilityL( mCertDataContainer.CertManager(), entry, newUids ); + } + CleanupStack::PopAndDestroy(&newUids); + ) + } + } + +TUid CpCertTrustView::trusterId(const QString& clientDescription) const + { + RDEBUG("0", 0); + TUid retValue = TUid::Uid(0); + if( clientDescription == " \tWAP connection\t\t" ) + retValue = KCertManUIViewTrustWapConnectionId; + else if( clientDescription == " \tMail and Image conn.\t\t" ) + retValue = KCertManUIViewTrustMailAndImageConnId; + else if( clientDescription == " \tNative installing\t\t" ) + retValue = KCertManUIViewTrustApplicationControllerId; + else if( clientDescription == " \tJava installing\t\t" ) + retValue = KCertManUIViewTrustJavaInstallingId; + else if( clientDescription == " \tOCSP validation\t\t" ) + retValue = KCertManUIViewOCSPCheckInstallingId; + else if( clientDescription == " \tVPN\t\t" ) + retValue = KCertManUIViewTrustVPNId; + else if( clientDescription == " \tWidget Installation\t\t" ) + retValue = KCertManUIViewTrustWidgetInstallId; + return retValue; + } + +// --------------------------------------------------------------------------- +// CpCertTrustView::trustIdIndex( TUid trustUid ) +// --------------------------------------------------------------------------- +// +TInt CpCertTrustView::trustIdIndex( TUid trustUid ) const + { + RDEBUG("0", 0); + TInt resIndex = KErrNotFound; + + if ( trustUid == KCertManUIViewTrustApplicationControllerId ) + { + resIndex = KTrustSettingsResourceIndexAppCtrl; + } + else if( trustUid == KCertManUIViewTrustWapConnectionId ) + { + resIndex = KTrustSettingsResourceIndexWAP; + } + else if ( trustUid == KCertManUIViewTrustMailAndImageConnId ) + { + resIndex = KTrustSettingsResourceIndexMailAndImageConn; + } + else if ( trustUid == KCertManUIViewTrustJavaInstallingId ) + { + resIndex = KTrustSettingsResourceIndexJavaInstall; + } + else if ( trustUid == KCertManUIViewOCSPCheckInstallingId ) + { + resIndex = KTrustSettingsResourceIndexOCSPCheck; + } + else if ( trustUid == KCertManUIViewTrustVPNId ) + { + resIndex = KTrustSettingsResourceIndexVPN; + } + else if ( trustUid == KCertManUIViewTrustWidgetInstallId ) + { + resIndex = KTrustSettingsResourceIndexWidget; + } + return resIndex; + } + + +// --------------------------------------------------------------------------- +// CpCertTrustView::CheckCertificateClientTrustL(const TUid aClientTUid, +// CCTCertInfo& aEntry) const +// Checks if a certificate trusts a client +// * Certificate format == ECrX509Certificate ECrX968Certificate ECrCertificateURL +// are not supported if certificate location == ECrCertLocationWIMCard +// * Certificate format == ECrX968Certificate ECrCertificateURL are not supported +// if certificate location == ECrCertLocationCertMan +// * Certificate location == ECrCertLocationWIMURL ECrCertLocationPhoneMemory +// ECrCertLocationPhoneMemoryURL are not supported +// --------------------------------------------------------------------------- +// +TBool CpCertTrustView::checkCertificateClientTrustL( + const TUid clientUid, const CCTCertInfo& entry ) const + { + RDEBUG("0", 0); + TBool trustSettingTrusted = EFalse; + TCertificateFormat format = entry.CertificateFormat(); + + if ( format == EX509Certificate ) + { + + RArray trusterUids; + CleanupClosePushL( trusterUids ); + + //Owned by mCertDataContainer. + CUnifiedCertStore*& store = mCertDataContainer.CertManager(); + // Get trusting applications' Uids for the one selected + // certificate entry + mCertDataContainer.iWrapper->GetApplicationsL( store, entry, trusterUids ); + + // get the number of trusting applications for one + // selected certificate entry + TInt trusterCount = trusterUids.Count(); + // in this loop, for every trusting application in one + // selected certificate entry + for ( TInt i = 0; i < trusterCount; ++i ) + { + // put the trusting application's Uid to TUid truster + if ( clientUid == trusterUids[i] ) + { + trustSettingTrusted = ETrue; + break; + } + } + CleanupStack::PopAndDestroy(&trusterUids); + } + + return trustSettingTrusted; + } + +// End of File + diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/src/cpcertview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/src/cpcertview.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,922 @@ +/* +* Copyright (c) 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"" +* 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: +* +*/ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include <../../inc/cpsecplugins.h> +#include "cpcertdetailview.h" +#include "cpcertview.h" +#include "cpcertdatacontainer.h" +#include "cpcerttrustview.h" +#include "cpcertmanuisyncwrapper.h" + + +CpCertView::CpCertView(const QModelIndex& modelIndex, QGraphicsItem *parent /*= 0*/) + : CpBaseSettingView(0,parent), + mPopup(NULL), + mPrevView(NULL), + mCurrentView(NULL), + mRefreshedView(NULL), + mListView(NULL), + mSelectAllView(NULL), + mOriginalView(NULL), + mNote(NULL) + { + RDEBUG("0", 0); + mOriginalView = mainWindow()->currentView(); + + HbMenu* menu = this->menu(); + std::auto_ptr deleteAction(new HbAction(hbTrId("txt_common_menu_delete"))); + connect(deleteAction.get(), SIGNAL(triggered()), this, SLOT(deleteList())); + menu->addAction(deleteAction.get()); + deleteAction.release(); + + std::auto_ptr layout(new QGraphicsLinearLayout(Qt::Vertical)); + + HbDataForm *form = q_check_ptr(new HbDataForm(this)); + std::auto_ptr formModel(q_check_ptr(new HbDataFormModel())); + form->setModel(formModel.get()); + formModel.release(); + + HbListWidget* certificateList = q_check_ptr(new HbListWidget(this)); + + CpCertView::TCertificateViews currentView = (CpCertView::TCertificateViews)modelIndex.row(); + QString title; + if(currentView == EPersonalView) + { + title = "Move to Device"; + } + else if(currentView == EDeviceView) + { + title = "Move to Personal"; + } + RDEBUG("0", 0); + if(currentView == EPersonalView || currentView == EDeviceView) + { + std::auto_ptr moveToDeviceAction(q_check_ptr(new HbAction(title))); + connect(moveToDeviceAction.get(), SIGNAL(triggered()), this, SLOT(moveCert())); + menu->addAction(moveToDeviceAction.get()); + moveToDeviceAction.release(); + } + + setDetails(currentView); + TInt count = 0; + try + { + QT_TRAP_THROWING(mCertDataContainer = CpCertDataContainer::NewL()); + QT_TRAP_THROWING(count = refreshListL()); + } + catch(const std::exception& exception) + { + HbMessageBox::information(exception.what()); + throw(exception); + } + RDEBUG("0", 0); + for(int index = 0; index< count; index++) + { + QString certificateLabel = certLabel(index); + std::auto_ptr singleCert(q_check_ptr(new HbListWidgetItem())); + singleCert->setText(certificateLabel); + certificateList->addItem(singleCert.get()); + singleCert.release(); + } // End of FOR loop + + connect(certificateList, SIGNAL(activated(QModelIndex)), this, SLOT(openCertFromList(QModelIndex))); + connect(certificateList, SIGNAL(longPressed(HbAbstractViewItem*, QPointF )), this, SLOT(indicateLongPress(HbAbstractViewItem*, QPointF))); + + layout->addItem(certificateList); + setLayout(layout.get()); + layout.release(); + + mPopup = q_check_ptr(new HbDialog()); + mContextMenu = q_check_ptr(new HbMenu()); + + RDEBUG("0", 0); + } + +CpCertView::~CpCertView() + { + delete mCertDataContainer; + mCertDataContainer = NULL; + RDEBUG("0", 0); + if(mPrevView) + { + mPrevView->deleteLater(); + mPrevView= NULL; + } + if(mCurrentView) + { + mCurrentView->deleteLater(); + mCurrentView= NULL; + } + if(mRefreshedView) + { + mRefreshedView->deleteLater(); + mRefreshedView= NULL; + } + if(mListView) + { + mListView->deleteLater(); + mListView= NULL; + } + + if(mSelectAllView) + { + mSelectAllView->deleteLater(); + mSelectAllView = NULL; + } + + mSelectionIndex.Close(); + + mIndexList.Close(); + + delete mPopup; + + delete mNote; + mNote = NULL; + + delete mContextMenu; + + } + +void CpCertView::setDetails(CpCertView::TCertificateViews currentView) + { + RDEBUG("0", 0); + switch(currentView) + { + case EAuthorityView: + setTitle(hbTrId("txt_certificate_manager_list_authority_certificate")); + mCertView = EAuthorityView; + break; + + case ETrustedView: + setTitle(hbTrId("txt_certificate_manager_list_trusted_site_certific")); + mCertView = ETrustedView; + break; + + case EPersonalView: + setTitle(hbTrId("txt_certificate_manager_list_personal_certificates")); + mCertView = EPersonalView; + break; + + case EDeviceView: + setTitle(hbTrId("txt_certificate_manager_list_device_certificates")); + mCertView = EDeviceView; + break; + } + } + +void CpCertView::indicateLongPress(HbAbstractViewItem *item,QPointF coords) + { + RDEBUG("0", 0); + mPos = item->modelIndex().row(); // Pos will tell you what is the certificate clicked in particular view. + + mContextMenu->clearActions(); + std::auto_ptr open(q_check_ptr(new HbAction(hbTrId("txt_common_menu_open")))); + connect(open.get(), SIGNAL(triggered()), this, SLOT( openCertificate())); + mContextMenu->addAction(open.get()); + open.release(); + + QString moveTitle; + + if(mCertView == EAuthorityView) + { + std::auto_ptr trustSettings(q_check_ptr(new HbAction(hbTrId("txt_certificate_manager_menu_trust_settings")))); + connect(trustSettings.get(), SIGNAL(triggered()), this, SLOT(showTrustSettings())); + mContextMenu->addAction(trustSettings.get()); + trustSettings.release(); + } + else if(mCertView == EPersonalView) + { + moveTitle = hbTrId("txt_certificate_manager_menu_move_to_device_certif"); + } + else if(mCertView == EDeviceView) + { + moveTitle = hbTrId("txt_certificate_manager_menu_move_to_personal_cert"); + } + + if(mCertView == EPersonalView || mCertView == EDeviceView ) + { + std::auto_ptr moveCert(q_check_ptr(new HbAction(moveTitle))); + connect(moveCert.get(), SIGNAL(triggered()), this, SLOT(moveSelectedCert())); + mContextMenu->addAction(moveCert.get()); + moveCert.release(); + } + + RDEBUG("0", 0); + if( certAt(mPos)->IsDeletable() ) + { + std::auto_ptr menuDelete(q_check_ptr(new HbAction(hbTrId("txt_common_menu_delete")))); + connect(menuDelete.get(), SIGNAL(triggered()), this, SLOT(deleteCertificate())); + mContextMenu->addAction(menuDelete.get()); + menuDelete.release(); + } + mContextMenu->setPreferredPos(coords); + mContextMenu->open(); + } + +void CpCertView::openCertFromList(const QModelIndex& modelIndex) + { + RDEBUG("0", 0); + // Pos will tell you what is the certificate clicked in particular view. + mPos = modelIndex.row(); + openCertificate(); + } + +void CpCertView::openCertificate() + { + RDEBUG("0", 0); + mCurrentView = q_check_ptr(new CpCertDetailView(mCertView,mPos,*mCertDataContainer)); + connect(mCurrentView, SIGNAL(aboutToClose()), this, SLOT(displayPreviousView())); + mPrevView = mainWindow()->currentView(); + mainWindow()->addView(mCurrentView); + mainWindow()->setCurrentView(mCurrentView); + } + +void CpCertView::displayPreviousView() + { + RDEBUG("0", 0); + mainWindow()->removeView(mCurrentView); + mCurrentView->deleteLater(); + mCurrentView= NULL; + mainWindow()->setCurrentView(mPrevView); + } + +void CpCertView::deleteCertificate() + { + RDEBUG("0", 0); + RArray pos; + pos.Append(mPos); + QT_TRAP_THROWING(deleteCertsL(pos)); + } + +void CpCertView::deleteList() + { + RDEBUG("0", 0); + mSelectAll = EFalse; + mPopup->setDismissPolicy(HbDialog::NoDismiss); + // Set the label as heading widget + mPopup->setHeadingWidget(q_check_ptr(new HbLabel(hbTrId("txt_certificate_manager_setlabel_certificates")))); + + std::auto_ptr layout(q_check_ptr(new QGraphicsLinearLayout(Qt::Vertical))); + + mSelectAllView = q_check_ptr(new HbListView(this)); + QStandardItemModel* selectAllModel = q_check_ptr(new QStandardItemModel(this)); + // Populate the model with content + std::auto_ptr selectAllItem(q_check_ptr(new QStandardItem())); + selectAllItem->setData(QString("Select All"),Qt::DisplayRole); + selectAllModel->appendRow(selectAllItem.get()); + selectAllItem.release(); + + connect(mSelectAllView, SIGNAL(activated(QModelIndex)), this, SLOT(selectAll())); + mSelectAllView->setModel(selectAllModel); + mSelectAllView->setSelectionMode(HbListView::MultiSelection); + layout->addItem(mSelectAllView); + + mListView = q_check_ptr(new HbListView(this)); + // Connect to "activated" signal + connect(mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemActivated(QModelIndex))); + + // Create a model + QStandardItemModel* model = q_check_ptr(new QStandardItemModel(this)); + TInt count=0; + QT_TRAP_THROWING( count = refreshListL()); + RDEBUG("0", 0); + for(TInt index = 0; index < count ; ++index) + { + const CCTCertInfo* cert = certAt(index); + if( cert->IsDeletable() ) + { + // Populate the model with content + std::auto_ptr certItem(q_check_ptr(new QStandardItem())); + QString certificateLabel = certLabel(index); + certItem->setData( certificateLabel, Qt::DisplayRole); + model->appendRow(certItem.get()); + mSelectionIndex.Append(index); + certItem.release(); + } + } + // Set the model to the list view + mListView->setModel(model); + mListView->setSelectionMode(HbListView::MultiSelection); + layout->addItem(mListView); + + std::auto_ptr widget( q_check_ptr(new HbWidget())); + widget->setLayout(layout.get()); + layout.release(); + mPopup->setContentWidget(widget.get()); + widget.release(); + + mPopup->setPrimaryAction(q_check_ptr(new HbAction(hbTrId("txt_common_opt_delete")))); + mPopup->setSecondaryAction(q_check_ptr(new HbAction(hbTrId("txt_common_button_cancel")))); + mPopup->setTimeout(HbPopup::NoTimeout); + RDEBUG("0", 0); + // Launch popup syncronously + mPopup->open(this, SLOT(handleMultipleDelete(HbAction*))); + +} + +void CpCertView::handleMultipleDelete(HbAction* action) +{ + RDEBUG("0", 0); + if(action == mPopup->primaryAction()) + { + QItemSelectionModel *selectionModel = mListView->selectionModel(); + QModelIndexList mWidgetItemsToRemove = selectionModel->selectedIndexes(); + TInt deleteCount = mWidgetItemsToRemove.count(); + // start deleting from end of array so that the indexes do not changes of the ones + // at the front. + RArray actualIndex; + QT_TRAP_THROWING + ( + CleanupClosePushL(actualIndex); + for (TInt index = deleteCount-1; index>= 0 ; --index) + { + TInt selectedItemIndex = mWidgetItemsToRemove[index].row(); + actualIndex.Append( mSelectionIndex[selectedItemIndex] ); + } + deleteCertsL(actualIndex); + CleanupStack::PopAndDestroy(&actualIndex); + ) // QT_TRAP_THROWING + } + RDEBUG("0", 0); + mListView->deleteLater(); + mListView = NULL; + mSelectAllView->deleteLater(); + mSelectAllView = NULL; + } + +void CpCertView::moveCert() + { + RDEBUG("0", 0); + mSelectAll = EFalse; + mPopup->setDismissPolicy(HbDialog::NoDismiss); + // Set the label as heading widget + if(mCertView == EPersonalView) + { + mPopup->setHeadingWidget(q_check_ptr(new HbLabel(tr("Move To Device")))); + } + else if(mCertView == EDeviceView) + { + mPopup->setHeadingWidget(q_check_ptr(new HbLabel(tr("Move To Personal")))); + } + + std::auto_ptr layout(q_check_ptr(new QGraphicsLinearLayout(Qt::Vertical))); + + mSelectAllView = q_check_ptr(new HbListView(this)); + QStandardItemModel* selectAllModel = q_check_ptr(new QStandardItemModel(this)); + // Populate the model with content + std::auto_ptr selectAllItem(q_check_ptr(new QStandardItem())); + selectAllItem->setData(QString("Select All"),Qt::DisplayRole); + selectAllModel->appendRow(selectAllItem.get()); + selectAllItem.release(); + connect(mSelectAllView, SIGNAL(activated(QModelIndex)), this, SLOT(selectAll())); + mSelectAllView->setModel(selectAllModel); + mSelectAllView->setSelectionMode(HbListView::MultiSelection); + layout->addItem(mSelectAllView); + + mListView = q_check_ptr(new HbListView(this)); + // Connect to "activated" signal + connect(mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemActivated(QModelIndex))); + + // Create a model + QStandardItemModel* model = q_check_ptr(new QStandardItemModel(this)); + TInt count =0; + RDEBUG("0", 0); + QT_TRAP_THROWING(count = refreshListL()); + for(TInt index = 0; index < count ; ++index) + { + // Populate the model with content + std::auto_ptr certItem(q_check_ptr(new QStandardItem())); + QString certificateLabel = certLabel(index); + certItem->setData( certificateLabel, Qt::DisplayRole); + model->appendRow(certItem.get()); + mSelectionIndex.Append(index); + certItem.release(); + } + + // Set the model to the list view + mListView->setModel(model); + mListView->setSelectionMode(HbListView::MultiSelection); + layout->addItem(mListView); + + std::auto_ptr widget(q_check_ptr(new HbWidget())); + widget->setLayout(layout.get()); + layout.release(); + mPopup->setContentWidget(widget.get()); + widget.release(); + RDEBUG("0", 0); + mPopup->setPrimaryAction(q_check_ptr(new HbAction(tr("Yes")))); + mPopup->setSecondaryAction(q_check_ptr(new HbAction(tr("No")))); + mPopup->setTimeout(HbPopup::NoTimeout); + + // Launch popup syncronously + mPopup->open(this, SLOT(handleMoveCertDialog(HbAction*))); + RDEBUG("0", 0); +} + +void CpCertView::handleMoveCertDialog(HbAction* action) +{ + RDEBUG("0", 0); + if(action == mPopup->primaryAction()) + { + QItemSelectionModel *selectionModel = mListView->selectionModel(); + QModelIndexList mWidgetItemsToRemove = selectionModel->selectedIndexes(); + TInt deleteCount = mWidgetItemsToRemove.count(); + // start deleting from end of array so that the indexes do not changes of the ones + // at the front. + RArray actualIndex; + RDEBUG("0", 0); + QT_TRAP_THROWING + ( + CleanupClosePushL(actualIndex); + for (TInt index = deleteCount-1; index>= 0 ; --index) + { + TInt selectedItemIndex = mWidgetItemsToRemove[index].row(); + actualIndex.Append(mSelectionIndex[selectedItemIndex]); + } + moveCertList(actualIndex); + CleanupStack::PopAndDestroy(&actualIndex); + ) + } + mListView->deleteLater(); + mListView = NULL; + mSelectAllView->deleteLater(); + mSelectAllView = NULL; + RDEBUG("0", 0); + } + +void CpCertView::selectAll() + { + RDEBUG("0", 0); + if(mSelectAll == EFalse) + { + mListView->selectAll(); + mSelectAll= ETrue; + } + else + { + mListView->clearSelection(); + mSelectAll= EFalse; + } + } + +void CpCertView::deleteCertsL( RArray& indexList ) + { + RDEBUG("0", 0); + TInt count = indexList.Count(); + for(int index = 0;index Label().Ptr(),entry->Label().Length()); + } + else + { + deleteMsg = "Delete %1 items?"; + sCount.setNum(count); + } + RDEBUG("0", 0); + deleteMsg = deleteMsg.arg(sCount); + mNote->setText(deleteMsg); + mNote->setTimeout(HbPopup::NoTimeout); + mNote->open(this,SLOT(handleDeleteDialog(HbAction*))); + +} + +void CpCertView::handleDeleteDialog(HbAction* action) +{ + RDEBUG("0", 0); + TInt count = mIndexList.Count(); + + if (action != mNote->primaryAction() || count == 0 ) + { + return; + } + + RPointerArray errCerts; + QT_TRAP_THROWING( + CleanupClosePushL(errCerts); + + for(TInt index = 0; index < count; ++index) + { + const CCTCertInfo* entry = certAt(mIndexList[index]); + + if( mCertView == EPersonalView || mCertView == EAuthorityView ) + { + mCertDataContainer->iWrapper->DeleteCertL( + mCertDataContainer->CertManager(), *entry ); + } + else if( mCertView == ETrustedView ) + { + mCertDataContainer->iWrapper->DeleteCertL( + mCertDataContainer->CertManager(),*entry, KCMTrustedServerTokenUid ); + } + else if( mCertView == EDeviceView ) + { + mCertDataContainer->iWrapper->DeleteCertL( + mCertDataContainer->CertManager(), *entry, KCMDeviceCertStoreTokenUid ); + } + errCerts.AppendL(entry); + } + RDEBUG("0", 0); + if(errCerts.Count() > 0) + { + QString message("Unable to delete the following certificate: \n"); + TInt count = errCerts.Count(); + for(TInt index=0;indexLabel(); + QString certName = QString((QChar*)certLabel.Ptr(),certLabel.Length()); + message.append(certName).append("\n"); + } + HbMessageBox::warning(message); + } + count = refreshListL(); + refreshView(count); + + CleanupStack::PopAndDestroy(&errCerts); + ) // QT_TRAP_THROWING + + delete mNote; + mNote = NULL; + RDEBUG("0", 0); + } + +const CCTCertInfo* CpCertView::certAt(TInt index) const + { + RDEBUG("0", 0); + CCTCertInfo* currentCert = NULL; + switch(mCertView) + { + case EAuthorityView: + { + currentCert = mCertDataContainer->iCALabelEntries[ index ]->iCAEntry; + break; + } + case ETrustedView: + { + currentCert = mCertDataContainer->iPeerLabelEntries[ index ]->iPeerEntry; + break; + } + case EDeviceView: + { + currentCert = mCertDataContainer->iDeviceLabelEntries[ index ]->iDeviceEntry; + break; + } + case EPersonalView: + { + currentCert = mCertDataContainer->iUserLabelEntries[ index ]->iUserEntry; + break; + } + }; + return currentCert; + } + +QString CpCertView::certLabel(TInt index) const + { + RDEBUG("0", 0); + CpCertManUICertData* certData = NULL; + HBufC* label = NULL; + TInt length = 0; + switch(mCertView) + { + case EAuthorityView: + { + certData = mCertDataContainer->iCALabelEntries[index]; + label = certData->iCAEntryLabel; + length = certData->iCAEntryLabel->Length(); + break; + } + case ETrustedView: + { + certData = mCertDataContainer->iPeerLabelEntries[index]; + label = certData->iPeerEntryLabel; + length = certData->iPeerEntryLabel->Length(); + break; + } + case EPersonalView: + { + certData = mCertDataContainer->iUserLabelEntries[index]; + label = certData->iUserEntryLabel; + length = certData->iUserEntryLabel->Length(); + break; + } + case EDeviceView: + { + certData = mCertDataContainer->iDeviceLabelEntries[index]; + label = certData->iDeviceEntryLabel; + length = certData->iDeviceEntryLabel->Length(); + break; + } + } + return QString((QChar*)label->Des().Ptr(), length); + } + +TInt CpCertView::refreshListL() + { + RDEBUG("0", 0); + TInt count = 0; + switch(mCertView) + { + case EAuthorityView: + mCertDataContainer->RefreshCAEntriesL(); + count = mCertDataContainer->iCALabelEntries.Count(); + break; + case ETrustedView: + mCertDataContainer->RefreshPeerCertEntriesL(); + count = mCertDataContainer->iPeerLabelEntries.Count(); + break; + case EPersonalView: + mCertDataContainer->RefreshUserCertEntriesL(); + count = mCertDataContainer->iUserLabelEntries.Count(); + break; + case EDeviceView: + mCertDataContainer->RefreshDeviceCertEntriesL(); + count = mCertDataContainer->iDeviceLabelEntries.Count(); + break; + }; + return count; + } + + +void CpCertView::refreshView( TInt count ) + { + RDEBUG("0", 0); + if(mRefreshedView) + { + mRefreshedView->deleteLater(); + mRefreshedView = NULL; + } + + mRefreshedView = q_check_ptr(new CpBaseSettingView()); + switch(mCertView) + { + case EAuthorityView: + { + mRefreshedView->setTitle(hbTrId("txt_certificate_manager_list_authority_certificate")); + break; + } + case ETrustedView: + { + mRefreshedView->setTitle(hbTrId("txt_certificate_manager_list_trusted_site_certific")); + break; + } + case EPersonalView: + { + mRefreshedView->setTitle(hbTrId("txt_certificate_manager_list_personal_certificates")); + break; + } + case EDeviceView: + { + mRefreshedView->setTitle(hbTrId("txt_certificate_manager_list_device_certificates")); + break; + } + } + + HbMenu* menu = mRefreshedView->menu(); + RDEBUG("0", 0); + std::auto_ptr endAction( q_check_ptr(new HbAction(hbTrId("txt_common_opt_delete"))) ); + connect(endAction.get(), SIGNAL(triggered()), this, SLOT(deleteList())); + menu->addAction(endAction.get()); + endAction.release(); + + QString title; + if(mCertView == EPersonalView) + { + title = "Move to Device"; + } + else if(mCertView == EDeviceView) + { + title = "Move to Personal"; + } + std::auto_ptr moveAction(q_check_ptr(new HbAction(title))); + connect(moveAction.get(), SIGNAL(triggered()), this, SLOT(moveCert())); + menu->addAction(moveAction.get()); + moveAction.release(); + RDEBUG("0", 0); + std::auto_ptr layout(q_check_ptr(new QGraphicsLinearLayout(Qt::Vertical))); + + HbListWidget* mCertificateList = q_check_ptr(new HbListWidget(this)); + + for(int index = 0; index< count; index++) + { + QString certificateLabel = certLabel(index); + std::auto_ptr singleCert(q_check_ptr(new HbListWidgetItem())); + singleCert->setText(certificateLabel); + mCertificateList->addItem(singleCert.get()); + singleCert.release(); + } // end of for loop + + connect(mCertificateList, SIGNAL(activated(QModelIndex)), this, SLOT(openCertFromList(QModelIndex))); + connect(mCertificateList, SIGNAL(longPressed(HbAbstractViewItem*, QPointF )), this, SLOT(indicateLongPress(HbAbstractViewItem*, QPointF))); + + layout->addItem(mCertificateList); + RDEBUG("0", 0); + // Refresh current view + QObject::connect(mRefreshedView , SIGNAL(aboutToClose()), this, SLOT(viewDone())); + mPrevView = mainWindow()->currentView(); + mainWindow()->addView(mRefreshedView); + mainWindow()->setCurrentView(mRefreshedView); + mRefreshedView->setLayout(layout.get()); + layout.release(); + RDEBUG("0", 0); + } + + +void CpCertView::viewDone() + { + RDEBUG("0", 0); + mCurrentView = mainWindow()->currentView(); + mCurrentView->deleteLater(); + mCurrentView= NULL; + mainWindow()->setCurrentView(mOriginalView); + } +void CpCertView::showTrustSettings() + { + RDEBUG("0", 0); + mCurrentView = q_check_ptr(new CpCertTrustView(mPos, *mCertDataContainer)); + connect(mCurrentView , SIGNAL(aboutToClose()), this, SLOT(saveTrustSettings())); + mPrevView = mainWindow()->currentView(); + mainWindow()->addView(mCurrentView); + mainWindow()->setCurrentView(mCurrentView); + } + +void CpCertView::saveTrustSettings() + { + ((CpCertTrustView*)mCurrentView)->saveTrustSettings(); + displayPreviousView(); + } + +void CpCertView::moveSelectedCert() + { + RDEBUG("0", 0); + RArray pos; + pos.Append(mPos); + moveCertList(pos); + } + +void CpCertView::moveCertList(RArray& indexList) + { + RDEBUG("0", 0); + mIndexList = indexList; + mNote = new HbMessageBox(HbMessageBox::MessageTypeQuestion); + mNote->setHeadingWidget(q_check_ptr(new HbLabel(hbTrId("txt_certificate_manager_info_move")))); + if( mCertView == EPersonalView ) + { + mNote->setText(hbTrId("txt_certificate_manager_info_device_certificates_c")); + } + else if( mCertView == EDeviceView ) + { + mNote->setText("Use of Personal certificates may require user confirmation. Proceed?"); + } + + mNote->setTimeout(HbPopup::NoTimeout); + mNote->setIconVisible (EFalse); + mNote->open(this,SLOT(handleMoveDialog(HbAction*))); + RDEBUG("0", 0); +} + +void CpCertView::handleMoveDialog(HbAction* action) +{ + RDEBUG("0", 0); + if (action != mNote->primaryAction()) + { + return; + } + + TInt count = mIndexList.Count(); + + for(TInt index = 0 ; index < count; ++index) + { + CCTCertInfo* entry = NULL; + if(mCertView == EPersonalView) + { + entry = mCertDataContainer->iUserLabelEntries[ mIndexList[index] ]->iUserEntry; + } + else if(mCertView == EDeviceView) + { + entry = mCertDataContainer->iDeviceLabelEntries[ mIndexList[index] ]->iDeviceEntry; + } + + // Move key first + TCTKeyAttributeFilter keyFilter; + keyFilter.iKeyId = entry->SubjectKeyId(); + keyFilter.iPolicyFilter = TCTKeyAttributeFilter::EAllKeys; + RDEBUG("0", 0); + TUid sourceCertStoreUid = TUid::Uid(0); + TUid targetCertStoreUid = TUid::Uid(0); + TUid sourceKeyStoreUid = TUid::Uid(0); + TUid targetKeyStoreUid = TUid::Uid(0); + + if(mCertView == EPersonalView) + { + sourceKeyStoreUid = KCMFileKeyStoreTokenUid; + targetKeyStoreUid = KCMDeviceKeyStoreTokenUid; + sourceCertStoreUid = KCMFileCertStoreTokenUid; + targetCertStoreUid = KCMDeviceCertStoreTokenUid; + } + else if(mCertView == EDeviceView) + { + sourceKeyStoreUid = KCMDeviceKeyStoreTokenUid; + targetKeyStoreUid = KCMFileKeyStoreTokenUid; + sourceCertStoreUid = KCMDeviceCertStoreTokenUid; + targetCertStoreUid = KCMFileCertStoreTokenUid; + } + RDEBUG("0", 0); + try + { + + QT_TRAP_THROWING( mCertDataContainer->iWrapper->MoveKeyL( + mCertDataContainer->KeyManager(), keyFilter, sourceKeyStoreUid, targetKeyStoreUid )); + + // Move certificate + QT_TRAP_THROWING( mCertDataContainer->iWrapper->MoveCertL( + mCertDataContainer->CertManager(), *entry, sourceCertStoreUid, targetCertStoreUid ) ); + + } + catch(const std::exception& exception) + { + QString error(exception.what()); + QT_TRAP_THROWING(mCertDataContainer->ShowErrorNoteL( error.toInt() )); + User::Exit( KErrNone ); + } + RDEBUG("0", 0); + try + { + if(mCertView == EPersonalView) + { + QT_TRAP_THROWING( mCertDataContainer->RefreshUserCertEntriesL() ); + } + else if(mCertView == EDeviceView) + { + QT_TRAP_THROWING( mCertDataContainer->RefreshDeviceCertEntriesL() ); + } + } + catch(const std::exception& exception) + { + QString error(exception.what()); + if ( error.toInt() == KErrCorrupt ) + { + QT_TRAP_THROWING(mCertDataContainer->ShowErrorNoteL( error.toInt()) ); + User::Exit( KErrNone ); + } + // have to call straight away the Exit + // showing any error notes would corrupt the display + User::Exit( error.toInt() ); + } + } // for + // Refresh current view + QT_TRAP_THROWING(refreshView(refreshListL())); + delete mNote; + mNote = NULL; + RDEBUG("0", 0); + } + diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/src/cpmoduleview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/src/cpmoduleview.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,364 @@ +/* +* Copyright (c) 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"" +* 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: +* +*/ + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include <../../inc/cpsecplugins.h> +#include "cpmoduleview.h" +#include "cpsecmodmodel.h" +#include "cpsecmodview.h" + +CpModuleView::CpModuleView( CpSecModView::TSecModViews currentView, + CSecModUIModel& secModUIModel, + QGraphicsItem *parent /*= 0*/ ) +: CpBaseSettingView(0,parent), + mCurrentView(currentView), + mSecModUIModel(secModUIModel) + { + RDEBUG("0", 0); + QString title = mSecModUIModel.TokenLabelForTitle(); + setTitle(title); + + mContextMenu = (q_check_ptr(new HbMenu())); + + if(currentView == CpSecModView::EAccessView) + { + showAccessView(); + } + else if(currentView == CpSecModView::ESignatureView) + { + showSignatureView(ETrue); + } + } + +CpModuleView::~CpModuleView() + {} + +void CpModuleView::showAccessView() + { + RDEBUG("0", 0); + HbMenu* menu = this->menu(); + std::auto_ptr endAction(q_check_ptr(new HbAction("Module Info"))); + connect(endAction.get(), SIGNAL(triggered()), this, SLOT(saveProv())); + + menu->addAction(endAction.get()); + endAction.release(); + + std::auto_ptr layout(q_check_ptr(new QGraphicsLinearLayout(Qt::Vertical))); + + std::auto_ptr form(q_check_ptr(new HbDataForm())); + std::auto_ptr formModel(q_check_ptr(new HbDataFormModel())); + form->setModel(formModel.get()); + formModel.release(); + + QString titleName; + if (mSecModUIModel.KeyStoreUID() == KTokenTypeFileKeystore) + { + titleName = "Phone key store code"; + } + else + { + const TDesC& label = mSecModUIModel.AuthObj(KPinGSettIndex).Label(); + titleName = QString((QChar*)label.Ptr(), label.Length()); + } + RDEBUG("0", 0); + HbListWidget* accessDetails = q_check_ptr(new HbListWidget(this)); + + std::auto_ptr codeLabel(q_check_ptr(new HbListWidgetItem())); + codeLabel->setText(titleName); + accessDetails->addItem(codeLabel.get()); + codeLabel.release(); + + std::auto_ptr codeText(q_check_ptr(new HbListWidgetItem())); + codeText->setText("****"); + accessDetails->addItem(codeText.get()); + codeText.release(); + + std::auto_ptr requestLabel(q_check_ptr(new HbListWidgetItem())); + requestLabel->setText("Access Code Request"); + accessDetails->addItem(requestLabel.get()); + requestLabel.release(); + + TUint32 status = mSecModUIModel.AuthStatus(KPinGSettIndex); + std::auto_ptr requestText(q_check_ptr(new HbListWidgetItem())); + requestText->setText("Off"); + if (status & EEnabled) + { + requestText->setText("On"); + } + accessDetails->addItem(requestText.get()); + requestText.release(); + RDEBUG("0", 0); + std::auto_ptr statusLabel(q_check_ptr(new HbListWidgetItem())); + statusLabel->setText("Status"); + accessDetails->addItem(statusLabel.get()); + statusLabel.release(); + + std::auto_ptr statusText(q_check_ptr(new HbListWidgetItem())); + QString pinStatus = mSecModUIModel.PINStatus(KPinGSettIndex, ETrue); + statusText->setText(pinStatus); + accessDetails->addItem(statusText.get()); + statusText.release(); + + connect(accessDetails, SIGNAL(longPressed(HbAbstractViewItem*, QPointF )), this, SLOT(indicateLongPress(HbAbstractViewItem*, QPointF))); + connect(formModel.get(), SIGNAL(activated(QModelIndex)), this, SLOT(handleAccessView(QModelIndex))); + + layout->addItem(accessDetails); + layout->addItem(form.get()); + form.release(); + setLayout(layout.get()); + layout.release(); + RDEBUG("0", 0); + } + +void CpModuleView::showSignatureView(TBool showBlockedNote) + { + RDEBUG("0", 0); + mCurrentView = CpSecModView::ESignatureView; + std::auto_ptr layout(q_check_ptr(new QGraphicsLinearLayout(Qt::Vertical))); + std::auto_ptr form(q_check_ptr(new HbDataForm())); + std::auto_ptr formModel(q_check_ptr(new HbDataFormModel())); + + QVector< QPair > authDetails = mSecModUIModel.AuthDetails(); + QVectorIterator< QPair > authDetailsIter(authDetails); + + HbListWidget* accessDetails = q_check_ptr(new HbListWidget(this)); + + while(authDetailsIter.hasNext()) + { + QPair pair = authDetailsIter.next(); + QString label = pair.first; + TUint32 status = pair.second; + QString blockedDetails = NULL; + if ( status & EAuthObjectBlocked) + { + if (showBlockedNote) + { + QString totalBlocked(" is blocked. PUK code is needed to unblock the code"); + if (status & EUnblockDisabled) + { + totalBlocked = " totalblocked, contact your module vendor."; + } + totalBlocked.prepend(label); + HbMessageBox::information(totalBlocked); + } + blockedDetails = label.append(" Blocked"); + RDEBUG("0", 0); + std::auto_ptr statusLabel(q_check_ptr(new HbListWidgetItem())); + statusLabel->setText(tr("Status")); + accessDetails->addItem(statusLabel.get()); + statusLabel.release(); + + std::auto_ptr statusText(q_check_ptr(new HbListWidgetItem())); + QString pinStatus = mSecModUIModel.PINStatus(KPinNrSettIndex, ETrue); + statusText->setText(pinStatus); + accessDetails->addItem(statusText.get()); + statusText.release(); + } + else + { + std::auto_ptr unblockedLabel(q_check_ptr(new HbListWidgetItem())); + unblockedLabel->setText(label); + accessDetails->addItem(unblockedLabel.get()); + unblockedLabel.release(); + + std::auto_ptr unblockedText(q_check_ptr(new HbListWidgetItem())); + unblockedText->setText("****"); + accessDetails->addItem(unblockedText.get()); + unblockedText.release(); + } + } + form->setModel(formModel.get()); + formModel.release(); + layout->addItem(accessDetails); + + connect(accessDetails, SIGNAL(longPressed(HbAbstractViewItem*, QPointF )), this, SLOT(indicateLongPress(HbAbstractViewItem*, QPointF))); + connect(formModel.get(), SIGNAL(activated(QModelIndex)), this, SLOT(handleSigView())); + + layout->addItem(form.get()); + form.release(); + setLayout(layout.get()); + layout.release(); + RDEBUG("0", 0); + } + +void CpModuleView::indicateLongPress(HbAbstractViewItem *item,QPointF coords) + { + RDEBUG("0", 0); + try + { + mContextMenu->clearActions(); + mPos = item->modelIndex().row(); + + if(mCurrentView == CpSecModView::EAccessView) + { + if( mPos == EIndexCodeLabel && mSecModUIModel.PinChangeable(KPinGSettIndex) + || mPos == EIndexCodeRequest && mSecModUIModel.PinRequestChangeable(KPinGSettIndex) + || mPos == EIndexCodeStatus ) + { + std::auto_ptr changePIN(q_check_ptr(new HbAction("Change"))); + connect(changePIN.get(), SIGNAL(triggered()), this, SLOT( handleAccessView())); + mContextMenu->addAction(changePIN.get()); + changePIN.release(); + } + if( mSecModUIModel.PinUnblockable(KPinGSettIndex) ) + { + std::auto_ptr unblockPIN(q_check_ptr(new HbAction("Unblock"))); + connect(unblockPIN.get(), SIGNAL(triggered()), this, SLOT( handleAccessView())); + mContextMenu->addAction(unblockPIN.get()); + unblockPIN.release(); + } + if( mSecModUIModel.PinOpen(KPinGSettIndex) ) + { + std::auto_ptr closePIN(q_check_ptr(new HbAction("Close"))); + connect(closePIN.get(), SIGNAL(triggered()), this, SLOT( handleAccessView())); + mContextMenu->addAction(closePIN.get()); + closePIN.release(); + } + } + else if(mCurrentView == CpSecModView::ESignatureView) + { + if (mSecModUIModel.PinChangeable(KPinNrSettIndex)) + { + std::auto_ptr changePIN(q_check_ptr(new HbAction("Change"))); + connect(changePIN.get(), SIGNAL(triggered()), this, SLOT( handleSigViewCommand())); + mContextMenu->addAction(changePIN.get()); + changePIN.release(); + } + if (mSecModUIModel.PinUnblockable(KPinNrSettIndex)) + { + std::auto_ptr unblockPIN(q_check_ptr(new HbAction("Unblock"))); + connect(unblockPIN.get(), SIGNAL(triggered()), this, SLOT( handleSigViewCommand())); + mContextMenu->addAction(unblockPIN.get()); + unblockPIN.release(); + } + } + + mContextMenu->setPreferredPos(coords); + mContextMenu->open(); + } + catch(const std::exception& exception) + { + HbMessageBox::information(exception.what()); + } + RDEBUG("0", 0); + } + +void CpModuleView::handleAccessView( const QModelIndex& modelIndex ) + { + RDEBUG("0", 0); + try + { + mPos = modelIndex.row(); + handleAccessView(); + } + catch(const std::exception& exception) + { + HbMessageBox::information(exception.what()); + } + } + +void CpModuleView::handleAccessView() + { + RDEBUG("0", 0); + try + { + if(mPos == EIndexCodeLabel) + { + QT_TRAP_THROWING(mSecModUIModel.ChangeOrUnblockPinL(KPinGSettIndex)); + } + else if(mPos == EIndexCodeRequest) + { + if (KErrCancel == mSecModUIModel.ChangeCodeRequest(KPinGSettIndex)) + { + return; + } + } + else if ( mPos == EIndexCodeStatus) + { + QT_TRAP_THROWING(mSecModUIModel.CloseAuthObjL(KPinGSettIndex)); + } + showAccessView(); + } + catch(const std::exception& exception) + { + HbMessageBox::information(exception.what()); + } + } + +void CpModuleView::handleSigView() + { + RDEBUG("0", 0); + try + { + QT_TRAP_THROWING(mSecModUIModel.ChangeOrUnblockPinL(KPinNrSettIndex)); + showSignatureView(EFalse); + } + catch(const std::exception& exception) + { + HbMessageBox::information(exception.what()); + } + } + +void CpModuleView::handleSigViewCommand() + { + RDEBUG("0", 0); + try + { + switch(mPos) + { + case ESecModUICmdChange: + QT_TRAP_THROWING(mSecModUIModel.ChangePinNrL(mPos)); + showSignatureView(EFalse); + break; + case ESecModUICmdUnblock: + QT_TRAP_THROWING(mSecModUIModel.UnblockPinNrL(mPos)); + showSignatureView(EFalse); + break; + }; + } + catch(const std::exception& exception) + { + HbMessageBox::information(exception.what()); + } + } + + diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/src/cpsecmodmodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/src/cpsecmodmodel.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,935 @@ +/* +* Copyright (c) 2005-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: Implementation of the CSecModUIModel class +* +*/ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include <../../inc/cpsecplugins.h> +#include "cpsecmodmodel.h" +#include "cpsecmodsyncwrapper.h" + +const TInt KWIMStoreUid ( 0x101F79D9 ); +_LIT(KSecModUIPanic, "Security Module UI panic"); + +// ============================= LOCAL FUNCTIONS =============================== +GLDEF_C void Panic(TInt aPanic) + { + User::Panic(KSecModUIPanic, aPanic); + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::NewL() +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CSecModUIModel* CSecModUIModel::NewL() + { + RDEBUG("0", 0); + CSecModUIModel* self = new( ELeave ) CSecModUIModel(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::CSecModUIModel +// C++ default constructor can NOT contain any code, that might leave. +// ----------------------------------------------------------------------------- +// +CSecModUIModel::CSecModUIModel() + {} + +// ----------------------------------------------------------------------------- +// CSecModUIModel::~CSecModUIModel +// C++ destructor +// ----------------------------------------------------------------------------- +// + +CSecModUIModel::~CSecModUIModel() + { + delete iWrapper; + ResetAndDestroyCTObjects(); + } +// ----------------------------------------------------------------------------- +// CSecModUIModel::ResetAndDestroyCTObjects(): Cleans up all objects referenced +// through the crypto token framework. +// ----------------------------------------------------------------------------- +// +void CSecModUIModel::ResetAndDestroyCTObjects() + { + ResetAndDestroyAOs(); + iAOKeyStores.Reset(); + delete iUnifiedKeyStore; + iUnifiedKeyStore = NULL; + iKeyStore = NULL; + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::ResetAndDestroyAOs(): Cleans up the list of auth objects. +// ----------------------------------------------------------------------------- +// +void CSecModUIModel::ResetAndDestroyAOs() + { + RDEBUG("0", 0); + if (iAOList) + { + iAOList->Release(); + iAOList = NULL; + } + if (iAOArray.Count() > 0 && + iAOArray[0]->Token().TokenType().Type().iUid == KTokenTypeFileKeystore) + { + iAOArray.Reset(); + } + else + { + iAOArray.Close(); + } + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::ConstructL() +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CSecModUIModel::ConstructL() + { + InitializeKeyStoreL(); + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::InitializeKeyStoreL() +// ----------------------------------------------------------------------------- +// +void CSecModUIModel::InitializeKeyStoreL() + { + RDEBUG("0", 0); + ResetAndDestroyCTObjects(); + + // Ensure that file server session is succesfully created + User::LeaveIfError( iRfs.Connect() ); + + iUnifiedKeyStore = CUnifiedKeyStore::NewL(iRfs); + + if (iWrapper == NULL) + { + iWrapper = CSecModUISyncWrapper::NewL(); + } + + TInt err = iWrapper->Initialize(*iUnifiedKeyStore); + + ShowErrorNote(err); + if (KErrNone != err && KErrHardwareNotAvailable != err) + { + User::Leave(err); + } + TInt keyStoreCount = iUnifiedKeyStore->KeyStoreCount(); + if (0 >= keyStoreCount) + { + return; + } + + RMPointerArray keyInfos; + CleanupClosePushL(keyInfos); + TCTKeyAttributeFilter filter; + TInt keyInfoCount = 0; + filter.iPolicyFilter = TCTKeyAttributeFilter::EAllKeys; + + for (TInt i = 0; i < keyStoreCount; i++) + { + err = iWrapper->ListKeys(iUnifiedKeyStore->KeyStore(i), keyInfos, filter); + User::LeaveIfError(err); + //If list ok, append the AO, otherwise go next + keyInfoCount = keyInfos.Count(); + for (TInt j = 0; j < keyInfoCount; j++) + { + // Check that keystore has at least one AO. + if (NULL != keyInfos[j]->Protector()) + { + // If keystore has AO, add it to the array. + User::LeaveIfError( + iAOKeyStores.Append(&(iUnifiedKeyStore->KeyStore(i)))); + break; + } + } + } + CleanupStack::PopAndDestroy(&keyInfos); + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::LoadTokenLabelsL() +// Retrieves the description and location of all tokens. +// ----------------------------------------------------------------------------- +// +QMap CSecModUIModel::LoadTokenLabelsL() + { + RDEBUG("0", 0); + TInt keyStoreCount = iAOKeyStores.Count(); + QMap labelList; + + if (0 == keyStoreCount) + { + return labelList; + } + + for (TInt i = 0; i < keyStoreCount; i++) + { + QString keystoreLabel = 0; + if (iAOKeyStores[i]->Token().TokenType().Type().iUid == KTokenTypeFileKeystore ) + { + keystoreLabel = "Phone keystore"; + } + else if(iAOKeyStores[i]->Token().TokenType().Type().iUid == KWIMStoreUid ) + { + const TDesC& label = iAOKeyStores[i]->Token().Label(); + keystoreLabel = QString( (QChar*) label.Ptr(), label.Length()); + } + else + { + continue; + } + QString location = Location(iAOKeyStores[i]->Token().TokenType().Type()); + labelList.insert(keystoreLabel,location); + } + return labelList; + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::Location() +// Identifies the location of the keystore based on the Uid. +// ----------------------------------------------------------------------------- +// +QString CSecModUIModel::Location( TUid aUid ) const + { + RDEBUG("0", 0); + QString location = 0; + + switch ( aUid.iUid ) + { + case KTokenTypeFileKeystore: + { + location = "\nPhone memory"; + break; + } + case KWIMStoreUid: + { + location = "\nSmart card"; + break; + } + default: + { + break; + } + } + return location; + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::ShowErrorNote(TInt aError) const +// Displays appropriate error message based on the error code. +// ----------------------------------------------------------------------------- +// +void CSecModUIModel::ShowErrorNote(TInt aError) const + { + QString sError; + RDEBUG("aError", aError); + switch (aError) + { + case KErrCancel: + case KErrLocked: + case KErrNone: + { + break; + } + case KErrInUse: + { + sError = "Key is currently in use. Unable to delete. Close applications and try again."; + break; + } + case KErrBadPassphrase: + { + sError = "Code incorrect"; + break; + } + case KErrHardwareNotAvailable: // flow thru + default: + { + sError = "Security module internal error"; + break; + } + } + + if ( sError.length() != 0 ) + { + HbMessageBox::information(sError); + } + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::OpenTokenL(TInt aTokenIndex) +// Retrieves the appropriate token based on the index. +// ----------------------------------------------------------------------------- +// +void CSecModUIModel::OpenTokenL(TInt aTokenIndex) + { + RDEBUG("0", 0); + ResetAndDestroyAOs(); + iKeyStore = iAOKeyStores[aTokenIndex]; + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::CheckCodeViewStringsL() +// Initialize the auth objects and return the total count. +// ----------------------------------------------------------------------------- +// +TInt CSecModUIModel::CheckCodeViewStringsL() + { + InitAuthObjectsL(); + ListAuthObjectsL(); + return iAOArray.Count(); + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::InitAuthObjectsL() +// Retrieve the authentication object associated with the appropriate key store +// implementation. +// ----------------------------------------------------------------------------- +// +void CSecModUIModel::InitAuthObjectsL() + { + RDEBUG("0", 0); + TInt err = KErrNone; + // Symbian's file key store does not support + // MCTAuthenticationObjectList interface, so we need to use + // other way to get AO. + if (iKeyStore->Token().TokenType().Type().iUid == KTokenTypeFileKeystore) + { + if (iAOArray.Count()==0) + { + RMPointerArray keyInfos; + CleanupClosePushL(keyInfos); + TCTKeyAttributeFilter filter; + TInt keyInfoCount = 0; + filter.iPolicyFilter = TCTKeyAttributeFilter::EAllKeys; + err = iWrapper->ListKeys(*iKeyStore, keyInfos, filter); + ShowErrorNote(err); + User::LeaveIfError(err); + keyInfoCount = keyInfos.Count(); + for (TInt j = 0; j < keyInfoCount; j++) + { + // Check that keystore has at least one AO. + if (NULL != keyInfos[j]->Protector()) + { + // If keystore has AO, add it to the array. + User::LeaveIfError(iAOArray.Append(keyInfos[j]->Protector())); + break; + } + } + CleanupStack::PopAndDestroy(&keyInfos); //keyInfos + } + } + else + { + if (NULL == iAOList) + { + MCTTokenInterface* tokenInterface = NULL; + err = iWrapper->GetAuthObjectInterface( + iKeyStore->Token(), tokenInterface); + if ( KErrNone != err || NULL == tokenInterface ) + { + ShowErrorNote(err); + User::Leave(err); + } + iAOList = (MCTAuthenticationObjectList*)tokenInterface; + } + } + } +// ----------------------------------------------------------------------------- +// CSecModUIModel::ListAuthObjectsL() +// list the auth objects. +// ----------------------------------------------------------------------------- +// +void CSecModUIModel::ListAuthObjectsL() + { + RDEBUG("0", 0); + if (0 >= iAOArray.Count()) + { + __ASSERT_ALWAYS(iAOList, Panic(EPanicNullPointer)); + TInt err = iWrapper->ListAuthObjects(*iAOList, iAOArray); + if (err) + { + ShowErrorNote(err); + User::Leave(err); + } + } + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::TokenLabelForTitle() const +// Retrieves description of the token based on UID of the current active keystore. +// ----------------------------------------------------------------------------- +// +QString CSecModUIModel::TokenLabelForTitle() const + { + QString qLabel; + if (iKeyStore->Token().TokenType().Type().iUid + == KTokenTypeFileKeystore) + { + qLabel = "Phone keystore"; + } + else + { + const TDesC& label = iKeyStore->Token().Label(); + qLabel = QString((QChar*)label.Ptr(),label.Length()); + } + return qLabel; + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::AuthStatus(TInt aIndex) const +// Returns status of the selected auth object. +// ----------------------------------------------------------------------------- +// +TUint32 CSecModUIModel::AuthStatus(TInt aIndex) const + { + return iAOArray[aIndex]->Status(); + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::PINStatus( TInt aIndex, TBool aShowBlockedNote ) const +// Returns status of the auth object based on its persistent properties set +// by security module implementation. +// ----------------------------------------------------------------------------- +// +QString CSecModUIModel::PINStatus( TInt aIndex, TBool aShowBlockedNote ) const + { + RDEBUG("0", 0); + __ASSERT_ALWAYS(aIndex < iAOArray.Count(), Panic(EPanicIndexOutOfRange)); + QString pinStatus; + TUint32 status = iAOArray[aIndex]->Status(); + + if (status & EAuthObjectBlocked) + { + if (aShowBlockedNote) + { + QString information = 0; + if (status & EUnblockDisabled) + { + information = " totalblocked, contact your module vendor."; + } + else + { + information = " is blocked. PUK code is needed to unblock the code"; + } + information.prepend(QString( (QChar*)(iAOArray[aIndex]->Label()).Ptr(),iAOArray[aIndex]->Label().Length() ) ); + HbMessageBox::information(information); + } + pinStatus = "Blocked"; + } + else if ( PinOpen(aIndex) ) + { + pinStatus = "Open"; + } + else + { + pinStatus = "Closed"; + } + return pinStatus; + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::PinOpen(TInt aIndex) const +// Checks whether the Pin is still available. +// ----------------------------------------------------------------------------- +// +TBool CSecModUIModel::PinOpen(TInt aIndex) const + { + __ASSERT_ALWAYS(aIndex < iAOArray.Count(), Panic(EPanicIndexOutOfRange)); + TInt timeRemaining = 0; + TInt err = iWrapper->TimeRemaining(*(iAOArray[aIndex]), timeRemaining); + TBool ret = ETrue; + if ( 0 < timeRemaining ) + { + ret = ETrue; + } + else if( timeRemaining == -1 ) + { + ret = ETrue; + } + else + { + ret = EFalse; + } + return ret; + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::ChangeOrUnblockPinL(TInt aIndex) +// Based on the property of auth object the pin can be changed or unblocked. +// ----------------------------------------------------------------------------- +// +void CSecModUIModel::ChangeOrUnblockPinL(TInt aIndex) + { + RDEBUG("0", 0); + __ASSERT_ALWAYS(aIndex < iAOArray.Count(), Panic(EPanicIndexOutOfRange)); + TUint32 status = iAOArray[aIndex]->Status(); + + if ((status & EAuthObjectBlocked) && (status & EUnblockDisabled)) + { + return; // We cannot do anything. PIN is total bolcked. + } + else if (status & EAuthObjectBlocked) + { + // Let's unblock the PIN + UnblockPinL(aIndex); + } + else if (status & EEnabled) + { + // PIN is enabled. Let's change the PIN. + ChangePinL(aIndex); + } + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::UnblockPinL(TInt aIndex) +// Unblocks PIN. +// ----------------------------------------------------------------------------- +// +void CSecModUIModel::UnblockPinL(TInt aIndex) + { + __ASSERT_ALWAYS(aIndex < iAOArray.Count(), Panic(EPanicIndexOutOfRange)); + TInt err = iWrapper->UnblockAuthObject(*(iAOArray[aIndex])); + if (KErrNone == err) + { + HbMessageBox::information("Code unblocked"); + } + else + { + ShowErrorNote(err); + } + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::ChangePinL(TInt aIndex) +// Changes the value of the PIN. +// ----------------------------------------------------------------------------- +// +void CSecModUIModel::ChangePinL(TInt aIndex) + { + RDEBUG("0", 0); + __ASSERT_ALWAYS(aIndex < iAOArray.Count(), Panic(EPanicIndexOutOfRange)); + TInt err = KErrNone; + + err = iWrapper->ChangeReferenceData(*(iAOArray[aIndex])); + if (err) + { + ShowErrorNote(err); + } + else + { + HbMessageBox::information("Code changed"); + } + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::ChangeCodeRequestL(TInt aIndex) +// Toggles the value of auth object if possible. +// ----------------------------------------------------------------------------- +// +TInt CSecModUIModel::ChangeCodeRequest(TInt aIndex) + { + __ASSERT_ALWAYS(aIndex < iAOArray.Count(), Panic(EPanicIndexOutOfRange)); + TUint32 status = iAOArray[aIndex]->Status(); + TInt err = KErrNone; + if (status & EDisableAllowed && !(status & EAuthObjectBlocked)) + { + if ( status & EEnabled ) + { + err = iWrapper->DisableAuthObject(*(iAOArray[aIndex])); + } + else + { + err = iWrapper->EnableAuthObject(*(iAOArray[aIndex])); + } + ShowErrorNote(err); + } + return err; + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::CloseAuthObjL(TInt aIndex) +// If the auth object is open then closes it. +// ----------------------------------------------------------------------------- +// +void CSecModUIModel::CloseAuthObjL(TInt aIndex) + { + if (PinOpen(aIndex)) + { + __ASSERT_ALWAYS(aIndex < iAOArray.Count(), Panic(EPanicIndexOutOfRange)); + TInt err = iWrapper->CloseAuthObject(*(iAOArray[aIndex])); + if (err) + { + ShowErrorNote(err); + User::Leave(err); + } + } + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::DeleteKeysL(TInt aTokenIndex) +// Deletes key from the appropriate keystore. +// ----------------------------------------------------------------------------- +// +void CSecModUIModel::DeleteKeysL(TInt aTokenIndex) + { + RDEBUG("0", 0); + __ASSERT_ALWAYS(aTokenIndex < iAOKeyStores.Count(), Panic(EPanicIndexOutOfRange)); + RMPointerArray keyInfos; + CleanupClosePushL(keyInfos); + TCTKeyAttributeFilter filter; + filter.iPolicyFilter = TCTKeyAttributeFilter::EAllKeys; + TInt err = iWrapper->ListKeys(*iAOKeyStores[aTokenIndex], keyInfos, filter); + ShowErrorNote(err); + User::LeaveIfError(err); + for (TInt i = 0; i < keyInfos.Count(); ++i) + { + err = iWrapper->DeleteKey(*iUnifiedKeyStore, keyInfos[i]->Handle()); + ShowErrorNote(err); + + if (KErrHardwareNotAvailable == err ) + { + break; // Break the loop, if keystore not available + } + } + CleanupStack::PopAndDestroy(&keyInfos); //keyInfos + ResetAndDestroyCTObjects(); + InitializeKeyStoreL(); + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::SecModDetailsL(TInt aTokenIndex) +// Retrieve security module details and cleansup all currently held auth objects. +// ----------------------------------------------------------------------------- +// +QVector< QPair > CSecModUIModel::SecModDetailsL(TInt aTokenIndex) + { + iKeyStore = iAOKeyStores[aTokenIndex]; + InitAuthObjectsL(); + ListAuthObjectsL(); + QVector< QPair > securityDetails = GetSecModDetailsL(); + iKeyStore = NULL; // not owned + if (iAOList) + { + iAOList->Release(); + iAOList = NULL; + } + iAOArray.Reset(); + return securityDetails; + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::GetSecModDetailsL() +// Retrieve security module details. +// ----------------------------------------------------------------------------- +// +QVector< QPair > CSecModUIModel::GetSecModDetailsL() + { + RDEBUG("0", 0); + MCTToken& token = iKeyStore->Token(); + QVector< QPair > securityModDetails; + + if (token.TokenType().Type().iUid == KTokenTypeFileKeystore) + { + QPair name("Name:","Phone keystore"); + securityModDetails.append(name); + } + else + { + QPair name("Name:","(No label)"); + securityModDetails.append(name); + } + + AppendItem(securityModDetails, "Version:", token.Information( MCTToken::EVersion ), "(Not defined)" ); + AppendLocation(securityModDetails, token.TokenType().Type(), QString("Security module location:")); + + if (token.TokenType().Type().iUid == KTokenTypeFileKeystore) + { + QPair accessCode("Access code:","Phone keystore code"); + securityModDetails.append(accessCode); + } + else + { + AppendItem(securityModDetails, "Access code:", iAOArray[0]->Label(), "Access code:" ); + } + + AppendPinNRs(securityModDetails); + + AppendItem( securityModDetails, "Serial number:", + token.Information( MCTToken::ESerialNo), + "(Not defined)"); + + AppendItem( securityModDetails, "Manufacturer:", + token.Information( MCTToken::EManufacturer), + "(Not defined)"); + return securityModDetails; + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::AppendLocation() +// Appends the location of the keystore. +// ----------------------------------------------------------------------------- +// +void CSecModUIModel::AppendLocation( QVector< QPair >& aSecModDetails, + TUid aLocUid, + QString aCertDisplayDetails ) + { + QString locationDetails = "(Not defined)"; + + switch ( aLocUid.iUid ) + { + case KTokenTypeFileKeystore: + locationDetails = "Phone memory"; + break; + + case KWIMStoreUid: + locationDetails = "Smart card"; + break; + + default: + break; + } + aSecModDetails.append(QPair(aCertDisplayDetails, locationDetails)); + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::AppendItem() +// Appends the value of a label if present otherwise appends empty descriotion. +// ----------------------------------------------------------------------------- +// +void CSecModUIModel::AppendItem( QVector< QPair >& aSecModDetails, + QString aLabel, + const TDesC& aValue, + QString aNullDescription) + { + RDEBUG("0", 0); + if( aValue.Length() == 0 ) + { + aSecModDetails.append(QPair(aLabel, aNullDescription)); + } + else + { + QString value = QString((QChar*) aValue.Ptr(),aValue.Length()); + aSecModDetails.append(QPair(aLabel, value)); + } + } + +// ------------------------------------------------------------------------------- +// CSecModUIModel::AppendPinNRs(QVector< QPair >& aSecModDetails) +// Generate details of signing security module. +// ------------------------------------------------------------------------------- +// +void CSecModUIModel::AppendPinNRs(QVector< QPair >& aSecModDetails) + { + TInt pinCount = iAOArray.Count(); + TInt j = 0; + + for (TInt i=1; iLabel(); + if(label.Length() == 0) + { + noLabelDetails.append(++j); + } + QString signingCode = "Signing code:"; + AppendItem(aSecModDetails, signingCode , iAOArray[i]->Label(), noLabelDetails); + } + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::AuthDetails() const +// Return the list of pair of description and status of each auth object. +// ----------------------------------------------------------------------------- +// +QVector > CSecModUIModel::AuthDetails() + { + QVector > authDetails; + + // Here is assumed that the first AO is always PIN-G + for (TInt i = 1; i < iAOArray.Count(); i++) + { + const TDesC& label = iAOArray[i]->Label(); + TUint32 status = iAOArray[i]->Status(); + QString sLabel = QString((QChar*) label.Ptr(), label.Length()); + QPair pair(sLabel, status); + authDetails.append(pair); + } + return authDetails; + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::ChangePinNrL(TInt aIndex) +// Change the pin value for the singing module. +// ----------------------------------------------------------------------------- +// +void CSecModUIModel::ChangePinNrL(TInt aIndex) + { + RDEBUG("0", 0); + ChangePinL(aIndex+1); + } + + +// ----------------------------------------------------------------------------- +// CSecModUIModel::UnblockPinNrL(TInt aIndex) +// Unblock the value for the signing code module. +// ----------------------------------------------------------------------------- +// +void CSecModUIModel::UnblockPinNrL(TInt aIndex) + { + UnblockPinL(aIndex+1); + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::KeyStoreUID() +// Retrieves the UID of the current active keystore. +// ----------------------------------------------------------------------------- +// +TInt CSecModUIModel::KeyStoreUID() + { + return iKeyStore->Token().TokenType().Type().iUid; + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::AuthObj(TInt aIndex) +// Retrieves the auth object at the speficied index. +// ----------------------------------------------------------------------------- +// +const MCTAuthenticationObject& CSecModUIModel::AuthObj(TInt aIndex) + { + return *iAOArray[aIndex]; + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::PinChangeable(TInt aIndex) const +// Returns the status accordingly if the pin is changeable or not. +// ----------------------------------------------------------------------------- +// +TBool CSecModUIModel::PinChangeable(TInt aIndex) const + { + RDEBUG("0", 0); + __ASSERT_ALWAYS(aIndex < iAOArray.Count(), Panic(EPanicIndexOutOfRange)); + TUint32 status = iAOArray[aIndex]->Status(); + TBool ret = ETrue; + if ( (status & EAuthObjectBlocked) || (status & EChangeDisabled) ) + { + ret = EFalse; + } + else if ( status & EEnabled ) + { + ret = ETrue; + } + else // PIN is disabled; + { + ret = EFalse; + } + return ret; + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::PinUnblockable(TInt aIndex) const +// Returns the status accordingly if the pin is unblockable or not. +// ----------------------------------------------------------------------------- +// +TBool CSecModUIModel::PinUnblockable(TInt aIndex) const + { + TUint32 status = iAOArray[aIndex]->Status(); + TBool ret = ETrue; + if ( status & EUnblockDisabled ) + { + ret = EFalse; + } + else if ( status & EAuthObjectBlocked ) + { + ret = ETrue; + } + else // PIN is not blocked; + { + ret = EFalse; + } + return ret; + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::PinRequestChangeable(TInt aIndex) const +// Returns the status accordingly if the pin is changeable or not. +// ----------------------------------------------------------------------------- +// +TBool CSecModUIModel::PinRequestChangeable(TInt aIndex) const + { + RDEBUG("0", 0); + __ASSERT_ALWAYS(aIndex < iAOArray.Count(), Panic(EPanicIndexOutOfRange)); + TUint32 status = iAOArray[aIndex]->Status(); + TBool ret = EFalse; + if ( status & EAuthObjectBlocked ) + { + ret = EFalse; + } + else if ( status & EDisableAllowed ) + { + ret = ETrue; + } + else // Disable not allowed; + { + ret = EFalse; + } + return ret; + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::IsTokenDeletable(TInt aTokenIndex) +// Returns the status accordingly if the token is deletable or not. +// ----------------------------------------------------------------------------- +// +TBool CSecModUIModel::IsTokenDeletable(TInt aTokenIndex) + { + __ASSERT_ALWAYS(aTokenIndex < iAOKeyStores.Count(), Panic(EPanicIndexOutOfRange)); + TBool ret = EFalse; + if (iAOKeyStores[aTokenIndex]->Token().TokenType().Type().iUid + == KTokenTypeFileKeystore) + { + ret = ETrue; + } + else + { + ret = EFalse; + } + return ret; + } + +// End of File + + diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/src/cpsecmodsyncwrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/src/cpsecmodsyncwrapper.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,401 @@ +/* +* 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" +* 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: Implementation of the CSecModUISyncWrapper class +* Implements a synchronous wrapper for easier use of Symbian's +* Security Frameworks's API's. +* +*/ + + +#include "cpsecmodsyncwrapper.h" +#include +#include +#include +#include +#include +#include +#include +#include <../../inc/cpsecplugins.h> + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CSecModUISyncWrapper::CSecModUISyncWrapper() +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CSecModUISyncWrapper::CSecModUISyncWrapper() : CActive( EPriorityStandard ) + { + CActiveScheduler::Add(this); + } + + +// ----------------------------------------------------------------------------- +// CSecModUISyncWrapper::NewLC +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CSecModUISyncWrapper* CSecModUISyncWrapper::NewLC() + { + CSecModUISyncWrapper* wrap = new (ELeave) CSecModUISyncWrapper(); + CleanupStack::PushL(wrap); + return wrap; + } + +// ----------------------------------------------------------------------------- +// CSecModUISyncWrapper::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CSecModUISyncWrapper* CSecModUISyncWrapper::NewL() + { + RDEBUG("0", 0); + CSecModUISyncWrapper* wrap = CSecModUISyncWrapper::NewLC(); + CleanupStack::Pop(wrap); + return wrap; + } + +// Destructor +CSecModUISyncWrapper::~CSecModUISyncWrapper() + { + Cancel(); + iOperation = EOperationNone; + } + +// ----------------------------------------------------------------------------- +// CSecModUISyncWrapper::Initialize(CUnifiedKeyStore& aKeyStore) +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// + +TInt CSecModUISyncWrapper::Initialize(CUnifiedKeyStore& aKeyStore) + { + if( !IsActive() && !iWait.IsStarted() ) + { + iOperation = EOperationInit; + iObject = STATIC_CAST(TAny*, &aKeyStore); + aKeyStore.Initialize(iStatus); + SetActive(); + iWait.Start(); + iOperation = EOperationNone; + return iStatus.Int(); + } + return KErrInUse; + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::GetAuthObjectInterface(...) +// ----------------------------------------------------------------------------- +// +TInt CSecModUISyncWrapper::GetAuthObjectInterface( + MCTToken& aToken, MCTTokenInterface*& aTokenInterface) + { + RDEBUG("0", 0); + 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; + return iStatus.Int(); + } + return KErrInUse; + } + +// ----------------------------------------------------------------------------- +// CSecModUISyncWrapper::ListAuthObjects(...) +// ----------------------------------------------------------------------------- +// +TInt CSecModUISyncWrapper::ListAuthObjects( + MCTAuthenticationObjectList& aAuthObjList, + RMPointerArray& aAuthObjects) + { + if( !IsActive() && !iWait.IsStarted() ) + { + iOperation = EOperationListAOs; + iObject = STATIC_CAST(TAny*, &aAuthObjList); + aAuthObjList.List( aAuthObjects, iStatus ); + iOperation = EOperationListAOs; + SetActive(); + iWait.Start(); + iOperation = EOperationNone; + return iStatus.Int(); + } + return KErrInUse; + } + +// ----------------------------------------------------------------------------- +// CSecModUISyncWrapper::ListKeys(...) +// ----------------------------------------------------------------------------- +// +TInt CSecModUISyncWrapper::ListKeys( + MCTKeyStore& aKeyStore, + RMPointerArray& aKeysInfos, + const TCTKeyAttributeFilter& aFilter) + { + RDEBUG("0", 0); + if( !IsActive() && !iWait.IsStarted() ) + { + iOperation = EOperationListKeys; + iObject = STATIC_CAST(TAny*, &aKeyStore); + aKeyStore.List(aKeysInfos, aFilter, iStatus); + SetActive(); + iWait.Start(); + iOperation = EOperationNone; + return iStatus.Int(); + } + return KErrInUse; + } + +// ----------------------------------------------------------------------------- +// CSecModUISyncWrapper::DeleteKey(...) +// ----------------------------------------------------------------------------- +// +TInt CSecModUISyncWrapper::DeleteKey( + CUnifiedKeyStore& aKeyStore, + TCTTokenObjectHandle aHandle) + { + RDEBUG("0", 0); + if( !IsActive() && !iWait.IsStarted() ) + { + iOperation = EOperationDelKey; + iObject = STATIC_CAST(TAny*, &aKeyStore); + aKeyStore.DeleteKey(aHandle, iStatus); + SetActive(); + iWait.Start(); + iOperation = EOperationNone; + return iStatus.Int(); + } + return KErrInUse; + } + +// ----------------------------------------------------------------------------- +// CSecModUISyncWrapper::ChangeReferenceData(MCTAuthenticationObject& aAuthObject) +// ----------------------------------------------------------------------------- +// +TInt CSecModUISyncWrapper::ChangeReferenceData( + MCTAuthenticationObject& aAuthObject) + { + RDEBUG("0", 0); + if( !IsActive() && !iWait.IsStarted() ) + { + iOperation = EOperationChangeReferenceData; + iObject = STATIC_CAST(TAny*, &aAuthObject); + aAuthObject.ChangeReferenceData(iStatus); + SetActive(); + iWait.Start(); + iOperation = EOperationNone; + return iStatus.Int(); + } + return KErrInUse; + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::UnblockAuthObject(MCTAuthenticationObject& aAuthObject) +// ----------------------------------------------------------------------------- +// +TInt CSecModUISyncWrapper::UnblockAuthObject( + MCTAuthenticationObject& aAuthObject) + { + RDEBUG("0", 0); + if( !IsActive() && !iWait.IsStarted() ) + { + iOperation = EOperationUnblockAO; + iObject = STATIC_CAST(TAny*, &aAuthObject); + aAuthObject.Unblock(iStatus); + SetActive(); + iWait.Start(); + iOperation = EOperationNone; + return iStatus.Int(); + } + return KErrInUse; + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::EnableAuthObject(MCTAuthenticationObject& aAuthObject) +// ----------------------------------------------------------------------------- +// +TInt CSecModUISyncWrapper::EnableAuthObject( + MCTAuthenticationObject& aAuthObject) + { + RDEBUG("0", 0); + if( !IsActive() && !iWait.IsStarted() ) + { + iOperation = EOperationEnableAO; + iObject = STATIC_CAST(TAny*, &aAuthObject); + aAuthObject.Enable(iStatus); + iOperation = EOperationUnblockAO; + SetActive(); + iWait.Start(); + iOperation = EOperationNone; + return iStatus.Int(); + } + return KErrInUse; + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::DisableAuthObject(MCTAuthenticationObject& aAuthObject) +// ----------------------------------------------------------------------------- +// +TInt CSecModUISyncWrapper::DisableAuthObject( + MCTAuthenticationObject& aAuthObject) + { + if( !IsActive() && !iWait.IsStarted() ) + { + iOperation = EOperationDisableAO; + iObject = STATIC_CAST(TAny*, &aAuthObject); + aAuthObject.Disable(iStatus); + SetActive(); + iWait.Start(); + iOperation = EOperationNone; + return iStatus.Int(); + } + return KErrInUse; + } + +// ----------------------------------------------------------------------------- +// CSecModUISyncWrapper::CloseAuthObject(MCTAuthenticationObject& aAuthObject) +// ----------------------------------------------------------------------------- +// +TInt CSecModUISyncWrapper::CloseAuthObject( + MCTAuthenticationObject& aAuthObject) + { + if( !IsActive() && !iWait.IsStarted() ) + { + iOperation = EOperationCloseAO; + iObject = STATIC_CAST(TAny*, &aAuthObject); + aAuthObject.Close(iStatus); + SetActive(); + iWait.Start(); + iOperation = EOperationNone; + return iStatus.Int(); + } + return KErrInUse; + } + +// ----------------------------------------------------------------------------- +// CSecModUIModel::TimeRemaining(...) +// ----------------------------------------------------------------------------- +// +TInt CSecModUISyncWrapper::TimeRemaining( + MCTAuthenticationObject& aAuthObject, + TInt& aStime ) + { + RDEBUG("0", 0); + if( !IsActive() && !iWait.IsStarted() ) + { + iOperation = EOperationTimeRemAO; + iObject = STATIC_CAST(TAny*, &aAuthObject); + aAuthObject.TimeRemaining(aStime, iStatus); + SetActive(); + iWait.Start(); + iOperation = EOperationNone; + return iStatus.Int(); + } + return KErrInUse; + } + +// ----------------------------------------------------------------------------- +// CSecModUISyncWrapper::DoCancel +// Cancels the ongoing operation if possible. +// ----------------------------------------------------------------------------- +// +void CSecModUISyncWrapper::DoCancel() + { + RDEBUG("iOperation", iOperation); + switch ( iOperation ) + { + case EOperationInit: + { + STATIC_CAST(CUnifiedKeyStore*, iObject)->CancelInitialize(); + break; + } + case EOperationGetAOInterface: + { + STATIC_CAST(MCTToken*, iObject)->CancelGetInterface(); + break; + } + case EOperationListAOs: + { + STATIC_CAST(MCTAuthenticationObjectList*, iObject)->CancelList(); + break; + } + case EOperationListKeys: + { + STATIC_CAST(MCTKeyStore*, iObject)->CancelList(); + break; + } + case EOperationDelKey: + { + STATIC_CAST(CUnifiedKeyStore*, iObject)->CancelDeleteKey(); + break; + } + case EOperationChangeReferenceData: + { + STATIC_CAST(MCTAuthenticationObject*, iObject)-> + CancelChangeReferenceData(); + break; + } + case EOperationUnblockAO: + { + STATIC_CAST(MCTAuthenticationObject*, iObject)->CancelUnblock(); + break; + } + case EOperationEnableAO: + { + STATIC_CAST(MCTAuthenticationObject*, iObject)->CancelEnable(); + break; + } + case EOperationDisableAO: + { + STATIC_CAST(MCTAuthenticationObject*, iObject)->CancelDisable(); + break; + } + case EOperationCloseAO: + { + STATIC_CAST(MCTAuthenticationObject*, iObject)->CancelClose(); + break; + } + case EOperationTimeRemAO: + { + STATIC_CAST(MCTAuthenticationObject*, iObject)->CancelTimeRemaining(); + break; + } + default: + { + break; + } + } + if (iWait.IsStarted()) + { + iWait.AsyncStop(); + } + } + +// ----------------------------------------------------------------------------- +// CSecModUISyncWrapper::RunL +// If no errors happened, stop. Show an error note if needed. +// ----------------------------------------------------------------------------- +// +void CSecModUISyncWrapper::RunL() + { + iWait.AsyncStop(); + } + diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/src/cpsecmoduleinfoview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/src/cpsecmoduleinfoview.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,86 @@ + +/* +* Copyright (c) 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"" +* 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: +* +*/ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include <../../inc/cpsecplugins.h> +#include "cpsecmoduleinfoview.h" + + +CpSecmoduleInfoView::CpSecmoduleInfoView(const QVector< QPair >& securityDetails, QGraphicsItem *parent /*= 0*/) + : CpBaseSettingView(0,parent) + { + RDEBUG("0", 0); + setTitle(tr("Module info")); + + std::auto_ptr layout(q_check_ptr(new QGraphicsLinearLayout(Qt::Vertical))); + HbListWidget* listSecurityDetails = q_check_ptr(new HbListWidget(this)); + + QVectorIterator< QPair > secDetIter(securityDetails); + while(secDetIter.hasNext()) + { + QPair pair = secDetIter.next(); + + std::auto_ptr label(q_check_ptr(new HbListWidgetItem())); + label->setText(pair.first); + listSecurityDetails->addItem(label.get()); + label.release(); + + std::auto_ptr description(q_check_ptr(new HbListWidgetItem())); + description->setText(pair.second); + listSecurityDetails->addItem(description.get()); + description.release(); + } + + layout->addItem(listSecurityDetails); + setLayout(layout.get()); + layout.release(); + RDEBUG("0", 0); + } + +CpSecmoduleInfoView::~CpSecmoduleInfoView() + {} + +// End of file + diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/src/cpsecmodview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/src/cpsecmodview.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,143 @@ +/* +* Copyright (c) 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"" +* 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: +* +*/ + +#include + + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include <../../inc/cpsecplugins.h> +#include "cpsecmodview.h" +#include "cpsecmodmodel.h" +#include "cpmoduleview.h" + +CpSecModView::CpSecModView(TInt currentPos, CSecModUIModel& secModUIModel, QGraphicsItem *parent /*= 0*/) +: CpBaseSettingView(0,parent), + mSecModUIModel(secModUIModel), + mPos(currentPos), + mCurrentView(EAccessView), + mAccessView(NULL), + mPrevView(NULL) + { + RDEBUG("0", 0); + try + { + QT_TRAP_THROWING(mSecModUIModel.OpenTokenL(mPos)); + QString title = mSecModUIModel.TokenLabelForTitle(); + setTitle(title); + + TInt count = 0; + // display code view + QT_TRAP_THROWING(count = mSecModUIModel.CheckCodeViewStringsL()); + + std::auto_ptr layout(q_check_ptr(new QGraphicsLinearLayout(Qt::Vertical))); + HbListWidget* listSecView = q_check_ptr(new HbListWidget(this)); + + std::auto_ptr moduleWidget(q_check_ptr(new HbListWidgetItem())); + moduleWidget->setText("\tModule PIN"); + listSecView->addItem(moduleWidget.get()); + moduleWidget.release(); + RDEBUG("count", count); + if( count == 2 ) + { + std::auto_ptr signingWidget(q_check_ptr(new HbListWidgetItem())); + signingWidget->setText("\tSigning PIN"); + listSecView->addItem(signingWidget.get()); + signingWidget.release(); + } + + connect(listSecView, SIGNAL(activated(QModelIndex)), this, SLOT(showNextView(QModelIndex))); + + layout->addItem(listSecView); + setLayout(layout.get()); + layout.release(); + } + catch(const std::exception& exception) + { + QString error(exception.what()); + HbMessageBox::information(error); + QT_RETHROW; + } + } + +CpSecModView::~CpSecModView() + { + if(mAccessView) + { + mAccessView->deleteLater(); + mAccessView = NULL; + } + if(mPrevView) + { + mPrevView->deleteLater(); + mPrevView = NULL; + } + } + + +void CpSecModView::showNextView( const QModelIndex& modelIndex ) + { + RDEBUG("0", 0); + try + { + mAccessView = q_check_ptr(new CpModuleView((TSecModViews)modelIndex.row(),mSecModUIModel)); + QObject::connect(mAccessView , SIGNAL(aboutToClose()), this, SLOT(displayPrevious())); + mPrevView = mainWindow()->currentView(); //suppose iPreView is member variable of CpSecurityView + mainWindow()->addView(mAccessView); + mainWindow()->setCurrentView(mAccessView); + } + catch(const std::exception& exception) + { + HbMessageBox::information(exception.what()); + } + } + +void CpSecModView::displayPrevious() + { + RDEBUG("0", 0); + try + { + mainWindow()->removeView(mAccessView); + } + catch(const std::exception& exception) + { + HbMessageBox::information(exception.what()); + } + } + diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpadvancedsecplugin/src/cpsecurityview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpadvancedsecplugin/src/cpsecurityview.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,388 @@ +/* +* Copyright (c) 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"" +* 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: +* +*/ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include <../../inc/cpsecplugins.h> + +#include "cpsecurityview.h" +#include "cpsecmodview.h" +#include "cpcertview.h" +#include "cpsecmodmodel.h" +#include "cpsecmoduleinfoview.h" + +CpSecurityView::CpSecurityView(QGraphicsItem *parent /*= 0*/) + : CpBaseSettingView(0,parent), + mSecModUIModel(NULL), + mSecModView(NULL), + mPreView(NULL), + mCertView(NULL), + mCurrentView(NULL), + mPos(0), + mNote(NULL) + { + RDEBUG("0", 0); + setTitle(hbTrId("txt_certificate_manager_setlabel_advanced_security")); + + std::auto_ptr layout(q_check_ptr(new QGraphicsLinearLayout(Qt::Vertical))); + HbListWidget* listCertView = q_check_ptr(new HbListWidget(this)); + + std::auto_ptr authcert(q_check_ptr(new HbListWidgetItem())); + authcert->setText(hbTrId("txt_certificate_manager_list_authority_certificate")); + + std::auto_ptr trustedsitecert(q_check_ptr(new HbListWidgetItem())); + trustedsitecert->setText(hbTrId("txt_certificate_manager_list_trusted_site_certific")); + + std::auto_ptr personalcert(q_check_ptr(new HbListWidgetItem())); + personalcert->setText(hbTrId("txt_certificate_manager_list_personal_certificates")); + + std::auto_ptr devicecert(q_check_ptr(new HbListWidgetItem())); + devicecert->setText(hbTrId("txt_certificate_manager_list_device_certificates")); + + listCertView->addItem(authcert.get()); + authcert.release(); + listCertView->addItem(trustedsitecert.get()); + trustedsitecert.release(); + listCertView->addItem(personalcert.get()); + personalcert.release(); + listCertView->addItem(devicecert.get()); + devicecert.release(); + + connect(listCertView, SIGNAL(released(QModelIndex)), this, SLOT(displayCert(QModelIndex))); + + HbListWidget* listSecView = q_check_ptr(new HbListWidget(this)); + QMap keystoreLabels; + RDEBUG("0", 0); + try + { + QT_TRAP_THROWING( + mSecModUIModel = CSecModUIModel::NewL(); + keystoreLabels = mSecModUIModel->LoadTokenLabelsL(); ) + } + catch(const std::exception& exception) + { + QString error(exception.what()); + HbMessageBox::information(error); + QT_RETHROW; + } + + QMapIterator labelIter(keystoreLabels); + if(keystoreLabels.count() != 0) + { + while(labelIter.hasNext()) + { + labelIter.next(); + std::auto_ptr widget(q_check_ptr(new HbListWidgetItem())); + widget->setText(labelIter.key()); + widget->setSecondaryText(labelIter.value()); + listSecView->addItem(widget.get()); + widget.release(); + } + connect(listSecView, SIGNAL(activated(QModelIndex)), this, SLOT(showCodeView(QModelIndex))); + connect(listSecView, SIGNAL(longPressed(HbAbstractViewItem*, QPointF )), this, SLOT(indicateLongPress(HbAbstractViewItem*, QPointF))); + } + else + { + std::auto_ptr emptyWidget(q_check_ptr(new HbListWidgetItem())); + emptyWidget->setText("(no security modules)"); + listSecView->addItem(emptyWidget.get()); + emptyWidget.release(); + } + RDEBUG("0", 0); + std::auto_ptr certificatesList(q_check_ptr(new HbGroupBox())); + certificatesList->setHeading(hbTrId("txt_certificate_manager_setlabel_certificates")); + certificatesList->setContentWidget(listCertView); + certificatesList->setCollapsed(true); + layout->addItem(certificatesList.get()); + certificatesList.release(); + + std::auto_ptr protectedContentList(q_check_ptr(new HbGroupBox())); + protectedContentList->setHeading("Protected Content"); + protectedContentList->setCollapsed(true); + layout->addItem(protectedContentList.get()); + protectedContentList.release(); + + std::auto_ptr securityModuleList(q_check_ptr(new HbGroupBox())); + securityModuleList->setHeading("Security Module"); + securityModuleList->setContentWidget(listSecView); + securityModuleList->setCollapsed(true); + layout->addItem(securityModuleList.get()); + securityModuleList.release(); + + mContextMenu = q_check_ptr(new HbMenu()); + + setLayout(layout.get()); + layout.release(); + } + + +CpSecurityView::~CpSecurityView() + { + if(mSecModView) + { + mSecModView->deleteLater(); + } + + if(mPreView) + { + mPreView->deleteLater(); + } + + if(mCertView) + { + mCertView->deleteLater(); + } + + if(mCurrentView) + { + mCurrentView->deleteLater(); + } + + delete mSecModUIModel; + + delete mNote; + delete mContextMenu; + } + +void CpSecurityView::showCodeView() + { + RDEBUG("0", 0); + try + { + mSecModView = q_check_ptr(new CpSecModView(mPos, *mSecModUIModel)); + QObject::connect(mSecModView , SIGNAL(aboutToClose()), this, SLOT(viewDone())); + mPreView = mainWindow()->currentView(); //suppose mPreView is member variable of CpSecurityView + mainWindow()->addView(mSecModView); + mainWindow()->setCurrentView(mSecModView); + } + catch(const std::exception& exception) + { + HbMessageBox::information(exception.what()); + } + } + +void CpSecurityView::showCodeView( const QModelIndex& aModelIndex) + { + mPos = aModelIndex.row(); + showCodeView(); + } + +void CpSecurityView::showWIMview() + { + RDEBUG("0", 0); + try + { + QObject::connect(mSecModView , SIGNAL(aboutToClose()), this, SLOT(viewDone())); + mPreView = mainWindow()->currentView(); //suppose mPreView is member variable of CpSecurityView + mainWindow()->addView(mSecModView); + mainWindow()->setCurrentView(mSecModView); + } + catch(const std::exception& exception) + { + HbMessageBox::information(exception.what()); + } + } + +void CpSecurityView::viewDone() + { + try + { + mainWindow()->removeView(mSecModView); + mSecModView->deleteLater(); + mSecModView= NULL; + mainWindow()->setCurrentView(mPreView); + } + catch(const std::exception& exception) + { + HbMessageBox::information(exception.what()); + } + } + +void CpSecurityView::displayCert(const QModelIndex& modelIndex) + { + RDEBUG("0", 0); + try + { + mCertView = q_check_ptr(new CpCertView(modelIndex)); + connect(mCertView , SIGNAL(aboutToClose()), this, SLOT(displayPrevious())); + mPreView = mainWindow()->currentView(); + mainWindow()->addView(mCertView); + mainWindow()->setCurrentView(mCertView); + } + catch(const std::exception& exception) + { + HbMessageBox::information(exception.what()); + } + } + +void CpSecurityView::displayPrevious() + { + RDEBUG("0", 0); + try + { + mainWindow()->removeView(mCertView); + mCertView->deleteLater(); + mCertView= NULL; + mainWindow()->setCurrentView(mPreView); + } + catch(const std::exception& exception) + { + HbMessageBox::information(exception.what()); + } + } + +void CpSecurityView::indicateLongPress(HbAbstractViewItem *item,QPointF coords) + { + RDEBUG("0", 0); + try + { + mContextMenu->clearActions(); + mPos = item->modelIndex().row(); + + std::auto_ptr openModule(q_check_ptr(new HbAction("Open"))); + connect(openModule.get(), SIGNAL(triggered()), this, SLOT( showCodeView())); + mContextMenu->addAction(openModule.get()); + openModule.release(); + + if(mSecModUIModel->IsTokenDeletable(mPos)) + { + std::auto_ptr deleteModule(q_check_ptr(new HbAction("Delete"))); + connect(deleteModule.get(), SIGNAL(triggered()), this, SLOT( deleteModule())); + mContextMenu->addAction(deleteModule.get()); + deleteModule.release(); + } + + std::auto_ptr moduleInfo(q_check_ptr(new HbAction("Module Info"))); + connect(moduleInfo.get(), SIGNAL(triggered()), this, SLOT( moduleDetails())); + mContextMenu->addAction(moduleInfo.get()); + moduleInfo.release(); + + mContextMenu->setPreferredPos(coords); + mContextMenu->open(); + } + catch(const std::exception& exception) + { + HbMessageBox::information(exception.what()); + } + } + +void CpSecurityView::deleteModule() + { + RDEBUG("0", 0); + try + { + + delete mNote; + mNote = NULL; + + mNote = new HbMessageBox(HbMessageBox::MessageTypeQuestion); + mNote->setHeadingWidget(q_check_ptr(new HbLabel(tr("Delete...")))); + mNote->setText("Delete keystore and password?"); + mNote->setPrimaryAction(q_check_ptr(new HbAction("Yes"))); + mNote->setSecondaryAction(q_check_ptr(new HbAction("No"))); + mNote->setTimeout(HbPopup::NoTimeout); + mNote->setIconVisible (EFalse); + mNote->open(this,SLOT(dialogClosed(HbAction*))); + } + catch(const std::exception& exception) + { + HbMessageBox *box = new HbMessageBox(exception.what()); + box->setAttribute(Qt::WA_DeleteOnClose); + box->open(); + } + +} +void CpSecurityView::dialogClosed(HbAction* action) +{ + RDEBUG("0", 0); + if (action != mNote->primaryAction()) + { + return; + } + + try + { + QT_TRAP_THROWING(mSecModUIModel->DeleteKeysL(mPos)); + } + catch(const std::exception& exception) + { + HbMessageBox *box = new HbMessageBox(exception.what()); + box->setAttribute(Qt::WA_DeleteOnClose); + box->open(); + } + } + +void CpSecurityView::moduleDetails() + { + RDEBUG("0", 0); + try + { + QVector< QPair > securityDetails; + QT_TRAP_THROWING(securityDetails = mSecModUIModel->SecModDetailsL(mPos)); + mModuleinfoView = q_check_ptr(new CpSecmoduleInfoView(securityDetails)); + + connect(mModuleinfoView , SIGNAL(aboutToClose()), this, SLOT(displayPreviousFromModInfo())); + mPreView = mainWindow()->currentView(); + mainWindow()->addView(mModuleinfoView); + mainWindow()->setCurrentView(mModuleinfoView); + } + catch(const std::exception& exception) + { + HbMessageBox::information(exception.what()); + } + } + +void CpSecurityView::displayPreviousFromModInfo() + { + RDEBUG("0", 0); + try + { + mainWindow()->removeView(mModuleinfoView); + mCertView->deleteLater(); + mCertView= NULL; + mainWindow()->setCurrentView(mPreView); + } + catch(const std::exception& exception) + { + HbMessageBox::information(exception.what()); + } + } + diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpplugincommon.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpplugincommon.pri Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,34 @@ +# +# Copyright (c) 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: controlpanel plugin project qmake common settings +# +include (common.pri) + + +LIBS += -lcpframework + +symbian: plugin { # copy qtstub and manifest + + PLUGIN_STUB_PATH = /resource/qt/plugins/controlpanel + + deploy.path = C: + pluginstub.sources = $${TARGET}.dll + pluginstub.path = $$PLUGIN_STUB_PATH + DEPLOYMENT += pluginstub + + qtplugins.path = $$PLUGIN_STUB_PATH + qtplugins.sources += qmakepluginstubs/$${TARGET}.qtplugin + + for(qtplugin, qtplugins.sources):BLD_INF_RULES.prj_exports += "./$$qtplugin $$deploy.path$$qtplugins.path/$$basename(qtplugin)" +} diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/cpsecplugins.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/cpsecplugins.pro Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,22 @@ +# +# Copyright (c) 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" +# 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: Security Settings plugins +# + +TEMPLATE = subdirs + +# temporarilly skip, because too many deprecations +SUBDIRS += devicelockplugin/devicelockplugin.pro +SUBDIRS += simpincodeplugin/pincodeplugin.pro +SUBDIRS += cpadvancedsecplugin/group/advancedsecplugin.pro diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/devicelockplugin/devicelocking.ts --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/devicelockplugin/devicelocking.ts Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,556 @@ + + + + + + Error note when trying to change lock code + Lock code can be changed %L1n times in %L2n hours + + qtl_dialog_pri5_large_graphic + devicelocking_22 + info + de + False + + + Error note when creating new lock code + Characters cannot be repeated + + qtl_dialog_pri5_large_graphic + devicelocking_21 + info + de + False + + + Value for combobox of device locking + 30 minutes + + qtl_dataform_heading_combobox_sec + devicelocking_04 + setlabel_3_val + de + False + + + Label for new lock code query + New lock code + + qtl_dialog_sec + devicelocking_06 + dialog + de + False + + + Error note when creating new lock code + Must include upper and lower case characters + + qtl_dialog_pri5_large_graphic + devicelocking_21 + info + de + False + + + Label for lock code query + Lock code + + qtl_dialog_sec + devicelocking_05 + dialog + de + False + + + Error note when creating new lock code + Lock code cannot be same as previous %Ln lock codes + + qtl_dialog_pri5_large_graphic + devicelocking_21 + info + de + False + + + NotificationDialog shown when creating locking messages + Messages do not match + + qtl_notifdialog_pri_medium_graphic + devicelocking_19 + dpophead + de + False + + + NotificationDialog shown when locking message is created successfully + Locking message created + + qtl_notifdialog_pri_medium_graphic + devicelocking_20 + dpophead + de + False + + + + Cancel + + + common + button + co + False + + + Label for Device lock settings in Control Panel + Device Locking + + qtl_dataform_pri + devicelocking_01 + subhead + de + False + + + Device lock item in Control Panel + Device lock + + qtl_list_pri_large_graphic + CP_01 + dblist_1 + CP + False + + + Label for Automatic locking combobox + Automatic locking + + qtl_dataform_heading_pri + devicelocking_04 + formlabel_3 + de + False + + + Label for remote locking message creation dialog + New locking message + + qtl_dialog_sec + device_locking_04 + dialog + de + False + + + Label for Remote locking field + Remote locking + + qtl_dataform_heading_pri + devicelocking_04 + formlabel_5 + de + False + + + Secondary text for wrong code dialog + Try again + + qtl_notifdialog_sec_medium_graphic + devicelocking_08 + dpopinfo + de + False + + + Error note when creating new lock code + Information included in the lock code is not allowed + + qtl_dialog_pri5_large_graphic + devicelocking_21 + info + de + False + + + Label for Remote locking message field + Locking message + + qtl_dataform_heading_pri + devicelocking_04 + formlabel_6 + de + False + + + Descriptive text for device lock code in control panel + Lock code can be used for protecting the device from unauthorized use + + qtl_dataform_description_sec + devicelocking_01 + info + de + False + + + Notification text for lock code query if field has numbers (other than emergency number) and hw call key is pressed + Emergency calls only + + qtl_notifdialog_pri_medium_graphic + devicelocking_13 + dpophead + de + False + + + Secondary text for blocked code note + Wait %Ln minutes + + qtl_notifdialog_sec_medium_graphic + devicelocking_15 + dpopinfo + de + False + + + Label for verifying new lock message query + Retype locking message + + qtl_dialog_sec + device_locking_04 + dialog + de + False + + + Call button for emergency calls in lock code query + Call + + common + common + button + co + False + + + Notification dialog for wrong lock code primary text + Wrong lock code + + qtl_notifdialog_pri_medium_graphic + devicelocking_08 + dpophead + de + False + + + Label in Device Locking view of Control Panel + Remote locking + + qtl_dataform_pri + devicelocking_04 + subhead + de + False + + + Error note when creating new lock code + Characters cannot be repeated more than %L1 times + + qtl_dialog_pri5_large_graphic + devicelocking_21 + info + de + False + + + Button label for Lock when SIM changed button + On + + qtl_dataform_button_sec + devicelocking_04 + button + de + False + + + NotificationDialog shown when lock code is created successfully + Lock code created + + qtl_notifdialog_pri_medium_graphic + devicelocking_10 + dpophead + de + False + + + Error note when creating new lock code + The security code must be alphanumeric + + qtl_dialog_pri5_large_graphic + devicelocking_21 + info + de + False + + + Error note when creating new lock code + Code must contain at least %L1 special characters + + qtl_dialog_pri5_large_graphic + devicelocking_21 + info + de + False + + + Button label for enabled remote locking + On + + qtl_dataform_button_sec + devicelocking_04 + button + de + False + + + Error message shown when giving the wrong code too many times + Incorrect lock code. One attempt left before data is erased. + + qtl_dialog_pri5_large_graphic + devicelocking_23 + info + de + False + + + Button text for activated device locking + On + + qtl_dataform_button_sec + devicelocking_04 + button + de + False + + + Error note when creating new lock code + Must be at least %L1 characters + + qtl_dialog_pri5_large_graphic + devicelocking_21 + info + de + False + + + Label for lock code field + Lock code + + qtl_dataform_heading_pri + devicelocking_04 + formlabel_2 + de + False + + + Value for combobox in device locking + 60 minutes + + qtl_dataform_heading_combobox_sec + devicelocking_04 + setlabel_4_val + de + False + + + Label for disabled device locking in Control Panel + Off + + qtl_dataform_button_sec + devicelocking_04 + button + de + False + + + Error note when creating new lock code + More than two consecutive numbers not allowed + + qtl_dialog_pri5_large_graphic + devicelocking_21 + info + de + False + + + Message Box shown when lock code expires + Lock code is expired. + + qtl_dialog_pri5_large_graphic + devicelocking_24 + info + de + False + + + Create locking code button in Control Panel + Create lock code + + qtl_dataform_button_sec + devicelocking_01 + button + de + False + + + + Codes do not match + + qtl_notifdialog_pri_medium_graphic + devicelocking_09 + dpophead + de + False + + + Notification text for blocked lock code query. Timed blocking starts from 5 minutes. + Lock code is blocked + + qtl_notifdialog_pri2 + devicelocking_15 + dpophead + de + False + + + ComboBox value for device locking + When keys & screen locked + + qtl_dataform_heading_combobox_sec + devicelocking_04 + setlabel_1_val + de + False + + + Button label for Lock when SIM changed button + Off + + qtl_dataform_button_sec + devicelocking_04 + button + de + False + + + Label for verifying new lock code query + Retype new lock code + + qtl_dialog_sec + devicelocking_07 + dialog + de + False + + + Label for lock if SIM changed field + Lock when SIM changed + + qtl_dataform_heading_pri + devicelocking_04 + formlabel_4 + de + False + + + Combobox value for device locking + 5 minutes + + qtl_dataform_heading_combobox_sec + devicelocking_04 + setlabel_2_val + de + False + + + Error note when creating new lock code + Code must not contain consecutive characters + + qtl_dialog_pri5_large_graphic + devicelocking_21 + info + de + False + + + Error note when creating new lock code + Must include letters and numbers + + qtl_dialog_pri5_large_graphic + devicelocking_21 + info + de + False + + + Label for Device Locking button + Device locking + + qtl_dataform_heading_pri + devicelocking_04 + formlabel_1 + de + False + + + Error note for creating locking message + The locking message and the lock code should not be equal + + qtl_dialog_pri5 + devicelocking_18 + info + de + False + + + Error note when creating new lock code + Cannot contain more than %L1 characters + + qtl_dialog_pri5_large_graphic + devicelocking_21 + info + de + False + + + Button label for disabled remote locking button + Off + + qtl_dataform_button_sec + devicelocking_04 + button + de + False + + + Error note when creating new lock code + Code must not contain single repeated character + + qtl_dialog_pri5_large_graphic + devicelocking_21 + info + de + False + + + + OK + + + common + button + co + False + + + diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/devicelockplugin/devicelockplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/devicelockplugin/devicelockplugin.pri Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,24 @@ +# +# Copyright (c) 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: cpdevicelockplugin source files +# + +# Input +HEADERS += src/*.h +SOURCES += src/*.cpp + +INCLUDEPATH += ../../seccodeui/src \ + ../../seccodeui/inc \ + + diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/devicelockplugin/devicelockplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/devicelockplugin/devicelockplugin.pro Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,44 @@ +# +# Copyright (c) 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: +# + +TEMPLATE = lib +TARGET = devicelockplugin + +CONFIG += hb plugin + +LIBS += -lsecuinotificationdialogplugin \ + -llockclient \ + -lautolockuseractivityservice \ + -lIndicatorAutolockPlugin \ + -lsecui \ + -letelmm \ + -letel \ + -lcustomapi \ + -lrlocksettings \ + -lcentralrepository \ + -lRLockSettings \ + -lflogger +TRANSLATIONS += devicelocking.ts +include ( ../cpplugincommon.pri ) +include ( devicelockplugin.pri ) +include ( rom/devicelockplugin_rom.pri ) + +symbian { + TARGET.UID3 = 0X2002E683 + + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + +} \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/devicelockplugin/devicelockplugin_installer.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/devicelockplugin/devicelockplugin_installer.pkg Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,29 @@ +; devicelockplugin_installer.pkg generated by qmake at 2010-04-27T17:12:14 +; This file is generated by qmake and should not be modified by the user +; + +; Language +&EN + +; SIS header: name, uid, version +#{"devicelockplugin installer"},(0xA000D7CE),1,0,0 + +; Localised Vendor name +%{"Vendor"} + +; Unique Vendor name +:"Vendor" + + +; Manual PKG pre-rules from PRO files +; Default HW/platform dependencies +[0x101F7961],0,0,0,{"S60ProductID"} +[0x102032BE],0,0,0,{"S60ProductID"} +[0x102752AE],0,0,0,{"S60ProductID"} +[0x1028315F],0,0,0,{"S60ProductID"} + +; Default dependency to Qt libraries + + +"M:/sf/app/settingsuis/controlpanelui/src/cpplugins/devicelockplugin/devicelockplugin.sis" - "c:\adm\devicelockplugin.sis" +@"M:/sf/mw/qt/smartinstaller.sis",(0x2002CCCD) diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/devicelockplugin/qmakepluginstubs/devicelockplugin.qtplugin --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/devicelockplugin/qmakepluginstubs/devicelockplugin.qtplugin Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,1 @@ +This file is a Qt plugin stub file. The real Qt plugin is located in /sys/bin. Created:2010-04-28T08:30:55 diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/devicelockplugin/rom/devicelockplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/devicelockplugin/rom/devicelockplugin.iby Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 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: +* +*/ + +#ifndef __DEVICELOCKPLUGIN_IBY__ +#define __DEVICELOCKPLUGIN_IBY__ + +file=ABI_DIR\BUILD_DIR\devicelockplugin.dll SHARED_LIB_DIR\devicelockplugin.dll +data=\epoc32\data\c\resource\qt\plugins\controlpanel\devicelockplugin.qtplugin resource\qt\plugins\controlpanel\devicelockplugin.qtplugin + +#endif diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/devicelockplugin/rom/devicelockplugin_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/devicelockplugin/rom/devicelockplugin_resources.iby Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 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: +* +*/ + +#ifndef __DEVICELOCKPLUGIN_RESOURCES_IBY__ +#define __DEVICELOCKPLUGIN_RESOURCES_IBY__ + +#include +#include + +// devicelockplugin is old. +// data=DATAZ_\QT_TRANSLATIONS_DIR\devicelockplugin.qm QT_TRANSLATIONS_DIR\devicelockplugin.qm +data=DATAZ_\QT_TRANSLATIONS_DIR\devicelocking.qm QT_TRANSLATIONS_DIR\devicelocking.qm + +#endif // __DEVICELOCKPLUGIN_RESOURCES_IBY__ diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/devicelockplugin/rom/devicelockplugin_rom.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/devicelockplugin/rom/devicelockplugin_rom.pri Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,22 @@ +# +# Copyright (c) 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: +# + +symbian { + BLD_INF_RULES.prj_exports += \ + "$${LITERAL_HASH}include" \ + "rom/devicelockplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(devicelockplugin.iby)" \ + "rom/devicelockplugin_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(devicelockplugin_resources.iby)" +} \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/devicelockplugin/secuidevicelockplugin_installer.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/devicelockplugin/secuidevicelockplugin_installer.pkg Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,29 @@ +; secuidevicelockplugin_installer.pkg generated by qmake at 2010-04-26T15:36:02 +; This file is generated by qmake and should not be modified by the user +; + +; Language +&EN + +; SIS header: name, uid, version +#{"secuidevicelockplugin installer"},(0xA000D7CE),1,0,0 + +; Localised Vendor name +%{"Vendor"} + +; Unique Vendor name +:"Vendor" + + +; Manual PKG pre-rules from PRO files +; Default HW/platform dependencies +[0x101F7961],0,0,0,{"S60ProductID"} +[0x102032BE],0,0,0,{"S60ProductID"} +[0x102752AE],0,0,0,{"S60ProductID"} +[0x1028315F],0,0,0,{"S60ProductID"} + +; Default dependency to Qt libraries + + +"M:/sf/app/settingsuis/controlpanelui/src/cpplugins/devicelockplugin/secuidevicelockplugin.sis" - "c:\adm\secuidevicelockplugin.sis" +@"M:/sf/mw/qt/smartinstaller.sis",(0x2002CCCD) diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/devicelockplugin/src/cpdevicelockplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/devicelockplugin/src/cpdevicelockplugin.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,71 @@ +/* + * Copyright (c) 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: + * + */ +#include "cpdevicelockplugin.h" +#include "cpdevicelockpluginview.h" +#include +#include <../../inc/cpsecplugins.h> + + +/* + ***************************************************************** + * Name : CpDeviceLockPlugin + * Parameters : None + * Return value: None + * Description : constructor + ***************************************************************** + */ +CpDeviceLockPlugin::CpDeviceLockPlugin() +{ + RDEBUG("0", 0); +} + + +/* + ***************************************************************** + * Name : ~CpDeviceLockPlugin + * Parameters : None + * Return value: None + * Description : destructor + ***************************************************************** + */ +CpDeviceLockPlugin::~CpDeviceLockPlugin() +{ +} + + +/* + ***************************************************************** + * Name : createSettingFormItemData + * Parameters : CpItemDataHelper + * Return value: QLsit* + * Description : creates a data form for device lock settings + ***************************************************************** + */ +QList CpDeviceLockPlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const +{ + RDEBUG("0", 0); + RDEBUG("using icon", 1); + return QList() + << new CpSettingFormEntryItemDataImpl( + itemDataHelper, + tr("Device lock"), // text + QString(), // description + HbIcon(QString("qtg_large_device_lock")) // icon + ); +} + +Q_EXPORT_PLUGIN2(cpdevicelockplugin, CpDeviceLockPlugin); diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/devicelockplugin/src/cpdevicelockplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/devicelockplugin/src/cpdevicelockplugin.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 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: + * + */ + +#ifndef CPDEVICELOCKPLUGIN_H +#define CPDEVICELOCKPLUGIN_H + +#include +#include + +class CpDeviceLockPlugin : public QObject, public CpPluginInterface +{ + Q_OBJECT + Q_INTERFACES(CpPluginInterface) +public: + /* construtor */ + CpDeviceLockPlugin(); + /* destructor */ + virtual ~CpDeviceLockPlugin(); + /* creates a data form item for device lock settings */ + virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; +}; + +#endif //CPDEVICELOCKPLUGIN_H diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/devicelockplugin/src/cpdevicelockpluginview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/devicelockplugin/src/cpdevicelockpluginview.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,647 @@ +/* + * Copyright (c) 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: + * + */ + +#include "cpdevicelockpluginview.h" +#include +#include +#include +#include +#include +#include "cpremotelockdataformviewitem.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "debug.h" +#include +#include +#include <../../inc/cpsecplugins.h> + + + +/* + ***************************************************************** + * Name : CpDeviceLockPluginView() + * Parameters : QGraphicsItem* + * Return value: None + * Description : constructor + ***************************************************************** + */ +CpDeviceLockPluginView::CpDeviceLockPluginView(QGraphicsItem *parent /*= 0*/) +: CpBaseSettingView(0,parent) + { + QTranslator *translator = new QTranslator(); + QString lang = QLocale::system().name(); + QString path = "Z:/resource/qt/translations/"; + bool fine = translator->load("devicelocking_en.qm", path); + if (fine) + qApp->installTranslator(translator); + + QTranslator *commontranslator = new QTranslator(); + + fine = commontranslator->load("common_" + lang, path); + if (fine) + qApp->installTranslator(commontranslator); + + TSecUi::InitializeLibL(); + mUiSecuSettings = CSecuritySettings::NewL(); + mRemoteLockSettings = CRemoteLockSettings::NewL(); + iALPeriodRep = CRepository::NewL(KCRUidSecuritySettings); + + mRemoteLockSettingClicked = false; + mHack = 0; + HbDataForm *form = qobject_cast (widget()); + if (form) + { + QGraphicsLinearLayout *layout = new QGraphicsLinearLayout( + Qt::Vertical); + QList protoTypeList = form->itemPrototypes(); + protoTypeList.append(new CpRemoteLockDataFormViewItem()); + form->setItemPrototypes(protoTypeList); + form->setHeading(hbTrId("txt_cp_dblist_device_lock")); + + //DataFormModel + formModel = new HbDataFormModel(); + + //lockcode + HbDataFormModelItem + *lockCodeItem = + new HbDataFormModelItem( + static_cast (CpRemoteLockDataFormViewItem::CpCodeEditItem), + hbTrId("txt_devicelocking_dialog_lock_code")); + lockCodeItem->setContentWidgetData("echomode", HbLineEdit::Password); + lockCodeItem->setContentWidgetData("text", "1234"); + lockCodeItem->setContentWidgetData("readonly", true); + form->addConnection(lockCodeItem, SIGNAL(clicked()), this, + SLOT(onLockCodeClicked())); + formModel->appendDataFormItem(lockCodeItem); + + //Autolock period + mAutolockPeriodItem = new HbDataFormModelItem( + HbDataFormModelItem::ComboBoxItem, hbTrId( + "txt_devicelocking_formlabel_automatic_locking")); + TInt autoLockVal; + TInt err = iALPeriodRep->Get(KSettingsAutoLockTime, autoLockVal); + TInt index = GetAutoLockIndex(autoLockVal); + Dprint((_L("Current AL period value %d"),autoLockVal)); + RDEBUG("err", err); + RDEBUG("index", index); + RDEBUG("autoLockVal", autoLockVal); + //TODO: need to set autoLockVal in editor + QStringList autolockPeriodList; + autolockPeriodList << hbTrId("txt_devicelocking_button_off") + << hbTrId("txt_devicelocking_setlabel_val_when_keys_screen") + << hbTrId("txt_devicelocking_setlabel_val_5_minutes") + << hbTrId("txt_devicelocking_setlabel_val_30_minutes") + << hbTrId("txt_devicelocking_setlabel_val_60_minutes"); + mAutolockPeriodItem->setContentWidgetData(QString("items"), + autolockPeriodList); + mAutolockPeriodItem->setContentWidgetData(QString("currentIndex"), + index); + mAutolockPeriodItem->setContentWidgetData(QString("editable"), true); + QVariant themeComboData = mAutolockPeriodItem->contentWidgetData( + QString("currentIndex")); + mThemeComboPrevIndex = themeComboData.toInt(); + + form->addConnection(mAutolockPeriodItem, + SIGNAL(currentIndexChanged(int)), this, + SLOT(onAutoLockChanged(int))); + //form->addConnection(mAutolockPeriodItem,SIGNAL(editTextChanged(const QString&)), this, SLOT(onAutoTextChanged(const QString&))); + formModel->appendDataFormItem(mAutolockPeriodItem); + + //LockWhenSimChange + mLockWhenSimChangeItem = new HbDataFormModelItem( + HbDataFormModelItem::ToggleValueItem, hbTrId( + "txt_devicelocking_formlabel_lock_when_sim_changed")); + TBool lockVal = mUiSecuSettings->IsLockEnabledL( + RMobilePhone::ELockPhoneToICC); + Dprint((_L("LockWhenSimChange enabled %d"),lockVal)); + RDEBUG("lockVal", lockVal); + if (lockVal) + { + mLockWhenSimChangeItem->setContentWidgetData("text", hbTrId( + "txt_remotelocking_button_sim_changed_on")); + mLockWhenSimChangeItem->setContentWidgetData("additionalText", + hbTrId("txt_devicelocking_button_sim_changed_off")); + } + else + { + mLockWhenSimChangeItem->setContentWidgetData("text", hbTrId( + "txt_devicelocking_button_sim_changed_off")); + mLockWhenSimChangeItem->setContentWidgetData("additionalText", + hbTrId("txt_remotelocking_button_sim_changed_on")); + } + mLockWhenSimChangeItem->setContentWidgetData("readonly", true); + mPrevSIMLockData = mLockWhenSimChangeItem->contentWidgetData(QString( + "text")); + + connect(formModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), + this, SLOT(onSIMLockDataChanged(QModelIndex,QModelIndex))); + formModel->appendDataFormItem(mLockWhenSimChangeItem); + + //Remote Lock Setting + TBool enabled = true; + TBool val = mRemoteLockSettings->GetEnabled(enabled); + Dprint((_L("Remote Lock Setting enabled %d"),val)); + RDEBUG("val", val); + mDeviceRemoteLockItem = new HbDataFormModelItem( + HbDataFormModelItem::ToggleValueItem, hbTrId( + "txt_devicelocking_subhead_remote_locking")); + + if (val && enabled) + { + mDeviceRemoteLockItem->setContentWidgetData("text", hbTrId( + "txt_devicelocking_button_remote_on")); + mDeviceRemoteLockItem->setContentWidgetData("additionalText", + hbTrId("txt_devicelocking_button_remote_off")); + } + else + { + mDeviceRemoteLockItem->setContentWidgetData("text", hbTrId( + "txt_devicelocking_button_remote_off")); + mDeviceRemoteLockItem->setContentWidgetData("additionalText", + hbTrId("txt_devicelocking_button_remote_on")); + } + + mPrevRemLockData = mDeviceRemoteLockItem->contentWidgetData(QString( + "text")); + QString s = mPrevRemLockData.toString(); + connect(formModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), + this, SLOT(onRemoteLockDataChanged(QModelIndex,QModelIndex))); + formModel->appendDataFormItem(mDeviceRemoteLockItem); + + //Remote lock message + mRemoteLockMessageItem + = new HbDataFormModelItem( + static_cast (CpRemoteLockDataFormViewItem::CpCodeEditItem), + hbTrId("txt_devicelocking_formlabel_locking_message")); + mRemoteLockMessageItem->setContentWidgetData("echoMode", + HbLineEdit::Password); + mRemoteLockMessageItem->setContentWidgetData("text", "1111"); + mRemoteLockMessageItem->setContentWidgetData("readOnly", true); + + if (mPrevRemLockData.toString() == hbTrId( + "txt_devicelocking_button_remote_on")) + mRemoteLockMessageItem->setEnabled(true); + else + mRemoteLockMessageItem->setEnabled(false); + + form->addConnection(mRemoteLockMessageItem, SIGNAL(clicked()), this, + SLOT(onLockMessageClicked())); + formModel->appendDataFormItem(mRemoteLockMessageItem); + + form->setModel(formModel); + layout->addItem(form); + setLayout(layout); + } + } + + +/* + ***************************************************************** + * Name : ~CpDeviceLockPluginView() + * Parameters : None + * Return value: None + * Description : destructor + ***************************************************************** + */ +CpDeviceLockPluginView::~CpDeviceLockPluginView() + { + TSecUi::UnInitializeLib(); +} + + +/* + ***************************************************************** + * Name : onLockCodeClicked() + * Parameters : None + * Return value: None + * Description : Enables user to change the lock code + ***************************************************************** + */ +void CpDeviceLockPluginView::onLockCodeClicked() + { + Dprint(_L("CpDeviceLockPluginView::onLockCodeClicked()..Enter")); + RDEBUG("0", 0); + mUiSecuSettings->ChangeSecCodeL(); + Dprint(_L("CpDeviceLockPluginView::onLockCodeClicked()..Exit")); +} + + +/* + ************************************************************************ + * Name : onAutoLockChanged() + * Parameters : int + * Return value: None + * Description : handles the data when automatic lock timings are changed + ************************************************************************ + */ +void CpDeviceLockPluginView::onAutoLockChanged(int index) + { + Dprint(_L("CpDeviceLockPluginView::onAutoLockChanged()..Enter")); + RDEBUG("index", index); + if (index != mThemeComboPrevIndex) + { + //TODO: need to set user entered/selected value + TInt lockValue = GetValueAtIndex(index); + TInt newAutoLockVal = mUiSecuSettings->ChangeAutoLockPeriodL( + lockValue); + RDEBUG("newAutoLockVal", newAutoLockVal); + RDEBUG("lockValue", lockValue); + if (newAutoLockVal == lockValue) + { + Dprint(_L("onAutoLockChanged().AL setting success !!")); + RDEBUG("success", 1); + TInt err = iALPeriodRep->Set(KSettingsAutoLockTime, lockValue); + RDEBUG("err", err); + mThemeComboPrevIndex = index; + } + else + { + Dprint(_L("onAutoLockChanged()..Setting to previous value")); + RDEBUG("previous", 0); + QVariant data(mThemeComboPrevIndex); + mAutolockPeriodItem->setContentWidgetData( + QString("currentIndex"), data); + } + + } + Dprint(_L("CpDeviceLockPluginView::onAutoLockChanged()..Exit")); + RDEBUG("0", 0); +} + + +/* + ************************************************************************* + * Name : onLockMessageClicked() + * Parameters : None + * Return value: None + * Description : verifies security code and enables user to change the lock + * message + ************************************************************************** + */ +void CpDeviceLockPluginView::onLockMessageClicked() + { + Dprint(_L("CpDeviceLockPluginView::onLockMessageClicked()..Exit")); + RDEBUG("0", 0); + TBuf remoteLockCode; + TBool remoteLockStatus(EFalse); + TInt retVal = KErrNone; + TInt autoLockVal = -1; + retVal = mUiSecuSettings->ChangeRemoteLockStatusL(remoteLockStatus, + remoteLockCode, autoLockVal); + RDEBUG("retVal", retVal); + RDEBUG("autoLockVal", autoLockVal); + RDEBUG("remoteLockStatus", remoteLockStatus); + if (retVal) + { + Dprint(_L("CpDeviceLockPluginView::onLockMessageClicked()..ChangeRemoteLockStatusL sucess")); + RDEBUG("sucess", 1); + } + else + { + Dprint(_L("CpDeviceLockPluginView::onLockMessageClicked()..ChangeRemoteLockStatusL failed")); + RDEBUG("failed", 0); + } + Dprint(_L("CpDeviceLockPluginView::onLockMessageClicked()..Exit")); + RDEBUG("0", 0); +} + + +/* + ************************************************************************* + * Name : onAutoTextChanged() + * Parameters : QString& + * Return value: None + * Description : + ************************************************************************** + */ +/* + *This slot can be enabled once fix from obit team for this siganl is available + */ + +#if 0 +void CpDeviceLockPluginView::onAutoTextChanged(const QString& aText) + { + Dprint(_L("CpDeviceLockPluginView::onAutoTextChanged()..Enter")); + RDEBUG("0", 0); + //TBool ret = DisplaySecurityDialog(); + Dprint(_L("CpDeviceLockPluginView::onAutoTextChanged()..Exit")); + RDEBUG("0", 0); + } +#endif + +/* + ************************************************************************* + * Name : onRemoteLockDataChanged() + * Parameters : QModelIndex + * Return value: None + * Description : handles the data when remote lock settings is changed + ************************************************************************** + */ +void CpDeviceLockPluginView::onRemoteLockDataChanged(QModelIndex aStartIn,QModelIndex aEndIn) + { + Q_UNUSED(aEndIn); + Dprint(_L("CpDeviceLockPluginView::onRemoteLockDataChanged..Enter")); + RDEBUG("0", 0); + HbDataFormModelItem *item = formModel->itemFromIndex(aStartIn); + + if ((item->type() == HbDataFormModelItem::ToggleValueItem) + && (item->data(HbDataFormModelItem::LabelRole).toString() + == hbTrId("txt_devicelocking_subhead_remote_locking"))) + { + RDEBUG("mHack", mHack); + //The following If-Else condition should be removed once orbit team fix the issue with datachanged() signal + /**************************************************************************************************************** + if ((mHack % 2) == 0) //need to capture second datachanged() signal , not first one. + { + mHack++; + return; + } + else + { + mHack++; + } + /****************************************************************************************************************/ + TInt autoLockVal; + TInt retVal = KErrNone; + TBuf remoteLockCode; + TBool remoteLockStatus(EFalse); + CRemoteLockSettings *remoteLockSetting = CRemoteLockSettings::NewL(); + TInt err = iALPeriodRep->Get(KSettingsAutoLockTime, autoLockVal); + RDEBUG("err", err); + RDEBUG("autoLockVal", autoLockVal); + RDEBUG("retVal", retVal); + QVariant remLockData = mDeviceRemoteLockItem->contentWidgetData( + QString("text")); + if (remLockData.toString() == hbTrId( + "txt_devicelocking_button_remote_on")) + { + remoteLockStatus = ETrue; + retVal = mUiSecuSettings->ChangeRemoteLockStatusL( + remoteLockStatus, remoteLockCode, autoLockVal); + } + else + { + remoteLockStatus = EFalse; + retVal = mUiSecuSettings->ChangeRemoteLockStatusL( + remoteLockStatus, remoteLockCode, autoLockVal); + } + RDEBUG("retVal", retVal); + if (retVal == KErrNone) + { + RDEBUG("remoteLockStatus", remoteLockStatus); + if (remoteLockStatus) + { + if (remoteLockSetting->SetEnabledL(remoteLockCode)) + { + Dprint(_L("CpDeviceLockPluginView::onRemoteLockDataChanged..remoteLockSetting->SetEnabledL success")); + RDEBUG("success", 1); + mPrevRemLockData + = mDeviceRemoteLockItem->contentWidgetData( + QString("text")); + } + else + { + RollbackRemoteLockSettingState(); + Dprint(_L("CpDeviceLockPluginView::onRemoteLockDataChanged..remoteLockSetting->SetEnabledL failed")); + RDEBUG("failed", 0); + } + } + else + { + if (mRemoteLockSettings->SetDisabled()) + { + Dprint(_L("CpDeviceLockPluginView::onRemoteLockDataChanged..remoteLockSetting->SetDisabled success")); + RDEBUG("success", 1); + mPrevRemLockData + = mDeviceRemoteLockItem->contentWidgetData( + QString("text")); + } + else + { + RollbackRemoteLockSettingState(); + Dprint(_L("CpDeviceLockPluginView::onRemoteLockDataChanged..remoteLockSetting->SetDisabled failed")); + RDEBUG("failed", 0); + } + } + } + else + { + Dprint(_L("CpDeviceLockPluginView::onRemoteLockDataChanged..RollbackRemoteLockSettingState")); + RDEBUG("Rollback", 0); + RollbackRemoteLockSettingState(); + } + delete remoteLockSetting; + } + Dprint(_L("CpDeviceLockPluginView::onRemoteLockDataChanged..Exit")); + RDEBUG("0", 0); +} + + +/* + ************************************************************************* + * Name : onSIMLockDataChanged() + * Parameters : QModelIndex + * Return value: None + * Description : handles the data afer Lock when SIM changed settings is + * changed + ************************************************************************** + */ +void CpDeviceLockPluginView::onSIMLockDataChanged(QModelIndex aStartIn, QModelIndex aEndIn) + { + Q_UNUSED(aEndIn); + HbDataFormModelItem *item = formModel->itemFromIndex(aStartIn); + + if ((item->type() == HbDataFormModelItem::ToggleValueItem) + && (item->data(HbDataFormModelItem::LabelRole).toString() + == hbTrId( + "txt_devicelocking_formlabel_lock_when_sim_changed"))) + { + RDEBUG("mHack", mHack); + //The following If-Else condition should be removed once orbit team fix the issue with datachanged() signal + /****************************************************************************************************************/ + if ((mHack % 2) == 0) //need to capture second datachanged() signal , not first one. + { + mHack++; + return; + } + else + { + mHack++; + } + /****************************************************************************************************************/ + + TBool ret = mUiSecuSettings->ChangeSimSecurityL(); + RDEBUG("ret", ret); + if (!ret) + { + /* + * disconnect to datachanged() signal as we are not interested in this signal + * generated as a part of setContentWidgetData() API call below + */ + disconnect(formModel, + SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, + SLOT(onSIMLockDataChanged(QModelIndex,QModelIndex))); + QVariant txt = mLockWhenSimChangeItem->contentWidgetData(QString( + "text")); + QVariant additionalText = + mLockWhenSimChangeItem->contentWidgetData(QString( + "additionalText")); + + mLockWhenSimChangeItem->setContentWidgetData(QString("text"), + additionalText); + mLockWhenSimChangeItem->setContentWidgetData(QString( + "additionalText"), txt); + /* + * Now connect back to datachanged() signal . + */ + connect(formModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), + this, SLOT(onSIMLockDataChanged(QModelIndex,QModelIndex))); + } + } +} + + +/* + ************************************************************************* + * Name : GetAutoLockIndex() + * Parameters : TInt + * Return value: TInt + * Description : returns corresponding index for the given autolock value + ************************************************************************** + */ +TInt CpDeviceLockPluginView::GetAutoLockIndex(TInt aValue) + { + TInt index = 0; + RDEBUG("ret", aValue); + switch (aValue) + { + case 0: + index = 0; + break; + case 65535: + index = 1; + break; + case 5: + index = 2; + break; + case 30: + index = 3; + break; + case 60: + index = 4; + break; + default: + break; + } + RDEBUG("index", index); + return index; + } + + +/* + ************************************************************************* + * Name : GetValueAtIndex() + * Parameters : TInt + * Return value: TInt + * Description : returns the corresponding autolock value for the given + * index. + ************************************************************************** + */ +TInt CpDeviceLockPluginView::GetValueAtIndex(TInt aIndex) + { + TInt value = 0; + RDEBUG("aIndex", aIndex); + switch (aIndex) + { + case 0: + value = 0; + break; + case 1: + value = 65535; + break; + case 2: + value = 5; + break; + case 3: + value = 30; + break; + case 4: + value = 60; + break; + default: + break; + } + RDEBUG("value", value); + return value; +} + + +/* + ************************************************************************* + * Name : RollbackRemoteLockSettingState() + * Parameters : None + * Return value: None + * Description : If Remote Lock Settings fails or user cancels the settings + * then this function resets to previous value. + ************************************************************************** + */ +void CpDeviceLockPluginView::RollbackRemoteLockSettingState() + { + RDEBUG("0", 0); + /* + * disconnect to datachanged() signal as we are not interested in this signal + * generated as a part of setContentWidgetData() API call below + */ + disconnect(formModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), + this, SLOT(onRemoteLockDataChanged(QModelIndex,QModelIndex))); + + QVariant txt = mDeviceRemoteLockItem->contentWidgetData(QString("text")); + QVariant additionaltxt = mDeviceRemoteLockItem->contentWidgetData( + QString("additionalText")); + mDeviceRemoteLockItem->setContentWidgetData(QString("text"), + additionaltxt); + mDeviceRemoteLockItem->setContentWidgetData(QString("additionalText"), + txt); + /* + * Now connect back to datachanged() signal . + */ + connect(formModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, + SLOT(onRemoteLockDataChanged(QModelIndex,QModelIndex))); + + if (mPrevRemLockData.toString() == hbTrId( + "txt_devicelocking_button_remote_on")) + mRemoteLockMessageItem->setEnabled(true); + else + mRemoteLockMessageItem->setEnabled(false); + RDEBUG("0", 0); + } diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/devicelockplugin/src/cpdevicelockpluginview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/devicelockplugin/src/cpdevicelockpluginview.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,100 @@ +/* + * Copyright (c) 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: + * + */ +#ifndef CPDEVICELOCKPLUGINVIEW_H +#define CPDEVICELOCKPLUGINVIEW_H + +#include +#include + +class HbDataFormModel; +class HbDataFormModelItem; +class CSecurityHandler; +class CSecuritySettings; +class SecCodeSettings; +class CRemoteLockSettings; +class CRepository; +class RMobilePhone; + +class CpDeviceLockPluginView : public CpBaseSettingView +{ + Q_OBJECT +public: + explicit CpDeviceLockPluginView(QGraphicsItem *parent = 0); + virtual ~CpDeviceLockPluginView(); +private: + /* Sets the remote lock setting state to previous value */ + void RollbackRemoteLockSettingState(); +private slots: + /* Displays security code dialog and enables user to change the lock code */ + void onLockCodeClicked(); + /* Aske for Security code dialog when Automatic Lock timings are changed*/ + void onAutoLockChanged(int); + /* Displays security Code dialog and then a Input dialog when Remote Lock + * settings is clicked + */ + void onLockMessageClicked(); + /* When Automatic Lock timings text is changed.*/ + /* + * This slot can be enabled once fix from obit team for this siganl is available + */ + // void onAutoTextChanged(const QString& aText); + /* Displays Security code dialog and handles the changed value of the Remote Lock*/ + void onRemoteLockDataChanged(QModelIndex,QModelIndex); + /* Displayes Security code dialog for Lock when SIM changed settings*/ + void onSIMLockDataChanged(QModelIndex,QModelIndex); + /* Returns the index of automatic lock timings for the given autoLock value*/ + TInt GetAutoLockIndex(TInt); + /* Returns the auto lcok value for the given automatic lock timings index*/ + TInt GetValueAtIndex(TInt); +private: + /*Handler for remote lock class*/ + CRemoteLockSettings* mRemoteLockSettings; + /* Handler for Securit Settings class*/ + CSecuritySettings *mUiSecuSettings; + /*Handler to Repository Class*/ + CRepository* iALPeriodRep; + + /* Data Model for DataForm*/ + HbDataFormModel *formModel; + /* Data Item for RemoteLock message*/ + HbDataFormModelItem *mRemoteLockMessageItem; + /* Data Item Remote Lock*/ + HbDataFormModelItem *mDeviceRemoteLockItem; + /* Data item for automatic lock timings*/ + HbDataFormModelItem *mAutolockPeriodItem; + /* Data item for Lock when SIM changed settings*/ + HbDataFormModelItem *mLockWhenSimChangeItem; + /* Input dalog for user to enter Lock message*/ + HbInputDialog* ipDialog; + + /* holds Lock when SIM changed data*/ + QVariant mPrevSIMLockData; + /* holds Remote Lock Value*/ + QVariant mPrevRemLockData; + /* holds the previous Automatic Lock timings index*/ + int mThemeComboPrevIndex; + /* holds the user defined Lock Message*/ + QString mLockMsg; + /* flag set on Remote Lock data changed*/ + TBool mRemoteLockSettingClicked; + /* + * Need to remove this variabl once fix available from orbit team + */ + TInt mHack; +}; + +#endif diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/devicelockplugin/src/cpremotelockdataformviewitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/devicelockplugin/src/cpremotelockdataformviewitem.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,159 @@ +/* + * Copyright (c) 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: + * + */ + +#include "cpremotelockdataformviewitem.h" +#include +#include +#include <../../inc/cpsecplugins.h> + + +/* + ***************************************************************** + * Name : CpRemoteLockDataFormViewItem + * Parameters : QGraphicsItem* + * Return value: None + * Description : constructor + ***************************************************************** + */ +CpRemoteLockDataFormViewItem::CpRemoteLockDataFormViewItem(QGraphicsItem *parent ) +: HbDataFormViewItem(parent) +{ +} + + +/* + ***************************************************************** + * Name : ~CpRemoteLockDataFormViewItem + * Parameters : None + * Return value: None + * Description : destructor + ***************************************************************** + */ +CpRemoteLockDataFormViewItem::~CpRemoteLockDataFormViewItem() +{ +} + + +/* + ***************************************************************** + * Name : createItem + * Parameters : None + * Return value: HbAbstractViewItem* + * Description : creates a HbAbstractViewItem + ***************************************************************** + */ +HbAbstractViewItem* CpRemoteLockDataFormViewItem::createItem() +{ + RDEBUG("0", 0); + return new CpRemoteLockDataFormViewItem(*this); +} + + +/* + ***************************************************************** + * Name : canSetModelIndex + * Parameters : QModelIndex& + * Return value: bool + * Description : + ***************************************************************** + */ +bool CpRemoteLockDataFormViewItem::canSetModelIndex(const QModelIndex &index) const +{ + int type = index.data(HbDataFormModelItem::ItemTypeRole).toInt(); + RDEBUG("type", type); + return ((type == CpRemoteLockItem) || (type == CpCodeEditItem)); +} + + +/* + ***************************************************************** + * Name : createCustomWidget + * Parameters : None + * Return value: HbWidget + * Description : creates a custom widget + ***************************************************************** + */ +HbWidget *CpRemoteLockDataFormViewItem::createCustomWidget() + { + int type = modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt(); + RDEBUG("type", type); + if (type == CpCodeEditItem) + { + CpLockEdit *edit = new CpLockEdit("1234"); + edit->setEchoMode(HbLineEdit::Password); + edit->setReadOnly(true); + return edit; + } + else + { + return 0; + } +} + + +/* + ***************************************************************** + * Name : CpLockEdit + * Parameters : QString&, QGraphicsitem + * Return value: None + * Description : constructor + ***************************************************************** + */ +CpLockEdit::CpLockEdit(const QString &text, QGraphicsItem *parent /*= 0*/) +: HbLineEdit(text,parent) +{ +} + + +/* + ***************************************************************** + * Name : CpLockEdit + * Parameters : None + * Return value: None + * Description : destructor + ***************************************************************** + */ +CpLockEdit::~CpLockEdit() + { + + } + + +/* + ***************************************************************** + * Name : mousePressEvent + * Parameters : QGraphicsSceneMouseEvent* + * Return value: None + * Description : handles mouse events + ***************************************************************** + */ +void CpLockEdit::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + RDEBUG("0", 0); + if (event->button() != Qt::LeftButton) { + event->ignore(); + return; + } + + if (rect().contains(event->pos())) { + emit clicked(); + event->accept(); + } + else { + event->ignore(); + } +} diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/devicelockplugin/src/cpremotelockdataformviewitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/devicelockplugin/src/cpremotelockdataformviewitem.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,64 @@ +/* + * Copyright (c) 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: + * + */ + + +#ifndef CPREMOTELOCKDATAFORMVIEWITEM_H +#define CPREMOTELOCKDATAFORMVIEWITEM_H + +//#include +#include +#include +#include + +class CpRemoteLockDataFormViewItem : public HbDataFormViewItem +{ + Q_OBJECT +public: + enum { CpRemoteLockItem = HbDataFormModelItem::CustomItemBase + 10, + CpCodeEditItem = CpRemoteLockItem + 1 }; + + /* Constructor */ + explicit CpRemoteLockDataFormViewItem(QGraphicsItem *parent = 0); + /* Destructor */ + virtual ~CpRemoteLockDataFormViewItem(); + /* creates a view item */ + virtual HbAbstractViewItem* createItem(); + /**/ + virtual bool canSetModelIndex(const QModelIndex &index) const; +protected: + /* creates a custom widget */ + virtual HbWidget* createCustomWidget(); +}; + + +class CpLockEdit : public HbLineEdit +{ + Q_OBJECT +public: + /* constructor */ + explicit CpLockEdit(const QString &text, QGraphicsItem *parent = 0); + /* destructor */ + virtual ~CpLockEdit(); + /* handles mouse events*/ + void mousePressEvent(QGraphicsSceneMouseEvent *event); +signals: + /* signal when edit box is clicked*/ + void clicked(); +}; + +#endif //CPREMOTELOCKDATAFORMVIEWITEM_H + diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/devicelockplugin/src/debug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/devicelockplugin/src/debug.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 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: + * + */ + +#if defined (_DEBUG) + +_LIT( KLogFile, "Devicelockplugin.log" ); +_LIT( KLogDir, "Devicelockplugin" ); + +#include +#include +#include +#include + +inline void FWrite (TRefByValue aFmt,...) + { + VA_LIST list; + VA_START( list, aFmt ); + RFileLogger::WriteFormat( KLogDir,KLogFile,EFileLoggingModeAppend ,TPtrC(aFmt) ,list ); + } + + #define Dprint(arg...) FWrite arg; +#else + #define Dprint(arg...) +#endif // _DEBUG + + diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/inc/cpsecplugins.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/inc/cpsecplugins.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 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"" + * 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: + * + */ + +#ifndef CPSECPLUGINS_H +#define CPSECPLUGINS_H + +#include + +// #if defined _DEBUG +#ifdef _DEBUG +#define RDEBUG( x, y ) RDebug::Printf( "%s %s (%u) %s=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, x, y ); +#else +#define RDEBUG( x, y ) +#endif + +#endif //CPSECPLUGINS_H diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/simpincodeplugin/inc/cppincodeplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/simpincodeplugin/inc/cppincodeplugin.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 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"" + * 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: + * + */ + +#ifndef CPPINCODEPLUGIN_H +#define CPPINCODEPLUGIN_H + +// System includes +#include + +// User includes +#include + +// Class declaration +class CpPinCodePlugin : public QObject, public CpPluginInterface +{ + Q_OBJECT + Q_INTERFACES(CpPluginInterface) + +public: + CpPinCodePlugin(); + virtual ~CpPinCodePlugin(); + virtual QList createSettingFormItemData( + CpItemDataHelper &itemDataHelper) const; +}; + +#endif //CPPINCODEPLUGIN_H diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/simpincodeplugin/inc/cppincodepluginview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/simpincodeplugin/inc/cppincodepluginview.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 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"" + * 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: + * + */ + +#ifndef CPPINCODEPLUGINVIEW_H +#define CPPINCODEPLUGINVIEW_H + +// System includes +#include + +// Forward declarations +class SecCodeSettings; +class HbDataFormModelItem; +class HbDataFormModel; + +// Class declaration +class CpPinCodePluginView : public CpBaseSettingView +{ + Q_OBJECT + +public: + explicit CpPinCodePluginView(QGraphicsItem *parent = 0); + virtual ~CpPinCodePluginView(); + +private slots: + void changePinCode(); + void changePin2Code(); + void toggleChange(QModelIndex startIn, QModelIndex endIn); + +private: + SecCodeSettings *mSecCodeSettings; + HbDataFormModel *mFormModel; + HbDataFormModelItem *mPinCodeRequestItem; +}; + +#endif //CPPINCODEPLUGINVIEW_H diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/simpincodeplugin/inc/seccodeedit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/simpincodeplugin/inc/seccodeedit.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 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" + * 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: + * + */ + +#ifndef SECCODEEDIT_H +#define SECCODEEDIT_H + +// System includes +#include + +// Class declaration +class SecCodeEdit : public HbLineEdit +{ + Q_OBJECT + +public: + explicit SecCodeEdit(const QString &text, QGraphicsItem *parent = 0); + virtual ~SecCodeEdit(); + void mousePressEvent(QGraphicsSceneMouseEvent *event); + +signals: + void clicked(); +}; + +#endif //SECCODEEDIT_H diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/simpincodeplugin/inc/seccodeeditdataformviewitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/simpincodeplugin/inc/seccodeeditdataformviewitem.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 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"" + * 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: + * + */ + +#ifndef SECCODEEDITDATAFORMVIEWITEM_H +#define SECCODEEDITDATAFORMVIEWITEM_H + +// System includes +#include +#include + +// User includes +#include "seccodeuiglobal.h" + +// Class declaration +class SecCodeEditDataFormViewItem : public HbDataFormViewItem +{ + Q_OBJECT + +public: + enum { SecCodeEditItem = HbDataFormModelItem::CustomItemBase + 1 }; + explicit SecCodeEditDataFormViewItem(QGraphicsItem *parent = 0); + virtual ~SecCodeEditDataFormViewItem(); + virtual HbAbstractViewItem* createItem(); + virtual bool canSetModelIndex(const QModelIndex &index) const; + +protected: + virtual HbWidget* createCustomWidget(); +}; + +#endif //SECCODEEDITDATAFORMVIEWITEM_H diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/simpincodeplugin/inc/seccodemodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/simpincodeplugin/inc/seccodemodel.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 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"" + * 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: + * + */ + +#ifndef SECCODEMODEL_H +#define SECCODEMODEL_H + +// System includes +#include + +// Forward declarations +class SecCodeModelPrivate; + +// Class declaration +class SecCodeModel : public QObject +{ + Q_OBJECT + +public: + SecCodeModel(QObject *parent = 0); + virtual ~SecCodeModel(); + bool pinCodeRequest() const; + bool changePinCodeRequest(); + int changePinCode(); + int changePin2Code(); + +private: // data + SecCodeModelPrivate *d_ptr; +}; + +#endif //SECCODEMODEL_H diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/simpincodeplugin/inc/seccodemodel_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/simpincodeplugin/inc/seccodemodel_p.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 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"" + * 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: + * + */ + +#ifndef SECCODEMODEL_P_H +#define SECCODEMODEL_P_H + +// System includes +#include +#include +// Class declaration +class SecCodeModelPrivate +{ +public: + static SecCodeModelPrivate* NewL(); + SecCodeModelPrivate(); + ~SecCodeModelPrivate(); + bool pinCodeRequest() const; + bool changePinCodeRequest(); + int changePinCode(); + int changePin2Code(); + +private: + void ConstructL(); + +private: // data + //to launch SecUI + CSecuritySettings* iSecurity; +}; + +#endif //SECCODEMODEL_P_H diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/simpincodeplugin/inc/seccodesettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/simpincodeplugin/inc/seccodesettings.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 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"" + * 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: + * + */ + +#ifndef SECCODESETTINGS_H +#define SECCODESETTINGS_H + +// System includes +#include +#include "seccodeuiglobal.h" + +// Forward declarations +class SecCodeSettingsPrivate; + +// Class declaration +class SecCodeSettings : public QObject +{ + Q_OBJECT + +public: + explicit SecCodeSettings(QObject *parent = 0); + virtual ~SecCodeSettings(); + bool pinCodeRequest() const; + bool changePinCodeRequest(); + void changePinCode(); + void changePin2Code(); + +private: + SecCodeSettingsPrivate *d_ptr; +}; + +#endif //SECCODESETTINGS_H diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/simpincodeplugin/inc/seccodeuiglobal.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/simpincodeplugin/inc/seccodeuiglobal.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 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: + * + */ + +#ifndef SECCODEUIGLOBAL_H +#define SECCODEUIGLOBAL_H + +// System includes +#include + +namespace SecCode +{ + enum SecCodeErr + { + ErrNone = 0, + ErrGsm0707IncorrectPassword, + ErrAccessDenied, + ErrGsmSSPasswordAttemptsViolation, + ErrLocked, + ErrGsm0707OperationNotAllowed, + ErrGsm0707SIMPuk2Required, + ErrAbort, + }; +} + +#endif //SECCODEUIGLOBAL_H diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/simpincodeplugin/pincodeplugin.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/simpincodeplugin/pincodeplugin.pri Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,33 @@ +# +# Copyright (c) 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" +# 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: cppincodeplugin source files +# + +# Input +HEADERS += inc/*.h + +SOURCES += src/cppincodeplugin.cpp \ + src/cppincodepluginview.cpp \ + src/seccodesettings.cpp \ + src/seccodeedit.cpp \ + src/seccodeeditdataformviewitem.cpp \ + src/seccodemodel.cpp + +symbian : { + SOURCES += src/seccodemodel_symbian.cpp +} + +win32 : { + SOURCES += src/seccodemodel_win.cpp +} \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/simpincodeplugin/pincodeplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/simpincodeplugin/pincodeplugin.pro Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,30 @@ +# +# Copyright (c) 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" +# 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: +# + +TEMPLATE = lib +TARGET = cppincodeplugin + +CONFIG += hb plugin + +include ( ../cpplugincommon.pri ) +include ( pincodeplugin.pri ) +include ( rom/pincodeplugin_rom.pri ) + +LIBS += -lsecui + +symbian : { + TARGET.UID3 = 0x2002E682 +} diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/simpincodeplugin/rom/pincodeplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/simpincodeplugin/rom/pincodeplugin.iby Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 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: +* +*/ + +#ifndef __PINCODEPLUGIN_IBY__ +#define __PINCODEPLUGIN_IBY__ + +#include +#include + +// pincodeplugin.iby should export cppincodeplugin.dll because controlpanelui.iby does NOT exports cppincodeplugin.dll +file=ABI_DIR\BUILD_DIR\cppincodeplugin.dll SHARED_LIB_DIR\cppincodeplugin.dll + +data=/epoc32/data/c/resource/qt/plugins/controlpanel/cppincodeplugin.qtplugin resource/qt/plugins/controlpanel/cppincodeplugin.qtplugin + +#endif diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/simpincodeplugin/rom/pincodeplugin_rom.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/simpincodeplugin/rom/pincodeplugin_rom.pri Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,21 @@ +# +# Copyright (c) 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: +# + +symbian { + BLD_INF_RULES.prj_exports += \ + "$${LITERAL_HASH}include" \ + "rom/pincodeplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(pincodeplugin.iby)" +} \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/simpincodeplugin/src/cppincodeplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/simpincodeplugin/src/cppincodeplugin.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 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"" + * 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: + * + */ + +// System includes +#include +#include <../../inc/cpsecplugins.h> + +// User includes +#include "cppincodeplugin.h" +#include "cppincodepluginview.h" + +/*! + \class CpPinCodePlugin + \brief Pin Code Setting plugin class + + This class is used to create PIN code setting +*/ + +// ======== LOCAL FUNCTIONS ======== + +/*! + Constructor +*/ +CpPinCodePlugin::CpPinCodePlugin() +{ +RDEBUG("0", 0); +} + +/*! + Destructor +*/ +CpPinCodePlugin::~CpPinCodePlugin() +{ +} + +/*! + Create PinCode setting +*/ +QList CpPinCodePlugin::createSettingFormItemData( + CpItemDataHelper &itemDataHelper) const +{ + RDEBUG("0", 0); + RDEBUG("using icon", 1); + return QList() + << new CpSettingFormEntryItemDataImpl + (itemDataHelper, tr("PIN code"), QString(), HbIcon(QString("qtg_large_pin_code")) ); +} + +/*! + Export plugin +*/ +Q_EXPORT_PLUGIN2(cppincodeplugin, CpPinCodePlugin); diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/simpincodeplugin/src/cppincodepluginview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/simpincodeplugin/src/cppincodepluginview.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,158 @@ +/* + * Copyright (c) 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"" + * 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: + * + */ + +// System includes +#include +#include +#include +#include +#include +#include + +// User includes +#include "cppincodepluginview.h" +#include <../../inc/cpsecplugins.h> + +/*! + \class CpPinCodePluginView + \brief Pin Code Setting view class + + This class is used to create PIN code setting view +*/ + +// ======== LOCAL FUNCTIONS ======== + +/*! + Constructor +*/ +CpPinCodePluginView::CpPinCodePluginView(QGraphicsItem *parent /*= 0*/) + : CpBaseSettingView(0,parent), mSecCodeSettings(new SecCodeSettings()) +{ + RDEBUG("0", 0); + HbDataForm *form = qobject_cast(widget()); + if (form) { + QList protoTypeList = form->itemPrototypes(); + protoTypeList.append(new SecCodeEditDataFormViewItem()); + form->setItemPrototypes(protoTypeList); + form->setHeading(tr("PIN code")); + + mFormModel = new HbDataFormModel(this); + mPinCodeRequestItem = new HbDataFormModelItem( + HbDataFormModelItem::ToggleValueItem, tr("PIN code requests")); + + bool currentPinCodeRequest = mSecCodeSettings->pinCodeRequest(); + if (currentPinCodeRequest) { + mPinCodeRequestItem->setContentWidgetData("text", tr("On")); + mPinCodeRequestItem->setContentWidgetData("additionalText", tr("On")); + } else { + mPinCodeRequestItem->setContentWidgetData("text",tr("Off")); + mPinCodeRequestItem->setContentWidgetData("additionalText", tr("Off")); + } + RDEBUG("form->addConnection", 1); + connect(mFormModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), + this, SLOT(toggleChange(QModelIndex, QModelIndex))); + mFormModel->appendDataFormItem(mPinCodeRequestItem); + + HbDataFormModelItem *pinCodeItem = new HbDataFormModelItem( + static_cast + (SecCodeEditDataFormViewItem::SecCodeEditItem), tr("PIN code")); + pinCodeItem->setContentWidgetData("echoMode", HbLineEdit::Password); + pinCodeItem->setContentWidgetData("text", "1111"); + pinCodeItem->setContentWidgetData("readOnly", true); + form->addConnection(pinCodeItem, SIGNAL(clicked()), this, + SLOT(changePinCode())); + mFormModel->appendDataFormItem(pinCodeItem); + + HbDataFormModelItem *pin2CodeItem = new HbDataFormModelItem( + static_cast + (SecCodeEditDataFormViewItem::SecCodeEditItem), tr("PIN2 code")); + pin2CodeItem->setContentWidgetData("echoMode", HbLineEdit::Password); + pin2CodeItem->setContentWidgetData("text", "1111"); + pin2CodeItem->setContentWidgetData("readOnly", true); + form->addConnection(pin2CodeItem, SIGNAL(clicked()), this, + SLOT(changePin2Code())); + mFormModel->appendDataFormItem(pin2CodeItem); + RDEBUG("form->setModel", 1); + form->setModel(mFormModel); + } +} + +/*! + Destructor +*/ +CpPinCodePluginView::~CpPinCodePluginView() +{ + delete mSecCodeSettings; +} + +/*! + response for click pin code request +*/ +void CpPinCodePluginView::toggleChange(QModelIndex startIn, + QModelIndex /*endIn*/) +{ + RDEBUG("0", 0); + HbDataFormModelItem *item = mFormModel->itemFromIndex(startIn); + if(item->type() == HbDataFormModelItem::ToggleValueItem) { + if (mSecCodeSettings->changePinCodeRequest()) { + RDEBUG("got changePinCodeRequest", 1); + disconnect(mFormModel, + SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, + SLOT(toggleChange(QModelIndex, QModelIndex))); + RDEBUG("disconnected", 1); + QString text = mPinCodeRequestItem->contentWidgetData( + "text").toString(); + if (0 == text.compare("On")) { + mPinCodeRequestItem->setContentWidgetData("text", + tr("Off")); + mPinCodeRequestItem->setContentWidgetData("additionalText", + tr("Off")); + } else { + mPinCodeRequestItem->setContentWidgetData("text", + tr("On")); + mPinCodeRequestItem->setContentWidgetData("additionalText", + tr("On")); + } + RDEBUG("reconnect", 1); + connect(mFormModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), + this, SLOT(toggleChange(QModelIndex, QModelIndex))); + } + else + { + RDEBUG("value was not changed", 0); + } + } + RDEBUG("0", 0); +} + +/*! + response for click pin code +*/ +void CpPinCodePluginView::changePinCode() +{ + RDEBUG("0", 0); + mSecCodeSettings->changePinCode(); +} + +/*! + response for click pin2 code +*/ +void CpPinCodePluginView::changePin2Code() +{ + RDEBUG("0", 0); + mSecCodeSettings->changePin2Code(); +} diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/simpincodeplugin/src/seccodeedit.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/simpincodeplugin/src/seccodeedit.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 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"" + * 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: + * + */ + +// System includes +#include + +// User includes +#include "seccodeedit.h" +#include <../../inc/cpsecplugins.h> + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor +*/ +SecCodeEdit::SecCodeEdit(const QString &text, QGraphicsItem *parent/*= 0*/) + : HbLineEdit(text, parent) +{ +} + +/*! + Destructor +*/ +SecCodeEdit::~SecCodeEdit() +{ +} + +/*! + Mouse Press Event +*/ +void SecCodeEdit::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + RDEBUG("0", 0); + if (event->button() != Qt::LeftButton) { + event->ignore(); + return; + } + + if (rect().contains(event->pos())) { + emit clicked(); + event->accept(); + } else { + event->ignore(); + } +} diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/simpincodeplugin/src/seccodeeditdataformviewitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/simpincodeplugin/src/seccodeeditdataformviewitem.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 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"" + * 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: + * + */ + +// User includes +#include "seccodeeditdataformviewitem.h" +#include "seccodeedit.h" +#include <../../inc/cpsecplugins.h> + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor +*/ +SecCodeEditDataFormViewItem::SecCodeEditDataFormViewItem( + QGraphicsItem *parent): HbDataFormViewItem(parent) +{ + RDEBUG("0", 0); +} + +/*! + Destructor +*/ +SecCodeEditDataFormViewItem::~SecCodeEditDataFormViewItem() +{ +} + +/*! + Create Item +*/ +HbAbstractViewItem *SecCodeEditDataFormViewItem::createItem() +{ + RDEBUG("0", 0); + return new SecCodeEditDataFormViewItem( *this); +} + +/*! + Create Item +*/ +bool SecCodeEditDataFormViewItem::canSetModelIndex( + const QModelIndex &index) const +{ + int type = index.data(HbDataFormModelItem::ItemTypeRole).toInt(); + RDEBUG("type", type); + return type == SecCodeEditItem; +} + +/*! + Create Custom Widget +*/ +HbWidget *SecCodeEditDataFormViewItem::createCustomWidget() +{ + int type = modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt(); + RDEBUG("type", type); + + if (type == SecCodeEditItem) { + SecCodeEdit *edit = new SecCodeEdit("1234"); + edit->setEchoMode(HbLineEdit::Password); + RDEBUG("edit->setReadOnly", 1); + edit->setReadOnly(true); + return edit; + } + RDEBUG("0", 0); + return 0; +} diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/simpincodeplugin/src/seccodemodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/simpincodeplugin/src/seccodemodel.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,76 @@ +/* + * Copyright (c) 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"" + * 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: + * + */ + +// User includes +#include "seccodemodel.h" +#include "seccodemodel_p.h" +#include <../../inc/cpsecplugins.h> + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor +*/ +SecCodeModel::SecCodeModel(QObject *parent/*= 0*/) + : QObject(parent) +{ + QT_TRAP_THROWING(d_ptr = SecCodeModelPrivate::NewL()); +} + +/*! + Destructor +*/ +SecCodeModel::~SecCodeModel() +{ + delete d_ptr; +} + +/*! + Get Pin Code Request State +*/ +bool SecCodeModel::pinCodeRequest() const +{ + RDEBUG("0", 0); + return d_ptr->pinCodeRequest(); +} + +/*! + Change Pin Code +*/ +bool SecCodeModel::changePinCodeRequest() +{ + RDEBUG("0", 0); + return d_ptr->changePinCodeRequest(); +} + +/*! + Change Pin Code +*/ +int SecCodeModel::changePinCode() +{ + RDEBUG("0", 0); + return d_ptr->changePinCode(); +} + +/*! + Change Pin2 Code +*/ +int SecCodeModel::changePin2Code() +{ + RDEBUG("0", 0); + return d_ptr->changePin2Code(); +} diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/simpincodeplugin/src/seccodemodel_symbian.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/simpincodeplugin/src/seccodemodel_symbian.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,113 @@ +/* + * Copyright (c) 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"" + * 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: + * + */ + +// System includes +#include +#include +#include + +// User includes +#include "seccodemodel_p.h" +#include "seccodeuiglobal.h" +#include <../../inc/cpsecplugins.h> + +// ======== MEMBER FUNCTIONS ======== + +/*! + NewL +*/ +SecCodeModelPrivate* SecCodeModelPrivate::NewL() +{ + SecCodeModelPrivate* self = new (ELeave) SecCodeModelPrivate(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); //self + return self; +} + +/*! + SecCodeModelPrivate +*/ +SecCodeModelPrivate::SecCodeModelPrivate() +{ +} + +/*! + ConstructL +*/ +void SecCodeModelPrivate::ConstructL() +{ + RDEBUG("0", 0); + iSecurity = CSecuritySettings::NewL(); +} + +/*! + Destructor +*/ +SecCodeModelPrivate::~SecCodeModelPrivate() +{ + if (iSecurity) { + delete iSecurity; + } +} + +/*! + Get Pin Code Request State +*/ +bool SecCodeModelPrivate::pinCodeRequest() const +{ + RDEBUG("0", 0); + bool isLockEnabled = false; + QT_TRAP_THROWING(isLockEnabled = iSecurity->IsLockEnabledL( + RMobilePhone::ELockICC)); + RDEBUG("isLockEnabled", isLockEnabled); + return isLockEnabled; +} + +/*! + Get the Change Pin Remaining Attempts +*/ +bool SecCodeModelPrivate::changePinCodeRequest() +{ + RDEBUG("0", 0); + bool result = false; + QT_TRAP_THROWING(result =iSecurity->ChangePinRequestL()); + RDEBUG("result", result); + return result; +} + +/*! + Change Pin Code +*/ +int SecCodeModelPrivate::changePinCode() +{ + RDEBUG("0", 0); + QT_TRAP_THROWING(iSecurity->ChangePinL()); + RDEBUG("0", 0); + return 0; +} + +/*! + Change Pin2 Code +*/ +int SecCodeModelPrivate::changePin2Code() +{ + RDEBUG("0", 0); + QT_TRAP_THROWING(iSecurity->ChangePin2L()); + RDEBUG("0", 0); + return 0; +} diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/simpincodeplugin/src/seccodemodel_win.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/simpincodeplugin/src/seccodemodel_win.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,103 @@ +/* + * Copyright (c) 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"" + * 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: + * + */ + +// User includes +#include "seccodemodel_p.h" +#include <../../inc/cpsecplugins.h> + +// ======== MEMBER FUNCTIONS ======== +/*! + NewL +*/ +SecCodeModelPrivate* SecCodeModelPrivate::NewL() +{ + return NULL; +} + +/*! + Constructor +*/ +SecCodeModelPrivate::SecCodeModelPrivate() +{ +} + +/*! + ConstructL +*/ +void SecCodeModelPrivate::ConstructL() +{ + +} + +/*! + Destructor +*/ +SecCodeModelPrivate::~SecCodeModelPrivate() +{ +} + +/*! + Get Pin Code Request State +*/ +bool SecCodeModelPrivate::pinCodeRequest() const +{ + RDEBUG("0", 0); + QString information; + information = QString("Emulator NOT supported!"); + HbMessageBox messageBox(information); + messageBox.exec(); + return false; +} + +/*! + Get the Change Pin Remaining Attempts +*/ +bool SecCodeModelPrivate::changePinCodeRequest() +{ + RDEBUG("0", 0); + QString information; + information = QString("Emulator NOT supported!"); + HbMessageBox messageBox(information); + messageBox.exec(); + return true; +} + +/*! + Change Pin Code +*/ +int SecCodeModelPrivate::changePinCode() +{ + RDEBUG("0", 0); + QString information; + information = QString("Emulator NOT supported!"); + HbMessageBox messageBox(information); + messageBox.exec(); + return 0; +} + +/*! + Change Pin2 Code +*/ +int SecCodeModelPrivate::changePin2Code() +{ + RDEBUG("0", 0); + QString information; + information = QString("Emulator NOT supported!"); + HbMessageBox messageBox(information); + messageBox.exec(); + return 0; +} diff -r 63339781d179 -r 09b1ac925e3f cpsecplugins/simpincodeplugin/src/seccodesettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpsecplugins/simpincodeplugin/src/seccodesettings.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,93 @@ +/* + * Copyright (c) 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"" + * 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: + * + */ + +// User includes +#include "seccodesettings.h" +#include "seccodemodel.h" +#include <../../inc/cpsecplugins.h> + +// Class declaration +class SecCodeSettingsPrivate +{ +public: + SecCodeSettingsPrivate() + { + mSecCodeModel = new SecCodeModel(); + } + + ~SecCodeSettingsPrivate() + { + delete mSecCodeModel; + } + + SecCodeModel *mSecCodeModel; +}; + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor +*/ +SecCodeSettings::SecCodeSettings(QObject * parent /*= 0*/) + : QObject(parent), d_ptr(new SecCodeSettingsPrivate()) +{ +RDEBUG("0", 0); +} + +/*! + Destructor +*/ +SecCodeSettings::~SecCodeSettings() +{ + delete d_ptr; +} + +/*! + Get Pin Code Request +*/ +bool SecCodeSettings::pinCodeRequest() const +{ + RDEBUG("0", 0); + return d_ptr->mSecCodeModel->pinCodeRequest(); +} + +/*! + Change Pin Code request +*/ +bool SecCodeSettings::changePinCodeRequest() +{ + RDEBUG("0", 0); + return d_ptr->mSecCodeModel->changePinCodeRequest(); +} + +/*! + Change Pin Code +*/ +void SecCodeSettings::changePinCode() +{ + RDEBUG("0", 0); + d_ptr->mSecCodeModel->changePinCode(); +} + +/*! + Change Pin2 Code +*/ +void SecCodeSettings::changePin2Code() +{ + RDEBUG("0", 0); + d_ptr->mSecCodeModel->changePin2Code(); +} diff -r 63339781d179 -r 09b1ac925e3f devencdiskutils/DevEncCommonUtils/src/DevEncDiskUtils.cpp --- a/devencdiskutils/DevEncCommonUtils/src/DevEncDiskUtils.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/devencdiskutils/DevEncCommonUtils/src/DevEncDiskUtils.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -255,23 +255,18 @@ if (!err) return err; TInt64 memoryWarningSpace(0); - TRAP(err, memoryWarningSpace = FindWarningLevelTresholdL( aNumber )); + TRAP(err, memoryWarningSpace = FindWarningLevelTresholdL()); if (!err) return err; DFLOG2( "CDevEncDiskUtils::DiskFinalize => memoryCriticalSpace = %d", (TInt) memoryCriticalSpace ); DFLOG2( "CDevEncDiskUtils::DiskFinalize => memoryWarningSpace = %d", (TInt) memoryWarningSpace ); - //create the number of files needed to fill the mmc or phone memory free space + //create the number of files needed to fill the mmc free space while( freeSpace ) { - TInt64 newMemoryWarningSpace(0); - if( aNumber == EDriveC ) - { - // The real warning space is a percentage of the free space. This applies only on drive C. - newMemoryWarningSpace = ( TInt64 ) ( volumeInfo.iSize*( 100 - memoryWarningSpace ) ) / 100; - } - + /* The real warning space is a percentage of the free space */ + TInt64 newMemoryWarningSpace = ( TInt64 ) ( volumeInfo.iSize*( 100 - memoryWarningSpace ) ) / 100; DFLOG2( "CDevEncDiskUtils::DiskFinalize => newMemoryWarningSpace = %d", (TInt) newMemoryWarningSpace ); if( TInt64( volumeInfo.iFree ) > TInt64( KMaxInt ) ) @@ -280,14 +275,7 @@ } else { - if( aNumber == EDriveC ) - { - size = Max( 0LL, TInt64( volumeInfo.iFree ) - memoryCriticalSpace - newMemoryWarningSpace ); - } - else - { - size = Max( 0LL, TInt64( volumeInfo.iFree ) - memoryCriticalSpace - memoryWarningSpace ); - } + size = Max( 0LL, TInt64( volumeInfo.iFree ) - memoryCriticalSpace - newMemoryWarningSpace ); } TFileName temp; @@ -314,19 +302,9 @@ if( err ) DFLOG2( "..fs.Volume fail %d", err ); - if( aNumber == EDriveC ) + if( TInt64( volumeInfo.iFree ) <= memoryCriticalSpace + newMemoryWarningSpace ) { - if( TInt64( volumeInfo.iFree ) <= memoryCriticalSpace + newMemoryWarningSpace ) - { - freeSpace = EFalse; - } - } - else - { - if( TInt64( volumeInfo.iFree ) <= memoryCriticalSpace + memoryWarningSpace ) - { - freeSpace = EFalse; - } + freeSpace = EFalse; } } @@ -370,16 +348,9 @@ // CDevEncDiskUtils::FindWarningLevelTresholdL() // // -------------------------------------------------------------------------- -TInt64 CDevEncDiskUtils::FindWarningLevelTresholdL( const TDriveNumber aNumber ) +TInt64 CDevEncDiskUtils::FindWarningLevelTresholdL() { - if( aNumber == EDriveC ) - { - return (TInt64) FindValueL( KCRUidUiklaf, KUikOODDiskFreeSpaceWarningNoteLevel ); - } - else - { - return (TInt64) FindValueL( KCRUidUiklaf, KUikOODDiskFreeSpaceWarningNoteLevelMassMemory ); - } + return (TInt64) FindValueL( KCRUidUiklaf, /*KUikOODDiskWarningThreshold*/KUikOODDiskFreeSpaceWarningNoteLevel ); } // End of file diff -r 63339781d179 -r 09b1ac925e3f devencdiskutils/DevEncCommonUtils/src/DevEncKeyUtils.cpp --- a/devencdiskutils/DevEncCommonUtils/src/DevEncKeyUtils.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/devencdiskutils/DevEncCommonUtils/src/DevEncKeyUtils.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -24,6 +24,7 @@ #include "DevEncLog.h" #include "DevEncUids.hrh" + #include #include //#include // for system path literals diff -r 63339781d179 -r 09b1ac925e3f gba/gbaapi/group/gba.mmp --- a/gba/gbaapi/group/gba.mmp Thu Aug 19 10:45:23 2010 +0300 +++ b/gba/gbaapi/group/gba.mmp Tue Aug 31 16:04:40 2010 +0300 @@ -23,8 +23,6 @@ VENDORID VID_DEFAULT CAPABILITY CAP_CLIENT_DLL -SMPSAFE - USERINCLUDE ../inc USERINCLUDE ../../inc diff -r 63339781d179 -r 09b1ac925e3f gba/gbafilter/group/httpfiltergba.mmp --- a/gba/gbafilter/group/httpfiltergba.mmp Thu Aug 19 10:45:23 2010 +0300 +++ b/gba/gbafilter/group/httpfiltergba.mmp Tue Aug 31 16:04:40 2010 +0300 @@ -26,8 +26,6 @@ UID 0x10009D8D 0x20029F09 VENDORID VID_DEFAULT -SMPSAFE - SOURCEPATH ../src SOURCE HTTPFilterGBAMain.cpp HTTPFilterGBA.cpp diff -r 63339781d179 -r 09b1ac925e3f gba/gbaserver/group/gbaserver.mmp --- a/gba/gbaserver/group/gbaserver.mmp Thu Aug 19 10:45:23 2010 +0300 +++ b/gba/gbaserver/group/gbaserver.mmp Tue Aug 31 16:04:40 2010 +0300 @@ -24,8 +24,6 @@ VENDORID VID_DEFAULT CAPABILITY CAP_SERVER NetworkControl -SMPSAFE - USERINCLUDE ../inc USERINCLUDE ../../inc diff -r 63339781d179 -r 09b1ac925e3f gba/gbaserver/inc/dataretriever.h --- a/gba/gbaserver/inc/dataretriever.h Thu Aug 19 10:45:23 2010 +0300 +++ b/gba/gbaserver/inc/dataretriever.h Tue Aug 31 16:04:40 2010 +0300 @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include "M3GPPAuthenticationCallback.h" @@ -147,7 +147,7 @@ RSocketServ iSockServ; C3GPPBootstrapHttpHandler* iHttpHandler; // we own this MBootstrapCallBack* iBootstrapCallBack; // don't own this - RCmManagerExt iCmManagerExt; + RCmManager iCmManager; }; diff -r 63339781d179 -r 09b1ac925e3f gba/gbaserver/src/dataretriever.cpp --- a/gba/gbaserver/src/dataretriever.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/gba/gbaserver/src/dataretriever.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -21,10 +21,9 @@ #include #include #include -#include #include #include -#include +#include #include #include "dataretriever.h" #include "GbaCommon.h" @@ -103,7 +102,7 @@ { iHttpHandler = C3GPPBootstrapHttpHandler::NewL( this, iBootstrapCallBack ); iInternalState = EReadyForRequest; - iCmManagerExt.OpenL(); + iCmManager.OpenL(); } @@ -120,7 +119,7 @@ iHTTPSession.Close(); iConnection.Close(); iSockServ.Close(); - iCmManagerExt.Close(); + iCmManager.Close(); if ( iInternalState == EMakeRequestCalled ) { @@ -356,11 +355,11 @@ RArray destIdArray; CleanupClosePushL( destIdArray ); CleanupCounter++; - iCmManagerExt.AllDestinationsL( destIdArray ); + iCmManager.AllDestinationsL( destIdArray ); for ( TInt i = 0; i< destIdArray.Count(); i++ ) { - RCmDestinationExt dest = iCmManagerExt.DestinationL( destIdArray[i] ); + RCmDestination dest = iCmManager.DestinationL( destIdArray[i] ); CleanupClosePushL( dest ); CleanupCounter++; @@ -409,11 +408,11 @@ RArray destIdArray; CleanupClosePushL( destIdArray ); CleanupCounter++; - iCmManagerExt.AllDestinationsL( destIdArray ); + iCmManager.AllDestinationsL( destIdArray ); for ( TInt i = 0; i< destIdArray.Count(); i++ ) { - RCmDestinationExt dest = iCmManagerExt.DestinationL( destIdArray[i] ); + RCmDestination dest = iCmManager.DestinationL( destIdArray[i] ); CleanupClosePushL( dest ); CleanupCounter++; diff -r 63339781d179 -r 09b1ac925e3f gba/sis/gba.pkg --- a/gba/sis/gba.pkg Thu Aug 19 10:45:23 2010 +0300 +++ b/gba/sis/gba.pkg Tue Aug 31 16:04:40 2010 +0300 @@ -17,7 +17,7 @@ &EN ; Header -#{"GBA"},(0x20029F08), 1, 0, 0, TYPE=SA,RU +#{"GBA"},(0x20029F08), 1, 1, 0, TYPE=SA,RU ; Localised Vendor name %{"Nokia"} @@ -27,8 +27,8 @@ "..\data\gba_license.txt"-"", FT, TA -; Product dependency for Series 60 v5.1 - [0x10283160], 0, 0, 0, {"Series60ProductID"} +; Product dependency for Symbian^4 + [0x20032DE7], 0, 0, 0, {"Series60ProductID"} ; Files to install diff -r 63339781d179 -r 09b1ac925e3f gba/sis/gba_stub.pkg --- a/gba/sis/gba_stub.pkg Thu Aug 19 10:45:23 2010 +0300 +++ b/gba/sis/gba_stub.pkg Tue Aug 31 16:04:40 2010 +0300 @@ -17,7 +17,7 @@ &EN ; Header -#{"GBA"}, (0x20029F08), 1, 0, 0, TYPE=SA +#{"GBA"}, (0x20029F08), 1, 1, 0, TYPE=SA ; Localised Vendor name %{"Nokia"} diff -r 63339781d179 -r 09b1ac925e3f gba/sis/gba_stub.sis Binary file gba/sis/gba_stub.sis has changed diff -r 63339781d179 -r 09b1ac925e3f gba/uicc/group/gbauicc.mmp --- a/gba/uicc/group/gbauicc.mmp Thu Aug 19 10:45:23 2010 +0300 +++ b/gba/uicc/group/gbauicc.mmp Tue Aug 31 16:04:40 2010 +0300 @@ -25,8 +25,6 @@ CAPABILITY CAP_ECOM_PLUGIN -SMPSAFE - USERINCLUDE ../inc USERINCLUDE ../../inc diff -r 63339781d179 -r 09b1ac925e3f layers.sysdef.xml --- a/layers.sysdef.xml Thu Aug 19 10:45:23 2010 +0300 +++ b/layers.sysdef.xml Tue Aug 31 16:04:40 2010 +0300 @@ -1,15 +1,18 @@ - ]> - + + + + diff -r 63339781d179 -r 09b1ac925e3f package_definition.xml --- a/package_definition.xml Thu Aug 19 10:45:23 2010 +0300 +++ b/package_definition.xml Tue Aug 31 16:04:40 2010 +0300 @@ -1,113 +1,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 63339781d179 -r 09b1ac925e3f package_map.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_map.xml Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,2 @@ + + \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CTSecurityDialogs/Group/CTSecDialogImpl.mmp --- a/pkiutilities/CTSecurityDialogs/Group/CTSecDialogImpl.mmp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/Group/CTSecDialogImpl.mmp Tue Aug 31 16:04:40 2010 +0300 @@ -34,29 +34,40 @@ LANGUAGE_IDS END +// CTSecuritydialognotifier uses CertManUi resources that are not compiled in builds any more +SOURCEPATH ../../CertmanUi/data +START RESOURCE certmanui.rss +HEADER +TARGETPATH RESOURCE_FILES_DIR +LANGUAGE_IDS +END + SYSTEMINCLUDE ../../CertmanUi/INC SYSTEMINCLUDE ../../CertSaver/inc SYSTEMINCLUDE ../../DeviceToken/Inc SYSTEMINCLUDE ../../../inc // securityservices/inc directory MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore +SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets USERINCLUDE ../NotifInc USERINCLUDE ../ClientInc +USERINCLUDE ../../../securitydialogs/SecUi/Inc SOURCEPATH ../NotifSrc SOURCE DllMain.cpp SOURCE CTSecuritydialognotifier.cpp -SOURCE CTpinquerydialog.cpp -SOURCE CTQueryDialog.cpp -SOURCE CTSigntextdialog.cpp -SOURCE CTSelectcertificatedialog.cpp -SOURCE CTPinPinQueryDialog.cpp +//SOURCE CTpinquerydialog.cpp +//SOURCE CTQueryDialog.cpp +//SOURCE CTSigntextdialog.cpp +//SOURCE CTSelectcertificatedialog.cpp +//SOURCE CTPinPinQueryDialog.cpp SOURCE CTCertificateQuery.cpp SOURCE CTSecurityDialogsAO.cpp -SOURCE CTNoTrustQuery.cpp -SOURCE CTInvalidCertNote.cpp +SOURCE CTUntrustedCertQuery.cpp +//SOURCE CTInvalidCertNote.cpp LIBRARY EUSER.LIB LIBRARY EIKSRV.LIB @@ -80,10 +91,13 @@ LIBRARY aknlayout.lib LIBRARY X500.lib LIBRARY DevTokenClient.lib +LIBRARY HbCore.lib // CHbDeviceDialog +LIBRARY HbWidgets.lib +LIBRARY secui.lib DEBUGLIBRARY flogger.lib -#if defined(ARMCC) +#if defined( EABI ) DEFFILE ../eabi/CTSecDilogImpl.DEF #elif defined( WINSCW ) DEFFILE ../BWINSCW/CTSecDilogImpl.DEF diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CTSecurityDialogs/Group/bld.inf --- a/pkiutilities/CTSecurityDialogs/Group/bld.inf Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/Group/bld.inf Tue Aug 31 16:04:40 2010 +0300 @@ -23,10 +23,12 @@ PRJ_EXPORTS ../loc/wmlbrowser_wim.loc MW_LAYER_LOC_EXPORT_PATH(wmlbrowser_wim.loc) +../../CertmanUi/loc/certmanui.loc MW_LAYER_LOC_EXPORT_PATH(certmanui.loc) PRJ_MMPFILES CTSecDialogImpl.mmp -CTSecDlgNotifier.mmp +//TODO: remove completely, commented out to remove AVKON Notifier API dependency +//CTSecDlgNotifier.mmp #ifdef __JAVA_JSR_177_SECURITY_AND_TRUST_SERVICES CTSecDlgs.mmp #endif diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CTSecurityDialogs/NotifInc/CTNoTrustQuery.h --- a/pkiutilities/CTSecurityDialogs/NotifInc/CTNoTrustQuery.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* -* 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: -* -*/ - - - -#ifndef CTNOTRUSTQUERY_H -#define CTNOTRUSTQUERY_H - -// INCLUDES - -#include - -// FORWARD DECLARATIONS - -class CCTSecurityDialogsAO; -class CAknSinglePopupMenuStyleListBox; - -// CLASS DECLARATION - -/** -* Notifier class for showing SSL security dialogs -*/ -NONSHARABLE_CLASS( CCTNoTrustQuery ): public CAknQueryDialog - { - public: // constructors and destructor - - CCTNoTrustQuery( - CCTSecurityDialogsAO& aNotifier, - TBool& aRetVal, - TRequestStatus& aClientStatus, - HBufC* aServerName, - TBool aShowPermAccept, - TBool& aIsDeleted ); - - virtual ~CCTNoTrustQuery(); - - private: // from CEikDialog - TBool OkToExitL( TInt aButtonId ); - void PostLayoutDynInitL(); - - private: // New functions - TBool OptionsMenuL(); - - private: // data - CCTSecurityDialogsAO& iNotifier; - TBool& iRetVal; //Dialog response - TRequestStatus* iClientStatus; - HBufC* iServerName; - TBool iShowPermAccept; - TBool& iDeleted; - }; - -#endif // CTNOTRUSTQUERY_H - diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CTSecurityDialogs/NotifInc/CTSecurityDialogsAO.h --- a/pkiutilities/CTSecurityDialogs/NotifInc/CTSecurityDialogsAO.h Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/NotifInc/CTSecurityDialogsAO.h Tue Aug 31 16:04:40 2010 +0300 @@ -36,7 +36,7 @@ class CX500DistinguishedName; class MCTWritableCertStore; class CAknQueryDialog; -class CCTPinQueryDialog; +//class CCTPinQueryDialog; // CLASS DECLARATION @@ -170,6 +170,8 @@ void ShowCSRDialogL(); + void ShowInformationNoteL( TInt aResourceID ) const; + /** * Saves digital signature receipt */ @@ -323,11 +325,8 @@ TBool& iDeleted; - CAknQueryDialog* iQueryDialog; - TBool iQueryDialogDeleted; - - CCTPinQueryDialog* iPinQueryDialog; - TBool iPinQueryDialogDeleted; + //CCTPinQueryDialog* iPinQueryDialog; + //TBool iPinQueryDialogDeleted; }; #endif // CTSECURITYDIALOGSAO_H diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CTSecurityDialogs/NotifInc/CTUntrustedCertQuery.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/CTSecurityDialogs/NotifInc/CTUntrustedCertQuery.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 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" +* 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: Displays untrusted certificate dialog. +* +*/ + +#ifndef CTUNTRUSTEDCERTQUERY_H +#define CTUNTRUSTEDCERTQUERY_H + +#include // CActive +#include // MHbDeviceDialogObserver +#include // TValidationError + +class CHbDeviceDialogSymbian; +class CHbSymbianVariantMap; + + +/** +* Displays untrusted certificate query. +* Untrusted certificate query dialog is displayed for secure connection +* (SSL/TLS) server authentication failure errors. CCTUntrustedCertQuery +* class uses UntrustedCertificateDialog device dialog to show the query. +*/ +NONSHARABLE_CLASS( CCTUntrustedCertQuery ) : public CActive, public MHbDeviceDialogObserver + { + public: // constructors and destructor + static CCTUntrustedCertQuery* NewLC( TValidationError aValidationError, + const TDesC8& aCertificate, const TDesC& aServerName, + TBool aCanHandlePermanentAccept ); + ~CCTUntrustedCertQuery(); + + public: // new functions + enum TResponse { + EQueryRejected, + EQueryAccepted, + EQueryAcceptedPermanently + }; + void ShowQueryAndWaitForResponseL( TResponse& aResponse ); + + protected: // from CActive + void DoCancel(); + void RunL(); + + private: // from MHbDeviceDialogObserver + void DataReceived( CHbSymbianVariantMap& aData ); + void DeviceDialogClosed( TInt aCompletionCode ); + + private: // new functions + CCTUntrustedCertQuery( TValidationError aValidationError, + const TDesC8& aCertificate, const TDesC& aServerName, + TBool aCanHandlePermanentAccept ); + void ConstructL(); + + private: // data + TValidationError iValidationError; + const TDesC8& iCertificate; + const TDesC& iServerName; + TBool iCanHandlePermanentAccept; + CActiveSchedulerWait *iWait; + TInt iWaitCompletionCode; + CHbDeviceDialogSymbian* iDeviceDialog; + CHbSymbianVariantMap* iVariantMap; + TResponse iResponse; + }; + +#endif // CTUNTRUSTEDCERTQUERY_H + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CTSecurityDialogs/NotifSrc/CTCertificateQuery.cpp --- a/pkiutilities/CTSecurityDialogs/NotifSrc/CTCertificateQuery.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/NotifSrc/CTCertificateQuery.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002 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" @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: * */ @@ -23,36 +23,40 @@ #include "CTSecurityDialogsAO.h" #include -#include +//#include #include #include // ================= MEMBER FUNCTIONS ========================================== -CCTCertificateQuery::CCTCertificateQuery(CCTSecurityDialogsAO& aAO): - CAknMessageQueryDialog( CAknQueryDialog::ENoTone ), - iNotifier(aAO) +CCTCertificateQuery::CCTCertificateQuery(CCTSecurityDialogsAO& aAO): + CAknMessageQueryDialog( CAknQueryDialog::ENoTone ), + iNotifier(aAO) { } CCTCertificateQuery* CCTCertificateQuery::NewL(CCTSecurityDialogsAO& aAO) { - CCTCertificateQuery* query = + CCTCertificateQuery* query = new( ELeave ) CCTCertificateQuery(aAO); CleanupStack::PushL( query ); query->ConstructL(); CleanupStack::Pop(); - + return query; } void CCTCertificateQuery::ConstructL() - { - iHeader = CEikonEnv::Static()->AllocReadResourceL( R_TEXT_RESOURCE_DETAILS_VIEW_HEADER ); - SetHeaderTextL( *iHeader ); - iMessage = iNotifier.CreateMessageL(); - SetMessageTextL( *iMessage ); + { + // Temporary fix. Resource file certmanui.rsg is removed. + //iHeader = CEikonEnv::Static()->AllocReadResourceL( R_TEXT_RESOURCE_DETAILS_VIEW_HEADER ); + _LIT( KHeader, "Certificate details" ); + iHeader = KHeader().AllocL(); + + SetHeaderTextL( *iHeader ); + iMessage = iNotifier.CreateMessageL(); + SetMessageTextL( *iMessage ); } CCTCertificateQuery::~CCTCertificateQuery() diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CTSecurityDialogs/NotifSrc/CTInvalidCertNote.cpp --- a/pkiutilities/CTSecurityDialogs/NotifSrc/CTInvalidCertNote.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/NotifSrc/CTInvalidCertNote.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -16,7 +16,7 @@ */ - +#include #include "CTInvalidCertNote.h" #include "CTCertificateQuery.h" // CCTCertificateQuery #include // CEikServAppUi diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CTSecurityDialogs/NotifSrc/CTNoTrustQuery.cpp --- a/pkiutilities/CTSecurityDialogs/NotifSrc/CTNoTrustQuery.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,212 +0,0 @@ -/* -* Copyright (c) 2006-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: -* -*/ - - - -// INCLUDE FILES - -#include "CTNoTrustQuery.h" -#include "CTSecurityDialogsAO.h" -#include "CTCertificateQuery.h" -#include -#include -#include -#include - - -// ================= MEMBER FUNCTIONS ========================================== - -// ----------------------------------------------------------------------------- -// CSecNotNoTrustQuery::CCTNoTrustQuery() -// ----------------------------------------------------------------------------- -// -CCTNoTrustQuery::CCTNoTrustQuery( - CCTSecurityDialogsAO& aNotifier, - TBool& aRetVal, - TRequestStatus& aClientStatus, - HBufC* aServerName, - TBool aShowPermAccept, - TBool& aIsDeleted ): - CAknQueryDialog( CAknQueryDialog::ENoTone ), - iNotifier( aNotifier ), - iRetVal( aRetVal ), - iClientStatus( &aClientStatus ), - iServerName( aServerName ), - iShowPermAccept( aShowPermAccept ), - iDeleted( aIsDeleted ) - { - iDeleted = EFalse; - } - -// ----------------------------------------------------------------------------- -// CSecNotNoTrustQuery::~CCTNoTrustQuery() -// ----------------------------------------------------------------------------- -// -CCTNoTrustQuery::~CCTNoTrustQuery() - { - // Allow application switching again - CEikonEnv* eikonEnv = CEikonEnv::Static(); - if( eikonEnv ) - { - CEikServAppUi* eikServAppUi = static_cast( eikonEnv->EikAppUi() ); - if( eikServAppUi ) - { - eikServAppUi->SuppressAppSwitching( EFalse ); - } - } - - // Complete the client request - if( iClientStatus && *iClientStatus == KRequestPending ) - { - iRetVal = EFalse; - User::RequestComplete( iClientStatus, KErrNone ); - } - - // Notify that the dialog has been deleted - iDeleted = ETrue; - } - -// ----------------------------------------------------------------------------- -// CSecNotNoTrustQuery::OkToExitL() -// ----------------------------------------------------------------------------- -// -TBool CCTNoTrustQuery::OkToExitL( TInt aButtonId ) - { - if ( aButtonId == EAknSoftkeyOptions || aButtonId == EAknSoftkeyOk ) - { - return OptionsMenuL(); - } - else - { - iRetVal = EFalse; - User::RequestComplete( iClientStatus, KErrNone ); - } - return ETrue; - } - -// ----------------------------------------------------------------------------- -// CCTNoTrustQuery::PostLayoutDynInitL() -// ----------------------------------------------------------------------------- -// -void CCTNoTrustQuery::PostLayoutDynInitL() - { - CAknQueryControl* control = QueryControl(); - if (control) - control->StartAnimationL(); - ((CEikServAppUi*)(CEikonEnv::Static())->EikAppUi())->SuppressAppSwitching( ETrue ); - } - -// ----------------------------------------------------------------------------- -// CCTNoTrustQuery::OptionsMenuL() -// ----------------------------------------------------------------------------- -TBool CCTNoTrustQuery::OptionsMenuL() - { - TBool ret = EFalse; - CAknSinglePopupMenuStyleListBox* list = - new( ELeave ) CAknSinglePopupMenuStyleListBox; - CleanupStack::PushL( list ); - CAknPopupList* popupList = CAknPopupList::NewL( - list, R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT, AknPopupLayouts::EMenuWindow ); - CleanupStack::PushL( popupList ); - list->ConstructL( popupList, CEikListBox::ELeftDownInViewRect ); - list->CreateScrollBarFrameL( ETrue ); - list->ScrollBarFrame()->SetScrollBarVisibilityL( - CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); - - TInt resourceid; - - if ( iShowPermAccept ) - { - resourceid = R_NOTRUST_MENUPANE; - } - else - { - resourceid = R_NOTRUST_MENUPANE_NO_PERM; - } - - CDesCArrayFlat* items = - CEikonEnv::Static()->ReadDesCArrayResourceL( resourceid ); - - CTextListBoxModel* model = list->Model(); - model->SetOwnershipType( ELbmOwnsItemArray ); - model->SetItemTextArray( items ); - - CleanupStack::Pop( popupList ); //popupList - if ( popupList->ExecuteLD() ) - { - if( !iDeleted ) - { - TInt index = list->CurrentItemIndex(); - if ( index == 0 ) // Accept now - { - iRetVal = EServerCertAcceptedTemporarily; - User::RequestComplete(iClientStatus, KErrNone); - ret = ETrue; - } - else if (( index == 1 ) && ( resourceid == R_NOTRUST_MENUPANE )) // Accept permanently - { - - HBufC* prompt = StringLoader::LoadLC( R_QTN_HTTPSEC_QUERY_PERM_ACCEPT_TEXT, *iServerName ); - - CAknMessageQueryDialog* note = CAknMessageQueryDialog::NewL( *prompt ); - - note->PrepareLC( R_HTTPSEC_QUERY_PERM_ACCEPT ); - note->SetPromptL( *prompt ); - - if ( note->RunLD() ) - { - iRetVal = EServerCertAcceptedPermanently; - User::RequestComplete( iClientStatus, KErrNone ); - ret = ETrue; - } - else - { - ret = EFalse; - } - - CleanupStack::PopAndDestroy( prompt ); - } - else if ((( index == 2 ) && ( resourceid == R_NOTRUST_MENUPANE )) || - (( index == 1 ) && ( resourceid == R_NOTRUST_MENUPANE_NO_PERM )) ) // Details - { - // We need to delay this implementation in other releases, because - // separate ICD was taken to 3.0. - CCTCertificateQuery* query = - CCTCertificateQuery::NewL( iNotifier ); - query->ExecuteLD( R_NOTRUST_CERTIFICATE_QUERY ); - ret = EFalse; - } - else - { - iRetVal = EServerCertNotAccepted; - User::RequestComplete( iClientStatus, KErrNone ); - ret = ETrue; - } - } - else - { - ret = EFalse; - } - } - else - { - ret = EFalse; - } - CleanupStack::PopAndDestroy( list ); // list - return ret; - } - diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CTSecurityDialogs/NotifSrc/CTPinPinQueryDialog.cpp --- a/pkiutilities/CTSecurityDialogs/NotifSrc/CTPinPinQueryDialog.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/NotifSrc/CTPinPinQueryDialog.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -17,6 +17,7 @@ // INCLUDE FILES +#include #include "CTPinPinQueryDialog.h" #include #include diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CTSecurityDialogs/NotifSrc/CTQueryDialog.cpp --- a/pkiutilities/CTSecurityDialogs/NotifSrc/CTQueryDialog.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/NotifSrc/CTQueryDialog.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -19,6 +19,7 @@ // INCLUDE FILES +#include #include "CTQueryDialog.h" #include "CTSecurityDialogsLogger.h" #include diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CTSecurityDialogs/NotifSrc/CTSecurityDialogsAO.cpp --- a/pkiutilities/CTSecurityDialogs/NotifSrc/CTSecurityDialogsAO.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/NotifSrc/CTSecurityDialogsAO.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -19,17 +19,17 @@ // INCLUDE FILES #include "CTSecurityDialogsAO.h" #include "CTSecurityDialogNotifier.h" -#include "CTPinQueryDialog.h" -#include "CTSignTextDialog.h" -#include "CTSelectCertificateDialog.h" -#include "CTQueryDialog.h" -#include "CTPinPinQueryDialog.h" -#include "CTNoTrustQuery.h" -#include "CTInvalidCertNote.h" +//#include "CTPinQueryDialog.h" +//#include "CTSignTextDialog.h" +//#include "CTSelectCertificateDialog.h" +//#include "CTQueryDialog.h" +//#include "CTPinPinQueryDialog.h" +#include "CTUntrustedCertQuery.h" +//#include "CTInvalidCertNote.h" #include #include #include -#include +//#include #include #include #include @@ -37,7 +37,7 @@ #include #include #include -#include +//#include #include #include #include @@ -45,7 +45,13 @@ #include #include #include -#include // KCoreAppUIsAutolockStatus +#include // CEikonEnv +#include // AknTextUtils + +#include "SecQueryUi.h" // needed for password dialog + +#include // needed for Note dialogs +#include // LOCAL CONSTANTS AND MACROS const TInt KCertArrayGranularity = 3; @@ -54,8 +60,6 @@ const TInt KMaxLengthTextCertLabelVisible = 200; // "dd/mm/yyyy0" const TInt KMaxLengthTextDateString = 20; -// HH0 -const TInt KMaxLengthTextSerialNumberFormatting = 3; // Maximum length of a certificate const TInt KMaxCertificateLength = 5000; @@ -64,12 +68,8 @@ const TInt KMinImportKeyPwLen = 1; -const TInt KMaxCNLength = 64; +const TInt KMaxCommonNameLength = 64; -_LIT(KCertManUIDetailsViewHexFormat, "%02X"); - -const TInt KFileCertStoreUid( 0x101F501A ); -const TInt KWIMCertStoreUid ( 0x101F79D9 ); const TUid KTrustedServerTokenUid = { 0x101FB66F }; const TUid KDeviceCertStoreTokenUid = { 0x101FB668 }; @@ -83,43 +83,15 @@ _LIT( KPKCS12TokenLabel, "PKCS12"); -// ============================ LOCAL FUNCTIONS =============================== - -TInt AlgorithmNameResourceId( TAlgorithmId aAlgorithmId ) - { - TInt resourceId = 0; - switch( aAlgorithmId ) - { - case ERSA: - resourceId = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_RSA; - break; - case EDSA: - resourceId = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_DSA; - break; - case EDH: - resourceId = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_DH; - break; - case EMD2: - resourceId = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_MD2; - break; - case EMD5: - resourceId = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_MD5; - break; - case ESHA1: - resourceId = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_SHA1; - break; - case ESHA224: - case ESHA256: - case ESHA384: - case ESHA512: - resourceId = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_SHA2; - break; - default: - resourceId = R_TEXT_RESOURCE_DETAILS_VIEW_UNKNOWN; - break; - } - return resourceId; - } +// TODO: replace with OST tracing +#ifdef _DEBUG +#include +#define TRACE(x) RDebug::Printf(x) +#define TRACE1(x,y) RDebug::Printf(x,y) +#else +#define TRACE(x) +#define TRACE1(x,y) +#endif // ============================ MEMBER FUNCTIONS =============================== @@ -147,9 +119,6 @@ void CCTSecurityDialogsAO::ConstructL() { iDeleted = EFalse; - - iQueryDialog = NULL; - iQueryDialogDeleted = ETrue; } // ----------------------------------------------------------------------------- @@ -225,6 +194,7 @@ iMessagePtr = aMessage; WIMSECURITYDIALOGS_WRITE_FORMAT( "CCTSecurityDialogsAO::StartLD iOperation=%d", iOperation ); + TRACE1( "CCTSecurityDialogsAO::StartLD iOperation=%d", iOperation ); MapTlsProviderOperation( iOperation ); @@ -305,7 +275,10 @@ pinLabel.Copy( pinLabelPtr ); HBufC* text = iNotifier->LoadResourceStringLC( iOperation, pinLabel ); - CCTSignTextDialog::RunDlgLD( R_WIM_UNBLOCK_INFO_DIALOG, *text, iStatus, iRetValue ); + // TODO + //CCTSignTextDialog::RunDlgLD( R_WIM_UNBLOCK_INFO_DIALOG, *text, iStatus, iRetValue ); + User::Leave( KErrGeneral ); + CleanupStack::PopAndDestroy( text ); iStatus = KRequestPending; SetActive(); @@ -379,6 +352,8 @@ // void CCTSecurityDialogsAO::DoHandleServerAuthFailL( const TDesC8& aBuffer ) { + TRACE( "CCTSecurityDialogsAO::DoHandleServerAuthFailL" ); + CServerAuthenticationFailureInput* srvAuthFail = CServerAuthenticationFailureInput::NewLC( aBuffer ); TPtrC8 cert; @@ -391,33 +366,31 @@ iServerName = HBufC::NewL( serverName.Length() ); iServerName->Des().Copy( serverName ); + iCertLabel = NULL; - HBufC* cn = NULL; - iCertLabel = NULL; // Site will be checked later. For now it is not trusted iTrustedSite = EFalse; - CX509Certificate* serverCert = CX509Certificate::NewLC( cert ); - // Retrieve subject name const CX500DistinguishedName& dName = serverCert->SubjectName(); - // Retrieve CN - cn = dName.ExtractFieldL( KX520CommonName ); - if ( cn != NULL ) + + HBufC* commonName = dName.ExtractFieldL( KX520CommonName ); + CleanupStack::PushL( commonName ); + if( commonName != NULL ) { - // commonName exist in the certificate. // Check the length of CN. RFC 3280 states // that max length of CN is 64. - if ( cn->Length() <= KMaxCNLength ) + if( commonName->Length() <= KMaxCommonNameLength ) { - iCertLabel = HBufC::NewL( cn->Length() ); - iCertLabel->Des().Append( cn->Des() ); + iCertLabel = HBufC::NewL( commonName->Length() ); + iCertLabel->Des().Append( commonName->Des() ); } } + CleanupStack::PopAndDestroy( commonName ); - if ( iCertLabel == NULL ) + if( iCertLabel == NULL ) { - // No or invalid commonName. Use domain name as label + // No or invalid commonName. Use domain name as label. iCertLabel = HBufC::NewL( iServerName->Length() ); iCertLabel->Des().Append( iServerName->Des() ); } @@ -536,17 +509,22 @@ { case EUserAuthenticationText: { - CCTSignTextDialog::RunDlgLD( R_WIM_USERAUTHTEXT_DIALOG, - *textToSign, iStatus, iRetValue ); + // TODO + //CCTSignTextDialog::RunDlgLD( R_WIM_USERAUTHTEXT_DIALOG, + // *textToSign, iStatus, iRetValue ); + User::Leave( KErrGeneral ); break; } case EUserAuthentication: { + DoHandleMessageL( EUserAuthentication, KNullDesC, KNullDesC, 1, KMaxTInt ); break; } case ESignText: { - CCTSignTextDialog::RunDlgLD( R_WIM_SIGNTEXT_DIALOG,*textToSign, iStatus, iRetValue ); + // TODO + //CCTSignTextDialog::RunDlgLD( R_WIM_SIGNTEXT_DIALOG,*textToSign, iStatus, iRetValue ); + User::Leave( KErrGeneral ); break; } default: @@ -598,6 +576,7 @@ if ( iRetry ) // Is this new try? { // Previous attempt was failed + // incorrect pin code DoHandleMessageL( EErrorPinCodeIncorrect, KNullDesC, KNullDesC, 0, 0 ); } // Ask the PIN code or PUK code @@ -605,11 +584,13 @@ { HBufC* header = StringLoader::LoadLC( R_QTN_CM_HEADING_PHONE_KEYSTORE, CEikonEnv::Static() ); - iPIN.iMinLength = KMaxKeystorePwLength; + iPIN.iMinLength = KMaxKeystorePwLength; DoHandleMessageL( EEnterKeyStorePw, KNullDesC, *header, iPIN.iMinLength, iPIN.iMaxLength ); iMultiLineDlgType = EEnterNewKeyStorePw; CleanupStack::PopAndDestroy( header ); + RunL(); + } else if ( iPIN.iPINLabel == KKeyStoreImportKeyLabel ) { @@ -626,7 +607,7 @@ else if ( iPIN.iPINLabel == KKeyStoreCreatePwLabel ) { iPIN.iMinLength = KMaxKeystorePwLength; - DoHandleMessageL( EInfoPwCreating, KNullDesC, KNullDesC, 0, 0 ); + ShowInformationNoteL(R_QTN_CM_CREATING_KEYSTORE); DoHandleMultilinePinQueryL( EEnterNewKeyStorePw ); iNextStep = EVerifyPINs; } @@ -651,8 +632,10 @@ // CCTSecurityDialogsAO::DoHandleMultilinePinQueryL() // ----------------------------------------------------------------------------- // -void CCTSecurityDialogsAO::DoHandleMultilinePinQueryL( const TInt& aDlgType ) +void CCTSecurityDialogsAO::DoHandleMultilinePinQueryL( const TInt& /*aDlgType*/ ) { + // TODO +#if 0 iMultiLineDlgType = aDlgType; HBufC* dlgText1 = NULL; HBufC* dlgText2 = NULL; @@ -660,12 +643,37 @@ TDialogType dlgType = ( TDialogType )aDlgType; if ( EEnterNewKeyStorePw == dlgType ) { +/* dlgText1 = iNotifier->LoadResourceStringLC( dlgType, KNullDesC ); dlgText2 = iNotifier->LoadResourceStringLC( EVerifyKeyStorePw, KNullDesC ); dlg = CCTPinPinQueryDialog::NewL( *dlgText1, *dlgText2, iPINValue2, - iPINValueVerify, iPIN.iMinLength, iPIN.iMaxLength, iRetValue ); + iPINValueVerify, iPIN.iMinLength, iPIN.iMaxLength, iRetValue );16:19:13.812 xti1:MCU_ASCII_PRINTF; channel:0xE0; msg:*PlatSec* ERROR - Capability check failed - Process #tlstest[e8dc94b1]0001 was checked by Thread c32exe.exe[101f7989]0001::ESock_IP and was found to be missing the capabilities: NetworkControl . + dlg->RunDlgLD( iStatus, R_WIM_PWPW_QUERY_DIALOG ); CleanupStack::PopAndDestroy( 2, dlgText1 ); // dlgText1, dlgText2 +*/ + dlgText1 = StringLoader::LoadLC( R_QTN_SN_NEW_PHONE_KEYSTORE ); + dlgText2 = StringLoader::LoadLC( R_QTN_WIM_VERIFY_PIN ); + HBufC* message = HBufC::NewLC( KMaxLengthTextCertLabelVisible ); + message->Des().Append(dlgText1->Des()); + message->Des().Append(_L("|")); + message->Des().Append(dlgText2->Des()); + CSecQueryUi* SecQueryUi = CSecQueryUi::NewL(); + TInt queryAccepted = SecQueryUi->SecQueryDialog(message->Des(), iPINValueVerify, + iPIN.iMinLength,iPIN.iMaxLength, + ESecUiAlphaSupported | + ESecUiCancelSupported | + ESecUiSecretSupported | + ESecUiEmergencyNotSupported); + iRetValue=(queryAccepted==KErrNone); + if(iRetValue) + iPINValue2.Copy(iPINValueVerify); // dialog already does not OK with different pin codes + delete SecQueryUi; + SecQueryUi=NULL; + CleanupStack::PopAndDestroy( message ); + CleanupStack::PopAndDestroy( dlgText2 ); + CleanupStack::PopAndDestroy( dlgText1 ); + RunL(); // had to call it this way } else if ( EExportKeyPw == dlgType ) { @@ -685,6 +693,8 @@ dlg->RunDlgLD( iStatus, R_WIM_PINPIN_QUERY_DIALOG ); CleanupStack::PopAndDestroy( 2, dlgText1 ); // dlgText1, dlgText2 } +#endif + User::Leave( KErrGeneral ); } // ----------------------------------------------------------------------------- @@ -704,7 +714,7 @@ TDialogTypeItem item = iNotifier->GetDialogTypeItem( dlgType ); - CAknResourceNoteDialog* dlg = NULL; + //CAknResourceNoteDialog* dlg = NULL; TInt resource = 0; @@ -712,44 +722,62 @@ { case EInfoNote: { - dlg = new ( ELeave ) CAknInformationNote( ETrue ); + // TODO + //dlg = new ( ELeave ) CAknInformationNote( ETrue ); + User::Leave( KErrGeneral ); break; } case EErrorNote: { - dlg = new ( ELeave ) CAknErrorNote( ETrue ); + // TODO + //dlg = new ( ELeave ) CAknErrorNote( ETrue ); + User::Leave( KErrGeneral ); break; } case EConfirmationNote: { - dlg = new ( ELeave ) CAknConfirmationNote( ETrue ); + // TODO + //dlg = new ( ELeave ) CAknConfirmationNote( ETrue ); + User::Leave( KErrGeneral ); break; } case EInfoDialog: { + // TODO + /* CCTQueryDialog::RunDlgLD( iStatus, iRetValue, *dlgText, item.iSoftKeyResource, ECTInfoDialog ); iStatus = KRequestPending; SetActive(); + */ + User::Leave( KErrGeneral ); break; } case EEnterPwPwDialog: { + // TODO + /* CCTPinPinQueryDialog* dialog = CCTPinPinQueryDialog::NewL( *dlgText, *dlgText, iPINValue2, iPINValueVerify, aMinLength, aMaxLength, iRetValue ); dialog->RunDlgLD( iStatus, R_WIM_PWPW_QUERY_DIALOG ); + */ + User::Leave( KErrGeneral ); break; } case EEnterPinPinCodeDialog: { + // TODO + /* CCTPinPinQueryDialog* dialog = CCTPinPinQueryDialog::NewL( *dlgText, *dlgText, iPINValue2, iPINValueVerify, aMinLength, aMaxLength, iRetValue ); dialog->RunDlgLD( iStatus, R_WIM_PINPIN_QUERY_DIALOG ); + */ + User::Leave( KErrGeneral ); break; } case EEnterPwDialog: @@ -793,17 +821,41 @@ User::Panic(_L("CSecDlgNotifier"), 0); } } - iPinQueryDialogDeleted = EFalse; - CCTPinQueryDialog::RunDlgLD( iStatus, - *dlgText, - *pinValue, - aMinLength, - aMaxLength, - iRetValue, - resource, - iPinQueryDialog, - iPinQueryDialogDeleted ); + //iPinQueryDialogDeleted = EFalse; + if(aDlgType!=EEnterKeyStorePw) { + // TODO + /* + CCTPinQueryDialog::RunDlgLD( iStatus, + *dlgText, + *pinValue, + aMinLength, + aMaxLength, + iRetValue, + resource, + iPinQueryDialog, + iPinQueryDialogDeleted ); + */ + User::Leave( KErrGeneral ); + resource = resource; // avoids compiler warning + break; + } + else + { + iPIN.iMinLength = KMaxKeystorePwLength; + CSecQueryUi* SecQueryUi = CSecQueryUi::NewL(); + HBufC* header =StringLoader::LoadLC( R_QTN_SN_ENTER_PHONE_KEYSTORE); + TInt queryAccepted = SecQueryUi->SecQueryDialog(header->Des(), *pinValue, + aMinLength,aMaxLength, + ESecUiAlphaSupported | + ESecUiCancelSupported | + ESecUiSecretSupported | + ESecUiEmergencyNotSupported); + delete SecQueryUi; + SecQueryUi=NULL; + iRetValue=(queryAccepted==KErrNone); + CleanupStack::PopAndDestroy( header ); break; + } } default: { @@ -811,12 +863,16 @@ } } + // TODO + /* + if ( dlg && aDlgType!=EEnterKeyStorePw) + { - if ( dlg ) - { dlg->ExecuteLD( *dlgText ); dlg = NULL; } + */ + User::Leave( KErrGeneral ); CleanupStack::PopAndDestroy( dlgText ); // dlgText } @@ -841,6 +897,8 @@ // void CCTSecurityDialogsAO::InitCertStoreL() { + TRACE( "CCTSecurityDialogsAO::InitCertStoreL" ); + switch(iOperation) { case ESignText: @@ -976,13 +1034,15 @@ { WIMSECURITYDIALOGS_WRITE_FORMAT( "CCTSecurityDialogsAO::RunL, iStatus %d", iStatus.Int() ); WIMSECURITYDIALOGS_WRITE_FORMAT( " iNextStep %d", iNextStep ); + TRACE1( "CCTSecurityDialogsAO::RunL, iStatus.Int()=%d", iStatus.Int() ); - if ( iStatus != KErrNone ) + if( iStatus != KErrNone ) { User::Leave( iStatus.Int() ); - } // if + } - switch ( iNextStep ) + TRACE1( "CCTSecurityDialogsAO::RunL, iNextStep=%d", iNextStep ); + switch( iNextStep ) { case EOperationCompleted: { @@ -990,35 +1050,34 @@ HandleResponseAndCompleteL(); break; } + case ECheckServerCerts: { WIMSECURITYDIALOGS_WRITE( "ECheckServerCerts" ); TBool foundCert( EFalse ); - if ( iServerCerts.Count() ) + if( iServerCerts.Count() ) { // Found certificates in the trusted site certificate storage. // Compare them with the one received from TlsProvider iCertPtr.Set( iCertBuf->Des() ); CX509Certificate* serverCert = CX509Certificate::NewLC( iCertPtr ); - for (TInt i=0; iDes() ); - CX509Certificate* cert = CX509Certificate::NewLC( certPtr ); - - // Compare fingerprints - if ( cert->Fingerprint() == serverCert->Fingerprint() ) + if( cert->Fingerprint() == serverCert->Fingerprint() ) { - // Fingerprints match foundCert = ETrue; } CleanupStack::PopAndDestroy( cert ); } + CleanupStack::PopAndDestroy( serverCert ); - if ( foundCert ) + + if( foundCert ) { // Found matching certificate. Complete the operation iRetValue = EServerCertAcceptedPermanently; @@ -1027,24 +1086,26 @@ } } - if ( !foundCert ) - { - // Couldn't find matching certificate. Prompt user - ShowNoTrustDialogL(); - } - + if ( !foundCert ) + { + // Couldn't find matching certificate. Prompt user + ShowNoTrustDialogL(); + } break; } + case EProcessTrustedSite: { WIMSECURITYDIALOGS_WRITE( "EProcessTrustedSite" ); + TRACE( "CCTSecurityDialogsAO::RunL, EProcessTrustedSite" ); + TInt count = iCertStore->WritableCertStoreCount(); - for ( TInt i = 0; i < count; i++ ) + for( TInt i = 0; i < count; i++ ) { MCTWritableCertStore *certstore = &iCertStore->WritableCertStore( i ); MCTToken& token = certstore->Token(); TUid tokenuid = token.Handle().iTokenTypeUid; - if ( tokenuid == KTrustedServerTokenUid ) + if( tokenuid == KTrustedServerTokenUid ) { iTrustedSiteCertStore = certstore; } @@ -1056,11 +1117,11 @@ // Find out whether or not site associated with certificate is trusted iTrustedSite = trustedSitesStore->IsTrustedSiteL( *iCertBuf, *iServerName ); - if ( iTrustedSite ) + if( iTrustedSite ) { TBool allowOutOfDate = trustedSitesStore->IsOutOfDateAllowedL(*iCertBuf, *iServerName); - if (!allowOutOfDate) + if( !allowOutOfDate ) { CX509Certificate* cert = CX509Certificate::NewLC( iCertBuf->Des() ); @@ -1081,7 +1142,7 @@ } CleanupStack::PopAndDestroy( trustedSitesStore ); - if ( iTrustedSite ) + if( iTrustedSite ) { // Site is trusted. Next step is to check that server // certificate is in the trusted site certificate storage @@ -1148,9 +1209,11 @@ } break; } + case EAddTrustedSite: { - if ( iStatus.Int() == KErrNone ) + TRACE( "CCTSecurityDialogsAO::RunL, EAddTrustedSite" ); + if( iStatus.Int() == KErrNone ) { //Added server certificate succesfully CTrustSitesStore* trustedSitesStore = CTrustSitesStore::NewL(); @@ -1159,7 +1222,7 @@ TInt status = trustedSitesStore->AddL( *iCertBuf, *iServerName ); CleanupStack::PopAndDestroy( trustedSitesStore ); - if ( status == KErrNone ) + if( status == KErrNone ) { iRetValue = EServerCertAcceptedPermanently; } @@ -1174,23 +1237,27 @@ else { //Adding server certificate failed + // TODO: unreached code? iNextStep = EOperationCompleted; iRetValue = EServerCertNotAccepted; HandleResponseAndCompleteL(); } - break; + break; } case ESaveServerCert: { WIMSECURITYDIALOGS_WRITE( "ESaveServerCert" ); + TRACE( "CCTSecurityDialogsAO::RunL, ESaveServerCert" ); DoHandleSaveServerCertL(); break; } + case EServerCertCheckUserResp: { WIMSECURITYDIALOGS_WRITE( "EServerCertCheckUserResp" ); - if ( iRetValue == EServerCertAcceptedPermanently ) + TRACE( "CCTSecurityDialogsAO::RunL, EServerCertCheckUserResp" ); + if( iRetValue == EServerCertAcceptedPermanently ) { // User accepted to select certificate permanently. // First add server certificate @@ -1207,6 +1274,7 @@ } break; } + case EOperationSignTextShown: { if ( iRetValue || iOperation == EUserAuthentication ) @@ -1223,6 +1291,7 @@ User::RequestComplete( status, KErrNone ); break; } + case EOperationInitCertStore: { TInt err = KErrNone; @@ -1240,6 +1309,7 @@ iNextStep = EOperationRetrieveCertInfos; break; } + case EOperationRetrieveCertInfos: { if ( iCertInfo ) @@ -1275,11 +1345,13 @@ } break; } + case EOperationSelectCert: { DoHandleSelectCertificateL(); break; } + case EGetCertInfo: { iStatus = KRequestPending; @@ -1289,6 +1361,7 @@ SetActive(); break; } + case EGetCertificate: { iStatus = KRequestPending; @@ -1308,36 +1381,42 @@ iNextStep = EInitKeyStore; break; } + case EInitKeyStore: { InitKeyStoreL(); iNextStep = EGetKeyInfos; break; } + case EGetKeyInfos: { GetKeyInfosL(); iNextStep = EShowCertDialog; break; } + case EGetKeyInfoByHandle: { GetKeyInfoByHandleL(); iNextStep = EShowCSRDialog; break; } + case EShowCSRDialog: { ShowCSRDialogL(); iNextStep = EOperationCompleted; break; } + case EShowCertDialog: { ShowCertDialogL(); iNextStep = EOperationCompleted; break; } + ///////////// // PIN steps ///////////// @@ -1380,11 +1459,13 @@ } break; } + case EVerifyPINs: { VerifyPinsL(); break; } + default: { User::Panic( _L("CTestSecDlgNotifier"), 0 ); @@ -1458,6 +1539,7 @@ { // No certificate from Device Certificate Store. Prompt user // for certificate selection + /* CCTSelectCertificateDialog::RunDlgLD( iCertArray, iCertHandleList, iTokenHandle, iStatus, iRetValue ); // Takes ownerhip of array @@ -1465,6 +1547,8 @@ iNextStep = EOperationCompleted; iStatus = KRequestPending; SetActive(); + */ + User::Leave( KErrGeneral ); // TODO: to be implemented } } @@ -1474,117 +1558,40 @@ // void CCTSecurityDialogsAO::ShowNoTrustDialogL() { - // Cannot display untrusted certificate dialog if device is locked. Untrusted - // certificate dialog would be displayed on top of possible lock code query. - TInt value = 0; - TInt err = RProperty::Get( KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, value ); - if( !err && value != EAutolockOff ) - { - iRetValue = EServerCertNotAccepted; - iStatus = KRequestPending; - TRequestStatus* status( &iStatus ); - User::RequestComplete( status, KErrNone ); - } - else - { - CX509Certificate* cert = CX509Certificate::NewLC( iCertBuf->Des() ); - TInt dialogResourceId = R_WIM_NO_TRUST_QUERY_UNTRUSTED; - TInt promptResourceId = R_QTN_ICS_SSL_CONF_Q_ACCEPT_UNTRUSTED; - TBool showPermAccept = ETrue; + TRACE( "CCTSecurityDialogsAO::ShowNoTrustDialogL, begin" ); - if( iAuthFailReason == ESignatureInvalid || iAuthFailReason == ECertificateRevoked ) - { - // Invalid or revoked certificate - CCTInvalidCertificateNote* note = - new( ELeave ) CCTInvalidCertificateNote( *this, iStatus ); - note->ExecuteLD( R_WIM_INVALID_CERTIFICATE_INFORMATION_NOTE ); - iRetValue = EServerCertNotAccepted; - - // CCTNoTrustQuery below self-completes this active object. It is necessary to - // complete it here too, in order to run the next step EServerCertCheckUserResp. - iStatus = KRequestPending; - TRequestStatus* status( &iStatus ); - User::RequestComplete( status, KErrNone ); - } - else - { - if( iAuthFailReason == EValidatedOK || iAuthFailReason == EDateOutOfRange ) - { - // Trusted certificate, but problems with CN or date - - // Retrieve subject name - const CX500DistinguishedName& dName = cert->SubjectName(); - - // Retrieve common name - HBufC* cn = dName.ExtractFieldL( KX520CommonName ); + // If trusted site certstore open has failed, then it is not possible to save + // the host name for permanent use. Hence, choice for permanent accept is not + // displayed if trusted site certstore open has failed. Other restrictions for + // permanent accept are defined in device dialog (UntrustedCertificateWidget). + TBool isTrustedSiteCertStoreOpened = ( iTrustedSiteCertStore != NULL ); + CCTUntrustedCertQuery *untrustedCertDlg = CCTUntrustedCertQuery::NewLC( + iAuthFailReason, *iCertBuf, *iServerName, isTrustedSiteCertStoreOpened ); - // Check common name first and then date - if( !cn ) - { - // Couldn't retrieve CN from certificate - dialogResourceId = R_WIM_NO_TRUST_QUERY_UNTRUSTED; - promptResourceId = R_QTN_ICS_SSL_CONF_Q_ACCEPT_UNTRUSTED; - } - else if( iServerName->Des() != cn->Des() ) - { - // Domain name doesn't match with CN - dialogResourceId = R_WIM_NO_TRUST_QUERY_SITE; - promptResourceId = R_QTN_ICS_SSL_CONF_Q_ACCEPT_SITE; - } - else if( iAuthFailReason == EDateOutOfRange ) - { - // Certificate is out of date - dialogResourceId = R_WIM_NO_TRUST_QUERY_OOD; - promptResourceId = R_QTN_ICS_SSL_CONF_Q_ACCEPT_OOD; - showPermAccept = EFalse; - } - else - { - // Otherwise show general untrusted note - dialogResourceId = R_WIM_NO_TRUST_QUERY_UNTRUSTED; - promptResourceId = R_QTN_ICS_SSL_CONF_Q_ACCEPT_UNTRUSTED; - } - } - else - { - // Untrusted certificate - dialogResourceId = R_WIM_NO_TRUST_QUERY_UNTRUSTED; - promptResourceId = R_QTN_ICS_SSL_CONF_Q_ACCEPT_UNTRUSTED; - } - - // No "Accept Permanently" option if certificate is out of date, or - // if domain name is not defined, or if trusted site store failed to - // open (and it's not possible to save the server certificate). - const CValidityPeriod& validityPeriod = cert->ValidityPeriod(); - const TTime& startValue = validityPeriod.Start(); - const TTime& finishValue = validityPeriod.Finish(); - TTime current; - current.UniversalTime(); - - if( (( startValue > current ) || ( finishValue < current )) || - ( iServerName->Des().Length() == 0 ) || - ( !iTrustedSiteCertStore ) ) - { - showPermAccept = EFalse; - } - - // CCTNoTrustQuery completes iStatus asynchronously when ready. Note that - // it happens after ExecuteLD() and also this function have returned. - iStatus = KRequestPending; - - iQueryDialog = new( ELeave ) CCTNoTrustQuery( *this, iRetValue, iStatus, - iServerName, showPermAccept, iQueryDialogDeleted ); - HBufC* prompt = StringLoader::LoadLC( promptResourceId, *iServerName ); - - iQueryDialog->ExecuteLD( dialogResourceId, *prompt ); - - CleanupStack::PopAndDestroy( prompt ); - } - - CleanupStack::PopAndDestroy( cert ); + CCTUntrustedCertQuery::TResponse response = CCTUntrustedCertQuery::EQueryRejected; + untrustedCertDlg->ShowQueryAndWaitForResponseL( response ); + switch( response ) + { + case CCTUntrustedCertQuery::EQueryAccepted: + iRetValue = EServerCertAcceptedTemporarily; + break; + case CCTUntrustedCertQuery::EQueryAcceptedPermanently: + // TODO: show confirmation note, qtn_httpsec_query_perm_accept_text + // "Connection to site %U will be made in future without any warnings. Continue?"" + iRetValue = EServerCertAcceptedPermanently; + break; + case CCTUntrustedCertQuery::EQueryRejected: + default: + iRetValue = EServerCertNotAccepted; + break; } + CleanupStack::PopAndDestroy( untrustedCertDlg ); + TRACE1( "CCTSecurityDialogsAO::ShowNoTrustDialogL, iRetValue=%d", iRetValue ); iNextStep = EServerCertCheckUserResp; + iStatus = KRequestPending; + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); SetActive(); } @@ -1601,16 +1608,18 @@ messagePtr.Append( KEnter ); - DetailsFieldDynamicL( messagePtr, *iText, - R_TEXT_RESOURCE_DETAILS_VIEW_SUBJECT, - R_TEXT_RESOURCE_VIEW_NO_SUBJECT_DETAILS ); + //DetailsFieldDynamicL( messagePtr, *iText, + // R_TEXT_RESOURCE_DETAILS_VIEW_SUBJECT, + // R_TEXT_RESOURCE_VIEW_NO_SUBJECT_DETAILS ); AddKeyUsageL( messagePtr, iKeyInfo ); AddKeyAlgorithmL( messagePtr, iKeyInfo ); AddKeySizeL( messagePtr, iKeyInfo ); AddKeyLocationL( messagePtr, iKeyInfo ); - CCTSignTextDialog::RunDlgLD( R_WIM_CSR_DIALOG, *message, iStatus, iRetValue ); + // TODO + //CCTSignTextDialog::RunDlgLD( R_WIM_CSR_DIALOG, *message, iStatus, iRetValue ); + User::Leave( KErrGeneral ); CleanupStack::PopAndDestroy( message ); iStatus = KRequestPending; @@ -1671,7 +1680,10 @@ User::Panic(_L("CTestSecDlgNotifier"), 0); } } - CCTSignTextDialog::RunDlgLD( resource, *message, iStatus, iRetValue ); + // TODO + //CCTSignTextDialog::RunDlgLD( resource, *message, iStatus, iRetValue ); + User::Leave( KErrGeneral ); + resource = resource; // avoids compiler warning CleanupStack::PopAndDestroy( message ); iStatus = KRequestPending; @@ -1686,13 +1698,14 @@ // --------------------------------------------------------- // HBufC* CCTSecurityDialogsAO::MessageQueryCertDetailsL( - const TDesC8& aCert, - const CCTCertInfo* aCertInfo, - TCertificateFormat aCertFormat, - const CCTKeyInfo* aKeyInfo) + const TDesC8& /*aCert*/, + const CCTCertInfo* /*aCertInfo*/, + TCertificateFormat /*aCertFormat*/, + const CCTKeyInfo* /*aKeyInfo*/) { // Create message buffer HBufC* message = HBufC::NewLC( KMaxLengthTextDetailsBody ); +/* TPtr messagePtr = message->Des(); // Label if ( aCertInfo ) @@ -1754,7 +1767,7 @@ User::Leave( KErrNotSupported ); } } - +*/ CleanupStack::Pop( message ); return message; } @@ -1763,22 +1776,25 @@ // CCTSecurityDialogsAO::AddIssuerAndSubjectL(...) // ----------------------------------------------------------------------------- // -void CCTSecurityDialogsAO::AddSiteL( TDes& aMessage ) +void CCTSecurityDialogsAO::AddSiteL( TDes& /*aMessage*/ ) { +/* if ( iServerName ) { DetailsFieldDynamicL( aMessage, iServerName->Des(), R_QTN_CM_SITE, R_TEXT_RESOURCE_DETAILS_VIEW_NOT_DEFINED ); } +*/ } // ----------------------------------------------------------------------------- // CCTSecurityDialogsAO::AddIssuerAndSubjectL(...) // ----------------------------------------------------------------------------- // -void CCTSecurityDialogsAO::AddIssuerAndSubjectL( TDes& aMessage, const CX509Certificate& aCert ) +void CCTSecurityDialogsAO::AddIssuerAndSubjectL( TDes& /*aMessage*/, const CX509Certificate& /*aCert*/ ) { +/* HBufC* issuer = NULL; HBufC* owner = NULL; X509CertNameParser::SubjectFullNameL( aCert, owner ); @@ -1796,14 +1812,16 @@ R_TEXT_RESOURCE_DETAILS_VIEW_SUBJECT, R_TEXT_RESOURCE_VIEW_NO_SUBJECT_DETAILS ); CleanupStack::PopAndDestroy( owner ); //owner +*/ } // ----------------------------------------------------------------------------- // CCTSecurityDialogsAO::AddKeySizeL(...) // ----------------------------------------------------------------------------- // -void CCTSecurityDialogsAO::AddKeySizeL( TDes& aMessage, const CCTKeyInfo* aKeyInfo ) +void CCTSecurityDialogsAO::AddKeySizeL( TDes& /*aMessage*/, const CCTKeyInfo* /*aKeyInfo*/ ) { +/* TUint keySize = aKeyInfo->Size(); TBuf sizeBuf; @@ -1817,14 +1835,16 @@ R_TEXT_RESOURCE_DETAILS_VIEW_NOT_DEFINED ); aMessage.Append( KEnterEnter ); +*/ } // ----------------------------------------------------------------------------- // CCTSecurityDialogsAO::AddKeyUsageL(...) // ----------------------------------------------------------------------------- // -void CCTSecurityDialogsAO::AddKeyUsageL( TDes& aMessage, const CCTKeyInfo* aKeyInfo ) +void CCTSecurityDialogsAO::AddKeyUsageL( TDes& /*aMessage*/, const CCTKeyInfo* /*aKeyInfo*/ ) { +/* if ( aKeyInfo != NULL ) { TKeyUsagePKCS15 keyUsage = aKeyInfo->Usage(); @@ -1847,14 +1867,16 @@ DetailsFieldResourceL( aMessage, R_TEXT_RESOURCE_DETAILS_VIEW_KEY_USAGE, usage); } +*/ } // ----------------------------------------------------------------------------- // CCTSecurityDialogsAO::AddKeyUsageL(...) // ----------------------------------------------------------------------------- // -void CCTSecurityDialogsAO::AddKeyUsageL( TDes& aMessage, const CX509Certificate& aCert ) +void CCTSecurityDialogsAO::AddKeyUsageL( TDes& /*aMessage*/, const CX509Certificate& /*aCert*/ ) { +/* TKeyUsageX509 x509Usage = EX509UsageNone; TKeyUsagePKCS15 pkcs15KeyUsage = EPKCS15UsageNone; const CX509CertExtension* ext = aCert.Extension(KKeyUsage); @@ -1927,14 +1949,16 @@ } DetailsFieldResourceL( aMessage, R_TEXT_RESOURCE_DETAILS_VIEW_KEY_USAGE, usage ); +*/ } // ----------------------------------------------------------------------------- // CCTSecurityDialogsAO::AddKeyAlgorithmL(...) // ----------------------------------------------------------------------------- // -void CCTSecurityDialogsAO::AddKeyAlgorithmL( TDes& aMessage, const CCTKeyInfo* aKeyInfo ) +void CCTSecurityDialogsAO::AddKeyAlgorithmL( TDes& /*aMessage*/, const CCTKeyInfo* /*aKeyInfo*/ ) { +/* TInt algRes = 0; switch( aKeyInfo->Algorithm()) { @@ -1965,6 +1989,7 @@ } DetailsFieldResourceL( aMessage, R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM, algRes); +*/ } // ----------------------------------------------------------------------------- @@ -1999,8 +2024,9 @@ // --------------------------------------------------------- // void CCTSecurityDialogsAO::AddLocationInfoL( - TDes& aMessage, TUid aUid, TBool aCertificate ) + TDes& /*aMessage*/, TUid /*aUid*/, TBool /*aCertificate*/ ) { +/* TInt location = 0; TInt locationRes =0; @@ -2041,6 +2067,7 @@ } DetailsFieldResourceL( aMessage, locationRes, location ); +*/ } // ----------------------------------------------------------------------------- @@ -2052,7 +2079,7 @@ { TLocale locale; TTimeIntervalSeconds offSet = locale.UniversalTimeOffset(); - DetailsResourceL( aMessage, R_TEXT_RESOURCE_DETAILS_VIEW_VALID_FROM ); + //DetailsResourceL( aMessage, R_TEXT_RESOURCE_DETAILS_VIEW_VALID_FROM ); const CValidityPeriod& validityPeriod = aCert.ValidityPeriod(); TTime startValue = validityPeriod.Start(); startValue += offSet; @@ -2067,7 +2094,7 @@ aMessage.Append( startString ); aMessage.Append( KEnterEnter ); - DetailsResourceL( aMessage, R_TEXT_RESOURCE_DETAILS_VIEW_VALID_UNTIL ); + //DetailsResourceL( aMessage, R_TEXT_RESOURCE_DETAILS_VIEW_VALID_UNTIL ); TTime finishValue = validityPeriod.Finish(); finishValue += offSet; TBuf finishString; @@ -2086,46 +2113,91 @@ // CCTSecurityDialogsAO::AddCertFormatL(...) // ----------------------------------------------------------------------------- // -void CCTSecurityDialogsAO::AddCertFormatL( TDes& aMessage, TCertificateFormat aCertFormat) +void CCTSecurityDialogsAO::AddCertFormatL( TDes& /*aMessage*/, TCertificateFormat aCertFormat) { - TInt fieldType = 0; + //TInt fieldType = 0; switch ( aCertFormat ) { case EX509CertificateUrl: case EX509Certificate: { - fieldType = R_TEXT_RESOURCE_DETAILS_VIEW_CERT_FORMAT_X509; + //fieldType = R_TEXT_RESOURCE_DETAILS_VIEW_CERT_FORMAT_X509; break; } default: { - fieldType = R_TEXT_RESOURCE_DETAILS_VIEW_NOT_DEFINED; + //fieldType = R_TEXT_RESOURCE_DETAILS_VIEW_NOT_DEFINED; break; } } - DetailsFieldResourceL( aMessage, - R_TEXT_RESOURCE_DETAILS_VIEW_CERT_FORMAT, fieldType ); + //DetailsFieldResourceL( aMessage, + // R_TEXT_RESOURCE_DETAILS_VIEW_CERT_FORMAT, fieldType ); } // ----------------------------------------------------------------------------- // CCTSecurityDialogsAO::AddCertAlgorithmsL(...) // ----------------------------------------------------------------------------- // -void CCTSecurityDialogsAO::AddCertAlgorithmsL( TDes& aMessage, const CX509Certificate& aCert ) +void CCTSecurityDialogsAO::AddCertAlgorithmsL( TDes& /*aMessage*/, const CX509Certificate& /*aCert*/ ) { +/* TInt fieldType = 0; TInt fieldType2 = 0; - // digest algorithm - TAlgorithmId algorithmId = aCert.SigningAlgorithm().DigestAlgorithm().Algorithm(); - fieldType = AlgorithmNameResourceId( algorithmId ); + TAlgorithmId algorithmId = + aCert.SigningAlgorithm().DigestAlgorithm().Algorithm(); + switch ( algorithmId ) + { + case EMD2: + { + fieldType = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_MD2; + break; + } + case EMD5: + { + fieldType = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_MD5; + break; + } + case ESHA1: + { + fieldType = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_SHA1; + break; + } + default: + { + fieldType = R_TEXT_RESOURCE_DETAILS_VIEW_UNKNOWN; + break; + } + } // public-key algorithm - algorithmId = aCert.SigningAlgorithm().AsymmetricAlgorithm().Algorithm(); - fieldType2 = AlgorithmNameResourceId( algorithmId ); + algorithmId = + aCert.SigningAlgorithm().AsymmetricAlgorithm().Algorithm(); + switch ( algorithmId ) + { + case ERSA: + { + fieldType2 = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_RSA; + break; + } + case EDSA: + { + fieldType2 = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_DSA; + break; + } + case EDH: + { + fieldType2 = R_TEXT_RESOURCE_DETAILS_VIEW_ALGORITHM_DH; + break; + } + default: + { + fieldType2 = R_TEXT_RESOURCE_DETAILS_VIEW_UNKNOWN; + } + } // If other algorithm is unknown - if( fieldType == R_TEXT_RESOURCE_DETAILS_VIEW_UNKNOWN || + if ( fieldType == R_TEXT_RESOURCE_DETAILS_VIEW_UNKNOWN || fieldType2 == R_TEXT_RESOURCE_DETAILS_VIEW_UNKNOWN ) { DetailsFieldResourceL( aMessage, @@ -2142,14 +2214,16 @@ CleanupStack::PopAndDestroy(); // stringHolder aMessage.Append( KEnterEnter ); } +*/ } // ----------------------------------------------------------------------------- // CCTSecurityDialogsAO::AddCertSerialNumberL(...) // ----------------------------------------------------------------------------- // -void CCTSecurityDialogsAO::AddCertSerialNumberL( TDes& aMessage, const CX509Certificate& aCert ) +void CCTSecurityDialogsAO::AddCertSerialNumberL( TDes& /*aMessage*/, const CX509Certificate& /*aCert*/ ) { +/* // certificate serial number DetailsResourceL( aMessage, R_TEXT_RESOURCE_DETAILS_VIEW_SERIAL_NUMBER ); TPtrC8 serialNumber = aCert.SerialNumber(); @@ -2162,14 +2236,16 @@ } aMessage.Append( KEnterEnter ); +*/ } // ----------------------------------------------------------------------------- // CCTSecurityDialogsAO::AddCertFingerprintsL(...) // ----------------------------------------------------------------------------- // -void CCTSecurityDialogsAO::AddCertFingerprintsL( TDes& aMessage, const CX509Certificate& aCert ) +void CCTSecurityDialogsAO::AddCertFingerprintsL( TDes& /*aMessage*/, const CX509Certificate& /*aCert*/ ) { +/* // certificate fingerprint SHA-1 DetailsResourceL( aMessage, R_TEXT_RESOURCE_DETAILS_VIEW_FINGERPRINT ); @@ -2187,6 +2263,7 @@ CleanupStack::PopAndDestroy( md5 ); DevideToBlocks( fingerprint, aMessage ); +*/ } // --------------------------------------------------------- @@ -2320,6 +2397,7 @@ iMessagePtr.WriteL( iReplySlot, pinValueBufPtr ); break; } + case EChangePIN: case EUnblockPIN: { @@ -2330,6 +2408,7 @@ iMessagePtr.WriteL( iReplySlot, twoPINOutputBuf ); break; } + case ESignText: // flow thru case EUserAuthenticationText: // flow thru case EUserAuthentication: @@ -2338,13 +2417,14 @@ iMessagePtr.WriteL( iReplySlot, tokenObjectHandleBuf ); break; } + case EServerAuthenticationFailure: { TServerAuthenticationFailureDialogResult result = EStop; - if ( iRetValue != EServerCertAcceptedPermanently ) + if( iRetValue != EServerCertAcceptedPermanently ) { - if ( iRetValue == EServerCertAcceptedTemporarily ) + if( iRetValue == EServerCertAcceptedTemporarily ) { result = EContinue; } @@ -2365,12 +2445,14 @@ break; } + case EPINBlocked: case EUnblockPINInClear: { User::Leave( KErrNotSupported ); break; } + case ECreateCSR: case ECertDetails: case ESaveCert: @@ -2386,6 +2468,7 @@ { break; // Complete is enough } + default: User::Panic( _L("CTestSecDlgNotifier"), 0 ); } @@ -2433,23 +2516,14 @@ void CCTSecurityDialogsAO::DoCancel() { WIMSECURITYDIALOGS_WRITE( "CCTSecurityDialogsAO::DoCancel" ); - - // Note that iQueryDialog may point to already deleted memory. - // Dialogs need to set and reset iQueryDialogDeleted flag to - // allow deleting the dialog from CCTSecurityDialogsAO. - if( !iQueryDialogDeleted ) - { - delete iQueryDialog; - iQueryDialogDeleted = ETrue; - } - iQueryDialog = NULL; - - if ( !iPinQueryDialogDeleted ) + /* + if( !iPinQueryDialogDeleted ) { delete iPinQueryDialog; iPinQueryDialogDeleted = ETrue; } iPinQueryDialog = NULL; + */ // Complete message if it has not been completed earlier. if( !iMessagePtr.IsNull() ) @@ -2477,10 +2551,12 @@ // void CCTSecurityDialogsAO::DoHandleSaveServerCertL() { + TRACE( "CCTSecurityDialogsAO::DoHandleSaveServerCertL" ); + if ( iTrustedSiteCertStore ) { iTrustedSiteCertStore->Add( *iCertLabel, EX509Certificate, - EPeerCertificate, NULL, NULL, *iCertBuf, iStatus ); + EPeerCertificate, NULL, NULL, *iCertBuf, iStatus ); // Next step is to update trust site db iNextStep = EAddTrustedSite; @@ -2511,3 +2587,14 @@ } } +void CCTSecurityDialogsAO::ShowInformationNoteL( TInt aResourceID ) const + { + HBufC* buffer = CEikonEnv::Static()->AllocReadResourceLC( aResourceID ); + CHbDeviceMessageBoxSymbian* iMessageBox = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EInformation); + CleanupStack::PushL(iMessageBox); + iMessageBox->SetTextL(buffer->Des()); + iMessageBox->SetTimeout(6000); + iMessageBox->ExecL(); + CleanupStack::PopAndDestroy(iMessageBox); + CleanupStack::PopAndDestroy( buffer ); + } diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CTSecurityDialogs/NotifSrc/CTSelectcertificatedialog.cpp --- a/pkiutilities/CTSecurityDialogs/NotifSrc/CTSelectcertificatedialog.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/NotifSrc/CTSelectcertificatedialog.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -18,6 +18,7 @@ // INCLUDE FILES +#include #include "CTSelectCertificateDialog.h" #include "CTSecurityDialogDefs.h" #include diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CTSecurityDialogs/NotifSrc/CTSigntextdialog.cpp --- a/pkiutilities/CTSecurityDialogs/NotifSrc/CTSigntextdialog.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/NotifSrc/CTSigntextdialog.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -18,6 +18,7 @@ // INCLUDE FILES +#include #include "CTSignTextDialog.h" #include "CTSecurityDialogsLogger.h" #include @@ -25,6 +26,7 @@ #include #include + // ============================ MEMBER FUNCTIONS =============================== // ----------------------------------------------------------------------------- diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CTSecurityDialogs/NotifSrc/CTUntrustedCertQuery.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/CTSecurityDialogs/NotifSrc/CTUntrustedCertQuery.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,238 @@ +/* +* Copyright (c) 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" +* 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: Displays untrusted certificate dialog. +* +*/ + +#include "CTUntrustedCertQuery.h" // CCTUntrustedCertQuery +#include // CHbSymbianVariantMap + +// Note that the dialog type string, the parameters name strings, and the return code +// name string and values must match to those defined in Qt-side untrusted certificate +// dialog (in untrustedcertificatedefinitions.h file). + +// Device dialog type for untrusted certificate dialog +_LIT( KUntrustedCertificateDialog, "com.nokia.untrustedcert/1.0" ); + +// Variant map parameter names for untrusted certificate dialog +_LIT( KUntrustedCertEncodedCertificate, "cert" ); // bytearray, mandatory +_LIT( KUntrustedCertServerName, "host" ); // string, mandatory +_LIT( KUntrustedCertValidationError, "err" ); // int (TValidationError), mandatory +_LIT( KUntrustedCertTrustedSiteStoreFail, "tss" ); // any, prevents permanent acceptance + +// Dialog return code name and values +_LIT( KUntrustedCertDialogResult, "result" ); // int +const TInt KUntrustedCertDialogRejected = 0; +const TInt KUntrustedCertDialogAccepted = 1; +const TInt KUntrustedCertDialogAcceptedPermanently = 2; + +// TODO: replace with OST tracing +#ifdef _DEBUG +#include +#define TRACE(x) RDebug::Printf(x) +#define TRACE1(x,y) RDebug::Printf(x,y) +#else +#define TRACE(x) +#define TRACE1(x,y) +#endif + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CCTUntrustedCertQuery::NewLC() +// --------------------------------------------------------------------------- +// +CCTUntrustedCertQuery* CCTUntrustedCertQuery::NewLC( + TValidationError aValidationError, const TDesC8& aCertificate, + const TDesC& aServerName, TBool aCanHandlePermanentAccept ) + { + TRACE( "CCTUntrustedCertQuery::NewLC" ); + CCTUntrustedCertQuery* self = new ( ELeave ) CCTUntrustedCertQuery( + aValidationError, aCertificate, aServerName, + aCanHandlePermanentAccept ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CCTUntrustedCertQuery::~CCTUntrustedCertQuery() +// --------------------------------------------------------------------------- +// +CCTUntrustedCertQuery::~CCTUntrustedCertQuery() + { + TRACE( "CCTUntrustedCertQuery::~CCTUntrustedCertQuery" ); + Cancel(); + delete iWait; + delete iDeviceDialog; + delete iVariantMap; + } + +// --------------------------------------------------------------------------- +// CCTUntrustedCertQuery::ShowQueryAndWaitForResponseL() +// --------------------------------------------------------------------------- +// +void CCTUntrustedCertQuery::ShowQueryAndWaitForResponseL( TResponse& aResponse ) + { + TRACE( "CCTUntrustedCertQuery::ShowQueryAndWaitForResponseL" ); + if( !iDeviceDialog ) + { + iDeviceDialog = CHbDeviceDialogSymbian::NewL(); + } + if( !iVariantMap ) + { + iVariantMap = CHbSymbianVariantMap::NewL(); + } + + CHbSymbianVariant *variant = NULL; + variant = CHbSymbianVariant::NewL( &iCertificate, CHbSymbianVariant::EBinary ); + User::LeaveIfError( iVariantMap->Add( KUntrustedCertEncodedCertificate, variant ) ); + variant = CHbSymbianVariant::NewL( &iValidationError, CHbSymbianVariant::EInt ); + User::LeaveIfError( iVariantMap->Add( KUntrustedCertValidationError, variant ) ); + variant = CHbSymbianVariant::NewL( &iServerName, CHbSymbianVariant::EDes ); + User::LeaveIfError( iVariantMap->Add( KUntrustedCertServerName, variant ) ); + if( !iCanHandlePermanentAccept ) + { + variant = CHbSymbianVariant::NewL( &iCanHandlePermanentAccept, CHbSymbianVariant::EBool ); + User::LeaveIfError( iVariantMap->Add( KUntrustedCertTrustedSiteStoreFail, variant ) ); + } + + User::LeaveIfError( iDeviceDialog->Show( KUntrustedCertificateDialog, *iVariantMap, this ) ); + + iStatus = KRequestPending; + SetActive(); + TRACE( "CCTUntrustedCertQuery::ShowQueryAndWaitForResponseL, wait start" ); + iWait->Start(); + TRACE( "CCTUntrustedCertQuery::ShowQueryAndWaitForResponseL, wait end" ); + TRACE1( "CCTUntrustedCertQuery::ShowQueryAndWaitForResponseL, iWaitCompletionCode=%d", iWaitCompletionCode ); + User::LeaveIfError( iWaitCompletionCode ); + TRACE1( "CCTUntrustedCertQuery::ShowQueryAndWaitForResponseL, iResponse=%d", iResponse ); + aResponse = iResponse; + } + +// --------------------------------------------------------------------------- +// CCTUntrustedCertQuery::DoCancel() +// --------------------------------------------------------------------------- +// +void CCTUntrustedCertQuery::DoCancel() + { + TRACE( "CCTUntrustedCertQuery::DoCancel begin" ); + if( iDeviceDialog ) + { + TRACE( "CCTUntrustedCertQuery::DoCancel, iDeviceDialog->Cancel()" ); + iDeviceDialog->Cancel(); + } + if( iWait && iWait->IsStarted() && iWait->CanStopNow() ) + { + TRACE( "CCTUntrustedCertQuery::DoCancel, iWait->AsyncStop()" ); + iWaitCompletionCode = KErrCancel; + iWait->AsyncStop(); + } + TRACE( "CCTUntrustedCertQuery::DoCancel end" ); + } + +// --------------------------------------------------------------------------- +// CCTUntrustedCertQuery::RunL() +// --------------------------------------------------------------------------- +// +void CCTUntrustedCertQuery::RunL() + { + TRACE1( "CCTUntrustedCertQuery::RunL, iStatus.Int()=%d", iStatus.Int() ); + iWaitCompletionCode = iStatus.Int(); + if( iWait ) + { + iWait->AsyncStop(); + } + } + +// --------------------------------------------------------------------------- +// CCTUntrustedCertQuery::DataReceived() +// --------------------------------------------------------------------------- +// +void CCTUntrustedCertQuery::DataReceived( CHbSymbianVariantMap& aData ) + { + TRACE( "CCTUntrustedCertQuery::DataReceived" ); + const CHbSymbianVariant* variant = aData.Get( KUntrustedCertDialogResult ); + if( variant ) + { + TInt* value = variant->Value(); + if( value ) + { + switch( *value ) + { + case KUntrustedCertDialogRejected: + TRACE( "CCTUntrustedCertQuery::DataReceived, rejected" ); + iResponse = EQueryRejected; + break; + case KUntrustedCertDialogAccepted: + TRACE( "CCTUntrustedCertQuery::DataReceived, accepted" ); + iResponse = EQueryAccepted; + break; + case KUntrustedCertDialogAcceptedPermanently: + TRACE( "CCTUntrustedCertQuery::DataReceived, accepted permanently" ); + iResponse = EQueryAcceptedPermanently; + break; + default: + __ASSERT_DEBUG( EFalse, User::Invariant() ); + break; + } + } + else + { + __ASSERT_DEBUG( EFalse, User::Invariant() ); + } + } + else + { + __ASSERT_DEBUG( EFalse, User::Invariant() ); + } + } + +// --------------------------------------------------------------------------- +// CCTUntrustedCertQuery::DeviceDialogClosed() +// --------------------------------------------------------------------------- +// +void CCTUntrustedCertQuery::DeviceDialogClosed( TInt aCompletionCode ) + { + TRACE1( "CCTUntrustedCertQuery::DeviceDialogClosed aCompletionCode=%d", aCompletionCode ); + TRequestStatus* status( &iStatus ); + User::RequestComplete( status, aCompletionCode ); + } + +// --------------------------------------------------------------------------- +// CCTUntrustedCertQuery::CCTUntrustedCertQuery() +// --------------------------------------------------------------------------- +// +CCTUntrustedCertQuery::CCTUntrustedCertQuery( + TValidationError aValidationError, const TDesC8& aCertificate, + const TDesC& aServerName, TBool aCanHandlePermanentAccept ) : + CActive( CActive::EPriorityStandard ), iValidationError( aValidationError ), + iCertificate( aCertificate ), iServerName( aServerName ), + iCanHandlePermanentAccept( aCanHandlePermanentAccept ), + iResponse( EQueryRejected ) + { + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------------------------- +// CCTUntrustedCertQuery::ConstructL() +// --------------------------------------------------------------------------- +// +void CCTUntrustedCertQuery::ConstructL() + { + TRACE( "CCTUntrustedCertQuery::ConstructL" ); + iWait = new( ELeave ) CActiveSchedulerWait; + } + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CTSecurityDialogs/NotifSrc/CTpinquerydialog.cpp --- a/pkiutilities/CTSecurityDialogs/NotifSrc/CTpinquerydialog.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/NotifSrc/CTpinquerydialog.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -18,6 +18,7 @@ // INCLUDE FILES +#include #include "CTPinQueryDialog.h" #include "CTSecurityDialogsLogger.h" #include diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CTSecurityDialogs/data/CTsecdlgs.rss --- a/pkiutilities/CTSecurityDialogs/data/CTsecdlgs.rss Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/data/CTsecdlgs.rss Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002-2008 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" @@ -24,7 +24,7 @@ #include #include #include -#include +//#include #include #include @@ -505,7 +505,7 @@ control= AVKON_CONFIRMATION_QUERY { layout = EConfirmationLayout; - // label defined dynamically, using host name parameter + label = qtn_ics_ssl_conf_q_accept_ood; }; } }; @@ -534,7 +534,7 @@ control= AVKON_CONFIRMATION_QUERY { layout = EConfirmationLayout; - // label defined dynamically, using host name parameter + label = qtn_ics_ssl_conf_q_accept_untrusted; }; } }; @@ -564,7 +564,7 @@ control= AVKON_CONFIRMATION_QUERY { layout = EConfirmationLayout; - // label defined dynamically, using host name parameter + label = qtn_ics_ssl_conf_q_accept_site; }; } }; @@ -876,10 +876,4 @@ RESOURCE TBUF r_qtn_cm_site { buf=qtn_cm_site; } -RESOURCE TBUF r_qtn_ics_ssl_conf_q_accept_site { buf=qtn_ics_ssl_conf_q_accept_site; } - -RESOURCE TBUF r_qtn_ics_ssl_conf_q_accept_ood { buf=qtn_ics_ssl_conf_q_accept_ood; } - -RESOURCE TBUF r_qtn_ics_ssl_conf_q_accept_untrusted { buf=qtn_ics_ssl_conf_q_accept_untrusted; } - // End of file diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CTSecurityDialogs/ecomsrc/CTSecDlgWrapper.cpp --- a/pkiutilities/CTSecurityDialogs/ecomsrc/CTSecDlgWrapper.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/ecomsrc/CTSecDlgWrapper.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -18,6 +18,7 @@ // INCLUDE FILES #include +#include #include // link against aknnotifierwrapper.lib #include #include "CTSecurityDialogDefs.h" diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CTSecurityDialogs/loc/wmlbrowser_wim.loc --- a/pkiutilities/CTSecurityDialogs/loc/wmlbrowser_wim.loc Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/loc/wmlbrowser_wim.loc Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002 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" @@ -286,35 +286,29 @@ //d:Confirmation query text shown if the server certificate contains -//d:site name that does not match to the one that was given in request. -//d:%U stands for the name of the site where the connection is requested. -//d:Displaying the site name is a security feature. +//d:site name that does not match to the one that was given in request the query contains text //l:popup_note_window //w: //r:3.2 // -#define qtn_ics_ssl_conf_q_accept_site "Service %U has sent a certificate with different site name than requested. Accept anyway?" +#define qtn_ics_ssl_conf_q_accept_site "This site has sent a certificate with different site name than requested. Accept anyway?" //d:Confirmation query text shown if the server certificate is out-of date -//d:%U stands for the name of the site where the connection is requested. -//d:Displaying the site name is a security feature. //l:popup_note_window //w: //r:3.2 // -#define qtn_ics_ssl_conf_q_accept_ood "Service %U has sent a certificate which is out of date. Accept anyway?" +#define qtn_ics_ssl_conf_q_accept_ood "This site has sent a certificate which is out of date. Accept anyway?" -//d:Confirmation query text shown if the server certificate issued by unknown +//d:Confirmation query text shown if the server certificate issued by unknown //d:Certification Authority -//d:%U stands for the name of the site where the connection is requested. -//d:Displaying the site name is a security feature. //l:popup_note_window //w: //r:3.2 // -#define qtn_ics_ssl_conf_q_accept_untrusted "Service %U has sent an untrusted certificate. Accept anyway?" +#define qtn_ics_ssl_conf_q_accept_untrusted "This site has sent an untrusted certificate. Accept anyway?" //d:Information note text shown if the server certificate has an invalid signature //d:Softkeys are SK1 'Close' (text_softkey_close) and SK2 'Details' (text_softkey_details) diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertSaver/data/CertSaver.rss --- a/pkiutilities/CertSaver/data/CertSaver.rss Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertSaver/data/CertSaver.rss Tue Aug 31 16:04:40 2010 +0300 @@ -22,14 +22,9 @@ // INCLUDES #include -#include #include -#include #include -#include -#include #include -#include //qtn_cm_not_valid_yet #include #include "certsaver.hrh" @@ -158,6 +153,7 @@ buf = qtn_cm_not_defined; } + //---------------------------------------------------- // // r_certsaver_softkeys_save_discard @@ -209,8 +205,6 @@ }; } - - //---------------------------------------------------- // // r_message_query_dosave @@ -282,24 +276,28 @@ // //---------------------------------------------------- // -RESOURCE DIALOG r_certsaver_warning_note - { - flags = EGeneralQueryFlags; - buttons = r_certsaver_softkeys_save_discard; - items= - { - DLG_LINE - { - type=EAknCtQuery; - id=EGeneralQuery; - control= AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationLayout; +RESOURCE TBUF r_certsaver_warning_note { buf = qtn_httpsec_save_rootcertificate; } + +/* +RESOURCE DIALOG r_certsaver_warning_note + { + flags = EGeneralQueryFlags; + buttons = r_certsaver_softkeys_save_discard; + items= + { + DLG_LINE + { + type=EAknCtQuery; + id=EGeneralQuery; + control= AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; label = qtn_httpsec_save_rootcertificate; - }; - } - }; - } + }; + } + }; + } +*/ //----------------------------------------------------------------------------- // @@ -472,6 +470,7 @@ RESOURCE TBUF r_certsaver_one_private_key{ buf = qtn_cm_one_private_key; } RESOURCE TBUF r_certsaver_one_personal_certificate { buf = qtn_cm_one_personal_certificate; } RESOURCE TBUF r_certsaver_one_authority_certificate { buf = qtn_cm_one_authority_certificate; } -RESOURCE TBUF r_certsaver_trustedsite_warning { buf = qtn_cm_save_trustedsite_certificate_warning_text; } +RESOURCE TBUF r_certsaver_trustedsite_warning + { buf = qtn_cm_save_trustedsite_certificate_warning_text; } // End of File diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertSaver/group/CertSaver.mmp --- a/pkiutilities/CertSaver/group/CertSaver.mmp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertSaver/group/CertSaver.mmp Tue Aug 31 16:04:40 2010 +0300 @@ -54,11 +54,16 @@ USERINCLUDE ../inc USERINCLUDE ../../Include +USERINCLUDE ../../../securitydialogs/SecUi/Inc MW_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE ../../PKCS12/CrPkcs12/Inc SYSTEMINCLUDE ../../DeviceToken/Inc +SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore +SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets + + LIBRARY euser.lib LIBRARY apparc.lib LIBRARY cone.lib @@ -81,5 +86,9 @@ LIBRARY aknskins.lib LIBRARY DevTokenClient.lib +LIBRARY HbCore.lib +LIBRARY HbWidgets.lib +LIBRARY secui.lib + SMPSAFE diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertSaver/inc/CertSaverModel.h --- a/pkiutilities/CertSaver/inc/CertSaverModel.h Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertSaver/inc/CertSaverModel.h Tue Aug 31 16:04:40 2010 +0300 @@ -77,12 +77,6 @@ void SavePKCS12L(); - /** - * Shows a error note with given text. - * @param aResourceID Id of the resource text to be shown. - */ - void ShowErrorNoteL( TInt aResourceID ) const; - private: // New functions /** @@ -198,11 +192,6 @@ */ void AddNewlinesToMessage( TDes& aMessage ) const; - /** - * Shows a confirmation note with given text. - * @param aResourceID Id of the resource text to be shown. - */ - void ShowConfirmationNoteL( TInt aResourceID ) const; /** * Shows a information note with given text. @@ -310,10 +299,12 @@ */ void DivideToBlocks( const TDesC8& aInput, TDes& aOutput ) const; - TBool DoMessageQueryL( - TInt aDialogResId, +/* + TBool DoMessageQueryL( + TInt aDialogResId, TInt aHeadingResId, - TDesC& aMessage ); + TDesC& aMessage ); +*/ private: //data TCertificateOwnerType iCertOwnerType; @@ -336,6 +327,8 @@ TInt iSavedUserCertsCount; TInt iSelectedKeyStore; TBool iKeyAlreadyExists; + + CEikonEnv* iEikEnv; }; #endif diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertSaver/loc/certsaver.loc --- a/pkiutilities/CertSaver/loc/certsaver.loc Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertSaver/loc/certsaver.loc Tue Aug 31 16:04:40 2010 +0300 @@ -30,6 +30,7 @@ //l:control_pane_t1/opt7 #define text_wmls_list_disc_recvd_cert "Discard" + //d:Item in save-confirmation query pop up. //d:This represents to whom the certificate //d:has been issued to. diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertSaver/src/CertSaverAppUi.cpp --- a/pkiutilities/CertSaver/src/CertSaverAppUi.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertSaver/src/CertSaverAppUi.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -18,7 +18,6 @@ // INCLUDE FILES #include // For FFSSpaceBelowCriticalLevelL(..) -#include // Note dialogs #include #include #include diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertSaver/src/CertSaverDocument.cpp --- a/pkiutilities/CertSaver/src/CertSaverDocument.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertSaver/src/CertSaverDocument.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -112,7 +112,7 @@ OpenFileL( docStore, file ); - CleanupStack::PopAndDestroy(); // Close file + CleanupStack::PopAndDestroy(&file); // Close file return docStore; } @@ -137,7 +137,7 @@ iAO = new (ELeave) CShutterAO; iAO->Exit(); #ifdef _DEBUG - RDebug::Print( _L("Exiting OpenFileL") ); + #endif } diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertSaver/src/CertSaverModel.cpp --- a/pkiutilities/CertSaver/src/CertSaverModel.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertSaver/src/CertSaverModel.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -16,9 +16,6 @@ */ -// INCLUDE FILES -#include // Note dialogs -#include // For CAknMessageQueryDialog #include // For loading resource strings #include // For saving the certificates #include // For saving the certificates @@ -35,6 +32,8 @@ #include #include #include +#include // CEikonEnv +#include // AknTextUtils #include #include "CertSaverModel.h" @@ -44,7 +43,14 @@ #include "certsaver.hrh" #include "securityuisvariant.hrh" +#include +#include +#include + +#include "SecQueryUi.h" // needed for label dialog + // CONSTANTS + const TInt32 KWTLSTrusterUID( 268479059 ); const TInt32 KInternetTrusterUID( 268441661 ); const TInt32 KApplicationControllerTrusterUID( 268452523 ); @@ -56,12 +62,14 @@ const TInt KMaxLengthTextMeassageBody( 5000 ); const TInt KMaxLengthTextDateString( 11 ); // "dd/mm/yyyy0" +const TInt KMaxLengthTextCheckBoxData( 255 ); // "dd/mm/yyyy0" //Issuer and Owner max visible length const TInt KMaxLengthTextCertIdentifierVisible( 1000 ); const TInt KAttempts( 3 ); const TInt KFingerprintLength( 50 ); +const TInt KTokenLength( 32 ); _LIT( KCertSaverListBoxItemPrefix, "1\t" ); const TInt KItemBufLen = 2 + KMaxName; @@ -116,6 +124,7 @@ const TCertificateOwnerType& aOwnerType, const TCertificateFormat& aCertFormat ) { + iCertOwnerType = aOwnerType; iCertFormat = aCertFormat; iNewCert = &aCertificate; @@ -139,6 +148,7 @@ // void CCertSaverModel::DoSavePrivateKeyL( const TDesC8& aKey ) { + CheckFSSpaceL( aKey ); TKeyIdentifier keyIdentifier; @@ -158,7 +168,8 @@ CleanupStack::PopAndDestroy( pkcs8Data ); if (KeyAlreadyExistsL( startDate, endDate, keyIdentifier, keyUsage) ) { - User::Leave( KErrNone ); + // used to leave with error none + return; } TInt accessType( 0 ); @@ -196,7 +207,7 @@ case KErrKeySize: case KErrArgument: { - ShowErrorNoteL( R_CERTSAVER_KEY_TYPE_NOT_SUPPORTED ); + ShowInformationNoteL( R_CERTSAVER_KEY_TYPE_NOT_SUPPORTED ); User::Leave( KErrCancel ); break; } @@ -207,21 +218,21 @@ } case KErrKeyUsage: { - ShowErrorNoteL( R_CERTSAVER_PRIVATE_KEY_CORRUPTED ); + ShowInformationNoteL( R_CERTSAVER_PRIVATE_KEY_CORRUPTED ); User::Leave( KErrCancel ); break; } case KErrCancel: case KErrPermissionDenied: { - ShowErrorNoteL( R_CERTSAVER_PKCS12_DISCARDED ); + ShowInformationNoteL( R_CERTSAVER_PKCS12_DISCARDED ); User::Leave( KErrCancel ); break; } case KErrCorrupt: case KErrEof: { - ShowErrorNoteL( R_CERTSAVER_KEYSTORE_CORRUPTED ); + ShowInformationNoteL( R_CERTSAVER_KEYSTORE_CORRUPTED ); User::Leave( KErrCancel ); break; } @@ -254,6 +265,7 @@ const TKeyIdentifier& aKeyIdentifier, TKeyUsagePKCS15& aKeyUsage ) { + TBool ret = EFalse; TCTKeyAttributeFilter keyFilter; keyFilter.iKeyAlgorithm = CKeyInfoBase::EInvalidAlgorithm; @@ -272,7 +284,7 @@ case KErrCorrupt: case KErrEof: { - ShowErrorNoteL( R_CERTSAVER_KEYSTORE_CORRUPTED ); + ShowInformationNoteL( R_CERTSAVER_KEYSTORE_CORRUPTED ); User::Leave( KErrCancel ); } default: @@ -304,6 +316,7 @@ const TKeyIdentifier& aKeyIdentifier ) { + for ( TInt i = 0; i < iParser.UserCertificates().Count(); i++ ) { const CX509Certificate* cert = iParser.UserCertificates().At( i ); @@ -330,6 +343,7 @@ // void CCertSaverModel::CreateKeyLabelL( TDes& aLabel ) { + TTime time; time.UniversalTime(); TBuf dateBuf; @@ -349,6 +363,7 @@ // void CCertSaverModel::SavePrivateKeyL() { + if ( iParser.Keys().Count() <= 0 ) { return; @@ -397,6 +412,7 @@ TAlgorithmId aAlgorithm ) { + TKeyUsagePKCS15 pkcs15KeyUsage = EPKCS15UsageNone; TKeyUsageX509 x509Usage = EX509UsageNone; @@ -485,16 +501,13 @@ // void CCertSaverModel::CheckFSSpaceL( const TDesC8& aDataToSave ) { + if (SysUtil::FFSSpaceBelowCriticalLevelL( &iFs, aDataToSave.Size() )) { - HBufC* p = StringLoader::LoadLC( R_CERTSAVER_MEMORY ); - CAknErrorNote* note = new (ELeave) CAknErrorNote( ETrue ); - note->ExecuteLD( p->Des() ); - CleanupStack::PopAndDestroy( p ); + ShowInformationNoteL(R_CERTSAVER_MEMORY); User::Leave( KErrExitApp ); } } - // ---------------------------------------------------------- // CCertSaverModel::SaveCertL() // Saves certificate @@ -502,48 +515,44 @@ // void CCertSaverModel::SaveCertL() { + if ( !CertificateOkL() ) { User::Leave( KErrCancel ); } - + HBufC* message = HBufC::NewLC( KMaxLengthTextMeassageBody ); TPtr msgPtr = message->Des(); ConstructMessageL( msgPtr ); - CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL( *message ); - CleanupStack::PopAndDestroy( message ); - CleanupStack::PushL( dlg ); - - - dlg->PrepareLC( R_MESSAGE_QUERY_DOSAVE ); - - HBufC* header = StringLoader::LoadLC( R_CERTSAVER_DETAILS_HEADING ); - dlg->QueryHeading()->SetTextL( header->Des() ); - CleanupStack::PopAndDestroy( header ); - CleanupStack::Pop( dlg ); - TBool doSave = dlg->RunLD(); - + CHbDeviceMessageBoxSymbian::TButtonId selection = + CHbDeviceMessageBoxSymbian::QuestionL(msgPtr, KNullDesC, KNullDesC); + TBool doSave= (selection == CHbDeviceMessageBoxSymbian::EAcceptButton); + CleanupStack::PopAndDestroy(message); +/* if ( doSave && iCertOwnerType == ECACertificate ) { // warn user about security risk - CAknQueryDialog* warningDialog = CAknQueryDialog::NewL(); - doSave = warningDialog->ExecuteLD( R_CERTSAVER_WARNING_NOTE ); + HBufC* stringHolder = StringLoader::LoadLC( R_CERTSAVER_WARNING_NOTE ); + CHbDeviceMessageBoxSymbian::TButtonId selection = + CHbDeviceMessageBoxSymbian::QuestionL(stringHolder->Des(),KNullDesC, KNullDesC); + CleanupStack::PopAndDestroy(stringHolder); + doSave=(selection == CHbDeviceMessageBoxSymbian::EAcceptButton); } - +*/ if ( doSave ) { - //Check that there still is enough space to store the - //certificate. + //Check that there still is enough space to store the certificate. CheckFSSpaceL( iNewCert->Encoding() ); DoSaveCertL(); } else { - ShowConfirmationNoteL( R_CERTSAVER_CERT_DISCARDED ); + ShowInformationNoteL(R_CERTSAVER_CERT_DISCARDED); User::Leave( KErrCancel ); } } + // ---------------------------------------------------------- // CCertSaverModel::InitCertStoreL() // @@ -551,12 +560,13 @@ // void CCertSaverModel::InitCertStoreL() { + if ( !iUnifiedCertStore ) { TRAPD( status, iUnifiedCertStore = CUnifiedCertStore::NewL( iFs, ETrue ) ); if ( status != KErrNone ) { - ShowErrorNoteL( R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED ); + ShowInformationNoteL( R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED ); User::Leave( KErrExitApp ); } // initialize unified cert store @@ -576,6 +586,7 @@ // void CCertSaverModel::DoSaveCertL() { + TInt status = KErrNone; CCertAttributeFilter* filter = NULL; TCertificateFormat certFormat = EX509Certificate; @@ -678,7 +689,8 @@ MCTToken& token = writableCertStore.Token(); TUid tokenuid = token.Handle().iTokenTypeUid; - if ( ( tokenuid == KTrustedServerTokenUid ) && ( iCertOwnerType == EPeerCertificate ) || + if ( ( tokenuid == KTrustedServerTokenUid ) && + ( iCertOwnerType == EPeerCertificate ) || ( tokenuid == KFileTokensUid ) && ( iCertOwnerType == ECACertificate ) || ( tokenuid == KFileTokensUid ) && ( iCertOwnerType == EUserCertificate ) ) { @@ -690,7 +702,7 @@ if ( certstoreIndex < 0 ) { // Couldn't find certificate storage - ShowErrorNoteL( R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED ); + ShowInformationNoteL( R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED ); User::Leave( KErrExitApp ); } @@ -729,7 +741,7 @@ { // If there is none WritableCertStore, // then at least cacerts.dat is corrupted. - ShowErrorNoteL( R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED ); + ShowInformationNoteL( R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED ); User::Leave( KErrExitApp ); } @@ -786,6 +798,7 @@ // TInt CCertSaverModel::QueryLabelL( TCertLabel& aLabel, CUnifiedCertStore& aStore ) { + CCertAttributeFilter* filter = NULL; TInt status = KErrNone; RMPointerArray entries; @@ -793,11 +806,21 @@ while ( loop ) { - CAknTextQueryDialog* dialog = CAknTextQueryDialog::NewL( aLabel ); - if ( !dialog->ExecuteLD( R_CERTSAVER_LABEL_QUERY ) ) + HBufC* labelprompt = CEikonEnv::Static()->AllocReadResourceLC( R_CERTSAVER_ENTER_LABEL ); + CSecQueryUi* SecQueryUi = CSecQueryUi::NewL(); + TInt queryAccepted = SecQueryUi->SecQueryDialog(labelprompt->Des(), aLabel, + 1,KMaxCertLabelLength, + ESecUiAlphaSupported | + ESecUiCancelSupported | + ESecUiEmergencyNotSupported); + CleanupStack::PopAndDestroy( labelprompt ); + delete SecQueryUi; + SecQueryUi=NULL; + + if ( queryAccepted!=KErrNone ) { // cancel - ShowConfirmationNoteL( R_CERTSAVER_CERT_DISCARDED ); + ShowInformationNoteL(R_CERTSAVER_CERT_DISCARDED); return KErrCancel; } // Create filter to confirm that label doesn't already exist. @@ -840,31 +863,32 @@ // void CCertSaverModel::HandleSaveErrorL( TInt aStatus ) const { + switch ( aStatus ) { case KErrNone: { - ShowConfirmationNoteL( R_CERTSAVER_ERROR_SAVEOK ); + ShowInformationNoteL(R_CERTSAVER_ERROR_SAVEOK); break; } case KErrNotSupported: { - ShowErrorNoteL( R_CERTSAVER_ERROR_UNSUPPORTED_CERT ); + ShowInformationNoteL(R_CERTSAVER_ERROR_UNSUPPORTED_CERT); break; } case KErrBadName: { - ShowErrorNoteL( R_CERTSAVER_ERROR_LABEL_ALREADY_EXISTS ); + ShowInformationNoteL(R_CERTSAVER_ERROR_LABEL_ALREADY_EXISTS); break; } case KErrAlreadyExists: { - ShowErrorNoteL( R_CERTSAVER_ERROR_ALREADY_EXISTS ); + ShowInformationNoteL(R_CERTSAVER_ERROR_ALREADY_EXISTS); break; } case KErrArgument: { - ShowErrorNoteL( R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED ); + ShowInformationNoteL(R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED); break; } default: @@ -884,6 +908,7 @@ void CCertSaverModel::AddToMessageWithStringL( TDes& aMessage, TInt aStringResID, const TDesC& aString ) const { + HBufC* promptPtr = NULL; promptPtr = StringLoader::LoadL( aStringResID, aString ); CleanupStack::PushL( promptPtr ); @@ -904,6 +929,7 @@ TInt aStringResID, TInt aInt ) const { + HBufC* promptPtr = NULL; promptPtr = StringLoader::LoadL( aStringResID, aInt ); CleanupStack::PushL( promptPtr ); @@ -922,6 +948,7 @@ // void CCertSaverModel::AddToMessageL( TDes& aMessage, TInt aStringResID ) const { + HBufC* promptPtr = NULL; promptPtr = StringLoader::LoadL( aStringResID ); CleanupStack::PushL( promptPtr ); @@ -940,6 +967,7 @@ // void CCertSaverModel::ConstructMessageL( TDes& aMessage ) const { + HBufC16* issuerName = NULL; HBufC16* subjectName = NULL; @@ -996,6 +1024,7 @@ // void CCertSaverModel::AddKeyUsageL( TDes& aMessage, const CX509Certificate& aCert ) const { + TKeyUsageX509 x509Usage = EX509UsageNone; TKeyUsagePKCS15 pkcs15KeyUsage = EPKCS15UsageNone; const CX509CertExtension* ext = aCert.Extension( KKeyUsage ); @@ -1079,6 +1108,7 @@ void CCertSaverModel::AddValidityPeriodL( TDes& aMessage, const CX509Certificate& aCert ) const { + // Hometime's offset to UTC TLocale locale; TTimeIntervalSeconds offSet = locale.UniversalTimeOffset(); @@ -1108,7 +1138,7 @@ // format the date to user readable format. The format is locale dependent finishValue.FormatL( finishString, *dateFormatString ); AknTextUtils::DisplayTextLanguageSpecificNumberConversion( finishString ); - CleanupStack::PopAndDestroy(); // dateFormatString + CleanupStack::PopAndDestroy(dateFormatString); // dateFormatString aMessage.Append( finishString ); AddNewlinesToMessage( aMessage ); } @@ -1120,6 +1150,7 @@ // void CCertSaverModel::AddNewlinesToMessage( TDes& aMessage ) const { + aMessage.Append( KDoubleEnter ); } @@ -1130,6 +1161,7 @@ // TBool CCertSaverModel::CertificateSupported() const { + if ( iCertFormat == EX509Certificate && ( iCertOwnerType == ECACertificate || iCertOwnerType == EPeerCertificate || @@ -1151,19 +1183,20 @@ // TBool CCertSaverModel::CertificateOkL() const { - if ( !CertificateSupported() ) + + if ( !CertificateSupported() ) { - ShowErrorNoteL( R_CERTSAVER_ERROR_UNSUPPORTED_CERT ); + ShowInformationNoteL(R_CERTSAVER_ERROR_UNSUPPORTED_CERT); return EFalse; } if ( CertNotValidAnymore() ) { - ShowErrorNoteL( R_CERTSAVER_ERROR_CERT_NOT_VALID ); + ShowInformationNoteL(R_CERTSAVER_ERROR_CERT_NOT_VALID); return ETrue; } else if ( CertNotValidYet() ) { - ShowErrorNoteL( R_CERTSAVER_ERROR_CERT_NOT_VALID_YET ); + ShowInformationNoteL(R_CERTSAVER_ERROR_CERT_NOT_VALID_YET); } return ETrue; } @@ -1175,6 +1208,7 @@ // TBool CCertSaverModel::CertNotValidAnymore() const { + TTime homeTime; homeTime.HomeTime(); if ( iNewCert->ValidityPeriod().Finish() < homeTime ) @@ -1191,6 +1225,7 @@ // TBool CCertSaverModel::CertNotValidYet() const { + TTime homeTime; homeTime.HomeTime(); if ( iNewCert->ValidityPeriod().Start() > homeTime ) @@ -1207,35 +1242,15 @@ // void CCertSaverModel::ShowInformationNoteL( TInt aResourceID ) const { - HBufC* buffer = iAppUi->CoeEnv()->AllocReadResourceLC( aResourceID ); - CAknInformationNote* note = new (ELeave) CAknInformationNote( ETrue ); - note->ExecuteLD( buffer->Des() ); - CleanupStack::PopAndDestroy( buffer ); - } -// ---------------------------------------------------------- -// CCertSaverModel::ShowConfirmationNoteL() const -// Creates and shows a confirmation note. -// ---------------------------------------------------------- -// -void CCertSaverModel::ShowConfirmationNoteL( TInt aResourceID ) const - { + HBufC* buffer = iAppUi->CoeEnv()->AllocReadResourceLC( aResourceID ); - CAknConfirmationNote* note = new (ELeave) CAknConfirmationNote( ETrue ); - note->ExecuteLD( buffer->Des() ); - CleanupStack::PopAndDestroy( buffer ); - } - -// ---------------------------------------------------------- -// CCertSaverModel::ShowErrorNoteL() const -// Creates and shows an error note. -// ---------------------------------------------------------- -// -void CCertSaverModel::ShowErrorNoteL( TInt aResourceID ) const - { - HBufC* buffer = iAppUi->CoeEnv()->AllocReadResourceLC( aResourceID ); - CAknErrorNote* note = new (ELeave) CAknErrorNote( ETrue ); - note->ExecuteLD(buffer->Des()); - CleanupStack::PopAndDestroy( buffer ); + CHbDeviceMessageBoxSymbian* iMessageBox = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EInformation); + CleanupStack::PushL(iMessageBox); + iMessageBox->SetTextL(buffer->Des()); + iMessageBox->SetTimeout(6000); + iMessageBox->ExecL(); + CleanupStack::PopAndDestroy(iMessageBox); + CleanupStack::PopAndDestroy( buffer ); } // ---------------------------------------------------------- @@ -1247,6 +1262,7 @@ // TPtrC CCertSaverModel::TrimCertificateFields( TPtrC aField ) const { + TPtrC cutField = CutCertificateField( aField ); // Find one semicolon at a time and crop the // helpField from the left to search for the next semicolon @@ -1298,6 +1314,7 @@ // TPtrC CCertSaverModel::CutCertificateField( TPtrC aField ) const { + TInt fieldLength = aField.Length(); if ( fieldLength >= KMaxLengthTextCertIdentifierVisible ) { @@ -1314,10 +1331,8 @@ // TInt CCertSaverModel::QueryTrusterUidsL( RArray& aUids ) { + TInt ret = KErrCancel; - CArrayFixFlat* selectionArray = - new (ELeave) CArrayFixFlat( KTrusterArrayInitSize ); - CleanupStack::PushL( selectionArray ); CDesCArray* itemsArray = new (ELeave) CDesCArrayFlat( KTrusterArrayInitSize ); CleanupStack::PushL( itemsArray ); @@ -1330,28 +1345,52 @@ CleanupClosePushL( appsInItemArray ); UpdateTrustListboxItemL( apps, appsInItemArray, *itemsArray ); - CAknListQueryDialog* dlg = new (ELeave) CAknListQueryDialog( selectionArray ); - CleanupStack::PushL( dlg ); - dlg->PrepareLC( R_CERTSAVER_TRUST_SETTINGS_QUERY ); - dlg->SetItemTextArray( itemsArray ); - dlg->SetOwnershipType( ELbmDoesNotOwnItemArray ); - if ( dlg->RunLD() ) + HBufC* title = CEikonEnv::Static()->AllocReadResourceLC( R_CERTSAVER_SELECT_TRUSTED_APPS); + + RBuf rBuf; // buffer for items with big enough space + rBuf.CreateL(KMaxLengthTextMeassageBody); + CleanupClosePushL(rBuf); + for(TInt i = 0; iCount(); i++) + rBuf.Append( (*itemsArray)[i] ); + + CSecQueryUi* SecQueryUi = CSecQueryUi::NewL(); + TInt saved = SecQueryUi->SecQueryDialog(*title, rBuf,1,KTokenLength, + ESecUiAlphaSupported | ESecUiCancelSupported | + ESecUiBasicTypeMultiCheck | + ESecUiEmergencyNotSupported); + delete SecQueryUi; + SecQueryUi=NULL; + + if (saved==KErrNone) { - aUids.Reset(); - for ( TInt i = 0; i < selectionArray->Count(); ++i ) - { - TInt ii = (*selectionArray)[ i ]; - aUids.Append( appsInItemArray[ ii ].Id() ); - } + TLex16 lex(rBuf); + TChar ch; + TBuf16 token; + TInt val; + while((ch = lex.Get()) != 0 ){ + while ((ch = lex.Peek()) != '|' && ch!=0) lex.Inc(); + token.Copy(lex.MarkedToken()); + TLex lexc(token); + if(lexc.Val(val)!=KErrNone) val=0; + if(val<=appsInItemArray.Count()-1) + aUids.Append( appsInItemArray[ val ].Id() ); + lex.Inc(); + lex.Mark(); + } ret = KErrNone; } else { - ShowConfirmationNoteL( R_CERTSAVER_CERT_DISCARDED ); + ShowInformationNoteL(R_CERTSAVER_CERT_DISCARDED); ret = KErrCancel; } - CleanupStack::Pop( dlg ); - CleanupStack::PopAndDestroy( 4, selectionArray ); + + rBuf.Close(); + CleanupStack::PopAndDestroy(&rBuf); + CleanupStack::PopAndDestroy(title); + CleanupStack::PopAndDestroy(&appsInItemArray); + CleanupStack::PopAndDestroy(appInfoManager); + CleanupStack::PopAndDestroy(itemsArray); return ret; } @@ -1362,6 +1401,7 @@ // TInt CCertSaverModel::QueryTrustedSiteL() { + TInt ret = KErrCancel; HBufC* label = NULL; HBufC* secondaryName = NULL; @@ -1373,27 +1413,19 @@ delete secondaryName; secondaryName = NULL; labelBuf = label->Des().Left( CERTSAVER_MAX_LABEL_LEN ); - - HBufC* prompt = StringLoader::LoadLC( R_CERTSAVER_TRUSTEDSITE_WARNING, labelBuf ); - - CAknMessageQueryDialog* note = CAknMessageQueryDialog::NewL( *prompt ); - - note->PrepareLC( R_CERTSAVER_TRUSTED_SITE_QUERY ); - note->SetPromptL( *prompt ); - - if ( note->RunLD() ) + CHbDeviceMessageBoxSymbian::TButtonId selection = + CHbDeviceMessageBoxSymbian::QuestionL(prompt->Des(), KNullDesC, KNullDesC); + if ( selection == CHbDeviceMessageBoxSymbian::EAcceptButton) { ret = KErrNone; } else { - ShowConfirmationNoteL( R_CERTSAVER_CERT_DISCARDED ); + ShowInformationNoteL(R_CERTSAVER_CERT_DISCARDED); ret = KErrCancel; } - CleanupStack::PopAndDestroy( prompt ); - CleanupStack::PopAndDestroy( label ); return ret; } @@ -1408,6 +1440,7 @@ RArray& aAppsInItemArray, CDesCArray& aItemsArray ) const { + for ( TInt i = 0; i < aApps.Count(); i++ ) { TCertificateAppInfo appInfo = aApps[ i ]; @@ -1470,6 +1503,7 @@ // void CCertSaverModel::DivideToBlocks( const TDesC8& aInput, TDes& aOutput ) const { + _LIT( KBlockSeparator, " " ); const TInt KBlockLength = 2; TInt blockIndex = 0; @@ -1492,25 +1526,37 @@ // void CCertSaverModel::SavePKCS12L() { + HBufC* message = HBufC::NewLC( KMaxLengthTextMeassageBody ); TPtr msgPtr = message->Des(); ConstructPKCS12QueryMsgL(msgPtr, iParser.Keys().Count(), iParser.UserCertificates().Count(), iParser.CACertificates().Count() ); - TBool save = DoMessageQueryL( - R_MESSAGE_QUERY_DOSAVE, R_CERTSAVER_HEADER_PKCS12_FILE_CONTAINS, - *message ); - CleanupStack::PopAndDestroy( message ); + + //TODO: Should be in loc file but hardcoded now + _LIT(KCheckBoxCaption,"Protect with Password|1"); + TBuf CheckeBoxData(KCheckBoxCaption); + + CSecQueryUi* SecQueryUi = CSecQueryUi::NewL(); + TInt save = SecQueryUi->SecQueryDialog(*message, CheckeBoxData,1,1, + ESecUiAlphaSupported | ESecUiCancelSupported | + ESecUiBasicTypeCheck | ESecUiEmergencyNotSupported); + CleanupStack::Pop(message); message = NULL; - if ( !save ) + delete SecQueryUi; + SecQueryUi=NULL; + + if ( save!=KErrNone ) { ShowInformationNoteL( R_CERTSAVER_PKCS12_DISCARDED ); User::Leave( KErrExitApp ); } TInt status = KErrNone; // save private keys - TRAP( status, SavePrivateKeyL() ); - + if(CheckeBoxData.Compare(_L("1"))==0) + { + TRAP( status, SavePrivateKeyL() ); + } // save user certificates if private key was saved. if ( ( iSavedKeysCount > 0 || iKeyAlreadyExists ) && iParser.UserCertificates().Count() > 0 ) { @@ -1543,42 +1589,28 @@ } } } +/* if ( iSavedCACertsCount != 0 || iSavedKeysCount != 0 || iSavedUserCertsCount != 0 ) { - message = HBufC::NewLC( KMaxLengthTextMeassageBody ); - TPtr msgPtr2 = message->Des(); - ConstructPKCS12QueryMsgL( +// show how many have been saved + HBufC* p = StringLoader::LoadLC( R_CERTSAVER_HEADER_SAVED ); + message = HBufC::NewLC( KMaxLengthTextMeassageBody ); + message->Des().Append(p->Des()); + TPtr msgPtr2 = message->Des(); + ConstructPKCS12QueryMsgL( msgPtr2, iSavedKeysCount, iSavedUserCertsCount, iSavedCACertsCount ); - DoMessageQueryL( - R_MESSAGE_QUERY_SAVED, R_CERTSAVER_HEADER_SAVED, *message ); - CleanupStack::PopAndDestroy( message ); + CHbDeviceMessageBoxSymbian::InformationL(message->Des()); + CleanupStack::PopAndDestroy( message ); + CleanupStack::PopAndDestroy( p ); } else { + // the contents could not be saved is dropped ShowInformationNoteL( R_QTN_CM_PKCS12_SAVING_FAILED ); + CleanupStack::PopAndDestroy( message ); } - } - -// ---------------------------------------------------------- -// CCertSaverModel::DoMessageQuery() -// Displays message query dialog for user. -// ---------------------------------------------------------- -// -TBool CCertSaverModel::DoMessageQueryL( - TInt aDialogResId, - TInt aHeadingResId, - TDesC& aMessage ) - { - CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL( aMessage ); - CleanupStack::PushL( dlg ); - dlg->PrepareLC( aDialogResId ); - - HBufC* header = StringLoader::LoadLC( aHeadingResId ); - dlg->QueryHeading()->SetTextL( header->Des() ); - CleanupStack::PopAndDestroy( header ); - CleanupStack::Pop( dlg ); - return dlg->RunLD(); +*/ } // ---------------------------------------------------------- @@ -1592,6 +1624,7 @@ TInt aUserCerts, TInt aCACerts ) const { + if ( aPrivateKeys > 0 ) { if ( aPrivateKeys == 1 ) diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertSaver/src/certparser.cpp --- a/pkiutilities/CertSaver/src/certparser.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertSaver/src/certparser.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -25,14 +25,17 @@ #include #include #include -#include #include #include #include -#include // Note dialogs #include +#include // CEikonEnv #include "certparser.h" +#include "SecQueryUi.h" // needed for password dialog + +#include // needed for Note dialogs + // CONSTANTS _LIT( KPKCS12DllName, "crpkcs12.dll" ); // PKCS12 DLL name const TInt KX509Version3 = 3; @@ -94,6 +97,7 @@ // void CCertParser::SetContentL( RFile& aFile ) { + delete iCert; iCert = NULL; TInt fileSize = 0; @@ -126,7 +130,8 @@ // void CCertParser::CreatePKCS12L() { - // Load PKCS#12 dll + + // Load PKCS#12 dll #ifdef __WINS__ User::LeaveIfError ( iLibrary.Load( KPKCS12DllName ) ); #else @@ -151,6 +156,7 @@ const TDesC8& aPKCS12, const TDesC& aFileName ) { + CreatePKCS12L(); if ( !iPKCS12->IsPKCS12Data( aPKCS12 ) ) @@ -161,21 +167,12 @@ TBool done = EFalse; TBuf password; - HBufC* buffer = NULL; - - if ( !iEikEnv ) - { - iEikEnv = CEikonEnv::Static(); - } while ( !done ) { if ( !GetPasswordL( password, aFileName ) ) { - buffer = iEikEnv->AllocReadResourceLC( R_CERTSAVER_PKCS12_DISCARDED ); - CAknInformationNote* note = new (ELeave) CAknInformationNote( ETrue ); - note->ExecuteLD(buffer->Des()); - CleanupStack::PopAndDestroy( buffer ); + ShowErrorNoteL(R_CERTSAVER_PKCS12_DISCARDED); User::Leave( KErrExitApp ); } TRAPD( err, iPKCS12->ParseL( aPKCS12, password ) ); @@ -226,15 +223,19 @@ // TInt CCertParser::GetPasswordL( TDes& aPassword, const TDesC& aFileName ) { - CAknTextQueryDialog* query = CAknTextQueryDialog::NewL( aPassword ); - CleanupStack::PushL( query ); - HBufC* prompt = - StringLoader::LoadLC( R_QTN_CM_TITLE_P12_PASSWORD, aFileName ); - query->SetPromptL( *prompt ); - CleanupStack::PopAndDestroy( prompt ); - CleanupStack::Pop( query ); - return query->ExecuteLD( R_PKCS12_PW_QUERY_DIALOG ); - } + CSecQueryUi* SecQueryUi = CSecQueryUi::NewL(); + HBufC* prompt =StringLoader::LoadLC( R_QTN_CM_TITLE_P12_PASSWORD, aFileName ); + TInt queryAccepted = SecQueryUi->SecQueryDialog(prompt->Des(), aPassword, + 1,KPwMaxLength, + ESecUiAlphaSupported | + ESecUiCancelSupported | + ESecUiSecretSupported | + ESecUiEmergencyNotSupported); + CleanupStack::PopAndDestroy( prompt ); + delete SecQueryUi; + SecQueryUi=NULL; + return (queryAccepted==KErrNone); + } // ---------------------------------------------------------- // CCertParser::CheckIfX509CertificateL() @@ -243,6 +244,7 @@ // TBool CCertParser::CheckIfX509CertificateL(const TDesC8& aCert) { + TRAPD( err, iCert = CX509Certificate::NewL(aCert); ); @@ -302,6 +304,7 @@ // const CArrayPtr& CCertParser::CACertificates() const { + __ASSERT_ALWAYS( iPKCS12, User::Panic( KCertSaverPanic, KPanicNullPointer ) ); return iPKCS12->CACertificates(); } @@ -312,6 +315,7 @@ // const CArrayPtr& CCertParser::UserCertificates() const { + __ASSERT_ALWAYS( iPKCS12, User::Panic( KCertSaverPanic, KPanicNullPointer ) ); return iPKCS12->UserCertificates(); } @@ -322,6 +326,7 @@ // const CArrayPtr& CCertParser::Keys() const { + __ASSERT_ALWAYS( iPKCS12, User::Panic( KCertSaverPanic, KPanicNullPointer ) ); return iPKCS12->PrivateKeys(); } @@ -332,6 +337,7 @@ // CCertParser::TCertType CCertParser::CertType() const { + return iCertType; } @@ -342,6 +348,7 @@ // const TPtrC8 CCertParser::CertificateBuf() const { + __ASSERT_ALWAYS( iCert, User::Panic( KCertSaverPanic, KPanicNullPointer ) ); return iCert->Encoding(); } @@ -353,6 +360,7 @@ // const CX509Certificate& CCertParser::Certificate() const { + __ASSERT_ALWAYS( iCert, User::Panic( KCertSaverPanic, KPanicNullPointer ) ); return *((CX509Certificate*)iCert); } @@ -369,9 +377,13 @@ iEikEnv = CEikonEnv::Static(); } HBufC* buffer = iEikEnv->AllocReadResourceLC( aResourceID ); - CAknErrorNote* note = new (ELeave) CAknErrorNote( ETrue ); - note->ExecuteLD(buffer->Des()); - CleanupStack::PopAndDestroy( buffer ); + CHbDeviceMessageBoxSymbian* iMessageBox = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EWarning); + CleanupStack::PushL(iMessageBox); + iMessageBox->SetTextL(buffer->Des()); + iMessageBox->SetTimeout(6000); + iMessageBox->ExecL(); + CleanupStack::PopAndDestroy(iMessageBox); + CleanupStack::PopAndDestroy( buffer ); } // End of File diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertmanUi/INC/CertmanuiCommon.h --- a/pkiutilities/CertmanUi/INC/CertmanuiCommon.h Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertmanUi/INC/CertmanuiCommon.h Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-2007 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" @@ -73,8 +73,8 @@ const TInt KMaxLengthTextDateString = 11; // HH0 const TInt KMaxLengthTextSerialNumberFormatting = 3; -// CertLabel, Issuer, Owner max length 1024 bytes -const TInt KMaxLengthTextCertLabel = 1024; +// CertLabel, Issuer, Owner max length 510 bytes +const TInt KMaxLengthTextCertLabel = 510; // CertLabel, Issuer, Owner max visible length const TInt KMaxLengthTextCertLabelVisible = 200; // CertWimLabel, KeyLabel, KeyWimLabel max length 255 bytes diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertmanUi/INC/CertmanuiKeeper.h --- a/pkiutilities/CertmanUi/INC/CertmanuiKeeper.h Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertmanUi/INC/CertmanuiKeeper.h Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-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" @@ -195,16 +195,11 @@ */ TBool iStartup; - /** + /** * Certificate helper class */ CCertManUICertificateHelper* iCertificateHelper; - /** - * Index for the current CA cert for changing trust settings - */ - TInt iCurrentCACertForTrustSettings; - private: // functions /** diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertmanUi/INC/CertmanuicontainerTrust.h --- a/pkiutilities/CertmanUi/INC/CertmanuicontainerTrust.h Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertmanUi/INC/CertmanuicontainerTrust.h Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-2007 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" @@ -33,7 +33,6 @@ const TInt KTrustSettingsResourceIndexJavaInstall = 3; const TInt KTrustSettingsResourceIndexOCSPCheck = 4; const TInt KTrustSettingsResourceIndexVPN = 5; -const TInt KTrustSettingsResourceIndexWidget = 6; const TInt KTrustSettingsResourceIndexValueYes = 0; const TInt KTrustSettingsResourceIndexValueNo = 1; @@ -240,8 +239,6 @@ void ShowTrustChangeSettingPageL( const TUid aClientUid, TDesC& aClientName, CCTCertInfo& aEntry ); - void ChangeTrustChangeSettingSingleClickL(); - void InsertItemToTrustListL( const TInt index, const TUid id, CCTCertInfo& entry, CDesCArray* itemArray, TInt position ); diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertmanUi/INC/Certmanuitrustids.h --- a/pkiutilities/CertmanUi/INC/Certmanuitrustids.h Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertmanUi/INC/Certmanuitrustids.h Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-2007 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" @@ -28,7 +28,6 @@ const TUid KCertManUIViewTrustJavaInstallingId = {270506792}; const TUid KCertManUIViewOCSPCheckInstallingId = {268478646}; const TUid KCertManUIViewTrustVPNId = {270498195}; -const TUid KCertManUIViewTrustWidgetInstallingId = {537028562}; #endif // __CERTMANUITRUSTIDS_H diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertmanUi/SRC/CertmanuiCertificateHelper.cpp --- a/pkiutilities/CertmanUi/SRC/CertmanuiCertificateHelper.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertmanUi/SRC/CertmanuiCertificateHelper.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-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" @@ -527,6 +527,7 @@ // HBufC& aMessage, TPtrC aValue, TInt aResourceOne) // Reads dynamic text from CertManAPI, if the string is empty // put a not defined text from the resource in its place +// KMaxLengthTextCertLabel = 510, used by CertLabel(), Issuer(), Owner() // --------------------------------------------------------- // void CCertManUICertificateHelper::DetailsDynamicL( @@ -535,29 +536,26 @@ CERTMANUILOGGER_ENTERFN( "CCertManUICertificateHelper::DetailsDynamicL" ); - HBufC* buf = aValue.AllocLC(); - TPtr trimmedValue( buf->Des() ); - trimmedValue.TrimLeft(); - - if( trimmedValue.Length() > KMaxLengthTextCertLabelVisible ) - { - trimmedValue.SetLength( KMaxLengthTextCertLabelVisible - 1 ); - trimmedValue.Append( KTextUtilClipEndChar ); - } - - if ( trimmedValue.Length() == 0 ) + HBufC* buf = HBufC::NewLC( KMaxLengthTextCertLabel ); + buf->Des() = aValue; + buf->Des().TrimLeft(); + // Cut CertLabel after fourth semi colon + TPtrC trimmedCertLabel = CutCertificateField( buf->Des() ); + buf->Des().Copy( trimmedCertLabel ); + TInt length = buf->Des().Length(); + if ( length == 0 ) { DetailsResourceL( aMessage, aResourceOne ); } else { - //LRM (Left-to-Right mark 0x200E) + //LRM (Left-to-Right mark 200E) const TInt KLRMark = 0x200E; - aMessage.Des().Append( trimmedValue ); - aMessage.Des().Append( KLRMark ); + aMessage.Des().Append( buf->Des() ); + aMessage.Des().Append(KLRMark); aMessage.Des().Append( KCertManUIDetailsViewEnter ); } - CleanupStack::PopAndDestroy( buf ); + CleanupStack::PopAndDestroy(); // buf CERTMANUILOGGER_LEAVEFN( "CCertManUICertificateHelper::DetailsDynamicL" ); diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertmanUi/SRC/CertmanuiKeeper.cpp --- a/pkiutilities/CertmanUi/SRC/CertmanuiKeeper.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertmanUi/SRC/CertmanuiKeeper.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-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" @@ -170,8 +170,7 @@ // Constructor with parent // --------------------------------------------------------- // -CCertManUIKeeper::CCertManUIKeeper() : iCurrentCACertForTrustSettings( KErrNotFound ), - iResourceLoader( *iCoeEnv ) +CCertManUIKeeper::CCertManUIKeeper(): iResourceLoader( *iCoeEnv ) { CERTMANUILOGGER_CREATE; //lint !e960 CERTMANUILOGGER_WRITE_TIMESTAMP( "CCertManUIKeeper::CCertManUIKeeper" ); diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertmanUi/SRC/CertmanuicontainerAuthority.cpp --- a/pkiutilities/CertmanUi/SRC/CertmanuicontainerAuthority.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertmanUi/SRC/CertmanuicontainerAuthority.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-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" @@ -79,7 +79,12 @@ CreateWindowL(); CreateListBoxL(); UpdateListBoxL( aCurrentPosition, aTopItem ); - iListBox->ItemDrawer()->ColumnData()->SetIconArray( iIconHandler->CreateIconArrayL() ); + if ( iListBox ) + { + // Creates graphic. + iListBox->ItemDrawer()->ColumnData()-> + SetIconArray( iIconHandler->CreateIconArrayL() ); + } SetRect( aRect ); CERTMANUILOGGER_LEAVEFN( " CCertManUIContainerAuthority::ConstructL" ); diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertmanUi/SRC/CertmanuicontainerDevice.cpp --- a/pkiutilities/CertmanUi/SRC/CertmanuicontainerDevice.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertmanUi/SRC/CertmanuicontainerDevice.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-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" @@ -80,7 +80,14 @@ CreateWindowL(); CreateListBoxL(); UpdateListBoxL( aCurrentPosition, aTopItem ); - iListBox->ItemDrawer()->ColumnData()->SetIconArray( iIconHandler->CreateIconArrayL() ); + + if ( iListBox ) + { + // Creates graphic. + iListBox->ItemDrawer()->ColumnData()-> + SetIconArray( iIconHandler->CreateIconArrayL() ); + } + SetRect( aRect ); CERTMANUILOGGER_LEAVEFN( " CCertManUIContainerDevice::ConstructL" ); diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertmanUi/SRC/CertmanuicontainerPersonal.cpp --- a/pkiutilities/CertmanUi/SRC/CertmanuicontainerPersonal.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertmanUi/SRC/CertmanuicontainerPersonal.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-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" @@ -79,7 +79,12 @@ CreateWindowL(); CreateListBoxL(); UpdateListBoxL( aCurrentPosition, aTopItem ); - iListBox->ItemDrawer()->ColumnData()->SetIconArray( iIconHandler->CreateIconArrayL() ); + if ( iListBox ) + { + // Creates graphic. + iListBox->ItemDrawer()->ColumnData()-> + SetIconArray( iIconHandler->CreateIconArrayL() ); + } SetRect( aRect ); CERTMANUILOGGER_LEAVEFN( " CCertManUIContainerPersonal::ConstructL" ); diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertmanUi/SRC/CertmanuicontainerTrust.cpp --- a/pkiutilities/CertmanUi/SRC/CertmanuicontainerTrust.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertmanUi/SRC/CertmanuicontainerTrust.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-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" @@ -170,7 +170,10 @@ switch( aEventType ) { case EEventItemSingleClicked: - ChangeTrustChangeSettingSingleClickL(); + if ( !iKeeper.iWrapper->IsActive() ) + { + iParent.ChangeTrustL(); + } break; default: { @@ -432,10 +435,6 @@ { resIndex = KTrustSettingsResourceIndexVPN; } - else if ( aTrusterUid == KCertManUIViewTrustWidgetInstallingId ) - { - resIndex = KTrustSettingsResourceIndexWidget; - } else { resIndex = KErrNotFound; @@ -596,23 +595,23 @@ } else if ( id == KCertManUIViewTrustMailAndImageConnId ) { - item = (*iTrustedClients)[ KTrustSettingsResourceIndexMailAndImageConn ]; + item = + (*iTrustedClients)[ KTrustSettingsResourceIndexMailAndImageConn ]; } else if ( id == KCertManUIViewTrustJavaInstallingId ) { - item = (*iTrustedClients)[ KTrustSettingsResourceIndexJavaInstall ]; + item = + (*iTrustedClients)[ KTrustSettingsResourceIndexJavaInstall ]; } else if ( id == KCertManUIViewOCSPCheckInstallingId ) { - item = (*iTrustedClients)[ KTrustSettingsResourceIndexOCSPCheck ]; + item = + (*iTrustedClients)[ KTrustSettingsResourceIndexOCSPCheck ]; } else if ( id == KCertManUIViewTrustVPNId ) { - item = (*iTrustedClients)[ KTrustSettingsResourceIndexVPN ]; - } - else if ( id == KCertManUIViewTrustWidgetInstallingId ) - { - item = (*iTrustedClients)[ KTrustSettingsResourceIndexWidget ]; + item = + (*iTrustedClients)[ KTrustSettingsResourceIndexVPN ]; } else { @@ -698,33 +697,6 @@ } // --------------------------------------------------------------------------- -// CCertManUIContainerTrust::ChangeTrustChangeSettingSingleClickL() -// --------------------------------------------------------------------------- -// -void CCertManUIContainerTrust::ChangeTrustChangeSettingSingleClickL() - { - if( !iKeeper.iWrapper->IsActive() ) - { - TInt certIndex = iKeeper.iCurrentCACertForTrustSettings; - - if( certIndex >= 0 && certIndex < iKeeper.iCALabelEntries.Count() ) - { - CCTCertInfo* entry = iKeeper.iCALabelEntries[ certIndex ]->iCAEntry; - if( entry && entry->IsDeletable() ) - { - TInt currentTrustSetting = iListBox->CurrentItemIndex(); - if( currentTrustSetting >= 0 && currentTrustSetting < iClientUids.Count() ) - { - TUid uid = iClientUids[ currentTrustSetting ]; - ChangeTrustValueL( *entry, uid ); - UpdateTrustListboxItemL( *entry, currentTrustSetting ); - } - } - } - } - } - -// --------------------------------------------------------------------------- // CCertManUIContainerTrust::PopupTrustChangeSettingPageL( // TInt aCertificateIndex) // Finds out which client was focused in Trust Settings view and calls @@ -748,7 +720,7 @@ CERTMANUILOGGER_LEAVEFN( "- PopupTrustChangeSettingPageL - read-only" ); return; } - + TUid id = KCertManUINullId; TInt poppableItems = 0; diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertmanUi/SRC/CertmanuicontainerTrustedSite.cpp --- a/pkiutilities/CertmanUi/SRC/CertmanuicontainerTrustedSite.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertmanUi/SRC/CertmanuicontainerTrustedSite.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-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" @@ -78,7 +78,12 @@ CreateWindowL(); CreateListBoxL(); UpdateListBoxL( aCurrentPosition, aTopItem ); - iListBox->ItemDrawer()->ColumnData()->SetIconArray( iIconHandler->CreateIconArrayL() ); + if ( iListBox ) + { + // Creates graphic. + iListBox->ItemDrawer()->ColumnData()-> + SetIconArray( iIconHandler->CreateIconArrayL() ); + } SetRect( aRect ); CERTMANUILOGGER_LEAVEFN( " CCertManUIContainerTrustedSite::ConstructL" ); diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertmanUi/SRC/Certmanuidialogs.cpp --- a/pkiutilities/CertmanUi/SRC/Certmanuidialogs.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertmanUi/SRC/Certmanuidialogs.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -59,8 +59,7 @@ if( !iDialog ) { - iDialog = new( ELeave ) CAknWaitDialog( - reinterpret_cast< CEikDialog** >( &iDialog ), ETrue ); + iDialog = new( ELeave ) CAknWaitDialog( reinterpret_cast< CEikDialog** >( &iDialog ) ); TInt dialog = 0; switch( aDialogSelector ) diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertmanUi/SRC/CertmanuiviewAuthority.cpp --- a/pkiutilities/CertmanUi/SRC/CertmanuiviewAuthority.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertmanUi/SRC/CertmanuiviewAuthority.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-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" @@ -364,7 +364,6 @@ } CleanupStack::PopAndDestroy(); // buf - iKeeper.iCurrentCACertForTrustSettings = helpIndex3; ((CAknViewAppUi*)iAvkonAppUi)->ActivateLocalViewL( KCertManUIViewTrustId, TUid::Uid( helpIndex3), KNullDesC8 ); break; diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertmanUi/SRC/CertmanuiviewPersonal.cpp --- a/pkiutilities/CertmanUi/SRC/CertmanuiviewPersonal.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertmanUi/SRC/CertmanuiviewPersonal.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-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" @@ -496,17 +496,11 @@ { CERTMANUILOGGER_ENTERFN( "CCertManUIViewPersonal::DoDeactivate" ); - if( iContainerPersonal ) + iCurrentPosition = iContainerPersonal->iListBox->CurrentItemIndex(); + iTopItem = iContainerPersonal->iListBox->TopItemIndex(); + if ( iContainerPersonal ) { - CEikColumnListBox* listBox = iContainerPersonal->iListBox; - if( listBox ) - { - iCurrentPosition = listBox->CurrentItemIndex(); - iTopItem = listBox->TopItemIndex(); - } - - iAvkonAppUi->RemoveFromViewStack( *this, iContainerPersonal ); - + ((CAknViewAppUi*)iAvkonAppUi)->RemoveFromViewStack(*this, iContainerPersonal); delete iContainerPersonal; iContainerPersonal = NULL; } diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertmanUi/SRC/CertmanuiviewTrust.cpp --- a/pkiutilities/CertmanUi/SRC/CertmanuiviewTrust.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertmanUi/SRC/CertmanuiviewTrust.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-2007 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" @@ -302,7 +302,6 @@ } RemoveNaviPane(); - iKeeper.iCurrentCACertForTrustSettings = KErrNotFound; CERTMANUILOGGER_LEAVEFN( " CCertManUIViewTrust::DoDeactivate" ); } diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertmanUi/data/certmanui.rss --- a/pkiutilities/CertmanUi/data/certmanui.rss Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertmanUi/data/certmanui.rss Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-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" @@ -1120,10 +1120,6 @@ { buf = qtn_cm_algorithm_sha1; } -RESOURCE TBUF r_text_resource_details_view_algorithm_SHA2 - { - buf = qtn_cm_algorithm_sha2; - } //---------------------------------------------------- // @@ -1338,10 +1334,6 @@ LBUF {//VPN txt = " \t"qtn_cm_lipri_vpn"\t\t"; - }, - LBUF - {//Widget installer - txt = " \t"qtn_cm_lipri_widget_installing"\t\t"; } }; } diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/CertmanUi/loc/certmanui.loc --- a/pkiutilities/CertmanUi/loc/certmanui.loc Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/CertmanUi/loc/certmanui.loc Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2002-2006 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" @@ -109,10 +109,6 @@ //l:popup_info_list_pane_t1 #define qtn_cm_algorithm_sha1 "SHA1" -//d:Certificate details algorithm name -//l:popup_info_list_pane_t1 -#define qtn_cm_algorithm_sha2 "SHA2" - //d:Certificate details algorithm unknown //l:popup_info_list_pane_t1 #define qtn_cm_algorithm_unknown "Unknown" @@ -237,12 +233,6 @@ //l:list_single_graphic_pane_t1_cp2 #define qtn_cm_lipri_native_installing "Native installing" -//d:Certificate trust settings widget installing. -//d:With this user can decide if certificate is trusted for -//d:installing widgets. -//l:list_single_graphic_pane_t1_cp2 -#define qtn_cm_lipri_widget_installing "Widget installing" - //d:Certificate trust settings for OCSP validation. //d:With this user can decide if certificate is trusted to //d:validate ocsp response (i.e. SOS applications). diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/PKCS12/CrPkcs12/group/crpkcs12.mmp --- a/pkiutilities/PKCS12/CrPkcs12/group/crpkcs12.mmp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/PKCS12/CrPkcs12/group/crpkcs12.mmp Tue Aug 31 16:04:40 2010 +0300 @@ -42,7 +42,7 @@ CAPABILITY CAP_GENERAL_DLL VENDORID VID_DEFAULT -#if defined(ARMCC) +#if defined( EABI ) deffile ../eabi/ #else deffile ../bwinscw/ diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/SecModUI/src/SecModUIViewAccess.cpp --- a/pkiutilities/SecModUI/src/SecModUIViewAccess.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/SecModUI/src/SecModUIViewAccess.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2005-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" @@ -349,9 +349,9 @@ { if( R_SECMODUI_VIEW_ACCESS_MENU == aResourceId ) { - if( !FeatureManager::FeatureSupported( KFeatureIdHelp ) ) + if( aResourceId == !FeatureManager::FeatureSupported( KFeatureIdHelp ) ) { - aMenuPane->DeleteMenuItem( EAknCmdHelp ); + aMenuPane->DeleteMenuItem( EAknCmdHelp ); //remove help } TInt currentItem = iContainer->ListBox().CurrentItemIndex(); diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/SecModUI/src/SecModUIViewSignature.cpp --- a/pkiutilities/SecModUI/src/SecModUIViewSignature.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/SecModUI/src/SecModUIViewSignature.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2005-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" @@ -172,9 +172,9 @@ { case R_SECMODUI_VIEW_SIGNATURE_MENU: { - if( !FeatureManager::FeatureSupported( KFeatureIdHelp ) ) + if( aResourceId == !FeatureManager::FeatureSupported( KFeatureIdHelp ) ) { - aMenuPane->DeleteMenuItem( EAknCmdHelp ); + aMenuPane->DeleteMenuItem( EAknCmdHelp ); //remove help } // The security module list is empty. // All except Exit and Help is dimmed. diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/StubSIS/swipolicy.ini --- a/pkiutilities/StubSIS/swipolicy.ini Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -AllowUnsigned = false -MandatePolicies = false -MandateCodeSigningExtension = false -Oid = 1.2.3.4.5.6 -Oid = 2.3.4.5.6.7 -DRMEnabled = true -DRMIntent = 3 -OcspMandatory = false -OcspEnabled = true -AllowGrantUserCapabilities = true -AllowOrphanedOverwrite = true -UserCapabilities = NetworkServices LocalServices ReadUserData WriteUserData UserEnvironment Location -AllowPackagePropagate = true -SISCompatibleIfNoTargetDevices = false -RunWaitTimeoutSeconds = 600 -AllowRunOnInstallUninstall = false -DeletePreinstalledFilesOnUninstall = true -AlternativeCodeSigningOID = 1.3.6.1.4.1.94.1.49.1.2.2.1 1.3.6.1.4.1.94.1.49.1.2.2.5 -RemoveOnlyWithLastDependent = true -PhoneTsyName = phonetsy diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/StubSIS/tlsproviderpolicy.ini --- a/pkiutilities/StubSIS/tlsproviderpolicy.ini Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -ClientAuthDlgEnabled = true - diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/group/bld.inf --- a/pkiutilities/group/bld.inf Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/group/bld.inf Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2005-2009 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,36 +18,22 @@ #include "../x509certnameparser/group/bld.inf" #include "../PKCS12/group/bld.inf" -#include "../CertmanUi/GROUP/bld.inf" -#include "../CTSecurityDialogs/Group/bld.inf" #include "../CertSaver/group/bld.inf" -#include "../SecModUI/group/bld.inf" #include "../DeviceToken/Group/bld.inf" +#include "../securitydialognotifier/group/bld.inf" +#include "../securitydialognotifiersrv/group/bld.inf" //Stub SIS PRJ_EXPORTS ../StubSIS/CenRepStub.sis /epoc32/data/z/system/install/CenRepStub.sis -//SWI and TLSProvider config files -../StubSIS/swipolicy.ini /epoc32/release/winscw/udeb/z/system/data/swipolicy.ini -../StubSIS/swipolicy.ini /epoc32/release/winscw/urel/z/system/data/swipolicy.ini -../StubSIS/swipolicy.ini /epoc32/data/z/system/data/swipolicy.ini - -../StubSIS/tlsproviderpolicy.ini /epoc32/release/winscw/urel/z/resource/tlsproviderpolicy.ini -../StubSIS/tlsproviderpolicy.ini /epoc32/release/winscw/udeb/z/resource/tlsproviderpolicy.ini - // export iby files ../rom/x509certnameparser.iby CORE_MW_LAYER_IBY_EXPORT_PATH( x509certnameparser.iby ) ../rom/pkcs12.iby CORE_MW_LAYER_IBY_EXPORT_PATH( pkcs12.iby ) -../rom/certmanui.iby CORE_MW_LAYER_IBY_EXPORT_PATH( certmanui.iby ) -../rom/certmanui_resources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH( certmanui_resources.iby ) -../rom/CTSecurityDialogs.iby CORE_MW_LAYER_IBY_EXPORT_PATH( CTSecurityDialogs.iby ) -../rom/CTSecurityDialogs_resources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH( CTSecurityDialogs_resources.iby ) +../rom/certmanui_resources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH( certmanui_resources.iby ) // needed by CTSecurityDialogs ../rom/CertSaver.iby CORE_MW_LAYER_IBY_EXPORT_PATH( CertSaver.iby ) ../rom/CertSaver_resources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH( CertSaver_resources.iby ) -../rom/SecModUI.iby CORE_MW_LAYER_IBY_EXPORT_PATH( SecModUI.iby ) -../rom/SecModUI_resources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH( SecModUI_resources.iby ) ../rom/DevToken.iby CORE_MW_LAYER_IBY_EXPORT_PATH( DevToken.iby ) ../rom/StubSIS.iby CORE_MW_LAYER_IBY_EXPORT_PATH( StubSIS.iby ) diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/pkiutilities.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/pkiutilities.pro Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,20 @@ +# +# Copyright (c) 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" +# 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: pkiutilities project file +# + +TEMPLATE = subdirs + +SUBDIRS += untrustedcertificatedialog/untrustedcertificateplugin.pro + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/rom/CTSecurityDialogs.iby --- a/pkiutilities/rom/CTSecurityDialogs.iby Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/rom/CTSecurityDialogs.iby Tue Aug 31 16:04:40 2010 +0300 @@ -27,7 +27,7 @@ file=ABI_DIR\BUILD_DIR\CTSecDialogImpl.dll SHARED_LIB_DIR\CTSecDialogImpl.dll -ECOM_PLUGIN(CTSECDLGNOTIFIER.dll, 10008D4F.rsc) +//ECOM_PLUGIN(CTSECDLGNOTIFIER.dll, 10008D4F.rsc) #endif // __CTSECURITYDIALOGS_IBY diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/rom/StubSIS.iby --- a/pkiutilities/rom/StubSIS.iby Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/rom/StubSIS.iby Tue Aug 31 16:04:40 2010 +0300 @@ -25,6 +25,4 @@ data=ZSYSTEM\install\CenRepStub.sis System\Install\CenRepStub.sis -//data = EPOCROOT##epoc32\release\winscw\urel\z\system\data\swipolicy.ini System\data\swipolicy.ini - #endif diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/data/20031DB3.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifier/data/20031DB3.rss Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 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" +* 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: Security dialog notifier plug-in resource file. +* +*/ + + +#include +#include + +RESOURCE REGISTRY_INFO r_registry + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = 0x20031DB3; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUikonUidPluginInterfaceNotifiers; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x101F883C; + version_no = 1; + display_name = "SecurityDialogs Plugin"; + default_data = "SecurityDialogs"; + opaque_data = "0"; + rom_only = 1; + } + }; + } + }; + } + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifier/group/bld.inf Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 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" +* 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: Security dialog notifier +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/securitydialognotifier.iby CORE_MW_LAYER_IBY_EXPORT_PATH( securitydialognotifier.iby ) + +PRJ_MMPFILES +securitydialognotifier.mmp + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/group/securitydialognotifier.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifier/group/securitydialognotifier.mmp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 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" +* 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: Security dialog notifier +* +*/ + +#include + +TARGET securitydialognotifier.dll +CAPABILITY CAP_ECOM_PLUGIN +TARGETTYPE PLUGIN +UID 0x10009D8D 0x20031DB3 +VENDORID VID_DEFAULT + +SOURCEPATH ../data +START RESOURCE 20031DB3.rss +TARGET securitydialognotifier.rsc +END + +MW_LAYER_SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore /epoc32/include/mw/hb/hbwidgets +USERINCLUDE ../inc + +SOURCEPATH ../src +SOURCE securitydialogmain.cpp +SOURCE securitydialognotifier.cpp +SOURCE securitydialognotifiersrv.cpp +SOURCE securitydialogs.cpp + +LIBRARY euser.lib +LIBRARY eiksrv.lib +LIBRARY ctframework.lib + +SMPSAFE diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/inc/securitydialognotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifier/inc/securitydialognotifier.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 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" +* 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: Security dialog notifier +* +*/ + +#ifndef SECURITYDIALOGNOTIFIER_H +#define SECURITYDIALOGNOTIFIER_H + +#include // MEikSrvNotifierManager + +class CSecurityDialogs; + + +/** + * Security Dialog Notifier + * CSecurityDialogNotifier is a RNotifier that implements security dialogs + * defined in secdlgimpldefs.h (see TSecurityDialogOperation operations). + */ +NONSHARABLE_CLASS( CSecurityDialogNotifier ) : public CBase, public MEikSrvNotifierBase2 + { + public: // constructors and destructor + static CSecurityDialogNotifier* NewL(); + ~CSecurityDialogNotifier(); + + private: // from MEikSrvNotifierBase2 + void Release(); + TNotifierInfo RegisterL(); + TNotifierInfo Info() const; + void StartL( const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage ); + TPtrC8 StartL( const TDesC8& aBuffer ); + void Cancel(); + TPtrC8 UpdateL( const TDesC8& aBuffer ); + + private: // new functions + CSecurityDialogNotifier(); + void ConstructL(); + void DoStartL( const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage ); + + private: // data + CSecurityDialogs* iSecurityDialogs; + TBool iIsSecurityDialogsDeleted; + }; + +#endif // SECURITYDIALOGNOTIFIER_H + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/inc/securitydialognotifiersrv.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifier/inc/securitydialognotifiersrv.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 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" +* 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: Security dialog notifier server, client-side API. +* +*/ + +#ifndef SECURITYDIALOGNOTIFIERSRV_H +#define SECURITYDIALOGNOTIFIERSRV_H + +#include // RSessionBase +#include // TSecurityDialogOperation + + +/** + * Security Dialog Notifier Server API + * Security dialogs provide TSecurityDialogOperation functionality defined in secdlgimpldefs.h. + * Implementation consist of two components: a notifier DLL (CSecurityDialogNotifier, ECom DLL) + * and a server executable (CSecurityDialogNotifierSrv). CSecurityDialogNotifier runs in UIKON + * server that has limited capabilities. It passes the requests to the server component + * (CSecurityDialogNotifierSrv) that provides the actual functionality. + */ +NONSHARABLE_CLASS( RSecurityDialogNotifierSrv ) : public RSessionBase + { + public: // constructors and destructor + RSecurityDialogNotifierSrv(); + ~RSecurityDialogNotifierSrv(); + + public: // new functions + TInt Connect(); + TVersion Version() const; + void SecurityDialogOperation( TSecurityDialogOperation aOperation, + const TDesC8& aInputBuffer, TDes8& aOutputBuffer, + TRequestStatus& aStatus ); + void CancelOperation(); + + private: // new functions + TInt StartServer(); + + private: // data + TIpcArgs iArgs; + }; + +#endif // SECURITYDIALOGNOTIFIERSRV_H + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/inc/securitydialogs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifier/inc/securitydialogs.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 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" +* 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: CSecurityDialogs active object +* +*/ + +#ifndef SECURITYDIALOGS_H +#define SECURITYDIALOGS_H + +#include // CActive +#include // TSecurityDialogOperation +#include "securitydialognotifiersrv.h" // RSecurityDialogNotifierSrv + + +/** + * Security Dialogs + * CSecurityDialogs class provides implementation for the security dialog + * operations (TSecurityDialogOperation) defined in secdlgimpldefs.h. + * When RNotifier class is used to open security dialogs, CSecurityDialogNotifier + * class calls CSecurityDialogs to show the requested dialogs. CSecurityDialogs + * uses RSecurityDialogNotifierSrv server to do the actual work. + */ +NONSHARABLE_CLASS( CSecurityDialogs ) : public CActive + { + public: // constructors and destructor + static CSecurityDialogs* NewL( TBool& aIsDeleted ); + ~CSecurityDialogs(); + + public: // new functions + /** + * Starts handling the requested operation. + * @param aBuffer - Data passed from client RNotifier::StartNotifierAndGetResponse() call + * @param aReplySlot - Identifies which message argument to use for the reply + * @param aMessage - Encapsulates the client request + */ + void StartLD( const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage ); + + protected: // from CActive + void RunL(); + void DoCancel(); + TInt RunError( TInt aError ); + + private: // new functions + CSecurityDialogs( TBool& aIsDeleted ); + + private: // data + TBool& iIsDeleted; + + TInt iRetry; + TInt iReplySlot; + RMessagePtr2 iMessagePtr; + TSecurityDialogOperation iOperation; + + RSecurityDialogNotifierSrv iServer; + HBufC8* iInputBuffer; + TAny* iOutputBuffer; + TPtr8 iOutputPtr; + }; + +#endif // SECURITYDIALOGS_H + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/inc/securitydialogstrace.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifier/inc/securitydialogstrace.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 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" +* 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: TRACE macros for security dialogs +* +*/ + +#ifndef SECURITYDIALOGSTRACE_H +#define SECURITYDIALOGSTRACE_H + +#include // RDebug + + +// TODO: replace with OST tracing +#ifdef _DEBUG +#define TRACE( a, ARGS... ) DebugPrint( _L( a ), ##ARGS ) +#else +#define TRACE( a, ARGS... ) +#endif + + +// --------------------------------------------------------------------------- +// DebugPrint() +// --------------------------------------------------------------------------- +// +#ifdef _DEBUG +const TInt KMaxPrintSize = 256; +inline void DebugPrint( TRefByValue aFmt, ... ) + { + VA_LIST list; + VA_START( list, aFmt ); + TBuf buf; + buf.AppendFormatList( aFmt, list ); + RDebug::Print( buf ); + } +#endif + + +#endif // SECURITYDIALOGSTRACE_H + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/rom/securitydialognotifier.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifier/rom/securitydialognotifier.iby Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 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" +* 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: Security dialog notifier +* +*/ + +#ifndef SECURITYDIALOGNOTIFIER_IBY +#define SECURITYDIALOGNOTIFIER_IBY +#include + +ECOM_PLUGIN( securitydialognotifier.dll, securitydialognotifier.rsc ) + +#endif // SECURITYDIALOGNOTIFIER_IBY + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/src/securitydialogmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifier/src/securitydialogmain.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 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" +* 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: Security Dialog notifier entry point +* +*/ + +#include "securitydialognotifier.h" // CSecurityDialogNotifier +#include // TImplementationProxy definition + +const TInt KNumberOfImplementations = 1; + + +// ---------------------------------------------------------------------------- +// CreateNotifiersL() +// ---------------------------------------------------------------------------- +// +void CreateNotifiersL( CArrayPtr& aNotifierArray ) + { + CSecurityDialogNotifier* notifier = CSecurityDialogNotifier::NewL(); + CleanupStack::PushL( notifier ); + aNotifierArray.AppendL( notifier ); + CleanupStack::Pop( notifier ); + } + +// ---------------------------------------------------------------------------- +// NotifierArray() +// ---------------------------------------------------------------------------- +// +CArrayPtr* NotifierArray() + { + CArrayPtr* notifierArray = + new CArrayPtrFlat( KNumberOfImplementations ); + if( notifierArray ) + { + TRAPD( err, CreateNotifiersL( *notifierArray ) ); + if( err ) + { + TInt count = notifierArray->Count(); + while( count-- ) + { + (*notifierArray)[ count ]->Release(); + } + delete notifierArray; + notifierArray = NULL; + } + } + return notifierArray; + } + +// ---------------------------------------------------------------------------- +// Provides a key value pair table, that ECOM uses to identify +// the correct construction function for the requested interface. +// ---------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { + // UID is the implementation uid defined in .rss file + IMPLEMENTATION_PROXY_ENTRY( 0x101F883C, NotifierArray ) + }; + +// ---------------------------------------------------------------------------- +// Main entry function used to return an instance of the proxy table. +// ---------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); + return ImplementationTable; + } diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/src/securitydialognotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifier/src/securitydialognotifier.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,169 @@ +/* +* Copyright (c) 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" +* 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: Security dialog notifier +* +*/ + +#include "securitydialognotifier.h" // CSecurityDialogNotifier +#include "securitydialogs.h" // CSecurityDialogs +#include "securitydialogstrace.h" // TRACE macro + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifier::~CSecurityDialogNotifier() +// --------------------------------------------------------------------------- +// +CSecurityDialogNotifier::~CSecurityDialogNotifier() + { + TRACE( "CSecurityDialogNotifier::~CSecurityDialogNotifier" ); + Cancel(); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifier::NewL() +// --------------------------------------------------------------------------- +// +CSecurityDialogNotifier* CSecurityDialogNotifier::NewL() + { + CSecurityDialogNotifier* self = new( ELeave ) CSecurityDialogNotifier; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifier::Release() +// --------------------------------------------------------------------------- +// +void CSecurityDialogNotifier::Release() + { + TRACE( "CSecurityDialogNotifier::Release" ); + delete this; + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifier::RegisterL() +// --------------------------------------------------------------------------- +// +CSecurityDialogNotifier::TNotifierInfo CSecurityDialogNotifier::RegisterL() + { + return Info(); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifier::Info() +// --------------------------------------------------------------------------- +// +CSecurityDialogNotifier::TNotifierInfo CSecurityDialogNotifier::Info() const + { + TNotifierInfo info; + info.iUid = KUidSecurityDialogNotifier; + info.iChannel = KUidSecurityDialogNotifier; + info.iPriority = ENotifierPriorityAbsolute; + return info; + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifier::StartL() +// --------------------------------------------------------------------------- +// +void CSecurityDialogNotifier::StartL( const TDesC8& aBuffer, TInt aReplySlot, + const RMessagePtr2& aMessage ) + { + TRACE( "CSecurityDialogNotifier::StartL, begin" ); + + TRAPD( err, DoStartL( aBuffer, aReplySlot, aMessage ) ); + TRACE( "CSecurityDialogNotifier::StartL, DoStartL err=%d", err ); + if( err ) + { + if( iSecurityDialogs && !iIsSecurityDialogsDeleted ) + { + TRACE( "CSecurityDialogNotifier::StartL, deleting iSecurityDialogs" ); + delete iSecurityDialogs; + iSecurityDialogs = NULL; + } + if( !aMessage.IsNull() ) + { + TRACE( "CSecurityDialogNotifier::StartL, completing message" ); + aMessage.Complete( err ); + } + } + + TRACE( "CSecurityDialogNotifier::StartL, end" ); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifier::StartL() +// --------------------------------------------------------------------------- +// +TPtrC8 CSecurityDialogNotifier::StartL( const TDesC8& /*aBuffer*/ ) + { + return KNullDesC8(); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifier::Cancel() +// --------------------------------------------------------------------------- +// +void CSecurityDialogNotifier::Cancel() + { + TRACE( "CSecurityDialogNotifier::Cancel" ); + if( iSecurityDialogs && !iIsSecurityDialogsDeleted ) + { + TRACE( "CSecurityDialogNotifier::Cancel, deleting iSecurityDialogs" ); + delete iSecurityDialogs; + iSecurityDialogs = NULL; + } + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifier::UpdateL() +// --------------------------------------------------------------------------- +// +TPtrC8 CSecurityDialogNotifier::UpdateL( const TDesC8& /*aBuffer*/ ) + { + return KNullDesC8(); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifier::CSecurityDialogNotifier() +// --------------------------------------------------------------------------- +// +CSecurityDialogNotifier::CSecurityDialogNotifier() + { + TRACE( "CSecurityDialogNotifier::CSecurityDialogNotifier" ); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifier::ConstructL() +// --------------------------------------------------------------------------- +// +void CSecurityDialogNotifier::ConstructL() + { + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifier::DoStartL() +// --------------------------------------------------------------------------- +// +void CSecurityDialogNotifier::DoStartL( const TDesC8& aBuffer, TInt aReplySlot, + const RMessagePtr2& aMessage ) + { + iSecurityDialogs = CSecurityDialogs::NewL( iIsSecurityDialogsDeleted ); + iSecurityDialogs->StartLD( aBuffer, aReplySlot, aMessage ); + } + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/src/securitydialognotifiersrv.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifier/src/securitydialognotifiersrv.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,148 @@ +/* +* Copyright (c) 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" +* 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: Security dialog notifier server, client-side API. +* +*/ + +#include "securitydialognotifiersrv.h" // RSecurityDialogNotifierSrv +#include "../../securitydialognotifiersrv/inc/securitydialognotifierservername.h" +#include "securitydialogstrace.h" // TRACE macro + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// RSecurityDialogNotifierSrv::RSecurityDialogNotifierSrv() +// --------------------------------------------------------------------------- +// +RSecurityDialogNotifierSrv::RSecurityDialogNotifierSrv() + { + } + +// --------------------------------------------------------------------------- +// RSecurityDialogNotifierSrv::~RSecurityDialogNotifierSrv() +// --------------------------------------------------------------------------- +// +RSecurityDialogNotifierSrv::~RSecurityDialogNotifierSrv() + { + } + +// --------------------------------------------------------------------------- +// RSecurityDialogNotifierSrv::Connect() +// --------------------------------------------------------------------------- +// +TInt RSecurityDialogNotifierSrv::Connect() + { + TRACE( "RSecurityDialogNotifierSrv::Connect" ); + const TInt KMaxCreateSessionAttepmts = 2; + TInt retry = KMaxCreateSessionAttepmts; + FOREVER + { + TInt err = CreateSession( KSecurityDialogNotifierServerName, Version() ); + TRACE( "RSecurityDialogNotifierSrv::Connect, create session err=%d", err ); + if( err != KErrNotFound && err != KErrServerTerminated ) + { + return err; + } + + if( --retry == 0 ) + { + return err; + } + + err = StartServer(); + if( err != KErrNone && err != KErrAlreadyExists ) + { + return err; + } + } + } + +// --------------------------------------------------------------------------- +// RSecurityDialogNotifierSrv::Version() +// --------------------------------------------------------------------------- +// +TVersion RSecurityDialogNotifierSrv::Version() const + { + return TVersion( KSecurityDialogNotifierServerMajorVersionNumber, + KSecurityDialogNotifierServerMinorVersionNumber, + KSecurityDialogNotifierServerBuildVersionNumber ); + } + +// --------------------------------------------------------------------------- +// RSecurityDialogNotifierSrv::SecurityDialogOperationL() +// --------------------------------------------------------------------------- +// +void RSecurityDialogNotifierSrv::SecurityDialogOperation( + TSecurityDialogOperation aOperation, + const TDesC8& aInputBuffer, TDes8& aOutputBuffer, + TRequestStatus& aStatus ) + { + TRACE( "RSecurityDialogNotifierSrv::SecurityDialogOperation" ); + iArgs = TIpcArgs( &aInputBuffer, &aOutputBuffer ); + SendReceive( aOperation, iArgs, aStatus ); + } + +// --------------------------------------------------------------------------- +// RSecurityDialogNotifierSrv::CancelOperation() +// --------------------------------------------------------------------------- +// +void RSecurityDialogNotifierSrv::CancelOperation() + { + TRACE( "RSecurityDialogNotifierSrv::CancelOperation" ); + SendReceive( KSecurityDialogCancelOperation ); + } + +// --------------------------------------------------------------------------- +// RSecurityDialogNotifierSrv::StartServer() +// --------------------------------------------------------------------------- +// +TInt RSecurityDialogNotifierSrv::StartServer() +{ + TRACE( "RSecurityDialogNotifierSrv::StartServer, begin" ); + RProcess server; + TInt err = server.Create( KSecurityDialogNotifierServerName, KNullDesC ); + if( err ) + { + TRACE( "RSecurityDialogNotifierSrv::StartServer, create failed, err=%d", err ); + return err; + } + + TRequestStatus status; + server.Rendezvous( status ); + if( status == KRequestPending ) + { + server.Resume(); + } + else + { + server.Kill( KErrNone ); + } + + TRACE( "RSecurityDialogNotifierSrv::StartServer, waiting rendezvous" ); + User::WaitForRequest( status ); + if( server.ExitType() == EExitPanic ) + { + err = KErrGeneral; + } + else + { + err = status.Int(); + } + server.Close(); + + TRACE( "RSecurityDialogNotifierSrv::StartServer, end err=%d", err ); + return err; +} + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/src/securitydialogs.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifier/src/securitydialogs.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,187 @@ +/* +* Copyright (c) 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" +* 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: CSecurityDialogs active object +* +*/ + +#include "securitydialogs.h" // CSecurityDialogs +#include "securitydialogstrace.h" // TRACE macro + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CSecurityDialogs::NewL() +// --------------------------------------------------------------------------- +// +CSecurityDialogs* CSecurityDialogs::NewL( TBool& aIsDeleted ) + { + return new( ELeave ) CSecurityDialogs( aIsDeleted ); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogs::~CSecurityDialogs() +// --------------------------------------------------------------------------- +// +CSecurityDialogs::~CSecurityDialogs() + { + TRACE( "CSecurityDialogs::~CSecurityDialogs, begin" ); + Cancel(); + iServer.Close(); + delete iInputBuffer; + iInputBuffer = NULL; + delete iOutputBuffer; + iOutputBuffer = NULL; + iIsDeleted = ETrue; + TRACE( "CSecurityDialogs::~CSecurityDialogs, end" ); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogs::StartLD() +// --------------------------------------------------------------------------- +// +void CSecurityDialogs::StartLD( const TDesC8& aBuffer, TInt aReplySlot, + const RMessagePtr2& aMessage ) + { + TRACE( "CSecurityDialogs::StartLD, begin" ); + User::LeaveIfError( iServer.Connect() ); + + const TInt* ptr = reinterpret_cast< const TInt* >( aBuffer.Ptr() ); + iOperation = static_cast< TSecurityDialogOperation >( *ptr & KSecurityDialogOperationMask ); + iReplySlot = aReplySlot; + + TRACE( "CSecurityDialogs::StartLD, message 0x%08x", iMessagePtr.Handle() ); + iMessagePtr = aMessage; + + TRACE( "CSecurityDialogs::StartLD, iOperation=%d", iOperation ); + __ASSERT_DEBUG( iOutputBuffer == NULL, User::Invariant() ); + TInt outputBufLen = 0; + switch( iOperation ) + { + case ESecureConnection: + case ESignText: + iOutputBuffer = new( ELeave ) TCTTokenObjectHandleBuf; + outputBufLen = sizeof( TCTTokenObjectHandleBuf ); + break; + case EEnterPIN: + case EEnablePIN: + case EDisablePIN: + iOutputBuffer = new( ELeave ) TPINValueBuf; + outputBufLen = sizeof( TPINValueBuf ); + break; + case EChangePIN: + case EUnblockPIN: + iOutputBuffer = new( ELeave ) TTwoPINOutputBuf; + outputBufLen = sizeof( TTwoPINOutputBuf ); + break; + case EPINBlocked: + case ETotalBlocked: + break; + case EUnblockPINInClear: + iOutputBuffer = new( ELeave ) TUnblockPINInClearOutputBuf; + outputBufLen = sizeof( TUnblockPINInClearOutputBuf ); + break; + case EServerAuthenticationFailure: + iOutputBuffer = new( ELeave ) TServerAuthenticationFailureOutputBuf; + outputBufLen = sizeof( TServerAuthenticationFailureOutputBuf ); + break; + default: + User::Leave( KErrNotSupported ); + break; + } + + __ASSERT_DEBUG( iInputBuffer == NULL, User::Invariant() ); + iInputBuffer = aBuffer.AllocL(); + + if( iOutputBuffer ) + { + iOutputPtr.Set( static_cast< TUint8* >( iOutputBuffer ), outputBufLen, outputBufLen ); + iServer.SecurityDialogOperation( iOperation, *iInputBuffer, iOutputPtr, iStatus ); + } + else + { + User::Leave( KErrNotSupported ); + } + SetActive(); + TRACE( "CSecurityDialogs::StartLD, end" ); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogs::RunL() +// --------------------------------------------------------------------------- +// +void CSecurityDialogs::RunL() + { + TRACE( "CSecurityDialogs::RunL, iStatus.Int()=%d", iStatus.Int() ); + TInt error = iStatus.Int(); + User::LeaveIfError( error ); + __ASSERT_DEBUG( iOutputPtr.Ptr(), User::Invariant() ); + iMessagePtr.WriteL( iReplySlot, iOutputPtr ); + + TRACE( "CSecurityDialogs::RunL, completing message 0x%08x", iMessagePtr.Handle() ); + iMessagePtr.Complete( error ); + + TRACE( "CSecurityDialogs::RunL, deleting this" ); + delete this; + TRACE( "CSecurityDialogs::RunL, end" ); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogs::DoCancel() +// --------------------------------------------------------------------------- +// +void CSecurityDialogs::DoCancel() + { + TRACE( "CSecurityDialogs::DoCancel, begin" ); + iServer.CancelOperation(); + if( !iMessagePtr.IsNull() ) + { + TRACE( "CSecurityDialogs::DoCancel, completing message 0x%08x", iMessagePtr.Handle() ); + iMessagePtr.Complete( KErrCancel ); + } + TRACE( "CSecurityDialogs::DoCancel(), end" ); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogs::RunError() +// --------------------------------------------------------------------------- +// +TInt CSecurityDialogs::RunError( TInt aError ) + { + TRACE( "CSecurityDialogs::RunError, aError=%d", aError ); + if( !iMessagePtr.IsNull() ) + { + TRACE( "CSecurityDialogs::RunError, completing message 0x%08x", iMessagePtr.Handle() ); + iMessagePtr.Complete( aError ); + } + + TRACE( "CSecurityDialogs::RunError, deleting this" ); + delete this; + + TRACE( "CSecurityDialogs::RunError, end" ); + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CSecurityDialogs::CSecurityDialogs() +// --------------------------------------------------------------------------- +// +CSecurityDialogs::CSecurityDialogs( TBool& aIsDeleted ) : CActive( CActive::EPriorityLow ), + iIsDeleted( aIsDeleted ), iOutputPtr( NULL, 0, 0 ) + { + TRACE( "CSecurityDialogs::CSecurityDialogs" ); + CActiveScheduler::Add( this ); + iIsDeleted = EFalse; + } + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglauncher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglauncher.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,218 @@ +/* +* Copyright (c) 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" +* 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: Test application for untrusted certificate dialog. +* +*/ + +#include "srvauthfaildlglauncher.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#ifdef Q_OS_SYMBIAN +#include // TValidationError +#include // TServerAuthenticationFailureInput, KUidSecurityDialogNotifier + +HBufC8* GetInputBufferL( const QString& server, const QByteArray& certificate, int reason ) + { + const TPtrC16 serverNameUnicode(reinterpret_cast(server.constData()), + server.length()); + const TPtrC8 encodedCert(reinterpret_cast(certificate.constData()), + certificate.length()); + + const TInt KServerNameMaxLength = 512; + TBuf8 serverName; + serverName.Copy(serverNameUnicode); + + TServerAuthenticationFailureInput serverAuthenticationInput; + serverAuthenticationInput.iOperation = EServerAuthenticationFailure; + serverAuthenticationInput.iFailureReason = static_cast(reason); + serverAuthenticationInput.iServerNameLength = serverName.Length(); + serverAuthenticationInput.iEncodedCertLength = encodedCert.Length(); + + TServerAuthenticationFailureInputBuf inputBuf( serverAuthenticationInput ); + + TInt bufferSize = sizeof( inputBuf ) + serverName.Length() + encodedCert.Length(); + HBufC8* packedBuffer = HBufC8::NewL( bufferSize ); + TPtr8 packedBufferPtr( packedBuffer->Des() ); + + packedBufferPtr.Append( inputBuf ); + packedBufferPtr.Append( serverName ); + packedBufferPtr.Append( encodedCert ); + + return packedBuffer; + } + +bool ShowDialogL( const QString& server, const QByteArray& certificate, int reason, bool cancel ) + { + RNotifier notifier; + User::LeaveIfError( notifier.Connect() ); + CleanupClosePushL( notifier ); + + HBufC8* buffer = GetInputBufferL( server, certificate, reason ); + CleanupStack::PushL( buffer ); + + TRequestStatus status; + TPckgBuf resultPckg; + notifier.StartNotifierAndGetResponse( status, KUidSecurityDialogNotifier, + *buffer, resultPckg ); + if( cancel ) + { + const TInt KTenSecDelay = 10000000; + User::After( KTenSecDelay ); + notifier.CancelNotifier( KUidSecurityDialogNotifier ); + } + User::WaitForRequest( status ); + User::LeaveIfError( status.Int() ); + + CleanupStack::PopAndDestroy( buffer ); + CleanupStack::PopAndDestroy( ¬ifier ); + return( resultPckg() == EContinue ); + } + +#endif // Q_OS_SYMBIAN + + +const QString KTestCertDir = "c:/data/testCerts"; + +SrvAuthFailDlgLauncher::SrvAuthFailDlgLauncher(int& argc, char* argv[]) + : HbApplication(argc, argv), mMainWindow(0), mMainView(0) +{ + mMainWindow = new HbMainWindow(); + mMainView = new HbView(); + mMainView->setTitle(tr("SrvAuthFailDlgLauncher")); + + QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); + + layout->addItem(new HbLabel(tr("Server host name:"))); + mHostName = new HbTextEdit(tr("some.host.com")); + layout->addItem(mHostName); + layout->addStretch(); + + layout->addItem(new HbLabel(tr("Certificate file:"))); + mFilesList = new HbComboBox; + mFilesList->setEditable(false); + QDir dir(KTestCertDir); + if (dir.exists()) { + QFileInfoList list = dir.entryInfoList(QDir::Files); + QListIterator iter(list); + while (iter.hasNext()) { + const QFileInfo &info(iter.next()); + mFilesList->addItem(info.fileName()); + } + } + layout->addItem(mFilesList); + layout->addStretch(); + + layout->addItem(new HbLabel(tr("Validation result:"))); + mValidationResult = new HbComboBox; + QStringList validationResults; + validationResults + << "EValidatedOK" + << "EChainHasNoRoot" + << "ESignatureInvalid" + << "EDateOutOfRange" + << "ENameIsExcluded" + << "ENameNotPermitted" + << "ENotCACert" + << "ECertificateRevoked" + << "EUnrecognizedCriticalExtension" + << "ENoBasicConstraintInCACert" + << "ENoAcceptablePolicy" + << "EPathTooLong" + << "ENegativePathLengthSpecified" + << "ENamesDontChain" + << "ERequiredPolicyNotFound" + << "EBadKeyUsage" + << "ERootCertNotSelfSigned" + << "ECriticalExtendedKeyUsage" + << "ECriticalCertPoliciesWithQualifiers" + << "ECriticalPolicyMapping" + << "ECriticalDeviceId" + << "ECriticalSid" + << "ECriticalVid" + << "ECriticalCapabilities"; + mValidationResult->addItems(validationResults); + mValidationResult->setCurrentIndex(1); // EChainHasNoRoot + layout->addItem(mValidationResult); + layout->addStretch(); + + mCancelShortly = new HbCheckBox("Cancel after 10 seconds"); + layout->addItem(mCancelShortly); + + HbPushButton *button = 0; + button = new HbPushButton("Launch dialog"); + connect(button, SIGNAL(clicked()), this, SLOT(activateDialog())); + layout->addItem(button); + + button = new HbPushButton("Exit"); + connect(button, SIGNAL(clicked()), qApp, SLOT(quit())); + layout->addItem(button); + + mMainView->setLayout(layout); + mMainWindow->addView(mMainView); + mMainWindow->show(); +} + +SrvAuthFailDlgLauncher::~SrvAuthFailDlgLauncher() +{ + delete mMainView; + delete mMainWindow; +} + +void SrvAuthFailDlgLauncher::activateDialog() +{ + QString server = mHostName->toPlainText(); + + QString fileName = mFilesList->currentText(); + QFile file; + QDir::setCurrent(KTestCertDir); + file.setFileName(fileName); + file.open(QIODevice::ReadOnly); + QByteArray fileContent = file.readAll(); + file.close(); + + int reason = mValidationResult->currentIndex(); + bool cancel = mCancelShortly->isChecked(); + + int error = 0; + bool accepted = false; +#ifdef Q_OS_SYMBIAN + TRAP( error, accepted = ShowDialogL(server, fileContent, reason, cancel) ); +#endif // Q_OS_SYMBIAN + if (!error) { + if (accepted) { + HbMessageBox::information(QString("Accepted")); + } else { + HbMessageBox::information(QString("Declined")); + } + } else { + if (error == KErrCancel) { + HbMessageBox::information(QString("Cancelled")); + } else { + HbMessageBox::information(QString("Failed, error %1").arg(error)); + } + } +} + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglauncher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglauncher.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 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" +* 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: Test application for untrusted certificate dialog. +* +*/ + +#ifndef SRVAUTHFAILDLGLAUNCHER_H +#define SRVAUTHFAILDLGLAUNCHER_H + +#include + +class HbMainWindow; +class HbView; +class HbComboBox; +class HbTextEdit; +class HbCheckBox; + + +class SrvAuthFailDlgLauncher : public HbApplication +{ + Q_OBJECT + +public: // constructor and destructor + SrvAuthFailDlgLauncher(int& argc, char* argv[]); + ~SrvAuthFailDlgLauncher(); + +private slots: // new functions + void activateDialog(); + +private: // data + HbMainWindow *mMainWindow; + HbView *mMainView; + HbComboBox *mFilesList; + HbTextEdit *mHostName; + HbComboBox *mValidationResult; + HbCheckBox *mCancelShortly; +}; + +#endif // SRVAUTHFAILDLGLAUNCHER_H + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglauncher.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglauncher.iby Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 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" +* 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: Test application for untrusted certificate dialog. +* +*/ + + +#ifndef __SRVAUTHFAILDLGLAUNCHER_IBY__ +#define __SRVAUTHFAILDLGLAUNCHER_IBY__ + +file=ABI_DIR/BUILD_DIR/srvauthfaildlglauncher.exe SHARED_LIB_DIR/srvauthfaildlglauncher.exe +HB_UPGRADABLE_APP_REG_RSC( srvauthfaildlglauncher ) +S60_APP_RESOURCE( srvauthfaildlglauncher ) + +#endif // __SRVAUTHFAILDLGLAUNCHER_IBY__ diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglauncher.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglauncher.pkg Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,43 @@ +; +; Copyright (c) 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" +; 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: Test application for untrusted certificate dialog. +; + +; Language +&EN + +; SIS header: name, uid, version +#{"srvauthfaildlglauncher"},(0xE9bbd80d),1,0,0 + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Manual PKG pre-rules from PRO files +; Default dependency to Qt libraries +(0x2001E61C), 4, 6, 3, {"Qt"} + +; Default HW/platform dependencies +[0x101F7961],0,0,0,{"S60ProductID"} +[0x102032BE],0,0,0,{"S60ProductID"} +[0x102752AE],0,0,0,{"S60ProductID"} +[0x1028315F],0,0,0,{"S60ProductID"} + +; Executable and default resource files +"/epoc32/release/armv5/urel/srvauthfaildlglauncher.exe" - "!:\sys\bin\srvauthfaildlglauncher.exe" +"/epoc32/data/z/resource/apps/srvauthfaildlglauncher.rsc" - "!:\resource\apps\srvauthfaildlglauncher.rsc" +"/epoc32/data/z/private/10003a3f/import/apps/srvauthfaildlglauncher_reg.rsc" - "!:\private\10003a3f\import\apps\srvauthfaildlglauncher_reg.rsc" + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglauncher.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglauncher.pro Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,43 @@ +# +# Copyright (c) 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" +# 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: Test application for untrusted certificate dialog. +# + +TEMPLATE = app +TARGET = srvauthfaildlglauncher +CONFIG += hb +DEPENDPATH += . +INCLUDEPATH += . + +HEADERS += srvauthfaildlglauncher.h +SOURCES += srvauthfaildlglaunchermain.cpp srvauthfaildlglauncher.cpp + +symbian { + TARGET.CAPABILITY = CAP_APPLICATION +} + +BLD_INF_RULES.prj_exports += \ + "$${LITERAL_HASH}include " \ + "srvauthfaildlglauncher.iby CORE_APP_LAYER_IBY_EXPORT_PATH(srvauthfaildlglauncher.iby)" \ + "testCerts/RootCert.cer /epoc32/winscw/c/data/testCerts/RootCert.cer" \ + "testCerts/IntermediateCert.cer /epoc32/winscw/c/data/testCerts/IntermediateCert.cer" \ + "testCerts/ServerCert1.cer /epoc32/winscw/c/data/testCerts/ServerCert1.cer" \ + "testCerts/ServerCert2_noCN.cer /epoc32/winscw/c/data/testCerts/ServerCert2_noCN.cer" \ + "testCerts/ServerCert3_exp.cer /epoc32/winscw/c/data/testCerts/ServerCert3_exp.cer" \ + "testCerts/ServerCert4_exp2.cer /epoc32/winscw/c/data/testCerts/ServerCert4_exp2.cer" \ + "testCerts/ServerCert5_alg.cer /epoc32/winscw/c/data/testCerts/ServerCert5_alg.cer" \ + "testCerts/ServerCert6_key.cer /epoc32/winscw/c/data/testCerts/ServerCert6_key.cer" \ + "testCerts/SevverCert7_ocsp.cer /epoc32/winscw/c/data/testCerts/ServerCert7_ocsp.cer" \ + "testCerts/ServerCert8_aia.cer /epoc32/winscw/c/data/testCerts/ServerCert8_aia.cer" \ + "testCerts/ServerCert9_san.cer /epoc32/winscw/c/data/testCerts/ServerCert9_san.cer" diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglaunchermain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/srvauthfaildlglaunchermain.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 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" +* 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: Test application for untrusted certificate dialog. +* +*/ + +#include "srvauthfaildlglauncher.h" + +int main(int argc, char *argv[]) +{ + SrvAuthFailDlgLauncher app(argc, argv); + return app.exec(); +} + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/testCerts/IntermediateCert.cer Binary file pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/testCerts/IntermediateCert.cer has changed diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/testCerts/RootCert.cer Binary file pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/testCerts/RootCert.cer has changed diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert1.cer Binary file pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert1.cer has changed diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert2_noCN.cer Binary file pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert2_noCN.cer has changed diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert3_exp.cer Binary file pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert3_exp.cer has changed diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert4_exp2.cer Binary file pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert4_exp2.cer has changed diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert5_alg.cer Binary file pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert5_alg.cer has changed diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert6_key.cer Binary file pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert6_key.cer has changed diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert8_aia.cer Binary file pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert8_aia.cer has changed diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert9_san.cer Binary file pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/testCerts/ServerCert9_san.cer has changed diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/testCerts/SevverCert7_ocsp.cer Binary file pkiutilities/securitydialognotifier/tsrc/srvauthfaildlglauncher/testCerts/SevverCert7_ocsp.cer has changed diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifiersrv/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifiersrv/group/bld.inf Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 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" +* 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: Security dialog notifier server +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +../rom/securitydialognotifiersrv.iby CORE_MW_LAYER_IBY_EXPORT_PATH( securitydialognotifiersrv.iby ) + +PRJ_MMPFILES +securitydialognotifiersrv.mmp + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifiersrv/group/securitydialognotifiersrv.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifiersrv/group/securitydialognotifiersrv.mmp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 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" +* 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: Security dialog notifier server +* +*/ + +#include + +TARGET securitydialognotifiersrv.exe +CAPABILITY CAP_SERVER +TARGETTYPE EXE +UID 0x0 0x20031DCE +VENDORID VID_DEFAULT + +MW_LAYER_SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore /epoc32/include/mw/hb/hbwidgets +USERINCLUDE ../inc + +SOURCEPATH ../src +SOURCE securitydialognotifierservermain.cpp +SOURCE securitydialognotifierserver.cpp +SOURCE securitydialognotifiersession.cpp +SOURCE securitydialogoperation.cpp +SOURCE securitydialogoperserverauthfail.cpp +SOURCE untrustedcertquery.cpp + +LIBRARY euser.lib // Base classes +LIBRARY efsrv.lib // RFs +LIBRARY ctframework.lib // CServerAuthenticationFailureInput +LIBRARY x509.lib // CX509Certificate +LIBRARY x500.lib // CX500DistinguishedName +LIBRARY crypto.lib // CSignedObject +LIBRARY certstore.lib // CUnifiedCertStore +LIBRARY DevTokenClient.lib // CTrustSitesStore +LIBRARY HbCore.lib // CHbDeviceDialog + +SMPSAFE diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifiersrv/inc/securitydialognotifierserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifiersrv/inc/securitydialognotifierserver.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 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" +* 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: Security dialog notifier server +* +*/ + +#ifndef SECURITYDIALOGNOTIFIERSERVER_H +#define SECURITYDIALOGNOTIFIERSERVER_H + +#include // CPolicyServer + + +/** + * CSecurityDialogNotifierServer is the work-horse for TSecurityDialogOperation + * operations defined for security dialogs in secdlgimpldefs.h. It's client + * is CSecurityDialogs class in securitydialognotifier component. + */ +NONSHARABLE_CLASS( CSecurityDialogNotifierServer ) : public CPolicyServer + { + public: // constructor and destructor + static CSecurityDialogNotifierServer* NewLC(); + ~CSecurityDialogNotifierServer(); + + public: // new functions + void AddSession(); + void RemoveSession(); + + private: // from CServer2 (via CPolicyServer) + CSession2* NewSessionL(const TVersion &aVersion, const RMessage2& aMessage) const; + + private: // new functions + CSecurityDialogNotifierServer(); + void ConstructL(); + + private: // data + TInt iSessionCount; + }; + +#endif // SECURITYDIALOGNOTIFIERSERVER_H + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifiersrv/inc/securitydialognotifierservername.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifiersrv/inc/securitydialognotifierservername.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 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" +* 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: Security dialog notifier server name +* +*/ + +#ifndef SECURITYDIALOGNOTIFIERSERVERNAME_H +#define SECURITYDIALOGNOTIFIERSERVERNAME_H + +_LIT( KSecurityDialogNotifierServerName, "securitydialognotifiersrv" ); +const TInt KSecurityDialogNotifierServerMajorVersionNumber = 1; +const TInt KSecurityDialogNotifierServerMinorVersionNumber = 0; +const TInt KSecurityDialogNotifierServerBuildVersionNumber = 0; + +// See TSecurityDialogOperation in secdlgimpldefs.h for other function codes. +const TInt KSecurityDialogCancelOperation = 0; + +#endif // SECURITYDIALOGNOTIFIERSERVERNAME_H + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifiersrv/inc/securitydialognotifiersession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifiersrv/inc/securitydialognotifiersession.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 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" +* 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: Security dialog notifier server session +* +*/ + +#ifndef SECURITYDIALOGNOTIFIERSESSION_H +#define SECURITYDIALOGNOTIFIERSESSION_H + +#include // CSession2 +#include "securitydialogoperationobserver.h" // MSecurityDialogOperationObserver + +class CSecurityDialogNotifierServer; +class CSecurityDialogOperation; + + +/** + * CSecurityDialogNotifierSession is the session object in security + * dialog notifier server (CSecurityDialogNotifierServer). + */ +NONSHARABLE_CLASS( CSecurityDialogNotifierSession ) : public CSession2, + public MSecurityDialogOperationObserver + { + public: // constructor and destructor + static CSecurityDialogNotifierSession* NewL(); + ~CSecurityDialogNotifierSession(); + + public: // from CSession2 + void CreateL(); + void ServiceL( const RMessage2& aMessage ); + + public: // from MSecurityDialogOperationObserver + void OperationComplete(); + + private: // new functions + CSecurityDialogNotifierSession(); + void ConstructL(); + CSecurityDialogNotifierServer& Server(); + void DispatchMessageL( const RMessage2& aMessage ); + TBool IsOperationCancelled( const RMessage2& aMessage ); + void ServerAuthenticationFailureL( const RMessage2& aMessage ); + void GetInputBufferL( const RMessage2& aMessage ); + + private: // data + HBufC8* iInputBuffer; + CSecurityDialogOperation* iOperationHandler; + }; + +#endif // SECURITYDIALOGNOTIFIERSESSION_H + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifiersrv/inc/securitydialogoperation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifiersrv/inc/securitydialogoperation.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 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" +* 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: Base class for CSecurityDialog operations +* +*/ + +#ifndef SECURITYDIALOGOPERATION_H +#define SECURITYDIALOGOPERATION_H + +#include // CActive + +class MSecurityDialogOperationObserver; + + +/** + * CSecurityDialogOperation is a base class for different kinds of operations + * defined for security dialogs in /epoc32/include/platform/secdlgimpldefs.h. + * TSecurityDialogOperation lists the possible operations. A derived class + * implements each operation separately. This base class works as common API + * between different operation classes and the main CSecurityDialog class. + */ +NONSHARABLE_CLASS( CSecurityDialogOperation ) : public CActive + { + protected: // constructor + CSecurityDialogOperation( MSecurityDialogOperationObserver& aObserver, + const RMessage2& aMessage, TInt aReplySlot ); + + public: // destructor + ~CSecurityDialogOperation(); + + public: // new function + virtual void StartL( const TDesC8& aBuffer ) = 0; + virtual void CancelOperation() = 0; + + protected: // from CActive + TInt RunError( TInt aError ); + + protected: // data + MSecurityDialogOperationObserver& iObserver; + RMessage2 iMessage; + const TInt iReplySlot; + }; + +#endif // SECURITYDIALOGOPERATION_H + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifiersrv/inc/securitydialogoperationobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifiersrv/inc/securitydialogoperationobserver.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 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" +* 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: Observer definition for CSecurityDialog operations +* +*/ + +#ifndef SECURITYDIALOGOPERATIONOBSERVER_H +#define SECURITYDIALOGOPERATIONOBSERVER_H + + +/** + * CSecurityDialogOperations inform observer when they are complete. + * Completed operations can be deleted safely. Deleting an incomplete + * operation cancels the ongoing request. + */ +class MSecurityDialogOperationObserver + { + public: + virtual void OperationComplete() = 0; + }; + +#endif // SECURITYDIALOGOPERATIONOBSERVER_H + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifiersrv/inc/securitydialogoperserverauthfail.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifiersrv/inc/securitydialogoperserverauthfail.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 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" +* 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: Server authentication failure operation in security dialog +* +*/ + +#ifndef SECURITYDIALOGOPERSERVERAUTHFAIL_H +#define SECURITYDIALOGOPERSERVERAUTHFAIL_H + +#include "securitydialogoperation.h" // CSecurityDialogOperation +#include // TValidationError +#include // RMPointerArray +#include // RFs +#include // TServerAuthenticationFailureDialogResult + +class MSecurityDialogOperationObserver; +class CServerAuthenticationFailureInput; +class CUnifiedCertStore; +class MCTWritableCertStore; +class CCertAttributeFilter; +class CCTCertInfo; +class CUntrustedCertQuery; + + +/** + * CServerAuthFailOperation is a CSecurityDialogOperation that handles + * the EServerAuthenticationFailure operation. + */ +NONSHARABLE_CLASS( CServerAuthFailOperation ) : public CSecurityDialogOperation + { + public: // constructors and destructor + static CServerAuthFailOperation* NewL( MSecurityDialogOperationObserver& aObserver, + const RMessage2& aMessage, TInt aReplySlot ); + ~CServerAuthFailOperation(); + + public: // from CSecurityDialogOperation + void StartL( const TDesC8& aBuffer ); + void CancelOperation(); + + protected: // from CActive (via CSecurityDialogOperation) + void RunL(); + void DoCancel(); + + private: // new functions + CServerAuthFailOperation( MSecurityDialogOperationObserver& aObserver, + const RMessage2& aMessage, TInt aReplySlot ); + void InitializeUnifiedCertStoreL(); + void ProcessServerAuthorizationFailureL(); + void OpenTrustedSiteCertificateStoreL(); + TBool IsAlreadyTrustedSiteL(); + void StartFetchingTrustedSiteCertsL(); + void ShowUntrustedCertificateDialogL(); + void SaveServerCertToTrustedSiteCertStoreL(); + void SaveServerNameToTrustedSitesStoreL(); + void ReturnResultL( TServerAuthenticationFailureDialogResult aResult ); + void RetrieveFirstTrustedSiteCertL(); + void RetrieveNextTrustedSiteCertL(); + TBool IsRetrievedCertSameAsServerCertL(); + + private: // data + CServerAuthenticationFailureInput* iInput; + + TValidationError iAuthFailReason; + TPtrC8 iEncodedServerCert; + HBufC8* iServerCertFingerprint; + HBufC* iServerName; + HBufC* iCertLabel; + + CUntrustedCertQuery* iUntrustedCertQuery; + + RFs iFs; + CUnifiedCertStore* iCertStore; + MCTWritableCertStore* iTrustedSiteCertStore; + CCertAttributeFilter* iCertAttributeFilter; + RMPointerArray iCertInfos; + TInt iRetrieveCertIndex; + HBufC8* iRetrievedCertBuffer; + + enum { + EInitialiseCertStore, + EListTrustedSiteCerts, + ERetrieveTrustedSiteCert, + ESavingServerCert + } iMode; + }; + +#endif // SECURITYDIALOGOPERSERVERAUTHFAIL_H + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifiersrv/inc/securitydialogstrace.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifiersrv/inc/securitydialogstrace.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 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" +* 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: TRACE macros for security dialogs +* +*/ + +#ifndef SECURITYDIALOGSTRACE_H +#define SECURITYDIALOGSTRACE_H + +#include // RDebug + + +// TODO: replace with OST tracing +#ifdef _DEBUG +#define TRACE( a, ARGS... ) DebugPrint( _L( a ), ##ARGS ) +#else +#define TRACE( a, ARGS... ) +#endif + + +// --------------------------------------------------------------------------- +// DebugPrint() +// --------------------------------------------------------------------------- +// +#ifdef _DEBUG +const TInt KMaxPrintSize = 256; +inline void DebugPrint( TRefByValue aFmt, ... ) + { + VA_LIST list; + VA_START( list, aFmt ); + TBuf buf; + buf.AppendFormatList( aFmt, list ); + RDebug::Print( buf ); + } +#endif + + +#endif // SECURITYDIALOGSTRACE_H + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifiersrv/inc/untrustedcertquery.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifiersrv/inc/untrustedcertquery.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 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" +* 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: Displays untrusted certificate dialog +* +*/ + +#ifndef C_UNTRUSTEDCERTQUERY_H +#define C_UNTRUSTEDCERTQUERY_H + +#include // CActive +#include // MHbDeviceDialogObserver +#include // TValidationError + +class CHbDeviceDialogSymbian; +class CHbSymbianVariantMap; + + +/** +* Displays untrusted certificate query. +* Untrusted certificate query dialog is displayed for secure connection +* (SSL/TLS) server authentication failure errors. CCTUntrustedCertQuery +* class uses UntrustedCertificateDialog device dialog to show the query. +*/ +NONSHARABLE_CLASS( CUntrustedCertQuery ) : public CActive, public MHbDeviceDialogObserver + { + public: // constructors and destructor + static CUntrustedCertQuery* NewL( TValidationError aValidationError, + const TDesC8& aCertificate, const TDesC& aServerName, + TBool aCanHandlePermanentAccept ); + ~CUntrustedCertQuery(); + + public: // new functions + enum TResponse { + EQueryRejected, + EQueryAccepted, + EQueryAcceptedPermanently + }; + void ShowQueryAndWaitForResponseL( TResponse& aResponse ); + + protected: // from CActive + void DoCancel(); + void RunL(); + + private: // from MHbDeviceDialogObserver + void DataReceived( CHbSymbianVariantMap& aData ); + void DeviceDialogClosed( TInt aCompletionCode ); + + private: // new functions + CUntrustedCertQuery( TValidationError aValidationError, + const TDesC8& aCertificate, const TDesC& aServerName, + TBool aCanHandlePermanentAccept ); + void ConstructL(); + + private: // data + TValidationError iValidationError; + const TDesC8& iCertificate; + const TDesC& iServerName; + TBool iCanHandlePermanentAccept; + CActiveSchedulerWait *iWait; + TInt iWaitCompletionCode; + CHbDeviceDialogSymbian* iDeviceDialog; + CHbSymbianVariantMap* iVariantMap; + TResponse iResponse; + }; + +#endif // C_UNTRUSTEDCERTQUERY_H + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifiersrv/rom/securitydialognotifiersrv.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifiersrv/rom/securitydialognotifiersrv.iby Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 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" +* 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: Security dialog notifier server +* +*/ + +#ifndef SECURITYDIALOGNOTIFIERSRV_IBY +#define SECURITYDIALOGNOTIFIERSRV_IBY +#include + +file=ABI_DIR\BUILD_DIR\securitydialognotifiersrv.exe sys\bin\securitydialognotifiersrv.exe + +#endif // SECURITYDIALOGNOTIFIERSRV_IBY + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifiersrv/src/securitydialognotifierserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifiersrv/src/securitydialognotifierserver.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 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" +* 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: Security dialog notifier server +* +*/ + +#include "securitydialognotifierserver.h" // CSecurityDialogNotifierServer +#include "securitydialognotifiersession.h" // CSecurityDialogNotifierSession +#include "securitydialognotifierservername.h" // KSecurityDialogNotifierServerName +#include "securitydialogstrace.h" // TRACE macro + + +const TUint KRangeCount = 1; + +const TInt KRanges[ KRangeCount ] = + { + 0 + }; + +const TUint8 KElementsIndex[ KRangeCount ] = + { + 0 + }; + +const TInt KUikonServerId = 0x10003a4a; +const CPolicyServer::TPolicyElement KPolicyElements[] = + { + { _INIT_SECURITY_POLICY_S0( KUikonServerId ), CPolicyServer::EFailClient } + }; + +const CPolicyServer::TPolicy KSecurityDialogNotifierServerPolicy = + { + CPolicyServer::EAlwaysPass, + KRangeCount, + KRanges, + KElementsIndex, + KPolicyElements + }; + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifierServer::NewLC() +// --------------------------------------------------------------------------- +// +CSecurityDialogNotifierServer* CSecurityDialogNotifierServer::NewLC() + { + CSecurityDialogNotifierServer* self = new( ELeave ) CSecurityDialogNotifierServer; + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifierServer::~CSecurityDialogNotifierServer() +// --------------------------------------------------------------------------- +// +CSecurityDialogNotifierServer::~CSecurityDialogNotifierServer() + { + TRACE( "CSecurityDialogNotifierServer::~CSecurityDialogNotifierServer" ); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifierServer::AddSession() +// --------------------------------------------------------------------------- +// +void CSecurityDialogNotifierServer::AddSession() + { + TRACE( "CSecurityDialogNotifierServer::AddSession" ); + ++iSessionCount; + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifierServer::RemoveSession() +// --------------------------------------------------------------------------- +// +void CSecurityDialogNotifierServer::RemoveSession() + { + TRACE( "CSecurityDialogNotifierServer::RemoveSession" ); + --iSessionCount; + if( iSessionCount == 0 ) + { + TRACE( "CSecurityDialogNotifierServer::RemoveSession, shutting down" ); + CActiveScheduler::Stop(); + } + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifierServer::NewSessionL() +// --------------------------------------------------------------------------- +// +CSession2* CSecurityDialogNotifierServer::NewSessionL( const TVersion &aVersion, + const RMessage2& /*aMessage*/ ) const + { + TRACE( "CSecurityDialogNotifierServer::NewSessionL" ); + TVersion version( KSecurityDialogNotifierServerMajorVersionNumber, + KSecurityDialogNotifierServerMinorVersionNumber, + KSecurityDialogNotifierServerBuildVersionNumber ); + if( !User::QueryVersionSupported( version, aVersion ) ) + { + TRACE( "CSecurityDialogNotifierServer::NewSessionL, version not supported" ); + User::Leave( KErrNotSupported ); + } + + return CSecurityDialogNotifierSession::NewL(); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifierServer::CSecurityDialogNotifierServer() +// --------------------------------------------------------------------------- +// +CSecurityDialogNotifierServer::CSecurityDialogNotifierServer() : + CPolicyServer( CActive::EPriorityStandard, KSecurityDialogNotifierServerPolicy ) + { + TRACE( "CSecurityDialogNotifierServer::CSecurityDialogNotifierServer" ); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifierServer::ConstructL() +// --------------------------------------------------------------------------- +// +void CSecurityDialogNotifierServer::ConstructL() + { + StartL( KSecurityDialogNotifierServerName ); + } + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifiersrv/src/securitydialognotifierservermain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifiersrv/src/securitydialognotifierservermain.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 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" +* 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: Security dialog notifier server +* +*/ + +#include "securitydialognotifierserver.h" // CSecurityDialogNotifierServer +#include "securitydialognotifierservername.h" // KSecurityDialogNotifierServerName +#include "securitydialogstrace.h" // TRACE macro + + +// --------------------------------------------------------------------------- +// MainL() +// --------------------------------------------------------------------------- +// +LOCAL_C void MainL() + { + TRACE( "SecurityDialogNotifierServer: MainL" ); + CActiveScheduler* scheduler = new( ELeave ) CActiveScheduler; + CleanupStack::PushL( scheduler ); + CActiveScheduler::Install( scheduler ); + + CSecurityDialogNotifierServer* server = CSecurityDialogNotifierServer::NewLC(); + User::LeaveIfError( User::RenameThread( KSecurityDialogNotifierServerName ) ); + TRACE( "SecurityDialogNotifierServer: MainL, rendezvous" ); + + RProcess::Rendezvous( KErrNone ); + TRACE( "SecurityDialogNotifierServer: MainL, activescheduler start" ); + CActiveScheduler::Start(); + + TRACE( "SecurityDialogNotifierServer: MainL, cleanup" ); + CleanupStack::PopAndDestroy( server ); + CleanupStack::PopAndDestroy( scheduler ); + } + +// --------------------------------------------------------------------------- +// E32Main() +// --------------------------------------------------------------------------- +// +GLDEF_C TInt E32Main() + { + CTrapCleanup* cleanup = CTrapCleanup::New(); + + TRAPD( err, MainL() ); + __ASSERT_ALWAYS( !err, User::Panic( KSecurityDialogNotifierServerName, err ) ); + + delete cleanup; + return err; + } + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifiersrv/src/securitydialognotifiersession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifiersrv/src/securitydialognotifiersession.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,220 @@ +/* +* Copyright (c) 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" +* 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: Security dialog notifier server session +* +*/ + +#include "securitydialognotifiersession.h" // CSecurityDialogNotifierSession +#include "securitydialognotifierserver.h" // CSecurityDialogNotifierServer +#include "securitydialognotifierservername.h" // KSecurityDialogsCancelOperation +#include "securitydialogoperserverauthfail.h" // CServerAuthFailOperation +#include "securitydialogstrace.h" // TRACE macro +#include // TSecurityDialogOperation + +const TInt KInputParam = 0; +const TInt KOutputParam = 1; + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifierSession::NewL() +// --------------------------------------------------------------------------- +// +CSecurityDialogNotifierSession* CSecurityDialogNotifierSession::NewL() + { + CSecurityDialogNotifierSession* self = new( ELeave ) CSecurityDialogNotifierSession; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifierSession::~CSecurityDialogNotifierSession() +// --------------------------------------------------------------------------- +// +CSecurityDialogNotifierSession::~CSecurityDialogNotifierSession() + { + TRACE( "CSecurityDialogNotifierSession::~CSecurityDialogNotifierSession, begin" ); + Server().RemoveSession(); + delete iOperationHandler; + iOperationHandler = NULL; + delete iInputBuffer; + iInputBuffer = NULL; + TRACE( "CSecurityDialogNotifierSession::~CSecurityDialogNotifierSession, end" ); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifierSession::CreateL() +// --------------------------------------------------------------------------- +// +void CSecurityDialogNotifierSession::CreateL() + { + TRACE( "CSecurityDialogNotifierSession::~CSecurityDialogNotifierSession" ); + Server().AddSession(); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifierSession::ServiceL() +// --------------------------------------------------------------------------- +// +void CSecurityDialogNotifierSession::ServiceL( const RMessage2& aMessage ) + { + TRACE( "CSecurityDialogNotifierSession::ServiceL, message 0x%08x", aMessage.Handle() ); + TRAPD( error, DispatchMessageL( aMessage ) ); + TRACE( "CSecurityDialogNotifierSession::ServiceL, dispatched, error %d", error ); + if( error && !aMessage.IsNull() ) + { + TRACE( "CSecurityDialogNotifierSession::ServiceL, completing msg 0x%08x", + aMessage.Handle() ); + aMessage.Complete( error ); + } + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifierSession::OperationComplete() +// --------------------------------------------------------------------------- +// +void CSecurityDialogNotifierSession::OperationComplete() + { + TRACE( "CSecurityDialogNotifierSession::OperationComplete, begin" ); + delete iOperationHandler; + iOperationHandler = NULL; + TRACE( "CSecurityDialogNotifierSession::OperationComplete, end" ); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifierSession::CSecurityDialogNotifierSession() +// --------------------------------------------------------------------------- +// +CSecurityDialogNotifierSession::CSecurityDialogNotifierSession() + { + TRACE( "CSecurityDialogNotifierSession::CSecurityDialogNotifierSession" ); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifierSession::ConstructL() +// --------------------------------------------------------------------------- +// +void CSecurityDialogNotifierSession::ConstructL() + { + TRACE( "CSecurityDialogNotifierSession::ConstructL" ); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifierSession::Server() +// --------------------------------------------------------------------------- +// +CSecurityDialogNotifierServer& CSecurityDialogNotifierSession::Server() + { + return *static_cast< CSecurityDialogNotifierServer* >( + const_cast< CServer2* >( CSession2::Server() ) ); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifierSession::DispatchMessageL() +// --------------------------------------------------------------------------- +// +void CSecurityDialogNotifierSession::DispatchMessageL( const RMessage2& aMessage ) + { + TRACE( "CSecurityDialogNotifierSession::DispatchMessageL, begin" ); + if( !IsOperationCancelled( aMessage ) ) + { + TSecurityDialogOperation operation = + static_cast< TSecurityDialogOperation >( aMessage.Function() ); + TRACE( "CSecurityDialogNotifierSession::DispatchMessageL, operation=%d", operation ); + switch( operation ) + { + case ESecureConnection: + case ESignText: + case EEnterPIN: + case EEnablePIN: + case EDisablePIN: + case EChangePIN: + case EUnblockPIN: + case EPINBlocked: + case ETotalBlocked: + case EUnblockPINInClear: + User::Leave( KErrNotSupported ); + break; + case EServerAuthenticationFailure: + ServerAuthenticationFailureL( aMessage ); + break; + default: + User::Leave( KErrNotSupported ); + break; + } + } + TRACE( "CSecurityDialogNotifierSession::DispatchMessageL, end" ); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifierSession::IsOperationCancelled() +// --------------------------------------------------------------------------- +// +TBool CSecurityDialogNotifierSession::IsOperationCancelled( const RMessage2& aMessage ) + { + TBool isCancelled = EFalse; + if( aMessage.Function() == KSecurityDialogCancelOperation ) + { + if( iOperationHandler ) + { + TRACE( "CSecurityDialogNotifierSession::CheckIfOperationCancelledL, cancelling" ); + iOperationHandler->CancelOperation(); + } + TRACE( "CSecurityDialogNotifierSession::CheckIfOperationCancelledL, completing msg 0x%08x", + aMessage.Handle() ); + aMessage.Complete( KErrNone ); + isCancelled = ETrue; + } + return isCancelled; + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifierSession::ServerAuthenticationFailureL() +// --------------------------------------------------------------------------- +// +void CSecurityDialogNotifierSession::ServerAuthenticationFailureL( const RMessage2& aMessage ) + { + TRACE( "CSecurityDialogNotifierSession::ServerAuthenticationFailureL, begin" ); + GetInputBufferL( aMessage ); + + __ASSERT_DEBUG( iOperationHandler == NULL, User::Invariant() ); + iOperationHandler = CServerAuthFailOperation::NewL( *this, aMessage, KOutputParam ); + iOperationHandler->StartL( *iInputBuffer ); + + TRACE( "CSecurityDialogNotifierSession::ServerAuthenticationFailureL, end" ); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogNotifierSession::GetInputBufferL() +// --------------------------------------------------------------------------- +// +void CSecurityDialogNotifierSession::GetInputBufferL( const RMessage2& aMessage ) + { + TInt inputLength = aMessage.GetDesLength( KInputParam ); + TRACE( "CSecurityDialogNotifierSession::GetInputBufferL, inputLength=%d", inputLength ); + __ASSERT_ALWAYS( inputLength > 0, User::Leave( KErrCorrupt ) ); + if( iInputBuffer ) + { + delete iInputBuffer; + iInputBuffer = NULL; + } + iInputBuffer = HBufC8::NewL( inputLength ); + TPtr8 inputBufferPtr( iInputBuffer->Des() ); + aMessage.ReadL( KInputParam, inputBufferPtr ); + TRACE( "CSecurityDialogNotifierSession::GetInputBufferL, read complete" ); + } + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifiersrv/src/securitydialogoperation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifiersrv/src/securitydialogoperation.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 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" +* 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: Base class for CSecurityDialog operations +* +*/ + +#include "securitydialogoperation.h" // CSecurityDialogOperation +#include "securitydialogoperationobserver.h" // MSecurityDialogOperationObserver +#include "securitydialogstrace.h" // TRACE macro + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CSecurityDialogOperation::CSecurityDialogOperation() +// --------------------------------------------------------------------------- +// +CSecurityDialogOperation::CSecurityDialogOperation( + MSecurityDialogOperationObserver& aObserver, const RMessage2& aMessage, + TInt aReplySlot ) : CActive( CActive::EPriorityStandard ), iObserver( aObserver ), + iMessage( aMessage ), iReplySlot( aReplySlot ) + { + TRACE( "CSecurityDialogOperation::CSecurityDialogOperation, iMessage 0x%08x", + iMessage.Handle() ); + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogOperation::~CSecurityDialogOperation() +// --------------------------------------------------------------------------- +// +CSecurityDialogOperation::~CSecurityDialogOperation() + { + TRACE( "CSecurityDialogOperation::~CSecurityDialogOperation, begin" ); + Cancel(); + TRACE( "CSecurityDialogOperation::~CSecurityDialogOperation, end" ); + } + +// --------------------------------------------------------------------------- +// CSecurityDialogOperation::RunError() +// --------------------------------------------------------------------------- +// +TInt CSecurityDialogOperation::RunError( TInt aError ) + { + TRACE( "CSecurityDialogOperation::RunError, aError=%d", aError ); + if( !iMessage.IsNull() ) + { + TRACE( "CSecurityDialogOperation::RunError, completing message 0x%08x", + iMessage.Handle() ); + iMessage.Complete( aError ); + } + return KErrNone; + } + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifiersrv/src/securitydialogoperserverauthfail.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifiersrv/src/securitydialogoperserverauthfail.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,498 @@ +/* +* Copyright (c) 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" +* 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: Server authentication failure operation in security dialog +* +*/ + +#include "securitydialogoperserverauthfail.h" // CServerAuthFailOperation +#include "securitydialogoperationobserver.h" // MSecurityDialogOperationObserver +#include "untrustedcertquery.h" // CUntrustedCertQuery +#include "../../DeviceToken/Inc/TrustedSitesStore.h" // CTrustSitesStore +#include // MCTWritableCertStore +#include // CUnifiedCertStore +#include // CCTCertInfo +#include // CX509Certificate +#include "securitydialogstrace.h" // TRACE macro + +const TUid KTrustedSiteCertificatesTokenTypeUid = { 0x101FB66F }; +const TInt KMaxCommonNameLength = 64; // from RFC3280 + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CServerAuthFailOperation::NewL() +// --------------------------------------------------------------------------- +// +CServerAuthFailOperation* CServerAuthFailOperation::NewL( + MSecurityDialogOperationObserver& aObserver, const RMessage2& aMessage, + TInt aReplySlot ) + { + TRACE( "CServerAuthFailOperation::NewL, aMessage 0x%08x", aMessage.Handle() ); + return new( ELeave ) CServerAuthFailOperation( aObserver, aMessage, aReplySlot ); + } + +// --------------------------------------------------------------------------- +// CServerAuthFailOperation::~CServerAuthFailOperation() +// --------------------------------------------------------------------------- +// +CServerAuthFailOperation::~CServerAuthFailOperation() + { + TRACE( "CServerAuthFailOperation::~CServerAuthFailOperation, begin" ); + Cancel(); + + delete iUntrustedCertQuery; + iUntrustedCertQuery = NULL; + + delete iInput; + iInput = NULL; + delete iCertLabel; + iCertLabel = NULL; + delete iServerName; + iServerName = NULL; + + delete iCertStore; + iCertStore = NULL; + iTrustedSiteCertStore = NULL; // not owned + + delete iCertAttributeFilter; + iCertAttributeFilter = NULL; + delete iRetrievedCertBuffer; + iRetrievedCertBuffer = NULL; + + iCertInfos.Close(); + iFs.Close(); + TRACE( "CServerAuthFailOperation::~CServerAuthFailOperation, end" ); + } + +// --------------------------------------------------------------------------- +// CServerAuthFailOperation::StartL() +// --------------------------------------------------------------------------- +// +void CServerAuthFailOperation::StartL( const TDesC8& aBuffer ) + { + TRACE( "CServerAuthFailOperation::StartL, begin" ); + __ASSERT_DEBUG( iInput == NULL, User::Invariant() ); + iInput = CServerAuthenticationFailureInput::NewL( aBuffer ); + + iInput->GetEncodedCert( iEncodedServerCert ); + + TPtrC8 serverName; + iInput->GetServerName( serverName ); + __ASSERT_DEBUG( iServerName == NULL, User::Invariant() ); + iServerName = HBufC::NewL( serverName.Length() ); + iServerName->Des().Copy( serverName ); + TRACE( "CServerAuthFailOperation::StartL, iServerName=%S", iServerName ); + + iAuthFailReason = iInput->FailureReason(); + TRACE( "CServerAuthFailOperation::StartL, iAuthFailReason=%d", iAuthFailReason ); + + InitializeUnifiedCertStoreL(); + // This is async function, processing continues in RunL(). + // Basically trusted site certificates are fetched and the + // server certificate is compared to them. If the server + // certificate is already in trusted site cert store, then + // connection is accepted silently. If it is not, then + // untrusted certificate dialog is displayed. + } + +// --------------------------------------------------------------------------- +// CServerAuthFailOperation::CancelOperation() +// --------------------------------------------------------------------------- +// +void CServerAuthFailOperation::CancelOperation() + { + TRACE( "CServerAuthFailOperation::CancelOperation, begin" ); + Cancel(); + if( iUntrustedCertQuery ) + { + TRACE( "CServerAuthFailOperation::CancelOperation, cancelling untrusted query" ); + iUntrustedCertQuery->Cancel(); + } + if( !iMessage.IsNull() ) + { + TRACE( "CServerAuthFailOperation::CancelOperation, completing message 0x%08x", + iMessage.Handle() ); + iMessage.Complete( KErrCancel ); + } + TRACE( "CServerAuthFailOperation::CancelOperation, end" ); + } + +// --------------------------------------------------------------------------- +// CServerAuthFailOperation::RunL() +// --------------------------------------------------------------------------- +// +void CServerAuthFailOperation::RunL() + { + TRACE( "CServerAuthFailOperation::RunL, iStatus.Int()=%d, iMode=%d", + iStatus.Int(), iMode ); + User::LeaveIfError( iStatus.Int() ); + switch( iMode ) + { + case EInitialiseCertStore: + ProcessServerAuthorizationFailureL(); + break; + case EListTrustedSiteCerts: + RetrieveFirstTrustedSiteCertL(); + break; + case ERetrieveTrustedSiteCert: + if( IsRetrievedCertSameAsServerCertL() ) + { + ReturnResultL( EContinue ); + } + else + { + RetrieveNextTrustedSiteCertL(); + } + break; + case ESavingServerCert: + SaveServerNameToTrustedSitesStoreL(); + ReturnResultL( EContinue ); + break; + default: + User::Leave( KErrGeneral ); + break; + } + TRACE( "CServerAuthFailOperation::RunL(), end" ); + } + +// --------------------------------------------------------------------------- +// CServerAuthFailOperation::DoCancel() +// --------------------------------------------------------------------------- +// +void CServerAuthFailOperation::DoCancel() + { + TRACE( "CServerAuthFailOperation::DoCancel, iMode=%d", iMode ); + switch( iMode ) + { + case EInitialiseCertStore: + if( iCertStore ) + { + iCertStore->CancelInitialize(); + } + break; + case EListTrustedSiteCerts: + if( iTrustedSiteCertStore ) + { + iTrustedSiteCertStore->CancelList(); + } + break; + case ERetrieveTrustedSiteCert: + if( iTrustedSiteCertStore ) + { + iTrustedSiteCertStore->CancelRetrieve(); + } + break; + case ESavingServerCert: + if( iTrustedSiteCertStore ) + { + iTrustedSiteCertStore->CancelAdd(); + } + break; + default: + break; + } + TRACE( "CServerAuthFailOperation::DoCancel, end" ); + } + +// --------------------------------------------------------------------------- +// CServerAuthFailOperation::CServerAuthFailOperation() +// --------------------------------------------------------------------------- +// +CServerAuthFailOperation::CServerAuthFailOperation( + MSecurityDialogOperationObserver& aObserver, const RMessage2& aMessage, + TInt aReplySlot ) : CSecurityDialogOperation( aObserver, aMessage, aReplySlot ) + { + TRACE( "CServerAuthFailOperation::CServerAuthFailOperation" ); + } + +// --------------------------------------------------------------------------- +// CServerAuthFailOperation::InitializeUnifiedCertStoreL() +// --------------------------------------------------------------------------- +// +void CServerAuthFailOperation::InitializeUnifiedCertStoreL() + { + TRACE( "CServerAuthFailOperation::InitializeUnifiedCertStoreL" ); + User::LeaveIfError( iFs.Connect() ); + iCertStore = CUnifiedCertStore::NewL( iFs, ETrue ); + + iCertStore->Initialize( iStatus ); + iMode = EInitialiseCertStore; + SetActive(); + } + +// --------------------------------------------------------------------------- +// CServerAuthFailOperation::ProcessServerAuthorizationFailureL() +// --------------------------------------------------------------------------- +// +void CServerAuthFailOperation::ProcessServerAuthorizationFailureL() + { + TRACE( "CServerAuthFailOperation::ProcessServerAuthorizationFailureL" ); + OpenTrustedSiteCertificateStoreL(); + if( IsAlreadyTrustedSiteL() ) + { + StartFetchingTrustedSiteCertsL(); + } + else + { + ShowUntrustedCertificateDialogL(); + } + } + +// --------------------------------------------------------------------------- +// CServerAuthFailOperation::OpenTrustedSiteCertificateStoreL() +// --------------------------------------------------------------------------- +// +void CServerAuthFailOperation::OpenTrustedSiteCertificateStoreL() + { + TRACE( "CServerAuthFailOperation::OpenTrustedSiteCertificateStoreL, begin" ); + TInt count = iCertStore->WritableCertStoreCount(); + for( TInt index = 0; ( index < count ) && !iTrustedSiteCertStore; index++ ) + { + MCTWritableCertStore* certstore = &( iCertStore->WritableCertStore( index ) ); + TUid tokenTypeUid = certstore->Token().Handle().iTokenTypeUid; + if( tokenTypeUid == KTrustedSiteCertificatesTokenTypeUid ) + { + iTrustedSiteCertStore = certstore; + } + } + TRACE( "CServerAuthFailOperation::OpenTrustedSiteCertificateStoreL, store 0x%08x", + iTrustedSiteCertStore ); + } + +// --------------------------------------------------------------------------- +// CServerAuthFailOperation::IsAlreadyTrustedSiteL() +// --------------------------------------------------------------------------- +// +TBool CServerAuthFailOperation::IsAlreadyTrustedSiteL() + { + TRACE( "CServerAuthFailOperation::IsAlreadyTrustedSiteL, begin" ); + TBool isTrustedSite = EFalse; + if( iTrustedSiteCertStore ) + { + CTrustSitesStore* trustedSitesStore = CTrustSitesStore::NewL(); + CleanupStack::PushL( trustedSitesStore ); + + isTrustedSite = trustedSitesStore->IsTrustedSiteL( iEncodedServerCert, *iServerName ); + if( isTrustedSite ) + { + TBool isExpiredAccepted = trustedSitesStore->IsOutOfDateAllowedL( + iEncodedServerCert, *iServerName ); + TRACE( "CServerAuthFailOperation::IsAlreadyTrustedSiteL, isExpiredAccepted=%d", + isExpiredAccepted ); + if( !isExpiredAccepted && iAuthFailReason == EDateOutOfRange ) + { + TRACE( "CServerAuthFailOperation::IsAlreadyTrustedSiteL, not accepted" ); + isTrustedSite = EFalse; + } + } + + CleanupStack::PopAndDestroy( trustedSitesStore ); + } + TRACE( "CServerAuthFailOperation::IsAlreadyTrustedSiteL, isTrustedSite=%d", isTrustedSite ); + return isTrustedSite; + } + +// --------------------------------------------------------------------------- +// CServerAuthFailOperation::StartFetchingTrustedSiteCertsL() +// --------------------------------------------------------------------------- +// +void CServerAuthFailOperation::StartFetchingTrustedSiteCertsL() + { + TRACE( "CServerAuthFailOperation::StartFetchingTrustedSiteCertsL" ); + __ASSERT_DEBUG( iCertAttributeFilter == NULL, User::Invariant() ); + iCertAttributeFilter = CCertAttributeFilter::NewL(); + iCertAttributeFilter->SetOwnerType( EPeerCertificate ); + __ASSERT_DEBUG( iTrustedSiteCertStore != NULL, User::Invariant() ); + iTrustedSiteCertStore->List( iCertInfos, *iCertAttributeFilter, iStatus ); + iMode = EListTrustedSiteCerts; + SetActive(); + } + +// --------------------------------------------------------------------------- +// CServerAuthFailOperation::ShowUntrustedCertificateDialogL() +// --------------------------------------------------------------------------- +// +void CServerAuthFailOperation::ShowUntrustedCertificateDialogL() + { + TRACE( "CServerAuthFailOperation::ShowUntrustedCertificateDialogL, begin" ); + + // If trusted site certstore open has failed, then it is not possible to save + // the host name for permanent use. Hence, choice for permanent accept is not + // displayed if trusted site certstore open has failed. Other restrictions for + // permanent accept are defined in device dialog (UntrustedCertificateWidget). + TBool isTrustedSiteCertStoreOpened = ( iTrustedSiteCertStore != NULL ); + __ASSERT_DEBUG( iUntrustedCertQuery == NULL, User::Invariant() ); + iUntrustedCertQuery = CUntrustedCertQuery::NewL( iAuthFailReason, iEncodedServerCert, + *iServerName, isTrustedSiteCertStoreOpened ); + + CUntrustedCertQuery::TResponse response = CUntrustedCertQuery::EQueryRejected; + iUntrustedCertQuery->ShowQueryAndWaitForResponseL( response ); + switch( response ) + { + case CUntrustedCertQuery::EQueryAccepted: + ReturnResultL( EContinue ); + break; + case CUntrustedCertQuery::EQueryAcceptedPermanently: + SaveServerCertToTrustedSiteCertStoreL(); + break; + case CUntrustedCertQuery::EQueryRejected: + default: + ReturnResultL( EStop ); + break; + } + + TRACE( "CServerAuthFailOperation::ShowUntrustedCertificateDialogL, end" ); + } + +// --------------------------------------------------------------------------- +// CServerAuthFailOperation::SaveServerCertToTrustedSiteCertStoreL() +// --------------------------------------------------------------------------- +// +void CServerAuthFailOperation::SaveServerCertToTrustedSiteCertStoreL() + { + TRACE( "CServerAuthFailOperation::SaveServerCertToTrustedSiteCertStoreL" ); + + __ASSERT_DEBUG( iCertLabel == NULL, User::Invariant() ); + CX509Certificate* serverCert = CX509Certificate::NewLC( iEncodedServerCert ); + const CX500DistinguishedName& dName = serverCert->SubjectName(); + HBufC* commonName = dName.ExtractFieldL( KX520CommonName ); + if( commonName ) + { + CleanupStack::PushL( commonName ); + TInt commonNameLen = commonName->Length(); + if( commonNameLen > 0 && commonNameLen <= KMaxCommonNameLength ) + { + iCertLabel = commonName->AllocL(); + } + CleanupStack::PopAndDestroy( commonName ); + } + CleanupStack::PopAndDestroy( serverCert ); + + if( !iCertLabel ) + { + iCertLabel = iServerName->AllocL(); + } + + iTrustedSiteCertStore->Add( *iCertLabel, EX509Certificate, EPeerCertificate, + NULL, NULL, iEncodedServerCert, iStatus ); + iMode = ESavingServerCert; + SetActive(); + } + +// --------------------------------------------------------------------------- +// CServerAuthFailOperation::SaveServerNameToTrustedSitesStoreL() +// --------------------------------------------------------------------------- +// +void CServerAuthFailOperation::SaveServerNameToTrustedSitesStoreL() + { + TRACE( "CServerAuthFailOperation::SaveServerNameToTrustedSitesStoreL, begin" ); + CTrustSitesStore* trustedSitesStore = CTrustSitesStore::NewL(); + CleanupStack::PushL( trustedSitesStore ); + + // CTrustSitesStore::AddL() may leave or it may return an error code. + // It leaves if parameters are incorrect, and it returns error code if + // saving fails. Both kinds of errors are handled here in the same way. + TInt err = trustedSitesStore->AddL( iEncodedServerCert, *iServerName ); + TRACE( "CServerAuthFailOperation::SaveServerNameToTrustedSitesStoreL, err=%d", err ); + User::LeaveIfError( err ); + + CleanupStack::PopAndDestroy( trustedSitesStore ); + } + +// --------------------------------------------------------------------------- +// CServerAuthFailOperation::ReturnResultL() +// --------------------------------------------------------------------------- +// +void CServerAuthFailOperation::ReturnResultL( TServerAuthenticationFailureDialogResult aResult ) + { + TRACE( "CServerAuthFailOperation::ReturnResultL, aResult=%d", aResult ); + TServerAuthenticationFailureOutputBuf output( aResult ); + iMessage.WriteL( iReplySlot, output ); + TRACE( "CServerAuthFailOperation::ReturnResultL, completing msg 0x%08x", iMessage.Handle() ); + iMessage.Complete( KErrNone ); + TRACE( "CServerAuthFailOperation::ReturnResultL, informing observer" ); + iObserver.OperationComplete(); + TRACE( "CServerAuthFailOperation::ReturnResultL, end" ); + } + +// --------------------------------------------------------------------------- +// CServerAuthFailOperation::RetrieveFirstTrustedSiteCertL() +// --------------------------------------------------------------------------- +// +void CServerAuthFailOperation::RetrieveFirstTrustedSiteCertL() + { + TRACE( "CServerAuthFailOperation::RetrieveFirstTrustedSiteCertL" ); + __ASSERT_DEBUG( iRetrievedCertBuffer == NULL, User::Invariant() ); + iRetrieveCertIndex = 0; + + RetrieveNextTrustedSiteCertL(); + } + +// --------------------------------------------------------------------------- +// CServerAuthFailOperation::RetrieveNextTrustedSiteCertL() +// --------------------------------------------------------------------------- +// +void CServerAuthFailOperation::RetrieveNextTrustedSiteCertL() + { + TRACE( "CServerAuthFailOperation::RetrieveNextTrustedSiteCertL" ); + if( iRetrieveCertIndex < iCertInfos.Count() ) + { + CCTCertInfo& cert = *( iCertInfos[ iRetrieveCertIndex ] ); + + if( iRetrievedCertBuffer ) + { + delete iRetrievedCertBuffer; + iRetrievedCertBuffer = NULL; + } + iRetrievedCertBuffer = HBufC8::NewL( cert.Size() ); + TPtr8 buffer = iRetrievedCertBuffer->Des(); + + iTrustedSiteCertStore->Retrieve( cert, buffer, iStatus ); + iMode = ERetrieveTrustedSiteCert; + SetActive(); + } + else + { + ShowUntrustedCertificateDialogL(); + } + } + +// --------------------------------------------------------------------------- +// CServerAuthFailOperation::IsRetrievedCertSameAsServerCertL() +// --------------------------------------------------------------------------- +// +TBool CServerAuthFailOperation::IsRetrievedCertSameAsServerCertL() + { + TRACE( "CServerAuthFailOperation::IsRetrievedCertSameAsServerCertL, begin" ); + TBool isSame = EFalse; + CX509Certificate* cert = CX509Certificate::NewLC( *iRetrievedCertBuffer ); + + if( !iServerCertFingerprint ) + { + CX509Certificate* serverCert = CX509Certificate::NewLC( iEncodedServerCert ); + iServerCertFingerprint = serverCert->Fingerprint().AllocL(); + CleanupStack::PopAndDestroy( serverCert ); + } + + if( cert->Fingerprint() == *iServerCertFingerprint ) + { + isSame = ETrue; + } + + CleanupStack::PopAndDestroy( cert ); + TRACE( "CServerAuthFailOperation::IsRetrievedCertSameAsServerCertL, isSame=%d", isSame ); + return isSame; + } + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/securitydialognotifiersrv/src/untrustedcertquery.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/securitydialognotifiersrv/src/untrustedcertquery.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,250 @@ +/* +* Copyright (c) 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" +* 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: Displays untrusted certificate dialog +* +*/ + +#include "untrustedcertquery.h" // CUntrustedCertQuery +#include // CHbSymbianVariantMap +#include "securitydialogstrace.h" // TRACE macro + +// Note that the dialog type string, the parameters name strings, and the return code +// name string and values must match to those defined in Qt-side untrusted certificate +// dialog (in untrustedcertificatedefinitions.h file). + +// Device dialog type for untrusted certificate dialog +_LIT( KUntrustedCertificateDialog, "com.nokia.untrustedcert/1.0" ); + +// Variant map parameter names for untrusted certificate dialog +_LIT( KUntrustedCertEncodedCertificate, "cert" ); // bytearray, mandatory +_LIT( KUntrustedCertServerName, "host" ); // string, mandatory +_LIT( KUntrustedCertValidationError, "err" ); // int (TValidationError), mandatory +_LIT( KUntrustedCertTrustedSiteStoreFail, "tss" ); // any, prevents permanent acceptance + +// Dialog return code name and values +_LIT( KUntrustedCertDialogResult, "result" ); // int +const TInt KUntrustedCertDialogRejected = 0; +const TInt KUntrustedCertDialogAccepted = 1; +const TInt KUntrustedCertDialogAcceptedPermanently = 2; + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CUntrustedCertQuery::NewL() +// --------------------------------------------------------------------------- +// +CUntrustedCertQuery* CUntrustedCertQuery::NewL( + TValidationError aValidationError, const TDesC8& aCertificate, + const TDesC& aServerName, TBool aCanHandlePermanentAccept ) + { + TRACE( "CUntrustedCertQuery::NewL" ); + CUntrustedCertQuery* self = new ( ELeave ) CUntrustedCertQuery( + aValidationError, aCertificate, aServerName, + aCanHandlePermanentAccept ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CUntrustedCertQuery::~CUntrustedCertQuery() +// --------------------------------------------------------------------------- +// +CUntrustedCertQuery::~CUntrustedCertQuery() + { + TRACE( "CUntrustedCertQuery::~CUntrustedCertQuery, begin" ); + Cancel(); + delete iWait; + iWait = NULL; + delete iDeviceDialog; + iDeviceDialog = NULL; + delete iVariantMap; + iVariantMap = NULL; + TRACE( "CUntrustedCertQuery::~CUntrustedCertQuery, end" ); + } + +// --------------------------------------------------------------------------- +// CUntrustedCertQuery::ShowQueryAndWaitForResponseL() +// --------------------------------------------------------------------------- +// +void CUntrustedCertQuery::ShowQueryAndWaitForResponseL( TResponse& aResponse ) + { + TRACE( "CUntrustedCertQuery::ShowQueryAndWaitForResponseL, begin" ); + if( !iDeviceDialog ) + { + iDeviceDialog = CHbDeviceDialogSymbian::NewL(); + } + if( !iVariantMap ) + { + iVariantMap = CHbSymbianVariantMap::NewL(); + } + + CHbSymbianVariant *variant = NULL; + variant = CHbSymbianVariant::NewL( &iCertificate, CHbSymbianVariant::EBinary ); + User::LeaveIfError( iVariantMap->Add( KUntrustedCertEncodedCertificate, variant ) ); + variant = CHbSymbianVariant::NewL( &iValidationError, CHbSymbianVariant::EInt ); + User::LeaveIfError( iVariantMap->Add( KUntrustedCertValidationError, variant ) ); + variant = CHbSymbianVariant::NewL( &iServerName, CHbSymbianVariant::EDes ); + User::LeaveIfError( iVariantMap->Add( KUntrustedCertServerName, variant ) ); + if( !iCanHandlePermanentAccept ) + { + variant = CHbSymbianVariant::NewL( &iCanHandlePermanentAccept, CHbSymbianVariant::EBool ); + User::LeaveIfError( iVariantMap->Add( KUntrustedCertTrustedSiteStoreFail, variant ) ); + } + + User::LeaveIfError( iDeviceDialog->Show( KUntrustedCertificateDialog, *iVariantMap, this ) ); + iStatus = KRequestPending; + SetActive(); + + TRACE( "CUntrustedCertQuery::ShowQueryAndWaitForResponseL, iWait start" ); + iWait->Start(); + TRACE( "CUntrustedCertQuery::ShowQueryAndWaitForResponseL, iWaitCompletionCode=%d", + iWaitCompletionCode ); + User::LeaveIfError( iWaitCompletionCode ); + TRACE( "CUntrustedCertQuery::ShowQueryAndWaitForResponseL, iResponse=%d", iResponse ); + aResponse = iResponse; + } + +// --------------------------------------------------------------------------- +// CUntrustedCertQuery::DoCancel() +// --------------------------------------------------------------------------- +// +void CUntrustedCertQuery::DoCancel() + { + TRACE( "CUntrustedCertQuery::DoCancel, begin" ); + if( iDeviceDialog ) + { + TRACE( "CUntrustedCertQuery::DoCancel, cancelling device dialog" ); + iDeviceDialog->Cancel(); + } + + // Have to complete the request here, because cancelled device dialog does not + // call DeviceDialogClosed() that normally completes it. The request needs to + // be completed since CActive::Cancel() waits until the request is completed. + TRACE( "CUntrustedCertQuery::DoCancel, completing self with KErrCancel" ); + TRequestStatus* status( &iStatus ); + User::RequestComplete( status, KErrCancel ); + + // Normally the above request complete would trigger running RunL(). Now RunL() + // is not run since the active object is already cancelled. Hence, have to stop + // the waiting here so that iWait->Start() returns. + iWaitCompletionCode = KErrCancel; + if( iWait && iWait->IsStarted() ) + { + TRACE( "CUntrustedCertQuery::DoCancel, stopping iWait" ); + iWait->AsyncStop(); + } + TRACE( "CUntrustedCertQuery::DoCancel, end" ); + } + +// --------------------------------------------------------------------------- +// CUntrustedCertQuery::RunL() +// --------------------------------------------------------------------------- +// +void CUntrustedCertQuery::RunL() + { + TRACE( "CUntrustedCertQuery::RunL, iStatus.Int()=%d", iStatus.Int() ); + iWaitCompletionCode = iStatus.Int(); + if( iWait && iWait->IsStarted() ) + { + TRACE( "CUntrustedCertQuery::RunL, stopping iWait" ); + iWait->AsyncStop(); + } + } + +// --------------------------------------------------------------------------- +// CUntrustedCertQuery::DataReceived() +// --------------------------------------------------------------------------- +// +void CUntrustedCertQuery::DataReceived( CHbSymbianVariantMap& aData ) + { + TRACE( "CUntrustedCertQuery::DataReceived" ); + const CHbSymbianVariant* variant = aData.Get( KUntrustedCertDialogResult ); + if( variant ) + { + TInt* value = variant->Value(); + if( value ) + { + switch( *value ) + { + case KUntrustedCertDialogRejected: + TRACE( "CUntrustedCertQuery::DataReceived, rejected" ); + iResponse = EQueryRejected; + break; + case KUntrustedCertDialogAccepted: + TRACE( "CUntrustedCertQuery::DataReceived, accepted" ); + iResponse = EQueryAccepted; + break; + case KUntrustedCertDialogAcceptedPermanently: + TRACE( "CUntrustedCertQuery::DataReceived, accepted permanently" ); + iResponse = EQueryAcceptedPermanently; + break; + default: + __ASSERT_DEBUG( EFalse, User::Invariant() ); + break; + } + } + else + { + __ASSERT_DEBUG( EFalse, User::Invariant() ); + } + } + else + { + __ASSERT_DEBUG( EFalse, User::Invariant() ); + } + } + +// --------------------------------------------------------------------------- +// CUntrustedCertQuery::DeviceDialogClosed() +// --------------------------------------------------------------------------- +// +void CUntrustedCertQuery::DeviceDialogClosed( TInt aCompletionCode ) + { + TRACE( "CUntrustedCertQuery::DeviceDialogClosed, aCompletionCode=%d", aCompletionCode ); + if( IsActive() ) + { + TRACE( "CUntrustedCertQuery::DeviceDialogClosed, request complete" ); + TRequestStatus* status( &iStatus ); + User::RequestComplete( status, aCompletionCode ); + } + } + +// --------------------------------------------------------------------------- +// CUntrustedCertQuery::CUntrustedCertQuery() +// --------------------------------------------------------------------------- +// +CUntrustedCertQuery::CUntrustedCertQuery( + TValidationError aValidationError, const TDesC8& aCertificate, + const TDesC& aServerName, TBool aCanHandlePermanentAccept ) : + CActive( CActive::EPriorityStandard ), iValidationError( aValidationError ), + iCertificate( aCertificate ), iServerName( aServerName ), + iCanHandlePermanentAccept( aCanHandlePermanentAccept ), + iResponse( EQueryRejected ) + { + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------------------------- +// CUntrustedCertQuery::ConstructL() +// --------------------------------------------------------------------------- +// +void CUntrustedCertQuery::ConstructL() + { + TRACE( "CUntrustedCertQuery::ConstructL" ); + iWait = new( ELeave ) CActiveSchedulerWait; + } + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/inc/untrustedcertificatedefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/inc/untrustedcertificatedefinitions.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 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" +* 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: Parameter definitions for untrusted certificate dialog. +* Untrusted certificate dialog is displayed for secure +* connection (TLS) server authentication failure errors. +* +*/ + +#ifndef UNTRUSTEDCERTIFICATEDEFINITIONS_H +#define UNTRUSTEDCERTIFICATEDEFINITIONS_H + +// Device dialog type for untrusted certificate dialog +const QString KUntrustedCertificateDialog = "com.nokia.untrustedcert/1.0"; + +// Corresponds to CServerAuthenticationFailureInput class +const QString KUntrustedCertEncodedCertificate = "cert"; // bytearray, mandatory +const QString KUntrustedCertServerName = "host"; // string, mandatory +const QString KUntrustedCertValidationError = "err"; // int (TValidationError), mandatory +const QString KUntrustedCertTrustedSiteStoreFail = "tss"; // any, prevents permanent acceptance + +// Dialog return codes +const QString KUntrustedCertificateDialogResult = "result"; // int +const int KDialogRejected = 0; +const int KDialogAccepted = 1; +const int KDialogAcceptedPermanently = 2; + +#endif // UNTRUSTEDCERTIFICATEDEFINITIONS_H + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/inc/untrustedcertificatedialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/inc/untrustedcertificatedialog.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 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" +* 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: Device dialog plugin that shows untrusted certificate +* dialog for TLS server authentication failure errors. +* +*/ + +#ifndef UNTRUSTEDCERTIFICATEDIALOG_H +#define UNTRUSTEDCERTIFICATEDIALOG_H + +#include +#include + +class UntrustedCertificateWidget; + + +/** + * Untrusted certificate dialog. + * This dialog is displayed when a secure socket (CSecureSocket) is opened + * using EDialogModeAttended mode, and the server sends untrusted certificate. + * Untrusted certificate dialog shows the certificate details and prompts if + * the secure connection is allowed to proceed. + */ +class UntrustedCertificateDialog : public HbDialog, public HbDeviceDialogInterface +{ + Q_OBJECT + +public: // constructor and destructor + UntrustedCertificateDialog(const QVariantMap ¶meters); + virtual ~UntrustedCertificateDialog(); + +public: // from HbDeviceDialogInterface + bool setDeviceDialogParameters(const QVariantMap ¶meters); + int deviceDialogError() const; + void closeDeviceDialog(bool byClient); + HbDialog *deviceDialogWidget() const; + +signals: // required by device dialog framework + void deviceDialogClosed(); + void deviceDialogData(const QVariantMap &data); + +protected: // from HbPopup (via HbDialog) + void hideEvent(QHideEvent *event); + void showEvent(QShowEvent *event); + +private: // new functions + bool isParametersValid(const QVariantMap ¶meters); + bool constructDialog(const QVariantMap ¶meters); + bool updateFromParameters(const QVariantMap ¶meters); + void sendResult(int result); + void confirmPermanentAccept(); + +private slots: // new slots + void handleAccepted(); + void handleRejected(); + void handlePermanentAcceptance(); + +private: // new functions + Q_DISABLE_COPY(UntrustedCertificateDialog) + +private: // data + int mLastError; + UntrustedCertificateWidget *mContent; + QVariantMap mResultMap; + bool mShowEventReceived; + HbAction *mOkAction; +}; + +#endif // UNTRUSTEDCERTIFICATEDIALOG_H + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/inc/untrustedcertificateinfo_symbian.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/inc/untrustedcertificateinfo_symbian.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 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" +* 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: Certificate info class for TLS untrusted certificate dialog. +* +*/ + +#ifndef UNTRUSTEDCERTIFICATEINFOSYMBIAN_H +#define UNTRUSTEDCERTIFICATEINFOSYMBIAN_H + +#include "untrustedcertificateinfobase.h" + +class CX509Certificate; + + +/** + * Certificate info class for secure connections (TLS) untrusted certificate dialog. + * Symbian-specific concrete implementeation for the certificate info class. + */ +class UntrustedCertificateInfoSymbian : public UntrustedCertificateInfoBase +{ +public: // constructor and destructor + UntrustedCertificateInfoSymbian(const QByteArray &aEncodedCert); + ~UntrustedCertificateInfoSymbian(); + +public: // from UntrustedCertificateInfoBase + bool commonNameMatches(const QString &siteName) const; + QString certificateDetails(const QString &siteName) const; + +private: // new functions + void ConstructL(const QByteArray &aEncodedCert); + bool CommonNameMatchesL(const QString &siteName) const; + QByteArray Md5FingerprintL( const TDesC8& aEncodedCert ) const; + +private: // data + CX509Certificate* mCert; + QByteArray mMd5Fingerprint; +}; + +#endif // UNTRUSTEDCERTIFICATEINFOSYMBIAN_H diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/inc/untrustedcertificateinfobase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/inc/untrustedcertificateinfobase.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 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" +* 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: Certificate info class for TLS untrusted certificate dialog. +* +*/ + +#ifndef UNTRUSTEDCERTIFICATEINFOBASE_H +#define UNTRUSTEDCERTIFICATEINFOBASE_H + +#include +#include + +/** + * Certificate info class for secure connections (TLS) untrusted certificate dialog. + * This is abstract class that is used in UI code to get displayable certificate + * details. Concrete (possibly platform specific) classes implement the functionality. + */ +class UntrustedCertificateInfoBase : public QObject +{ + Q_OBJECT + +public: // definitions + enum CertificateFormat { + UnknownCertificate, + X509Certificate, + WTLSCertificate, + X968Certificate + }; + enum Algorithm { + Unknown, + RSA, + DSA, + DH, + MD2, + MD5, + SHA1, + SHA224, + SHA256, + SHA384, + SHA512 + }; + +protected: // constructor, available for derived classes only + UntrustedCertificateInfoBase(); + +public: // destructor + virtual ~UntrustedCertificateInfoBase(); + +public: // new functions + virtual const QString subjectName() const; + virtual const QString issuerName() const; + virtual const QByteArray fingerprint() const; + virtual const QByteArray serialNumber() const; + virtual const QDateTime validFrom() const; + virtual const QDateTime validTo() const; + virtual const QString format() const; + virtual const QString digestAlgorithm() const; + virtual const QString asymmetricAlgorithm() const; + virtual const QString combinedAlgorithmName() const; + virtual const QString formattedFingerprint(const QByteArray &fingerprint) const; + virtual const QString formattedSerialNumber(const QByteArray &serialNumber) const; + virtual bool isDateValid() const; + +public: // new abstract functions + virtual bool commonNameMatches(const QString &siteName) const = 0; + virtual QString certificateDetails(const QString &siteName) const = 0; + +private: // new functions + const QString algorithmName(Algorithm algorithm) const; + +protected: // data + QString mSubjectName; + QString mIssuerName; + QByteArray mFingerprint; + QByteArray mSerialNumber; + QDateTime mValidFrom; + QDateTime mValidTo; + CertificateFormat mFormat; + Algorithm mDigestAlgorithm; + Algorithm mAsymmetricAlgorithm; +}; + +#endif // UNTRUSTEDCERTIFICATEINFOBASE_H diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/inc/untrustedcertificateplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/inc/untrustedcertificateplugin.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 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" +* 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: Device dialog plugin that shows untrusted certificate +* dialog for TLS server authentication failure errors. +* +*/ + +#ifndef UNTRUSTEDCERTIFICATEPLUGIN_H +#define UNTRUSTEDCERTIFICATEPLUGIN_H + +#include + + +/** + * Untrusted certificate plugin. + * Device dialog plugin to show untrusted certificate dialog. + * See UntrustedCertificateDialog. + */ +class UntrustedCertificatePlugin : public HbDeviceDialogPlugin +{ + Q_OBJECT + +public: + UntrustedCertificatePlugin(); + ~UntrustedCertificatePlugin(); + +public: // from HbDeviceDialogPlugin + bool accessAllowed(const QString &deviceDialogType, const QVariantMap ¶meters, + const QVariantMap &securityInfo) const; + HbDeviceDialogInterface *createDeviceDialog(const QString &deviceDialogType, + const QVariantMap ¶meters); + bool deviceDialogInfo(const QString &deviceDialogType, const QVariantMap ¶meters, + DeviceDialogInfo *info) const; + QStringList deviceDialogTypes() const; + PluginFlags pluginFlags() const; + int error() const; + +private: + Q_DISABLE_COPY(UntrustedCertificatePlugin) + + int mError; +}; + +#endif // UNTRUSTEDCERTIFICATEPLUGIN_H diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/inc/untrustedcertificatewidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/inc/untrustedcertificatewidget.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 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" +* 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: Device dialog plugin that shows untrusted certificate +* dialog for TLS server authentication failure errors. +* +*/ + +#ifndef UNTRUSTEDCERTIFICATEWIDGET_H +#define UNTRUSTEDCERTIFICATEWIDGET_H + +#include + +class UntrustedCertificateInfoBase; +class QGraphicsLinearLayout; +class HbLabel; +class HbCheckBox; +class HbGroupBox; +class HbTextEdit; + + +/** + * Untrusted certificate widget. + * Content widget for untrusted certificate dialog. + * See UntrustedCertificateDialog. + */ +class UntrustedCertificateWidget : public HbWidget +{ + Q_OBJECT + +public: // constructor and destructor + UntrustedCertificateWidget(QGraphicsItem *parent=0, Qt::WindowFlags flags=0); + virtual ~UntrustedCertificateWidget(); + + void constructFromParameters(const QVariantMap ¶meters); + void updateFromParameters(const QVariantMap ¶meters); + bool isPermanentAcceptAllowed() const; + bool isPermanentAcceptChecked() const; + QString serverName() const; + +public: // new platform specific functions + bool isCertificateValid(); + +private: // new platform specific functions + void processEncodedCertificate(const QByteArray &encodedCert); + QString descriptionText(); + +private: // new functions + Q_DISABLE_COPY(UntrustedCertificateWidget) + void processParameters(const QVariantMap ¶meters); + +private: // data + QGraphicsLinearLayout *mMainLayout; + HbLabel *mProblemDescription; + HbCheckBox *mAcceptPermanently; + HbGroupBox *mCertificateDetailsGroupBox; + HbTextEdit *mCertificateDetailsText; + UntrustedCertificateInfoBase *mCertificateInfo; + QString mServerName; + int mValidationError; + bool mIsSavingServerNamePossible; +}; + + +#endif // UNTRUSTEDCERTIFICATEWIDGET_H + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/rom/untrustedcertdialog.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/rom/untrustedcertdialog.iby Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 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" +* 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: ROM image files for untrusted certificate dialog. +* +*/ + +#ifndef __UNTRUSTEDCERTDIALOG_IBY__ +#define __UNTRUSTEDCERTDIALOG_IBY__ + +file=ABI_DIR\UREL\untrustedcertdialog.dll SHARED_LIB_DIR\untrustedcertdialog.dll UNPAGED +data=\epoc32\data\z\pluginstub\untrustedcertdialog.qtplugin \resource\plugins\devicedialogs\untrustedcertdialog.qtplugin + +#endif // __UNTRUSTEDCERTDIALOG_IBY__ diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/rom/untrustedcertdialog_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/rom/untrustedcertdialog_resources.iby Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,24 @@ +/* +* Copyright (c) 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" +* 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: ROM image files for untrusted certificate dialog. +* +*/ + +#ifndef __UNTRUSTEDCERTDIALOG_RESOURCES_IBY__ +#define __UNTRUSTEDCERTDIALOG_RESOURCES_IBY__ + +//TODO: enable when localisations ready +//data=DATAZ_/QT_TRANSLATIONS_DIR/untrustedcertdialog.qm QT_TRANSLATIONS_DIR/untrustedcertdialog.qm + +#endif // __UNTRUSTEDCERTDIALOG_RESOURCES_IBY__ diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/src/untrustedcertificatedialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/src/untrustedcertificatedialog.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,294 @@ +/* +* Copyright (c) 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" +* 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: Device dialog plugin that shows untrusted certificate +* dialog for TLS server authentication failure errors. +* +*/ + +#include "untrustedcertificatedialog.h" +#include "untrustedcertificatedefinitions.h" +#include "untrustedcertificatewidget.h" +#include +#include +#include +#include + +const int KNoError = 0; // KErrNone +const int KParameterError = -6; // KErrArgument + +// TODO: replace with OST tracing +#ifdef _DEBUG +#include +#define TRACE(x) qDebug() << x +#define TRACE1(x,y) qDebug() << x << y +#else +#define TRACE(x) +#define TRACE1(x,y) +#endif + + +// ---------------------------------------------------------------------------- +// UntrustedCertificateDialog::UntrustedCertificateDialog() +// ---------------------------------------------------------------------------- +// +UntrustedCertificateDialog::UntrustedCertificateDialog(const QVariantMap ¶meters) : + HbDialog(), mLastError(KNoError), mContent(0), mResultMap(), + mShowEventReceived(false), mOkAction(0) +{ + constructDialog(parameters); +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateDialog::~UntrustedCertificateDialog() +// ---------------------------------------------------------------------------- +// +UntrustedCertificateDialog::~UntrustedCertificateDialog() +{ +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateDialog::setDeviceDialogParameters() +// ---------------------------------------------------------------------------- +// +bool UntrustedCertificateDialog::setDeviceDialogParameters(const QVariantMap ¶meters) +{ + return updateFromParameters(parameters); +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateDialog::deviceDialogError() +// ---------------------------------------------------------------------------- +// +int UntrustedCertificateDialog::deviceDialogError() const +{ + return mLastError; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateDialog::closeDeviceDialog() +// ---------------------------------------------------------------------------- +// +void UntrustedCertificateDialog::closeDeviceDialog(bool byClient) +{ + Q_UNUSED(byClient); + TRACE("UntrustedCertificateDialog::closeDeviceDialog"); + close(); + + // If show event has been received, close is signalled from hide event. + // If not, hide event does not come and close is signalled from here. + if (!mShowEventReceived) { + emit deviceDialogClosed(); + } +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateDialog::deviceDialogWidget() +// ---------------------------------------------------------------------------- +// +HbDialog *UntrustedCertificateDialog::deviceDialogWidget() const +{ + return const_cast(this); +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateDialog::hideEvent() +// ---------------------------------------------------------------------------- +// +void UntrustedCertificateDialog::hideEvent(QHideEvent *event) +{ + TRACE("UntrustedCertificateDialog::hideEvent"); + HbDialog::hideEvent(event); + emit deviceDialogClosed(); +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateDialog::showEvent() +// ---------------------------------------------------------------------------- +// +void UntrustedCertificateDialog::showEvent(QShowEvent *event) +{ + TRACE("UntrustedCertificateDialog::showEvent"); + HbDialog::showEvent(event); + mShowEventReceived = true; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateDialog::isParametersValid() +// ---------------------------------------------------------------------------- +// +bool UntrustedCertificateDialog::isParametersValid(const QVariantMap ¶meters) +{ + if (parameters.contains(KUntrustedCertEncodedCertificate) && + parameters.contains(KUntrustedCertServerName) && + parameters.contains(KUntrustedCertValidationError)) { + return true; + } + mLastError = KParameterError; + return false; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateDialog::constructDialog() +// ---------------------------------------------------------------------------- +// +bool UntrustedCertificateDialog::constructDialog(const QVariantMap ¶meters) +{ + TRACE("UntrustedCertificateDialog::constructDialog"); + if (!isParametersValid(parameters)) { + return false; + } + + setTimeout(HbPopup::NoTimeout); + setDismissPolicy(HbPopup::NoDismiss); + setModal(true); + + //: Title text in untrusted certificate dialog. User is opening secure + //: connection to site or service, which authenticity cannot be proved, + //: or there are other problems in the site certificate. User needs to + //: decide if she/he accepts the risk and opens the secure connection + //: anyway, or if the connection is rejected. + //TODO: localised UI string + //QString titleText = hbTrId(""); + QString titleText = tr("Untrusted certificate"); + setHeadingWidget(new HbLabel(titleText, this)); + + Q_ASSERT(mContent == 0); + mContent = new UntrustedCertificateWidget(this); + mContent->constructFromParameters(parameters); + setContentWidget(mContent); + + if (mContent->isCertificateValid()) { + mOkAction = new HbAction(qtTrId("txt_common_button_ok"), this); + addAction(mOkAction); + disconnect(mOkAction, SIGNAL(triggered()), this, SLOT(close())); + connect(mOkAction, SIGNAL(triggered()), this, SLOT(handleAccepted())); + + HbAction *cancelAction = new HbAction(qtTrId("txt_common_button_cancel"), this); + addAction(cancelAction); + disconnect(cancelAction, SIGNAL(triggered()), this, SLOT(close())); + connect(cancelAction, SIGNAL(triggered()), this, SLOT(handleRejected())); + } else { + HbAction *closeAction = new HbAction(qtTrId("txt_common_button_close"), this); + addAction(closeAction); + disconnect(closeAction, SIGNAL(triggered()), this, SLOT(close())); + connect(closeAction, SIGNAL(triggered()), this, SLOT(handleRejected())); + } + + return true; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateDialog::updateFromParameters() +// ---------------------------------------------------------------------------- +// +bool UntrustedCertificateDialog::updateFromParameters(const QVariantMap ¶meters) +{ + TRACE("UntrustedCertificateDialog::updateFromParameters"); + if (!isParametersValid(parameters)) { + return false; + } + + Q_ASSERT(mContent != 0); + mContent->updateFromParameters(parameters); + return true; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateDialog::sendResult() +// ---------------------------------------------------------------------------- +// +void UntrustedCertificateDialog::sendResult(int result) +{ + TRACE1("UntrustedCertificateDialog::sendResult", result); + QVariant resultValue(result); + mResultMap.insert(KUntrustedCertificateDialogResult, resultValue); + emit deviceDialogData(mResultMap); +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateDialog::confirmPermanentAccept() +// ---------------------------------------------------------------------------- +// +void UntrustedCertificateDialog::confirmPermanentAccept() +{ + TRACE("UntrustedCertificateDialog::confirmPermanentAccept"); + + HbDialog *dialog = new HbDialog(); + dialog->setAttribute(Qt::WA_DeleteOnClose, true); + dialog->setTimeout(HbPopup::NoTimeout); + dialog->setDismissPolicy(HbDialog::NoDismiss); + dialog->setModal(true); + + // TODO: localised UI string needed + QString questionTitle = tr("Certificate access"); + dialog->setHeadingWidget(new HbLabel(questionTitle)); + + HbWidget *widget = new HbWidget(); + QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(); + // TODO: localized UI string needed + QString questionText = + tr("Connections to '%1' will be made without warnings. Continue?") + .arg(mContent->serverName()); + HbLabel *textLabel = new HbLabel(questionText); + textLabel->setTextWrapping(Hb::TextWordWrap); + layout->addItem(textLabel); + widget->setLayout(layout); + dialog->setContentWidget(widget); + + HbAction *yesAction = new HbAction(hbTrId("txt_common_button_yes")); + dialog->addAction(yesAction); + disconnect(yesAction, SIGNAL(triggered()), this, SLOT(close())); + connect(yesAction, SIGNAL(triggered()), this, SLOT(handlePermanentAcceptance())); + dialog->addAction(new HbAction(hbTrId("txt_common_button_no"))); + + dialog->show(); +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateDialog::handleAccepted() +// ---------------------------------------------------------------------------- +// +void UntrustedCertificateDialog::handleAccepted() +{ + TRACE("UntrustedCertificateDialog::handleAccepted"); + if (mContent->isPermanentAcceptChecked()) { + confirmPermanentAccept(); + } else { + sendResult(KDialogAccepted); + close(); + } +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateDialog::handleRejected() +// ---------------------------------------------------------------------------- +// +void UntrustedCertificateDialog::handleRejected() +{ + TRACE("UntrustedCertificateDialog::handleRejected"); + sendResult(KDialogRejected); + close(); +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateDialog::handlePermanentAcceptance() +// ---------------------------------------------------------------------------- +// +void UntrustedCertificateDialog::handlePermanentAcceptance() +{ + TRACE("UntrustedCertificateDialog::handlePermanentAcceptance"); + sendResult(KDialogAcceptedPermanently); + close(); +} + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/src/untrustedcertificateinfo_symbian.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/src/untrustedcertificateinfo_symbian.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,227 @@ +/* +* Copyright (c) 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" +* 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: Certificate info class for TLS untrusted certificate dialog. +* +*/ + +#include "untrustedcertificateinfo_symbian.h" +#include // TAlgorithmId +#include // CX509Certificate +#include // X509CertNameParser +#include // CMD5 + + +// ======== LOCAL FUNCTIONS ======== + +// ---------------------------------------------------------------------------- +// mapAlgorithm() +// ---------------------------------------------------------------------------- +// +UntrustedCertificateInfoBase::Algorithm mapAlgorithm(TAlgorithmId aAlgId) +{ + UntrustedCertificateInfoBase::Algorithm algorithm = + UntrustedCertificateInfoBase::Unknown; + switch(aAlgId) { + case ERSA: + algorithm = UntrustedCertificateInfoBase::RSA; + break; + case EDSA: + algorithm = UntrustedCertificateInfoBase::DSA; + break; + case EDH: + algorithm = UntrustedCertificateInfoBase::DH; + break; + case EMD2: + algorithm = UntrustedCertificateInfoBase::MD2; + break; + case EMD5: + algorithm = UntrustedCertificateInfoBase::MD5; + break; + case ESHA1: + algorithm = UntrustedCertificateInfoBase::SHA1; + break; + case ESHA224: + algorithm = UntrustedCertificateInfoBase::SHA224; + break; + case ESHA256: + algorithm = UntrustedCertificateInfoBase::SHA256; + break; + case ESHA384: + algorithm = UntrustedCertificateInfoBase::SHA384; + break; + case ESHA512: + algorithm = UntrustedCertificateInfoBase::SHA512; + break; + default: + break; + } + return algorithm; +} + +// ---------------------------------------------------------------------------- +// convertDateTime() +// ---------------------------------------------------------------------------- +// +void convertDateTime(const TTime& aFromTime, QDateTime& aToDateTime) +{ + const TDateTime &symbianDateTime = aFromTime.DateTime(); + + QDate date(symbianDateTime.Year(), symbianDateTime.Month()+1, symbianDateTime.Day()+1); + QTime time(symbianDateTime.Hour(), symbianDateTime.Minute(), symbianDateTime.Second()); + aToDateTime.setDate(date); + aToDateTime.setTime(time); +} + + +// ======== MEMBER FUNCTIONS ======== + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoSymbian::UntrustedCertificateInfoSymbian() +// ---------------------------------------------------------------------------- +// +UntrustedCertificateInfoSymbian::UntrustedCertificateInfoSymbian( + const QByteArray &aEncodedCert) : UntrustedCertificateInfoBase(), + mCert(0), mMd5Fingerprint() +{ + QT_TRAP_THROWING(ConstructL(aEncodedCert)); +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoSymbian::~UntrustedCertificateInfoSymbian() +// ---------------------------------------------------------------------------- +// +UntrustedCertificateInfoSymbian::~UntrustedCertificateInfoSymbian() +{ + delete mCert; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoSymbian::commonNameMatches() +// ---------------------------------------------------------------------------- +// +bool UntrustedCertificateInfoSymbian::commonNameMatches(const QString &siteName) const +{ + bool matches = false; + QT_TRAP_THROWING(matches = CommonNameMatchesL(siteName)); + return matches; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoSymbian::certificateDetails() +// ---------------------------------------------------------------------------- +// +QString UntrustedCertificateInfoSymbian::certificateDetails(const QString &siteName) const +{ + // TODO: localized UI string needed + QString details = tr("Service:\n%1\n\nIssuer:\n%2\n\nSubject:\n%3\n\n" + "Valid from:\n%4\n\nValid until:\n%5\n\nCertificate format:\n%6\n\n" + "Algorithm:\n%7\n\nSerial number:\n%8\n\n" + "Fingerprint (SHA1):\n%9\n\nFingerprint (MD5):\n%10") + .arg(siteName) // %1 + .arg(issuerName()) // %2 + .arg(subjectName()) // %3 + .arg(validFrom().toString()) // %4 + .arg(validTo().toString()) // %5 + .arg(format()) // %6 + .arg(combinedAlgorithmName()) // %7 + .arg(formattedSerialNumber(serialNumber())) // %8 + .arg(formattedFingerprint(fingerprint())) // %9 + .arg(formattedFingerprint(mMd5Fingerprint)); // %10 + return details; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoSymbian::ConstructL() +// ---------------------------------------------------------------------------- +// +void UntrustedCertificateInfoSymbian::ConstructL(const QByteArray &aEncodedCert) +{ + TPtrC8 encodedCert( reinterpret_cast( aEncodedCert.constData() ), + aEncodedCert.length() ); + + ASSERT( mCert == 0 ); + mCert = CX509Certificate::NewL( encodedCert ); + + HBufC16* subjectBuf = NULL; + X509CertNameParser::SubjectFullNameL( *mCert, subjectBuf ); + CleanupStack::PushL( subjectBuf ); + QT_TRYCATCH_LEAVING( mSubjectName = + QString::fromUtf16(subjectBuf->Ptr(), subjectBuf->Length()) ); + CleanupStack::PopAndDestroy( subjectBuf ); + + HBufC16* issuerBuf = NULL; + X509CertNameParser::IssuerFullNameL( *mCert, issuerBuf ); + CleanupStack::PushL( issuerBuf ); + QT_TRYCATCH_LEAVING( mIssuerName = + QString::fromUtf16(issuerBuf->Ptr(), issuerBuf->Length())); + CleanupStack::PopAndDestroy( issuerBuf ); + + TPtrC8 fingerprint = mCert->Fingerprint(); + QT_TRYCATCH_LEAVING( mFingerprint = QByteArray::fromRawData( + reinterpret_cast(fingerprint.Ptr()), fingerprint.Length()) ); + + mMd5Fingerprint = Md5FingerprintL( mCert->Encoding() ); + + TPtrC8 serialNumber = mCert->SerialNumber(); + QT_TRYCATCH_LEAVING( mSerialNumber = QByteArray::fromRawData( + reinterpret_cast(serialNumber.Ptr()), serialNumber.Length()) ); + + const CValidityPeriod& validityPeriod = mCert->ValidityPeriod(); + convertDateTime(validityPeriod.Start(), mValidFrom); + convertDateTime(validityPeriod.Finish(), mValidTo); + + mFormat = X509Certificate; + + const CSigningAlgorithmIdentifier& alg = mCert->SigningAlgorithm(); + mDigestAlgorithm = mapAlgorithm(alg.DigestAlgorithm().Algorithm()); + mAsymmetricAlgorithm = mapAlgorithm(alg.AsymmetricAlgorithm().Algorithm()); +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoSymbian::CommonNameMatchesL() +// ---------------------------------------------------------------------------- +// +bool UntrustedCertificateInfoSymbian::CommonNameMatchesL(const QString &siteName) const +{ + bool matches = false; + const CX500DistinguishedName& distinguishedName = mCert->SubjectName(); + HBufC* commonNameSymbian = distinguishedName.ExtractFieldL( KX520CommonName ); + if (commonNameSymbian) { + CleanupStack::PushL(commonNameSymbian); + QString commonName = QString::fromRawData( + reinterpret_cast(commonNameSymbian->Ptr()), + commonNameSymbian->Length()); + matches = ( commonName == siteName ); // TODO: accept '*' chars in commonName? + CleanupStack::PopAndDestroy(commonNameSymbian); + } + return matches; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoSymbian::Md5FingerprintL() +// ---------------------------------------------------------------------------- +// +QByteArray UntrustedCertificateInfoSymbian::Md5FingerprintL( const TDesC8& aEncodedCert ) const +{ + CMD5* md5 = CMD5::NewL(); + CleanupStack::PushL( md5 ); + + const TPtrC8 fingerprintSymbian = md5->Hash( aEncodedCert ); + QByteArray fingerprint( reinterpret_cast( fingerprintSymbian.Ptr() ), + fingerprintSymbian.Length() ); + + CleanupStack::PopAndDestroy( md5 ); + return fingerprint; +} + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/src/untrustedcertificateinfobase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/src/untrustedcertificateinfobase.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,268 @@ +/* +* Copyright (c) 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" +* 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: Certificate info class for TLS untrusted certificate dialog. +* +*/ + +#include "UntrustedCertificateInfoBase.h" + +const char *KHexNumberFormatSimple = "%X"; +const char *KHexNumberFormatTwoDigitsWithLeadingZeroes = "%02X"; +const int KCharsPerBlock = 2; +const char KBlockSeparator = ' '; + + +// ======== MEMBER FUNCTIONS ======== + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoBase::UntrustedCertificateInfoBase() +// ---------------------------------------------------------------------------- +// +UntrustedCertificateInfoBase::UntrustedCertificateInfoBase() : QObject(), + mSubjectName(), mIssuerName(), mFingerprint(), mSerialNumber(), mValidFrom(), mValidTo(), + mFormat(UnknownCertificate), mDigestAlgorithm(Unknown), mAsymmetricAlgorithm(Unknown) +{ +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoBase::~UntrustedCertificateInfoBase() +// ---------------------------------------------------------------------------- +// +UntrustedCertificateInfoBase::~UntrustedCertificateInfoBase() +{ +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoBase::subjectName() +// ---------------------------------------------------------------------------- +// +const QString UntrustedCertificateInfoBase::subjectName() const +{ + return mSubjectName; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoBase::issuerName() +// ---------------------------------------------------------------------------- +// +const QString UntrustedCertificateInfoBase::issuerName() const +{ + return mIssuerName; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoBase::fingerprint() +// ---------------------------------------------------------------------------- +// +const QByteArray UntrustedCertificateInfoBase::fingerprint() const +{ + return mFingerprint; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoBase::serialNumber() +// ---------------------------------------------------------------------------- +// +const QByteArray UntrustedCertificateInfoBase::serialNumber() const +{ + return mSerialNumber; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoBase::validFrom() +// ---------------------------------------------------------------------------- +// +const QDateTime UntrustedCertificateInfoBase::validFrom() const +{ + return mValidFrom; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoBase::validTo() +// ---------------------------------------------------------------------------- +// +const QDateTime UntrustedCertificateInfoBase::validTo() const +{ + return mValidTo; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoBase::format() +// ---------------------------------------------------------------------------- +// +const QString UntrustedCertificateInfoBase::format() const +{ + QString format; + switch (mFormat) { + case X509Certificate: + //: Type name for X509 certificates displayed in certificate details. + // TODO: localised UI string + format = tr("X.509"); + break; + default: + //: Type name for unknown certificates displayed in certificate details. + // TODO: localised UI string + format = tr("Unknown"); + break; + } + return format; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoBase::digestAlgorithm() +// ---------------------------------------------------------------------------- +// +const QString UntrustedCertificateInfoBase::digestAlgorithm() const +{ + return algorithmName(mDigestAlgorithm); +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoBase::AsymmetricAlgorithm() +// ---------------------------------------------------------------------------- +// +const QString UntrustedCertificateInfoBase::asymmetricAlgorithm() const +{ + return algorithmName(mAsymmetricAlgorithm); +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoBase::AsymmetricAlgorithm() +// ---------------------------------------------------------------------------- +// +const QString UntrustedCertificateInfoBase::combinedAlgorithmName() const +{ + if (mDigestAlgorithm != Unknown && mAsymmetricAlgorithm != Unknown) { + //: Format to combine digest and asymmetric algorithm names. + //: %1 is digest (signing) and %2 is asymmetric (public-key) algorithm. + // TODO: localised UI string needed + return tr("%1%2").arg(digestAlgorithm()).arg(asymmetricAlgorithm()); + } + //: Algorithm name for unknown algorithm. + // TODO: localised UI string needed + return tr("Unknown"); +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoBase::formattedFingerprint() +// ---------------------------------------------------------------------------- +// +const QString UntrustedCertificateInfoBase::formattedFingerprint( + const QByteArray &byteArray) const +{ + QString formatted; + + QString number; + int blockIndex = 0; + int count = byteArray.count(); + for (int index = 0; index < count; ++index) { + if (blockIndex == KCharsPerBlock) { + formatted.append(KBlockSeparator); + blockIndex = 0; + } + number.sprintf(KHexNumberFormatTwoDigitsWithLeadingZeroes, + static_cast(byteArray.at(index))); + formatted.append(number); + ++blockIndex; + } + + return formatted; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoBase::formattedSerialNumber() +// ---------------------------------------------------------------------------- +// +const QString UntrustedCertificateInfoBase::formattedSerialNumber( + const QByteArray &serialNumber) const +{ + QString formatted; + + QString number; + int count = serialNumber.count(); + for (int index = 0; index < count; ++index) { + number.sprintf(KHexNumberFormatSimple, + static_cast(serialNumber.at(index))); + formatted.append(number); + } + + return formatted; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoBase::isDateValid() +// ---------------------------------------------------------------------------- +// +bool UntrustedCertificateInfoBase::isDateValid() const +{ + QDateTime current = QDateTime::currentDateTime(); + return (mValidFrom <= current && mValidTo >= current); +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoBase::algorithmName() +// ---------------------------------------------------------------------------- +// +const QString UntrustedCertificateInfoBase::algorithmName(Algorithm algorithm) const +{ + QString name; + switch (algorithm) { + case RSA: + //: Certificate details algorithm name + // TODO: localized UI string + name = tr("RSA"); + break; + case DSA: + //: Certificate details algorithm name + // TODO: localized UI string + name = tr("DSA"); + break; + case DH: + //: Certificate details algorithm name + // TODO: localized UI string + name = tr("DH"); + break; + case MD2: + //: Certificate details algorithm name + // TODO: localized UI string + name = tr("MD2"); + break; + case MD5: + //: Certificate details algorithm name + // TODO: localized UI string + name = tr("MD5"); + break; + case SHA1: + //: Certificate details algorithm name + // TODO: localized UI string + name = tr("SHA1"); + break; + case SHA224: + case SHA256: + case SHA384: + case SHA512: + //: Certificate details algorithm name + // TODO: localized UI string + name = tr("SHA2"); + break; + case Unknown: + default: + //: Certificate details algorithm name + // TODO: localized UI string + name = tr("Unknown"); + break; + } + return name; +} + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/src/untrustedcertificateplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/src/untrustedcertificateplugin.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,122 @@ +/* +* Copyright (c) 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" +* 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: Device dialog plugin that shows untrusted certificate +* dialog for TLS server authentication failure errors. +* +*/ + +#include "untrustedcertificateplugin.h" +#include "untrustedcertificatedialog.h" +#include "untrustedcertificatedefinitions.h" + + +// ---------------------------------------------------------------------------- +// UntrustedCertificatePlugin::UntrustedCertificatePlugin() +// ---------------------------------------------------------------------------- +// +UntrustedCertificatePlugin::UntrustedCertificatePlugin() : mError(KErrNone) +{ +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificatePlugin::~UntrustedCertificatePlugin() +// ---------------------------------------------------------------------------- +// +UntrustedCertificatePlugin::~UntrustedCertificatePlugin() +{ +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificatePlugin::accessAllowed() +// ---------------------------------------------------------------------------- +// +bool UntrustedCertificatePlugin::accessAllowed(const QString &deviceDialogType, + const QVariantMap ¶meters, const QVariantMap &securityInfo) const +{ + Q_UNUSED(deviceDialogType) + Q_UNUSED(parameters) + Q_UNUSED(securityInfo) + + // All clients are allowed to use. + // TODO: should access be limited to certain clients? + return true; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificatePlugin::createDeviceDialog() +// ---------------------------------------------------------------------------- +// +HbDeviceDialogInterface *UntrustedCertificatePlugin::createDeviceDialog( + const QString &deviceDialogType, const QVariantMap ¶meters) +{ + Q_UNUSED(deviceDialogType) + + UntrustedCertificateDialog *deviceDialog = new UntrustedCertificateDialog(parameters); + mError = deviceDialog->deviceDialogError(); + if (mError != KErrNone) { + delete deviceDialog; + deviceDialog = 0; + } + + return deviceDialog; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificatePlugin::deviceDialogInfo() +// ---------------------------------------------------------------------------- +// +bool UntrustedCertificatePlugin::deviceDialogInfo( const QString &deviceDialogType, + const QVariantMap ¶meters, DeviceDialogInfo *info) const +{ + Q_UNUSED(deviceDialogType); + Q_UNUSED(parameters); + + info->group = GenericDeviceDialogGroup; + info->flags = NoDeviceDialogFlags; + info->priority = DefaultPriority; + + return true; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificatePlugin::deviceDialogTypes() +// ---------------------------------------------------------------------------- +// +QStringList UntrustedCertificatePlugin::deviceDialogTypes() const +{ + QStringList types; + types << KUntrustedCertificateDialog; + return types; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificatePlugin::pluginFlags() +// ---------------------------------------------------------------------------- +// +HbDeviceDialogPlugin::PluginFlags UntrustedCertificatePlugin::pluginFlags() const +{ + return NoPluginFlags; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificatePlugin::error() +// ---------------------------------------------------------------------------- +// +int UntrustedCertificatePlugin::error() const +{ + return mError; +} + +Q_EXPORT_PLUGIN2(untrustedcertdialog,UntrustedCertificatePlugin) + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/src/untrustedcertificatewidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/src/untrustedcertificatewidget.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,161 @@ +/* +* Copyright (c) 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" +* 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: Device dialog plugin that shows untrusted certificate +* dialog for TLS server authentication failure errors. +* +*/ + +#include "untrustedcertificatewidget.h" +#include "untrustedcertificatedefinitions.h" +#include "untrustedcertificateinfobase.h" +#include +#include +#include +#include +#include + +const int KUnknownError = -5; // KErrNotSupported + + +// ======== MEMBER FUNCTIONS ======== + +// ---------------------------------------------------------------------------- +// UntrustedCertificateWidget::UntrustedCertificateWidget() +// ---------------------------------------------------------------------------- +// +UntrustedCertificateWidget::UntrustedCertificateWidget(QGraphicsItem *parent, + Qt::WindowFlags flags) : HbWidget(parent, flags), + mMainLayout(0), mProblemDescription(0), mAcceptPermanently(0), + mCertificateDetailsGroupBox(0), mCertificateDetailsText(0), + mCertificateInfo(0), mServerName(), mValidationError(0), + mIsSavingServerNamePossible(true) +{ +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateWidget::~UntrustedCertificateWidget() +// ---------------------------------------------------------------------------- +// +UntrustedCertificateWidget::~UntrustedCertificateWidget() +{ + delete mCertificateInfo; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateWidget::constructFromParameters() +// ---------------------------------------------------------------------------- +// +void UntrustedCertificateWidget::constructFromParameters( + const QVariantMap ¶meters) +{ + processParameters(parameters); + + Q_ASSERT(mMainLayout == 0); + mMainLayout = new QGraphicsLinearLayout(Qt::Vertical); + + Q_ASSERT(mProblemDescription == 0); + QString text = descriptionText().arg(mServerName); + mProblemDescription = new HbLabel(text); + mProblemDescription->setTextWrapping(Hb::TextWordWrap); + mMainLayout->addItem(mProblemDescription); + + if (isPermanentAcceptAllowed()) { + Q_ASSERT(mAcceptPermanently == 0); + // TODO: localised UI string needed + mAcceptPermanently = new HbCheckBox(tr("Accept permanently")); + mMainLayout->addItem(mAcceptPermanently); + } + + Q_ASSERT(mCertificateDetailsGroupBox == 0); + mCertificateDetailsGroupBox = new HbGroupBox; + // TODO: localized UI string needed + mCertificateDetailsGroupBox->setHeading(tr("Details")); + + Q_ASSERT(mCertificateDetailsText == 0); + mCertificateDetailsText = new HbTextEdit; + QString certificateDetails = mCertificateInfo->certificateDetails(mServerName); + mCertificateDetailsText->setPlainText(certificateDetails); + mCertificateDetailsText->setReadOnly(true); + + mCertificateDetailsGroupBox->setContentWidget(mCertificateDetailsText); + mCertificateDetailsGroupBox->setCollapsed(true); + mMainLayout->addItem(mCertificateDetailsGroupBox); + + setLayout(mMainLayout); + } + +// ---------------------------------------------------------------------------- +// UntrustedCertificateWidget::updateFromParameters() +// ---------------------------------------------------------------------------- +// +void UntrustedCertificateWidget::updateFromParameters( + const QVariantMap ¶meters) +{ + processParameters(parameters); +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateWidget::isPermanentAcceptAllowed() +// ---------------------------------------------------------------------------- +// +bool UntrustedCertificateWidget::isPermanentAcceptAllowed() const +{ + return (mCertificateInfo->isDateValid() && (mServerName.length() > 0) && + mIsSavingServerNamePossible); +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateWidget::isPermanentAcceptChecked() +// ---------------------------------------------------------------------------- +// +bool UntrustedCertificateWidget::isPermanentAcceptChecked() const +{ + if (mAcceptPermanently) { + return (mAcceptPermanently->checkState() == Qt::Checked); + } + return false; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateWidget::serverName() +// ---------------------------------------------------------------------------- +// +QString UntrustedCertificateWidget::serverName() const +{ + return mServerName; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateWidget::processParameters() +// ---------------------------------------------------------------------------- +// +void UntrustedCertificateWidget::processParameters(const QVariantMap ¶meters) +{ + mServerName = parameters.value(KUntrustedCertServerName).toString(); + + bool ok = false; + mValidationError = KUnknownError; + int value = parameters.value(KUntrustedCertValidationError).toInt(&ok); + if (ok) { + mValidationError = value; + } + + QByteArray encodedCert = parameters.value(KUntrustedCertEncodedCertificate).toByteArray(); + processEncodedCertificate(encodedCert); + + if (parameters.contains(KUntrustedCertTrustedSiteStoreFail)) { + mIsSavingServerNamePossible = false; + } +} + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/src/untrustedcertificatewidget_symbian.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/src/untrustedcertificatewidget_symbian.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 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" +* 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: Device dialog plugin that shows untrusted certificate +* dialog for TLS server authentication failure errors. +* +*/ + +#include "untrustedcertificatewidget.h" +#include "untrustedcertificatedefinitions.h" +#include "untrustedcertificateinfobase.h" +#include "untrustedcertificateinfo_symbian.h" +#include // TValidationError + + +// ======== MEMBER FUNCTIONS ======== + +// ---------------------------------------------------------------------------- +// UntrustedCertificateWidget::isInvalidCertificate() +// ---------------------------------------------------------------------------- +// +bool UntrustedCertificateWidget::isCertificateValid() +{ + return (mValidationError != ESignatureInvalid && mValidationError != ECertificateRevoked); +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateWidget::processEncodedCertificate() +// ---------------------------------------------------------------------------- +// +void UntrustedCertificateWidget::processEncodedCertificate(const QByteArray &encodedCert) +{ + UntrustedCertificateInfoBase *info = new UntrustedCertificateInfoSymbian(encodedCert); + if (mCertificateInfo) { + delete mCertificateInfo; + mCertificateInfo = 0; + } + mCertificateInfo = info; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateWidget::descriptionText() +// ---------------------------------------------------------------------------- +// +QString UntrustedCertificateWidget::descriptionText() +{ + QString text; + if (!isCertificateValid()) { + //: Information note text shown if the server certificate has an invalid signature + // TODO: localised UI string + text = tr("'%1' has sent an invalid certificate. Connection cannot be created."); + } else if (mValidationError == EValidatedOK || mValidationError == EDateOutOfRange) { + bool isDateValid = mCertificateInfo->isDateValid(); + bool isSiteValid = mCertificateInfo->commonNameMatches(mServerName); + if (!isDateValid && !isSiteValid) { + // TODO: hbTrId("txt_untrustedcert_dialog _accept_site_ood") + text = tr("'%1' has sent a certificate with different site name and which is out of date. Accept anyway?"); + } else if (!isSiteValid) { + // TODO: hbTrId("txt_untrustedcert_dialog _accept_site" + text = tr("'%1' has sent a certificate with different site name. Accept anyway?"); + } else { + // TODO: hbTrId("txt_untrustedcert_dialog_accept_ood") + text = tr("'%1' has sent a certificate which is out of date. Accept anyway?"); + } + } else { + bool isDateValid = mCertificateInfo->isDateValid(); + bool isSiteValid = mCertificateInfo->commonNameMatches(mServerName); + if (!isDateValid && !isSiteValid) { + // TODO: hbTrId("txt_untrustedcert_dialog _accept_untrusted_site_ood" + text = tr("'%1' has sent an untrusted certificate with different site name and which is out of date. Accept anyway?"); + } else if (!isSiteValid) { + // TODO: hbTrId("txt_untrustedcert_dialog _accept_untrusted_site" + text = tr("'%1' has sent an untrusted certificate with different site name. Accept anyway?"); + } else if (!isDateValid) { + // TODO: hbTrId("txt_untrustedcert_dialog _accept_untrusted_ood") + text = tr("'%1' has sent an untrusted certificate which is out of date. Accept anyway?"); + } else { + // TODO: hbTrId("txt_untrustedcert_dialog _accept_untrusted" + text = tr("'%1' has sent an untrusted certificate. Accept anyway?"); + } + } + return text; +} + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/ctc_instrument_code.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/ctc_instrument_code.bat Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,34 @@ +@echo off +rem +rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: TLS untrusted certificate dialog test code. +rem + +echo ---------------------------------------------------------------------- +echo. +echo Instrumenting code (armv5 urel and winscw udeb, decision coverage) +echo. +echo ---------------------------------------------------------------------- +echo. +pushd ..\.. +if exist MON.sym del MON.sym +if exist MON.dat del MON.dat +if exist profile.txt del profile.txt +call qmake +call make distclean +call qmake +call ctcwrap -i d -2comp -C "EXCLUDE+*.UID.CPP" -C "EXCLUDE+moc_*.cpp" sbs -c armv5_urel +call ctcwrap -i d -2comp -C "EXCLUDE+*.UID.CPP" -C "EXCLUDE+moc_*.cpp" sbs -c winscw_udeb +popd + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/ctc_remove_instrumentation.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/ctc_remove_instrumentation.bat Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,31 @@ +@echo off +rem +rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: TLS untrusted certificate dialog test code. +rem + +echo ---------------------------------------------------------------------- +echo. +echo Removing instrumentation +echo. +echo ---------------------------------------------------------------------- +echo. +pushd ..\.. +call qmake +call make distclean +call qmake +call sbs -c armv5_urel +call sbs -c winscw_udeb +popd + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/dialoglauncher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/dialoglauncher.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,189 @@ +/* +* Copyright (c) 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" +* 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: Test application for untrusted certificate dialog. +* +*/ + +#include "dialoglauncher.h" +#include "../../inc/untrustedcertificatedefinitions.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef Q_OS_SYMBIAN +#include // EValidatedOK, ESignatureInvalid, EDateOutOfRange +#endif + +const QString KTestCertDir = "c:/data/testCerts"; + + +UntrustedCertDialogLauncher::UntrustedCertDialogLauncher(int& argc, char* argv[]) + : HbApplication(argc, argv), mMainWindow(0), mMainView(0) +{ + mMainWindow = new HbMainWindow(); + mMainView = new HbView(); + mMainView->setTitle(tr("UntrustedCertDlg")); + + QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); + + HbLabel *certFile = new HbLabel(tr("Certificate file:")); + layout->addItem(certFile); + + mFilesList = new HbComboBox; + mFilesList->setEditable(false); + QDir dir(KTestCertDir); + if (dir.exists()) { + QFileInfoList list = dir.entryInfoList(QDir::Files); + QListIterator iter(list); + while (iter.hasNext()) { + const QFileInfo &info(iter.next()); + mFilesList->addItem(info.fileName()); + } + } + layout->addItem(mFilesList); + + mHostName = new HbTextEdit(tr("some.host.com")); + layout->addItem(mHostName); + + HbPushButton *button = 0; + button = new HbPushButton("Open (valid)"); + connect(button, SIGNAL(clicked()), this, SLOT(activateDialogDateValid())); + layout->addItem(button); + + button = new HbPushButton("Open (out-of-date)"); + connect(button, SIGNAL(clicked()), this, SLOT(activateDialogOutOfDate())); + layout->addItem(button); + + button = new HbPushButton("Open (untrusted)"); + connect(button, SIGNAL(clicked()), this, SLOT(activateDialogUntrusted())); + layout->addItem(button); + + button = new HbPushButton("Open (invalid)"); + connect(button, SIGNAL(clicked()), this, SLOT(activateDialogInvalid())); + layout->addItem(button); + + button = new HbPushButton("Exit"); + connect(button, SIGNAL(clicked()), qApp, SLOT(quit())); + layout->addItem(button); + + mMainView->setLayout(layout); + mMainWindow->addView(mMainView); + mMainWindow->show(); +} + +UntrustedCertDialogLauncher::~UntrustedCertDialogLauncher() +{ + delete mMainView; + delete mMainWindow; +} + +void UntrustedCertDialogLauncher::activateDialog(const QVariantMap ¶ms) +{ + HbDeviceDialog *deviceDialog = new HbDeviceDialog(HbDeviceDialog::NoFlags, this); + connect(deviceDialog, SIGNAL(dataReceived(QVariantMap)), + this, SLOT(dataReceived(QVariantMap))); + connect(deviceDialog, SIGNAL(deviceDialogClosed()), + this, SLOT(deviceDialogClosed())); + + if (!deviceDialog->show(KUntrustedCertificateDialog, params)) { + HbMessageBox::warning(tr("Cannot open dialog")); + } +} + +QVariantMap UntrustedCertDialogLauncher::readParams() +{ + QVariantMap params; + + QString fileName = mFilesList->currentText(); + QFile file; + QDir::setCurrent(KTestCertDir); + file.setFileName(fileName); + file.open(QIODevice::ReadOnly); + QByteArray fileContent = file.readAll(); + file.close(); + + params.insert(KUntrustedCertEncodedCertificate, fileContent); + + QString serverName = mHostName->toPlainText(); + params.insert(KUntrustedCertServerName, serverName); + + return params; +} + +void UntrustedCertDialogLauncher::activateDialogDateValid() +{ + QVariantMap params = readParams(); + + int validationError = EValidatedOK; + params.insert(KUntrustedCertValidationError, validationError); + + activateDialog(params); +} + +void UntrustedCertDialogLauncher::activateDialogOutOfDate() +{ + QVariantMap params = readParams(); + + int validationError = EDateOutOfRange; + params.insert(KUntrustedCertValidationError, validationError); + + activateDialog(params); +} + +void UntrustedCertDialogLauncher::activateDialogUntrusted() +{ + QVariantMap params = readParams(); + + int validationError = EChainHasNoRoot; + params.insert(KUntrustedCertValidationError, validationError); + + activateDialog(params); +} + +void UntrustedCertDialogLauncher::activateDialogInvalid() +{ + QVariantMap params = readParams(); + + int validationError = ECertificateRevoked; + params.insert(KUntrustedCertValidationError, validationError); + + activateDialog(params); +} + +void UntrustedCertDialogLauncher::dataReceived(QVariantMap data) +{ + QString values; + foreach(const QString key, data.keys()) { + values.append(key); + values.append(tr(" = ")); + values.append(data.value(key).toString()); + values.append(tr("\n")); + } + + HbMessageBox::information(tr("dataReceived %1").arg(values)); +} + +void UntrustedCertDialogLauncher::deviceDialogClosed() +{ + HbMessageBox::information(tr("deviceDialogClosed")); +} + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/dialoglauncher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/dialoglauncher.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 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" +* 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: Test application for untrusted certificate dialog. +* +*/ + +#ifndef UNTRUSTEDCERTDIALOGLAUNCHER_H +#define UNTRUSTEDCERTDIALOGLAUNCHER_H + +#include + +class HbMainWindow; +class HbView; +class HbComboBox; +class HbTextEdit; + + +class UntrustedCertDialogLauncher : public HbApplication +{ + Q_OBJECT + +public: // constructor and destructor + UntrustedCertDialogLauncher(int& argc, char* argv[]); + ~UntrustedCertDialogLauncher(); + +private: // new functions + void activateDialog(const QVariantMap ¶ms); + QVariantMap readParams(); + +private slots: // new functions + void activateDialogDateValid(); + void activateDialogOutOfDate(); + void activateDialogUntrusted(); + void activateDialogInvalid(); + void dataReceived(QVariantMap data); + void deviceDialogClosed(); + +private: // data + HbMainWindow *mMainWindow; + HbView *mMainView; + HbComboBox *mFilesList; + HbTextEdit *mHostName; +}; + +#endif // UNTRUSTEDCERTDIALOGLAUNCHER_H + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/dialoglauncher.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/dialoglauncher.iby Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 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" +* 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: Test application for untrusted certificate dialog. +* +*/ + + +#ifndef __DIALOGLAUNCHER_IBY__ +#define __DIALOGLAUNCHER_IBY__ + +file=ABI_DIR/BUILD_DIR/dialoglauncher.exe SHARED_LIB_DIR/dialoglauncher.exe +HB_UPGRADABLE_APP_REG_RSC( dialoglauncher ) + +#endif // __DIALOGLAUNCHER_IBY__ diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/dialoglauncher.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/dialoglauncher.pkg Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,43 @@ +; +; Copyright (c) 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" +; 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: Test application for untrusted certificate dialog. +; + +; Language +&EN + +; SIS header: name, uid, version +#{"dialoglauncher"},(0xE9bbd80d),1,0,0 + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Manual PKG pre-rules from PRO files +; Default dependency to Qt libraries +(0x2001E61C), 4, 6, 3, {"Qt"} + +; Default HW/platform dependencies +[0x101F7961],0,0,0,{"S60ProductID"} +[0x102032BE],0,0,0,{"S60ProductID"} +[0x102752AE],0,0,0,{"S60ProductID"} +[0x1028315F],0,0,0,{"S60ProductID"} + +; Executable and default resource files +"/epoc32/release/armv5/urel/dialoglauncher.exe" - "!:\sys\bin\dialoglauncher.exe" +"/epoc32/data/z/resource/apps/dialoglauncher.rsc" - "!:\resource\apps\dialoglauncher.rsc" +"/epoc32/data/z/private/10003a3f/import/apps/dialoglauncher_reg.rsc" - "!:\private\10003a3f\import\apps\dialoglauncher_reg.rsc" + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/dialoglauncher.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/dialoglauncher.pro Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,36 @@ +# +# Copyright (c) 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" +# 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: Test application for untrusted certificate dialog. +# + +TEMPLATE = app +TARGET = dialoglauncher +CONFIG += hb +DEPENDPATH += . +INCLUDEPATH += . + +HEADERS += dialoglauncher.h +SOURCES += dialoglaunchermain.cpp dialoglauncher.cpp + +symbian { + TARGET.CAPABILITY = CAP_APPLICATION +} + +BLD_INF_RULES.prj_exports += \ + "$${LITERAL_HASH}include " \ + "dialoglauncher.iby CORE_APP_LAYER_IBY_EXPORT_PATH(dialoglauncher.iby)" \ + "test_cert_expired.crt /epoc32/winscw/c/data/testCerts/test_cert_expired.crt" \ + "test_cert_server.crt /epoc32/winscw/c/data/testCerts/test_cert_server.crt" \ + "test_cert_sha2.crt /epoc32/winscw/c/data/testCerts/test_cert_sha2.crt" + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/dialoglaunchermain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/dialoglaunchermain.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 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" +* 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: Test application for untrusted certificate dialog. +* +*/ + +#include "dialoglauncher.h" + +int main(int argc, char *argv[]) +{ + UntrustedCertDialogLauncher app(argc, argv); + return app.exec(); +} + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/test_cert_expired.crt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/test_cert_expired.crt Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,17 @@ +-----BEGIN CERTIFICATE----- +MIICpTCCAg6gAwIBAgIBBDANBgkqhkiG9w0BAQUFADBwMQswCQYDVQQGEwJGSTEQ +MA4GA1UECBMHVGFtcGVyZTEQMA4GA1UEBxMHVGFtcGVyZTEOMAwGA1UEChMFTm9r +aWExFTATBgNVBAsTDFM2MCBTZWN1cml0eTEWMBQGA1UEAxMNc29tZS5ob3N0LmNv +bTAeFw0xMDA2MDIxMTQwMDFaFw0wNjA2MDIxMzU0MTdaMHAxCzAJBgNVBAYTAkZJ +MRAwDgYDVQQIEwdUYW1wZXJlMRAwDgYDVQQHEwdUYW1wZXJlMQ4wDAYDVQQKEwVO +b2tpYTEVMBMGA1UECxMMUzYwIFNlY3VyaXR5MRYwFAYDVQQDEw1zb21lLmhvc3Qu +Y29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC/31fdPI+OcFPpaUC0D2XO +SmmDbRdouyUa0LCQ9sP9ChiGBqT6g2uv/irhcezA+gUdlERrEQsmmeXuMqktG0Jb +dxHJNSEboERr+65q7F4g3nJlxeNOlVllCKd4cFO7/oGRtduAJALkQmeKkPwgHPW+ +AFtG7U3rAd5xRjxzK8q7SQIDAQABo08wTTAMBgNVHRMBAf8EAjAAMB0GA1UdDgQW +BBSJJ8UI5B6SWTG05XFyD3N+/6/+CTALBgNVHQ8EBAMCBeAwEQYJYIZIAYb4QgEB +BAQDAgZAMA0GCSqGSIb3DQEBBQUAA4GBAB+kN6paDHW46pLwCR5yJLp5m7DoEJ/L +IMWCmxKB90FADiBz+jvNQue3hO8SJVpvuRsy1y/e915LXYD4JAlIhZektB2DmYqg +6Tic9tlcQh101myX9sV5ORC2BKg4Tol2PUDaiVsaXSU2cgfWmxPmza2d4RvMvkGp +4L/EpR5ol37y +-----END CERTIFICATE----- diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/test_cert_server.crt Binary file pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/test_cert_server.crt has changed diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/test_cert_sha2.crt Binary file pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/test_cert_sha2.crt has changed diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/tsrc/tlsconntest/tlsconnection.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/tsrc/tlsconntest/tlsconnection.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,471 @@ +/* +* Copyright (c) 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" +* 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: Secure connections test application +* +*/ + +#include "tlsconnection.h" +#include +#include +#include // KSolInetSSL, KSoSSLDomainName + +_LIT( KData, "GET index.html" ); +_LIT( KSecureProtocol, "TLS1.0" ); +_LIT( KCommDBIapId, "IAP\\Id" ); +_LIT8( KNewLine, "\n" ); + +const TInt KRecvBufferLength = 0x4000; +const TInt KOneSecondInMicroseconds = 1000000; + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------- +// CTlsConnection::NewL +// --------------------------------------------------------- +// +CTlsConnection* CTlsConnection::NewL( MTlsConnectionObserver& aObs ) + { + RDebug::Print( _L("CTlsConnection::NewL()") ); + CTlsConnection* self = new ( ELeave ) CTlsConnection( aObs ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CTlsConnection::~CTlsConnection() +// ----------------------------------------------------------------------------- +// +CTlsConnection::~CTlsConnection() + { + RDebug::Print( _L("CTlsConnection::~CTlsConnection()") ); + Cancel(); + iDelayTimer.Close(); + CloseSession(); + delete iSendBuffer; + delete iSendBufPtr; + } + +// ----------------------------------------------------------------------------- +// CTlsConnection::ConnectL() +// ----------------------------------------------------------------------------- +// +void CTlsConnection::ConnectL( const TDesC& aHostName, TInt aPort, TInt aDelay ) + { + RDebug::Print( _L("CTlsConnection::Connect() host '%S', port %d, delay %d"), + &aHostName, aPort, aDelay ); + CloseConnection(); + + // Parameters + if( iHostName ) + { + delete iHostName; + iHostName = NULL; + } + iHostName = aHostName.AllocL(); + iPort = aPort; + iDelay = aDelay; + + // Save host name in 8-bit form for server certificate checking + if( iHostNameForCertCheck ) + { + delete iHostNameForCertCheck; + iHostNameForCertCheck = NULL; + } + iHostNameForCertCheck = HBufC8::NewL( aHostName.Length() ); + TPtr8 ptr( iHostNameForCertCheck->Des() ); + ptr.Copy( aHostName ); + + // Convert send data to 8-bit and add newline at the end + if( iSendBuffer || iSendBufPtr ) + { + delete iSendBuffer; + iSendBuffer = NULL; + delete iSendBufPtr; + iSendBufPtr = NULL; + } + iSendBuffer = HBufC8::NewL( KData().Length() + 1 ); + iSendBufPtr = new( ELeave ) TPtr8( iSendBuffer->Des() ); + iSendBufPtr->Copy( KData ); + iSendBufPtr->Append( KNewLine ); + + // Connect + RDebug::Printf( "CTlsConnection::ConnectL iConnection.Open" ); + User::LeaveIfError( iConnection.Open( iSockServer ) ); + RDebug::Printf( "CTlsConnection::ConnectL iConnPref.SetDirection" ); + iConnPref.SetDirection( ECommDbConnectionDirectionOutgoing ); + if( iCurrentIap ) + { + // uses the same IAP as before + RDebug::Printf( "CTlsConnection::ConnectL SetIapId(%d)", iCurrentIap ); + iConnPref.SetIapId( iCurrentIap ); + iConnPref.SetDialogPreference( ECommDbDialogPrefDoNotPrompt ); + } + else + { + // not defined, prompts the IAP from user + RDebug::Printf( "CTlsConnection::ConnectL ECommDbDialogPrefPrompt" ); + iConnPref.SetDialogPreference( ECommDbDialogPrefPrompt ); + } + StateChange( EConnectingNetwork ); + RDebug::Printf( "CTlsConnection::ConnectL iConnection.Start" ); + iConnection.Start( iConnPref, iStatus ); + SetActive(); + RDebug::Printf( "CTlsConnection::ConnectL end" ); + } + +// ----------------------------------------------------------------------------- +// CTlsConnection::Disconnect() +// ----------------------------------------------------------------------------- +// +void CTlsConnection::Disconnect() + { + Cancel(); + CloseConnection(); + StateChange( EDisconnected ); + } + +// ----------------------------------------------------------------------------- +// CTlsConnection::RunL +// ----------------------------------------------------------------------------- +// +void CTlsConnection::RunL() + { + if( iState == EReading && ( iStatus.Int() == KErrEof || iStatus.Int() == KErrSSLAlertCloseNotify ) ) + { + RDebug::Printf( "CTlsConnection::RunL: EReading, EOF: iStatus = %d", iStatus.Int() ); + StateChange( EAllDone ); + } + else if( iStatus.Int() == KErrNone ) + { + switch ( iState ) + { + case EConnectingNetwork: + RDebug::Printf( "CTlsConnection::RunL: EConnectingNetwork" ); + if( !iCurrentIap ) + { + iConnection.GetIntSetting( KCommDBIapId, iCurrentIap ); + } + if( iDelay ) + { + TTimeIntervalMicroSeconds32 delay( iDelay * KOneSecondInMicroseconds ); + iDelayTimer.After( iStatus, delay ); + StateChange( EOpeningDelay ); + } + else + { + iConnection.ProgressNotification( iProgress, iStatus ); + StateChange( EResolvingHostName ); + } + SetActive(); + break; + + case EOpeningDelay: + iConnection.ProgressNotification( iProgress, iStatus ); + StateChange( EResolvingHostName ); + SetActive(); + break; + + case EResolvingHostName: + { + RDebug::Printf( "CTlsConnection::RunL: EResolvingHostName" ); + TInt err = iHostResolver.Open( iSockServer, KAfInet, KProtocolInetUdp, iConnection ); + User::LeaveIfError( err ); + iHostResolver.GetByName( *iHostName, iNameEntry, iStatus ); + StateChange( EConnectingServer ); + SetActive(); + } + break; + + case EConnectingServer: + { + iRemoteAddr.SetFamily( KAfInet ); + iRemoteAddr = TInetAddr( iNameEntry().iAddr ); + iRemoteAddr.SetPort( iPort ); + + RDebug::Printf( "CTlsConnection::RunL: EConnectingServer" ); + TInt err = iSocket.Open( iSockServer, KAfInet, KSockStream, KProtocolInetTcp, iConnection ); + RDebug::Printf( "CTlsConnection::RunL: iSocket.Open ret %d", err ); + User::LeaveIfError( err ); + iSocket.Connect( iRemoteAddr, iStatus ); + StateChange( EHandshaking ); + SetActive(); + } + break; + + case EHandshaking: + { + RDebug::Printf( "CTlsConnection::RunL: EHandshaking" ); + if( iSecureSocket ) + { + delete iSecureSocket; + iSecureSocket = NULL; + } + iSecureSocket = CSecureSocket::NewL( iSocket, KSecureProtocol ); + iSecureSocket->SetDialogMode( EDialogModeAttended ); + // Server name must be set, otherwise CCTSecurityDialogsAO fails with KErrArgument + iSecureSocket->SetOpt( KSoSSLDomainName, KSolInetSSL, *iHostNameForCertCheck ); + iSecureSocket->StartClientHandshake( iStatus ); + StateChange( EConnecting ); + SetActive(); + } + break; + + case EConnecting: + { + RDebug::Printf( "CTlsConnection::RunL: EConnecting" ); + // Check if connection is closed + const TInt stage( iProgress().iStage ); + if( stage == KConnectionClosed || stage == KLinkLayerClosed ) + { + StateChange( EDisconnected ); + } + else + { + iConnection.ProgressNotification( iProgress, iStatus ); + StateChange( ESending ); + SetActive(); + } + } + break; + + case ESending: + RDebug::Printf( "CTlsConnection::RunL: ESending" ); + iSecureSocket->Send( *iSendBufPtr, iStatus, iSendLength ); + StateChange( EReading ); + SetActive(); + break; + + case EReading: + iTotalRecvCount += iRecvLength(); + RDebug::Printf( "CTlsConnection::RunL: EReading, read %d bytes", iTotalRecvCount ); + iObserver.HandleTransferData( iRecvBuffer->Des(), iTotalRecvCount ); + + iRecvBufPtr->Zero(); + iSecureSocket->RecvOneOrMore( *iRecvBufPtr, iStatus, iRecvLength ); + SetActive(); + break; + + default: + break; + } + } + else + { + RDebug::Printf( "CTlsConnection::RunL: ERROR iStatus %d", iStatus.Int() ); + CloseConnection(); + StateChange( EDisconnected, iStatus.Int() ); + } + } + +// --------------------------------------------------------------------------- +// CTlsConnection::DoCancel() +// --------------------------------------------------------------------------- +// +void CTlsConnection::DoCancel() + { + RDebug::Printf( "CTlsConnection::DoCancel(), iState=%d", iState ); + + switch( iState ) + { + case EConnectingNetwork: + iConnection.Stop(); + break; + + case EOpeningDelay: + iDelayTimer.Cancel(); + iConnection.Stop(); + break; + + case EResolvingHostName: + iConnection.CancelProgressNotification(); + iConnection.Stop(); + break; + + case EConnectingServer: + iHostResolver.Cancel(); + iConnection.Stop(); + break; + + case EHandshaking: + iSocket.CancelConnect(); + iConnection.Stop(); + break; + + case EConnecting: + if( iSecureSocket ) + { + iSecureSocket->CancelHandshake(); + delete iSecureSocket; + iSecureSocket = NULL; + } + iSocket.Close(); + iConnection.Stop(); + break; + + case ESending: + if( iSecureSocket ) + { + iSecureSocket->CancelSend(); + delete iSecureSocket; + iSecureSocket = NULL; + } + iSocket.Close(); + iConnection.Stop(); + break; + + case EReading: + if( iSecureSocket ) + { + iSecureSocket->CancelRecv(); + delete iSecureSocket; + iSecureSocket = NULL; + } + iSocket.Close(); + iConnection.Stop(); + break; + + case EAllDone: + case EIdle: + case EDisconnected: + default: + break; + } + + StateChange( EDisconnected ); + } + + +// ----------------------------------------------------------------------------- +// CTlsConnection::RunError() +// ----------------------------------------------------------------------------- +// +TInt CTlsConnection::RunError( TInt aError ) + { + RDebug::Printf( "CTlsConnection::RunError, aError: %d", aError ); + CloseConnection(); + StateChange( EDisconnected, aError ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CTlsConnection::CTlsConnection() +// ----------------------------------------------------------------------------- +// +CTlsConnection::CTlsConnection( MTlsConnectionObserver& aObs ) : + CActive( CActive::EPriorityStandard ), iObserver( aObs ), iState( ENotInitialized ) + { + CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// CTlsConnection::ConstructL() +// ----------------------------------------------------------------------------- +// +void CTlsConnection::ConstructL() + { + RDebug::Printf( "CTlsConnection::ConstructL begin" ); + + User::LeaveIfError( iDelayTimer.CreateLocal() ); + RDebug::Printf( "CTlsConnection::ConstructL iSockServer" ); + User::LeaveIfError( iSockServer.Connect() ); + RDebug::Printf( "CTlsConnection::ConstructL iConnection" ); + User::LeaveIfError( iConnection.Open( iSockServer ) ); + RDebug::Printf( "CTlsConnection::ConstructL buffers" ); + iRecvBuffer = HBufC8::NewL( KRecvBufferLength ); + iRecvBufPtr = new( ELeave ) TPtr8( iRecvBuffer->Des() ); + StateChange( EIdle ); + + RDebug::Printf( "CTlsConnection::ConstructL end" ); + } + +// --------------------------------------------------------------------------- +// CTlsConnection::CloseConnection() +// --------------------------------------------------------------------------- +// +void CTlsConnection::CloseConnection() + { + RDebug::Printf( "CTlsConnection::CloseConnection begin" ); + if( iSecureSocket ) + { + delete iSecureSocket; + iSecureSocket = NULL; + } + iSocket.Close(); + iHostResolver.Close(); + if( iConnection.SubSessionHandle() ) + { + if( iState >= EConnectingNetwork ) + { + TInt err = iConnection.Stop(); + if( err != KErrNone ) + { + RDebug::Printf( "iConnection.Stop() failed: %d", err ); + } + } + iConnection.Close(); + } + RDebug::Printf( "CTlsConnection::CloseConnection end" ); + } + +// --------------------------------------------------------------------------- +// CTlsConnection::CloseSession() +// --------------------------------------------------------------------------- +// +void CTlsConnection::CloseSession() + { + RDebug::Printf( "CTlsConnection::CloseSession" ); + CloseConnection(); + iSockServer.Close(); + delete iHostName; + iHostName = NULL; + delete iHostNameForCertCheck; + iHostNameForCertCheck = NULL; + delete iRecvBuffer; + iRecvBuffer = NULL; + delete iRecvBufPtr; + iRecvBufPtr = NULL; + StateChange( EDisconnected ); + } + +// ----------------------------------------------------------------------------- +// CTlsConnection::StateChange() +// ----------------------------------------------------------------------------- +// +void CTlsConnection::StateChange( TTlsConnectionState aNewState, TInt aError ) + { + RDebug::Printf( "CTlsConnection::StateChange, aNewState=%d, aError=%d", aNewState, aError ); + if( aNewState != iState && iState != EAllDone ) + { + iState = aNewState; + iObserver.HandleNetworkEvent( aNewState, aError ); + } + } + +// --------------------------------------------------------------------------- +// CTlsConnection::ReadL() +// --------------------------------------------------------------------------- +// +void CTlsConnection::ReadL() + { + RDebug::Printf( "CTlsConnection::ReadL(), iState=%d", iState ); + + TPtr8 recvBuffer = iRecvBuffer->Des(); + recvBuffer.Zero(); + iSecureSocket->RecvOneOrMore( recvBuffer, iStatus, iRecvLength ); + SetActive(); + } + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/tsrc/tlsconntest/tlsconnection.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/tsrc/tlsconntest/tlsconnection.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 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" +* 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: Secure connections test application +* +*/ + +#ifndef C_TESTTLSCONNECTION_H +#define C_TESTTLSCONNECTION_H + +#include // RConnection +#include // TInetAddr +#include // TCommDbConnPref +#include "tlsconnectionobserver.h" // MTlsConnectionObserver, TTlsConnectionState + +class CSecureSocket; + + +class CTlsConnection : public CActive + { + public: // new functions + static CTlsConnection* NewL( MTlsConnectionObserver& aObs ); + ~CTlsConnection(); + void ConnectL( const TDesC& aHostName, TInt aPort, TInt aDelay ); + void Disconnect(); + + protected: // from CActive + void RunL(); + void DoCancel(); + TInt RunError( TInt aError ); + + private: // constructors + CTlsConnection( MTlsConnectionObserver& aObs ); + void ConstructL(); + + private: // new functions + void CloseConnection(); + void CloseSession(); + void StateChange( TTlsConnectionState aNewState, TInt aError = KErrNone ); + void ReadL(); + + private: // data + MTlsConnectionObserver& iObserver; + RConnection iConnection; + RSocketServ iSockServer; + TCommDbConnPref iConnPref; + TUint32 iCurrentIap; + TNifProgressBuf iProgress; + HBufC* iHostName; + HBufC8* iHostNameForCertCheck; + TInt iPort; + TInt iDelay; + RHostResolver iHostResolver; + TNameEntry iNameEntry; + TInetAddr iRemoteAddr; + RSocket iSocket; + CSecureSocket* iSecureSocket; + HBufC8* iRecvBuffer; + TPtr8* iRecvBufPtr; + TSockXfrLength iRecvLength; + HBufC8* iSendBuffer; + TPtr8* iSendBufPtr; + TSockXfrLength iSendLength; + TInt iTotalRecvCount; + TTlsConnectionState iState; + RTimer iDelayTimer; + }; + + +#endif // C_TESTTLSCONNECTION_H + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/tsrc/tlsconntest/tlsconnectionapp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/tsrc/tlsconntest/tlsconnectionapp.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,197 @@ +/* +* Copyright (c) 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" +* 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: Secure connections test application +* +*/ + +#include "tlsconnectionapp.h" +#include "tlsconnection.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +TlsConnectionApplication::TlsConnectionApplication(int& aArgc, char* aArgv[]) + : HbApplication(aArgc, aArgv), mMainWindow(0), mMainView(0), mHost(0), + mPort(0), mOpeningDelay(0), mStatusLabel(0), mConnection(0) +{ + qDebug() << "TLStest TlsConnectionApplication begin"; + + mMainWindow = new HbMainWindow(); + mMainView = new HbView(); + mMainView->setTitle(tr("TLS Test")); + + QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); + + mHost = new HbComboBox; + QStringList defaultHosts; + defaultHosts << "www.nokia.com" + << "www.f-secure.com" + << "www.google.fi" + << "www.tut.fi"; + mHost->addItems(defaultHosts); + connect(mHost, SIGNAL(editingFinished()), this, SLOT(addHostName())); + mHost->setEditable(true); + layout->addItem(mHost); + + mPort = new HbLineEdit(tr("Port?")); + mPort->setText(tr("443")); + layout->addItem(mPort); + + mOpeningDelay = new HbLineEdit(tr("Opening delay?")); + mOpeningDelay->setText(tr("0")); + layout->addItem(mOpeningDelay); + + mStatusLabel = new HbLabel(tr("Inactive")); + layout->addItem(mStatusLabel); + + HbPushButton *activateButton = new HbPushButton(tr("Run Test")); + connect(activateButton, SIGNAL(clicked()), this, SLOT(runTestPressed())); + layout->addItem(activateButton); + + HbPushButton *closeButton = new HbPushButton("Close"); + connect(closeButton, SIGNAL(clicked()), qApp, SLOT(quit())); + layout->addItem(closeButton); + + mMainView->setLayout(layout); + mMainWindow->addView(mMainView); + mMainWindow->show(); + + qDebug() << "TLStest TlsConnectionApplication end"; +} + +TlsConnectionApplication::~TlsConnectionApplication() +{ + qDebug() << "TLStest ~TlsConnectionApplication begin"; + + delete mConnection; + delete mMainView; + delete mMainWindow; + + qDebug() << "TLStest ~TlsConnectionApplication end"; +} + +void TlsConnectionApplication::HandleNetworkEvent( TTlsConnectionState aEvent, TInt aError ) +{ + switch( aEvent ) { + case ENotInitialized: + showProgress( tr("NotInitialized"), aError ); + break; + case EDisconnected: + showProgress( tr("Disconnected"), aError ); + break; + case EIdle: + showProgress( tr("Idle"), aError ); + break; + case EConnectingNetwork: + showProgress( tr("ConnectingNetwork"), aError ); + break; + case EOpeningDelay: + showProgress( tr("OpeningDelay"), aError ); + break; + case EResolvingHostName: + showProgress( tr("ResolvingHostName"), aError ); + break; + case EConnectingServer: + showProgress( tr("ConnectingServer"), aError ); + break; + case EHandshaking: + showProgress( tr("Handshaking"), aError ); + break; + case EConnecting: + showProgress( tr("Connecting"), aError ); + break; + case ESending: + showProgress( tr("Sending"), aError ); + break; + case EReading: + showProgress( tr("Reading"), aError ); + break; + case EAllDone: + showProgress( tr("AllDone"), aError ); + break; + default: + showProgress( tr("unknown"), aError ); + break; + } +} + +void TlsConnectionApplication::HandleTransferData( const TDesC8& /*aData*/, TInt aLength ) +{ + qDebug() << "TLStest HandleTransferData, length:" << aLength; +} + +void TlsConnectionApplication::runTestPressed() +{ + qDebug() << "TLStest runTestPressed begin"; + + if (mConnection) { + delete mConnection; + mConnection = NULL; + } + + TPtrC host( reinterpret_cast( mHost->currentText().constData() )); + TInt port = getInt(mPort->text(), 443); + TInt delay = getInt(mOpeningDelay->text(), 0); + qDebug() << "TLStest runTestPressed host:" << mHost->currentText() << "port" << port << "delay" << delay; + TRAPD( err, mConnection = CTlsConnection::NewL( *this ) ); + qDebug() << "TLStest runTestPressed err:" << err; + if( !err ) { + qDebug() << "TLStest runTestPressed CTlsConnection created, connecting"; + TRAP( err, mConnection->ConnectL( host, port, delay ) ); + qDebug() << "TLStest runTestPressed err:" << err; + } + + qDebug() << "TLStest runTestPressed end"; +} + +void TlsConnectionApplication::addHostName() +{ + QString newHostName = mHost->currentText(); + mHost->addItem(newHostName); +} + +void TlsConnectionApplication::showProgress(const QString& aStep, int aError) +{ + qDebug() << "TLStest showProgress step" << aStep << "error" << aError; + if (mStatusLabel) { + if (!aError) { + mStatusLabel->setPlainText(aStep); + } else { + QString msg(aStep); + msg.append(tr(" error %1").arg(aError)); + mStatusLabel->setPlainText(msg); + } + } +} + +TInt TlsConnectionApplication::getInt(const QString& aString, int defaultValue) +{ + qDebug() << "TLStest getInt" << aString << "defaultValue" << defaultValue; + + bool ok = false; + TInt value = aString.toInt(&ok, 10); + if (!ok) { + value = defaultValue; + } + + qDebug() << "TLStest getInt returns " << value; + return value; +} diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/tsrc/tlsconntest/tlsconnectionapp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/tsrc/tlsconntest/tlsconnectionapp.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 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" +* 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: Secure connections test application +* +*/ + +#ifndef TLSCONNECTIONAPP_H +#define TLSCONNECTIONAPP_H + +#include +#include "tlsconnectionobserver.h" + +class HbMainWindow; +class HbView; +class HbComboBox; +class HbLineEdit; +class HbLabel; +class CTlsConnection; + + +class TlsConnectionApplication : public HbApplication, public MTlsConnectionObserver +{ + Q_OBJECT + +public: // constructor and destructor + TlsConnectionApplication(int& aArgc, char* aArgv[]); + virtual ~TlsConnectionApplication(); + +public: // from MTlsConnectionObserver + void HandleNetworkEvent(TTlsConnectionState aEvent, TInt aError); + void HandleTransferData(const TDesC8& aData, TInt aLength); + +private slots: + void runTestPressed(); + void addHostName(); + +private: // new functions + void showProgress(const QString& aStep, int aError); + TInt getInt(const QString& aString, int defaultValue); + +private: // data + HbMainWindow *mMainWindow; + HbView *mMainView; + HbComboBox *mHost; + HbLineEdit *mPort; + HbLineEdit *mOpeningDelay; + HbLabel *mStatusLabel; + CTlsConnection *mConnection; +}; + +#endif // TLSCONNECTIONAPP_H + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/tsrc/tlsconntest/tlsconnectionmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/tsrc/tlsconntest/tlsconnectionmain.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 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" +* 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: Secure connections test application +* +*/ + +#include "tlsconnectionapp.h" +#include +#include // CTrapCleanup + + +int DoMainL(int argc, char *argv[]) +{ + TlsConnectionApplication app(argc, argv); + return app.exec(); +} + +int main(int argc, char *argv[]) +{ + qDebug() << "TLStest main begin"; + + int err = 0; + CTrapCleanup *cleanup = CTrapCleanup::New(); + if (cleanup) { + TRAP(err, DoMainL(argc, argv)); + delete cleanup; + } + + qDebug() << "TLStest main returns" << err; + return err; +} + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/tsrc/tlsconntest/tlsconnectionobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/tsrc/tlsconntest/tlsconnectionobserver.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 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" +* 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: Secure connections test application +* +*/ + +#ifndef M_MTLSCONNECTIONOBSERVER_H +#define M_MTLSCONNECTIONOBSERVER_H + +enum TTlsConnectionState + { + ENotInitialized = 0, + EDisconnected, + EIdle, + EConnectingNetwork, + EOpeningDelay, + EResolvingHostName, + EConnectingServer, + EHandshaking, + EConnecting, + ESending, + EReading, + EAllDone + }; + +class MTlsConnectionObserver + { + public: + virtual void HandleNetworkEvent( TTlsConnectionState aEvent, TInt aError ) = 0; + virtual void HandleTransferData( const TDesC8& aData, TInt aLength ) = 0; + }; + +#endif // M_MTLSCONNECTIONOBSERVER_H diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/tsrc/tlsconntest/tlsconntest.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/tsrc/tlsconntest/tlsconntest.iby Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 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" +* 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: Secure connections test application +* +*/ + + +#ifndef __TLSCONNTEST_IBY__ +#define __TLSCONNTEST_IBY__ + +file=ABI_DIR/BUILD_DIR/tlsconntest.exe SHARED_LIB_DIR/tlsconntest.exe +HB_UPGRADABLE_APP_REG_RSC( tlsconntest ) + +#endif // __TLSCONNTEST_IBY__ diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/tsrc/tlsconntest/tlsconntest.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/tsrc/tlsconntest/tlsconntest.loc Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,19 @@ +/* +* Copyright (c) 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" +* 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: Secure connections test application +* +*/ + +#define STRING_r_short_caption "TlsConnTest" +#define STRING_r_caption "TlsConnTest" diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/tsrc/tlsconntest/tlsconntest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/tsrc/tlsconntest/tlsconntest.pkg Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,41 @@ +; +; Copyright (c) 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" +; 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: Secure connections test application +; +; + +; Language +&EN + +; SIS header: name, uid, version +#{"TlsConnTest"},(0xE8DC94B1),1,0,0 + +; Vendor name, localised and unique +%{"Nokia"} +:"Nokia" + +; Default dependency to Qt libraries +(0x2001E61C), *, *, *, {"Qt"} + +; Default platform dependencies +[0x101F7961],0,0,0,{"S60ProductID"} +[0x102032BE],0,0,0,{"S60ProductID"} +[0x102752AE],0,0,0,{"S60ProductID"} +[0x1028315F],0,0,0,{"S60ProductID"} + +; Executable and default resource files +"/epoc32/release/armv5/urel/tlsconntest.exe" - "!:\sys\bin\tlsconntest.exe" +"/epoc32/data/z/resource/apps/tlsconntest.rsc" - "!:\resource\apps\tlsconntest.rsc" +"/epoc32/data/z/private/10003a3f/import/apps/tlsconntest_reg.rsc" - "!:\private\10003a3f\import\apps\tlsconntest_reg.rsc" + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/tsrc/tlsconntest/tlsconntest.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/tsrc/tlsconntest/tlsconntest.pro Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,39 @@ +# +# Copyright (c) 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" +# 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: Secure connections test application +# + +TEMPLATE = app +TARGET = tlsconntest +CONFIG += hb +DEPENDPATH += . +INCLUDEPATH += . + +HEADERS += tlsconnection.h tlsconnectionobserver.h tlsconnectionapp.h tlsconntest.loc +SOURCES += tlsconnectionmain.cpp tlsconnection.cpp tlsconnectionapp.cpp +LIBS += -lesock -lcommdb -linsock -linetprotutil -lsecuresocket + +symbian { + BLD_INF_RULES.prj_exports += "tlsconntest.loc APP_LAYER_LOC_EXPORT_PATH(tlsconntest.loc)" + + TARGET.UID2 = 0x100039CE + TARGET.UID3 = 0xE8DC94B1 # random uid + TARGET.CAPABILITY = CAP_APPLICATION +} + +BLD_INF_RULES.prj_exports += \ + "$${LITERAL_HASH}include " \ + "tlsconntest.iby CORE_APP_LAYER_IBY_EXPORT_PATH(tlsconntest.iby)" + + \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/untrustedcertificatedialog/untrustedcertificateplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/untrustedcertificateplugin.pro Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,58 @@ +# +# Copyright (c) 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" +# 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: Device dialog plugin that shows untrusted certificate +# dialog for TLS server authentication failure errors. +# + +TEMPLATE = lib +TARGET = untrustedcertdialog +CONFIG += hb plugin + +INCLUDEPATH += . +INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE +DEPENDPATH += . + +HEADERS += inc/untrustedcertificateplugin.h \ + inc/untrustedcertificatedefinitions.h \ + inc/untrustedcertificatedialog.h \ + inc/untrustedcertificatewidget.h \ + inc/untrustedcertificateinfobase.h + +SOURCES += src/untrustedcertificateplugin.cpp \ + src/untrustedcertificatedialog.cpp \ + src/untrustedcertificatewidget.cpp \ + src/untrustedcertificateinfobase.cpp + +symbian: { + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.CAPABILITY = CAP_GENERAL_DLL + TARGET.UID3 = 0x20030000 + + HEADERS += inc/untrustedcertificateinfo_symbian.h + SOURCES += src/untrustedcertificatewidget_symbian.cpp \ + src/untrustedcertificateinfo_symbian.cpp + + LIBS += -lcrypto -lx509 -lx500 -lhash -lX509CertNameParser + + pluginstub.sources = untrustedcertdialog.dll + pluginstub.path = /resource/plugins/devicedialogs + DEPLOYMENT += pluginstub +} + +BLD_INF_RULES.prj_exports += \ + "$${LITERAL_HASH}include " \ + "qmakepluginstubs/untrustedcertdialog.qtplugin /epoc32/data/z/pluginstub/untrustedcertdialog.qtplugin" \ + "rom/untrustedcertdialog.iby CORE_MW_LAYER_IBY_EXPORT_PATH(untrustedcertdialog.iby)" \ + "rom/untrustedcertdialog_resources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(untrustedcertdialog_resources.iby)" + diff -r 63339781d179 -r 09b1ac925e3f pkiutilities/x509certnameparser/group/X509CertNameParser.mmp --- a/pkiutilities/x509certnameparser/group/X509CertNameParser.mmp Thu Aug 19 10:45:23 2010 +0300 +++ b/pkiutilities/x509certnameparser/group/X509CertNameParser.mmp Tue Aug 31 16:04:40 2010 +0300 @@ -39,7 +39,7 @@ CAPABILITY CAP_GENERAL_DLL VENDORID VID_DEFAULT -#if defined(ARMCC) +#if defined( EABI ) deffile ../EABI/ #elif defined( WINSCW ) deffile ../BWINSCW/ diff -r 63339781d179 -r 09b1ac925e3f remotelock/RemoteLockEngine/Src/RemoteLock.cpp --- a/remotelock/RemoteLockEngine/Src/RemoteLock.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/remotelock/RemoteLockEngine/Src/RemoteLock.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -33,6 +33,7 @@ #include #endif //RD_MULTIPLE_DRIVE #include +#include #include #include #include @@ -625,7 +626,7 @@ if ( !iProfileSession ) { RL_TRACE_PRINT(" [ rl.exe ] CheckSettingsL() create session "); - iProfileSession = CRepository::NewL( KCRUidProfileEngine ); + iProfileSession = CRepository::NewL( KCRUidCoreApplicationUIs ); // previously it was KCRUidProfileEngine } if ( !iObserver ) { @@ -655,7 +656,7 @@ if ( !iProfileSession ) { RL_TRACE_PRINT(" [ rl.exe ] CheckSettingsL() create session "); - iProfileSession = CRepository::NewL( KCRUidProfileEngine ); + iProfileSession = CRepository::NewL( KCRUidCoreApplicationUIs ); // previously it was KCRUidProfileEngine } ProfileNotifyL( EFalse ); delete iProfileSession; @@ -1458,7 +1459,10 @@ if ( aNotifyEnable ) { - TInt err = iProfileSession->Get( KProEngActiveProfile, iCurrentProfile ); + TInt err = iProfileSession->Get( KCoreAppUIsNetworkConnectionAllowed , iCurrentProfile ); // previously was KProEngActiveProfile + RL_TRACE_PRINT_NUM("[rl.exe] HandleNotifyGeneric() err = %d", err ); + RL_TRACE_PRINT_NUM("[rl.exe] HandleNotifyGeneric() iCurrentProfile = %d", iCurrentProfile ); + User::LeaveIfError( err ); RL_TRACE_PRINT(" [ rl.exe ] ProfileNotifyL() startlisten"); iProfileNotifyHandler->StartListeningL(); @@ -1486,7 +1490,9 @@ { RL_TRACE_PRINT(" [ rl.exe ] GetProfile() "); TInt err; - err = iProfileSession->Get( KProEngActiveProfile, aProfile ); + err = iProfileSession->Get( KCoreAppUIsNetworkConnectionAllowed , aProfile ); // previously was KProEngActiveProfile + RL_TRACE_PRINT_NUM("[rl.exe] HandleNotifyGeneric() err = %d", err ); + RL_TRACE_PRINT(" [ rl.exe ] exit GetProfile() "); return ( err == KErrNone ); } @@ -1505,8 +1511,9 @@ TInt profile = 0; GetProfile( profile ); - - if ( ( profile == EProfileOffLineId ) && ( iIsEnabled ) && ( iCurrentProfile != EProfileOffLineId )) + RL_TRACE_PRINT_NUM("[rl.exe] HandleNotifyGeneric() profile = %d", profile ); + RL_TRACE_PRINT_NUM("[rl.exe] HandleNotifyGeneric() iCurrentProfile = %d", iCurrentProfile ); + if ( ( profile == ECoreAppUIsNetworkConnectionNotAllowed ) && ( iIsEnabled ) && ( iCurrentProfile != ECoreAppUIsNetworkConnectionNotAllowed )) { ActivateDeviceLock(); } diff -r 63339781d179 -r 09b1ac925e3f secsrv_plat/devenccommonutils_api/inc/DevEncDiskUtils.h --- a/secsrv_plat/devenccommonutils_api/inc/DevEncDiskUtils.h Thu Aug 19 10:45:23 2010 +0300 +++ b/secsrv_plat/devenccommonutils_api/inc/DevEncDiskUtils.h Tue Aug 31 16:04:40 2010 +0300 @@ -43,7 +43,7 @@ static void DoVerifyTestFileL(); static TInt64 FindCriticalLevelTresholdL(); static TInt FindValueL( const TUid aRepositoryUid, const TUint aCRKey ); - static TInt64 FindWarningLevelTresholdL( const TDriveNumber aNumber ); + static TInt64 FindWarningLevelTresholdL(); }; #endif // DEVENCDISKUTILS_H diff -r 63339781d179 -r 09b1ac925e3f secsrv_plat/devicelock_access_api/group/ABLD.BAT --- a/secsrv_plat/devicelock_access_api/group/ABLD.BAT Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -@ECHO OFF - -REM Bldmake-generated batch file - ABLD.BAT -REM ** DO NOT EDIT ** - -perl -S ABLD.PL "\s60\mw\devicemanagement\devmngt_dom\devicelock_access_api\group\\" %1 %2 %3 %4 %5 %6 %7 %8 %9 -if errorlevel==1 goto CheckPerl -goto End - -:CheckPerl -perl -v >NUL -if errorlevel==1 echo Is Perl, version 5.003_07 or later, installed? -goto End - -:End diff -r 63339781d179 -r 09b1ac925e3f secsrv_plat/keyguard_access_api/group/ABLD.BAT --- a/secsrv_plat/keyguard_access_api/group/ABLD.BAT Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -@ECHO OFF - -REM Bldmake-generated batch file - ABLD.BAT -REM ** DO NOT EDIT ** - -perl -S ABLD.PL "\s60\mw\devicemanagement\devmngt_dom\keyguard_access_api\group\\" %1 %2 %3 %4 %5 %6 %7 %8 %9 -if errorlevel==1 goto CheckPerl -goto End - -:CheckPerl -perl -v >NUL -if errorlevel==1 echo Is Perl, version 5.003_07 or later, installed? -goto End - -:End diff -r 63339781d179 -r 09b1ac925e3f secsrv_plat/lockapp_server_api/group/ABLD.BAT --- a/secsrv_plat/lockapp_server_api/group/ABLD.BAT Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -@ECHO OFF - -REM Bldmake-generated batch file - ABLD.BAT -REM ** DO NOT EDIT ** - -perl -S ABLD.PL "\s60\mw\devicemanagement\devmngt_dom\lockapp_server_api\group\\" %1 %2 %3 %4 %5 %6 %7 %8 %9 -if errorlevel==1 goto CheckPerl -goto End - -:CheckPerl -perl -v >NUL -if errorlevel==1 echo Is Perl, version 5.003_07 or later, installed? -goto End - -:End diff -r 63339781d179 -r 09b1ac925e3f secsrv_plat/security_code_ui_api/inc/SecUi.h --- a/secsrv_plat/security_code_ui_api/inc/SecUi.h Thu Aug 19 10:45:23 2010 +0300 +++ b/secsrv_plat/security_code_ui_api/inc/SecUi.h Tue Aug 31 16:04:40 2010 +0300 @@ -21,6 +21,14 @@ #ifndef __SECUI_H #define __SECUI_H +#if defined(_DEBUG) +#define RDEBUG( x, y ) RDebug::Printf( "%s %s (%u) %s=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, x, y ); +#define RDEBUGSTR( x ) RDebug::Print( x ); +#else +#define RDEBUG( x, y ) +#define RDEBUGSTR( x ) +#endif + class TSecUi { public: @@ -36,12 +44,6 @@ * Should be called after finished using SecUi methods */ IMPORT_C static void UnInitializeLib(); - /** - * Returns the resource file name of SecurityUI dll. - * - * @return TFileName (resource file name) - */ - static TFileName ResourceFileName(); /** * Check if SecUi can be uninitialized, i.e. if client count is zero (or less). * @@ -75,6 +77,7 @@ private: TInt iResourceFileOffset; TInt iClientCount; + TInt iDialogOpened; }; #endif diff -r 63339781d179 -r 09b1ac925e3f secsrv_plat/security_code_ui_api/inc/SecUiCodeQueryDialog.h --- a/secsrv_plat/security_code_ui_api/inc/SecUiCodeQueryDialog.h Thu Aug 19 10:45:23 2010 +0300 +++ b/secsrv_plat/security_code_ui_api/inc/SecUiCodeQueryDialog.h Tue Aug 31 16:04:40 2010 +0300 @@ -17,15 +17,12 @@ * */ - #ifndef __SECUICODEQUERYDIALOG__ #define __SECUICODEQUERYDIALOG__ -#include -#include #include -class CCodeQueryDialog : public CAknTextQueryDialog +class CCodeQueryDialog : public CBase { public://construction and destruction /** @@ -40,73 +37,7 @@ * Destructor. */ ~CCodeQueryDialog(); - public: - /** - * Allows dismissing of code queries. Only mandatory requirement is that PIN - * queries are dismissed by the # - * - * @param aKeyEvent TKeyEvent& - * @return ETrue query is dismissed - * EFalse not dismissed - */ - TBool NeedToDismissQueryL(const TKeyEvent& aKeyEvent); - /** - * Calls the dialog's TryExitL and passes the reason given as a parameter. - * - * @param TInt aReason (The reason for the cancel request) - */ - void TryCancelQueryL(TInt aReason); - protected://from CAknTextQueryDialog - /** - * From CAknTextQueryDialog This function is called by the UIKON dialog framework - * just before the dialog is activated, after it has called - * PreLayoutDynInitL() and the dialog has been sized. - */ - void PreLayoutDynInitL(); - /** - * From CAknTextQueryDialog This function is called by the UIKON framework - * if the user activates a button in the button panel. - * It is not called if the Cancel button is activated, - * unless the EEikDialogFlagNotifyEsc flag is set. - * @param aButtonId The ID of the button that was activated - * @return Should return ETrue if the dialog should exit, and EFalse if it should not. - */ - TBool OkToExitL(TInt aButtonId); - /** - * From CAknTextQueryDialog This function is called by the UIKON dialog framework - * just after a key is pressed - * @param aKeyEvent TKeyEvent& - * @param aType TEventCode - */ - TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); - /** - * From MAknQueryControlObeserver; overrides the default implementation in CAknQueryDialog. - * Gets called by framework when editor sends state event - */ - TBool HandleQueryEditorStateEventL(CAknQueryControl* aQueryControl, TQueryControlEvent aEventType, TQueryValidationStatus aStatus); - - TBool CheckIfEntryTextOk() const; - - void UpdateLeftSoftKeyL(); - private: - void ShowWarningNoteL(); - - /* - * SetIncallBubbleAllowedInUsualL - */ - void SetIncallBubbleAllowedInUsualL(TBool aAllowed); - - private: // DATA - TInt iMinLength; - TInt iMaxLength; - TInt iMode; - TBool iFront; - TInt iAppKey; - TInt iVoiceKey1; - TInt iVoiceKey2; - TInt iEndKey; - TBool iIsRemoteLockQuery; }; #endif diff -r 63339781d179 -r 09b1ac925e3f secsrv_plat/security_code_ui_api/inc/SecUiSecurityHandler.h --- a/secsrv_plat/security_code_ui_api/inc/SecUiSecurityHandler.h Thu Aug 19 10:45:23 2010 +0300 +++ b/secsrv_plat/security_code_ui_api/inc/SecUiSecurityHandler.h Tue Aug 31 16:04:40 2010 +0300 @@ -112,7 +112,15 @@ */ void RemoveSplashScreenL() const; + /** + * ShowGenericErrorNoteL + */ void ShowGenericErrorNoteL(TInt aStatus); + /** + * CancelOpenQuery + */ + TInt CancelOpenQuery(TInt aStatus); + private: // DATA /***************************************************** * Series 60 Customer / ETel diff -r 63339781d179 -r 09b1ac925e3f secsrv_plat/security_code_ui_api/inc/SecUiSecuritySettings.h --- a/secsrv_plat/security_code_ui_api/inc/SecUiSecuritySettings.h Thu Aug 19 10:45:23 2010 +0300 +++ b/secsrv_plat/security_code_ui_api/inc/SecUiSecuritySettings.h Tue Aug 31 16:04:40 2010 +0300 @@ -26,6 +26,9 @@ #include #include +#define KSecUiAskNever 1 +#define KSecUiAskOnlyIfInvalid 2 +#define KSecUiAskAlways 3 class CWait; class CSecurityHandler; @@ -175,6 +178,27 @@ TInt RemoteLockCodeQueryL( TDes& aRemoteLockCode ); + /** + * Same functions, taking parameters. This is used in QT because the Settings handles it. + * + * @param aOldPassword RMobilePhone::TMobilePassword : current password, probably asked to the user by other means + * @param aNewPassword RMobilePhone::TMobilePassword : current password, probably asked to the user by other means + * @param aFlags TInt : when to ask for the password + * @param aCaption TDes& : caption to show in the dialog. If NULL, then the function will calculate it. If empty, it will be empty + * @param aShowError TInt : in case of error, it will show it. If this is not set, then no errors will be displayed. + * @return TInt: KErrNone (succesful) , KErrGsm0707IncorrectPassword, KErrAccessDenied, KErrGsmSSPasswordAttemptsViolation, KErrLocked, KErrGsm0707OperationNotAllowed, KErrAbort, KErrNotSupported, ... + */ + IMPORT_C TInt ChangePinParamsL(RMobilePhone::TMobilePassword aOldPassword, RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, TDes& aCaption, TInt aShowError); + IMPORT_C TInt ChangeUPinParamsL(RMobilePhone::TMobilePassword aOldPassword, RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, TDes& aCaption, TInt aShowError); + IMPORT_C TInt ChangePin2ParamsL(RMobilePhone::TMobilePassword aOldPassword, RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, TDes& aCaption, TInt aShowError); + IMPORT_C TInt ChangeSecCodeParamsL(RMobilePhone::TMobilePassword aOldPassword, RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, TDes& aCaption, TInt aShowError); + IMPORT_C TInt ChangeAutoLockPeriodParamsL(TInt aPeriod, RMobilePhone::TMobilePassword aOldPassword, TInt aFlags, TDes& aCaption, TInt aShowError); + /* if aOldPassword is used, then try to verify. + KSecUiAskNever, KSecUiAskOnlyIfInvalid, KSecUiAskAlways + */ + IMPORT_C TInt AskSecCodeParamsL(RMobilePhone::TMobilePassword &aOldPassword, TInt aFlags, TDes& aCaption, TInt aShowError); + IMPORT_C TInt ChangePinRequestParamsL(TInt aEnable, RMobilePhone::TMobilePassword aOldPassword, TInt aFlags, TDes& aCaption, TInt aShowError); + private: TInt RemoteLockSetLockSettingL( TBool aLockSetting ); diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/Autolock.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/Autolock.loc Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,13 @@ +// ============================================================================ +// * Generated by qmake (2.01a) (Qt 4.6.2) on: 2010-03-17T08:18:14 +// * This file is generated by qmake and should not be modified by the +// * user. +// ============================================================================ + +#ifdef LANGUAGE_SC +#define STRING_r_short_caption "Autolock" +#define STRING_r_caption "Autolock" +#else +#define STRING_r_short_caption "Autolock" +#define STRING_r_caption "Autolock" +#endif diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/Autolock.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/Autolock.pro Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,70 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, version 2.1 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, +# see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +# +# Description: +# + +TEMPLATE=app +TARGET=Autolock + +CONFIG += service +CONFIG += Hb + +CONFIG += mobility +MOBILITY = publishsubscribe + +#TRANSLATIONS = autolock.ts + +XQSERVICE_ROOT=../.. +#include(../../xqservicebase.pri) +include(src/Autolock.pri) + +LIBS+=-lxqservice -lxqserviceutil -lflogger +LIBS += -L../../../../../bin/release -lautolockuseractivityservice +LIBS += -lsecui -letelmm -letel -lcustomapi -lcentralrepository +LIBS += -lcone -lws32 -lkeylockpolicyapi +LIBS += -lpower_save_display_mode +LIBS += -ltstaskmonitorclient # for TsTaskSettings +LIBS += -lavkon # for KeySounds + +SERVICE.FILE = service_conf.xml +SERVICE.OPTIONS = embeddable +SERVICE.OPTIONS += hidden + +libFiles.sources = Autolock.exe +#libFiles.path = "!:\sys\bin" +DEPLOYMENT += libFiles + +RESOURCES += Autolock.qrc + +symbian*: { + TARGET.CAPABILITY = CAP_APPLICATION + TARGET.UID3 = 0x100059B5 + crmlFiles.sources = autolock.qcrml + crmlFiles.path = /resource/qt/crml + DEPLOYMENT += crmlFiles +} + +BLD_INF_RULES.prj_exports += "./rom/Autolock.iby CORE_APP_LAYER_IBY_EXPORT_PATH(Autolock.iby)" +BLD_INF_RULES.prj_exports += "./conf/Autolock.confml MW_LAYER_CONFML(Autolock.confml)" +BLD_INF_RULES.prj_exports += "./conf/lock.confml MW_LAYER_CONFML(lock.confml)" +# remove CI_autolock.confml because CI already exports it +# BLD_INF_RULES.prj_exports += "./conf/CI_Autolock.confml MW_LAYER_CONFML(CI_Autolock.confml)" +BLD_INF_RULES.prj_exports += "./rom/AutolockSrv.iby CORE_APP_LAYER_IBY_EXPORT_PATH(AutolockSrv.iby)" +BLD_INF_RULES.prj_exports += "./PubSub/SecurityUIsPrivatePSKeys.h |../../inc/securityuisprivatepskeys.h" + +BLD_INF_RULES.prj_exports += "./conf/lock_10283322.crml MW_LAYER_CRML(lock_10283322.crml)" \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/Autolock.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/Autolock.qrc Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,6 @@ + + + iconnotifier.svg + qtg_large_device_lock.svg + + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/Autolock.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/Autolock.rss Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,21 @@ +// ============================================================================ +// * Generated by qmake (2.01a) (Qt 4.6.3) on: 2010-05-24T09:03:31 +// * This file is generated by qmake and should not be modified by the +// * user. +// ============================================================================ + +#include +#include + +RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info + { + short_caption = STRING_r_short_caption; + caption_and_icon = + CAPTION_AND_ICON_INFO + { + caption = STRING_r_caption; + number_of_icons = 0; + icon_file = ""; + }; + } + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/Autolock_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/Autolock_reg.rss Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,57 @@ +// ============================================================================ +// * Generated by qmake (2.01a) (Qt 4.6.3) on: 2010-05-19T16:00:27 +// * This file is generated by qmake and should not be modified by the +// * user. +// ============================================================================ + +#include +#include + +UID2 KUidAppRegistrationResourceFile +UID3 0x100059B5 + + + +/* xqsreg.exe fingerprint */ +#include +STRUCT SERVICE_CONFIGURATION {LTEXT xmldata;} +STRUCT SERVICE_CONFIGURATION_ARRAY {STRUCT service_configuration_array[];} + +RESOURCE APP_REGISTRATION_INFO + { + + embeddability = KAppEmbeddable; + hidden = KAppIsHidden; + newfile = KAppDoesNotSupportNewFile; + service_list = + { + SERVICE_INFO + { + uid = KXQServiceUid; + datatype_list = {}; + opaque_data = r_service_configuration_reg; + } + }; + + app_file="Autolock"; + localisable_resource_file="\\resource\\apps\\Autolock"; + + } + + +RESOURCE SERVICE_CONFIGURATION_ARRAY r_service_configuration_reg + { + service_configuration_array= + { + SERVICE_CONFIGURATION + { + xmldata = " com.nokia.services.Autolock No path really Autolock Autolock 2.0 Interface"; + } + , + SERVICE_CONFIGURATION + { + xmldata = " to Autolock "; + } + + }; + } diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/Autolock_reg.rss.back --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/Autolock_reg.rss.back Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,57 @@ +// ============================================================================ +// * Generated by qmake (2.01a) (Qt 4.6.3) on: 2010-05-19T16:00:27 +// * This file is generated by qmake and should not be modified by the +// * user. +// ============================================================================ + +#include +#include + +UID2 KUidAppRegistrationResourceFile +UID3 0xE0022E73 + + + +/* xqsreg.exe fingerprint */ +#include +STRUCT SERVICE_CONFIGURATION {LTEXT xmldata;} +STRUCT SERVICE_CONFIGURATION_ARRAY {STRUCT service_configuration_array[];} + +RESOURCE APP_REGISTRATION_INFO + { + + embeddability = KAppEmbeddable; + hidden = KAppIsHidden; + newfile = KAppDoesNotSupportNewFile; + service_list = + { + SERVICE_INFO + { + uid = KXQServiceUid; + datatype_list = {}; + opaque_data = r_service_configuration_reg; + } + }; + + app_file="AutolockSrv"; + localisable_resource_file="\\resource\\apps\\AutolockSrv"; + + } + + +RESOURCE SERVICE_CONFIGURATION_ARRAY r_service_configuration_reg + { + service_configuration_array= + { + SERVICE_CONFIGURATION + { + xmldata = " com.nokia.services.AutolockSrv No path really AutolockSrv AutolockSrv 2.0 Interface"; + } + , + SERVICE_CONFIGURATION + { + xmldata = " to AutolockSrv "; + } + + }; + } diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/Autolock_template.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/Autolock_template.pkg Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,39 @@ +; Autolock_template.pkg generated by qmake at 2010-05-24T09:03:30 +; This file is generated by qmake and should not be modified by the user +; + +; Language +&EN + + +; SIS header: name, uid, version +#{"Autolock"},(0x100059B5),1,0,0 + +; Localised Vendor name +%{"Vendor"} + +; Unique Vendor name +:"Vendor" + + +; Manual PKG pre-rules from PRO files +; Default dependency to Qt libraries +(0x2001E61C), 4, 6, 3, {"Qt"} +; Default HW/platform dependencies +[0x101F7961],0,0,0,{"S60ProductID"} +[0x102032BE],0,0,0,{"S60ProductID"} +[0x102752AE],0,0,0,{"S60ProductID"} +[0x1028315F],0,0,0,{"S60ProductID"} + +; Default dependency to QtMobility libraries +(0x2002AC89), 1, 0, 0, {"QtMobility"} + +; Executable and default resource files +"/epoc32/release/$(PLATFORM)/$(TARGET)/Autolock.exe" - "!:\sys\bin\Autolock.exe" +"/epoc32/data/z/resource/apps/Autolock.rsc" - "!:\resource\apps\Autolock.rsc" +"/epoc32/data/z/private/10003a3f/import/apps/Autolock_reg.rsc" - "!:\private\10003a3f\import\apps\Autolock_reg.rsc" +; DEPLOYMENT +"/epoc32/release/$(PLATFORM)/$(TARGET)/Autolock.exe" - "!:\sys\bin\Autolock.exe" +"/epoc32/data/z/resource/qt/crml/autolock.qcrml" - "!:\resource\qt\crml\autolock.qcrml" + +; Manual PKG post-rules from PRO files diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/CenRep/AutolockPrivateCRKeys.h --- a/securitydialogs/Autolock/CenRep/AutolockPrivateCRKeys.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2004 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: Autolock local variation Central Repository keys. -* -*/ - - -#ifndef AUTOLOCKPRIVATECRKEYS_H -#define AUTOLOCKPRIVATECRKEYS_H - -// ============================================================================= -// Autolock Configuration API -// ============================================================================= -const TUid KCRUidAutolockConf = { 0x102824AE }; - -/** -* Bitmask used in configuring automatic keylock. -*/ -const TUint32 KAutoKeyLockConf = 0x00000001; - -// ============================================================================= -// Automatic Keylock Local Variation constants (KAutoKeyLockConf) -// ============================================================================= - -/** -* KAutolockFeatureIdFlipOpenDisabled is an on/off setting for -* disabling automatic keyguard locking when flip is open. By default off. -* Possible values: 0 (locking enabled), 1 (locking diabled) <-- -*/ -const TInt KAutoKeylockFeatureIdFlipOpenDisabled= 0x01; // 2^0 - -#endif diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/Keyguard_enabled.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/Keyguard_enabled.svg Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,1949 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/PubSub/SecurityUIsPrivatePSKeys.h --- a/securitydialogs/Autolock/PubSub/SecurityUIsPrivatePSKeys.h Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/Autolock/PubSub/SecurityUIsPrivatePSKeys.h Tue Aug 31 16:04:40 2010 +0300 @@ -12,8 +12,8 @@ * Contributors: * * Description: Private Publish&Subscribe definitions of the -* Security UIs subsystem -* + * Security UIs subsystem + * */ @@ -32,24 +32,25 @@ // Use TUid KPSUidSecurityUIs = { 0x100059b5 } /** -* Used by SecUI to differentiate between ETel API originated and SecUI originated -* security queries. -* Old Shared Data constant name: KSecUIOriginatedQuery -*/ + * Used by SecUI to differentiate between ETel API originated and SecUI originated + * security queries. + * Old Shared Data constant name: KSecUIOriginatedQuery + */ const TUint32 KSecurityUIsSecUIOriginatedQuery = 0x00000301; enum TSecurityUIsSecUIOriginatedQuery { ESecurityUIsSecUIOriginatedUninitialized = 0, ESecurityUIsETelAPIOriginated, ESecurityUIsSecUIOriginated, - ESecurityUIsSystemLockOriginated + ESecurityUIsSystemLockOriginated, + ESecurityUIsFpsOriginated }; /** -* Used by SecUI to tell if a query request set by some ETELMM API lock setting function (i.e. SetXXXXSetting) -* has been canceled sinnce canceling the setting request does not prompt a query cancel event from ETEL. -* Old Shared Data constant name: KSecUIOriginatedQuery -*/ + * Used by SecUI to tell if a query request set by some ETELMM API lock setting function (i.e. SetXXXXSetting) + * has been canceled since canceling the setting request does not prompt a query cancel event from ETEL. + * Old Shared Data constant name: KSecUIOriginatedQuery + */ const TUint32 KSecurityUIsQueryRequestCancel = 0x00000302; enum TSecurityUIsQueryRequestCancel { @@ -58,7 +59,58 @@ ESecurityUIsQueryRequestCanceled }; -#endif // SECURITYUISPRIVATEPSKEYS_H +/** + * Used by Autolock to tell which application has enabled/disabled the keyguard/devicelock , and at which moment. + */ +const TUint32 KSecurityUIsLockInitiatorUID = 0x00000303; +const TUint32 KSecurityUIsLockInitiatorTimeHigh = 0x00000304; +const TUint32 KSecurityUIsLockInitiatorTimeLow = 0x00000305; + +/** + * Used by Autolock to tell the status of screensaver + */ +const TUint32 KSecurityUIsScreenSaverStatus = 0x00000306; +enum TSecurityUIsScreenSaverValues + { + ESecurityUIsScreenSaverUninitialized = 0, + ESecurityUIsScreenSaverOn, + ESecurityUIsScreenSaverOff, + ESecurityUIsScreenSaverOffWhileUnguardQuery, + ESecurityUIsScreenSaverOffWhileUnlockQuery, + ESecurityUIsScreenSaverLastValue + }; + +/** + * Used by any applicattion, to send a Code for Secui + */ +const TUint32 KSecurityUIsTestCode = 0x00000307; + +/** + * Used to tell SysAp to switch-on the lights. + */ +const TUint32 KSecurityUIsLights = 0x00000308; +enum TSecurityUIsLights + { + ESecurityUIsLightsUninitialized = 0, + ESecurityUIsLightsLockOnRequest, + ESecurityUIsLightsQueryOnRequest, + ESecurityUIsLightsLockOffRequest, + ESecurityUIsLightsLastValue + }; + +/** + * Used by Autolock to tell the dialog to dismiss. In fact, any app can do this. + */ +const TUint32 KSecurityUIsDismissDialog = 0x00000309; +enum TSecurityUIsDismissDialogValues + { + ESecurityUIsDismissDialogUninitialized = 0, + ESecurityUIsDismissDialogOn, + ESecurityUIsDismissDialogProcessing, + ESecurityUIsDismissDialogDone, + ESecurityUIsDismissDialogLastValue + }; + +#endif // SECURITYUISPRIVATEPSKEYS_H // End of File - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/aif/Autolockaif.rss --- a/securitydialogs/Autolock/aif/Autolockaif.rss Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2002 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: -* RSS for creating the aif file for Autolock. -* -* -*/ - - -#include - -RESOURCE AIF_DATA -{ - app_uid=0x100059B5; - hidden = KAppIsHidden; - num_icons = 0; - embeddability = KAppNotEmbeddable; - newfile = KAppDoesNotSupportNewFile; -} - -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/autolock.qcrml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolock.qcrml Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/autolockuseractivityservice.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice.pro Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,19 @@ +# +# Copyright (c) 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: autolockuseractivityservice.pro +# + +TEMPLATE = subdirs + +SUBDIRS += autolockuseractivityservice/autolockuseractivityservice.pro diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/autolockuseractivityservice/autolockuseractivityservice.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/autolockuseractivityservice.pri Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,26 @@ +# +# Copyright (c) 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: autolockuseractivityservice.pri +# + +HEADERS += ./inc/*.h + +SOURCES += ./src/*.cpp + +INCLUDEPATH += . \ + inc + +DEPENDPATH += . \ + inc \ + src diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/autolockuseractivityservice/autolockuseractivityservice.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/autolockuseractivityservice.pro Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,32 @@ +# +# Copyright (c) 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: autolockuseractivityservice.pro +# + +TEMPLATE = lib + +include(common.pri) + +DEFINES += AUTOLOCKUSERACTIVITYSERVICE_LIB + +symbian: { +TARGET.UID3 = 0x2002704D +LIBS += -lactivitymanager + +include(autolockuseractivityservice_s60.pri) +} else { +include(autolockuseractivityservice_stub.pri) +} + +include(autolockuseractivityservice.pri) diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/autolockuseractivityservice/autolockuseractivityservice_s60.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/autolockuseractivityservice_s60.pri Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,24 @@ +# +# Copyright (c) 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: autolockuseractivityservice_s60.pri +# + +HEADERS += ./s60/inc/*.h + +SOURCES += ./s60/src/*.cpp + +INCLUDEPATH += ./s60/inc + +DEPENDPATH += ./s60/inc \ + ./s60/src diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/autolockuseractivityservice/autolockuseractivityservice_stub.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/autolockuseractivityservice_stub.pri Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,24 @@ +# +# Copyright (c) 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: autolockuseractivityservice_stub.pri +# + +HEADERS += ./stub/inc/*.h + +SOURCES += ./stub/src/*.cpp + +INCLUDEPATH += ./stub/inc + +DEPENDPATH += ./stub/inc \ + ./stub/src diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/autolockuseractivityservice/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/bld.inf Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,41 @@ +// ============================================================================ +// * Makefile for building: autolockuseractivityservice +// * Generated by qmake (2.01a) (Qt 4.6.3) on: 2010-05-20T15:50:24 +// * This file is generated by qmake and should not be modified by the +// * user. +// * Project: autolockuseractivityservice.pro +// * Template: lib +// ============================================================================ + +#define BLD_INF_AUTOLOCKUSERACTIVITYSERVICE_FB812CD7 + + +prj_platforms + +WINSCW GCCE ARMV5 ARMV6 + + +prj_mmpfiles + +autolockuseractivityservice_0x2002704D.mmp + +prj_extensions + +START EXTENSION qt/qmake_extra_pre_targetdep.export +OPTION PREDEP_TARGET E:/sf/mw/securitysrv/securitydialogs/Autolock/autolockuseractivityservice/moc_autolockuseractivityservice.cpp +OPTION DEPS E:/sf/mw/securitysrv/securitydialogs/Autolock/autolockuseractivityservice/inc/autolockuseractivityserviceinterface.h E:/sf/mw/securitysrv/securitydialogs/Autolock/autolockuseractivityservice/inc/autolockuseractivityservice_global.h E:/sf/mw/securitysrv/securitydialogs/Autolock/autolockuseractivityservice/inc/autolockuseractivityservice.h +OPTION COMMAND /epoc32/tools/moc -DSYMBIAN -DUNICODE -DQT_KEYPAD_NAVIGATION -DQT_SOFTKEYS_ENABLED -DQT_USE_MATH_H_FLOATS -DAUTOLOCKUSERACTIVITYSERVICE_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I"E:/epoc32/include/mw/QtCore" -I"E:/epoc32/include/mw/QtGui" -I"E:/epoc32/include/mw" -I"E:/sf/mw/qt/mkspecs/common/symbian" -I"E:/epoc32/include" -I"E:/epoc32/include/stdapis" -I"E:/epoc32/include/stdapis/sys" -I"E:/sf/mw/securitysrv/securitydialogs/Autolock/autolockuseractivityservice" -I"E:/sf/mw/securitysrv/securitydialogs/Autolock/autolockuseractivityservice/inc" -I"E:/epoc32/include/platform/mw" -I"E:/epoc32/include/platform" -I"E:/epoc32/include/app" -I"E:/epoc32/include/platform/app" -I"E:/epoc32/include/platform/loc" -I"E:/epoc32/include/platform/mw/loc" -I"E:/epoc32/include/platform/app/loc" -I"E:/epoc32/include/platform/loc/sc" -I"E:/epoc32/include/platform/mw/loc/sc" -I"E:/epoc32/include/platform/app/loc/sc" -I"E:/sf/mw/securitysrv/securitydialogs/Autolock/autolockuseractivityservice/s60/inc" -I"E:/epoc32/include/stdapis/stlportv5" -I"E:/sf/mw/securitysrv/securitydialogs/Autolock/autolockuseractivityservice/s60/src" -I"E:/sf/mw/securitysrv/securitydialogs/Autolock/autolockuseractivityservice/src" -DSYMBIAN e:/sf/mw/securitysrv/securitydialogs/Autolock/autolockuseractivityservice/inc/autolockuseractivityservice.h -o e:/sf/mw/securitysrv/securitydialogs/Autolock/autolockuseractivityservice/moc_autolockuseractivityservice.cpp +END +START EXTENSION qt/qmake_extra_pre_targetdep.export +OPTION PREDEP_TARGET E:/sf/mw/securitysrv/securitydialogs/Autolock/autolockuseractivityservice/moc_autolockuseractivityserviceinterface.cpp +OPTION DEPS E:/sf/mw/securitysrv/securitydialogs/Autolock/autolockuseractivityservice/inc/autolockuseractivityserviceinterface.h +OPTION COMMAND /epoc32/tools/moc -DSYMBIAN -DUNICODE -DQT_KEYPAD_NAVIGATION -DQT_SOFTKEYS_ENABLED -DQT_USE_MATH_H_FLOATS -DAUTOLOCKUSERACTIVITYSERVICE_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I"E:/epoc32/include/mw/QtCore" -I"E:/epoc32/include/mw/QtGui" -I"E:/epoc32/include/mw" -I"E:/sf/mw/qt/mkspecs/common/symbian" -I"E:/epoc32/include" -I"E:/epoc32/include/stdapis" -I"E:/epoc32/include/stdapis/sys" -I"E:/sf/mw/securitysrv/securitydialogs/Autolock/autolockuseractivityservice" -I"E:/sf/mw/securitysrv/securitydialogs/Autolock/autolockuseractivityservice/inc" -I"E:/epoc32/include/platform/mw" -I"E:/epoc32/include/platform" -I"E:/epoc32/include/app" -I"E:/epoc32/include/platform/app" -I"E:/epoc32/include/platform/loc" -I"E:/epoc32/include/platform/mw/loc" -I"E:/epoc32/include/platform/app/loc" -I"E:/epoc32/include/platform/loc/sc" -I"E:/epoc32/include/platform/mw/loc/sc" -I"E:/epoc32/include/platform/app/loc/sc" -I"E:/sf/mw/securitysrv/securitydialogs/Autolock/autolockuseractivityservice/s60/inc" -I"E:/epoc32/include/stdapis/stlportv5" -I"E:/sf/mw/securitysrv/securitydialogs/Autolock/autolockuseractivityservice/s60/src" -I"E:/sf/mw/securitysrv/securitydialogs/Autolock/autolockuseractivityservice/src" -DSYMBIAN e:/sf/mw/securitysrv/securitydialogs/Autolock/autolockuseractivityservice/inc/autolockuseractivityserviceinterface.h -o e:/sf/mw/securitysrv/securitydialogs/Autolock/autolockuseractivityservice/moc_autolockuseractivityserviceinterface.cpp +END + +#if defined(WINSCW) +#endif + +START EXTENSION qt/qmake_store_build +END + + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/autolockuseractivityservice/bwins/autolockuseractivityserviceu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/bwins/autolockuseractivityserviceu.def Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,16 @@ +EXPORTS + ?trUtf8@AutolockUserActivityService@@SA?AVQString@@PBD0H@Z @ 1 NONAME ; class QString AutolockUserActivityService::trUtf8(char const *, char const *, int) + ?tr@AutolockUserActivityService@@SA?AVQString@@PBD0@Z @ 2 NONAME ; class QString AutolockUserActivityService::tr(char const *, char const *) + ?trUtf8@AutolockUserActivityService@@SA?AVQString@@PBD0@Z @ 3 NONAME ; class QString AutolockUserActivityService::trUtf8(char const *, char const *) + ?getStaticMetaObject@AutolockUserActivityService@@SAABUQMetaObject@@XZ @ 4 NONAME ; struct QMetaObject const & AutolockUserActivityService::getStaticMetaObject(void) + ?setInactivityPeriod@AutolockUserActivityService@@UAEXH@Z @ 5 NONAME ; void AutolockUserActivityService::setInactivityPeriod(int) + ?tr@AutolockUserActivityService@@SA?AVQString@@PBD0H@Z @ 6 NONAME ; class QString AutolockUserActivityService::tr(char const *, char const *, int) + ?qt_metacast@AutolockUserActivityService@@UAEPAXPBD@Z @ 7 NONAME ; void * AutolockUserActivityService::qt_metacast(char const *) + ??1AutolockUserActivityService@@UAE@XZ @ 8 NONAME ; AutolockUserActivityService::~AutolockUserActivityService(void) + ?qt_metacall@AutolockUserActivityService@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 9 NONAME ; int AutolockUserActivityService::qt_metacall(enum QMetaObject::Call, int, void * *) + ?inactivityPeriod@AutolockUserActivityService@@UBEHXZ @ 10 NONAME ; int AutolockUserActivityService::inactivityPeriod(void) const + ??0AutolockUserActivityService@@QAE@XZ @ 11 NONAME ; AutolockUserActivityService::AutolockUserActivityService(void) + ??_EAutolockUserActivityService@@UAE@I@Z @ 12 NONAME ; AutolockUserActivityService::~AutolockUserActivityService(unsigned int) + ?staticMetaObject@AutolockUserActivityService@@2UQMetaObject@@B @ 13 NONAME ; struct QMetaObject const AutolockUserActivityService::staticMetaObject + ?metaObject@AutolockUserActivityService@@UBEPBUQMetaObject@@XZ @ 14 NONAME ; struct QMetaObject const * AutolockUserActivityService::metaObject(void) const + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/autolockuseractivityservice/common.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/common.pri Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,66 @@ +# +# Copyright (c) 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: screensaverapp project - common QMake settings +# + +CONFIG += debug_and_release + +# On win32 and mac, debug and release libraries are named differently. +# We must follow the debug and release settings Qt was compiled with: +# build debug iff Qt built debug, build release iff Qt built release. +win32|mac { + !contains(QT_CONFIG,debug)|!contains(QT_CONFIG,release) { + CONFIG -= debug_and_release debug release + contains(QT_CONFIG,debug): CONFIG+=debug + contains(QT_CONFIG,release):CONFIG+=release + } +} + +CONFIG(debug, debug|release) { + SUBDIRPART = debug +} else { + SUBDIRPART = release +} + +SOURCE_DIR = $$PWD/inc + +DESTDIR = $$OUTPUT_DIR + +# Add the output dirs to the link path too +LIBS += -L$$DESTDIR + +DEPENDPATH += . $$SOURCE_DIR +INCLUDEPATH += . $$SOURCE_DIR +#For some reason the default include path doesn't include MOC_DIR on symbian +symbian { + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + TARGET.CAPABILITY = ALL -TCB + TARGET.EPOCALLOWDLLDATA=1 +} + + +plugin: !isEmpty(PLUGIN_SUBDIR): DESTDIR = $$OUTPUT_DIR/$$PLUGIN_SUBDIR + +symbian: plugin { # copy qtstub and manifest + pluginstub.sources = $${TARGET}.dll + pluginstub.path = $$PLUGIN_SUBDIR + + DEPLOYMENT += pluginstub + + qtplugins.path = $$PLUGIN_SUBDIR + qtplugins.sources += qmakepluginstubs/$${TARGET}.qtplugin + qtplugins.sources += resource/$${TARGET}.manifest + + for(qtplugin, qtplugins.sources):BLD_INF_RULES.prj_exports += "./$$qtplugin z:$$qtplugins.path/$$basename(qtplugin)" +} diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/autolockuseractivityservice/eabi/autolockuseractivityserviceu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/eabi/autolockuseractivityserviceu.def Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,16 @@ +EXPORTS + _ZN27AutolockUserActivityService11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME + _ZN27AutolockUserActivityService11qt_metacastEPKc @ 2 NONAME + _ZN27AutolockUserActivityService16staticMetaObjectE @ 3 NONAME DATA 16 + _ZN27AutolockUserActivityService19getStaticMetaObjectEv @ 4 NONAME + _ZN27AutolockUserActivityService19setInactivityPeriodEi @ 5 NONAME + _ZN27AutolockUserActivityServiceC1Ev @ 6 NONAME + _ZN27AutolockUserActivityServiceC2Ev @ 7 NONAME + _ZN27AutolockUserActivityServiceD0Ev @ 8 NONAME + _ZN27AutolockUserActivityServiceD1Ev @ 9 NONAME + _ZN27AutolockUserActivityServiceD2Ev @ 10 NONAME + _ZNK27AutolockUserActivityService10metaObjectEv @ 11 NONAME + _ZNK27AutolockUserActivityService16inactivityPeriodEv @ 12 NONAME + _ZTI27AutolockUserActivityService @ 13 NONAME + _ZTV27AutolockUserActivityService @ 14 NONAME + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/autolockuseractivityservice/inc/autolockuseractivityservice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/inc/autolockuseractivityservice.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 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: autolockuseractivityservice.h +* +*/ + +#ifndef AUTOLOCKAUTOLOCKUSERACTIVITYSERVICE_H +#define AUTOLOCKAUTOLOCKUSERACTIVITYSERVICE_H + +#include "autolockuseractivityserviceinterface.h" +#include "autolockuseractivityservice_global.h" + +class AutolockUserActivityServicePrivate; + +class AUTOLOCKUSERACTIVITYSERVICE_EXPORT AutolockUserActivityService : public AutolockUserActivityServiceInterface +{ + Q_OBJECT + +public: + + explicit AutolockUserActivityService(/*QObject *parent = 0*/); + ~AutolockUserActivityService(); + + virtual void setInactivityPeriod(int seconds); + virtual int inactivityPeriod() const; + +private: + + //virtual void connectNotify(const char *signal); + //virtual void disconnectNotify(const char *signal); + + //bool receiversConnected(); + + Q_DISABLE_COPY(AutolockUserActivityService) + +private: + + AutolockUserActivityServicePrivate *m_d; + friend class AutolockUserActivityServicePrivate; + +}; + +#endif // AUTOLOCKAUTOLOCKUSERACTIVITYSERVICE_H diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/autolockuseractivityservice/inc/autolockuseractivityservice_global.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/inc/autolockuseractivityservice_global.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 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: autolockuseractivityservice_global.h +* +*/ + + +#ifndef AUTOLOCKAUTOLOCKUSERACTIVITYSERVICE_GLOBAL_H +#define AUTOLOCKAUTOLOCKUSERACTIVITYSERVICE_GLOBAL_H + +#include + +#ifdef AUTOLOCKUSERACTIVITYSERVICE_LIB + #define AUTOLOCKUSERACTIVITYSERVICE_EXPORT Q_DECL_EXPORT +#else + #ifdef AUTOLOCKUSERACTIVITYSERVICE_TEST + #define AUTOLOCKUSERACTIVITYSERVICE_EXPORT + #else + #define AUTOLOCKUSERACTIVITYSERVICE_EXPORT Q_DECL_IMPORT + #endif +#endif + +#endif // AUTOLOCKAUTOLOCKUSERACTIVITYSERVICE_GLOBAL_H diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/autolockuseractivityservice/inc/autolockuseractivityserviceinterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/inc/autolockuseractivityserviceinterface.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 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: autolockuseractivityserviceinterface.h +* +*/ + +#ifndef AUTOLOCKUSERACTIVITYSERVICEINTERFACE_H +#define AUTOLOCKUSERACTIVITYSERVICEINTERFACE_H + +#include + +class AutolockUserActivityServiceInterface : public QObject +{ + Q_OBJECT + +public: + + virtual void setInactivityPeriod(int seconds) = 0; + virtual int inactivityPeriod() const = 0; + +signals: + + void notActive(); + void active(); + +}; + +#endif // AUTOLOCKUSERACTIVITYSERVICEINTERFACE_H diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/autolockuseractivityservice/s60/inc/autolockuseractivityservice_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/s60/inc/autolockuseractivityservice_p.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 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: autolockuseractivityservice_p.h +* +*/ + +#ifndef AUTOLOCKUSERACTIVITYSERVICEPRIVATE_H +#define AUTOLOCKUSERACTIVITYSERVICEPRIVATE_H + +class CUserActivityManager; + +class AutolockUserActivityService; + +class AutolockUserActivityServicePrivate +{ + +public: + + explicit AutolockUserActivityServicePrivate(AutolockUserActivityService *servicePublic); + ~AutolockUserActivityServicePrivate(); + + void setInactivityPeriod(int seconds); + int inactivityPeriod() const; + + void watch(bool shouldWatch); + + void emitActive() const; + void emitNotActive() const; + +private: + + bool isWatching() const; + +private: + + AutolockUserActivityService *m_q; + + CUserActivityManager *mActivityManager; + int mInactivityPeriod; + +}; + +#endif // AUTOLOCKUSERACTIVITYSERVICEPRIVATE_H diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/autolockuseractivityservice/s60/src/autolockuseractivityservice_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/s60/src/autolockuseractivityservice_p.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,143 @@ +/* +* Copyright (c) 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: autolockuseractivityservice_p.cpp +* +*/ + +#include "autolockuseractivityservice.h" +#include "autolockuseractivityservice_p.h" +#include + +#include + +const int lDefaultInactivityPeriod(5); + +// ======== LOCAL FUNCTIONS ======== + +/*! + Called as callback to activity event. + \param pointer to activity callback object. + \retval error code. +*/ +TInt activityCallback(TAny *ptr) +{ + RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + + static_cast(ptr)->emitActive(); + // activity manager doesn't care about the return value, + // we return a value indicating 'true' to be elegant (see CIdle) + return 1; +} + +/*! + Called as callback to inactivity event. + \param pointer to inactivity callback object. + \retval error code. +*/ +TInt inactivityCallback(TAny *ptr) +{ + RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + + static_cast(ptr)->emitNotActive(); + // activity manager doesn't care about the return value, + // we return a value indicating 'true' to be elegant (see CIdle) + return 1; +} + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. + \param servicePublic public implementation. +*/ +AutolockUserActivityServicePrivate::AutolockUserActivityServicePrivate(AutolockUserActivityService *servicePublic) : + m_q(servicePublic), mActivityManager(0), mInactivityPeriod(lDefaultInactivityPeriod) +{ + mActivityManager = CUserActivityManager::NewL(CActive::EPriorityStandard); +} + +/*! + Destructor. +*/ +AutolockUserActivityServicePrivate::~AutolockUserActivityServicePrivate() +{ + delete mActivityManager; +} + +/*! + Sets the inactivity period after which to emit signal of inactivity. + \param seconds after which inactivity is detected. +*/ +void AutolockUserActivityServicePrivate::setInactivityPeriod(int seconds) +{ + RDebug::Printf( "%s %s (%u) seconds=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, seconds ); + + mInactivityPeriod = seconds; + // activity manager panics if timeout set before start + if (isWatching()) + { + mActivityManager->SetInactivityTimeout(TTimeIntervalSeconds(mInactivityPeriod)); + } +} + +/*! + Retrives the current inactivity period setting. + \retval inactivity period set. +*/ +int AutolockUserActivityServicePrivate::inactivityPeriod() const +{ + return mInactivityPeriod; +} + +/*! + Starts or stops activity manager user activity watching. + \param shouldWatch determines if we shoul start watching or stop watching. +*/ +void AutolockUserActivityServicePrivate::watch(bool shouldWatch) +{ + RDebug::Printf( "%s %s (%u) shouldWatch=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, shouldWatch ); + if (shouldWatch && !isWatching()) { + mActivityManager->Start( + TTimeIntervalSeconds(mInactivityPeriod), + TCallBack(inactivityCallback, this), + TCallBack(activityCallback, this)); + } else if (!shouldWatch && isWatching()) { + mActivityManager->Cancel(); + } +} + +/*! + Checks if activity service is currently watching for user activity. + \retval true if user acitivity service is active. +*/ +bool AutolockUserActivityServicePrivate::isWatching() const +{ + return mActivityManager && mActivityManager->IsActive(); +} + +/*! + Emits signal that user is active. +*/ +void AutolockUserActivityServicePrivate::emitActive() const +{ + emit m_q->active(); +} + +/*! + Emits signal that user is not active. +*/ +void AutolockUserActivityServicePrivate::emitNotActive() const +{ + emit m_q->notActive(); +} diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/autolockuseractivityservice/src/autolockuseractivityservice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/src/autolockuseractivityservice.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 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: autolockuseractivityservice.cpp +* +*/ + +#include "autolockuseractivityservice.h" +#include "autolockuseractivityservice_p.h" + +/*! + \class AutolockUserActivityService + \brief ?brier_description + + ?Qt_style_documentation +*/ + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. +*/ +AutolockUserActivityService::AutolockUserActivityService() : + m_d(new AutolockUserActivityServicePrivate(this)) +{ + m_d->watch(true); +} + +/*! + Destructor. +*/ +AutolockUserActivityService::~AutolockUserActivityService() +{ + delete m_d; +} + +/*! + Sets the inactivity period after which to emit signal of inactivity. + \param seconds after which inactivity is detected. +*/ +void AutolockUserActivityService::setInactivityPeriod(int seconds) +{ + m_d->setInactivityPeriod(seconds); +} + +/*! + Retrives the current inactivity period setting. + \retval inactivity period set. +*/ +int AutolockUserActivityService::inactivityPeriod() const +{ + return m_d->inactivityPeriod(); +} diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/autolockuseractivityservice/stub/inc/autolockuseractivityservice_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/stub/inc/autolockuseractivityservice_p.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 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: autolockuseractivityservice_p.h +* +*/ + +#ifndef AUTOLOCKUSERACTIVITYSERVICEPRIVATE_H +#define AUTOLOCKUSERACTIVITYSERVICEPRIVATE_H + +#include "autolocktest_global.h" + +class QTimer; + +class AutolockUserActivityService; + +class AutolockUserActivityServicePrivate +{ + +public: + + explicit AutolockUserActivityServicePrivate(AutolockUserActivityService *servicePublic); + ~AutolockUserActivityServicePrivate(); + + void setInactivityPeriod(int seconds); + int inactivityPeriod() const; + + void watch(bool shouldWatch); + +private: + + bool isWatching() const; + +private: + + AutolockUserActivityService *m_q; + + QTimer *mActivityTimer; + QTimer *mInactivityTimer; + + int mInactivityPeriod; + SCREENSAVER_TEST_FRIEND_CLASS(T_AutolockUserActivityService) +}; + +#endif // AUTOLOCKUSERACTIVITYSERVICEPRIVATE_H diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/autolockuseractivityservice/stub/src/autolockuseractivityservice_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/stub/src/autolockuseractivityservice_p.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 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: autolockuseractivityservice_p.cpp +* +*/ + +#include "autolockuseractivityservice.h" +#include "autolockuseractivityservice_p.h" + +#include +#include + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. + \param servicePublic public implementation. +*/ +AutolockUserActivityServicePrivate::AutolockUserActivityServicePrivate(AutolockUserActivityService *servicePublic) : + m_q(servicePublic), mInactivityPeriod(9) +{ + mActivityTimer = new QTimer(); + QObject::connect(mActivityTimer, SIGNAL(timeout()), m_q, SIGNAL(active())); + + mInactivityTimer = new QTimer(); + QObject::connect(mInactivityTimer, SIGNAL(timeout()), m_q, SIGNAL(notActive())); +} + +/*! + Destructor. +*/ +AutolockUserActivityServicePrivate::~AutolockUserActivityServicePrivate() +{ + delete mActivityTimer; + delete mInactivityTimer; +} + +/*! + Sets the inactivity period after which to emit signal of inactivity. + \param seconds after which inactivity is detected. +*/ +void AutolockUserActivityServicePrivate::setInactivityPeriod(int seconds) +{ + mInactivityPeriod = seconds; + if (isWatching()) { + mInactivityTimer->start(seconds * 1000); + } +} + +/*! + Retrives the current inactivity period setting. + \retval inactivity period set. +*/ +int AutolockUserActivityServicePrivate::inactivityPeriod() const +{ + return mInactivityPeriod; +} + +/*! + Starts or stops activity manager user activity watching. + \param shouldWatch determines if we shoul start watching or stop watching. +*/ +void AutolockUserActivityServicePrivate::watch(bool shouldWatch) +{ + if (shouldWatch && !isWatching()) { + mActivityTimer->start(5000); + mInactivityTimer->start(mInactivityPeriod * 1000); + } else if (!shouldWatch && isWatching()) { + mActivityTimer->stop(); + mInactivityTimer->stop(); + } +} + +/*! + Checks if activity service is currently watching for user activity. + \retval true if user acitivity service is active. +*/ +bool AutolockUserActivityServicePrivate::isWatching() const +{ + return (mActivityTimer->isActive() || mInactivityTimer->isActive()); +} + + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/bld.inf Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,794 @@ +// ============================================================================ +// * Makefile for building: Autolock +// * Generated by qmake (2.01a) (Qt 4.7.0) on: 2010-08-07T17:22:57 +// * This file is generated by qmake and should not be modified by the +// * user. +// * Project: Autolock.pro +// * Template: app +// ============================================================================ + +#define BLD_INF_AUTOLOCK_04D793A7 + + +prj_platforms + +WINSCW GCCE ARMV5 ARMV6 + + +prj_mmpfiles + +Autolock_0x100059B5.mmp + +prj_extensions + +START EXTENSION qt/qmake_extra_pre_targetdep.export +OPTION PREDEP_TARGET A:/sf/mw/securitysrv/securitydialogs/Autolock/moc_Autolock.cpp +OPTION DEPS A:/sf/mw/securitysrv/securitydialogs/SecUi/Inc/SecQueryUi.h A:/sf/mw/securitysrv/securitydialogs/Autolock/src/Autolock.h +OPTION COMMAND /epoc32/tools/moc.exe -DSYMBIAN -DUNICODE -DQT_KEYPAD_NAVIGATION -DQT_SOFTKEYS_ENABLED -DQT_USE_MATH_H_FLOATS -DHB_HAVE_QT_MOBILITY -DHB_HAVE_PROTECTED_CHUNK -DHB_TOUCHFEEDBACK_TYPE_IS_LONGPRESS -DHB_GESTURE_FW -DHB_EFFECTS -DHB_TEXT_MEASUREMENT_UTILITY -DHB_HAVE_QT_MOBILITY -DHB_HAVE_PROTECTED_CHUNK -DHB_TOUCHFEEDBACK_TYPE_IS_LONGPRESS -DHB_GESTURE_FW -DHB_EFFECTS -DHB_TEXT_MEASUREMENT_UTILITY -DQT_SVG_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I"A:/epoc32/include/mw/QtCore" -I"A:/epoc32/include/mw/QtNetwork" -I"A:/epoc32/include/mw/QtGui" -I"A:/epoc32/include/mw/QtSvg" -I"A:/epoc32/include/mw" -I"A:/epoc32/include/mw/QtPublishSubscribe" -I"A:/sf/mw/qt/mkspecs/common/symbian" -I"A:/epoc32/include" -I"A:/epoc32/include/stdapis" -I"A:/epoc32/include/stdapis/sys" -I"A:/epoc32/include/platform/mw" -I"A:/epoc32/include/platform" -I"A:/epoc32/include/platform/loc" -I"A:/epoc32/include/platform/mw/loc" -I"A:/epoc32/include/platform/loc/sc" -I"A:/epoc32/include/platform/mw/loc/sc" -I"A:/sf/mw/securitysrv/securitydialogs/Autolock" -I"A:/sf/mw/securitysrv/securitydialogs/Autolock/inc" -I"A:/sf/mw/securitysrv/securitydialogs/Autolock/autolockuseractivityservice" -I"A:/sf/mw/securitysrv/securitydialogs/Autolock/autolockuseractivityservice/inc" -I"A:/QtPublishSubscribe" -I"A:/epoc32/include/mw/hb/hbcore" -I"A:/epoc32/include/mw/hb/hbwidgets" -I"A:/epoc32/include/mw/hb/hbutils" -I"A:/epoc32/include/stdapis/stlportv5" -I"A:/sf/mw/securitysrv/securitydialogs/Autolock/src" -DSYMBIAN a:/sf/mw/securitysrv/securitydialogs/Autolock/src/Autolock.h -o a:/sf/mw/securitysrv/securitydialogs/Autolock/moc_Autolock.cpp +END +START EXTENSION qt/qmake_extra_pre_targetdep.export +OPTION PREDEP_TARGET A:/sf/mw/securitysrv/securitydialogs/Autolock/qrc_Autolock.cpp +OPTION DEPS A:/sf/mw/securitysrv/securitydialogs/Autolock/Autolock.qrc A:/sf/mw/securitysrv/securitydialogs/Autolock/iconnotifier.svg A:/sf/mw/securitysrv/securitydialogs/Autolock/qtg_large_device_lock.svg +OPTION COMMAND /epoc32/tools/rcc.exe -name Autolock a:/sf/mw/securitysrv/securitydialogs/Autolock/Autolock.qrc -o a:/sf/mw/securitysrv/securitydialogs/Autolock/qrc_Autolock.cpp +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ar.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_ar.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ar.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_ar.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ar.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_ar.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_eu.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_eu.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_eu.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_eu.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_eu.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_eu.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_bg.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_bg.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_bg.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_bg.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_bg.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_bg.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ca.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_ca.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ca.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_ca.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ca.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_ca.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_hr.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_hr.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_hr.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_hr.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_hr.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_hr.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_cs.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_cs.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_cs.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_cs.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_cs.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_cs.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_da.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_da.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_da.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_da.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_da.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_da.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_nl.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_nl.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_nl.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_nl.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_nl.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_nl.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_en.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_en.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_en.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_en.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_en.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_en.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_en_US.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_en_US.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_en_US.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_en_US.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_en_US.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_en_US.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_et.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_et.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_et.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_et.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_et.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_et.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_fi.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_fi.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_fi.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_fi.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_fi.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_fi.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_fr.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_fr.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_fr.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_fr.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_fr.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_fr.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_fr_CA.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_fr_CA.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_fr_CA.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_fr_CA.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_fr_CA.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_fr_CA.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_gl.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_gl.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_gl.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_gl.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_gl.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_gl.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_de.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_de.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_de.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_de.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_de.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_de.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_el.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_el.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_el.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_el.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_el.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_el.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_he.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_he.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_he.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_he.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_he.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_he.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_hi.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_hi.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_hi.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_hi.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_hi.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_hi.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_zh_HK.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_zh_HK.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_zh_HK.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_zh_HK.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_zh_HK.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_zh_HK.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_hu.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_hu.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_hu.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_hu.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_hu.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_hu.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_is.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_is.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_is.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_is.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_is.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_is.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_id.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_id.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_id.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_id.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_id.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_id.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_it.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_it.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_it.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_it.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_it.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_it.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ja.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_ja.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ja.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_ja.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ja.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_ja.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ko.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_ko.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ko.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_ko.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ko.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_ko.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_lv.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_lv.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_lv.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_lv.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_lv.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_lv.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_lt.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_lt.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_lt.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_lt.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_lt.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_lt.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ms.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_ms.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ms.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_ms.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ms.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_ms.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_no.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_no.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_no.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_no.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_no.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_no.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_pl.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_pl.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_pl.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_pl.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_pl.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_pl.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_pt.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_pt.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_pt.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_pt.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_pt.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_pt.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_pt_BR.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_pt_BR.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_pt_BR.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_pt_BR.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_pt_BR.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_pt_BR.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_zh.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_zh.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_zh.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_zh.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_zh.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_zh.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ro.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_ro.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ro.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_ro.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ro.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_ro.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ru.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_ru.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ru.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_ru.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ru.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_ru.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_sr.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_sr.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_sr.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_sr.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_sr.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_sr.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_sk.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_sk.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_sk.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_sk.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_sk.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_sk.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_sl.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_sl.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_sl.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_sl.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_sl.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_sl.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_es.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_es.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_es.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_es.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_es.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_es.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_es_419.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_es_419.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_es_419.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_es_419.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_es_419.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_es_419.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_sv.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_sv.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_sv.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_sv.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_sv.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_sv.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_tl.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_tl.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_tl.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_tl.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_tl.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_tl.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_zh_TW.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_zh_TW.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_zh_TW.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_zh_TW.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_zh_TW.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_zh_TW.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_th.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_th.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_th.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_th.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_th.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_th.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_tr.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_tr.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_tr.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_tr.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_tr.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_tr.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_uk.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_uk.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_uk.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_uk.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_uk.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_uk.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ur.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_ur.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ur.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_ur.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_ur.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_ur.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_vi.ts +OPTION QMFILE /epoc32/data/z/resource/qt/translations/calwidget_vi.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_vi.ts +OPTION QMFILE /epoc32/release/winscw/udeb/z/resource/qt/translations/calwidget_vi.qm +END + +START EXTENSION qt/ts2qm +OPTION TSFILE /epoc32/include/platform/qt/translations/calwidget_vi.ts +OPTION QMFILE /epoc32/release/winscw/urel/z/resource/qt/translations/calwidget_vi.qm +END + +#if defined(WINSCW) +START EXTENSION qt/qmake_emulator_deployment +OPTION DEPLOY_SOURCE a:/sf/mw/securitysrv/securitydialogs/Autolock/autolock.qcrml +OPTION DEPLOY_TARGET A:/epoc32/winscw/c/resource/qt/crml/autolock.qcrml +END +#endif +START EXTENSION qt/qmake_emulator_deployment +OPTION DEPLOY_SOURCE a:/sf/mw/securitysrv/securitydialogs/Autolock/autolock.qcrml +OPTION DEPLOY_TARGET A:/epoc32/data/z/resource/qt/crml/autolock.qcrml +END + +START EXTENSION qt/qmake_store_build +END + + + + +prj_exports + +./rom/Autolock.iby CORE_APP_LAYER_IBY_EXPORT_PATH(Autolock.iby) +./conf/Autolock.confml MW_LAYER_CONFML(Autolock.confml) +./conf/lock.confml MW_LAYER_CONFML(lock.confml) +./rom/AutolockSrv.iby CORE_APP_LAYER_IBY_EXPORT_PATH(AutolockSrv.iby) +./PubSub/SecurityUIsPrivatePSKeys.h |../../inc/securityuisprivatepskeys.h +./conf/lock_10283322.crml MW_LAYER_CRML(lock_10283322.crml) diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/bwins/autolockuseractivityserviceu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/bwins/autolockuseractivityserviceu.def Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,16 @@ +EXPORTS + ?trUtf8@AutolockUserActivityService@@SA?AVQString@@PBD0H@Z @ 1 NONAME ; class QString AutolockUserActivityService::trUtf8(char const *, char const *, int) + ?tr@AutolockUserActivityService@@SA?AVQString@@PBD0@Z @ 2 NONAME ; class QString AutolockUserActivityService::tr(char const *, char const *) + ?trUtf8@AutolockUserActivityService@@SA?AVQString@@PBD0@Z @ 3 NONAME ; class QString AutolockUserActivityService::trUtf8(char const *, char const *) + ?getStaticMetaObject@AutolockUserActivityService@@SAABUQMetaObject@@XZ @ 4 NONAME ; struct QMetaObject const & AutolockUserActivityService::getStaticMetaObject(void) + ?setInactivityPeriod@AutolockUserActivityService@@UAEXH@Z @ 5 NONAME ; void AutolockUserActivityService::setInactivityPeriod(int) + ?tr@AutolockUserActivityService@@SA?AVQString@@PBD0H@Z @ 6 NONAME ; class QString AutolockUserActivityService::tr(char const *, char const *, int) + ?qt_metacast@AutolockUserActivityService@@UAEPAXPBD@Z @ 7 NONAME ; void * AutolockUserActivityService::qt_metacast(char const *) + ??1AutolockUserActivityService@@UAE@XZ @ 8 NONAME ; AutolockUserActivityService::~AutolockUserActivityService(void) + ?qt_metacall@AutolockUserActivityService@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 9 NONAME ; int AutolockUserActivityService::qt_metacall(enum QMetaObject::Call, int, void * *) + ?inactivityPeriod@AutolockUserActivityService@@UBEHXZ @ 10 NONAME ; int AutolockUserActivityService::inactivityPeriod(void) const + ??0AutolockUserActivityService@@QAE@XZ @ 11 NONAME ; AutolockUserActivityService::AutolockUserActivityService(void) + ??_EAutolockUserActivityService@@UAE@I@Z @ 12 NONAME ; AutolockUserActivityService::~AutolockUserActivityService(unsigned int) + ?staticMetaObject@AutolockUserActivityService@@2UQMetaObject@@B @ 13 NONAME ; struct QMetaObject const AutolockUserActivityService::staticMetaObject + ?metaObject@AutolockUserActivityService@@UBEPBUQMetaObject@@XZ @ 14 NONAME ; struct QMetaObject const * AutolockUserActivityService::metaObject(void) const + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/conf/autolock.confml Binary file securitydialogs/Autolock/conf/autolock.confml has changed diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/conf/autolock_102824AE.crml Binary file securitydialogs/Autolock/conf/autolock_102824AE.crml has changed diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/data/Autolock.rss --- a/securitydialogs/Autolock/data/Autolock.rss Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -/* -* Copyright (c) 2002 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: -* This file contains all the resources for the Autolock. -* -* -*/ - - -// RESOURCE IDENTIFIER -NAME ALCK // 4 letter ID - -// INCLUDES - -#include -#include "autolock.hrh" -#include -#include "eikon.rsg" -#include -#include -#include -#include -#include - - -// RESOURCE DEFINITIONS - -RESOURCE RSS_SIGNATURE { } - -RESOURCE TBUF { buf=""; } - -RESOURCE EIK_APP_INFO - { - status_pane = r_autolock_status_pane; - } - -RESOURCE STATUS_PANE_APP_MODEL r_autolock_status_pane - { - layout = R_AVKON_STATUS_PANE_LAYOUT_IDLE; - panes = - { - SPANE_PANE - { - id = EEikStatusPaneUidTitle; - type = EAknCtTitlePane; - resource = r_title_pane_locked; - } - }; - } - - -RESOURCE AVKON_VIEW r_locked_view - { - } - - - -RESOURCE CBA r_autolock_softkeys_unlock_empty - { - buttons = - { - CBA_BUTTON{id=ESecUiCmdUnlock; txt= qtn_set_sec_unlock_system; }, - CBA_BUTTON{id=EAknSoftkeyEmpty; txt=text_softkey_empty; }, - CBA_BUTTON{id=EAknSoftkeyEmpty; txt=text_softkey_empty; } - }; - } - - -RESOURCE TITLE_PANE r_title_pane_locked - { - txt = qtn_set_sec_title_locked; - } - - - -RESOURCE DIALOG r_emergency - { - flags = EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | - EEikDialogFlagCbaButtons; - buttons=R_AVKON_SOFTKEYS_CANCEL; - items= - { - DLG_LINE - { - type=EAknCtNote; - id=EGeneralNote; - control= AVKON_NOTE - { - layout = EGeneralLayout; - }; - } - }; - } - -// end of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/data/Autolock_reg.rss --- a/securitydialogs/Autolock/data/Autolock_reg.rss Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* Copyright (c) 2004 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: RSS for creating the registration file for Autolock. -* -*/ - - -#include -#include - - -UID2 KUidAppRegistrationResourceFile -UID3 0x100059B5 // application UID -RESOURCE APP_REGISTRATION_INFO - { - app_file="Autolock"; // filename of application binary (minus extension) - hidden = KAppIsHidden; - embeddability = KAppNotEmbeddable; - newfile = KAppDoesNotSupportNewFile; - } diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/eabi/autolockuseractivityserviceu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/eabi/autolockuseractivityserviceu.def Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,16 @@ +EXPORTS + _ZN27AutolockUserActivityService11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME + _ZN27AutolockUserActivityService11qt_metacastEPKc @ 2 NONAME + _ZN27AutolockUserActivityService16staticMetaObjectE @ 3 NONAME DATA 16 + _ZN27AutolockUserActivityService19getStaticMetaObjectEv @ 4 NONAME + _ZN27AutolockUserActivityService19setInactivityPeriodEi @ 5 NONAME + _ZN27AutolockUserActivityServiceC1Ev @ 6 NONAME + _ZN27AutolockUserActivityServiceC2Ev @ 7 NONAME + _ZN27AutolockUserActivityServiceD0Ev @ 8 NONAME + _ZN27AutolockUserActivityServiceD1Ev @ 9 NONAME + _ZN27AutolockUserActivityServiceD2Ev @ 10 NONAME + _ZNK27AutolockUserActivityService10metaObjectEv @ 11 NONAME + _ZNK27AutolockUserActivityService16inactivityPeriodEv @ 12 NONAME + _ZTI27AutolockUserActivityService @ 13 NONAME + _ZTV27AutolockUserActivityService @ 14 NONAME + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/group/Autolock.mmp --- a/securitydialogs/Autolock/group/Autolock.mmp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* -* Copyright (c) 2002 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: Makefile -* -* -*/ - -#include - -#include - -TARGET autolock.exe -TARGETTYPE exe -epocstacksize 0x5000 - -UID 0x100039CE 0x100059B5 - -VENDORID VID_DEFAULT -CAPABILITY CAP_APPLICATION NetworkControl - -MACRO __NO_DOS__ - -SOURCEPATH ../src -SOURCE AutolockApp.cpp -SOURCE AutolockAppUi.cpp -SOURCE AutolockDocument.cpp -SOURCE AutolockContainer.cpp -SOURCE AutoLockModel.cpp -SOURCE AutoLockCenRepI.cpp -SOURCE AutoLockLockObserver.cpp -SOURCE AutoLockValueObserver.cpp -SOURCE AutoLockView.cpp -SOURCE AutolockWait.cpp -SOURCE AutoKeyGuardCenRepI.cpp -SOURCE AutoKeyguardObserver.cpp -SOURCE AutolockGripStatusObserver.cpp -SOURCE AutolockFpsStatusObserver.cpp - - -START RESOURCE ../data/Autolock.rss -HEADER - -TARGETPATH APP_RESOURCE_DIR - -LANGUAGE_IDS -END //RESOURCE - - -//s60 Integration -START RESOURCE ../data/Autolock_reg.rss -DEPENDS autolock.rsg -TARGETPATH /private/10003a3f/apps -END - -//S60 Integration - -USERINCLUDE . ../inc ../CenRep - -APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE ../../../inc - -LIBRARY euser.lib apparc.lib cone.lib eikcore.lib -LIBRARY eikcoctl.lib avkon.lib -LIBRARY activitymanager.lib -LIBRARY apgrfx.lib -LIBRARY ws32.lib secui.lib commonengine.lib -LIBRARY etel.lib etelmm.lib eikdlg.lib -LIBRARY sysutil.lib -LIBRARY aknlayout.lib -LIBRARY aknskins.lib -LIBRARY centralrepository.lib -LIBRARY cenrepnotifhandler.lib -LIBRARY aknlayout2scalable.lib -LIBRARY aknlayout2.lib -LIBRARY featmgr.lib -LIBRARY aknicon.lib -LIBRARY fbscli.lib -LIBRARY scpclient.lib -LIBRARY gdi.lib -LIBRARY aknnotify.lib -LIBRARY customapi.lib -LIBRARY keylockpolicyapi.lib - - -SMPSAFE diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/group/Autolock_Icons_dc.mk --- a/securitydialogs/Autolock/group/Autolock_Icons_dc.mk Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -# -# Copyright (c) 2004 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: -# - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) -ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z -else -ZDIR=\epoc32\data\z -endif - -# ---------------------------------------------------------------------------- -# TARGET FILES: Configure these -# ---------------------------------------------------------------------------- - -TARGETDIR=$(ZDIR)\resource\apps -ICONTARGETFILENAME=$(TARGETDIR)\autolock.mif - -HEADERDIR=\epoc32\include -HEADERFILENAME=$(HEADERDIR)\autolock.mbg - -do_nothing : - @rem do_nothing - -MAKMAKE : do_nothing - -BLD : do_nothing - -CLEAN : do_nothing - -LIB : do_nothing - -CLEANLIB : do_nothing - -# ---------------------------------------------------------------------------- -# RESOURCE COMMAND: Configure these. -# -# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by -# MifConv if the mask detph is defined. -# -# NOTE 2: Usually, source paths should not be included in the bitmap -# definitions. MifConv searches for the icons in all icon directories in a -# predefined order, which is currently \s60\icons, \s60\bitmaps2, \s60\bitmaps. -# The directory \s60\icons is included in the search only if the feature flag -# __SCALABLE_ICONS is defined. -# ---------------------------------------------------------------------------- - -RESOURCE : - mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ - /c8,8 qgn_graf_phone_locked /c8,8 qgn_indi_button_end_call \ - - -FREEZE : do_nothing - -SAVESPACE : do_nothing - -RELEASABLES : - @echo $(HEADERFILENAME)&& \ - @echo $(ICONTARGETFILENAME) - -FINAL : do_nothing diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/group/bld.inf --- a/securitydialogs/Autolock/group/bld.inf Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* Copyright (c) 2002 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: This file provides the information required for building -* the whole autolock. -* -*/ - - -#include -PRJ_PLATFORMS - -DEFAULT - -PRJ_EXPORTS -//Configuration tool migration -../conf/autolock.confml MW_LAYER_CONFML(autolock.confml) -../conf/autolock_102824AE.crml MW_LAYER_CRML(autolock_102824ae.crml) -../conf/lock.confml MW_LAYER_CONFML(lock.confml) -../conf/lock_10283322.crml MW_LAYER_CRML(lock_10283322.crml) - -../rom/Autolock.iby CORE_MW_LAYER_IBY_EXPORT_PATH(autolock.iby) -../rom/AutolockResources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(autolockresources.iby) -../loc/autolock.loc MW_LAYER_LOC_EXPORT_PATH(autolock.loc) -// taken from lockapp -// ../PubSub/SecurityUIsPrivatePSKeys.h |../../../inc/SecurityUIsPrivatePSKeys.h - -PRJ_MMPFILES -../group/Autolock.mmp - -PRJ_EXTENSIONS -START EXTENSION s60/mifconv -OPTION TARGETFILE autolock.mif -OPTION HEADERFILE autolock.mbg -OPTION SOURCES -c8,8 qgn_graf_phone_locked -c8,8 qgn_indi_button_end_call -END - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/iconnotifier.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/iconnotifier.svg Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,260 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/inc/AutoKeyguardCenRepI.h --- a/securitydialogs/Autolock/inc/AutoKeyguardCenRepI.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -*/ - - -#ifndef _AUTOKEYGUARDCENREPI_H__ -#define _AUTOKEYGUARDCENREPI_H__ - -#include -#include // link against CenRepNotifHandler.lib - -class CAutoKeyguardObserver; - -class CAutoKeyguardCenRepI : public CBase, public MCenRepNotifyHandlerCallback - { - public: - /** - * Creates instance of the CAutoKeyguardCenRepI class. - * - * @param aObserver (pointer to keyguard timeout observer) - * @return Returns the instance just created. - */ - static CAutoKeyguardCenRepI* NewLC(CAutoKeyguardObserver* aObserver); - /** - * Creates instance of the CAutoKeyguardCenRepI class. - * - * @param aObserver (pointer to keyguard timeout observer) - * @return Returns the instance just created. - */ - static CAutoKeyguardCenRepI* NewL(CAutoKeyguardObserver* aObserver); - /** - * Destructor. - */ - ~CAutoKeyguardCenRepI(); - public: - /** - * Current autokeyguard period - * - * @return TInt (curenst autokeyguard period in minutes) - */ - TInt Timeout(); - /** - * From MCenRepNotifyHandlerCallback. Handles period changed event. Called by CenRep. - * - * @param aId (The id of the changed setting) - * @param aNewValue (The new value of the changed setting) - * @return KErNone - */ - void HandleNotifyInt(TUint32 aId, TInt aNewValue); - - void HandleNotifyError(TUint32 aId, TInt error, CCenRepNotifyHandler* aHandler); - - void HandleNotifyGeneric(TUint32 aId); - - private: - /** - * C++ default constructor. - * - * @param aObserver (pointer to keyguard timeout observer) - */ - CAutoKeyguardCenRepI(CAutoKeyguardObserver* aObserver); - /** - * Symbian OS constructor. - */ - void ConstructL(); - private: - /** - * Tells observer that keyguard period has been changed - */ - void ResetInactivityTimeout(); - private: // data - CAutoKeyguardObserver* iObserver; //not owned! - CCenRepNotifyHandler* iNotifyHandler; - CRepository* iSession; - - }; - -#endif -// END OF FILE diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/inc/AutoKeyguardObserver.h --- a/securitydialogs/Autolock/inc/AutoKeyguardObserver.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -/* -* Copyright (c) 2006 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: -* -*/ - - -#ifndef _AUTOKEYGUARDOBSERVER_H__ -#define _AUTOKEYGUARDOBSERVER_H__ - -#include -#include -#include - -class CUserActivityManager; -class CAutoKeyguardCenRepI; -class MAutolockAppUiInterface; - -class CAutoKeyguardObserver : public CBase - { - public: - /** - * Creates instance of the CAutoKeyguardObserver class. - * - * @return Returns the instance just created. - */ - static CAutoKeyguardObserver* NewL( MAutolockAppUiInterface* aAppUiI ); - /** - * Symbian OS constructor. - */ - void ConstructL( CAutoKeyguardObserver* aObserver ); - /** - * Destructor. - */ - ~CAutoKeyguardObserver(); - public: - /** - * Gets new autokeyguard period and starts monitoring user activity - */ - void ResetInactivityTimeout(); - /** - * Activates keyguard - */ - void LockKeysL(); - private: - /** - * C++ default constructor. - */ - CAutoKeyguardObserver( MAutolockAppUiInterface* aAppUiI ); - private: - /** - * Return current autokeyguard period - * - * @return TInt (autokeyguard period in minutes) - */ - TInt AutoKeyguardTimeout(); - /** - * Handles Active event. Called by ActivityManager - * - * @param aPtr - * @return KErNone - */ - static TInt HandleActiveEventL(TAny* aPtr); - /** - * Handles Inactive event. Called by ActivityManager - * - * @param aPtr (pointer to CAutoKeyguardObserver) - * @return KErNone - */ - static TInt HandleInactiveEventL(TAny* aPtr); - /** - * Starts monitoring user activity - */ - void StartActivityMonitoringL(); - /** - * Stop monitoring user activity. - */ - void StopActivityMonitoring(); - /** - * Initializes activymanager - */ - void SetActivityManagerL(); - /** - * UnInitializes activymanager - */ - void CancelActivityManager(); - private: //data - CUserActivityManager* iActivityManager; - CAutoKeyguardCenRepI* iCenRepI; - MAutolockAppUiInterface* iAppUiI; - }; -#endif -// END OF FILE diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/inc/AutoLockCenRepI.h --- a/securitydialogs/Autolock/inc/AutoLockCenRepI.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -*/ - - -#ifndef _AUTOLOCKCENREPI_H__ -#define _AUTOLOCKCENREPI_H__ - -#include -#include // link against CenRepNotifHandler.lib -#include "AutolockAppUiPS.h" - - -class CAutolockCenRepI : public CBase, public MCenRepNotifyHandlerCallback - { - public: - /** - * Creates instance of the CAutolockShareDataI class. - * - * @param aAppUi (pointer to autolock appui) - * @return Returns the instance just created. - */ - static CAutolockCenRepI* NewLC(CAutolockAppUi* aAppUi); - /** - * Creates instance of the CAutolockShareDataI class. - * - * @param aAppUi (pointer to autolock appui) - * @return Returns the instance just created. - */ - static CAutolockCenRepI* NewL(CAutolockAppUi* aAppUi); - /** - * Destructor. - */ - ~CAutolockCenRepI(); - public: - /** - * Currenst autolock period - * - * @return TInt (curenst autolock period in minutes) - */ - TInt Timeout(); - /** - * Sets device lock value in SharedData - * - * @param: aLocked (decice lock on/off) - */ - void SetLockedL(TBool aLockValue); - /** - * From MCenRepNotifyHandlerCallback. Handles period changed event. Called by CenRep. - * - * @param aId (The id of the changed setting) - * @param aNewValue (The new value of the changed setting) - * @return KErNone - */ - void HandleNotifyInt(TUint32 aId, TInt aNewValue); - - void HandleNotifyError(TUint32 aId, TInt error, CCenRepNotifyHandler* aHandler); - - void HandleNotifyGeneric(TUint32 aId); - - private: - /** - * C++ default constructor. - * - * @param aAppUi (pointer to autolock appui) - */ - CAutolockCenRepI(CAutolockAppUi* aAppUi); - /** - * Symbian OS constructor. - */ - void ConstructL(); - private: - /** - * Handles period changed event. Called by CSharedDataInteger - * - * @param aPtr (pointer to CAutolockShareDataI) - * @return KErNone - */ - TInt HandleTimeoutChangedL(); - /** - * Tells model that autolock period has been changed - */ - void ResetInactivityTimeout(); - private: // data - CAutolockAppUi* iAppUi; //not owned! - CCenRepNotifyHandler* iNotifyHandler; - CRepository* iSession; - - }; - -#endif -// END OF FILE diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/inc/AutoLockLockObserverPS.h --- a/securitydialogs/Autolock/inc/AutoLockLockObserverPS.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Obsererver for Set System Locked event -* -* -*/ - - -#ifndef __AUTOLOCKLOCKOBSERVERPS_H -#define __AUTOLOCKLOCKOBSERVERPS_H - -#include -#include -#include "AutolockAppUiPS.h" - -class CLockObserver: public CActive - { - public: - /** - * Creates instance of the CLockObserver class. - * - * @param aAppUi (pointer to autolock appui) - * @return Returns the instance just created. - */ - static CLockObserver* NewL(CAutolockAppUi* aAppUi); - /** - * Destructor. - */ - ~CLockObserver(); - private: - /** - * Starts asynchronic listening KUidAutolockStatus event - * - * @return KErrNone: if no errors - * @return KErrInUse: if already listening - */ - TInt Start(); - private: // constructors - /** - * C++ default constructor. - * - * @param aAppUi (pointer to autolock appui) - */ - CLockObserver(CAutolockAppUi* aAppUi); - /** - * Symbian OS constructor. - */ - void ConstructL(); - private: // from CActive - /** @see CActive::RunL() */ - void RunL(); - /** @see CActive::DoCancel() */ - void DoCancel(); - private: // data - CAutolockAppUi* iAppUi; //not owned! - RProperty iProperty; - - }; - -#endif -// End of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/inc/AutoLockModelPS.h --- a/securitydialogs/Autolock/inc/AutoLockModelPS.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -*/ - - -#ifndef _AUTOLOCKMODELPS_H__ -#define _AUTOLOCKMODELPS_H__ - -#include -#include -#include - -class CUserActivityManager; -class CAutolockCenRepI; -class CAutolockAppUi; -class CLockObserver; - -class CAutoLockModel : public CBase - { - public: - /** - * Creates instance of the CAutoLockModel class. - * - * @param aAppUi (pointer to autolock appui) - * @return Returns the instance just created. - */ - static CAutoLockModel* NewL(CAutolockAppUi* aAppUi, TBool aLocked ); - /** - * Symbian OS constructor. - */ - void ConstructL( TBool aLocked ); - /** - * Destructor. - */ - ~CAutoLockModel(); - public: - /** - * Gets new autolock period and starts monitoring user activity - */ - void ResetInactivityTimeout(); - /** - * Brings autolock app to foreground and locks the system - */ - void LockSystemL(TInt aAutolockState = 0); - /** - * Sets device lock value in SharedData and in SystemAgent - * - * @param: aLocked (decice lock on/off) - */ - void SetLockedL(TInt aAutolockState = 0); - private: - /** - * C++ default constructor. - * - * @param aAppUi (pointer to autolock appui) - */ - CAutoLockModel(CAutolockAppUi* aAppUi); - private: - /** - * Return current autolock period - * - * @return TInt (autolock period in minutes) - */ - TInt AutoLockTimeout(); - /** - * Handles Active event. Called by ActivityManager - * - * @param aPtr - * @return KErNone - */ - static TInt HandleActiveEventL(TAny* aPtr); - /** - * Handles Inactive event. Called by ActivityManager - * - * @param aPtr (pointer to CAutoLockModel) - * @return KErNone - */ - static TInt HandleInactiveEventL(TAny* aPtr); - /** - * Starts monitoring user activity - */ - void StartActivityMonitoringL(); - /** - * Stop monitoring user activity. - */ - void StopActivityMonitoring(); - /** - * Initializes activymanager - */ - void SetActivityManagerL(); - /** - * UnInitializes activymanager - */ - void CancelActivityManager(); - private: //data - CUserActivityManager* iActivityManager; - CAutolockAppUi* iAppUi; //not owned! - CAutolockCenRepI* iCenRepI; - CLockObserver* iLockObserver; - TBool iMonitoring; - RProperty iProperty; - }; -#endif -// END OF FILE diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/inc/AutoLockValueObserverPS.h --- a/securitydialogs/Autolock/inc/AutoLockValueObserverPS.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Observer for phone events. Used to deactive/active the side-key -* -* -*/ - - -#ifndef __AUTOLOCKVALUEOBSERVERPS_H -#define __AUTOLOCKVALUEOBSERVERPS_H - -#include -#include - -class CAutolockAppUi; - -class CValueObserver: public CActive - { - public: - /** - * Creates instance of the CValueObserver class. - * - * @param aAppUi (pointer to autolock appui) - * @return Returns the instance just created. - */ - static CValueObserver* NewL(CAutolockAppUi* aAppUi); - /** - * Destructor. - */ - ~CValueObserver(); - public: - /** - * Starts asynchronic listening KUidCurrentCall event - * - * @return KErrNone: if no errors - * @return KErrInUse: if already listening - */ - TInt Start(); - /** - * Stops asynchronic listening KUidAutolockStatus event - */ - void Stop(); - private: // constructors - /** - * C++ default constructor. - * - * @param aAppUi (pointer to autolock appui) - */ - CValueObserver(CAutolockAppUi* aAppUi); - /** - * Symbian OS constructor. - */ - void ConstructL(); - private: // from CActive - /** @see CActive::RunL() */ - void RunL(); - /** @see CActive::DoCancel() */ - void DoCancel(); - private: // data - CAutolockAppUi* iAppUi; //not owned! - RProperty iProperty; - }; - -#endif -// End of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/inc/AutolockApp.h --- a/securitydialogs/Autolock/inc/AutolockApp.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Declares main application class. -* -*/ - - -#ifndef AUTOLOCKAPP_H -#define AUTOLOCKAPP_H - -// INCLUDES -#include - -// CONSTANTS -// UID of the application -const TUid KUidAutolock = { 0x100059B5 }; - -// CLASS DECLARATION - -/** -* CAutolockApp application class. -* Provides factory to create concrete document object. -* -*/ -class CAutolockApp : public CAknApplication - { - - private: - - /** - * From CApaApplication, creates CAutolockDocument document object. - * @return A pointer to the created document object. - */ - CApaDocument* CreateDocumentL(); - - /** - * From CApaApplication, returns application's UID (KUidAutolock). - * @return The value of KUidAutolock. - */ - TUid AppDllUid() const; - }; - -#endif - -// End of File - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/inc/AutolockAppUiInterface.h --- a/securitydialogs/Autolock/inc/AutolockAppUiInterface.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 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" -* 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: -* Interface to App Ui from helper classes -* -*/ -#ifndef AUTOLOCKAPPUIINTERFACE_H -#define AUTOLOCKAPPUIINTERFACE_H - -class MAutolockAppUiInterface - { - public: - virtual TInt DeviceLockQueryStatus() = 0; - virtual TInt DeviceLockStatus() = 0; - virtual void CancelDeviceLockQuery() = 0; - virtual void ForceOrientation(TInt value) = 0; - }; - -#endif // AUTOLOCKAPPUIINTERFACE_H diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/inc/AutolockAppUiPS.h --- a/securitydialogs/Autolock/inc/AutolockAppUiPS.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,272 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Declares UI class for application. -* -*/ - - -#ifndef AUTOLOCKAPPUIPS_H -#define AUTOLOCKAPPUIPS_H - -// INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "AutolockWait.h" -#include "AutoKeyguardObserver.h" - -#include "AutolockGripStatusObserver.h" -#include "AutolockFpsStatusObserver.h" -#include "AutolockAppUiInterface.h" - -// FORWARD DECLARATIONS -class CAutolockContainer; -class CAutoLockModel; -class CValueObserver; - -// CONSTANTS -const TUid KAutoLockViewId = {101}; // CDMA StartUp needs this UID. - -// CLASS DECLARATIONS - -/** -* part of emergency call handling when telephony+devicelock is active -* this solution is meant only for 3.1 and 3.2 -*CEcsNote -*It defines security note used in security view. -*/ -class CEcsNote : public CAknNoteDialog - { - public: // Constructors and destructors - /** - * C++ constructor. - */ - CEcsNote(); - public: // new - /** - * Constructs sleeping note - */ - void ConstructSleepingNoteL(TInt aResourceId); - /** - * Shows slpeeping note - */ - TInt ShowNote(); - /** - * Hides sleeping note - */ - void SleepNote(); - - TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, - TEventCode aType); - - /** - * API to set the emergency number to be displayed - * - * aMatchedNumber text to display (e.g. "112" ) - */ - void SetEmergencyNumber( const TDesC& aMatchedNumber ); - - public: - TBool iNoteOnScreen; - }; - - -/** -* Application UI class. -* Provides support for the following features: -* - UIKON control architecture -* -*/ -class CAutolockAppUi : public CAknViewAppUi, public MAknEcsObserver, - public MAutolockAppUiInterface, - public MAutolockFpsStatusObserver - { - public: // // Constructors and destructor - - /** - * Symbian OS default constructor. - */ - void ConstructL(); - - /** - * Destructor. - */ - ~CAutolockAppUi(); - - /** - * From MAutolockAppUiInterface - */ - TBool DeviceLockQueryStatus(); - - TBool DeviceLockStatus(); - - void CancelDeviceLockQuery(); - void ForceOrientation(TInt value); - /** - * From MAutolockFpsStatusObserver - */ - TBool DeviceFpsLock(TInt iStatus); - - public: // New functions - /** - * Activates previous app - */ - void SwitchToPreviousAppL(); - /** - * Activates device lock view - */ - void BringAppToForegroundL(); - /** - * Pointer to model - * - * @return CAutoLockModel* - */ - inline CAutoLockModel* Model() const; - /** - * Locks voice-key and app-key - */ - void LockKeysL(); - /** - * UnLocks voice-key and app-key - */ - void UnLockKeys(); - /** - * Locks voice-key - */ - void LockSideKeyL(); - /** - * UnLocks voice-key - */ - void UnLockSideKey(); - /** - * Returns ETrue if system is locked. - */ - inline TBool Locked() { return (iSideKey2 != 0); } - /** - * Checks whether PUK1 dialog is active. - */ - TBool IsPinBlocked(); - /** - * Checks whether the phone has done hidden reset. - */ - TBool HiddenReset(); - void EnableWGListChangeEventListening(); - void DisableWGListChangeEventListening(); - - protected: - /** - * From CEikAppUi, handles the TARM unlock message, other messages - * are propagated to the superclass handler. - * @param aClientHandleOfTargetWindowGroup The window group that the message was sent to. - * @param aMessageUid The message UID. - * @param aMessageParameters The message parameters - * @return TMessageResponse EMessageHandled if the message was the TARM unlock message, - * otherwise the return value from the superclass handler. - */ - MCoeMessageObserver::TMessageResponse HandleMessageL( - TUint32 aClientHandleOfTargetWindowGroup, - TUid aMessageUid, - const TDesC8& aMessageParameters ); - - - private: - // From MEikMenuObserver - void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane); - - // from CCoeAppUi - void HandleForegroundEventL(TBool aForeground); - /** - * From CAknAppUi, called when screen layout changes - */ - void HandleScreenDeviceChangedL(); - private: - /** - * From CEikAppUi, takes care of command handling. - * @param aCommand command to be handled - */ - void HandleCommandL(TInt aCommand); - - /** - * From CEikAppUi, handles key events. - * @param aKeyEvent Event to handled. - * @param aType Type of the key event. - * @return Reponse code (EKeyWasConsumed, EKeyWasNotConsumed). - */ - virtual TKeyResponse HandleKeyEventL( - const TKeyEvent& aKeyEvent,TEventCode aType); - virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent); - private: - /** - * From AknViewAppUi. Handles pointer-initiated view switch. - * @param aEvent Window server event. - * @param aDestination Pointer to the control which the event is targeted to. - */ - void HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination ); - - /** - * Used for communication with SysAp - * @param aMessage message enumeration defined in eikon.hrh - */ - void SendMessageToSysAp(TInt aMessage); - - /** - * From MAknEcsObserver - * part of emergency call handling when telephony+devicelock is active - * this solution is meant only for 3.1 and 3.2 - * handles emergency call - */ - virtual void HandleEcsEvent( CAknEcsDetector* aEcsDetector, CAknEcsDetector::TState aState ); - - TBool TarmState(); - void HandleWindowGroupListChange(); - private: //Data - CAutoLockModel* iModel; - RTelServer iServer; - RMobilePhone iPhone; - TInt iAppKey; - TInt iSideKey1; - TInt iSideKey2; - CValueObserver* iPhoneObserver; - TBool iLocked; - TBool iDeviceLockQueryStatus; - // Idle Incall Bubbles. - CAknIncallBubble* iIncallBubble; - CAutoKeyguardObserver* iKeyguardObserver; - CAutolockGripStatusObserver* iGripStatusObserver; - CAutolockFpsStatusObserver* iFpsStatusObserver; - RMmCustomAPI iCustomPhone; - - // part of emergency call handling when t//iEmergencySupportReadyelephony+devicelock is active - // this solution is meant only for 3.1 and 3.2 - CAknEcsDetector* iEcsDetector; - CEcsNote* iEcsNote; - TBool iEmergencySupportReady; - CWait* iWait; - TRect aCallButtonRect; - TInt iGotEventDownDuringCall; - }; - - inline CAutoLockModel* CAutolockAppUi::Model() const - {return iModel;} - -#endif - -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/inc/AutolockContainer.h --- a/securitydialogs/Autolock/inc/AutolockContainer.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Declares container control for application. -* -*/ - - -#ifndef AUTOLOCKCONTAINER_H -#define AUTOLOCKCONTAINER_H - -// INCLUDES -#include -#include -#include -#include - -// FORWARD DECLARATIONS - -class CAknsLayeredBackgroundControlContext; - -// CLASS DECLARATION - -/** -* CAutolockContainer container control class. -* -*/ -class CAutolockContainer : public CCoeControl, MCoeControlObserver - { - public: // Constructors and destructor - - /** - * Symbian OS default constructor. - * @param aRect Frame rectangle for container. - */ - void ConstructL(const TRect& aRect); - - /** - * Destructor. - */ - ~CAutolockContainer(); - - public: // Functions from base classes - /** - * From CCoeControl, MopSupplyObject - */ - TTypeUid::Ptr MopSupplyObject( TTypeUid aId ); - void GiveCoords( TRect& aRect ); - - private: // Functions from base classes - - /** - * From CoeControl,SizeChanged. - */ - void SizeChanged(); - - /** - * From CoeControl,CountComponentControls. - */ - TInt CountComponentControls() const; - - /** - * From CCoeControl,ComponentControl. - */ - CCoeControl* ComponentControl(TInt aIndex) const; - - /** - * From CCoeControl,Draw. - */ - void Draw(const TRect& aRect) const; - - // event handling section - // e.g Listbox events - void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); - - private: //data - CEikImage* iEikBitmap; - CFbsBitmap* iBitmap; - CFbsBitmap* iMask; - CEikImage* iEikBitmapCall; - CFbsBitmap* iBitmapCall; - CFbsBitmap* iMaskCall; - // Owned background context. - CAknsLayeredBackgroundControlContext* iBgContext; - - }; - -#endif - -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/inc/AutolockDocument.h --- a/securitydialogs/Autolock/inc/AutolockDocument.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Declares document for application. -* -*/ - - -#ifndef AUTOLOCKDOCUMENT_H -#define AUTOLOCKDOCUMENT_H - -// INCLUDES -#include -// CONSTANTS - -// FORWARD DECLARATIONS -class CEikAppUi; - -// CLASS DECLARATION - -/** -* CAutolockDocument application class. -*/ -class CAutolockDocument : public CAknDocument - { - public: // Constructors and destructor - /** - * Two-phased constructor. - */ - static CAutolockDocument* NewL(CEikApplication& aApp); - - /** - * Destructor. - */ - virtual ~CAutolockDocument(); - - public: // From CEikDocument - /** - * Updates task name --> Sets autolock hidden - * - * @param aWgName CApaWindowGroupName* - */ - void UpdateTaskNameL( CApaWindowGroupName* aWgName ); - - private: - - /** - * Symbian OS default constructor. - */ - CAutolockDocument(CEikApplication& aApp): CAknDocument(aApp) { } - void ConstructL(); - - private: - - /** - * From CEikDocument, create CAutolockAppUi "App UI" object. - */ - CEikAppUi* CreateAppUiL(); - }; - -#endif - -// End of File - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/inc/AutolockFpsStatusObserver.h --- a/securitydialogs/Autolock/inc/AutolockFpsStatusObserver.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Declares UI class for application. -* -*/ - -#ifndef AUTOLOCKFPSOBSERVER_H_ -#define AUTOLOCKFPSOBSERVER_H_ - -#include -#include -#include -#include - - -class MAutolockFpsStatusObserver - { - public: - /** - * Implement this method to be notified when Fps status - * changes. - */ - IMPORT_C virtual TInt DeviceFpsLock(TInt iStatus) = 0; - IMPORT_C virtual TInt DeviceLockStatus() = 0; - }; - -class CAutolockFpsStatusObserver : public CActive - { - public: - IMPORT_C static CAutolockFpsStatusObserver* NewL( MAutolockFpsStatusObserver* aObserver, RWsSession& aSession ); - - void RunL(); - void DoCancel(); - ~CAutolockFpsStatusObserver(); - - private: - void ConstructL( MAutolockFpsStatusObserver* aObserver ); - CAutolockFpsStatusObserver( RWsSession& aSession ); - void FpsStatusChangedL( TInt aFpsStatus ); - - private: - MAutolockFpsStatusObserver* iObserver; - RProperty iFpsStatus; - RWsSession& iSession; - }; - - -#endif diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/inc/AutolockGripStatusObserver.h --- a/securitydialogs/Autolock/inc/AutolockGripStatusObserver.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Declares UI class for application. -* -*/ - -#ifndef AUTOLOCKGRIPOBSERVER_H_ -#define AUTOLOCKGRIPOBSERVER_H_ - -#include -#include -#include -#include - -class MAutolockAppUiInterface; - -class CAutolockGripStatusObserver : public CActive - { - public: - IMPORT_C static CAutolockGripStatusObserver* NewL( MAutolockAppUiInterface* aObserver, RWsSession& aSession ); - - void RunL(); - void DoCancel(); - ~CAutolockGripStatusObserver(); - - private: - void ConstructL( MAutolockAppUiInterface* aObserver ); - CAutolockGripStatusObserver( RWsSession& aSession ); - void GripStatusChangedL( TInt aGripStatus ); - - private: - MAutolockAppUiInterface* iObserver; - RProperty iGripStatus; - RWsSession& iSession; - }; - - -#endif diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/inc/AutolockView.h --- a/securitydialogs/Autolock/inc/AutolockView.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -*/ - - -#ifndef __AUTOLOCKVIEW_H__ -#define __AUTOLOCKVIEW_H__ - -#include -#include "AutolockContainer.h" - -class CAutolockView : public CAknView - { - public: - /** - * Symbian OS constructor. - */ - void ConstructL(); - /** - * Destructor. - */ - ~CAutolockView(); - public: // from CAknView - /** - * Returns view id. - * @return An unsigned integer (view id). - */ - TUid Id() const; - /** - * Handles commands. - * @param aCommand Command to be handled. - * @return void. - */ - void HandleCommandL(TInt aCommand); - /** - * Handles statuspane changes - * @return void. - */ - void HandleStatusPaneSizeChange(); - /** - * Handles screen layout changes - */ - void ScreenDeviceChanged(); - void MakeVisible(TBool aVisibility); - void HandleCall(TInt aCommand, TRect &aRect ); - private: // from CAknView - /** - * Activates the view. - * @param aPrevViewId ID of previous view - * @param aCustomMessageId customized message ID - * @param aCustomMessage sutomized message payload - */ - void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage); - /** - * Deactivates view - */ - void DoDeactivate(); - private: // data - CAutolockContainer* iView; - }; -#endif -// end of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/inc/AutolockWait.h --- a/securitydialogs/Autolock/inc/AutolockWait.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -* -*/ - - -#ifndef __AUTOLOCKWAIT_H -#define __AUTOLOCKWAIT_H - -// INCLUDES - -#include -#include -#include - -// CLASS DEFINITIONS -class CWait : public CActive - { - public: - /** - * Creates instance of the CWait class. - * - * @return Returns the instance just created. - */ - static CWait* NewL(); - /** - * Destructor. - */ - ~CWait(); - public: - /** - * Starts waiting for aReqStatus. - */ - TInt WaitForRequestL(); - public: - /** - * Sets active request type. - */ - void SetRequestType(TInt aRequestType); - /** - * Gets active request type. - */ - TInt GetRequestType(); - private: - /** - * C++ default constructor. - */ - CWait(); - /** - * Symbian OS constructor. - */ - void ConstructL(); - private: // from CActive - /** @see CActive::RunL() */ - void RunL(); - /** @see CActive::DoCancel() */ - void DoCancel(); - RTimer iTimer; - CActiveSchedulerWait iWait; - // Used if there is a need to cancel an active request; - // namely in situations where destructor is called when Wait - // is active. - TInt iRequestType; - }; - - -// CWaitAbsorbingControl, absorbs all the key presses. -class CWaitAbsorbingControl : public CCoeControl - { - public: - static CWaitAbsorbingControl* NewLC(); - virtual ~CWaitAbsorbingControl(); - private: - virtual TKeyResponse OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/); - private: - CWaitAbsorbingControl(); - void ConstructL(); - private: // Data - CEikAppUi* iAppUi; - }; - -#endif - -// End of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/inc/autolock.hrh --- a/securitydialogs/Autolock/inc/autolock.hrh Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2002 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: -* This file contains declarations for resources of Autolock. -* The file can be included in C++ or resource file. -* -*/ - -#ifndef AUTOLOCK_HRH -#define AUTOLOCK_HRH - -enum TAutoLockKeys - { - ESecUiCmdUnlock = 300 - }; -#endif // AUTOLOCK - - - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/indicatorplugin/qmakepluginstubs/indicatorautolockplugin.qtplugin --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/indicatorplugin/qmakepluginstubs/indicatorautolockplugin.qtplugin Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,1 @@ +This file is a Qt plugin stub file. The real Qt plugin is located in /sys/bin. Created:2010-05-17T09:17:32 diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/indicatorplugin/rom/indicatorautolockplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/indicatorplugin/rom/indicatorautolockplugin.iby Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 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" +* 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: Keylock indicator +* +*/ + +#ifndef INDICATORAUTOLOCKPLUGIN_IBY +#define INDICATORAUTOLOCKPLUGIN_IBY + +file=ABI_DIR\UREL\indicatorautolockplugin.dll SHARED_LIB_DIR\indicatorautolockplugin.dll UNPAGED +data=\epoc32\data\z\resource\plugins\indicators\indicatorautolockplugin.qtplugin \resource\plugins\indicators\indicatorautolockplugin.qtplugin + +#endif // INDICATORAUTOLOCKPLUGIN_IBY + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/loc/autolock.loc --- a/securitydialogs/Autolock/loc/autolock.loc Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* -* Copyright (c) 2002 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: This is a localisation file for Autolock -* -*/ - - - -// LOCALISATION STRINGS - -//d:Title pane text in System Lock View.(Phone is in locked mode) -//l:title_pane_t2/opt9 -// -#define qtn_set_sec_title_locked "Locked" - -//d:Left Softkey text in System Lock View. -//l:control_pane_t1/opt7 -// -#define qtn_set_sec_unlock_system "Unlock" - - -// End of File - - - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/qtg_large_device_lock.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/qtg_large_device_lock.svg Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/resources/Keyguard_enabled_test.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/resources/Keyguard_enabled_test.svg Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,1949 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/resources/iconnotifier.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/resources/iconnotifier.svg Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,260 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/resources/qtg_large_device_lock.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/resources/qtg_large_device_lock.svg Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/rom/Autolock.iby --- a/securitydialogs/Autolock/rom/Autolock.iby Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/Autolock/rom/Autolock.iby Tue Aug 31 16:04:40 2010 +0300 @@ -14,12 +14,26 @@ * Description: * */ - #ifndef __AUTOLOCK_IBY__ #define __AUTOLOCK_IBY__ +#include + S60_APP_EXE(Autolock) S60_APP_BITMAP(Autolock) -S60_APP_AIF_RSC(Autolock) +//S60_APP_AIF_RSC(Autolock) +S60_APP_RESOURCE(Autolock) + +file=ABI_DIR\BUILD_DIR\autolockuseractivityservice.dll SHARED_LIB_DIR\autolockuseractivityservice.dll +data=\epoc32\data\z\resource\qt\crml\autolock.qcrml \resource\qt\crml\autolock.qcrml -#endif +// this is already done in IndicatorAutolockPlugin.iby +// file=ABI_DIR\BUILD_DIR\IndicatorAutolockPlugin.dll SHARED_LIB_DIR\IndicatorAutolockPlugin.dll + +// Autolock_reg.rsc needs to be also in import\apps because this is where QtHighway searches for it. +data=ZSYSTEM\..\PRIVATE\10003a3f\import\apps\Autolock_reg.rsc private\10003a3f\import\apps\Autolock_reg.rsc + +// this is already done in IndicatorAutolockPlugin.iby +// data=\epoc32\data\z\resource\plugins\indicators\indicatorautolockplugin.qtplugin \resource\plugins\indicators\indicatorautolockplugin.qtplugin + +#endif // __AUTOLOCK_IBY__ diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/rom/AutolockResources.iby --- a/securitydialogs/Autolock/rom/AutolockResources.iby Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* Copyright (c) 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: -* -*/ - - -#ifndef __AUTOLOCK_RESOURCES_IBY__ -#define __AUTOLOCK_RESOURCES_IBY__ - -//Resource file(s) for AUTOLOCK application - -S60_APP_RESOURCE(Autolock) - -#endif diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/rom/AutolockSrv.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/rom/AutolockSrv.iby Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,22 @@ +/* +* Copyright (c) 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: +* +*/ +#ifndef __AUTOLOCKSRV_IBY__ +#define __AUTOLOCKSRV_IBY__ + +// this exists just to delete the old AutolockSrv.iby file, which contains some duplicated files + +#endif // __AUTOLOCKSRV_IBY__ diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/service_conf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/service_conf.xml Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,11 @@ + + + com.nokia.services.Autolock + No path really + Autolock + + Autolock + 2.0 + Interface to Autolock + + \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/service_conf_new.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/service_conf_new.xml Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,12 @@ + + + com.nokia.services.Autolock + No path + Autolock service + + Autolock + 2.0 + Interface to Autolock + Dial now + + \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/service_conf_old_format.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/service_conf_old_format.xml Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,7 @@ + + + Autolock + + Dial interface + + \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/src/AutoKeyGuardCenRepI.cpp --- a/securitydialogs/Autolock/src/AutoKeyGuardCenRepI.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,154 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -*/ - - -#include -#include -#include "AutoKeyguardObserver.h" -#include "AutoKeyguardCenRepI.h" - - - -// ================= MEMBER FUNCTIONS ======================= -// -// ---------------------------------------------------------- -// CAutoKeyguardCenRepI::NewLC() -// Two-phased constructor. -// ---------------------------------------------------------- -// -CAutoKeyguardCenRepI* CAutoKeyguardCenRepI::NewLC(CAutoKeyguardObserver* aObserver) - { - CAutoKeyguardCenRepI* self = new (ELeave) CAutoKeyguardCenRepI(aObserver); - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } - -// -// ---------------------------------------------------------- -// CAutoKeyguardCenRepI::NewL() -// Two-phased constructor. -// ---------------------------------------------------------- -// -CAutoKeyguardCenRepI* CAutoKeyguardCenRepI::NewL(CAutoKeyguardObserver* aObserver) - { - CAutoKeyguardCenRepI* self = NewLC(aObserver); - CleanupStack::Pop(); //self - return self; - } - -// -// ---------------------------------------------------------- -// CAutoKeyguardCenRepI::~CAutoKeyguardCenRepI() -// Destructor -// ---------------------------------------------------------- -// -CAutoKeyguardCenRepI::~CAutoKeyguardCenRepI() - { - if(iNotifyHandler) - { - iNotifyHandler->StopListening(); - delete iNotifyHandler; - } - if(iSession) - delete iSession; - } -// -// ---------------------------------------------------------- -// CAutoKeyguardCenRepI::CAutoKeyguardCenRepI() -// C++ default constructor -// ---------------------------------------------------------- -// -CAutoKeyguardCenRepI::CAutoKeyguardCenRepI(CAutoKeyguardObserver* aObserver):iObserver(aObserver) - { - } - -// -// ---------------------------------------------------------- -// CAutoKeyguardCenRepI::ConstructL() -// Symbian OS default constructor -// ---------------------------------------------------------- -// -void CAutoKeyguardCenRepI::ConstructL() - { - // init cenrep connection - iSession = CRepository::NewL(KCRUidSecuritySettings); - - iNotifyHandler = CCenRepNotifyHandler::NewL(*this, *iSession, CCenRepNotifyHandler::EIntKey, KSettingsAutomaticKeyguardTime); - iNotifyHandler->StartListeningL(); - } - -// -// ---------------------------------------------------------- -// CAutoKeyguardCenRepI::HandleNotifyInt() -// Handles autoKeyguard period changes. Called by CenRep. -// ---------------------------------------------------------- -// -void CAutoKeyguardCenRepI::HandleNotifyInt(TUint32 aId, TInt /*aNewValue*/) - { - if(aId == KSettingsAutomaticKeyguardTime) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardCenRepI::HandleNotifyInt() Reset timeout")); - #endif - ResetInactivityTimeout(); - } - return; - } - -void CAutoKeyguardCenRepI::HandleNotifyError(TUint32 /*aId*/, TInt /*error*/, CCenRepNotifyHandler* /*aHandler*/) - { - return; - } - -void CAutoKeyguardCenRepI::HandleNotifyGeneric(TUint32 aId) - { - if ( aId == NCentralRepositoryConstants::KInvalidNotificationId ) - {//Repository wide reset caused generic notification - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardCenRepI::HandleNotifyGeneric() Reset timeout")); - #endif - ResetInactivityTimeout(); - } - return; - } - -// -// ---------------------------------------------------------- -// CAutoKeyguardCenRepI::ResetInactivityTimeoutL() -// Resets autoKeyguard timer -// ---------------------------------------------------------- -// -void CAutoKeyguardCenRepI::ResetInactivityTimeout() - { - iObserver->ResetInactivityTimeout(); - } - -// -// ---------------------------------------------------------- -// CAutoKeyguardCenRepI::Timeout() -// Returns currents autoKeyguard period (in seconds) -// ---------------------------------------------------------- -// -TInt CAutoKeyguardCenRepI::Timeout() - { - TInt period = 0; - iSession->Get(KSettingsAutomaticKeyguardTime, period); - return period; - } - -// END OF FILE diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/src/AutoKeyguardObserver.cpp --- a/securitydialogs/Autolock/src/AutoKeyguardObserver.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,468 +0,0 @@ -/* -* Copyright (c) 2006 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: -* -*/ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "AutoKeyguardCenRepI.h" -#include "AutoKeyguardObserver.h" -#include "AutolockPrivateCRKeys.h" -#include "AutolockAppUiInterface.h" - -const TInt AutoKeyguardOff(60000); -// Screensaver "On" status value -const TInt KSsOn = 1; -// Screensaver started fron idle status value -const TInt KSsStartedFromIdle = 1; -//Flip open -const TInt KFlipOpen = 1; - -// ================= MEMBER FUNCTIONS ======================= -// -// ---------------------------------------------------------- -// CAutoKeyguardObserver::NewL() -// ---------------------------------------------------------- -// - -CAutoKeyguardObserver* CAutoKeyguardObserver::NewL( MAutolockAppUiInterface* aAppUiI ) - { - #ifdef RD_AUTO_KEYGUARD - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::NewL() BEGIN")); - #endif - CAutoKeyguardObserver* self = new (ELeave) CAutoKeyguardObserver( aAppUiI ); - CleanupStack::PushL(self); - self->ConstructL(self); - CleanupStack::Pop(); //self - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::NewL() END")); - #endif - return self; - #else - return NULL; - #endif //RD_AUTO_KEYGUARD - } -// -// ---------------------------------------------------------- -// CAutoKeyguardObserver::CAutoKeyguardObserver() -// C++ default constructor -// ---------------------------------------------------------- -// -CAutoKeyguardObserver::CAutoKeyguardObserver( MAutolockAppUiInterface* aAppUiI ): - iAppUiI( aAppUiI ) - { - } - -// -// ---------------------------------------------------------- -// CAutoKeyguardObserver::ConstructL() -// Symbian OS default constructor -// ---------------------------------------------------------- -// -void CAutoKeyguardObserver::ConstructL(CAutoKeyguardObserver* aObserver) - { - #ifdef RD_AUTO_KEYGUARD - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::ConstructL() BEGIN")); - #endif - //Central Repository handler - iCenRepI = CAutoKeyguardCenRepI::NewL(aObserver); - // Activitymanager - iActivityManager = CUserActivityManager::NewL(CActive::EPriorityStandard); - StartActivityMonitoringL(); - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::ConstructL() END")); - #endif - #else // !RD_AUTO_KEYGUARD - iCenRepI = NULL; - iActivityManager = NULL; - #endif //RD_AUTO_KEYGUARD - } -// -// ---------------------------------------------------------- -// CAutoKeyguardObserver::StartActivityMonitoringL() -// Start monitoring user activity -// ---------------------------------------------------------- -// -void CAutoKeyguardObserver::StartActivityMonitoringL() - { - #ifdef RD_AUTO_KEYGUARD - SetActivityManagerL(); - #endif //RD_AUTO_KEYGUARD - } - -// -// ---------------------------------------------------------- -// CAutoKeyguardObserver::StopActivityMonitoring() -// Stop monitoring user activity -// ---------------------------------------------------------- -// -void CAutoKeyguardObserver::StopActivityMonitoring() - { - #ifdef RD_AUTO_KEYGUARD - CancelActivityManager(); - #endif // RD_AUTO_KEYGUARD - } - -// -// ---------------------------------------------------------- -// CAutoKeyguardObserver::SetActivityManagerL() -// Initializes activymanager -// ---------------------------------------------------------- -// -void CAutoKeyguardObserver::SetActivityManagerL() - { - #ifdef RD_AUTO_KEYGUARD - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::SetActivityManagerL() BEGIN")); - #endif - if (AutoKeyguardTimeout() ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::SetActivityManagerL() ON: Start manager")); - #endif - iActivityManager->Start(AutoKeyguardTimeout(), TCallBack(HandleInactiveEventL,this), - TCallBack(HandleActiveEventL,this)); - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::SetActivityManagerL() OFF: Start manager")); - #endif - iActivityManager->Start(AutoKeyguardOff, TCallBack(HandleInactiveEventL,this), - TCallBack(HandleActiveEventL,this)); - } - - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::SetActivityManagerL() END")); - #endif - #endif //RD_AUTO_KEYGUARD - } -// -// ---------------------------------------------------------- -// CAutoKeyguardObserver::CancelActivityManager() -// UnInitializes activymanager -// ---------------------------------------------------------- -// -void CAutoKeyguardObserver::CancelActivityManager() - { - #ifdef RD_AUTO_KEYGUARD - if ( iActivityManager ) - { - iActivityManager->Cancel(); - } - #endif //RD_AUTO_KEYGUARD - } -// -// ---------------------------------------------------------- -// CAutoKeyguardObserver::~CAutoKeyguardObserver() -// Destructor -// ---------------------------------------------------------- -// -CAutoKeyguardObserver::~CAutoKeyguardObserver() - { - #ifdef RD_AUTO_KEYGUARD - if(iCenRepI) - delete iCenRepI; - if(iActivityManager) - { - StopActivityMonitoring(); - delete iActivityManager; - iActivityManager = NULL; - } - #endif //RD_AUTO_KEYGUARD - } -// -// ---------------------------------------------------------- -// CAutoKeyguardObserver::AutoKeyguardTimeout() -// Returns current AutoKeyguard period -// ---------------------------------------------------------- -// -TInt CAutoKeyguardObserver::AutoKeyguardTimeout() - { - #ifdef RD_AUTO_KEYGUARD - return iCenRepI->Timeout(); - #else - return 0; - #endif //RD_AUTO_KEYGUARD - } -// -// ---------------------------------------------------------- -// CAutoKeyguardObserver::ResetInactivityTimeoutL() -// Gets AutoKeyguard period and starts monitoring user activity -// ---------------------------------------------------------- -// -void CAutoKeyguardObserver::ResetInactivityTimeout() - { - #ifdef RD_AUTO_KEYGUARD - if (AutoKeyguardTimeout() ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::ResetInactivityTimeoutL() ON")); - #endif - iActivityManager->SetInactivityTimeout(AutoKeyguardTimeout()); - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::ResetInactivityTimeoutL() OFF")); - #endif - iActivityManager->SetInactivityTimeout(AutoKeyguardOff); - } - #endif //RD_AUTO_KEYGUARD - } -// -// ---------------------------------------------------------- -// CAutoKeyguardObserver::HandleActiveEventL() -// Handles Active event. Called by ActivityManager -// ---------------------------------------------------------- -// -TInt CAutoKeyguardObserver::HandleActiveEventL(TAny* /*aPtr*/) - { - return KErrNone; - } - -// -// ---------------------------------------------------------- -// CAutoKeyguardObserver::HandleInactiveEventL() -// Handles InActive event. Called by ActivityManager -// ---------------------------------------------------------- -// -TInt CAutoKeyguardObserver::HandleInactiveEventL(TAny* aPtr) - { - #ifdef RD_AUTO_KEYGUARD - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::HandleInactiveEventL() BEGIN")); - #endif - if ( STATIC_CAST(CAutoKeyguardObserver*, aPtr)->AutoKeyguardTimeout() ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::HandleInactiveEventL() Lock")); - #endif - STATIC_CAST(CAutoKeyguardObserver*, aPtr)->LockKeysL(); - } - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::HandleInactiveEventL() END")); - #endif - #endif //RD_AUTO_KEYGUARD - return KErrNone; - } - -// -// ---------------------------------------------------------- -// CAutoKeyguardObserver::LockKeysL() -// Locks system -// ---------------------------------------------------------- -// -void CAutoKeyguardObserver::LockKeysL() - { - #ifdef RD_AUTO_KEYGUARD - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::LockKeysL() BEGIN")); - #endif - CRepository* repository = CRepository::NewL(KCRUidAutolockConf); - TInt keyguardConf(0); - //Check local keyguard variation key - repository->Get(KAutoKeyLockConf, keyguardConf); - delete repository; - if(keyguardConf & KAutoKeylockFeatureIdFlipOpenDisabled) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::LockKeysL() Flip variation")); - #endif - TInt flipState(KFlipOpen); - RProperty::Get(KPSUidHWRM, KHWRMFlipStatus, flipState); - TInt lightStatus=EForcedLightsUninitialized; - RProperty::Get(KPSUidCoreApplicationUIs,KLightsVTForcedLightsOn,lightStatus ); - - //If flip is open and feature flag is on. don't lock - if(flipState == KFlipOpen || lightStatus == EForcedLightsOn) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::LockKeysL() Flip open")); - #endif - return; - } - - } - - { // REQ 414-5466 Prevention of device lock in context of Hands Free Voice UI - TInt vuiValue = 0; - TUid KHFVuiModePSUid = { 0x102818E7 }; - enum THFVuiModePSKeys - { - EHFVuiPSModeId = 1000 - }; - TInt tRet = RProperty::Get(KHFVuiModePSUid, EHFVuiPSModeId, vuiValue); // also 0 if can't get because permissions or because doesn't exists - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) gatting KHFVuiModePSUid+EHFVuiPSModeId=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, tRet ); - RDebug::Printf( "%s %s (%u) vuiValue=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, vuiValue ); - #endif - if(vuiValue) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::LockKeysL() Voice functions active. No locking possible.")); - #endif - return; - } - } - - TInt value = 0; - TBool keylockOn = EFalse; - TBool autolockOn = EFalse; - TBool idle = EFalse; - TInt callState = EPSCTsyCallStateNone; - TBool okToLock = EFalse; - TBool screenSaverOn = EFalse; - TBool screenSaverStertedFromIdle = EFalse; - TBool startupOver = EFalse; - TBool codeQueryOpen = EFalse; - //Get keyguard status - RProperty::Get(KPSUidAvkonDomain, KAknKeyguardStatus, value); - keylockOn = (value == EKeyguardLocked); - //Get call state - RProperty::Get(KPSUidCtsyCallInformation, KCTsyCallState, callState); - - //See whether we are in idle - value = 0; - RProperty::Get(KPSUidAiInformation, KActiveIdleState, value); - idle = (value == EPSAiForeground); - idle = ETrue; // don't care about idle state. Phone should autolock on any UI, not only HomeSreeen. - - value = 0; - RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, value); - autolockOn = (value > EAutolockOff); - - value = 0; - RProperty::Get(KPSUidScreenSaver, KScreenSaverOn, value); - screenSaverOn = (value == KSsOn); - - value = 0; - RProperty::Get(KPSUidScreenSaver, KScreenSaverActivatedFromIdle, value); - screenSaverStertedFromIdle = (value == KSsStartedFromIdle); - - // See if SIM is accepted - if(idle) - { - value = 0; - RProperty::Get(KPSUidStartup, KPSSimStatus, value); - // automatic lock can't get enabled if SIM-locked. - if(value == ESimNotReady) - idle = EFalse; - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::LockKeysL() KPSSimStatus state: %d"), value); - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::LockKeysL() ESimUsable: %d"), ESimUsable); - #endif - } - - //See if all the startup related queries and graphics has been displayed - value = 0; - RProperty::Get(KPSUidStartup, KPSStartupUiPhase, value); - startupOver = (value == EStartupUiPhaseAllDone); - - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::LockKeysL() startupOver: %d"), startupOver); - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::LockKeysL() Startup state: %d"), value); - #endif - //See if the lock code query is open - codeQueryOpen = iAppUiI->DeviceLockQueryStatus(); - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::LockKeysL() codeQueryOpen: %d"), codeQueryOpen); - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::LockKeysL() autolockOn: %d"), autolockOn); - #endif - if (startupOver) - { - // If lock code query is open and device lock is on, cancel the query. - // AppUi will enable keylock when the query is cancelled - if (autolockOn && codeQueryOpen) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::LockKeysL() Query open, cancel it")); - #endif - iAppUiI->CancelDeviceLockQuery(); - return; - } - // If keylock is already ON, there is a ongoing call, - // autolock is already ON or phone is not in idle, don't lock. - if (keylockOn || (callState > EPSCTsyCallStateNone) || autolockOn || !idle) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::LockKeysL() Don't lock")); - RDebug::Print(_L("(AUTOLOCK)keylockstatus: %d"), keylockOn); - RDebug::Print(_L("(AUTOLOCK)callstate: %d"), callState); - RDebug::Print(_L("(AUTOLOCK)autolockstate: %d"), autolockOn); - RDebug::Print(_L("(AUTOLOCK)idlestate: %d"), idle); - RDebug::Print(_L("(AUTOLOCK)screenSaverOn: %d"), screenSaverOn); - RDebug::Print(_L("(AUTOLOCK)screenSaverStertedFromIdle: %d"), screenSaverStertedFromIdle); - #endif - //If screensaver is on, idle does not have foreground. If Screensaver was started from Idle, lock keys. - if(!idle && screenSaverOn && screenSaverStertedFromIdle && (callState <= EPSCTsyCallStateNone)) - okToLock = ETrue; - else - okToLock = EFalse; - } - else //Otherwise there's no problem... - okToLock = ETrue; - } - - - if (okToLock) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::LockKeysL() Lock")); - RDebug::Print(_L("(AUTOLOCK)keylockstatus: %d"), keylockOn); - RDebug::Print(_L("(AUTOLOCK)callstate: %d"), callState); - RDebug::Print(_L("(AUTOLOCK)autolockstate: %d"), autolockOn); - RDebug::Print(_L("(AUTOLOCK)idlestate: %d"), idle); - RDebug::Print(_L("(AUTOLOCK)screenSaverOn: %d"), screenSaverOn); - RDebug::Print(_L("(AUTOLOCK)screenSaverStertedFromIdle: %d"), screenSaverStertedFromIdle); - #endif - //Tell keylock to lock itself. - RAknKeyLock keylock; - if ( keylock.Connect() == KErrNone ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::LockKeysL() Connect OK")); - #endif - if(AknLayoutUtils::PenEnabled()) - keylock.EnableWithoutNote(); //Enable without note - else - keylock.EnableKeyLock(); - keylock.Close(); - } - } - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::LockKeysL() END")); - #endif - #endif //RD_AUTO_KEYGUARD -} - - -// END OF FILE diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/src/AutoLockCenRepI.cpp --- a/securitydialogs/Autolock/src/AutoLockCenRepI.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,165 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -*/ - - -#include -#include -#include "AutoLockModelPS.h" -#include "AutolockAppUiPS.h" -#include "AutoLockCenRepI.h" - - - -// ================= MEMBER FUNCTIONS ======================= -// -// ---------------------------------------------------------- -// CAutolockCenRepI::NewLC() -// Two-phased constructor. -// ---------------------------------------------------------- -// -CAutolockCenRepI* CAutolockCenRepI::NewLC(CAutolockAppUi* aAppUi) - { - CAutolockCenRepI* self = new (ELeave) CAutolockCenRepI(aAppUi); - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } - -// -// ---------------------------------------------------------- -// CAutolockCenRepI::NewL() -// Two-phased constructor. -// ---------------------------------------------------------- -// -CAutolockCenRepI* CAutolockCenRepI::NewL(CAutolockAppUi* aAppUi) - { - CAutolockCenRepI* self = NewLC(aAppUi); - CleanupStack::Pop(); //self - return self; - } - -// -// ---------------------------------------------------------- -// CAutolockCenRepI::~CAutolockCenRepI() -// Destructor -// ---------------------------------------------------------- -// -CAutolockCenRepI::~CAutolockCenRepI() - { - if(iNotifyHandler) - { - iNotifyHandler->StopListening(); - delete iNotifyHandler; - } - if(iSession) - delete iSession; - } -// -// ---------------------------------------------------------- -// CAutolockCenRepI::CAutolockCenRepI() -// C++ default constructor -// ---------------------------------------------------------- -// -CAutolockCenRepI::CAutolockCenRepI(CAutolockAppUi* aAppUi):iAppUi(aAppUi) - { - } - -// -// ---------------------------------------------------------- -// CAutolockCenRepI::ConstructL() -// Symbian OS default constructor -// ---------------------------------------------------------- -// -void CAutolockCenRepI::ConstructL() - { - // init cenrep connection - iSession = CRepository::NewL(KCRUidSecuritySettings); - - iNotifyHandler = CCenRepNotifyHandler::NewL(*this, *iSession, CCenRepNotifyHandler::EIntKey, KSettingsAutoLockTime); - iNotifyHandler->StartListeningL(); - } - -// -// ---------------------------------------------------------- -// CAutolockCenRepI::HandleNotifyInt() -// Handles autolock period changes. Called by CenRep. -// ---------------------------------------------------------- -// -void CAutolockCenRepI::HandleNotifyInt(TUint32 aId, TInt /*aNewValue*/) - { - if(aId == KSettingsAutoLockTime) - { - ResetInactivityTimeout(); - } - return; - } - -void CAutolockCenRepI::HandleNotifyError(TUint32 /*aId*/, TInt /*error*/, CCenRepNotifyHandler* /*aHandler*/) - { - return; - } - -void CAutolockCenRepI::HandleNotifyGeneric(TUint32 aId) - { - if ( aId == NCentralRepositoryConstants::KInvalidNotificationId ) - {//Repository wide reset caused generic notification - ResetInactivityTimeout(); - } - return; - } - -// -// ---------------------------------------------------------- -// CAutolockCenRepI::ResetInactivityTimeoutL() -// Resets autolock timer -// ---------------------------------------------------------- -// -void CAutolockCenRepI::ResetInactivityTimeout() - { - iAppUi->Model()->ResetInactivityTimeout(); - } - -// -// ---------------------------------------------------------- -// CAutolockCenRepI::Timeout() -// Returns currents autolock period (in seconds) -// ---------------------------------------------------------- -// -TInt CAutolockCenRepI::Timeout() - { - TInt period = 0; - iSession->Get(KSettingsAutoLockTime, period); - return period * 60; - } -// -// ---------------------------------------------------------- -// CAutolockCenRepI::SetLocked () -// Sets lock on/off in CenRep -// ---------------------------------------------------------- -// -void CAutolockCenRepI::SetLockedL(TBool aLockValue) - { - TInt lockValue = 0; - if (aLockValue) - { - lockValue = 1; - } - CRepository* repository = CRepository::NewL(KCRUidSecuritySettings); - repository->Set(KSettingsAutolockStatus, lockValue); - delete repository; - } -// END OF FILE diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/src/AutoLockLockObserver.cpp --- a/securitydialogs/Autolock/src/AutoLockLockObserver.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Obsererver for Set System Locked event -* -* -*/ - -#include -#include -#include -#include - -#include "AutoLockLockObserverPS.h" -#include "AutolockAppUiPS.h" -#include "AutoLockModelPS.h" - - -// ================= MEMBER FUNCTIONS ======================= -// -// ---------------------------------------------------------- -// CLockObserver::NewL() -// Constructs a new entry with given values. -// ---------------------------------------------------------- -// -CLockObserver* CLockObserver::NewL(CAutolockAppUi* aAppUi) - { - CLockObserver* self = new (ELeave) CLockObserver(aAppUi); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); - return self; - } -// -// ---------------------------------------------------------- -// CLockObserver::CLockObserver() -// Destructor -// ---------------------------------------------------------- -// -CLockObserver::~CLockObserver() - { - Cancel(); - iProperty.Close(); - } -// -// ---------------------------------------------------------- -// CNoSimCard::Start() -// Starts listening KUidAutolockStatus event -// ---------------------------------------------------------- -// -TInt CLockObserver::Start() - { - if (IsActive()) - return KErrInUse; - iStatus = KRequestPending; - iProperty.Attach(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus); - iProperty.Subscribe(iStatus); - SetActive(); - return KErrNone; - } -// -// ---------------------------------------------------------- -// CLockObserver::CLockObserver() -// C++ constructor -// ---------------------------------------------------------- -// -CLockObserver::CLockObserver(CAutolockAppUi* aAppUi) : CActive(0), iAppUi(aAppUi) - { - } -// -// ---------------------------------------------------------- -// CLockObserver::ConstructL() -// Symbian OS default constructor -// ---------------------------------------------------------- -// -void CLockObserver::ConstructL() - { - - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CLockObserver::ConstructL()")); - #endif - - // Add this active object to the scheduler. - CActiveScheduler::Add(this); - - TInt ret; - _LIT_SECURITY_POLICY_PASS(KReadPolicy); - _LIT_SECURITY_POLICY_C1(KWritePolicy, ECapabilityWriteDeviceData); - - ret = RProperty::Define(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, RProperty::EInt, KReadPolicy, KWritePolicy); - if(ret != KErrAlreadyExists) - User::LeaveIfError(ret); - - // Begin obsering PubSub event - Start(); - } -// -// ---------------------------------------------------------- -// CLockObserver::RunL() -// Called when device (autolock) is activated from menu. -// ---------------------------------------------------------- -// -void CLockObserver::RunL() - { - // set ui locked. - TInt autolockState; - iProperty.Get( autolockState ); - if (autolockState > EAutolockOff) - { - iAppUi->Model()->LockSystemL(autolockState); - } - // Continue observing PubSub event - Start(); - } -// -// ---------------------------------------------------------- -// CLockObserver::DoCancel() -// Cancels event listening -// ---------------------------------------------------------- -// -void CLockObserver::DoCancel() - { - iProperty.Cancel(); - } -// End of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/src/AutoLockModel.cpp --- a/securitydialogs/Autolock/src/AutoLockModel.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,444 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "AutoLockModelPS.h" -#include "AutolockAppUiPS.h" -#include "AutoLockLockObserverPS.h" -#include "AutoLockCenRepI.h" - - -const TInt AutoLockOff(60000); - - - -// ================= MEMBER FUNCTIONS ======================= -// -// ---------------------------------------------------------- -// CAutoLockModel::NewL() -// ---------------------------------------------------------- -// - -CAutoLockModel* CAutoLockModel::NewL(CAutolockAppUi* aAppUi, TBool aLocked) - { - CAutoLockModel* self = new (ELeave) CAutoLockModel(aAppUi); - CleanupStack::PushL(self); - self->ConstructL( aLocked ); - CleanupStack::Pop(); //self - return self; - } -// -// ---------------------------------------------------------- -// CAutoLockModel::CAutoLockModel() -// C++ default constructor -// ---------------------------------------------------------- -// -CAutoLockModel::CAutoLockModel(CAutolockAppUi* aAppUi) : - iAppUi( aAppUi ), iMonitoring(EFalse) - { - } - -// -// ---------------------------------------------------------- -// CAutoLockModel::ConstructL() -// Symbian OS default constructor -// ---------------------------------------------------------- -// -void CAutoLockModel::ConstructL( TBool aLocked ) - { - FeatureManager::InitializeLibL(); - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::ConstructL() BEGIN")); - #endif - iCenRepI = CAutolockCenRepI::NewL(iAppUi); - // lock status observer - iLockObserver = CLockObserver::NewL(iAppUi); - // Activitymanager - iActivityManager = CUserActivityManager::NewL(CActive::EPriorityStandard); - StartActivityMonitoringL(); - // In GSM the device is always unlocked. - // In CDMA, SecClientUi will lock the device on boot-up if needed. - if ( aLocked == EFalse ) { - SetLockedL(EAutolockOff); - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::ConstructL() EAutolockOff")); - #endif - } - - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::ConstructL() END")); - #endif - } - // -// ---------------------------------------------------------- -// CAutoLockModel::StartActivityMonitoringL() -// Start monitoring user activity -// ---------------------------------------------------------- -// -void CAutoLockModel::StartActivityMonitoringL() - { - SetActivityManagerL(); - } - -// -// ---------------------------------------------------------- -// CAutoLockModel::StopActivityMonitoring() -// Stop monitoring user activity -// ---------------------------------------------------------- -// -void CAutoLockModel::StopActivityMonitoring() - { - CancelActivityManager(); - } - -// -// ---------------------------------------------------------- -// CAutoLockModel::SetActivityManagerL() -// Initializes activymanager -// ---------------------------------------------------------- -// -void CAutoLockModel::SetActivityManagerL() - { - if (AutoLockTimeout() ) - { - iActivityManager->Start(AutoLockTimeout(), TCallBack(HandleInactiveEventL,this), - TCallBack(HandleActiveEventL,this)); - } - else - { - iActivityManager->Start(AutoLockOff, TCallBack(HandleInactiveEventL,this), - TCallBack(HandleActiveEventL,this)); - } - - } -// -// ---------------------------------------------------------- -// CAutoLockModel::CancelActivityManager() -// UnInitializes activymanager -// ---------------------------------------------------------- -// -void CAutoLockModel::CancelActivityManager() - { - if ( iActivityManager ) - { - iActivityManager->Cancel(); - } - delete iActivityManager; - iActivityManager = NULL; - } -// -// ---------------------------------------------------------- -// CAutoLockModel::~CAutoLockModel() -// Destructor -// ---------------------------------------------------------- -// -CAutoLockModel::~CAutoLockModel() - { - delete iCenRepI; - delete iLockObserver; - StopActivityMonitoring(); - FeatureManager::UnInitializeLib(); - // close custom phone - } -// -// ---------------------------------------------------------- -// CAutoLockModel::AutoLockTimeout() -// Returns current autolock period -// ---------------------------------------------------------- -// -TInt CAutoLockModel::AutoLockTimeout() - { - return iCenRepI->Timeout(); - } -// -// ---------------------------------------------------------- -// CAutoLockModel::ResetInactivityTimeoutL() -// Gets autolock period and starts monitoring user activity -// ---------------------------------------------------------- -// -void CAutoLockModel::ResetInactivityTimeout() - { - if (AutoLockTimeout() ) - { - iActivityManager->SetInactivityTimeout(AutoLockTimeout()); - } - else - { - iActivityManager->SetInactivityTimeout(AutoLockOff); - } - } -// -// ---------------------------------------------------------- -// CAutoLockModel::HandleActiveEventL() -// Handles Active event. Called by ActivityManager -// ---------------------------------------------------------- -// -TInt CAutoLockModel::HandleActiveEventL(TAny* /*aPtr*/) - { - return KErrNone; - } - -// -// ---------------------------------------------------------- -// CAutoLockModel::HandleInactiveEventL() -// Handles InActive event. Called by ActivityManager -// ---------------------------------------------------------- -// -TInt CAutoLockModel::HandleInactiveEventL(TAny* aPtr) - { - if ( STATIC_CAST(CAutoLockModel*, aPtr)->AutoLockTimeout() ) - { - TInt value(EStartupUiPhaseUninitialized); - RProperty::Get(KPSUidStartup, KPSStartupUiPhase, value); - //Don't lock unless boot is over. - if(value == EStartupUiPhaseAllDone) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::HandleInactiveEventL() Boot over")); - #endif - #ifdef RD_REMOTELOCK - STATIC_CAST(CAutoLockModel*, aPtr)->LockSystemL(ETimerLocked); - #else - STATIC_CAST(CAutoLockModel*, aPtr)->LockSystemL(EAutolockOn); - #endif //RD_REMOTELOCK - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::HandleInactiveEventL() In boot; don't lock")); - #endif - } - } - return KErrNone; - } - -// -// ---------------------------------------------------------- -// CAutoLockModel::LockSystemL() -// Locks system -// ---------------------------------------------------------- -// -void CAutoLockModel::LockSystemL(TInt aAutolockState) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::LockSystemL() BEGIN")); - #endif - // If already locked, do nothing. Otherwise we'll end up - // on top of Screensaver - // Check if iSideKey2 is zero or not (locked if nonzero) - // Also, phone should not be locked if PUK1 code query is up. -#ifdef FF_STARTUP_OMA_DM_SUPPORT // New booting order Start ID: MVKS-7PZDZ5 - TInt autolock_value = 0; - RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolock_value); - if (autolock_value == EAutolockStatusUninitialized) - { - return; - } -#endif //End ID: MVKS-7PZDZ5 - if (iAppUi->Locked() || iAppUi->IsPinBlocked()) - { - return; - } - - TInt lightStatus=EForcedLightsUninitialized; - RProperty::Get(KPSUidCoreApplicationUIs,KLightsVTForcedLightsOn,lightStatus ); - //If display is forced on. don't lock - if(lightStatus == EForcedLightsOn ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::LockSystemL() Display is forced on. Device not locked")); - #endif - return; - } - - //Check which state we are in to see if it's OK to lock the phone - //In CDMA when there is no SIM (RUIM) support we should be able to lock - //the phone after reboot. In this case ESWStateNormal is too late to lock the phone - //and other states below are needed. - TBool okToLock = EFalse; - TInt sysState = 0; - iProperty.Get(KPSUidStartup, KPSGlobalSystemState, sysState); - //If NOT in CDMA the Autolock should come up only after the phone has booted up. - if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) || iAppUi->HiddenReset()) - { - if( (sysState == ESwStateNormalRfOn || - sysState == ESwStateNormalRfOff || - sysState == ESwStateCriticalPhaseOK) && - (aAutolockState > EAutolockOff) ) // EMKK-7N3G7R - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::LockSystemL() LOCKED AFTER HIDDEN RESET")); - #endif - okToLock = ETrue; - } - } - else //Feature Manager - { - if( (sysState == ESwStateNormalRfOn || - sysState == ESwStateNormalRfOff) && - (aAutolockState > EAutolockOff) ) // EMKK-7N3G7R - { - okToLock = ETrue; - } - } - TInt tarmFlag=0; -if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) -{ - // Get the TARM admin flag value - TInt tRet = RProperty::Get( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag ); - - if ( tRet != KErrNone ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::BringAppToForegroundL():\ - Warning: failed to get TARM Admin Flag state")); - #endif - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::BringAppToForegroundL(): TARM flag: %d"), - tarmFlag ); - #endif - } -} - - TInt callState=0; - iProperty.Get(KPSUidCtsyCallInformation, KCTsyCallState, callState); -TBool isConditionSatisfied = EFalse; -if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) -{ - if ( ( callState != EPSCTsyCallStateNone ) && (!( tarmFlag & KSCPFlagAdminLock )) ) - isConditionSatisfied = ETrue; -} -else -{ - if ( callState != EPSCTsyCallStateNone ) - isConditionSatisfied = ETrue; -} - if (isConditionSatisfied) - { - TBool remoteLocked(EFalse); - #ifdef RD_REMOTELOCK - remoteLocked = (aAutolockState == ERemoteLocked); - #endif //RD_REMOTELOCK - if(remoteLocked) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::LockSystemL() REMOTE LOCKED")); - #endif - okToLock = ETrue; - - } - else - okToLock = EFalse; - } - - if (!iAppUi->IsForeground() && okToLock) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::LockSystemL() LOCK PHONE")); - #endif - // close fast-swap window - CEikonEnv::Static()->DismissTaskList(); - // inform Avokon & Other app that system is locked - // unless the value has already been set in secuisystemlock - #ifdef RD_REMOTELOCK - if(aAutolockState != EManualLocked) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::LockSystemL() Timer/Remote locked: %d"), aAutolockState); - #endif - SetLockedL(aAutolockState); - } - else if((aAutolockState == EManualLocked) && !iAppUi->Locked() && iAppUi->HiddenReset()) - { //set the PubSub key if we are to be locked after a hidden reset has occurred. - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::LockSystemL() HIDDEN RESET LOCK")); - #endif - SetLockedL(aAutolockState); - } - else - { //Normal manual lock from power key. Just set the CenRep key. - iCenRepI->SetLockedL(okToLock); - } - #else //! RD_REMOTELOCK - SetLockedL(aAutolockState); - #endif//RD_REMOTELOCK - // lock keys - iAppUi->LockKeysL(); - // iAppUi->EnableWGListChangeEventListening(); // this was in previous versions. It's not needed because it will come on top of bigClock - // app to foreground - iAppUi->BringAppToForegroundL(); - // Reset inactivity time so that Screensaver gets to - // run again after its timeout. We'll ignore the new - // inactivity timeout, if already locked - // RDebug::Printf( "%s %s (%u) CR 428-469 avoid User::ResetInactivityTime=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - // User::ResetInactivityTime(); - } - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::LockSystemL() END")); - #endif -} - -// -// ---------------------------------------------------------- -// CAutoLockModel::SetLocked -// Sets lockvalue in Publish & Subscribe and Central Repository -// ---------------------------------------------------------- -// -void CAutoLockModel::SetLockedL(TInt aAutolockState) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::SetLockedL() begin")); - #endif - TBool locked = (aAutolockState > EAutolockOff); - if (locked) - { - iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, aAutolockState); - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::SetLockedL() LOCK")); - #endif - } - else - { - iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOff); - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::SetLockedL() UNLOCK")); - #endif - } - - iCenRepI->SetLockedL(locked); - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::SetLockedL() end")); - #endif - } - -// END OF FILE diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/src/AutoLockValueObserver.cpp --- a/securitydialogs/Autolock/src/AutoLockValueObserver.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,211 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Observer for phone events. Used to deactive/active the side-key -* -* -*/ - - -#include -#include -#include -#include "AutolockAppUiPS.h" -#include "AutoLockValueObserverPS.h" -#include -#include - -// ================= MEMBER FUNCTIONS ======================= -// -// ---------------------------------------------------------- -// CValueObserver::NewL() -// Constructs a new entry with given values. -// ---------------------------------------------------------- -// -CValueObserver* CValueObserver::NewL(CAutolockAppUi* aAppUi) - { - CValueObserver* self = new (ELeave) CValueObserver(aAppUi); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); - return self; - } -// -// ---------------------------------------------------------- -// CValueObserver::CValueObserver() -// Destructor -// ---------------------------------------------------------- -// -CValueObserver::~CValueObserver() - { - Cancel(); - } -// -// ---------------------------------------------------------- -// CValueObserver::Start() -// Starts listening KUidCurrentCall event -// ---------------------------------------------------------- -// -TInt CValueObserver::Start() - { - if (IsActive()) - return KErrInUse; - iStatus = KRequestPending; - iProperty.Attach(KPSUidCtsyCallInformation, KCTsyCallState); - iProperty.Subscribe(iStatus); - SetActive(); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - #endif - return KErrNone; - } -// -// ---------------------------------------------------------- -// CValueObserver::Stop() -// Stops listening KUidCurrentCall event -// ---------------------------------------------------------- -// -void CValueObserver::Stop() - { - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - #endif - Cancel(); - } -// -// ---------------------------------------------------------- -// CLockObserver::CLockObserver() -// C++ constructor -// ---------------------------------------------------------- -// -CValueObserver::CValueObserver(CAutolockAppUi* aAppUi) : CActive(0), iAppUi(aAppUi) - { - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - #endif - } -// -// ---------------------------------------------------------- -// CLockObserver::ConstructL() -// Symbian OS default constructor -// ---------------------------------------------------------- -// -void CValueObserver::ConstructL() - { - // Add this active object to the scheduler. - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - #endif - CActiveScheduler::Add(this); - } -// -// ---------------------------------------------------------- -// CValueObserver::RunL() -// -// ---------------------------------------------------------- -// -void CValueObserver::RunL() - { - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - #endif - TInt atForeground = iAppUi->IsForeground(); - TInt value(EStartupUiPhaseUninitialized); - RProperty::Get(KPSUidStartup, KPSStartupUiPhase, value); - TInt callState; - iProperty.Get( callState ); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) callState=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, callState ); - RDebug::Printf( "%s %s (%u) EPSCTsyCallStateNone=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EPSCTsyCallStateNone ); - RDebug::Printf( "%s %s (%u) EPSCTsyCallStateUninitialized=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EPSCTsyCallStateUninitialized ); - RDebug::Printf( "%s %s (%u) atForeground=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, atForeground ); - RDebug::Printf( "%s %s (%u) KPSStartupUiPhase value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, value ); - RDebug::Printf( "%s %s (%u) EStartupUiPhaseSystemWelcomeDone=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EStartupUiPhaseSystemWelcomeDone ); - #endif - - - if (callState == EPSCTsyCallStateNone && !atForeground) - { - if( valueLocked(); - TInt alocked = RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, value); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) alocked=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, alocked ); - RDebug::Printf( "%s %s (%u) iAppUi_Locked=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iAppUi_Locked ); - #endif - if(iAppUi_Locked) - { - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) BringAppToForegroundL=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - #endif - iAppUi->BringAppToForegroundL(); - } - } - } - else - { - { - if( valueBringAppToForegroundL(); - } - else if( (callState == EPSCTsyCallStateNone || callState == EPSCTsyCallStateUninitialized) && atForeground) - { - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) calling BringAppToForegroundL=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - #endif - iAppUi->BringAppToForegroundL(); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) calling SwitchToPreviousAppL=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 2 ); - #endif - iAppUi->SwitchToPreviousAppL(); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) done=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 3 ); - #endif - } - } - } - Start(); - } - - } -// -// ---------------------------------------------------------- -// CValueObserver::DoCancel() -// Cancels event listening -// ---------------------------------------------------------- -// -void CValueObserver::DoCancel() - { - iProperty.Cancel(); - } - -// End of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/src/AutoLockView.cpp --- a/securitydialogs/Autolock/src/AutoLockView.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,269 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "autolock.hrh" -#include -#include -#include -#include "AutolockAppUiPS.h" -#include "AutoLockModelPS.h" -#include "AutolockView.h" -#include "AutolockContainer.h" - - - - -// CONSTANTS - -const TUid KUidStartUp = { 0x100058F4 }; -const TInt KPhoneAppOrdinalPosition = 1; // used to pull phone app closer to foreground - -// ================= MEMBER FUNCTIONS ======================= -// -// ---------------------------------------------------- -// CAutolockView::ConstructL() -// Symbian OS default constructor can leave.. -// ---------------------------------------------------- -// -void CAutolockView::ConstructL() - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockView::ConstructL()")); - #endif - BaseConstructL(); - } -// ---------------------------------------------------- -// CAutolockView::~CAutolockView() -// Destructor -// ---------------------------------------------------- -// -CAutolockView::~CAutolockView() - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockView::~CAutolockView()")); - #endif - CAutolockContainer* view = iView; - iView = NULL; - if (view) - { - AppUi()->RemoveFromStack(view); - } - delete view; - } -// ---------------------------------------------------- -// CAutolockView::Id() -// Returns view Id -// ---------------------------------------------------- -// -TUid CAutolockView::Id() const - { - return KAutoLockViewId; - } -// ---------------------------------------------------- -// CAutolockView::HandleCommandL() -// Handles user inputs -// ---------------------------------------------------- -// -void CAutolockView::HandleCommandL(TInt aCommand) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockView::HandleCommandL()")); - #endif - AppUi()->HandleCommandL(aCommand); - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockView::HandleCommandL END()")); - #endif - } -void CAutolockView::HandleCall(TInt aCommand, TRect &aRect) - { - // RDebug::Printf( "%s %s (%u) aCommand=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aCommand ); - if (iView) - { - TRect cr = ClientRect(); - iView->SetRect( cr ); - // RDebug::Printf( "%s %s (%u) got 2 cr=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aCommand ); - iView->DrawNow( ); - iView->GiveCoords( aRect ); - } - else - { - // RDebug::Printf( "%s %s (%u) !iView ???=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iView ); - } - } -void CAutolockView::MakeVisible(TBool aVisibility) - { - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) aVisibility=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aVisibility ); - #endif - if (iView) - iView->MakeVisible( aVisibility ); - else - { - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) !iView ???=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iView ); - #endif - } - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) aVisibility=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aVisibility ); - #endif - } -// ---------------------------------------------------- -// CAutolockView::HandleStatusPaneSizeChange() -// Handles StatusPane Size Change -// ---------------------------------------------------- -// -void CAutolockView::HandleStatusPaneSizeChange() - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockView::HandleStatusPaneSizeChange()")); - #endif - if (iView) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockView::HandleStatusPaneSizeChange() SET RECT")); - #endif - TRect cr = ClientRect(); - iView->SetRect( cr ); - } - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockView::HandleStatusPaneSizeChange() END")); - #endif - } -// ---------------------------------------------------- -// CAutolockView::DoActivateL -// Activates the view -// ---------------------------------------------------- -// -void CAutolockView::DoActivateL(const TVwsViewId& /*aPrevViewId*/,TUid aCustomMessageId,const TDesC8& /*aCustomMessage*/) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockView::DoActivateL")); - #endif - iView = new(ELeave) CAutolockContainer; - - TRect screen( iAvkonAppUi->ApplicationRect() ); - TAknLayoutRect applicationWindow; - applicationWindow.LayoutRect(screen, AknLayoutScalable_Avkon::application_window(0)); - TInt mainPaneVariety = 0; - if((AknLayoutUtils::PenEnabled()) && !(Layout_Meta_Data::IsLandscapeOrientation())) - {//Use main pane without softkey area - mainPaneVariety = 5; - } - else if (Layout_Meta_Data::IsLandscapeOrientation()) - { - mainPaneVariety = 4; - } - else - { - mainPaneVariety = 3; - } - - - - TAknLayoutRect mainPane; - mainPane.LayoutRect(applicationWindow.Rect(), AknLayoutScalable_Avkon::main_pane(mainPaneVariety)); - iView->ConstructL( mainPane.Rect() ); - AppUi()->AddToStackL(*this,iView); - - // Message comes from start-up. We need to lock the device. - if ( aCustomMessageId == KUidStartUp ) - { - static_cast(AppUi())->Model()->LockSystemL(); - - // Set phone app window group to position 2. This is the same position - // as the phone app set is self when it goes to background. - TVwsViewId phoneAppId; - TApaTaskList taskList( iEikonEnv->WsSession() ); - User::LeaveIfError( AknDef::GetPhoneIdleViewId(phoneAppId) ); - const TInt phoneWgId = taskList.FindApp( phoneAppId.iAppUid ).WgId(); - User::LeaveIfError( iCoeEnv->WsSession().SetWindowGroupOrdinalPosition( phoneWgId, KPhoneAppOrdinalPosition ) ); - } - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockView::DoActivateL END")); - #endif - } -// ---------------------------------------------------- -// CAutolockView::DoDeActivateL -// Deactivates the view -// ---------------------------------------------------- -// -void CAutolockView::DoDeactivate() - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockView::DoDeActivateL")); - #endif - CAutolockContainer* view = iView; - iView = NULL; - if (view) - { - AppUi()->RemoveFromStack(view); - } - delete view; - } -// ---------------------------------------------------- -// CAutolockView::ScreenDeviceChanged() -// Handles screen layout changes -// ---------------------------------------------------- -// -void CAutolockView::ScreenDeviceChanged() -{ - if (Layout_Meta_Data::IsLandscapeOrientation() && AknLayoutUtils::PenEnabled()) - {//do not change layout in touch device to conserve battery - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockView::ScreenDeviceChanged(): Do Nothing")); - #endif - return; - } - - if (iView) - { - TRect screen( iAvkonAppUi->ApplicationRect() ); - TAknLayoutRect applicationWindow; - applicationWindow.LayoutRect(screen, AknLayoutScalable_Avkon::application_window(0)); - - TInt mainPaneVariety = 0; - if((AknLayoutUtils::PenEnabled()) && !(Layout_Meta_Data::IsLandscapeOrientation())) - {//Use main pane without softkey area - mainPaneVariety = 5; - } - else if (Layout_Meta_Data::IsLandscapeOrientation()) - { - mainPaneVariety = 4; - } - else - { - mainPaneVariety = 3; - } - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockView::ScreenDeviceChanged() variety: %d"), mainPaneVariety); - #endif - TAknLayoutRect mainPane; - mainPane.LayoutRect(applicationWindow.Rect(), AknLayoutScalable_Avkon::main_pane(mainPaneVariety)); - iView->SetRect(mainPane.Rect()); - } -} -// end of file - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/src/Autolock.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/src/Autolock.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,1767 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, version 2.1 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, + * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". + * + * Description: + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QTM_USE_NAMESPACE + +#include +#include + +#include + +#include "Autolock.h" +#include +#include "autolockuseractivityservice.h" +#include // CenRep keys +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include "../PubSub/securityuisprivatepskeys.h" +#include +#include +#include + +#include +#include + +const TInt KPhoneIndex(0); +const TInt KTriesToConnectServer(2); +const TInt KTimeBeforeRetryingServerConnection(50000); +#define ESecUiTypeLock 0x00100000 +_LIT( KMmTsyModuleName, "PhoneTsy"); + +// Constant definitions to control screensaver view types +static const char *KSnsrViewTypeKey = "view_type"; +enum TSnsrViewType + { + ESnsrViewTypeInitial = 0, // default initial state, depends on the configuration + ESnsrViewTypeActive, + ESnsrViewTypeStandby, + ESnsrViewTypeDisabled, + }; +static const char *KSnsrCmdUnlock = "unlock"; +static const char *KSnsrCmdSwitchLights = "switch_lights"; +static const char *KSnsrCmdSwitchLowPower = "switch_low_power"; + +Autolock::Autolock(QWidget *parent, Qt::WFlags f) : + QWidget(parent, f), mService(NULL) + { + RDEBUG("start autolock", 0); + + // The very first thing is to define the properties, so that others can use them. + TSecurityPolicy readPolicy(ECapabilityReadDeviceData); + TSecurityPolicy writePolicy(ECapabilityWriteDeviceData); + TInt ret = RProperty::Define(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, RProperty::EInt, readPolicy, writePolicy); + RDEBUG("defined KSecurityUIsSecUIOriginatedQuery", ret); + ret = RProperty::Define(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, RProperty::EInt, readPolicy, writePolicy); + RDEBUG("defined KSecurityUIsQueryRequestCancel", ret); + _LIT_SECURITY_POLICY_PASS( KReadPolicy); + _LIT_SECURITY_POLICY_C1(KWritePolicy, ECapabilityWriteDeviceData); + ret = RProperty::Define(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, RProperty::EInt, KReadPolicy, KWritePolicy); + RDEBUG("defined KCoreAppUIsAutolockStatus", ret); + + // This is important: we set the status through a property + TInt autolockState; + ret = RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolockState); + RDEBUG("Get KCoreAppUIsAutolockStatus", ret); + RDEBUG("autolockState", autolockState); + if (autolockState == EAutolockStatusUninitialized) + { + autolockState = EAutolockOff; // not-initialized means taht the unlock-query hasn't been displayed. Therefore the device should not stay locked. + } + ret = RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolockState); // this might re-set it. That's not bad. It will re-notify all listeners. + RDEBUG("Set KCoreAppUIsAutolockStatus", ret); + + ret = RProperty::Define(KPSUidAvkonDomain, KAknKeyguardStatus, RProperty::EInt, TSecurityPolicy(TSecurityPolicy::EAlwaysPass), KWritePolicy); + RDEBUG("defined KAknKeyguardStatus", ret); + + ret = RProperty::Define(KPSUidSecurityUIs, KSecurityUIsLockInitiatorUID, RProperty::EInt, TSecurityPolicy(TSecurityPolicy::EAlwaysPass), writePolicy); + RDEBUG("defined KSecurityUIsLockInitiatorUID", ret); + + ret = RProperty::Define(KPSUidSecurityUIs, KSecurityUIsLockInitiatorTimeHigh, RProperty::EInt, readPolicy, writePolicy); + RDEBUG("defined KSecurityUIsLockInitiatorTimeHigh", ret); + ret = RProperty::Define(KPSUidSecurityUIs, KSecurityUIsLockInitiatorTimeLow, RProperty::EInt, readPolicy, writePolicy); + RDEBUG("defined KSecurityUIsLockInitiatorTimeLow", ret); + + ret = RProperty::Define(KPSUidSecurityUIs, KSecurityUIsLights, RProperty::EInt, TSecurityPolicy(TSecurityPolicy::EAlwaysPass), TSecurityPolicy(TSecurityPolicy::EAlwaysPass)); + RDEBUG("defined KAknKeyguardStatus", ret); + + ret = RProperty::Define(KPSUidSecurityUIs, KSecurityUIsDismissDialog, RProperty::EInt, TSecurityPolicy(TSecurityPolicy::EAlwaysPass), TSecurityPolicy( + TSecurityPolicy::EAlwaysPass)); + RDEBUG("defined KSecurityUIsDismissDialog", ret); + + mService = new AutolockService(this); + + /* Adjust the palette */ +#if defined(Q_WS_S60) + // this is defined. + RDEBUG( "Q_WS_S60", 1 ); + QPalette p = qApp->palette(); + QColor color(192,192,192); + QColor bg(201,250,250); + p.setColor(QPalette::Highlight, color.lighter(200)); + p.setColor(QPalette::Text, Qt::black); + p.setColor(QPalette::Base, bg); + p.setColor(QPalette::WindowText, Qt::black); + p.setColor(QPalette::Window, bg); + p.setColor(QPalette::ButtonText, Qt::black); + p.setColor(QPalette::Button, color.lighter(150)); + p.setColor(QPalette::Link, QColor(240,40,40)); + + qApp->setPalette(p); +#endif + + RDEBUG("connect", 1); + +#if defined(Q_WS_X11) || defined(Q_WS_WIN) + setFixedSize(QSize(360,640)); // nHD +#elif defined(Q_WS_S60) + // this doesn't work well + // showMaximized(); + showFullScreen(); +#endif + + serviceKeyguard = new AutolockUserActivityService(); + serviceDevicelock = new AutolockUserActivityService(); + + TInt lockValue = 0; + TInt lightsTimeout = 0; + CRepository* repository = NULL; + TInt cRresult = 0; + iLockCodeQueryInDisplay = EFalse; + Q_UNUSED(cRresult); + + iProcessingEvent = -1; + iLockStatusPrev = ELockNotActive; + iLockStatus = ELockNotActive; + QT_TRAP_THROWING(repository = CRepository::NewL(KCRUidSecuritySettings)); + cRresult = repository->Get(KSettingsAutolockStatus, lockValue); + RDEBUG("KSettingsAutolockStatus", KSettingsAutolockStatus); + RDEBUG("cRresult", cRresult); + RDEBUG("lockValue", lockValue); + iLockStatus = lockValue; + // the settings says to lock + delete repository; + + adjustInactivityTimers(0); + + QT_TRAP_THROWING(repository = CRepository::NewL(KCRUidProfileEngine)); + cRresult = repository->Get(KProEngActiveProfile, lightsTimeout); + // this value is not used for now + delete repository; + + QT_TRAP_THROWING(repository = CRepository::NewL(KCRUidLightSettings)); + cRresult = repository->Get(KDisplayLightsTimeout, lightsTimeout); + // this value is not used for now + delete repository; + + // subscribe to settings changes + subscriberKSettingsAutolockStatus = new QValueSpaceSubscriber("/KCRUidSecuritySettings/KSettingsAutolockStatus", this); + connect(subscriberKSettingsAutolockStatus, SIGNAL(contentsChanged()), this, SLOT(subscriberKSettingsAutolockStatusChanged())); + subscriberKSettingsAutoLockTime = new QValueSpaceSubscriber("/KCRUidSecuritySettings/KSettingsAutoLockTime", this); + connect(subscriberKSettingsAutoLockTime, SIGNAL(contentsChanged()), this, SLOT(subscriberKSettingsAutoLockTimeChanged())); + subscriberKSettingsAutomaticKeyguardTime = new QValueSpaceSubscriber("/KCRUidSecuritySettings/KSettingsAutomaticKeyguardTime", this); + connect(subscriberKSettingsAutomaticKeyguardTime, SIGNAL(contentsChanged()), this, SLOT(subscriberKSettingsAutomaticKeyguardTimeChanged())); + subscriberKDisplayLightsTimeout = new QValueSpaceSubscriber("/KCRUidLightSettings/KDisplayLightsTimeout", this); + connect(subscriberKDisplayLightsTimeout, SIGNAL(contentsChanged()), this, SLOT(subscriberKDisplayLightsTimeoutChanged())); + subscriberKProEngActiveProfile = new QValueSpaceSubscriber("/KCRUidProfileEngine/KProEngActiveProfile", this); + connect(subscriberKProEngActiveProfile, SIGNAL(contentsChanged()), this, SLOT(subscriberKProEngActiveProfileChanged())); + + subscriberKSecurityUIsDismissDialog = new QValueSpaceSubscriber("/KPSUidSecurityUIs/KSecurityUIsDismissDialog", this); + connect(subscriberKSecurityUIsDismissDialog, SIGNAL(contentsChanged()), this, SLOT(subscriberKSecurityUIsDismissDialogChanged())); + + // subscribe to environment changes + subscriberKHWRMGripStatus = new QValueSpaceSubscriber("/KPSUidHWRM/KHWRMGripStatus"); + connect(subscriberKHWRMGripStatus, SIGNAL(contentsChanged()), this, SLOT(subscriberKHWRMGripStatusChanged())); + + subscriberKAknKeyguardStatus = new QValueSpaceSubscriber("/KPSUidAvkonDomain/KAknKeyguardStatus"); + connect(subscriberKAknKeyguardStatus, SIGNAL(contentsChanged()), this, SLOT(subscriberKAknKeyguardStatusChanged())); + + subscriberKCoreAppUIsAutolockStatus = new QValueSpaceSubscriber("/KPSUidCoreApplicationUIs/KCoreAppUIsAutolockStatus"); + connect(subscriberKCoreAppUIsAutolockStatus, SIGNAL(contentsChanged()), this, SLOT(subscriberKCoreAppUIsAutolockStatusChanged())); + + subscriberKCTsyCallState = new QValueSpaceSubscriber("/KPSUidCtsyCallInformation/KCTsyCallState"); + connect(subscriberKCTsyCallState, SIGNAL(contentsChanged()), this, SLOT(subscriberKCTsyCallStateChanged())); + + // inactivity + connect(serviceKeyguard, SIGNAL(active()), this, SLOT(activeKeyguard())); + connect(serviceKeyguard, SIGNAL(notActive()), this, SLOT(notActiveKeyguard())); + connect(serviceDevicelock, SIGNAL(active()), this, SLOT(activeDevicelock())); + connect(serviceDevicelock, SIGNAL(notActive()), this, SLOT(notActiveDevicelock())); + + RWindowGroup& groupWin = CEikonEnv::Static()->RootWin(); + RDEBUG("got groupWin", 1); + // if I want to release, I should do: mKeyCaptureHandle = env->RootWin().CaptureKey(EKeyBackspace, 0, 0); + mEKeyDeviceFCaptureHandle = groupWin.CaptureKey(EKeyDeviceF, 0, 0); + RDEBUG("mEKeyDeviceFCaptureHandle", mEKeyDeviceFCaptureHandle); + mEKeyBellCaptureHandle = groupWin.CaptureKey(EKeyBell, 0, 0); + RDEBUG("mEKeyBellCaptureHandle", mEKeyBellCaptureHandle); + RDEBUG("got mKeyCaptureHandle", 1); + + iSecQueryUiCreated = -1; + iDeviceDialogCreated = EDeviceDialogUninitialized; + RDEBUG("new iDeviceDialogCreated", iDeviceDialogCreated); + iDeviceDialog = NULL; + // for now, always starts unlocked. This is correct because if locked, the unlock-query (from starter) is on top + // TryChangeStatus(iLockStatus); + TryChangeStatus( ELockNotActive); + lower(); + hide(); + + iDeviceDialog = new HbDeviceDialog(HbDeviceDialog::NoFlags, this); + connect(iDeviceDialog, SIGNAL(dataReceived(QVariantMap)), SLOT(handleMessageFromScreensaver(QVariantMap))); + connect(iDeviceDialog, SIGNAL(deviceDialogClosed()), SLOT(handleScreensaverClosed())); + + // screensaver standby mode timer + mScreensaverModeTimer = new QTimer(this); + mScreensaverModeTimer->setInterval(5 * 1000); // milliseconds, TODO: read from cenrep + connect(mScreensaverModeTimer, SIGNAL(timeout()), SLOT(switchScreensaverToPowerSaveMode())); + // screensaver AMOLED low power mode support + mScreensaverPowerSave = CPowerSaveDisplayMode::NewL(); + mScreensaverPowerSavePixelBuffer = HBufC16::NewL(360 * 640); + mScreensaverPowerSavePixelBuffer->Des().Fill(0); + } + +Autolock::~Autolock() + { + RDEBUG("0", 0); + delete mService; + delete mScreensaverPowerSave; + delete mScreensaverPowerSavePixelBuffer; + RDEBUG("1", 1); + } + +void Autolock::adjustInactivityTimers(int aReason) + { + RDEBUG("aReason", aReason); + TInt keyguardTime = 0; + TInt lockTime = 0; + CRepository* repository = NULL; + TInt cRresult = 0; + Q_UNUSED(cRresult); + + QT_TRAP_THROWING(repository = CRepository::NewL(KCRUidSecuritySettings)); + cRresult = repository->Get(KSettingsAutomaticKeyguardTime, keyguardTime); // in seconds + RDEBUG("KSettingsAutomaticKeyguardTime", KSettingsAutomaticKeyguardTime); + RDEBUG("cRresult", cRresult); + RDEBUG("keyguardTime", keyguardTime); + if (keyguardTime > 0 && keyguardTime < 1000) + { + serviceKeyguard->setInactivityPeriod(keyguardTime); + } + else + { + serviceKeyguard->setInactivityPeriod(12 * 31 * 24 * 60 * 60); + } + + cRresult = repository->Get(KSettingsAutoLockTime, lockTime); // in minutes, handled internally as seconds + lockTime *= 60; + RDEBUG("KSettingsAutoLockTime", KSettingsAutoLockTime); + RDEBUG("cRresult", cRresult); + RDEBUG("lockTime", lockTime); + if (lockTime == 65535 * 60) // Special setting "lock at same time as keyguard" at CpDeviceLockPluginView::GetAutoLockIndex which uses this magic number + lockTime = keyguardTime - 2; // lock 2 seconds before before, to avoid keyguard->devicelock sequence + if (lockTime > 60 && lockTime < 24 * 60 * 60) // lock timer can't be bigger than 1 day + { + serviceDevicelock->setInactivityPeriod(lockTime); + } + else + { + serviceDevicelock->setInactivityPeriod(12 * 31 * 24 * 60 * 60); // 0x1ea6e00 + } + + delete repository; + } +void Autolock::quit() + { + RDEBUG("0", 0); + qApp->quit(); + } + +int Autolock::AskValidSecCode(int aReason) + { + RDEBUG("aReason", aReason); + RMobilePhone iPhone; // NULL in emulator + +#ifdef __WINS__1 + return KErrNone; +#endif + + TInt err(KErrGeneral); + Q_UNUSED(err); + TBool validCode(EFalse); + TInt thisTry(0); + RTelServer iTelServer; + + err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsLights, ESecurityUIsLightsQueryOnRequest); + RDEBUG("KSecurityUIsLights err", err); + + RMmCustomAPI iCustomPhone; + while ((err = iTelServer.Connect()) != KErrNone && (thisTry++) <= KTriesToConnectServer) + { + User::After( KTimeBeforeRetryingServerConnection); + } + err = iTelServer.LoadPhoneModule(KMmTsyModuleName); + RTelServer::TPhoneInfo PhoneInfo; + RDEBUG("LoadPhoneModule err", err); + err = iTelServer.SetExtendedErrorGranularity(RTelServer::EErrorExtended); + RDEBUG("SetExtendedErrorGranularity err", err); + err = iTelServer.GetPhoneInfo(KPhoneIndex, PhoneInfo); + RDEBUG("GetPhoneInfo err", err); + err = iPhone.Open(iTelServer, PhoneInfo.iName); + RDEBUG("Open err", err); + err = iCustomPhone.Open(iPhone); + RDEBUG("Open2 err", err); + + RDEBUG("CSecurityHandler", 0); + CSecurityHandler* handler = new (ELeave) CSecurityHandler(iPhone); + if (aReason == ELockAppDisableDevicelock) + { + RDEBUG("calling AskSecCodeInAutoLockL", 0); + iLockCodeQueryInDisplay = ETrue; + QT_TRAP_THROWING(validCode = handler->AskSecCodeInAutoLockL()); // this returns true/false + iLockCodeQueryInDisplay = EFalse; + // TODO should this also do iPhone.SetLockSetting(status, lockType, lockChange); ??? + } + else if (aReason == ELockAppEnableDevicelock) + { + // check whether code is really needed + RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; + RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; + RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); + RMobilePhone::TMobilePhoneLockSetting lockChange(RMobilePhone::ELockSetDisabled); + TRequestStatus status = KRequestPending; + TInt ret = KErrNone; + RDEBUG("GetLockInfo", 0); + iPhone.GetLockInfo(status, lockType, lockInfoPkg); + RDEBUG("WaitForRequest", 0); + User::WaitForRequest(status); + ret = status.Int(); + RDEBUG("WaitForRequest ret", ret); +#ifdef __WINS__ + if (ret == KErrTimedOut) + { + ret = KErrNone; + lockInfo.iSetting = RMobilePhone::ELockSetDisabled; // ask password only if there's no timeout. + } +#endif + if (ret == KErrNone) + { + RDEBUG("lockInfo.iSetting", lockInfo.iSetting); + RDEBUG("RMobilePhone::ELockSetDisabled", + RMobilePhone::ELockSetDisabled); + if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) // ask password only if there's no timeout + { + lockChange = RMobilePhone::ELockSetEnabled; + RDEBUG("SetLockSetting lockChange", lockChange); +#define OLD_METHODx +#ifdef OLD_METHOD + status = KRequestPending; + RDEBUG( "SetLockSetting", 0 ); + iPhone.SetLockSetting(status, lockType, lockChange); // ask for PassPhraseRequiredL + RDEBUG( "WaitForRequestL", 0 ); + User::WaitForRequest( status ); // TODO this waits 33 seconds in WINS and returns ffffffdf = KErrTimedOut + ret = status.Int(); + RDEBUG( "WaitForRequestL ret", ret ); +#else + RDEBUG("! OLD_METHOD", 0); + CWait *iWait = NULL; + QT_TRAP_THROWING(iWait = CWait::NewL()); + iWait->SetRequestType(EMobilePhoneSetLockSetting); + iPhone.SetLockSetting(iWait->iStatus, lockType, lockChange); // ask for PassPhraseRequiredL + RDEBUG("WaitForRequestL", 0); + QT_TRAP_THROWING(ret = iWait->WaitForRequestL()); + RDEBUG("WaitForRequestL ret", ret); + if (iWait) + { + RDEBUG("IsActive", 0); + if (iWait->IsActive()) + { + RDEBUG("CancelAsyncRequest", 0); + iPhone.CancelAsyncRequest(iWait->GetRequestType()); + RDEBUG("cancelled", 0); + } + } + delete iWait; +#endif + + RDEBUG("WaitForRequestL ret", ret); +#ifdef __WINS__ + if (ret == KErrTimedOut) + ret = KErrNone; +#endif + if (ret == KErrNone) + validCode = 1; + else + validCode = 0; + } + else + { + RDEBUG("RMobilePhone::ELockSetEnabled", RMobilePhone::ELockSetEnabled); + RDEBUG("lockInfo.iSetting = RMobilePhone::ELockSetEnabled", RMobilePhone::ELockSetEnabled); + validCode = 0x20; + } + } + else + { + RDEBUG("Error: ret", ret); + validCode = 0x21; + } + + /* Alternative way to ask for password + RMobilePhone::TMobilePhoneSecurityEvent iEvent; + TInt result = KErrNone; + iEvent = RMobilePhone::EPhonePasswordRequired; + RDEBUG( "calling HandleEventL", 0 ); + handler->HandleEventL(iEvent, result); // this is supposed to wait + validCode = false; + if(result) + validCode = true; + RDEBUG( "result", result ); + */ + } + RDEBUG("validCode", validCode); + if (validCode > 0) + return KErrNone; + + // no valid code -> switch off the lights + err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsLights, ESecurityUIsLightsLockOffRequest); + RDEBUG("KSecurityUIsLights err", err); + return KErrCancel; + } + +void Autolock::handleAnswerDelivered() + { + RDEBUG("0", 0); + // quit(); + + } + +void Autolock::setLabelNumber(QString label, QString number) + { + RDEBUG("0", 0); + } + +void Autolock::DebugRequest(int aReason) + { + switch (aReason) + { + case ELockAppEnableKeyguard: + RDEBUG("ELockAppEnableKeyguard", aReason) + ; + break; + case ELockAppDisableKeyguard: + RDEBUG("ELockAppDisableKeyguard", aReason) + ; + break; + case ELockAppEnableDevicelock: + RDEBUG("ELockAppEnableDevicelock", aReason) + ; + break; + case ELockAppDisableDevicelock: + RDEBUG("ELockAppDisableDevicelock", aReason) + ; + break; + case ELockAppOfferKeyguard: + RDEBUG("ELockAppOfferKeyguard", aReason) + ; + break; + case ELockAppOfferDevicelock: + RDEBUG("ELockAppOfferDevicelock", aReason) + ; + break; + case ELockAppShowKeysLockedNote: + RDEBUG("ELockAppShowKeysLockedNote", aReason) + ; + break; + default: + RDEBUG("default", aReason) + ; + break; + } + } +void Autolock::DebugStatus(int aReason) + { + switch (aReason) + { + case ELockNotActive: + RDEBUG("ELockNotActive", aReason) + ; + break; + case EKeyguardActive: + RDEBUG("EKeyguardActive", aReason) + ; + break; + case EDevicelockActive: + RDEBUG("EDevicelockActive", aReason) + ; + break; + default: + RDEBUG("default", aReason) + ; + break; + } + } +void Autolock::DebugError(int aReason) + { + switch (aReason) + { + case KErrNone: + RDEBUG("KErrNone", aReason) + ; + break; + case KErrPermissionDenied: // caller doesn't have enough capabilities + RDEBUG("KErrPermissionDenied", aReason) + ; + break; + case KErrAlreadyExists: // this particular lock is already enabled + RDEBUG("KErrAlreadyExists", aReason) + ; + break; + case KErrInUse: // the dialog is already shown + RDEBUG("KErrInUse", aReason) + ; + break; + default: + RDEBUG("default", aReason) + ; + break; + } + } + +int Autolock::CheckIfLegal(int aReason) + { + RDEBUG("aReason", aReason); + // check whether a dialog is already displayed. This is to prevent timeout-lock and timeout-keyguard activated on top of a PIN query, in particular at boot-up (TODO check for Starter) + TInt secUiOriginatedQuery(ESecurityUIsSecUIOriginatedUninitialized); + TInt err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); + RDEBUG("err", err); + RDEBUG("secUiOriginatedQuery", secUiOriginatedQuery); + switch (aReason) + { + case ELockAppEnableKeyguard: + { + RDEBUG("ELockAppEnableKeyguard iLockStatus", iLockStatus); + if (secUiOriginatedQuery != ESecurityUIsSecUIOriginatedUninitialized) + return KErrInUse; // PIN on top. Don't keyguard + switch (iLockStatus) + { + case ELockNotActive: + if (!CKeyLockPolicyApi::KeyguardAllowed()) + return KErrPermissionDenied; + else + return KErrNone; + case EKeyguardActive: + return KErrAlreadyExists; + case EDevicelockActive: + return KErrPermissionDenied; + } + } + break; + case ELockAppDisableKeyguard: + { + RDEBUG("ELockAppDisableKeyguard iLockStatus", iLockStatus); + // no matter whether PIN is displayed + switch (iLockStatus) + { + case ELockNotActive: + return KErrAlreadyExists; + case EKeyguardActive: + return KErrNone; + case EDevicelockActive: + return KErrPermissionDenied; + } + } + break; + case ELockAppEnableDevicelock: + { + RDEBUG("ELockAppEnableDevicelock iLockStatus", iLockStatus); + if (secUiOriginatedQuery != ESecurityUIsSecUIOriginatedUninitialized && secUiOriginatedQuery != ESecurityUIsSystemLockOriginated) + return KErrInUse; // PIN on top. Don't devicelock + switch (iLockStatus) + { + case ELockNotActive: + return KErrNone; + case EKeyguardActive: + return KErrNone; + case EDevicelockActive: + return KErrAlreadyExists; + } + } + break; + case ELockAppDisableDevicelock: + { + RDEBUG("ELockAppDisableDevicelock iLockStatus", iLockStatus); + if (iLockCodeQueryInDisplay) + { + // PIN on top and trying to display unlock-code. This is valid + return KErrAlreadyExists; + } + switch (iLockStatus) + { + case ELockNotActive: + return KErrAlreadyExists; + case EKeyguardActive: + return KErrPermissionDenied; + case EDevicelockActive: + return KErrNone; + } + } + break; + case ELockAppOfferKeyguard: + { + RDEBUG("ELockAppOfferKeyguard iLockStatus", iLockStatus); + if (secUiOriginatedQuery != ESecurityUIsSecUIOriginatedUninitialized && secUiOriginatedQuery != ESecurityUIsSystemLockOriginated) + return KErrInUse; // PIN on top. Don't offer + switch (iLockStatus) + { + case ELockNotActive: + return KErrNone; + case EKeyguardActive: + return KErrPermissionDenied; + case EDevicelockActive: + return KErrPermissionDenied; + } + } + break; + case ELockAppOfferDevicelock: + { + RDEBUG("ELockAppOfferDevicelock iLockStatus", iLockStatus); + if (secUiOriginatedQuery != ESecurityUIsSecUIOriginatedUninitialized && secUiOriginatedQuery != ESecurityUIsSystemLockOriginated) + return KErrInUse; // PIN on top. Don't offer + switch (iLockStatus) + { + case ELockNotActive: + return KErrNone; + case EKeyguardActive: + return KErrNone; + case EDevicelockActive: + return KErrAlreadyExists; + } + } + break; + case ELockAppShowKeysLockedNote: + { + RDEBUG("ELockAppShowKeysLockedNote iLockStatus", iLockStatus); + if (secUiOriginatedQuery != ESecurityUIsSecUIOriginatedUninitialized && secUiOriginatedQuery != ESecurityUIsSystemLockOriginated) + return KErrInUse; // PIN on top. Don't display + switch (iLockStatus) + { + case ELockNotActive: + return KErrPermissionDenied; + case EKeyguardActive: + return KErrNone; + case EDevicelockActive: // TODO confirm this. CMMKeyBearer::ReceivedKeyEvent expects KErrNone if keypad is locked + return KErrPermissionDenied; + } + } + break; + default: + { + RDEBUG("default iLockStatus", iLockStatus); + return KErrPermissionDenied; + } + // break; + } // switch + return KErrPermissionDenied; + } + +int Autolock::publishStatus(int aReason) + { + RDEBUG("aReason", aReason); + Q_UNUSED(aReason); + TInt err = KErrNone; + Q_UNUSED(err); + // can't use include file because it's private file. However it gives permissions + const TUid KCRUidCoreApplicationUIsSysAp = + { + 0x101F8765 + }; + const TUint32 KSysApKeyguardActive = 0x00000001; + CRepository* repositoryDevicelock = NULL; + CRepository* repositoryKeyguard = NULL; + QT_TRAP_THROWING(repositoryDevicelock = CRepository::NewL(KCRUidSecuritySettings)); + QT_TRAP_THROWING(repositoryKeyguard = CRepository::NewL(KCRUidCoreApplicationUIsSysAp)); + TInt cRresult = KErrNone; + Q_UNUSED(cRresult); + if (1 == 1) // this is a quick way to disable this functionality, for testing + { + RDEBUG("publishing", aReason); + if (aReason == ELockNotActive) + { + err = RProperty::Set(KPSUidAvkonDomain, KAknKeyguardStatus, EKeyguardNotActive); + RDEBUG("err", err); + err = RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOff); + RDEBUG("err", err); + err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsLights, ESecurityUIsLightsLockOnRequest); // lights are required + RDEBUG("KSecurityUIsLights err", err); + + // cRresult = repositoryDevicelock->Set(KSettingsAutolockStatus, 0); // the settings remains. Only ISA changes, as well as the P&S + cRresult = repositoryKeyguard->Set(KSysApKeyguardActive, 0); + RDEBUG("cRresult", cRresult); + } + if (1 == 1) // this is a quick way to disable this functionality, for testing + { + if (aReason == EKeyguardActive) + { + err = RProperty::Set(KPSUidAvkonDomain, KAknKeyguardStatus, EKeyguardLocked); + RDEBUG("KAknKeyguardStatus err", err); + err = RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOff); + RDEBUG("KCoreAppUIsAutolockStatus err", err); + err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsLights, ESecurityUIsLightsLockOffRequest); // same for keyguard and devicelock + RDEBUG("KSecurityUIsLights err", err); + // cRresult = repositoryDevicelock->Set(KSettingsAutolockStatus, 0); + cRresult = repositoryKeyguard->Set(KSysApKeyguardActive, 1); + RDEBUG("cRresult", cRresult); + } + else if (aReason >= EDevicelockActive) + { + err = RProperty::Set(KPSUidAvkonDomain, KAknKeyguardStatus, EKeyguardAutolockEmulation); // Other candidates might be: EKeyguardLocked and EKeyguardNotActive + RDEBUG("KAknKeyguardStatus err", err); + err = RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EManualLocked); + RDEBUG("KCoreAppUIsAutolockStatus err", err); + err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsLights, ESecurityUIsLightsLockOffRequest); + RDEBUG(" KSecurityUIsLights err", err); + // cRresult = repositoryDevicelock->Set(KSettingsAutolockStatus, 1); + cRresult = repositoryKeyguard->Set(KSysApKeyguardActive, 0); // keyguard disabled, so that user can type and DeviceF can be captured + RDEBUG("cRresult", cRresult); + } + } + } + delete repositoryDevicelock; + delete repositoryKeyguard; + // this is the real point where everything is done. + iLockStatusPrev = iLockStatus; + iLockStatus = aReason; + RDEBUG("setting iLockStatus", iLockStatus); + return KErrNone; + } +/********************/ +int Autolock::showNoteIfRequested(int aReason) + { + RDEBUG("aReason", aReason); + // The notes are displayed. This is useful only for the API withNote, and ELockAppShowKeysLockedNote + // However, it has some inconvenients: + // - the screensaver already displays/hides + // - the notes are shown behing the icon because they have lower priorities + // - they are annoying + // TODO translate + if (aReason == ELockNotActive) + { + if (iShowKeyguardNote == 1) + { + HbDeviceMessageBox::information("Keyguard deactivated"); + } + } + else if (aReason == EKeyguardActive) + { + if (iShowKeyguardNote == 1) + { + HbDeviceMessageBox::information("Keyguard activated"); + // this already waits a bit because the lock-icon takes some time to display. So the note is visible before the lock-icon. + } + } + else if (aReason >= EDevicelockActive) // this doesn't happen, but we are prepared nevertheless + { + if (iShowKeyguardNote == 1) + { + HbDeviceMessageBox::information("Devicelock activated"); + } + } + return KErrNone; + } +/***********************/ +int Autolock::TryChangeStatus(int aReason) + { + RDEBUG("aReason", aReason); + int ret = aReason; + int errorInProcess = KErrNone; + DebugRequest(ret); + + // this will cancel any previous dialog, i.e. PIN query, or any previous code-request. + // not sure about the screensaver, but nevertheless will be cancelled when the status is changed. + TInt err = KErrNone; + Q_UNUSED(err); + RDEBUG("Not setting KSecurityUIsDismissDialog ESecurityUIsDismissDialogOn", ESecurityUIsDismissDialogOn); + //// err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsDismissDialog, ESecurityUIsDismissDialogOn); + RDEBUG("err", err); + switch (ret) + { + case ELockAppEnableKeyguard: // 1 + { + errorInProcess = CheckIfLegal(ret); + DebugError(errorInProcess); + if (errorInProcess == KErrNone) + { + showNoteIfRequested( EKeyguardActive); + setLabelIcon(EKeyguardActive); + updateIndicator(EKeyguardActive); + publishStatus(EKeyguardActive); + setLockDialog(aReason, 1); + } + } + break; + case ELockAppDisableKeyguard: // 2 + { + errorInProcess = CheckIfLegal(ret); + DebugError(errorInProcess); + if (errorInProcess == KErrNone) + { + showNoteIfRequested( ELockNotActive); + setLabelIcon(ELockNotActive); + updateIndicator(ELockNotActive); + publishStatus(ELockNotActive); + setLockDialog(aReason, 0); + } + } + break; + case ELockAppEnableDevicelock: // 3 + { + errorInProcess = CheckIfLegal(ret); + DebugError(errorInProcess); + if (errorInProcess == KErrNone) + { + if (!callerHasECapabilityWriteDeviceData) // check permissions for calling process, because doesn't AskValidSecCode + errorInProcess = KErrPermissionDenied; + DebugError(errorInProcess); + } + if (errorInProcess == KErrNone) + { + updateIndicator( EDevicelockActive); + publishStatus(EDevicelockActive); + setLabelIcon(EDevicelockActive); + setLockDialog(aReason, 1); + } + // aParam1 is aReason : EDevicelockManual, EDevicelockRemote + // this never shows a note + } + break; + case ELockAppDisableDevicelock: // 4 + { + errorInProcess = CheckIfLegal(ret); + DebugError(errorInProcess); + if (errorInProcess == KErrNone) + { + if (!callerHasECapabilityWriteDeviceData) // check permissions for calling process, because doesn't AskValidSecCode + errorInProcess = KErrPermissionDenied; + DebugError(errorInProcess); + } + if (errorInProcess == KErrNone) + { + setLockDialog(aReason, 0); // hide temporarilly because HbDeviceMessageBox doesn't get in top of the Lock-icon. Thus, dismiss it. + // do I need to enable touch? it seems to work without it + // in any case, lights are needed + err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsLights, ESecurityUIsLightsQueryOnRequest); + RDEBUG("calling HbDeviceMessageBox::question", 0); + bool value = true; + // not sure whether this question is really needed. The UI doesn't say anything, so I remove it for now. + // HbDeviceMessageBox::question("Disable Lock?"); // this doesn't block other events, so after return everything might be messed up. + RDEBUG("value", value); + if (!value) + errorInProcess = KErrCancel; + } + if (errorInProcess == KErrNone) + { + setLockDialog(aReason, 0); // hide temporarilly because AskValidSecCode doesn't get in top of the Lock-icon. Thus, dismiss it. + RDEBUG("calling AskValidSecCode", 0); + errorInProcess = AskValidSecCode(ELockAppDisableDevicelock); + RDEBUG("errorInProcess", errorInProcess); + } + if (errorInProcess == KErrNone) + { + setLabelIcon( ELockNotActive); + updateIndicator(ELockNotActive); + setLockDialog(aReason, 0); + publishStatus(ELockNotActive); + } + if (errorInProcess != KErrNone) + { // re-lock. For example, if password is wrong + if (iLockStatus >= EDevicelockActive) // this skips the case "unlocking although it wasn't locked" + setLockDialog(ELockAppEnableDevicelock, 1); + } + // this never shows a note + } + break; + case ELockAppOfferKeyguard: // 5 + { + errorInProcess = CheckIfLegal(ret); + DebugError(errorInProcess); + if (errorInProcess == KErrNone) + { + // no need to dismiss screensaver, because it's not active + // what about any PIN-query, i.e. from settings ? In this case, the query will show after the PIN query is finished. somehow this is good because PIN is more important + bool value = HbDeviceMessageBox::question("Enable Keyguard?"); // this doesn't block other events, so after return everything might be messed up. + // what about a nice icon? + RDEBUG("value", value); + if (!value) + errorInProcess = KErrCancel; + } + if (errorInProcess == KErrNone) + { + errorInProcess = TryChangeStatus(ELockAppEnableKeyguard); + } + // this never shows a note + } + break; + case ELockAppOfferDevicelock: // 6 + { + errorInProcess = CheckIfLegal(ret); + DebugError(errorInProcess); + if (errorInProcess == KErrNone) + { + setLockDialog(aReason, 0); // hide temporarilly because AskValidSecCode doesn't get in top of the Lock-icon. Thus, dismiss it. + errorInProcess = AskValidSecCode(ELockAppEnableDevicelock); + } + if (errorInProcess == KErrNone) + { + RDEBUG("ELockAppOfferDevicelock calling ELockAppEnableDevicelock", ELockAppEnableDevicelock); + errorInProcess = TryChangeStatus(ELockAppEnableDevicelock); + } + // this never shows a note. Perhaps ELockAppEnableDevicelock does. + } + break; + case ELockAppShowKeysLockedNote: // 7 + { + errorInProcess = CheckIfLegal(ret); // it will not be legal if the keyguard is not enabled and the devicelock is not enabled. + DebugError(errorInProcess); + if (errorInProcess == KErrNone) + { + iShowKeyguardNote = 1; // this is not sent as parameter, so we need to fake it: ON + showNoteIfRequested( EKeyguardActive); + } + } + break; + default: + { + RDEBUG("default", ret); + errorInProcess = KErrNotSupported; + } + break; + + } + return errorInProcess; + } +/**************************/ +int Autolock::setLockDialog(int aReason, int status) + { + RDEBUG("aReason", aReason); + RDEBUG("status", status); + RDEBUG("iDeviceDialogCreated", iDeviceDialogCreated); + TInt secUiOriginatedQuery(ESecurityUIsSecUIOriginatedUninitialized); + TInt err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); + RDEBUG("err", err); + RDEBUG("secUiOriginatedQuery", secUiOriginatedQuery); + + RWindowGroup& groupWin = CEikonEnv::Static()->RootWin(); + + if (status == 0) // hide + { + // aReason is not important here, but let's check nevertheless + RDEBUG("ReleaseContext", R_AVKON_DEFAULT_SKEY_LIST); + static_cast(CEikonEnv::Static()->EikAppUi())->KeySounds()->ReleaseContext(); + RDEBUG("PopContext", 0x90); + static_cast(CEikonEnv::Static()->EikAppUi())->KeySounds()->PopContext(); + RDEBUG("ReleaseContext done", 0x92); + + if (aReason != ELockAppDisableKeyguard && aReason != ELockAppDisableDevicelock) + { + RDEBUG("!!!!****!!!!! error. status=0 but aReason", aReason); + } + // secUiOriginatedQuery should be ESecurityUIsSystemLockOriginated . If not, this is not correctly setting it + if (iDeviceDialogCreated >= EDeviceDialogCreated) + { + iDeviceDialogCreated = EDeviceDialogDestroyed; + RDEBUG("new iDeviceDialogCreated", iDeviceDialogCreated); + + RDEBUG("calling switchScreensaverMode", ESnsrViewTypeDisabled); + switchScreensaverMode( ESnsrViewTypeDisabled); + + disconnect(iDeviceDialog, SIGNAL(dataReceived(QVariantMap)), this, SLOT(handleMessageFromScreensaver(QVariantMap))); + disconnect(iDeviceDialog, SIGNAL(deviceDialogClosed()), this, SLOT(handleScreensaverClosed())); + RDEBUG("signal disconnected", err); + // TODO this crashes for EDeviceDialogScreenSaver + err = iDeviceDialog->cancel(); + RDEBUG("cancel (bool: 1= wellCancelled) err", err); + err = iDeviceDialog->error(); + RDEBUG("err", err); + RDEBUG("calling iDeviceDialog->waitForClosed()", 0); + err = iDeviceDialog->waitForClosed(); + RDEBUG("cancel (bool: 1= well waitForClosed) err", err); + err = iDeviceDialog->error(); + RDEBUG("err", err); + + TInt err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginatedUninitialized); + RDEBUG("reset KSecurityUIsSecUIOriginatedQuery. err", err); + // Cancel power key and application key capturing + groupWin.CancelCaptureKey(mPowerKeyCaptureHandle); + groupWin.CancelCaptureKey(mApplicationKeyCaptureHandle); + groupWin.CancelCaptureLongKey(mApplicationLongKeyCaptureHandle); + RDEBUG("done CancelCaptureKey", 1); + if (mEKeyYesCaptureHandle) + { + RDEBUG("mEKeyYesCaptureHandle", mEKeyYesCaptureHandle); + groupWin.CancelCaptureKey(mEKeyYesCaptureHandle); + mEKeyYesCaptureHandle = NULL; + } + if (mEKeyNoCaptureHandle) + { + RDEBUG("mEKeyNoCaptureHandle", mEKeyNoCaptureHandle); + groupWin.CancelCaptureKey(mEKeyNoCaptureHandle); + mEKeyNoCaptureHandle = NULL; + } + + RDEBUG("deleting iDeviceDialog", 0); + delete iDeviceDialog; + RDEBUG("deleted iDeviceDialog", 1); + iDeviceDialog = NULL; + } + } + else if (status == 1) // show + { + RDEBUG("PushContextL", R_AVKON_DEFAULT_SKEY_LIST); + static_cast(CEikonEnv::Static()->EikAppUi())->KeySounds()->PushContextL(R_AVKON_SILENT_SKEY_LIST); + RDEBUG("BringToForeground", 0x90); + static_cast(CEikonEnv::Static()->EikAppUi())->KeySounds()->BringToForeground(); + RDEBUG("LockContext", 0x91); + static_cast(CEikonEnv::Static()->EikAppUi())->KeySounds()->LockContext(); + RDEBUG("PushContextL Done", 0x92); + + // secUiOriginatedQuery should be ESecurityUIsSecUIOriginatedUninitialized . If not, the validation is not correctly filtering it + QVariantMap params; + TBool err; +#define ESecUiTypeDeviceLock 0x00100000 +#define ESecUiTypeKeyguard 0x00200000 + + if (aReason == ELockAppEnableKeyguard) + params.insert("type", ESecUiTypeKeyguard); + else if (aReason == ELockAppEnableDevicelock) + params.insert("type", ESecUiTypeDeviceLock); + else + { + RDEBUG("error. status=1 but aReason", aReason); + } + // no need for title. Icon should be explicit enough + // params.insert("title", "Locked"); + if (iDeviceDialogCreated < EDeviceDialogCreated) + { + if (iDeviceDialog != NULL) + { + RDEBUG("!!!!!!*********!!!!!!!! error: iDeviceDialog != NULL", 0); + } + RDEBUG("creating iDeviceDialog", 0); + iDeviceDialog = new HbDeviceDialog(HbDeviceDialog::NoFlags, this); + // in theory this is needed only for screensaver, not for LockIcon. But it doesn't harm + connect(iDeviceDialog, SIGNAL(dataReceived(QVariantMap)), SLOT(handleMessageFromScreensaver(QVariantMap))); + connect(iDeviceDialog, SIGNAL(deviceDialogClosed()), SLOT(handleScreensaverClosed())); + iDeviceDialogCreated = EDeviceDialogCreated; + RDEBUG("new iDeviceDialogCreated", iDeviceDialogCreated); + } + else + { + RDEBUG("raising iDeviceDialog", 0); + // confirm that dialog is present + err = iDeviceDialog->error(); + RDEBUG("err", err); + iDeviceDialogCreated = EDeviceDialogRaised; + RDEBUG("new iDeviceDialogCreated", iDeviceDialogCreated); + } + const QString KScreensaverDeviceDialog("com.nokia.screensaver.snsrdevicedialogplugin/1.0"); + RDEBUG("pre show", aReason); + bool launchSuccesful = iDeviceDialog->show(KScreensaverDeviceDialog, params); // and continue processing + RDEBUG("post show. bool launchSuccesful", launchSuccesful); + err = iDeviceDialog->error(); + RDEBUG("iDeviceDialog->error", err); + if (launchSuccesful) // TODO && !error ??? + { + iDeviceDialogCreated = EDeviceDialogScreenSaver; + RDEBUG("new iDeviceDialogCreated", iDeviceDialogCreated); + // TODO this is needed if creating dialog for first time? switchScreensaverToActiveMode(); // this is needed in case the dialog was existing. + // Start standy mode timer. The initial state may already be the standby + // mode but setting screensaver again to standby doesn't hurt. + mScreensaverModeTimer->start(); + } + else // some err. Usually 3 (not existing) + { + // screensaver has failed. Probably because it's not installed. Then, try the standard lock-icon + iDeviceDialogCreated = EDeviceDialogLockIcon; + RDEBUG("new iDeviceDialogCreated", iDeviceDialogCreated); + const QString KSecQueryUiDeviceDialog("com.nokia.secuinotificationdialog/1.0"); + err = iDeviceDialog->show(KSecQueryUiDeviceDialog, params); // and continue processing + RDEBUG("post show. err", err); + } + err = iDeviceDialog->error(); + RDEBUG("err", err); + // This won't be needed when screensaver is in place, as the dialogs will be different, and therefore both can be present + // Somehow this should be handled by Orbit, but unfortunatelly they don't allow the same dialog twice + err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginatedUninitialized); // this could also be ESecurityUIsSystemLockOriginated + RDEBUG("err", err); + // Capture power and application keys while screen saver is open. Also works for LockIcon + mPowerKeyCaptureHandle = groupWin.CaptureKey(EKeyDevice2, 0, 0); + mApplicationKeyCaptureHandle = groupWin.CaptureKey(EKeyApplication0, 0, 0); + mApplicationLongKeyCaptureHandle = groupWin.CaptureLongKey(EKeyApplication0, EKeyApplication0, 0, 0, 0, ELongCaptureShortEventImmediately | ELongCaptureRepeatEvents); + mEKeyYesCaptureHandle = groupWin.CaptureKey(EKeyYes, 0, 0); + mEKeyNoCaptureHandle = groupWin.CaptureKey(EKeyNo, 0, 0); + RDEBUG("keys captured", err); + } + else + { + RDEBUG("unknown status", status); + return KErrNotSupported; + } + return KErrNone; + } + +void Autolock::setLabelIcon(int aReason) + { + RDEBUG("aReason", aReason); + + if (aReason == ELockNotActive) + { + // setLockDialog(aReason, 0); // This is done already at TryChangeStatus + lower(); + hide(); + } + else if (aReason == EKeyguardActive) + { + // setLockDialog(aReason, 1); // This is done already at TryChangeStatus + // this shows the Autolock Application. not needed + } + else if (aReason == EDevicelockActive) + { + } + else + { + RDEBUG("error: aReason", aReason); + } + } + +int Autolock::updateIndicator(int aReason) + { + RDEBUG("aReason", aReason); + QList list; + list.insert(0, 1); + list.insert(1, "dummy"); + list.insert(2, 2); + + HbIndicator indicator; + bool success; + if (aReason == ELockNotActive) + success = indicator.deactivate("com.nokia.hb.indicator.autolock.autolock_8/1.0"); // maybe it's already deactivated. Not a problem + else if (aReason == EKeyguardActive) + success = indicator.activate("com.nokia.hb.indicator.autolock.autolock_8/1.0"); + else if (aReason == EDevicelockActive) + success = indicator.activate("com.nokia.hb.indicator.autolock.autolock_8/1.0"); // same. We have just 1 indicator + else + success = 0; + RDEBUG("success", success); + return success; + } + +void Autolock::activeKeyguard() + { + // activity while keyguarded. Nothing to do + RDEBUG("0", 0); + } + +void Autolock::notActiveKeyguard() + { + // inactivity. Keyguard should be activated + RDEBUG("0", 0); + int ret = KErrNone; + DebugStatus( iLockStatus); + if (iLockStatus == ELockNotActive) // not possible if it's keyguarded, or locked + { + TInt callState = EPSCTsyCallStateNone; + int err = RProperty::Get(KPSUidCtsyCallInformation, KCTsyCallState, callState); + RDEBUG("err", err); + RDEBUG("callState", callState); + // if there's an active call, don't auto-keyguard (manual is still possible) + if (callState <= EPSCTsyCallStateNone) + { + ret = TryChangeStatus(ELockAppEnableKeyguard); + RDEBUG("ret", ret); + } + else + { + RDEBUG("not ELockAppEnableKeyguard because callState", callState); + } + } + else + { + // restart screensaver. The scenario is: keyguard->screensaver->CriticalNote->lightsOn . Therefore we need lightsOff + // this is done when keyguard can't be enabled because it's already enabled + // Note that this happens only once, so it's fine to show the screensaver in full light. + if (ret == KErrAlreadyExists) + switchScreensaverMode( ESnsrViewTypeInitial); + } + RDEBUG("ret", ret); + } +/* Some activity detected while the deviceLock is enabled */ +void Autolock::activeDevicelock() + { + // nothing to do + RDEBUG("0", 0); + } + +void Autolock::notActiveDevicelock() + { + // inactivity. Devicelock should be activated + RDEBUG("0", 0); + int ret = KErrNone; + Q_UNUSED(ret); + DebugStatus( iLockStatus); + if (iLockStatus == ELockNotActive || iLockStatus == EKeyguardActive) // not possible if it's locked + { + // this is independent of the call status + ret = TryChangeStatus(ELockAppEnableDevicelock); + } + RDEBUG("ret", ret); + + } + +void Autolock::switchScreensaverMode(int mode) + { + RDEBUG("mode", mode); + if (iDeviceDialog) + { + // maybe this can be used to tell the dialog to dismiss itself? + RDEBUG("got iDeviceDialog. iDeviceDialogCreated", iDeviceDialogCreated); + QVariantMap params; + // this is for LockIcon. Doesn't harm screensaver + // need to send again so that the existing dialog still knows what is its type + if (iLockStatus == EKeyguardActive) + params.insert("type", ESecUiTypeKeyguard); + else if (iLockStatus >= EDevicelockActive) + params.insert("type", ESecUiTypeDeviceLock); + + // this is for screensaver. Doesn't harm LockIcon + params.insert(KSnsrViewTypeKey, mode); + iDeviceDialog->update(params); + + if (mScreensaverModeTimer) + { + if (mode == ESnsrViewTypeStandby || mode == ESnsrViewTypeDisabled) + { + RDEBUG("stop mScreensaverModeTimer", 0); + mScreensaverModeTimer->stop(); + } + else + { + RDEBUG("start mScreensaverModeTimer", 0); + mScreensaverModeTimer->start(); + } + } + } + RDEBUG("1", 1); + } + +void Autolock::switchScreensaverToPowerSaveMode() + { + RDEBUG("0", 0); + switchScreensaverMode( ESnsrViewTypeStandby); + RDEBUG("1", 1); + } + +void Autolock::handleMessageFromScreensaver(const QVariantMap &data) + { + RDEBUG("0", 0); + RDEBUG("iLockStatus", iLockStatus); + QVariantMap::const_iterator it = data.find(KSnsrCmdUnlock); + if (it != data.end() && iLockStatus != ELockNotActive) + { + RDEBUG("calling handleLockSwitch", 0); + handleLockSwitch(); + } + + it = data.find(KSnsrCmdSwitchLights); + if (it != data.end()) + { + int lightStatus = it.value().toInt(); + RDEBUG("switching screen lights . lightStatus", lightStatus); + int err = RProperty::Set(KPSUidCoreApplicationUIs, KLightsSSForcedLightsOn, lightStatus); + RDEBUG("err", err); + } + + it = data.find(KSnsrCmdSwitchLowPower); + if (it != data.end()) + { + QVariantList lowPowerLimits = it.value().toList(); + if (lowPowerLimits.count() == 2) + { + // switch on screen power save mode when start and end lines are given + int startRow = lowPowerLimits.at(0).toInt(); + int endRow = lowPowerLimits.at(1).toInt(); + // TODO: The pixel buffer passed to CPowerSaveDisplayMode is supposed to + // contain the pixels shown in the active area of the screen. Currently, we + // pass a buffer filled with 0s, and this works fine on the reference + // hardware. However, according to display driver people, this doesn't + // work if the display component of the device doesn't have internal memory + // which may be the case in some of our target devices. + TUint16 *ptr = const_cast (mScreensaverPowerSavePixelBuffer->Ptr()); + RDEBUG("switching screen power save on, number of visible rows", endRow-startRow); + int err = mScreensaverPowerSave->Set(startRow, endRow, ptr); + RDEBUG("err", err); + } + else + { + // any other case is interpreted as an order to switch off the power save and + // return to the normal mode + RDEBUG("switching screen power save off 0", 0); + int err = mScreensaverPowerSave->Exit(); + RDEBUG("err", err); + } + } + } + +void Autolock::handleScreensaverClosed() + { + RDEBUG("0", 0); + int err(0); + // Screensaver (usually) cannot send anymore any commands when + // it's being closed. Thus, we need to ensure here that screen has lights and + // full-power mode once screensaver is closed. + if (mScreensaverPowerSave) + { + RDEBUG("switching screen power save off", 0); + err = mScreensaverPowerSave->Exit(); + RDEBUG("error=", err); + } + RDEBUG("switching screen lights on", 1); + err = RProperty::Set(KPSUidCoreApplicationUIs, KLightsSSForcedLightsOn, 30); + RDEBUG("err", err); + } + +// some key is pressed +// TODO perhaps need a way to stop switch-key while asking unlock-code? +// Not clear what to do here. dismiss query? +bool Autolock::event(QEvent *ev) + { + if (ev) + { + int isSwitchKey = 0; + if (ev->type() == QEvent::KeyPress) + { + QKeyEvent *keyEvent = static_cast (ev); + RDEBUG("KeyPress", keyEvent->key()); + RDEBUG("KeyPress nativeScanCode", keyEvent->nativeScanCode()); + RDEBUG("EStdKeyDeviceF", EStdKeyDeviceF); + RDEBUG("EKeyDeviceF", EKeyDeviceF); + RDEBUG("keyEvent->isAutoRepeat()", keyEvent->isAutoRepeat()); + // note that the key was EKeyApplication0 and EKeyDevice2 + // yes=0xc4 app=0xb4 no=0xa6 + if (keyEvent->nativeScanCode() == EStdKeyApplication0 || keyEvent->nativeScanCode() == EStdKeyDevice2 || keyEvent->nativeScanCode() == EStdKeyYes + || keyEvent->nativeScanCode() == EStdKeyNo) + { + // switch to active screensaver if application key or power key pressed while screensaver active + // This key can be repeated, so that the screensaver remains as long as key is pushed + // TODO what happens when holding Power key ? + switchScreensaverMode( ESnsrViewTypeActive); + } + else if (!keyEvent->isAutoRepeat()) + { + if (keyEvent->key() == EKeyInsert) + { + // on WINS, this is handled with the "Ins" key in the numeric keypad + RDEBUG("EKeyInsert", EKeyInsert); + // only reacts on release, not on press + isSwitchKey = 1; + } + else if (keyEvent->key() == EKeyDeviceF) + { + // this never seem to happen. Nevertheless we are not doing anything + RDEBUG("EKeyDeviceF", EKeyDeviceF); + } + else if (keyEvent->nativeScanCode() == EStdKeyDeviceF) + { + RDEBUG("got EStdKeyDeviceF", EStdKeyDeviceF); + isSwitchKey = 1; + } + else if (keyEvent->nativeScanCode() == EKeyBell) // this might be sent by others, i.e. PCFW + { + RDEBUG("got EKeyBell", EKeyBell); + isSwitchKey = 1; + } + else if (keyEvent->key() == 0x1ffffff) + { + RDEBUG("0x1ffffff", 0x1ffffff); // some unknown key is received. Nothing to do + } + } + } + else if (ev->type() == QEvent::KeyRelease) + { + QKeyEvent *keyEvent = static_cast (ev); + RDEBUG("KeyRelease", keyEvent->key()); + RDEBUG("KeyRelease native", keyEvent->nativeScanCode()); + if (keyEvent->nativeScanCode() == EStdKeyDeviceF && !keyEvent->isAutoRepeat()) + { + RDEBUG("released EStdKeyDeviceF", 1); + // isSwitchKey=1; this should happen is pressed was not processed (hint: if it is/was in background) + } + } + RDEBUG("isSwitchKey", isSwitchKey); + if (isSwitchKey) + { + handleLockSwitch(); + RDEBUG("0", 0); + } // isSwitchKey + } // ev + // Process if not done before. For example, redraw or quit + TBool widgetEventSuccesful = QWidget::event(ev); + RDEBUG("9", 9); + return widgetEventSuccesful; + } + +int Autolock::handleLockSwitch() + { + RDEBUG("0", 0); + int ret = KErrNone; + RDEBUG("iProcessingEvent", iProcessingEvent); + // iProcessingEvent is used to avoid concurrent processing, i.e. 2 side-switch presses; because it needs time to create (and dismiss) the dialog + // However this disallows keyguard during unlock-quey. + if(iProcessingEvent < 1) + { + iProcessingEvent = 1; + Q_UNUSED(ret); + DebugStatus( iLockStatus); + if (iLockStatus == ELockNotActive) + { + iShowKeyguardNote = 0; // no note on enable keyguard + callerHasECapabilityWriteDeviceData = 1; + ret = TryChangeStatus(ELockAppEnableKeyguard); // this should not ask confirmation + } + else if (iLockStatus == EKeyguardActive) + { + iShowKeyguardNote = 0; // no note on disable keyguard + callerHasECapabilityWriteDeviceData = 1; + ret = TryChangeStatus(ELockAppDisableKeyguard); + } + else if (iLockStatus == EDevicelockActive) + { + callerHasECapabilityWriteDeviceData = 1; + ret = TryChangeStatus(ELockAppDisableDevicelock); + } + else + { + RDEBUG("unknown iLockStatus", iLockStatus); + } + iProcessingEvent = 0; + } + RDEBUG("ret", ret); + return ret; + } + +bool Autolock::eventFilter(QObject *o, QEvent *ev) + { + // this never happens + RDEBUG("0", 0); + return QWidget::eventFilter(o, ev); + } +// some setting changed +void Autolock::subscriberKSettingsAutolockStatusChanged() + { + RDEBUG("0", 0); + QVariant v = subscriberKSettingsAutolockStatus->value("/KCRUidSecuritySettings/KSettingsAutolockStatus"); + adjustInactivityTimers( KSettingsAutolockStatus); + } +void Autolock::subscriberKSettingsAutoLockTimeChanged() + { + RDEBUG("0", 0); + QVariant v = subscriberKSettingsAutoLockTime->value("/KCRUidSecuritySettings/KSettingsAutoLockTime"); + adjustInactivityTimers( KSettingsAutoLockTime); + } +void Autolock::subscriberKSettingsAutomaticKeyguardTimeChanged() + { + RDEBUG("0", 0); + QVariant v = subscriberKSettingsAutomaticKeyguardTime->value("/KCRUidSecuritySettings/KSettingsAutomaticKeyguardTime"); + adjustInactivityTimers( KSettingsAutoLockTime); + } +void Autolock::subscriberKDisplayLightsTimeoutChanged() + { + RDEBUG("0", 0); + QVariant v = subscriberKDisplayLightsTimeout->value("/KCRUidLightSettings/KDisplayLightsTimeout"); + // nothing to do + } +void Autolock::subscriberKProEngActiveProfileChanged() + { + RDEBUG("0", 0); + QVariant v = subscriberKProEngActiveProfile->value("/KCRUidProfileEngine/KProEngActiveProfile"); + // nothing to do + } +// some environment changed +void Autolock::subscriberKAknKeyguardStatusChanged() + { + RDEBUG("Error only Autolock should be able to change it", 0); + } +void Autolock::subscriberKCoreAppUIsAutolockStatusChanged() + { + RDEBUG("Error only Autolock should be able to change it", 0); + } +void Autolock::subscriberKHWRMGripStatusChanged() + { + TInt ret = KErrNone; + Q_UNUSED(ret); + RDEBUG("0", 0); + TInt aGripStatus; + TInt err = RProperty::Get(KPSUidHWRM, KHWRMGripStatus, aGripStatus); + RDEBUG("err", err); + RDEBUG("value", aGripStatus); + if (aGripStatus == EPSHWRMGripOpen) + { + if (iLockStatus == EKeyguardActive) + { + iShowKeyguardNote = 0; // no note on disable keyguard + callerHasECapabilityWriteDeviceData = 1; + ret = TryChangeStatus(ELockAppDisableKeyguard); + } + else if (iLockStatus == EDevicelockActive) + { + callerHasECapabilityWriteDeviceData = 1; + ret = TryChangeStatus(ELockAppDisableDevicelock); + } + } + else if (aGripStatus == EPSHWRMGripClosed) + { + if (iLockStatus == ELockNotActive) + { + iShowKeyguardNote = 0; // no note on enable keyguard + callerHasECapabilityWriteDeviceData = 1; + ret = TryChangeStatus(ELockAppEnableKeyguard); + } + } + RDEBUG("ret", ret); + } +/**************/ +void Autolock::subscriberKCTsyCallStateChanged() + { + RDEBUG("0", 0); + TInt aCallStatus; + TInt err = RProperty::Get(KPSUidCtsyCallInformation, KCTsyCallState, aCallStatus); + RDEBUG("err", err); + RDEBUG("aCallStatus", aCallStatus); + RWindowGroup& groupWin = CEikonEnv::Static()->RootWin(); + if (aCallStatus == EPSCTsyCallStateUninitialized || aCallStatus == EPSCTsyCallStateNone) + { + RDEBUG("call is inactive", aCallStatus); + RDEBUG("iLockStatus", iLockStatus); + if (iLockStatus == EKeyguardActive || iLockStatus == EDevicelockActive) + { + if (!mEKeyYesCaptureHandle) + mEKeyYesCaptureHandle = groupWin.CaptureKey(EKeyYes, 0, 0); + if (!mEKeyNoCaptureHandle) + mEKeyNoCaptureHandle = groupWin.CaptureKey(EKeyNo, 0, 0); + } + } + else + { + RDEBUG("call is active", aCallStatus); + // Telephone should be on top, but nevertheless we give End/Send to them + // This should be done only if locked, but it doesn't harm + if (mEKeyYesCaptureHandle) + { + RDEBUG("mEKeyYesCaptureHandle", mEKeyYesCaptureHandle); + groupWin.CancelCaptureKey(mEKeyYesCaptureHandle); + mEKeyYesCaptureHandle = NULL; + } + if (mEKeyNoCaptureHandle) + { + RDEBUG("mEKeyNoCaptureHandle", mEKeyNoCaptureHandle); + groupWin.CancelCaptureKey(mEKeyNoCaptureHandle); + mEKeyNoCaptureHandle = NULL; + } + } + RDEBUG("9", 9); + } +// SecUiNotificationDialog::subscriberKSecurityUIsDismissDialogChanged() +// A way for Autolock to dismiss any possible PIN dialog +// ---------------------------------------------------------------------------- +// +void Autolock::subscriberKSecurityUIsDismissDialogChanged() + { + RDEBUG("0", 0); + TInt aDismissDialog = ESecurityUIsDismissDialogUninitialized; + TInt err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsDismissDialog, aDismissDialog); + RDEBUG("err", err); + RDEBUG("aDismissDialog", aDismissDialog); + } +// ----------AutolockService--------------- + +AutolockService::AutolockService(Autolock* parent) : + XQServiceProvider(QLatin1String("com.nokia.services.Autolock.Autolock"), parent), mAutolock(parent), mAsyncReqId(-1), mAsyncAnswer(false) + { + RDEBUG("0", 0); + publishAll(); + connect(this, SIGNAL(returnValueDelivered()), parent, SLOT(handleAnswerDelivered())); + } + +AutolockService::~AutolockService() + { + RDEBUG("0", 0); + } + +void AutolockService::complete(QString number) + { + RDEBUG("0", 0); + if (mAsyncReqId == -1) + return; + completeRequest(mAsyncReqId, number.toInt()); + } + +// got API request from lockaccessextension +int AutolockService::service(const QString& number, const QString& aParam1, const QString& aParam2) + { + RDEBUG("0", 0); + TInt err = KErrNone; + RDEBUG("number", number.toInt()); + RDEBUG("aParam1", aParam1.toInt()); + RDEBUG("aParam2", aParam2.toInt()); + mAsyncAnswer = false; + XQRequestInfo info = requestInfo(); + QSet caps = info.clientCapabilities(); + + mAutolock->callerHasECapabilityWriteDeviceData = 0; + if (caps.contains(ECapabilityWriteDeviceData)) + { + RDEBUG("callerHasECapabilityWriteDeviceData", + ECapabilityWriteDeviceData); + mAutolock->callerHasECapabilityWriteDeviceData = 1; + } + + QString label = "Autolock::service:\n"; + label += QString("number=%1\n").arg(number); + + mNumber = number; + mAutolock->setLabelNumber(label, number); + int ret = 0; + ret = number.toInt(); + + mAutolock->mParam1 = aParam1.toInt(); + mAutolock->iShowKeyguardNote = aParam1.toInt(); + mAutolock->mParam2 = aParam2.toInt(); + TTime myTime; + myTime.HomeTime(); + TInt myTimeHigh = 0; + TInt myTimeLow = 0; + err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsLockInitiatorTimeHigh, myTimeHigh); + RDEBUG("err", err); + RDEBUG("myTimeHigh", myTimeHigh); + err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsLockInitiatorTimeLow, myTimeLow); + RDEBUG("err", err); + RDEBUG("myTimeLow", myTimeLow); + + myTimeHigh = I64HIGH( myTime.Int64() ); + myTimeLow = I64LOW( myTime.Int64() ); + RDEBUG("myTimeHigh", myTimeHigh); + RDEBUG("myTimeLow", myTimeLow); + err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsLockInitiatorTimeHigh, myTimeHigh); + err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsLockInitiatorTimeLow, myTimeLow); + + ret = mAutolock->TryChangeStatus(ret); + RDEBUG("ret", ret); + + TInt myInitiatorUID = 0; + err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsLockInitiatorUID, myInitiatorUID); + RDEBUG("ret", ret); + RDEBUG("myInitiatorUID", myInitiatorUID); + myInitiatorUID = info.clientSecureId(); + err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsLockInitiatorUID, myInitiatorUID); + RDEBUG("ret", ret); + RDEBUG("myInitiatorUID", myInitiatorUID); + + return ret; + } + +void AutolockService::handleClientDisconnect() + { + RDEBUG("0", 0); + // Just quit service application if client ends + mAsyncAnswer = false; + RDEBUG("0", 0); + // mAutolock->quit(); + } + +/****************/ +CWait* CWait::NewL() + { + CWait* self = new (ELeave) CWait(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } +void CWait::ConstructL() + { + CActiveScheduler::Add(this); + } +CWait::CWait() : + CActive(0) + { + } +CWait::~CWait() + { + Cancel(); + } +TInt CWait::WaitForRequestL() + { + SetActive(); + iWait.Start(); + return iStatus.Int(); + } +void CWait::RunL() + { + if (iWait.IsStarted()) + iWait.AsyncStop(); + } +void CWait::DoCancel() + { + if (iWait.IsStarted()) + iWait.AsyncStop(); + } +void CWait::SetRequestType(TInt aRequestType) + { + iRequestType = aRequestType; + } +TInt CWait::GetRequestType() + { + return iRequestType; + } + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/src/Autolock.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/src/Autolock.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,249 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, version 2.1 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program. If not, +* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +* +* Description: +* +*/ + +#ifndef AUTOLOCK_H +#define AUTOLOCK_H + +#ifdef _DEBUG + #define RDEBUG( x, y ) RDebug::Printf( "%s %s (%u) %s=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, x, y ); +#else + #define RDEBUG( x, y ) +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "autolockuseractivityservice.h" +#include "../../SecUi/Inc/SecQueryUi.h" + +QTM_BEGIN_NAMESPACE + class QValueSpacePublisher; + class QValueSpaceSubscriber; +QTM_END_NAMESPACE +QTM_USE_NAMESPACE + +#include +#include +#include + +enum TLockStatus + { + ELockNotActive = 0, + EKeyguardActive, + EDevicelockActive + }; + +enum TDevicelockReason + { + EDevicelockManual = 1, + EDevicelockRemote, + EDevicelockTimer + }; + +enum TDeviceDialogCreated + { + EDeviceDialogUninitialized = -1, + EDeviceDialogDestroyed = 0, + EDeviceDialogCreated = 1, + EDeviceDialogRaised = 2, + EDeviceDialogScreenSaver = 0x10, + EDeviceDialogLockIcon= 0x11, + EDeviceDialogLastValue + }; + +class QTimer; + +class AutolockService; +class CPowerSaveDisplayMode; + +class Autolock : public QWidget +{ + Q_OBJECT + +public: + Autolock( QWidget *parent = 0, Qt::WFlags f = 0 ); + ~Autolock(); + + void setLabelNumber(QString label,QString number); + void setLabelIcon(int value); + int CheckIfLegal(int value); + void DebugRequest(int value); + void DebugError(int value); + void DebugStatus(int value); + void adjustInactivityTimers(int aReason); + int updateIndicator(int aReason); + int AskValidSecCode(int aReason); + int publishStatus(int aReason); + int TryChangeStatus(int aReason); + int setLockDialog(int aReason, int status); + int showNoteIfRequested(int aReason); + + bool event(QEvent *event); + bool eventFilter(QObject *, QEvent *); + + int callerHasECapabilityWriteDeviceData; + int iShowKeyguardNote; + int mParam1; + int mParam2; + +public slots: + void quit(); + void handleAnswerDelivered(); + void subscriberKSettingsAutolockStatusChanged(); + void subscriberKSettingsAutoLockTimeChanged(); + void subscriberKSettingsAutomaticKeyguardTimeChanged(); + void subscriberKDisplayLightsTimeoutChanged(); + void subscriberKProEngActiveProfileChanged(); + void subscriberKAknKeyguardStatusChanged(); + void subscriberKCoreAppUIsAutolockStatusChanged(); + void subscriberKHWRMGripStatusChanged(); + void subscriberKCTsyCallStateChanged(); + void subscriberKSecurityUIsDismissDialogChanged(); + +private slots: + void activeKeyguard(); + void notActiveKeyguard(); + void activeDevicelock(); + void notActiveDevicelock(); + void switchScreensaverMode( int mode ); + void switchScreensaverToPowerSaveMode(); + void handleMessageFromScreensaver( const QVariantMap &data ); + void handleScreensaverClosed(); +private: + int handleLockSwitch(); + +private: + AutolockService* mService; + // int mKeyCode; + // int mKeyCaptureHandle; + QValueSpaceSubscriber *subscriberKSettingsAutolockStatus; + QValueSpaceSubscriber *subscriberKSettingsAutoLockTime; + QValueSpaceSubscriber *subscriberKSettingsAutomaticKeyguardTime; + QValueSpaceSubscriber *subscriberKDisplayLightsTimeout; + QValueSpaceSubscriber *subscriberKProEngActiveProfile; + QValueSpaceSubscriber *subscriberKAknKeyguardStatus; + QValueSpaceSubscriber *subscriberKCoreAppUIsAutolockStatus; + QValueSpaceSubscriber *subscriberKHWRMGripStatus; + QValueSpaceSubscriber *subscriberKCTsyCallState; + QValueSpaceSubscriber *subscriberKSecurityUIsDismissDialog; + + AutolockUserActivityService* serviceKeyguard; + AutolockUserActivityService* serviceDevicelock; + + int iLockStatus; + int iLockStatusPrev; + CSecQueryUi *iSecQueryUi; + int iSecQueryUiCreated; + HbDeviceDialog *iDeviceDialog; + int iDeviceDialogCreated; + TInt32 mPowerKeyCaptureHandle; + TInt32 mApplicationKeyCaptureHandle; + TInt32 mApplicationLongKeyCaptureHandle; + TInt32 mEKeyDeviceFCaptureHandle; + TInt32 mEKeyBellCaptureHandle; + TInt32 mEKeyYesCaptureHandle; + TInt32 mEKeyNoCaptureHandle; + TBool iLockCodeQueryInDisplay; + QTimer *mScreensaverModeTimer; + CPowerSaveDisplayMode *mScreensaverPowerSave; + HBufC16 *mScreensaverPowerSavePixelBuffer; + TInt32 iProcessingEvent; +}; + +class AutolockService : public XQServiceProvider +{ + Q_OBJECT +public: + AutolockService( Autolock *parent = 0 ); + ~AutolockService(); + + void complete(QString number); + bool asyncAnswer() {return mAsyncAnswer;} +public slots: + int service(const QString& number, const QString& aParam1, const QString& aParam2 ); + +private slots: + void handleClientDisconnect(); + +private: + Autolock* mAutolock; + QString mNumber; + bool mAsyncAnswer; + int mAsyncReqId; +}; + +class CWait : public CActive + { + public: + /** + * Creates instance of the CWait class. + * + * @return Returns the instance just created. + */ + static CWait* NewL(); + /** + * Destructor. + */ + ~CWait(); + public: + /** + * Starts waiting for aReqStatus. + */ + TInt WaitForRequestL(); + public: + /** + * Sets active request type. + */ + void SetRequestType(TInt aRequestType); + /** + * Gets active request type. + */ + TInt GetRequestType(); + private: + /** + * C++ default constructor. + */ + CWait(); + /** + * Symbian OS constructor. + */ + void ConstructL(); + private: // from CActive + /** @see CActive::RunL() */ + void RunL(); + /** @see CActive::DoCancel() */ + void DoCancel(); + RTimer iTimer; + CActiveSchedulerWait iWait; + // Used if there is a need to cancel an active request; + // namely in situations where destructor is called when Wait + // is active. + TInt iRequestType; + }; + + +#endif // AUTOLOCK_H diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/src/Autolock.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/src/Autolock.pri Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,32 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, version 2.1 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, +# see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +# +# Description: +# + +INCLUDEPATH += . \ + inc \ + autolockuseractivityservice \ + autolockuseractivityservice/inc + +SOURCES=\ + src/main.cpp\ + src/Autolock.cpp + +HEADERS=\ + src/Autolock.h + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/src/AutolockApp.cpp --- a/securitydialogs/Autolock/src/AutolockApp.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -*/ - - -// INCLUDE FILES -#include "AutolockApp.h" -#include "AutolockDocument.h" -#include - - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CAutolockApp::AppDllUid() -// Returns application UID -// --------------------------------------------------------- -// -TUid CAutolockApp::AppDllUid() const - { - return KUidAutolock; - } - -// --------------------------------------------------------- -// CAutolockApp::CreateDocumentL() -// Creates CAutolockDocument object -// --------------------------------------------------------- -// -CApaDocument* CAutolockApp::CreateDocumentL() - { - return CAutolockDocument::NewL( *this ); - } - -// ================= OTHER EXPORTED FUNCTIONS ============== -// - -LOCAL_C CApaApplication* NewApplication() - { - return new CAutolockApp; - } - -GLDEF_C TInt E32Main() - { - return EikStart::RunApplication(NewApplication); - } - -// End of File - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/src/AutolockAppUi.cpp --- a/securitydialogs/Autolock/src/AutolockAppUi.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1782 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // Property values -#include -#include -#include -#include -#include - -#include "AutolockAppUiPS.h" -#include "AutoLockValueObserverPS.h" -#include "AutoLockModelPS.h" -#include "AutolockApp.h" -#include "autolock.hrh" -#include "AutolockView.h" - -#include -#include - -// sysap uid and message enums defined in eikon.hrh -// for sending messages to sysap -#include -#include -#include - -#include -#include - -#include - -// LOCAL CONSTANTS AND MACROS -#define KSysApUid TUid::Uid(0x100058F3) -#define KPhoneAppUid TUid::Uid(0x100058B3) - -const TInt KTriesToConnectServer( 2 ); -const TInt KTimeBeforeRetryingServerConnection( 50000 ); -const TInt PhoneIndex( 0 ); -const TInt KCancelKeyScanCode( EStdKeyDevice1 ); // 165 - - -// ================= MEMBER FUNCTIONS ======================= -// -// ---------------------------------------------------------- -// CAutolockAppUi::ConstructL() -// ?implementation_description -// ---------------------------------------------------------- -// -void CAutolockAppUi::ConstructL() - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL")); - #endif - - BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknDisableAnimationBackground ); - - //Disable priority control so that Autolock process priority isn't set to "background" by - //window server when it is not active. - iEikonEnv->WsSession().ComputeMode( RWsSession::EPriorityControlDisabled ); - RThread().SetProcessPriority( EPriorityHigh ); - - FeatureManager::InitializeLibL(); - - RTelServer::TPhoneInfo PhoneInfo; - // prevent autolock shutdown - iEikonEnv->SetSystem( ETrue ); - - CKeyLockPolicyApi* iCKeyLockPolicyApi = CKeyLockPolicyApi::NewL( EPolicyActivateKeyguard ); - TBool keyguardAllowed = iCKeyLockPolicyApi->KeyguardAllowed(); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) keyguardAllowed=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, keyguardAllowed ); - #endif - keyguardAllowed = iCKeyLockPolicyApi->EnableKeyguardFeature(); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) new keyguardAllowed=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, keyguardAllowed ); - #endif - delete iCKeyLockPolicyApi; - - iSideKey1 = 0; - iSideKey2 = 0; - iAppKey = 0; - - aCallButtonRect = TRect (0,0,0,0); - iGotEventDownDuringCall = -1; - //connect to ETel - - TInt err( KErrGeneral ); - TInt thisTry( 0 ); - - /*All server connections are tried to be made KTiesToConnectServer times because occasional - fails on connections are possible at least on some servers*/ - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() connect to etel server")); - #endif - // connect etel server - while ( ( err = iServer.Connect() ) != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) - { - User::After( KTimeBeforeRetryingServerConnection ); - } - User::LeaveIfError( err ); - - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() load tsy")); - #endif - // load tsy - err = iServer.LoadPhoneModule( KMmTsyModuleName ); - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() load tsy ERROR: %d"), err); - #endif - if ( err != KErrAlreadyExists ) - { - // may return also KErrAlreadyExists if some other - // is already loaded the tsy module. And that is - // not an error. - User::LeaveIfError( err ); - } - - thisTry = 0; - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() open phone")); - #endif - //open phone - User::LeaveIfError(iServer.SetExtendedErrorGranularity(RTelServer::EErrorExtended)); - User::LeaveIfError(iServer.GetPhoneInfo(PhoneIndex, PhoneInfo)); - User::LeaveIfError(iPhone.Open(iServer,PhoneInfo.iName)); - User::LeaveIfError(iCustomPhone.Open(iPhone)); - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() phone opened")); - #endif - - TBool systemLocked = EFalse; - TBool phoneLocked = EFalse; - - iWait = NULL; - iWait = CWait::NewL(); - - RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; - RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; - RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); - TInt cRresult = KErrNone; - - #ifndef __WINS__ - - - /***************************************************** - * Series 60 Customer / ETEL - * Series 60 ETEL API - *****************************************************/ - - // set autolock period to 0, if lock is disabled in DOS side - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() set autolock period to 0")); - #endif - - iWait->SetRequestType(EMobilePhoneGetLockInfo); - iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); - TInt res = iWait->WaitForRequestL(); - User::LeaveIfError(res); - - // Eventhough we might lock the device on boot-up (systemLocked == ETrue), we - // want to hide the app until the handshake is done. StartUp application will - // active the app when it is finished. - TApaTask self(iCoeEnv->WsSession()); - self.SetWgId(iCoeEnv->RootWin().Identifier()); - self.SendToBackground(); - // flush - iCoeEnv->WsSession().Flush(); - - TInt lockValue = 0; - CRepository* repository = CRepository::NewL(KCRUidSecuritySettings); - cRresult = repository->Get(KSettingsAutolockStatus, lockValue); - TBool hiddenReset = HiddenReset(); - #if defined(_DEBUG) - if(hiddenReset) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() Hidden reset")); - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() CR get result: %d"), cRresult); - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() CR lock value: %d"), lockValue); - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() CR lockInfo.iSetting: %d"), lockInfo.iSetting); - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() RMobilePhone::ELockSetEnabled: %d"), RMobilePhone::ELockSetEnabled); - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() RMobilePhone::ELockSetDisabled: %d"), RMobilePhone::ELockSetDisabled); - #endif - if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) - { - repository->Set(KSettingsAutoLockTime, 0); - if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) ) - { - repository->Set(KSettingsLockOnPowerUp, 0); - } - } - // In CDMA, the system can stay locked on after the boot-up sequence. - else if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) || (hiddenReset && (lockValue == 1))) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() Hidden reset when locked")); - #endif - phoneLocked = systemLocked = ETrue; - } - else if (lockInfo.iSetting == RMobilePhone::ELockSetEnabled && !hiddenReset) { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() Set phone locked")); - #endif - phoneLocked = ETrue; - } - - - delete repository; - #endif //__WINS__ - - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() Enable emergency call support")); - #endif - - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() Autolock view")); - #endif - - - - // ------------------------------------------------------------------------------------------------------------- - // part of emergency call handling when telephony+devicelock is active - // this solution is meant only for 3.1 and 3.2 - - iEcsNote = new (ELeave) CEcsNote(); - iEcsNote->ConstructSleepingNoteL(R_AVKON_EMERGENCY_CALL_NOTE); - iEcsNote->ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0,2); - - if (AknLayoutUtils::PenEnabled()) // on touch devices, if Autolock is activated from IdleScreen in landscape, the buttons need to be drawn. - { - iEcsNote->ButtonGroupContainer().SetCommandL( 0, _L("") ); // as keyboard is locked, these buttons do nothing. Better to hide their labels. - iEcsNote->ButtonGroupContainer().SetCommandL( EAknSoftkeyCancel, _L("") ); - iEcsNote->ButtonGroupContainer().ButtonGroup()->AsControl()->MakeVisible(ETrue); - } - - // Emergency call support - iEcsDetector = CAknEcsDetector::NewL(); - iEcsDetector->SetObserver( this ); - iEmergencySupportReady = ETrue; - // ------------------------------------------------------------------------------------------------------------- - - - // Autolock view - CAutolockView* lockView = new(ELeave) CAutolockView; - CleanupStack::PushL(lockView); - lockView->ConstructL(); - CleanupStack::Pop(); // lockView - AddViewL(lockView); // transfer ownership to CAknViewAppUi - SetDefaultViewL(*lockView); - - // start autolock timer - iModel = CAutoLockModel::NewL(this, phoneLocked); - - // phone event observer - iPhoneObserver = CValueObserver::NewL(this); - //call bubble - iIncallBubble = CAknIncallBubble::NewL(); - - //Autokeyguard Period observer - #ifdef RD_AUTO_KEYGUARD - iKeyguardObserver = CAutoKeyguardObserver::NewL(this); - #else //!RD_AUTO_KEYGUARD - iKeyguardObserver = NULL; - #endif //RD_AUTO_KEYGUARD - // Create the write policy. Also processes with write device data can write the value. - TSecurityPolicy writePolicy( ECapabilityWriteDeviceData ); - // Create the read policy. Also processes with read device data can read the value. - TSecurityPolicy readPolicy( ECapabilityReadDeviceData ); - - TInt tRet = RProperty::Define( KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, RProperty::EInt, readPolicy, writePolicy ); - - if ( tRet != KErrNone ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL():\ - FAILED to define the SECUI query Flag: %d"), tRet); - #endif - } - - tRet = RProperty::Define( KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, RProperty::EInt, readPolicy, writePolicy ); - if ( tRet != KErrNone ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL():\ - FAILED to define the SECUI query request state Flag: %d"), tRet); - #endif - } - -if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) -{ - - // Define the TARM admin flag. - - tRet = RProperty::Define( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, RProperty::EInt, - readPolicy, writePolicy ); - if ( tRet != KErrNone ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL():\ - FAILED to define the TARM Admin Flag")); - #endif - } - - // The following sequence is used to validate the configuration on SCP server. - // This is needed on the first boot (initial or RFS) or if the C-drive has been formatted - // (3-button format) and Autolock is not active. - - RSCPClient scpClient; - if ( scpClient.Connect() == KErrNone ) - { - TInt confStatus = KErrNone; - // check whether this is normal or exceptional boot. This solves the issue when PIN is requested, Autolock starts, and scpClient.CheckConfiguration verifies the internal lock code - TInt startupReason(ENormalStartup); - RProperty::Get(KPSUidStartup, KPSStartupReason, startupReason); - - TInt secQueryStatus = ESecurityQueryUninitialized; - TInt tRet = RProperty::Get(KPSUidStartup, KStartupSecurityCodeQueryStatus, secQueryStatus); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) startupReason=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, startupReason ); - RDebug::Printf( "%s %s (%u) secQueryStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, secQueryStatus ); - RDebug::Printf( "%s %s (%u) cRresult=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, cRresult ); - RDebug::Printf( "%s %s (%u) lockInfo.iSetting=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, lockInfo.iSetting ); - RDebug::Printf( "%s %s (%u) tRet=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, tRet ); - #endif - - TInt simStatusValue; - tRet = RProperty::Get(KPSUidStartup, KPSSimStatus, simStatusValue); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) tRet=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, tRet ); - RDebug::Printf( "%s %s (%u) simStatusValue=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, simStatusValue ); - RDebug::Printf( "%s %s (%u) ESimReadable=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ESimReadable ); - #endif - - if( simStatusValue==ESimReadable && secQueryStatus==ESecurityQueryActive) - { // query during SIM-query. This should not happen because check on CSecurityNotifier::GetParamsL iEvent != RMobilePhone::EPin1Required - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) tRet=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, tRet ); - #endif - confStatus = KErrNone; // the best thing to do is to skip CheckConfiguration, because it might secretly accept the lock-code - } - else - confStatus = scpClient.CheckConfiguration( KSCPInitial ); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) confStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, confStatus ); - RDebug::Printf( "%s %s (%u) KErrAccessDenied=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, KErrAccessDenied ); - #endif - if ( confStatus == KErrAccessDenied ) - { - #ifndef __WINS__ - if ( 1 ) // Previously was ( lockInfo.iSetting == RMobilePhone::ELockSetDisabled ) but now it needs to handle scenarios : ISA_format without drive format, and the opposite - #else // __WINS__ - if ( 1 ) // DOS lock is never active in WINS - #endif // __WINS__ - { - // DOS lock is not active. Note that if DOS is locked, checking the code here will - // mess up the query sequence. On initial startup DOS is not locked. - - TInt finalConfStatus = scpClient.CheckConfiguration( KSCPComplete ); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) finalConfStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, finalConfStatus ); - #endif - if ( finalConfStatus == KErrAccessDenied ) - { - #ifdef __WINS__ - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL():\ - DOS validation FAILED in WINS, something wrong!")); - #endif - #else // !__WINS__ - - // The SCP server is out of sync and Autolock is not active. (c-drive formatted) - // We must ask the security code. ( Note that it is very rare that this is executed ) - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL():\ - Lock setting disabled, calling setlocksetting")); - #endif - - // Wait here until the startup is complete - - TInt tarmErr = KErrNone; - while ( tarmErr == KErrNone ) - { - TInt sysState=0; - tarmErr = RProperty::Get(KPSUidStartup, KPSGlobalSystemState, sysState); - - if ((sysState == ESwStateNormalRfOn) || (sysState == ESwStateNormalRfOff) - || (sysState == ESwStateNormalBTSap)) - { - break; - } - User::After(500000); - } - - // Just change the lock setting again to disabled to request the security code. - // Set the TARM flag so SecUi knows it should display the "login" query. - TInt tarmFlag=0; - tRet = RProperty::Get( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag ); - if ( tRet == KErrNone ) - { - tarmFlag |= KSCPFlagResyncQuery; - tRet = RProperty::Set( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag ); - } - - if ( tRet != KErrNone ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL():\ - FAILED to set TARM Admin Flag")); - #endif - } - - RMobilePhone::TMobilePhoneLockSetting lockChange; - lockChange = RMobilePhone::ELockSetDisabled; - iWait->SetRequestType(EMobilePhoneSetLockSetting); - iPhone.SetLockSetting(iWait->iStatus, lockType, lockChange); - - res = iWait->WaitForRequestL(); - #endif // __WINS__ - } - } - - } // if ( confStatus == KErrAccessDenied ) - - scpClient.Close(); - } - -} - - // Eventhough we might lock the device on boot-up (systemLocked == ETrue), we - // want to hide the app until the handshake is done. StartUp application will - // active the app when it is finished. - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) systemLocked=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, systemLocked ); - RDebug::Printf( "%s %s (%u) phoneLocked=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, phoneLocked ); - #endif - if( !systemLocked ) - { - // incoming call on boot - TInt value(EStartupUiPhaseUninitialized); - RProperty::Get(KPSUidStartup, KPSStartupUiPhase, value); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) KPSStartupUiPhase value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, value ); - #endif - if( valueStart(); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) err=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, err ); - #endif - } - // app to background - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() app to background")); - #endif - TApaTask self(iCoeEnv->WsSession()); - self.SetWgId(iCoeEnv->RootWin().Identifier()); - self.SendToBackground(); - // flush - iCoeEnv->WsSession().Flush(); - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() LOCK SYSTEM")); - #endif - TInt lockState = 0; - - #ifdef RD_REMOTELOCK - lockState = EManualLocked; - #else //!RD_REMOTELOCK - lockState = EAutolockOn; - #endif//RD_REMOTELOCK - iModel->LockSystemL(lockState); - } - - iGripStatusObserver = CAutolockGripStatusObserver::NewL( this, iEikonEnv->WsSession() ); - iFpsStatusObserver = CAutolockFpsStatusObserver::NewL( this, iEikonEnv->WsSession() ); - iDeviceLockQueryStatus = EFalse; - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() END")); - #endif - } -// ---------------------------------------------------- -// CAutolockAppUi::~CAutolockAppUi() -// Destructor -// Frees reserved resources -// ---------------------------------------------------- -// -CAutolockAppUi::~CAutolockAppUi() - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::~CAutolockAppUi() BEGIN")); - #endif - - if(iWait) - { - // Cancel active requests - if(iWait->IsActive()) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::~CAutolockAppUi() CANCEL REQ")); - #endif - iPhone.CancelAsyncRequest(iWait->GetRequestType()); - } - } - //close ETel connections - if (iCustomPhone.SubSessionHandle()) - iCustomPhone.Close(); - - if (iPhone.SubSessionHandle()) - iPhone.Close(); - - if (iServer.Handle()) - { - iServer.UnloadPhoneModule(KMmTsyModuleName); - iServer.Close(); - } - delete iModel; - delete iPhoneObserver; - delete iIncallBubble; -#ifdef RD_AUTO_KEYGUARD - delete iKeyguardObserver; -#endif - - delete iEcsDetector; - delete iEcsNote; // Ecs change - delete iWait; - FeatureManager::UnInitializeLib(); - delete iGripStatusObserver; - delete iFpsStatusObserver; - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::~CAutolockAppUi() END")); - #endif - } -// ---------------------------------------------------- -// CAutolockAppUi::HandleForegroundEventL() -// Handles foreground event. -// ---------------------------------------------------- -// -void CAutolockAppUi::HandleForegroundEventL(TBool aForeground) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleForegroundEventL()")); - #endif - if (aForeground ) - { - if (iLocked) - { - // lock voice key - LockSideKeyL(); - CAknView* view = View(KAutoLockViewId); - if(view) - { - TRect aInitialRect; - STATIC_CAST(CAutolockView*, view)->HandleCall(0x15, aInitialRect); - } - - } - else - { - // app back to background - TApaTask self(iCoeEnv->WsSession()); - self.SetWgId(iCoeEnv->RootWin().Identifier()); - self.SendToBackground(); - } - } - - if (!aForeground && iLocked) - { - TInt callState=0; - TInt simStatus=0; - RProperty::Get(KPSUidCtsyCallInformation, KCTsyCallState, callState ); - RProperty::Get(KPSUidStartup, KPSSimStatus, simStatus); - - if (callState == EPSCTsyCallStateNone && simStatus != ESimNotPresent) - { - // try put autolock back to foreground - CAknView* view = View(KAutoLockViewId); - if(view) - { - TRect aInitialRect; - STATIC_CAST(CAutolockView*, view)->HandleCall(0x19, aInitialRect); - } - TApaTask self(iCoeEnv->WsSession()); - self.SetWgId(iCoeEnv->RootWin().Identifier()); - self.BringToForeground(); - } - else - { - // unlock voice key while there is active call - UnLockSideKey(); - CAknView* view = View(KAutoLockViewId); - if(view) - { - TRect aInitialRect; - STATIC_CAST(CAutolockView*, view)->HandleCall(0x16, aInitialRect); - } - } - } - - CAknAppUi::HandleForegroundEventL(aForeground); - - } - - -// ---------------------------------------------------- -// HideSoftNotification() -// dismiss all the pending notes just before asking the unlocking code -// ---------------------------------------------------- -// -void HideSoftNotification() - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)HideSoftNotification")); - #endif - CAknSoftNotifier *softNotifier = NULL; - TRAPD (err, { - softNotifier = CAknSoftNotifier::NewL(); - softNotifier->AddNotificationL(ESetIdleState, 0); - };) - delete softNotifier; - } -// CAutolockAppUi::HandleCommandL(TInt aCommand) -// ---------------------------------------------------- - - -// ---------------------------------------------------- -// CAutolockAppUi::HandleMessageL -// -// Handles the TARM command to unlock the phone. -// ---------------------------------------------------- -// -MCoeMessageObserver::TMessageResponse CAutolockAppUi::HandleMessageL( - TUint32 aClientHandleOfTargetWindowGroup, - TUid aMessageUid, - const TDesC8& aMessageParameters - ) - { - - if(!FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) - { - User::Leave(KErrNotSupported); - } - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleMessageL()")); - #endif - - MCoeMessageObserver::TMessageResponse messageResponse( EMessageHandled ); - - if ( aMessageUid.iUid == SCP_CMDUID_UNLOCK+1 ) - { - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) calling CancelDeviceLockQuery=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - #endif - CancelDeviceLockQuery(); - } - else if ( aMessageUid.iUid == SCP_CMDUID_UNLOCK ) - { - // For security reasons we must check from the SCP server did this - // command originate from it. - RSCPClient scpClient; - if ( scpClient.Connect() == KErrNone ) - { - CleanupClosePushL( scpClient ); - - if ( scpClient.QueryAdminCmd( ESCPCommandUnlockPhone ) ) - { - // Switch autolock to BG - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleMessageL():\ - Admin command received, unlocking")); - #endif - - if ( !iLocked ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleMessageL():\ - Ignoring Unlock message - not locked.")); - #endif - } - else - { - iLocked = EFalse; - HideSoftNotification(); // dismiss all the pending notes - DisableWGListChangeEventListening(); - UnLockKeys(); - iModel->SetLockedL(EFalse); - // Disable keyguard after remote unlock - RAknKeyLock iKeyLock; - TInt tempResult = iKeyLock.Connect(); - iKeyLock.DisableKeyLock(); - // end Disable keyguard after remote unlock - SwitchToPreviousAppL(); - } - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleMessageL():\ - Unauthorized attempt to unlock")); - #endif - } - - CleanupStack::PopAndDestroy(); // scpClient - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleMessageL():\ - Failed to connect to SCP, ignoring unlock-message.")); - #endif - - } - } - else // aMessageUid.iUid != SCP_CMDUID_UNLOCK - { - messageResponse = CAknAppUi::HandleMessageL( aClientHandleOfTargetWindowGroup, - aMessageUid, - aMessageParameters - ); - } - - return messageResponse; - } - - -// ------------------------------------------------------------------------------ -// CAutolockAppUi::::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane) -// This function is called by the UIKON framework just before it displays -// a menu pane. Its default implementation is empty, and by overriding it, -// the application can set the state of menu items dynamically according -// to the state of application data. -// ------------------------------------------------------------------------------ -// -void CAutolockAppUi::DynInitMenuPaneL( - TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/) - { - } - -void CAutolockAppUi::HandlePointerEventL(const TPointerEvent& aPointerEvent) - { - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - #endif - } -// ---------------------------------------------------- -// CAutolockAppUi::HandleKeyEventL( -// const TKeyEvent& aKeyEvent,TEventCode /*aType*/) -// ---------------------------------------------------- -// -TKeyResponse CAutolockAppUi::HandleKeyEventL( - const TKeyEvent& aKeyEvent,TEventCode aType) - { - - if ( aKeyEvent.iCode == EKeyBell || (aType == EEventKeyUp && aKeyEvent.iScanCode == EStdKeyDeviceF) || (aKeyEvent.iCode == EKeyDeviceF) ) - { - if(iLocked) - HandleCommandL(ESecUiCmdUnlock); - return EKeyWasConsumed; - } - - TBool featureNoPowerkey = FeatureManager::FeatureSupported( KFeatureIdNoPowerkey ); - // If power key pressed, tell SysAp about if - if( (aKeyEvent.iScanCode == EStdKeyDevice2 && aType == EEventKeyDown ) - || (aType == EEventKey && featureNoPowerkey && aKeyEvent.iCode == EKeyNo)) - { - SendMessageToSysAp(EEikKeyLockPowerKeyPressed); - if ( featureNoPowerkey ) - { - SendMessageToSysAp(EEikKeyLockLightsOnRequest); - } - } - return EKeyWasNotConsumed; - } - -void CAutolockAppUi::SendMessageToSysAp(TInt aMessage) - { - RWsSession& ws = iEikonEnv->WsSession(); - TInt wgId=0; - CApaWindowGroupName::FindByAppUid(KSysApUid, ws, wgId); - if (wgId) - { - TWsEvent event; - event.SetType(aMessage); - event.SetTimeNow(); - ws.SendEventToWindowGroup(wgId, event); - } - } - - -void CAutolockAppUi::HandleCommandL(TInt aCommand) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleCommandL()")); - #endif - switch ( aCommand ) - { - case EEikCmdExit: - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleCommandL() EEikCmdExit")); - #endif - Exit(); - break; - } - case ESecUiCmdUnlock: - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleCommandL() ESecUiCmdUnlock")); - #endif - // stop observing emergency call event - iEmergencySupportReady = EFalse; - iEcsDetector->Reset(); // Ecs queue is cleared; keys up til here are forgotten - // ask secuity code - CSecurityHandler* handler = new (ELeave) CSecurityHandler(iPhone); - CleanupStack::PushL(handler); - TSecUi::InitializeLibL(); - - // Put the lights on when security query is shown - SendMessageToSysAp( EEikSecurityQueryLights ); - HideSoftNotification(); // dismiss all the pending notes just before asking the unlocking code - - TRAPD(err, - { - iDeviceLockQueryStatus = ETrue; - if(handler->AskSecCodeInAutoLockL()) - { - iLocked = EFalse; - DisableWGListChangeEventListening(); - iDeviceLockQueryStatus = EFalse; - UnLockKeys(); - iModel->SetLockedL(EFalse); - SwitchToPreviousAppL(); - } - else - { // make sure that we will be topmost still - iDeviceLockQueryStatus = EFalse; - TInt callState; - RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); - if ( callState == EPSCTsyCallStateNone && - !FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) ) - { - TApaTask self(CCoeEnv::Static()->WsSession()); - self.SetWgId(CCoeEnv::Static()->RootWin().Identifier()); - self.BringToForeground(); - TBool featureNoPowerkey = FeatureManager::FeatureSupported( KFeatureIdNoPowerkey ); - if ( featureNoPowerkey ) - {//set lights on in case user pressed "red button". If he pressed cancel the lights are on anyway so it doesn't matter. - SendMessageToSysAp(EEikKeyLockLightsOnRequest); - } - // we don't want enable lock if call in progress - RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); - TInt keyguardDisableState(ECoreAppUIsDisableKeyguardUninitialized); - //If there is alarm on the keyguard status is set to disabled. In that case don't enable keyguard as it will be done by SysAp - //after the alarm has been disabled/snoozed. Otherwise the alarm CBA is left under keyguard CBA. - RProperty::Get( KPSUidCoreApplicationUIs, KCoreAppUIsDisableKeyguard, keyguardDisableState ); - if ((callState == EPSCTsyCallStateNone) && (keyguardDisableState != ECoreAppUIsDisableKeyguard)) - { - RAknKeyLock keylock; - if ( keylock.Connect() == KErrNone ) - { - keylock.EnableAutoLockEmulation(); - keylock.Close(); - } - } - } - } - };) - - // start observing emergency call event - iEmergencySupportReady = ETrue; - CleanupStack::PopAndDestroy(handler); // handler - TSecUi::UnInitializeLib(); // secui - - User::LeaveIfError(err); - - break; - } - default: - break; - } - } - -// ---------------------------------------------------- -// CAutolockAppUi::SwitchToPreviousAppL() -// Activates previous app -//---------------------------------------------------- -// -void CAutolockAppUi::SwitchToPreviousAppL() - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::SwitchToPreviousAppL()")); - #endif - iEcsDetector->Reset(); // Ecs queue is cleared; keys up til here are forgotten - // stop observing phone events - iPhoneObserver->Stop(); - CAknView* view = View(KAutoLockViewId); - if(view) - { - STATIC_CAST(CAutolockView*, view)->MakeVisible(EFalse); - } - else - { - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) no view ????=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, view ); - #endif - } - // app to background - TApaTask self(iCoeEnv->WsSession()); - self.SetWgId(iCoeEnv->RootWin().Identifier()); - self.SendToBackground(); - // flush - iCoeEnv->WsSession().Flush(); - } -// ---------------------------------------------------- -// CAutolockAppUi::BringAppToForegroundL() -// Activates autolock app -//---------------------------------------------------- -// -void CAutolockAppUi::BringAppToForegroundL() - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::BringAppToForegroundL()")); - #endif - TBool tarmAdminFlag(EFalse); - TBool remotelockState(EFalse); -if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) -{ - tarmAdminFlag = TarmState(); -} - -#ifdef RD_REMOTELOCK - TInt autolockState; - RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolockState); - remotelockState = (autolockState == ERemoteLocked); -#endif//RD_REMOTELOCK - // If TARM admin flag is set, bring Autolock to foreground regardless of call state. - - - if(!tarmAdminFlag) - { //If phone has been remote locked bring Autolock to foreground regardless of call state. - if(!remotelockState) - { // check if there is active call - TInt callState; - RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) callState=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, callState ); - #endif - - TInt value(EStartupUiPhaseUninitialized); - RProperty::Get(KPSUidStartup, KPSStartupUiPhase, value); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) KPSStartupUiPhase value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, value ); - RDebug::Printf( "%s %s (%u) EStartupUiPhaseSystemWelcomeDone=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EStartupUiPhaseSystemWelcomeDone ); - #endif - if(value EPSCTsyCallStateNone) - { - callState = EPSCTsyCallStateNone+0; // so that is locks - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) new+0 callState=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, callState ); - #endif - } - if (callState != EPSCTsyCallStateNone ) - { - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - #endif - UnLockKeys(); - iModel->SetLockedL(EFalse); - iModel->ResetInactivityTimeout(); - return; - } - } - - } - - - #ifndef __WINS__ - - #ifndef __NO_DOS__ - - /***************************************************** - * Series 60 Customer / ETEL - * Series 60 ETEL API - *****************************************************/ - - // check that device locked in DOS side too - RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; - RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; - RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); - - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::BringAppToForegroundL() GetLockInfo")); - #endif - iWait->SetRequestType(EMobilePhoneGetLockInfo); - iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); - TInt res = iWait->WaitForRequestL(); - User::LeaveIfError(res); - if (iWait->iStatus == KErrNone) - { - // if not don't lock ui either - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::BringAppToForegroundL() KErrNone")); - RDebug::Printf( "%s %s (%u) lockInfo.iSetting=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, lockInfo.iSetting ); - RDebug::Printf( "%s %s (%u) RMobilePhone::ELockSetDisabled=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, RMobilePhone::ELockSetDisabled ); - #endif - if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) - { - iModel->SetLockedL(EFalse); - UnLockKeys(); - return; - } - } - #endif - - #endif - - // in case Telephone-app is topmost, then the user is confused because he sees but can't use it. - // therefore it's required to hide it, by sending to background. ETMA-7M8A2Y 20090105 - if ( AknLayoutUtils::PenEnabled() ) - { - TApaTaskList apaTaskList(CCoeEnv::Static()->WsSession()); - - TApaTask apaTask = apaTaskList.FindApp(KPhoneAppUid); - if (apaTask.Exists()) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAknKeyLockControl::EnableKeylock() Bring phone to background")); - #endif - // Bring phone to background - apaTask.SendToBackground(); - } - } - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) iPhoneObserver->Start=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - #endif - - iPhoneObserver->Start(); - iLocked = ETrue; - // app to foreground - TApaTask self(iCoeEnv->WsSession()); - self.SetWgId(iCoeEnv->RootWin().Identifier()); - self.BringToForeground(); - ActivateLocalViewL(KAutoLockViewId); - CAknView* view = View(KAutoLockViewId); - if(view) - { - TRect aInitialRect; - STATIC_CAST(CAutolockView*, view)->HandleCall(0x17, aInitialRect); - STATIC_CAST(CAutolockView*, view)->MakeVisible(ETrue); - } - else - { - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) no view ????=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, view ); - #endif - } - } - -// ---------------------------------------------------- -// CAutolockAppUi::LockKeysL() -// locks keys -//---------------------------------------------------- -// -void CAutolockAppUi::LockKeysL() - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::LockKeysL()")); - #endif - // capture appkey & volume key - if (!iAppKey) - { - RWindowGroup& groupWin=iCoeEnv->RootWin(); - iAppKey = groupWin.CaptureKeyUpAndDowns(EStdKeyApplication0, 0, 0); // Capture app key - } - TInt gripStatus = EPSHWRMGripClosed; - RProperty::Get( KPSUidHWRM, KHWRMGripStatus, gripStatus ); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) gripStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, gripStatus ); - #endif - if(gripStatus==EPSHWRMGripOpen) - ForceOrientation(0); - else - ForceOrientation(1); - LockSideKeyL(); - } -// ---------------------------------------------------- -// CAutolockAppUi::UnLockKeys() -// unlocks keys -//---------------------------------------------------- -// -void CAutolockAppUi::UnLockKeys() - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::UnLockKeysL()")); - #endif - // uncapture appkey - if (iAppKey) - { - RWindowGroup& groupWin=iCoeEnv->RootWin(); - groupWin.CancelCaptureKeyUpAndDowns(iAppKey); - iAppKey = 0; - } - UnLockSideKey(); - } -// ---------------------------------------------------- -// CAutolockAppUi::LockSideKeyL() -// unlocks side-key -//---------------------------------------------------- -// -void CAutolockAppUi::LockSideKeyL() - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::LockSideKeyL()")); - #endif - if (!iSideKey1) - { - RWindowGroup& groupWin=iCoeEnv->RootWin(); - iSideKey1 = groupWin.CaptureKey(EKeyDeviceF,0,0); // EKeySide -> EKeyDeviceF - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) capturing EStdKeyDeviceF=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EStdKeyDeviceF ); - #endif - iSideKey2 = groupWin.CaptureKeyUpAndDowns(EStdKeyDeviceF, 0, 0); // EStdKeyDevice6 -> EStdKeyDeviceF - } - } - -// ------------------------------------------------------------------------------------------------------------- -// part of emergency call handling when telephony+devicelock is active -// this solution is meant only for 3.1 and 3.2 -void CAutolockAppUi::HandleEcsEvent( CAknEcsDetector* aEcsDetector, CAknEcsDetector::TState aState ) - { - switch ( aState ) - { - case CAknEcsDetector::ECompleteMatchThenSendKey: - // Do nothing since note will be removed on ECallAttempted event - break; - case CAknEcsDetector::ECompleteMatch: - iEcsNote->SetEmergencyNumber( aEcsDetector->CurrentMatch() ); - - // Tell sysAp to switch lights on - SendMessageToSysAp( EEikEcsQueryLights ); - - iEcsNote->ShowNote(); - iEcsNote->iNoteOnScreen =ETrue; - break; - case CAknEcsDetector::EPartialMatch: - iEcsNote->SleepNote(); - break; - case CAknEcsDetector::ECallAttempted: - iEcsNote->SleepNote(); - break; - case CAknEcsDetector::EEmpty: - iEcsNote->SleepNote(); - break; - case CAknEcsDetector::ENoMatch: - iEcsNote->SleepNote(); - break; - default: - break; - } - } - -CEcsNote::CEcsNote() : iNoteOnScreen( EFalse ) - {} - -void CEcsNote::ConstructSleepingNoteL(TInt aResourceId) - { - CAknNoteDialog::ConstructSleepingDialogL(aResourceId); - } - -TInt CEcsNote::ShowNote() - { - ReportUserActivity(); - iTimeoutInMicroseconds = CAknNoteDialog::EUndefinedTimeout; - iTone = CAknNoteDialog::ENoTone; - if (!iNoteOnScreen) - { - return RouseSleepingDialog(); - } - // return value not used - else - // return value not used - return NULL; - } - -void CEcsNote::SleepNote() - { - if (iNoteOnScreen) - ExitSleepingDialog(); // Causes flicker to other notes if called when note is not on screen - iNoteOnScreen = EFalse; - } - -TKeyResponse CEcsNote::OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/) - { - return EKeyWasConsumed; - } - -void CEcsNote::SetEmergencyNumber( const TDesC& aMatchedNumber ) - { - TRect screen(iAvkonAppUi->ApplicationRect()); - TAknLayoutRect mainPane; - mainPane.LayoutRect(screen, AKN_LAYOUT_WINDOW_main_pane(screen, 0, 1, 1)); - TAknLayoutRect popupNoteWindow; - AknLayoutUtils::TAknCbaLocation cbaLocation( AknLayoutUtils::CbaLocation() ); - TInt variety( 0 ); - if ( cbaLocation == AknLayoutUtils::EAknCbaLocationRight ) - { - variety = 5; - } - else if ( cbaLocation == AknLayoutUtils::EAknCbaLocationLeft ) - { - variety = 8; - } - else - { - variety = 2; - } - - popupNoteWindow.LayoutRect(mainPane.Rect(), AknLayoutScalable_Avkon::popup_note_window( variety )); - TAknLayoutText textRect; - textRect.LayoutText(popupNoteWindow.Rect(), AKN_LAYOUT_TEXT_Note_pop_up_window_texts_Line_1(4)); - - // Size of a temporary buffer that contains new lines, spaces and - // emergency number for a note. - TBuf16 number; - number.Append('\n'); - number.Append('\n'); - - TInt spaceCharWidthInPixels = textRect.Font()->CharWidthInPixels(' '); - if (spaceCharWidthInPixels < 1) - { - // Avoid divide by zero situation even the space char would have zero length. - spaceCharWidthInPixels = 1; - } - - TInt length = (textRect.TextRect().Width() - textRect.Font()->TextWidthInPixels(aMatchedNumber)) - / spaceCharWidthInPixels; - - const TInt matchedNumberLength = aMatchedNumber.Length(); - const TInt numberLength = number.Length(); - const TInt numberMaxLength = number.MaxLength(); - - if ( numberLength + length + matchedNumberLength > numberMaxLength) - { - // To make sure that buffer overflow does not happen. - length = numberMaxLength - numberLength - matchedNumberLength; - } - for (int i = 0; i < length ; i++) - { - number.Append(' '); - } - - number.Append(aMatchedNumber); - TRAP_IGNORE(SetTextL(number)); - - } - -// ------------------------------------------------------------------------------------------------------------- - -// ---------------------------------------------------- -// CAutolockAppUi::UnLockSideKey() -// unlocks side-key -//---------------------------------------------------- -// -void CAutolockAppUi::UnLockSideKey() - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::UnLockSideKeyL()")); - #endif - if (iSideKey1) - { - RWindowGroup& groupWin=iCoeEnv->RootWin(); - groupWin.CancelCaptureKeyUpAndDowns(iSideKey2); - groupWin.CancelCaptureKey(iSideKey1); - iSideKey1 = 0; - iSideKey2 = 0; - } - } - - -// -// --------------------------------------------------------- -// CAutolockAppUi::HandleScreenDeviceChangedL() -// Handles screen layout changes, called by CCoeAppUi -// --------------------------------------------------------- -// -void CAutolockAppUi::HandleScreenDeviceChangedL() -{ - CAknAppUiBase::HandleScreenDeviceChangedL(); - //get autolock view from CAknViewAppUi - CAknView* view = View(KAutoLockViewId); - if(view) - { - STATIC_CAST(CAutolockView*, view)->ScreenDeviceChanged(); - } - -} - -// -// ---------------------------------------------------------- -// CAutolockAppUi::IsPinBlocked() -// Checks whether PIN1/UPIN is blocked -// ---------------------------------------------------------- -// -TBool CAutolockAppUi::IsPinBlocked() -{ - RMmCustomAPI::TSecurityCodeType secCodeType; - TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); - - if(wcdmaSupported || upinSupported) - { - RMobilePhone::TMobilePhoneSecurityCode activePin; - iCustomPhone.GetActivePin(activePin); - if(activePin == RMobilePhone::ESecurityUniversalPin) - secCodeType = RMmCustomAPI::ESecurityUniversalPin; - else - secCodeType = RMmCustomAPI::ESecurityCodePin1; - } - else - secCodeType = RMmCustomAPI::ESecurityCodePin1; - - TBool isBlocked = EFalse; - iCustomPhone.IsBlocked(secCodeType,isBlocked); - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::IsPinBlocked result: %d"), isBlocked); - #endif - return isBlocked; -} - -// -// ---------------------------------------------------------- -// CAutolockAppUi::HandleWsEventL() -// -// ---------------------------------------------------------- -// -void CAutolockAppUi::HandleWsEventL( const TWsEvent& aEvent,CCoeControl* aDestination ) - { - const TInt type = aEvent.Type(); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) type=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, type ); - #endif - - switch ( type ) - { - case KAknFullOrPartialForegroundLost: // partial or full fg lost - if( iIncallBubble ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleWsEventL: DISABLE call bubble")); - #endif - iIncallBubble->SetIncallBubbleAllowedInIdleL( EFalse ); - } - break; - case KAknFullOrPartialForegroundGained: // partial or full fg gained - if( iIncallBubble ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleWsEventL: ENABLE call bubble")); - #endif - CAknView* view = View(KAutoLockViewId); - if(view) - { - TRect aInitialRect; - STATIC_CAST(CAutolockView*, view)->HandleCall(0x1A, aInitialRect); - } - - iIncallBubble->SetIncallBubbleAllowedInIdleL( ETrue ); - } - break; - case EEventWindowGroupListChanged: - HandleWindowGroupListChange(); - break; - case EEventPointer: - case EEventDragDrop: - { - TInt gripStatus = EPSHWRMGripClosed; - RProperty::Get( KPSUidHWRM, KHWRMGripStatus, gripStatus ); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) 1 gripStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, gripStatus ); - RDebug::Printf( "%s %s (%u) EPSHWRMGripClosed=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EPSHWRMGripClosed ); - #endif - if(gripStatus==EPSHWRMGripStatusUninitialized) - { - gripStatus=EPSHWRMGripClosed; - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) new gripStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, gripStatus ); - #endif - } - TInt callState = 0; - RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) callState=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, callState ); - #endif - TPointerEvent *pointer = aEvent.Pointer(); - CAknView* view = View(KAutoLockViewId); - if(view) - { - STATIC_CAST(CAutolockView*, view)->ScreenDeviceChanged(); - TRect aInitialRect; - STATIC_CAST(CAutolockView*, view)->HandleCall(0x1, aInitialRect); - if(aCallButtonRect.iBr.iX==0) // initialize if not done already - aCallButtonRect = TRect (aInitialRect); - } - if ( callState != EPSCTsyCallStateNone && callState != EPSCTsyCallStateUninitialized ) - { - if(pointer->iType==TPointerEvent::EButton1Down) - { - TPoint iPosition = pointer->iPosition; - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) iPosition.iX=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPosition.iX ); - RDebug::Printf( "%s %s (%u) aCallButtonRect.iBr.iX=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aCallButtonRect.iBr.iX ); - RDebug::Printf( "%s %s (%u) iPosition.iY=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPosition.iY ); - RDebug::Printf( "%s %s (%u) aCallButtonRect.iBr.iY=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aCallButtonRect.iBr.iY ); - #endif - if(aCallButtonRect.iBr.iX400) || (gripStatus!=EPSHWRMGripClosed && aCallButtonRect.iBr.iYiType==TPointerEvent::EButton1Up) - { - TPoint iPosition = pointer->iPosition; - // touching at any point inside and below the BigRedButton. This is to handle the case where another dialog overlaps - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) iGotEventDownDuringCall=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iGotEventDownDuringCall ); - RDebug::Printf( "%s %s (%u) iPosition.iX=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPosition.iX ); - RDebug::Printf( "%s %s (%u) aCallButtonRect.iBr.iX=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aCallButtonRect.iBr.iX ); - RDebug::Printf( "%s %s (%u) iPosition.iY=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPosition.iY ); - RDebug::Printf( "%s %s (%u) aCallButtonRect.iBr.iY=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aCallButtonRect.iBr.iY ); - #endif - if(iGotEventDownDuringCall==1 && aCallButtonRect.iBr.iX400) || (gripStatus!=EPSHWRMGripClosed && aCallButtonRect.iBr.iYWsSession().SimulateRawEvent(event); - User::After(1000); - event.Set(TRawEvent::EKeyUp, EStdKeyNo); - iEikonEnv->WsSession().SimulateRawEvent(event); - User::After(100000); // give time for the call to end - } - } - iGotEventDownDuringCall=0; // even if outside the touch area - aCallButtonRect.iBr.iX = 0; - } - } - } - break; - case EEventKeyUp: // on touch devices, this happens only for the switch-key, which should turn on the lights. - case EEventKey: - case EEventKeyDown: - if(iLocked) - { // need to capture the switch-key for the case activeCall because Autolock stays on top, even over Akn - TKeyEvent *key = aEvent.Key(); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) key->iCode=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, key->iCode ); - RDebug::Printf( "%s %s (%u) key->iScanCode=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, key->iScanCode ); - #endif - if ( (key->iScanCode == EStdKeyDeviceF) || (key->iCode == EKeyDeviceF) ) - { - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) good key=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - #endif - RWsSession& ws = iEikonEnv->WsSession(); - TApaTaskList tasklist( ws ); - TApaTask capserver = tasklist.FindApp( KAknCapServerUid ); - if( capserver.Exists() ) - { - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) found KAknCapServerUid=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, KAknCapServerUid ); - #endif - capserver.SendKey( *key ); - } - SendMessageToSysAp( EEikSecurityQueryLights ); - } - } - break; - default: - iGotEventDownDuringCall=0; // any other event invalidates the Press inside the BigRedButton - break; - } - - // All events are sent to base class. - CAknViewAppUi::HandleWsEventL( aEvent, aDestination ); - - // part of emergency call handling when telephony+devicelock is active - // this solution is meant only for 3.1 and 3.2 - // Emergency detector only handles key down events - if ( iEmergencySupportReady ) - iEcsDetector->HandleWsEventL( aEvent, aDestination); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) 0=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - #endif - } - -TBool CAutolockAppUi::DeviceLockQueryStatus() - { - return iDeviceLockQueryStatus; - } - -TBool CAutolockAppUi::DeviceLockStatus() - { - return iLocked; - } - -void CAutolockAppUi::ForceOrientation(TInt value) - { - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, value ); - #endif - if(value==1) - { - SetOrientationL( EAppUiOrientationLandscape ); - SetOrientationL( EAppUiOrientationPortrait ); - } - if(value==0) - { - SetOrientationL( EAppUiOrientationPortrait ); - SetOrientationL( EAppUiOrientationLandscape ); - } - aCallButtonRect.iBr.iX = 0; - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) done value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, value ); - #endif - } - -void CAutolockAppUi::CancelDeviceLockQuery() - { - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) 0=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - #endif - TRawEvent rawEvent; - rawEvent.Set( TRawEvent::EKeyDown, KCancelKeyScanCode ); - iCoeEnv->WsSession().SimulateRawEvent( rawEvent ); - rawEvent.Set( TRawEvent::EKeyUp, KCancelKeyScanCode ); - iCoeEnv->WsSession().SimulateRawEvent( rawEvent ); - } - -TBool CAutolockAppUi::DeviceFpsLock(TInt iStatus) - { - if(iStatus) - HandleCommandL(ESecUiCmdUnlock); - else - iModel->SetLockedL(ETimerLocked); - return ETrue; - } -void CAutolockAppUi::HandleWindowGroupListChange() - { - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) iLocked=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iLocked ); - #endif - if ( !iLocked ) - { - // System is not locked, make sure app is not on the foreground. - if ( !iCoeEnv->RootWin().OrdinalPosition() ) - { - CAknSgcClient::MoveApp( - iCoeEnv->RootWin().Identifier(), - ESgcMoveAppToBackground ); - } - } - else - { - CAknView* view = View(KAutoLockViewId); - if(view) - { - TRect aInitialRect; - STATIC_CAST(CAutolockView*, view)->HandleCall(0x10, aInitialRect); - if(aCallButtonRect.iBr.iX==0) // initialize if not done already - aCallButtonRect = TRect (aInitialRect); - } - // So now system is locked. When call is not ongoing, autolock should - // be on the foreground. - TInt callState = 0; - RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); - if ( callState == EPSCTsyCallStateNone || - callState == EPSCTsyCallStateUninitialized ) - { - // No calls ongoing. - if ( iCoeEnv->RootWin().OrdinalPosition() > 0 ) - { - // Not on foreground - CAknSgcClient::MoveApp( - iCoeEnv->RootWin().Identifier(), - ESgcMoveAppToForeground ); - } - } - } - } - -TBool CAutolockAppUi::TarmState() -{ -TBool ret(EFalse); -if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) -{ - // Get the TARM admin flag value - TInt tarmFlag; - TInt tRet = RProperty::Get( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag ); - - if ( tRet != KErrNone ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::BringAppToForegroundL(): Warning: failed to get TARM Admin Flag state")); - #endif - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::BringAppToForegroundL(): TARM flag: %d"), - tarmFlag ); - #endif - } - - // Unset the admin flag if set - if ( tarmFlag & KSCPFlagAdminLock ) - { - ret = ETrue; - TInt tRet = RProperty::Get( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag ); - - if ( tRet == KErrNone ) - { - tarmFlag &= ~KSCPFlagAdminLock; - tRet = RProperty::Set( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag ); - } - - if ( tRet != KErrNone ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::BringAppToForegroundL(): FAILED to unset TARM Admin Flag")); - #endif - } - } - -} - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) ret=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ret ); - #endif -return ret; -} - -// --------------------------------------------------------- -// CAutolockAppUi::HiddenReset() -// --------------------------------------------------------- -TBool CAutolockAppUi::HiddenReset() - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HiddenReset() begin")); - #endif - - TBool ret_val ( EFalse ); - TInt startupReason(ENormalStartup); - TInt errorCode(KErrNone); - - RProperty::Get(KPSUidStartup, KPSStartupReason, startupReason); - - if ( errorCode != KErrNone ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HiddenReset() error getting startup reason")); - #endif - } - ret_val = (startupReason != ENormalStartup); - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HiddenReset() END: %d"), ret_val); - #endif - return ret_val; - } -void CAutolockAppUi::EnableWGListChangeEventListening() -{ - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::EnableWGListChangeEventListening()")); - #endif - RWindowGroup& rootWin = iCoeEnv->RootWin(); - rootWin.EnableGroupListChangeEvents(); - rootWin.EnableScreenChangeEvents(); -} -void CAutolockAppUi::DisableWGListChangeEventListening() -{ - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::DisableWGListChangeEventListening()")); - #endif - RWindowGroup& rootWin = iCoeEnv->RootWin(); - rootWin.DisableGroupListChangeEvents(); - rootWin.DisableScreenChangeEvents(); -} -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/src/AutolockContainer.cpp --- a/securitydialogs/Autolock/src/AutolockContainer.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,394 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -*/ - - -// INCLUDE FILES -#include "AutolockContainer.h" -#include -#include -#include -#include -#include -#include -#include -#include "AutolockAppUiPS.h" -#include -#include "autolock.hrh" -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -#include -#include // Property values -#include -#include -#include -_LIT(BitmapName,"AutoLock.mbm"); - -// CONSTANTS - -#ifdef RD_FULLSCREEN_WALLPAPER -enum TAutolockBgLayers - { - EAutolockBgLayerWallpaper = 0, - EAutolockBgLayerBackground = 1, - EAutolockBgLayersN = 2 - }; -#else -enum TAutolockBgLayers - { - EAutolockBgLayerBackground = 0, - EAutolockBgLayerWallpaper = 1, - EAutolockBgLayersN = 2 - }; -#endif //RD_FULLSCREEN_WALLPAPER - - TInt aCallRect_x; - TInt aCallRect_y; - TInt aCallRect_width; - TInt aCallRect_height; -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CAutolockContainer::ConstructL(const TRect& aRect) -// Symbian OS two phased constructor -// --------------------------------------------------------- -// -void CAutolockContainer::ConstructL(const TRect& aRect) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockContainer::ConstructL")); - #endif - CreateWindowL(); - - HBufC* bitMapPath = HBufC::NewLC(KMaxPath); - TPtr BitmapFile(bitMapPath->Des()); - BitmapFile.Append(_L("Z:")); - BitmapFile.Append(KDC_APP_BITMAP_DIR); - BitmapFile.Append(BitmapName); - - iEikBitmap = 0; - iEikBitmapCall = 0; - AknsUtils::CreateIconL( - AknsUtils::SkinInstance(), - KAknsIIDQgnGrafPhoneLocked, - iBitmap, - iMask, - BitmapFile, - EMbmAutolockQgn_graf_phone_locked, - EMbmAutolockQgn_graf_phone_locked_mask ); - AknsUtils::CreateIconL( - AknsUtils::SkinInstance(), - KAknsIIDQgnGrafPhoneLocked, - iBitmapCall, - iMaskCall, - BitmapFile, - EMbmAutolockQgn_indi_button_end_call, - EMbmAutolockQgn_indi_button_end_call_mask ); - -#ifdef RD_FULLSCREEN_WALLPAPER - TSize screenSize = iCoeEnv->ScreenDevice()->SizeInPixels(); - TRect wallpaperRect( TPoint(0,0), screenSize ); - iBgContext = CAknsLayeredBackgroundControlContext::NewL( - KAknsIIDWallpaper, wallpaperRect, ETrue, EAutolockBgLayersN ); - SetRect(aRect); -#else - // Create background control context for skins. Use parent absolute mode, - // as this is window owning control - iBgContext = CAknsLayeredBackgroundControlContext::NewL( - KAknsIIDQsnBgAreaMainIdle, aRect, ETrue, EAutolockBgLayersN ); - iBgContext->SetLayerImage( EAutolockBgLayerWallpaper, KAknsIIDWallpaper ); - iBgContext->SetLayerRect( EAutolockBgLayerWallpaper, aRect ); - SetRect(aRect); -#endif // RD_FULLSCREEN_WALLPAPER - ActivateL(); - - CleanupStack::PopAndDestroy(bitMapPath); //bitMapPath - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockContainer::ConstructL END")); - #endif - } - - -// --------------------------------------------------------- -// CAutolockContainer::~CAutolockContainer() -// Destructor -// --------------------------------------------------------- -// -CAutolockContainer::~CAutolockContainer() - { - delete iBgContext; - delete iBitmap; - delete iMask; - delete iBitmapCall; - delete iMaskCall; - - } -// --------------------------------------------------------- -// CAutolockContainer::SizeChanged() -// Called by framework when the view size is changed -// --------------------------------------------------------- -// -void CAutolockContainer::SizeChanged() - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockContainer::SizeChanged()")); - #endif - - TRect mainPaneRect(Rect()); - TAknLayoutRect idleTradPane; - idleTradPane.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::main_idle_trad_pane()); - - TInt variety = 3; - if (Layout_Meta_Data::IsLandscapeOrientation()) - { - variety = 2; - } - - - TAknLayoutRect idlePaneG2; - idlePaneG2.LayoutRect(idleTradPane.Rect(), AknLayoutScalable_Avkon::main_idle_pane_g2(variety)); - - TInt callState = 0; - RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); - if ( callState == EPSCTsyCallStateNone || callState == EPSCTsyCallStateUninitialized ) - { - AknIconUtils::SetSize( iBitmap, idlePaneG2.Rect().Size() ); - } - else - { - TSize lockSize = TSize(0.8 * idlePaneG2.Rect().Size().iWidth, 0.8 * idlePaneG2.Rect().Size().iHeight); - AknIconUtils::SetSize( iBitmap, lockSize ); - } - TSize callSize = TSize(60,60); - AknIconUtils::SetSize( iBitmapCall, callSize ); - -#ifdef RD_FULLSCREEN_WALLPAPER - TSize screenSize = iCoeEnv->ScreenDevice()->SizeInPixels(); - TRect wallpaperRect( TPoint(0,0), screenSize ); - iBgContext->SetLayerRect( EAutolockBgLayerBackground, Rect() ) ; - iBgContext->SetLayerRect( EAutolockBgLayerWallpaper, wallpaperRect ) ; - - TPoint origo( 0, 0); - iBgContext->SetParentPos(origo); -#else - - iBgContext->SetLayerRect( EAutolockBgLayerBackground, Rect() ) ; - iBgContext->SetLayerRect( EAutolockBgLayerWallpaper, Rect() ) ; - - TPoint positionRelativeToScreen = PositionRelativeToScreen(); - //parent must be set when using parent absolute mode. - iBgContext->SetParentPos(positionRelativeToScreen); -#endif //RD_FULLSCREEN_WALLPAPER - - RRegion autolockRegion; -#ifdef RD_FULLSCREEN_WALLPAPER - autolockRegion.AddRect( wallpaperRect); -#else - autolockRegion.AddRect(Rect()); -#endif //RD_FULLSCREEN_WALLPAPER - Window().SetShape(autolockRegion); - autolockRegion.Close(); - - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockContainer::SizeChanged() END")); - #endif - } -// --------------------------------------------------------- -// CAutolockContainer::CountComponentControls() const -// --------------------------------------------------------- -// -TInt CAutolockContainer::CountComponentControls() const - { - TInt controlCount = 0; - - return controlCount; - } - -// --------------------------------------------------------- -// CAutolockContainer::ComponentControl(TInt aIndex) const -// --------------------------------------------------------- -// -CCoeControl* CAutolockContainer::ComponentControl(TInt /*aIndex*/) const - { - return NULL; - } - // --------------------------------------------------------- -// CAutolockContainer::Draw(const TRect& aRect) const -// --------------------------------------------------------- -// -void CAutolockContainer::Draw(const TRect& aRect) const - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockContainer::Draw")); - #endif - if (AknLayoutUtils::PenEnabled() ) - { - TInt value = 0; - RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, value); - if(value <= EAutolockOff) - { // Avoid displaying the icon - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) no Draw value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, value ); - #endif - // If it returns, it will not handle orientation changes. - // However it will not really draw because the view is hidden - // return; - } - } - - CWindowGc& gc = SystemGc(); - gc.SetPenStyle(CGraphicsContext::ENullPen); - gc.SetBrushColor(KRgbWhite); - gc.SetBrushStyle(CGraphicsContext::ESolidBrush); - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); - AknsDrawUtils::Background( skin, cc, this, gc, aRect ); - - // Draw "lock" icon centered to this control - // fist calculate the correct x coordinate based on this - // controls rect and bitmap width - TInt x = Rect().Width()/2 - iBitmap->SizeInPixels().iWidth /2; - // and do same with y - TInt y = Rect().Height()/2 - iBitmap->SizeInPixels().iHeight/2; - TInt width =iBitmap->SizeInPixels().iWidth; - TInt height =iBitmap->SizeInPixels().iHeight; - - TInt gripStatus = EPSHWRMGripClosed; - RProperty::Get( KPSUidHWRM, KHWRMGripStatus, gripStatus ); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) gripStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, gripStatus ); - #endif - - TInt callState = 0; - RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); - if ( callState == EPSCTsyCallStateNone || callState == EPSCTsyCallStateUninitialized ) - { - } - else - { - if (gripStatus != EPSHWRMGripOpen) - y-=100; - } - - if (iBitmap && iMask) - { - // gc.BitBltMasked(TPoint(x,y),iBitmap,TRect(TPoint(0,0),iBitmap->SizeInPixels()), iMask, ETrue); - gc.BitBltMasked(TPoint(x,y),iBitmap,TRect(TPoint(0,0),TPoint(width,height)), iMask, ETrue); - if ( callState == EPSCTsyCallStateNone || callState == EPSCTsyCallStateUninitialized ) - { - } - else - { - if (gripStatus != EPSHWRMGripOpen) - { - aCallRect_x=Rect().Width()/2 - iBitmapCall->SizeInPixels().iWidth/2; - aCallRect_y=Rect().Height() * 0.75; - } - else - { - aCallRect_x=Rect().Width()* 0.75 - iBitmapCall->SizeInPixels().iWidth/2; - aCallRect_y = Rect().Height()/2-3*10; - } - aCallRect_width=iBitmapCall->SizeInPixels().iWidth; - aCallRect_height=iBitmapCall->SizeInPixels().iHeight; - TSize cornerSize(20,20); - TSize cornerEllipseSize(cornerSize.iHeight*2,cornerSize.iWidth*2); - TRect box(aCallRect_x-3*10 , aCallRect_y-3*10, aCallRect_x+aCallRect_width+3*10, aCallRect_y+aCallRect_height+3*10); - TRect cornerRectTl(box.iTl,cornerEllipseSize); - gc.SetBrushColor(KRgbRed); - gc.SetBrushStyle(CGraphicsContext::ESolidBrush); - gc.SetPenStyle(CGraphicsContext::EDottedPen); - gc.DrawRoundRect(box,cornerSize); - gc.BitBltMasked(TPoint(aCallRect_x,aCallRect_y),iBitmapCall,TRect(TPoint(0,0),TPoint(aCallRect_width,aCallRect_height)), iMaskCall, ETrue); - if (gripStatus != EPSHWRMGripOpen) - aCallRect_y+=100; // coordinates are relative to TRect, not to Screen - - // if active call, dismiss all pending notes. This avoids them on top of the BigRedButton - CAknSoftNotifier *softNotifier = NULL; - TRAPD (err, { - softNotifier = CAknSoftNotifier::NewL(); - softNotifier->AddNotificationL(ESetIdleState, 0); - // softNotifier->SetIdleStateL(EFalse); - };) - delete softNotifier; - // during any call ,the touch need to be enabled, so that BigRedButton is available - // It will be re-enabled when the call ends - RAknKeyLock keylock; - if ( keylock.Connect() == KErrNone ) - { - keylock.DisableWithoutNote(); - keylock.Close(); - } - } - } - else if (iBitmap && !iMask) - { - gc.BitBlt(TPoint(x,y),iBitmap); - if ( callState == EPSCTsyCallStateNone || callState == EPSCTsyCallStateUninitialized ) - { - } - else - { - gc.BitBlt(TPoint(x,y+iBitmap->SizeInPixels().iHeight),iBitmapCall); - } - } - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockContainer::Draw END")); - #endif - } - -// --------------------------------------------------------- -// CAutolockContainer::HandleControlEventL( -// CCoeControl* aControl,TCoeEvent aEventType) -// --------------------------------------------------------- -// -void CAutolockContainer::HandleControlEventL( - CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/) - { - } - -// --------------------------------------------------------- -// CAutolockContainer::MopSupplyObject -// -// --------------------------------------------------------- -// -TTypeUid::Ptr CAutolockContainer::MopSupplyObject( TTypeUid aId ) - { - if (aId.iUid == MAknsControlContext::ETypeId) - { - return MAknsControlContext::SupplyMopObject( aId, iBgContext ); - } - return CCoeControl::MopSupplyObject( aId ); - } -void CAutolockContainer::GiveCoords( TRect& aRect ) - { - aRect.iBr.iX=aCallRect_x; - aRect.iBr.iY=aCallRect_y; - aRect.iTl.iX=aCallRect_width+2*3*10; - aRect.iTl.iY=aCallRect_height+2*3*10; - } -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/src/AutolockDocument.cpp --- a/securitydialogs/Autolock/src/AutolockDocument.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -*/ - - -// INCLUDE FILES -#include -#include "AutolockDocument.h" -#include "AutolockAppUiPS.h" - -// ================= MEMBER FUNCTIONS ======================= -// -// ---------------------------------------------------- -// CAutolockDocument::ConstructL() -// destructor. -// ---------------------------------------------------- -// -CAutolockDocument::~CAutolockDocument() - { - } -// ---------------------------------------------------- -// CAutolockDocument::ConstructL() -// Symbian OS default constructor can leave.. -// ---------------------------------------------------- -// -void CAutolockDocument::ConstructL() - { - } -// ---------------------------------------------------- -// CAutolockDocument::NewL() -// Two-phased constructor. -// ---------------------------------------------------- -// -CAutolockDocument* CAutolockDocument::NewL(CEikApplication& aApp) - { - CAutolockDocument* self = new (ELeave) CAutolockDocument( aApp ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); - return self; - } -// ---------------------------------------------------- -// CAutolockDocument::CreateAppUiL() -// constructs CAutolockAppUi -// ---------------------------------------------------- -// -CEikAppUi* CAutolockDocument::CreateAppUiL() - { - return new (ELeave) CAutolockAppUi; - } - -// ---------------------------------------------------- -// CAutolockDocument::UpdateTaskNameL() -// Sets app hidden... -// ---------------------------------------------------- -// -void CAutolockDocument::UpdateTaskNameL( CApaWindowGroupName* aWgName ) - { - CEikDocument::UpdateTaskNameL( aWgName ); - aWgName->SetHidden( ETrue ); - } -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/src/AutolockFpsStatusObserver.cpp --- a/securitydialogs/Autolock/src/AutolockFpsStatusObserver.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -*/ - -#include -#include -#include -#include -#include "AutolockFpsStatusObserver.h" - - -EXPORT_C CAutolockFpsStatusObserver* CAutolockFpsStatusObserver::NewL( MAutolockFpsStatusObserver* aObserver, RWsSession& aSession ) - { - CAutolockFpsStatusObserver* self = new (ELeave) CAutolockFpsStatusObserver( aSession ); - CleanupStack::PushL( self ); - self->ConstructL( aObserver ); - CleanupStack::Pop( self ); - return self; - } - -void CAutolockFpsStatusObserver::ConstructL( MAutolockFpsStatusObserver* aObserver ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockFpsStatusObserver::ConstructL") ); - #endif -const TUid KUidFpsCategory = {0x1020507E }; - -// PnS key -const TUint32 KFpsAuthenticationKey = 0x00000001; - - TInt err = iFpsStatus.Attach( KUidFpsCategory, KFpsAuthenticationKey ); - if ( err ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)ERROR: Attach failed, err %d"), err ); - #endif - } - iObserver = aObserver; - CActiveScheduler::Add( this ); - iFpsStatus.Subscribe( iStatus ); - SetActive(); - } - -CAutolockFpsStatusObserver::CAutolockFpsStatusObserver( RWsSession& aSession ) : CActive( EPriorityIdle ), iSession( aSession ) - { - } - -CAutolockFpsStatusObserver::~CAutolockFpsStatusObserver() - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockFpsStatusObserver::~CAutolockFpsStatusObserver") ); - #endif - Cancel(); - iFpsStatus.Close(); - } - -void CAutolockFpsStatusObserver::DoCancel() - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockFpsStatusObserver::DoCancel") ); - #endif - iFpsStatus.Cancel(); - } - -void CAutolockFpsStatusObserver::RunL() - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockFpsStatusObserver::RunL") ); - #endif - iFpsStatus.Subscribe( iStatus ); - SetActive(); - - TInt FpsStatus; - TInt err = iFpsStatus.Get( FpsStatus ); - if( !err ) - { - FpsStatusChangedL( FpsStatus ); - } - } - -void CAutolockFpsStatusObserver::FpsStatusChangedL( TInt aFpsStatus ) - { -const TUint32 ESwipeValid = 0x00000001; - if( aFpsStatus == ESwipeValid ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockFpsStatusObserver::FpsStatusChangedL => Fps opened")); - #endif - if( iObserver->DeviceLockStatus() ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockFpsStatusObserver::FpsStatusChangedL => unlocking")); - #endif - iObserver->DeviceFpsLock(1); - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockFpsStatusObserver::FpsStatusChangedL => locking")); - #endif - iObserver->DeviceFpsLock(0); - } - } - } - -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/src/AutolockGripStatusObserver.cpp --- a/securitydialogs/Autolock/src/AutolockGripStatusObserver.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,158 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -*/ - -#include -#include -#include -#include -#include "AutolockGripStatusObserver.h" -#include "AutolockApp.h" -#include "AutolockAppUiInterface.h" -#include - - -EXPORT_C CAutolockGripStatusObserver* CAutolockGripStatusObserver::NewL( MAutolockAppUiInterface* aObserver, RWsSession& aSession ) - { - CAutolockGripStatusObserver* self = new (ELeave) CAutolockGripStatusObserver( aSession ); - CleanupStack::PushL( self ); - self->ConstructL( aObserver ); - CleanupStack::Pop( self ); - return self; - } - -void CAutolockGripStatusObserver::ConstructL( MAutolockAppUiInterface* aObserver ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockGripStatusObserver::ConstructL") ); - #endif - TInt err = iGripStatus.Attach( KPSUidHWRM, KHWRMGripStatus ); - if ( err ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)ERROR: Attach failed, err %d"), err ); - #endif - } - iObserver = aObserver; - CActiveScheduler::Add( this ); - iGripStatus.Subscribe( iStatus ); - SetActive(); - } - -CAutolockGripStatusObserver::CAutolockGripStatusObserver( RWsSession& aSession ) : CActive( EPriorityIdle ), iSession( aSession ) - { - } - -CAutolockGripStatusObserver::~CAutolockGripStatusObserver() - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockGripStatusObserver::~CAutolockGripStatusObserver") ); - #endif - Cancel(); - iGripStatus.Close(); - } - -void CAutolockGripStatusObserver::DoCancel() - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockGripStatusObserver::DoCancel") ); - #endif - iGripStatus.Cancel(); - } - -void CAutolockGripStatusObserver::RunL() - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockGripStatusObserver::RunL") ); - #endif - iGripStatus.Subscribe( iStatus ); - SetActive(); - - TInt gripStatus; - TInt err = iGripStatus.Get( gripStatus ); - if( !err ) - { - GripStatusChangedL( gripStatus ); - } - } - -void CAutolockGripStatusObserver::GripStatusChangedL( TInt aGripStatus ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockGripStatusObserver::::GripStatusChangedL")); - #endif - if( aGripStatus == EPSHWRMGripOpen ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockGripStatusObserver::::GripStatusChangedL => Grip opened")); - #endif - iObserver->ForceOrientation(0); - if( !iObserver->DeviceLockQueryStatus() && iObserver->DeviceLockStatus() ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockGripStatusObserver::::GripStatusChangedL => send command")); - #endif - //Grip opened - TApaTaskList tasklist( iSession ); - /* this is old code. It was changed to a new one, following a suggestion from the Slide-handling team - TApaTask capserver = tasklist.FindApp( KAknCapServerUid ); - if( capserver.Exists() ) - { - TKeyEvent key; - key.iCode = EKeyDevice0; - key.iModifiers = 0; - key.iRepeats = 0; - key.iScanCode = EStdKeyDevice0; - capserver.SendKey( key ); - } - */ - TApaTask capserver = tasklist.FindApp( KUidAutolock ); - if( capserver.Exists() ) - { - TKeyEvent key; - key.iCode = EKeyBell; - capserver.SendKey( key ); - } - RAknKeylock2 keylock; - TInt error( keylock.Connect() ); - if ( !error ) - { - keylock.DisableWithoutNote(); - keylock.Close(); - } - } - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockGripStatusObserver::::GripStatusChangedL => Grip closed")); - #endif - iObserver->ForceOrientation(1); - - //Grip closed - if( iObserver->DeviceLockQueryStatus() ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockGripStatusObserver::::GripStatusChangedL => send key event")); - #endif - //the device lock query is on top - //generate cancel key event - iObserver->CancelDeviceLockQuery(); - } - } - } - -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/src/AutolockWait.cpp --- a/securitydialogs/Autolock/src/AutolockWait.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,168 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -* -*/ - - - -#include -#include -#include -#include "AutolockWait.h" - - - -// ================= MEMBER FUNCTIONS ======================= -// -// ---------------------------------------------------------- -// CWait::NewL() -// -// ---------------------------------------------------------- -// -CWait* CWait::NewL() - { - CWait* self = new(ELeave) CWait(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); - return self; - } -// -// ---------------------------------------------------------- -// CSystemLock::ConstructL() -// -// ---------------------------------------------------------- -// -void CWait::ConstructL() - { - CActiveScheduler::Add(this); - } -// -// ---------------------------------------------------------- -// CWait::CWait() -// -// ---------------------------------------------------------- -// -CWait::CWait() : CActive(0) - { - } -// -// ---------------------------------------------------------- -// CWait::~CWait() -// Destructor -// ---------------------------------------------------------- -// -CWait::~CWait() - { - Cancel(); - } -// -// ---------------------------------------------------------- -// CWait::StartWaitForRequest -// -// ---------------------------------------------------------- -// -TInt CWait::WaitForRequestL() - { - CWaitAbsorbingControl* absorbing = CWaitAbsorbingControl::NewLC(); - SetActive(); - iWait.Start(); - CleanupStack::PopAndDestroy(absorbing); - return iStatus.Int(); - } -// -// ---------------------------------------------------------- -// CWait::RunL() -// -// ---------------------------------------------------------- -// -void CWait::RunL() - { - if(iWait.IsStarted()) - iWait.AsyncStop(); - } -// -// ---------------------------------------------------------- -// CWait::DoCancel() -// Cancels code request -// ---------------------------------------------------------- -// -void CWait::DoCancel() - { - if(iWait.IsStarted()) - iWait.AsyncStop(); - } - -// -// ---------------------------------------------------------- -// CWait::SetRequestType -// Sets active request type -// ---------------------------------------------------------- -// -void CWait::SetRequestType(TInt aRequestType) -{ - iRequestType = aRequestType; -} - -// -// ---------------------------------------------------------- -// CWait::GetRequestType -// Gets active request type -// ---------------------------------------------------------- -// -TInt CWait::GetRequestType() -{ - return iRequestType; -} - -// -// class CWaitAbsorbingControl -// -CWaitAbsorbingControl::CWaitAbsorbingControl() - { - } - -CWaitAbsorbingControl::~CWaitAbsorbingControl() - { - if (iCoeEnv && iAppUi) - iAppUi->RemoveFromStack(this); - } - -CWaitAbsorbingControl* CWaitAbsorbingControl::NewLC() - { - CWaitAbsorbingControl* self= new(ELeave) CWaitAbsorbingControl(); - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } - -void CWaitAbsorbingControl::ConstructL() - { - CreateWindowL(); - SetExtent(TPoint(0,0), TSize(0,0)); - ActivateL(); - SetPointerCapture(ETrue); - ClaimPointerGrab(ETrue); - iAppUi=iEikonEnv->EikAppUi(); - iAppUi->AddToStackL(this, ECoeStackPriorityEnvironmentFilter); - } - -TKeyResponse CWaitAbsorbingControl::OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/) - { - return EKeyWasConsumed; - } - -// End of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/src/lockapp.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/src/lockapp.hrh Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2007 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: General application spesific enumeration values + * +*/ + + +#ifndef __LOCKAPP_HRH__ +#define __LOCKAPP_HRH__ + +/** + * LockApp panic codes + * + * @lib lockapp + * @since 5.0 + * @author Joona Petrell + * @author Tamas Koteles + */ +enum TLockAppPanic + { + ELockPanicGeneral, + ELockPanicIllegalMessage, + ELockUnknownValue, + ELockIllegalState, + ELockPanicOutOfRange, + ELockPanicObserverAlreadyExists, + ELockPanicObserverNotFound, + }; + +/** + * Three possible states of LockApp: unlocked, keyguard active, devicelock active + * + * @lib lockapp + * @since 5.0 + * @author Joona Petrell + * @author Tamas Koteles + */ +enum TLockStatus + { + ELockNotActive = 0, + EKeyguardActive, + EDevicelockActive + }; + +/** + * Three possible reason for devicelock: manual, remote, timer + * + * @lib lockapp + * @since 5.0 + * @author Joona Petrell + * @author Tamas Koteles + */ +enum TDevicelockReason + { + EDevicelockManual = 1, + EDevicelockRemote, + EDevicelockTimer + }; + +/** + * Bit-field representing screen saver status + */ +const TUint KLockAppEnvScreenSaverOn = 1; + +/** + * Bit-field representing phonecall status + */ +const TUint KLockAppEnvPhonecallOngoing = 2; + +/** + * Bit-field representing idle status + */ +const TUint KLockAppEnvIdleOnForeground = 4; + +/** + * Bit-field representing grip status + */ +const TUint KLockAppEnvGrip = 8; + +/** + * Bit-field representing FPS status + */ +const TUint KLockAppEnvFPS = 0x10; + +#endif // __LOCKAPP_HRH__ diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Autolock/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/src/main.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, version 2.1 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program. If not, +* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +* +* Description: +* +*/ + +// #include "xqservicelog.h" +#include + +#include +#include "Autolock.h" +#include "../PubSub/securityuisprivatepskeys.h" + +#include +#include + +int main(int argc, char **argv) +{ + // qInstallMsgHandler(XQSERVICEMESSAGEHANDLER); + // XQSERVICE_DEBUG_PRINT(" ================== xxxx Autolock::main"); + qDebug() << "================== xxxx QApplication Autolock::main"; + + + // Need to check whether process is already running. This happens if it's started from Stater, and + // before fully initialized, it's started by API through QtHighway + TSecurityPolicy readPolicy(ECapabilityReadDeviceData); + TSecurityPolicy writePolicy(ECapabilityWriteDeviceData); + int ret = RProperty::Define(KPSUidSecurityUIs, + KSecurityUIsLockInitiatorUID, RProperty::EInt, TSecurityPolicy(TSecurityPolicy::EAlwaysPass), + writePolicy); + qDebug() << "KSecurityUIsLockInitiatorUID ret=" << ret; + int myInitiatorUID = 0; + int err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsLockInitiatorUID, myInitiatorUID); + qDebug() << "KSecurityUIsLockInitiatorUID err=" << err; + qDebug() << "KSecurityUIsLockInitiatorUID myInitiatorUID=" << myInitiatorUID; + err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsLockInitiatorUID, 0); + + // it takes about 3 seconds to start it, on device + QApplication a( argc, argv ); + Autolock *cl = new Autolock(); + // qDebug() << " Autolock::main cl->show"; + // cl->show(); + // qDebug() << " Autolock::main cl->hide"; + cl->hide(); + // qDebug() << " Autolock::main cl->lower"; + cl->lower(); + qDebug() << " Autolock::main cl->lower"; + err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsLockInitiatorUID, 1); + int rv = a.exec(); + qDebug() << " Autolock::main cl->exec"; + delete cl; + qDebug() << " Autolock::main cl->delete"; + return rv; +} + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/BWinsCw/SECUI_EKA2U.def --- a/securitydialogs/SecUi/BWinsCw/SECUI_EKA2U.def Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/SecUi/BWinsCw/SECUI_EKA2U.def Tue Aug 31 16:04:40 2010 +0300 @@ -46,4 +46,27 @@ ?UnblockPinL@CManualSecuritySettings@@QAEHW4TPin@1@ABVTDesC16@@11@Z @ 45 NONAME ; int CManualSecuritySettings::UnblockPinL(enum CManualSecuritySettings::TPin, class TDesC16 const &, class TDesC16 const &, class TDesC16 const &) ?UnlockSimL@CManualSecuritySettings@@QAEHABVTDesC16@@0@Z @ 46 NONAME ; int CManualSecuritySettings::UnlockSimL(class TDesC16 const &, class TDesC16 const &) ?HandleEventL@CSecurityHandler@@QAEXW4TMobilePhoneSecurityEvent@RMobilePhone@@HAAH@Z @ 47 NONAME ; void CSecurityHandler::HandleEventL(enum RMobilePhone::TMobilePhoneSecurityEvent, int, int &) + ?DisplayPermanentNoteL@CSecQueryUi@@QAEXABVTDesC16@@@Z @ 48 NONAME ; void CSecQueryUi::DisplayPermanentNoteL(class TDesC16 const &) + ?DisplayErrorNoteL@CSecQueryUi@@QAEXABVTDesC16@@@Z @ 49 NONAME ; void CSecQueryUi::DisplayErrorNoteL(class TDesC16 const &) + ?NewLC@CSecQueryUi@@SAPAV1@XZ @ 50 NONAME ; class CSecQueryUi * CSecQueryUi::NewLC(void) + ?LaunchHelpL@CSecQueryUi@@QAEXABVTDesC16@@@Z @ 51 NONAME ; void CSecQueryUi::LaunchHelpL(class TDesC16 const &) + ?ChangePin2ParamsL@CSecuritySettings@@QAEHV?$TBuf@$09@@0HAAVTDes16@@H@Z @ 52 NONAME ; int CSecuritySettings::ChangePin2ParamsL(class TBuf<10>, class TBuf<10>, int, class TDes16 &, int) + ?InstallConfirmationQueryL@CSecQueryUi@@QAEHHAAV?$TBuf@$09@@@Z @ 53 NONAME ; int CSecQueryUi::InstallConfirmationQueryL(int, class TBuf<10> &) + ?ChangePinParamsL@CSecuritySettings@@QAEHV?$TBuf@$09@@0HAAVTDes16@@H@Z @ 54 NONAME ; int CSecuritySettings::ChangePinParamsL(class TBuf<10>, class TBuf<10>, int, class TDes16 &, int) + ?DisplayWarningNoteL@CSecQueryUi@@QAEXABVTDesC16@@@Z @ 55 NONAME ; void CSecQueryUi::DisplayWarningNoteL(class TDesC16 const &) + ?DisplayInformationNoteL@CSecQueryUi@@QAEXABVTDesC16@@@Z @ 56 NONAME ; void CSecQueryUi::DisplayInformationNoteL(class TDesC16 const &) + ?NewL@CSecQueryUi@@SAPAV1@XZ @ 57 NONAME ; class CSecQueryUi * CSecQueryUi::NewL(void) + ?SecQueryDialog@CSecQueryUi@@QAEHABVTDesC16@@AAVTDes16@@HHH@Z @ 58 NONAME ; int CSecQueryUi::SecQueryDialog(class TDesC16 const &, class TDes16 &, int, int, int) + ?ChangeUPinParamsL@CSecuritySettings@@QAEHV?$TBuf@$09@@0HAAVTDes16@@H@Z @ 59 NONAME ; int CSecuritySettings::ChangeUPinParamsL(class TBuf<10>, class TBuf<10>, int, class TDes16 &, int) + ?CloseWaitNote@CSecQueryUi@@QAEXXZ @ 60 NONAME ; void CSecQueryUi::CloseWaitNote(void) + ?UpdateProgressNoteValueL@CSecQueryUi@@QAEXH@Z @ 61 NONAME ; void CSecQueryUi::UpdateProgressNoteValueL(int) + ?DisplayProgressNoteL@CSecQueryUi@@QAEXABVTDesC16@@H@Z @ 62 NONAME ; void CSecQueryUi::DisplayProgressNoteL(class TDesC16 const &, int) + ?DisplayWaitNoteL@CSecQueryUi@@QAEXABVTDesC16@@AAVTRequestStatus@@@Z @ 63 NONAME ; void CSecQueryUi::DisplayWaitNoteL(class TDesC16 const &, class TRequestStatus &) + ?ChangePinRequestParamsL@CSecuritySettings@@QAEHHV?$TBuf@$09@@HAAVTDes16@@H@Z @ 64 NONAME ; int CSecuritySettings::ChangePinRequestParamsL(int, class TBuf<10>, int, class TDes16 &, int) + ?ChangeSecCodeParamsL@CSecuritySettings@@QAEHV?$TBuf@$09@@0HAAVTDes16@@H@Z @ 65 NONAME ; int CSecuritySettings::ChangeSecCodeParamsL(class TBuf<10>, class TBuf<10>, int, class TDes16 &, int) + ?CloseProgressNoteL@CSecQueryUi@@QAEXXZ @ 66 NONAME ; void CSecQueryUi::CloseProgressNoteL(void) + ?ClosePermanentNote@CSecQueryUi@@QAEXXZ @ 67 NONAME ; void CSecQueryUi::ClosePermanentNote(void) + ?ChangeAutoLockPeriodParamsL@CSecuritySettings@@QAEHHV?$TBuf@$09@@HAAVTDes16@@H@Z @ 68 NONAME ; int CSecuritySettings::ChangeAutoLockPeriodParamsL(int, class TBuf<10>, int, class TDes16 &, int) + ?LaunchHelpL@CSecQueryUi@@QAEXABVTDesC16@@ABVTUid@@@Z @ 69 NONAME ; void CSecQueryUi::LaunchHelpL(class TDesC16 const &, class TUid const &) + ?AskSecCodeParamsL@CSecuritySettings@@QAEHAAV?$TBuf@$09@@HAAVTDes16@@H@Z @ 70 NONAME ; int CSecuritySettings::AskSecCodeParamsL(class TBuf<10> &, int, class TDes16 &, int) diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/EABI/Secuiu.def --- a/securitydialogs/SecUi/EABI/Secuiu.def Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/SecUi/EABI/Secuiu.def Tue Aug 31 16:04:40 2010 +0300 @@ -75,4 +75,29 @@ _ZTV23CManualSecuritySettings @ 74 NONAME ; ## _ZTV5CWait @ 75 NONAME ; ## _ZN16CSecurityHandler12HandleEventLEN12RMobilePhone25TMobilePhoneSecurityEventEiRi @ 76 NONAME + _ZN11CSecQueryUi11LaunchHelpLERK7TDesC16 @ 77 NONAME + _ZN11CSecQueryUi11LaunchHelpLERK7TDesC16RK4TUid @ 78 NONAME + _ZN11CSecQueryUi13CloseWaitNoteEv @ 79 NONAME + _ZN11CSecQueryUi14SecQueryDialogERK7TDesC16R6TDes16iii @ 80 NONAME + _ZN11CSecQueryUi16DisplayWaitNoteLERK7TDesC16R14TRequestStatus @ 81 NONAME + _ZN11CSecQueryUi17DisplayErrorNoteLERK7TDesC16 @ 82 NONAME + _ZN11CSecQueryUi18ClosePermanentNoteEv @ 83 NONAME + _ZN11CSecQueryUi18CloseProgressNoteLEv @ 84 NONAME + _ZN11CSecQueryUi19DisplayWarningNoteLERK7TDesC16 @ 85 NONAME + _ZN11CSecQueryUi20DisplayProgressNoteLERK7TDesC16i @ 86 NONAME + _ZN11CSecQueryUi21DisplayPermanentNoteLERK7TDesC16 @ 87 NONAME + _ZN11CSecQueryUi23DisplayInformationNoteLERK7TDesC16 @ 88 NONAME + _ZN11CSecQueryUi24UpdateProgressNoteValueLEi @ 89 NONAME + _ZN11CSecQueryUi25InstallConfirmationQueryLEiR4TBufILi10EE @ 90 NONAME + _ZN11CSecQueryUi4NewLEv @ 91 NONAME + _ZN11CSecQueryUi5NewLCEv @ 92 NONAME + _ZN17CSecuritySettings16ChangePinParamsLE4TBufILi10EES1_iR6TDes16i @ 93 NONAME + _ZN17CSecuritySettings17ChangePin2ParamsLE4TBufILi10EES1_iR6TDes16i @ 94 NONAME + _ZN17CSecuritySettings17ChangeUPinParamsLE4TBufILi10EES1_iR6TDes16i @ 95 NONAME + _ZN17CSecuritySettings20ChangeSecCodeParamsLE4TBufILi10EES1_iR6TDes16i @ 96 NONAME + _ZN17CSecuritySettings23ChangePinRequestParamsLEi4TBufILi10EEiR6TDes16i @ 97 NONAME + _ZN17CSecuritySettings27ChangeAutoLockPeriodParamsLEi4TBufILi10EEiR6TDes16i @ 98 NONAME + _ZTI11CSecQueryUi @ 99 NONAME + _ZTV11CSecQueryUi @ 100 NONAME + _ZN17CSecuritySettings17AskSecCodeParamsLER4TBufILi10EEiR6TDes16i @ 101 NONAME diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/GSSimSecPlugin/Data/10207438.rss --- a/securitydialogs/SecUi/GSSimSecPlugin/Data/10207438.rss Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2005 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: ECOM plugin resource file for Device & SIM Security plugin. -* -*/ - -// INCLUDES -#include - - -RESOURCE REGISTRY_INFO theInfo - { - dll_uid = 0x10207438; - interfaces = - { - INTERFACE_INFO - { - interface_uid = 0x10207236; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = 0x10207439; - version_no = 1; - display_name = "Device & SIM Security Plugin"; - default_data = "0x1020743A"; - opaque_data = "0";//Order number - } - }; - } - }; - } - -// End of File - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/GSSimSecPlugin/Data/GSSimSecPluginRsc.rss --- a/securitydialogs/SecUi/GSSimSecPlugin/Data/GSSimSecPluginRsc.rss Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,609 +0,0 @@ -/* -* Copyright (c) 2005 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: Resource file for General Settings -* -*/ - - - -// RESOURCE IDENTIFIER -NAME SIMS // 4 letter ID - -// INCLUDES -#include -#include "GSSimSecPlugin.hrh" -#include "GSSimSecPlugin.rh" - -#include // Avkon localized strings -#include -#include -#include -#include -#include -#include - -// CONSTANTS - -// RESOURCE DEFINITIONS - -RESOURCE RSS_SIGNATURE - { - } - - - -//---------------------------------------------------- -// r_gs_sim_security_view_caption -// -// Security view caption for plugin -//---------------------------------------------------- -// -RESOURCE TBUF r_gs_sim_security_view_caption - { - buf = qtn_set_dev_sim_security; - } - - -//---------------------------------------------------- -// -// r_gs_sim_security_view_title -// Security view title -// -//---------------------------------------------------- -// - -RESOURCE TITLE_PANE r_gs_sim_security_view_title - { - txt = qtn_set_title_security_phone_and_sim; - } - -//---------------------------------------------------- -// -// r_gs_sim_security_softkeys_options_back__change -// SIM security view's CBA resource -// -//---------------------------------------------------- -// -RESOURCE CBA r_gs_sim_security_softkeys_options_back__change - { - buttons = - { - CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;}, - CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back; }, - CBA_BUTTON {id=EAknSoftkeyChange; txt= qtn_msk_change; } - }; - } - -//---------------------------------------------------- -// -// r_gs_sim_security_view -// SIM security view's menu -// -//---------------------------------------------------- -// -RESOURCE AVKON_VIEW r_gs_sim_security_view - { - menubar = r_gs_sim_sec_menubar_change_exit; - cba = r_gs_sim_security_softkeys_options_back__change; - } - -// ----------------------------------------------------------------------------- -// -// r_gs_menubar_change_exit -// GS menu with 'change' and 'exit' items. -// -// ----------------------------------------------------------------------------- -// -RESOURCE MENU_BAR r_gs_sim_sec_menubar_change_exit - { - titles = - { - MENU_TITLE - { - menu_pane = r_gs_sim_sec_menu_item_exit; - }, - MENU_TITLE - { - menu_pane = r_gs_sim_sec_menu_item_help; - }, - MENU_TITLE - { - menu_pane = r_gs_sim_sec_menu_item_change; - } - }; - } - -// ----------------------------------------------------------------------------- -// -// r_gs_menu_item_exit -// -// ----------------------------------------------------------------------------- -// -RESOURCE MENU_PANE r_gs_sim_sec_menu_item_exit - { - items = - { - MENU_ITEM - { - command = EAknCmdExit; - txt = qtn_options_exit; - } - }; - } - - -// ----------------------------------------------------------------------------- -// -// r_gs_menu_item_change -// Change item. -// -// ----------------------------------------------------------------------------- -// -RESOURCE MENU_PANE r_gs_sim_sec_menu_item_change - { - items = - { - MENU_ITEM - { - flags = EEikMenuItemAction; - command = EGSCmdAppChange; - txt = qtn_options_change; - } - }; - } - -// ----------------------------------------------------------------------------- -// -// r_gs_menu_item_help -// Change item. -// -// ----------------------------------------------------------------------------- -// -RESOURCE MENU_PANE r_gs_sim_sec_menu_item_help - { - items = - { - MENU_ITEM - { - command = EAknCmdHelp; - txt = qtn_options_help; - } - }; - } - -//---------------------------------------------------- -// -// r_sim_security_lbx -// SIM security view's list box items -// -//---------------------------------------------------- -// -RESOURCE SIM_SEC_FEATURE_ARRAY r_sim_security_lbx - { - items = - { - SIM_SEC_FEATURE - { - txt = " \t"qtn_set_code_in_use"\t\t"; - item = EGSSettIdCodeInUse; - type = EGSListBoxItemTypeIsDynamic; - }, - SIM_SEC_FEATURE - { - txt = " \t"qtn_set_upin_code_req"\t\t"; - item = EGSSettIdUpinRequest; - type = EGSListBoxItemTypeIsDynamic; - }, - SIM_SEC_FEATURE - { - txt = " \t"text_pin_code_cntrl"\t\t"; - item = EGSSettIdPinRequest; - type = EGSListBoxItemTypeIsDynamic; - }, - SIM_SEC_FEATURE - { - txt = " \t"text_pin_change"\t\t"; - item = EGSSettIdPinCode; - type = EGSListBoxItemTypeIsDynamic; - }, - SIM_SEC_FEATURE - { - txt = " \t"qtn_set_upin_code"\t\t"; - item = EGSSettIdUpinCode; - type = EGSListBoxItemTypeIsDynamic; - }, - SIM_SEC_FEATURE - { - txt = " \t"text_pin2_change"\t\t"; - item = EGSSettIdPin2Code; - }, - SIM_SEC_FEATURE - { - txt = " \t"qtn_set_autolock"\t\t"; - item = EGSSettIdAutolock; - }, - SIM_SEC_FEATURE - { - txt = " \t"qtn_set_sec_code"\t\t"; - item = EGSSettIdSecurityCode; - }, - SIM_SEC_FEATURE - { - txt = " \t"qtn_set_sim_change_sec"\t\t"; - item = EGSSettIdSimChange; - }, - -#ifdef RD_REMOTELOCK - SIM_SEC_FEATURE - { - txt = " \t"qtn_set_remotelock_status"\t\t"; - item = EGSSettIdRemoteLock; - }, -#endif //RD_REMOTELOCK - - SIM_SEC_FEATURE - { - txt = " \t"text_closed_user_groups"\t\t"; - item = EGSSettIdClosedUserGroup; - type = EGSListBoxItemTypeIsDynamic; - }, - SIM_SEC_FEATURE - { - txt = " \t"text_simatk_setting"\t\t"; - item = EGSSettIdSatOperations; - type = EGSListBoxItemTypeIsDynamic; - }, - SIM_SEC_FEATURE - { - txt = " \t"qtn_op_set_trusted_prov_server"\t\t "; - item = EGSSettIdTPServer; - type = EGSListBoxItemTypeIsDynamic; - } - }; -} - -//---------------------------------------------------- -// -// r_autolock_array -// Autolock array items -// -//---------------------------------------------------- -// -RESOURCE ARRAY r_autolock_array - { - items = - { - LBUF - { - txt = qtn_set_autolock_off; - }, - LBUF - { - txt = qtn_set_autolock_min_one; - }, - LBUF - { - txt = qtn_set_autolock_value_min; - } - }; - } - -#ifdef RD_REMOTELOCK -//---------------------------------------------------- -// -// r_remotelock_array -// Remote Lock status (on/off) array items -// -//---------------------------------------------------- -// -RESOURCE ARRAY r_remotelock_array - { - items = - { - LBUF - { - txt = qtn_set_remotelock_on; - }, - LBUF - { - txt = qtn_set_remotelock_off; - } - }; - } -#endif // RD_REMOTELOCK - -//---------------------------------------------------- -// -// r_pin_array -// PIN array items -// -//---------------------------------------------------- -// -RESOURCE ARRAY r_pin_array - { - items = - { - LBUF - { - txt = text_pin_code_on; - }, - LBUF - { - txt = text_pin_code_off; - } - }; - } - -//---------------------------------------------------- -// -// r_upin_array -// UPIN array items -// -//---------------------------------------------------- -// -RESOURCE ARRAY r_upin_array - { - items = - { - LBUF - { - txt = text_pin_code_on; - }, - LBUF - { - txt = text_pin_code_off; - } - }; - } - -//---------------------------------------------------- -// -// r_code_array -// Code in use array items -// -//---------------------------------------------------- -// -RESOURCE ARRAY r_code_array - { - items = - { - LBUF - { - txt = qtn_set_pin; - }, - LBUF - { - txt = qtn_set_upin; - } - }; - } - - -//---------------------------------------------------- -// -// r_security_array -// Security array items -// -//---------------------------------------------------- -// -RESOURCE ARRAY r_security_array - { - items = - { - LBUF - { - txt = qtn_set_sim_change_sec_on; - }, - LBUF - { - txt = qtn_set_sim_change_sec_off; - } - }; - } - - -//---------------------------------------------------- -// -// r_sat_array -// SAT array items -// -//---------------------------------------------------- -// -RESOURCE ARRAY r_sat_array - { - items = - { - LBUF - { - txt = text_simatk_notes_off; - }, - LBUF - { - txt = text_simatk_notes_on; - } - }; - } - -//---------------------------------------------------- -// -// r_cug_network_default -// -//---------------------------------------------------- -// -RESOURCE TBUF r_cug_network_default { buf = text_cug_default; } - -//---------------------------------------------------- -// -// r_cug_on -// -//---------------------------------------------------- -// -RESOURCE TBUF r_cug_on { buf = text_cug_group; } - -//---------------------------------------------------- -// -// r_cug_off -// -//---------------------------------------------------- -// -RESOURCE TBUF r_cug_off { buf = text_cug_suppress; } - -//---------------------------------------------------- -// -// r_cug_index -// CUG Index dialog resource -// -//---------------------------------------------------- -// -RESOURCE DIALOG r_cug_index - { - flags=EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK; - items = - { - DLG_LINE - { - type=EAknCtQuery; - id=EGeneralQuery; - control= AVKON_DATA_QUERY - { - layout = ENumberLayout; - label = text_give_group_number; - control = AVKON_INTEGER_EDWIN - { - maxlength = 5; - min=0; - max=99999; - }; - - }; - } - }; - } - -//---------------------------------------------------- -// -// r_cug_index_error_note -// CUG Index error note dialog resource -// -//---------------------------------------------------- -// -RESOURCE DIALOG r_cug_index_error_note - { - flags = EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | - EEikDialogFlagCbaButtons | EEikDialogFlagWait; - buttons = R_AVKON_SOFTKEYS_EMPTY; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = ECugIndexErrorNote; - control = AVKON_NOTE - { - layout = EGeneralLayout; - singular_label = text_cug_error; - animation = R_QGN_NOTE_ERROR_ANIM; - }; - } - }; - } - - -//---------------------------------------------------- -// -// r_cug_setting_page -// CUG setting page dialog resource -// -//---------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_cug_setting_page - { - label= text_closed_user_groups; - softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK; - type = EAknSetListBox; - editor_resource_id= r_cug_listbox; - } - -//---------------------------------------------------- -// -// r_cug_listbox -// CUG list box resource -// -//---------------------------------------------------- -// -RESOURCE LISTBOX r_cug_listbox - { - array_id = r_cug_lbx; - flags = EEikListBoxMultipleSelection; - } - - -//---------------------------------------------------- -// -// r_cug_lbx -// CUG list box items -// -//---------------------------------------------------- -// -RESOURCE ARRAY r_cug_lbx - { - items = - { - LBUF - { - txt = text_cug_default; - }, - LBUF - { - txt = text_cug_group; - }, - LBUF - { - txt = text_cug_suppress; - } - - }; - } - - -//---------------------------------------------------- -// -// r_sat_setting_page -// SAT setting page resource -// -//---------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_sat_setting_page - { - label= text_simatk_setting; - softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK; - type = EAknSetListBox; - editor_resource_id= r_sat_listbox; - } - -//---------------------------------------------------- -// -// r_sat_listbox -// SAT list box resource -// -//---------------------------------------------------- -// -RESOURCE LISTBOX r_sat_listbox - { - array_id = r_sat_array; - flags = EEikListBoxMultipleSelection; - } - -//End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/GSSimSecPlugin/GSSimSecPlugin.mmp --- a/securitydialogs/SecUi/GSSimSecPlugin/GSSimSecPlugin.mmp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* -* Copyright (c) 2005 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: Project specification file. -* -*/ - -#include - -#include // For RESOURCE_FILES_DIR - -CAPABILITY CAP_ECOM_PLUGIN -TARGET gssimsecplugin.dll -TARGETTYPE PLUGIN -UID 0x10009D8D 0x10207438 -VENDORID VID_DEFAULT - - -SOURCEPATH Src -SOURCE GSSimSecPluginImplementationTable.cpp -SOURCE GSSimSecPlugin.cpp -SOURCE GSSimSecPluginContainer.cpp -SOURCE GSSimSecPluginModel.cpp -SOURCE GSPubSubsListener.cpp - - -//User include paths -USERINCLUDE Inc -USERINCLUDE Data // For *.rh - -//System include paths -APP_LAYER_SYSTEMINCLUDE - - -SOURCEPATH Data - -START RESOURCE 10207438.rss -TARGET gssimsecplugin.rsc -END - -START RESOURCE GSSimSecPluginRsc.rss -HEADER -TARGETPATH RESOURCE_FILES_DIR -LANGUAGE_IDS -END - - - -LIBRARY euser.lib -LIBRARY ecom.lib -LIBRARY efsrv.lib -LIBRARY avkon.lib -LIBRARY bafl.lib -LIBRARY cone.lib -LIBRARY eikcoctl.lib -LIBRARY eikcore.lib -LIBRARY egul.lib -LIBRARY eikdlg.lib // eikon dialogs -LIBRARY flogger.lib // File logging -LIBRARY commonengine.lib // For RConeResourceLoader -LIBRARY featmgr.lib // Feature manager -LIBRARY centralrepository.lib -LIBRARY aknskinsrv.lib // for enhanced skinning -LIBRARY aknskins.lib // for enhanced skinning -LIBRARY secui.lib // security -LIBRARY etelmm.lib // security -LIBRARY sssettings.lib // ss settings -LIBRARY hlplch.lib // for "Help" options menu -LIBRARY gsecomplugin.lib -LIBRARY gsframework.lib // For base classes -LIBRARY gslistbox.lib // For CGSListBoxItemTextArray - -LIBRARY scpclient.lib - -#ifdef RD_REMOTELOCK -LIBRARY rlocksettings.lib -#endif - -SMPSAFE - -// End of File \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/GSSimSecPlugin/Inc/GSPubSubsListener.h --- a/securitydialogs/SecUi/GSSimSecPlugin/Inc/GSPubSubsListener.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -/* -* Copyright (c) 2005 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: Listener for Publish and subscribe data. -* -*/ - - -#ifndef GSPUBSUBSLISTENER_H -#define GSPUBSUBSLISTENER_H - -// INCLUDES -#include -#include -#include - -// FORWARD DECLARATIONS -class MGSSettingPSObserver; - -// CLASS DECLARATION - -/** -* RProperty poller. -* -* @lib gs.lib -* @since Series 60 3.0 -*/ -NONSHARABLE_CLASS( CGSPubSubsListener ) : public CActive - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @param aUid the Uid to use - * @param aKey item's key - * @param aObserver callback interface for notification - * @return instance of CGSPubSubsListener - */ - static CGSPubSubsListener* NewL( const TUid aUid, const TInt aKey, - MGSSettingPSObserver* aObserver ); - - /** - * Destructor. - */ - virtual ~CGSPubSubsListener(); - - public: // New functions. - - /** - * Gets integer value from P & S. - * @param aVal a value in return - * @return error code - */ - TInt Get( TInt& aVal ); - - /** - * Gets 8 bit string value from P&S. - * @param aVal a value in return - * @return error code - */ - TInt Get( TDes8& aVal ); - - /** - * Gets 16 bit descriptor value from P&S. - * @param aVal a value in return - * @return error code - */ - TInt Get( TDes16& aVal ); - - private: // From CActive. - - /** @see CActive::RunL */ - virtual void RunL(); - - /** @see CActive::Cancel */ - virtual void DoCancel(); - - /** @see CActive::RunError */ - virtual TInt RunError( TInt aError ); - - /** - * Starts the listening (RunL). - */ - void StartListening(); - - private: - - /** - * C++ default constructor. - * @param aUid the Uid to use - * @param aKey item's key - * @param aObserver callback interface for notification - */ - CGSPubSubsListener( const TUid aUid, TInt aKey, - MGSSettingPSObserver* aObserver ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: // Data - - // UID of the monitored item. - TUid iUid; - - // ID of the monitored item. - TInt iId; - - // Property to subscribe to. - RProperty iProperty; - - // The notification interface. - MGSSettingPSObserver* iCallback; - }; - -#endif // GSPUBSUBSLISTENER_H - -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/GSSimSecPlugin/Inc/GSSimSecPlugin.h --- a/securitydialogs/SecUi/GSSimSecPlugin/Inc/GSSimSecPlugin.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,219 +0,0 @@ -/* -* Copyright (c) 2005 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: View for Device & SIM security plug-in. -* -*/ - - -#ifndef GSSIMSECPLUGIN_H -#define GSSIMSECPLUGIN_H - -// INCLUDES -#include "GSSimSecPluginContainer.h" -#include "GSSimSecPluginModel.h" -#include "MGSSettingPSObserver.h" -#include "GSPubSubsListener.h" - -#include -#include -#include -#include -#include -#include -#include - -// CONSTANTS -const TInt KMaxStringLength = 80; -const TUid KGSSimSecPluginUid = { 0x10207438 }; - -// MACROS - -// DATA TYPES - -// FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS -class CAknViewAppUi; -class CGSSimSecPluginContainer; - - -// CLASS DECLARATION - -/** -* CGSSimSecPlugin view class -* -* View class for Sim Security sub-folder -*/ -class CGSSimSecPlugin : public CGSBaseView, - private MGSSettingPSObserver - { - public: // Constructors and destructor - - /** - * Symbian OS two-phased constructor - * @return GS sim & device security view. - */ - static CGSSimSecPlugin* NewL( TAny* aInitParams ); - - /** - * C++ default constructor. - */ - CGSSimSecPlugin(); - - /** - * Symbian OS default constructor. - */ - void ConstructL(); - - /** - * Destructor. - */ - ~CGSSimSecPlugin(); - - public: // Functions from base classes - - /** - * Returns view id. - * @return TUid. - */ - TUid Id() const; - - /** - * Handles commands. - * @param aCommand Command to be handled. - * - */ - void HandleCommandL( TInt aCommand ); - - public: //new - - /** - * Updates listbox's item's value. - * @param aItemId An item which is updated. - * - */ - void UpdateListBoxL( TInt aItemId ); - - //From CGSBaseView - void HandleResourceChangeL( TInt aType ); - - public: // From CGSPluginInterface - - /** - * @see CGSPluginInterface header file. - */ - void GetCaptionL( TDes& aCaption ) const; - - /** - * @see CGSPluginInterface header file. - */ - TInt PluginProviderCategory() const; - - /** - * @see CGSPluginInterface header file. - */ - TBool Visible() const; - - protected: // From MEikMenuObserver - - void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); - - private: // from CAknView - /** - * Activates the view. - * @param aPrevViewId ID of previous view - * @param aCustomMessageId customized message ID - * @param aCustomMessage sutomized message payload - */ - void DoActivateL( const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ); - - private: // from CGSBaseView - - void NewContainerL(); - - /** - * From CGSBaseView, handles list box selections. - * - */ - void HandleListBoxSelectionL(); - - private: - /** - * Callback from MGSSettingPSObserver - */ - void HandleNotifyPSL( const TUid aUid, const TInt& aKey, - const TRequestStatus& aStatus ); - - private: //new - - /** - * Sets Autolock period - * - */ - void SetAutolockTimeL( TInt aPeriod ); - - /** - * Set sat operations value (on/off). - * - */ - - void SetSatOperationsL(); - - /** - * Set sat operations value with setting page(on/off). - * - */ - void SetSatWithSettingPageL(); - - /** - * Shows closed user group index query - * @param aCugIndex Current Cug index - * @param aCugDefault Default CUG index - * @return TInt (query result) - */ - TInt CugIndexQueryL( TInt& aCugIndex, TInt& aCugDefault ); - - /** - * Set closed user group setting - * - */ - void CugModeL(); - - /** - * Get CGSSimSecPlugin's ccontainer. - */ - CGSSimSecPluginContainer* Container(); - - - TInt SetRemoteLockStatusL( TInt aAutoLockPeriod ); - - private: // Data - //for CUG settings - RSSSettings iCugSettings; - //to launch SecUI - CSecuritySettings* iSecurity; - //plugin model. - CGSSimSecPluginModel* iModel; - //resource loader - RConeResourceLoader iResourceLoader; - //PubSub object for BT SAP state - CGSPubSubsListener* iBtSapListener; - - }; - -#endif //GSSIMSECPLUGIN_H - -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/GSSimSecPlugin/Inc/GSSimSecPlugin.hrh --- a/securitydialogs/SecUi/GSSimSecPlugin/Inc/GSSimSecPlugin.hrh Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* -* Copyright (c) 2002 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: contains common definitions for menu id:s -* -*/ - - -#ifndef GSSIMSECPLUGIN_HRH -#define GSSIMSECPLUGIN_HRH - -// Data query max length -#define KGSMaxDataLength 21 - -enum TSimSecMenuCommands - { - EGSCmdAppOpen = 1, - EGSCmdAppHelp, - EGSCmdAppChange, - EAppCmdChange - }; - -enum TCugPopupIndex - { - EGSCugNetworkDefault = 0, - EGSCugOn = 1, - EGSCugOff = 2 - }; - -enum TGSNotes - { - EPasswordErrorNote, - EPasswordChangedNote, - ECugIndexErrorNote - }; - - -// Device & SIM security -enum { - EGSSettIdPinRequest, - EGSSettIdPinCode, - EGSSettIdPin2Code, - EGSSettIdAutolock, - EGSSettIdSecurityCode, - EGSSettIdSimChange, - EGSSettIdClosedUserGroup, - EGSSettIdSatOperations, - EGSSettIdTPServer, - EGSSettIdUpinRequest, - EGSSettIdCodeInUse, - EGSSettIdUpinCode, - EGSSettIdDevAndSim, - EGSSettIdCertManUi, - EGSSettIdWlanEapPlugins, - EGSSettIdWimSecurity, - EGSSettIdTransTracking, - EGSSettIdAutoKeyguard, - EGSSettIdRemoteLock - }; - -enum TGSListBoxItemVisibility - { - EGSListBoxItemTypeIsAlwaysVisible = 0, - EGSListBoxItemTypeIsDynamic - }; -#endif //GSSIMSECPLUGIN_HRH - -//End of File - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/GSSimSecPlugin/Inc/GSSimSecPlugin.rh --- a/securitydialogs/SecUi/GSSimSecPlugin/Inc/GSSimSecPlugin.rh Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* -* Copyright (c) 2003-2005 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: Contains common declarations for resources of GS. -* The file can be included only in resource file. -* -*/ - -#ifndef GSSIMSEC_RH -#define GSSIMSEC_RH - - -// Global definitions - - -// --------------------------------------------------------- -// sim_sec_feature_array -// Defines a structure to contain information about items -// to be able to included in the listbox. -// --------------------------------------------------------- -// -STRUCT SIM_SEC_FEATURE_ARRAY - { - STRUCT items[]; - } - -// --------------------------------------------------------- -// sim_sec_feature -// Defines a structure that contains information about -// a single listbox item. -// --------------------------------------------------------- -// -STRUCT SIM_SEC_FEATURE - { - LTEXT txt = ""; - WORD item = -1; - BYTE type = EGSListBoxItemTypeIsAlwaysVisible; - } - -#endif // GSSIMSEC_RH -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/GSSimSecPlugin/Inc/GSSimSecPluginContainer.h --- a/securitydialogs/SecUi/GSSimSecPlugin/Inc/GSSimSecPluginContainer.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,180 +0,0 @@ -/* -* Copyright (c) 2005 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: Container for the Display sub-folder -* -*/ - - - -#ifndef GSSIMSECCONTAINER_H -#define GSSIMSECCONTAINER_H - -// INCLUDES -#include -#include - -#include - - -// FORWARD DECLARATION -class CGSListBoxItemTextArray; -class CGSSimSecPluginModel; - -// CLASS DECLARATION - -/** -* CGSSimSecPluginContainer container class -* -* Container class for SIM security view -* @lib GSSimSecPlugin.lib -* @since Series 60_3.1 -*/ -class CGSSimSecPluginContainer : public CGSBaseContainer - { - public: // Constructors and destructor - - /** - * Symbian OS constructor. - * @param aRect Listbox's rect. - * - */ - void ConstructL( const TRect& aRect ); - - /** - * Destructor. - */ - ~CGSSimSecPluginContainer(); - - /** - * Constructor - */ - CGSSimSecPluginContainer( CGSSimSecPluginModel* aModel ); - - public: // new - /** - * Updates the listbox items - * @param aFeatureId: selected listbox item ID - */ - void UpdateListBoxL( TInt aFeatureId ); - - /** - * Retrieves the feature id for the selected item in the listbox - * @return listbox item array's current feature. - */ - TInt CurrentFeatureId() const; - - void HandleResourceChangeL( TInt aType ); - - protected: // from CGSBaseContainer - /** - * Constructs listbox. - * @param aResLbxId Resource id for listbox. - * - */ - void ConstructListBoxL( TInt aResLbxId ); - - private: //new - /** - * Creates list box items - */ - void CreateListBoxItemsL(); - /** - * Creates Code in use item - */ - void MakeCodeInUseItemL(); - /** - * Creates upin code request list box item - */ - void MakeUpinRequestItemL(); - /** - * Creates pin code request list box item - */ - void MakePinRequestItemL(); - /** - * Creates code list box item - * - * @ param aItemType TInt (code type pin/pin2/security) - */ - void MakeCodeItemL( const TInt aItemType ); - /** - * Creates autolock list box item - */ - void MakeAutolockItemL(); - /** - * Creates sim change security list box item - */ - void MakeSimChangeItemL(); - /** - * Creates closed user group list box item - */ - void MakeClosedUserGroupItemL(); - - /** - * Creates sat operations list box item - */ - void MakeSatOperationsItemL(); - - /** - * Creates Trusted provisioning server list box item - */ - void MakeTPServerItemL(); - /** - * Recreates different pin code related list box items as needed - * after switching PIN codes from PIN to UPIN or vice versa. - */ - void RecreatePinItemsL(); - - void MakeRemoteLockItemL(); - private: - /** - * Required for help. - * - */ - void GetHelpContext( TCoeHelpContext& aContext ) const; - - private: //data - //Code in use item's text - CDesCArrayFlat* iCodeItems; - //UPIN item's text - CDesCArrayFlat* iUpinItems; - //autolock item's text - CDesCArrayFlat* iAutoLockItems; - // RemoteLock item's text - CDesCArrayFlat* iRemoteLockItems; - //PIN item's text - CDesCArrayFlat* iPinItems; - //security item's text - CDesCArrayFlat* iSecurityItems; - //SAT item's text - CDesCArrayFlat* iSatItems; - //items from resource - CDesCArray* iItemArray; - //for SecUI - CSecuritySettings* iSecurity; - //check if UPIN code is supported - TBool iUpinCodeSupported; - //check if UPIN code is active - TBool iUpinCodeActive; - //check if UPIN code is permanently rejected - TBool iUpinCodeRejected; - //GS listbox model - CGSListBoxItemTextArray* iListboxItemArray; - //Model pointer. Does not own it, so do not delete this pointer. - CGSSimSecPluginModel* iModel; - - }; - -#endif //GSSIMSECCONTAINER_H - -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/GSSimSecPlugin/Inc/GSSimSecPluginModel.h --- a/securitydialogs/SecUi/GSSimSecPlugin/Inc/GSSimSecPluginModel.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/* -* Copyright (c) 2005 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: Model for Device & SIM security plug-in. -* -*/ - - -#ifndef GSSIMSECPLUGINMODEL_H -#define GSSIMSECPLUGINMODEL_H - -// INCLUDES -#include -#include - -// CONSTANTS -const TInt KGSBufSize128 = 128; - -// MACROS - -// DATA TYPES - -// FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -// CLASS DEFINITION -/** -* CGSSimSecPluginModel is the model class of device & sim security plugin. -* It provides functions to get and set setting values. -* @lib GSSimSecPlugin.lib -* @since Series 60_3.1 - -*/ -class CGSSimSecPluginModel : public CBase - { - public: // Constructor and destructor - /** - * Two-phased constructor - */ - static CGSSimSecPluginModel* NewL(); - - /** - * Destructor - */ - ~CGSSimSecPluginModel(); - - public: - /** - * Returns the autolock period time (minutes). - * - * @return TInt: period - */ - TInt AutoLockPeriod(); - - /** - * Sets the autolock period. After this period device is locked. - * @param aLockTime TInt (minutes) - * - * @return ETrue: no errors - * EFalse: an error has occurred - */ - TBool SetAutoLockPeriod( const TInt aLockTime ); - - /** - * Returns SAT operations sate - * - * @return TInt 0: SAT operations off - * TInt 1: SAT operations on - */ - TInt SatOperations(); - - /** - * Sets SAT operations on/off - * @param aValue TInt (0 = off 1 =on) - * - * @return ETrue: no errors - * EFalse: an error has occurred - */ - TBool SetSatOperations( const TInt aValue ); - - /** - * Checking if SAT operations supported - * @return: - * 0: not supported - * 1: supported - */ - TInt ConfirmSatOperationsSupport(); - - private: // Private constructors - /** - * Default C++ contructor - */ - CGSSimSecPluginModel(); - - /** - * Symbian OS default constructor - * @return void - */ - void ConstructL(); - - private: // data - CRepository* iSecurityRepository; - CRepository* iPersonalizationRepository; - - }; - - -#endif //GSSIMSECPLUGINMODEL_H - -// End of File \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/GSSimSecPlugin/Inc/MGSSettingPSObserver.h --- a/securitydialogs/SecUi/GSSimSecPlugin/Inc/MGSSettingPSObserver.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* -* Copyright (c) 2005 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: Observer interface for indicating publish and subscribe -* setting changes -* -*/ - - - -#ifndef MGSSETTINGPSOBSERVER_H -#define MGSSETTINGPSOBSERVER_H - -// INCLUDES -#include - -// CLASS DECLARATION - -/** -* Observer interface for indicating setting changes -* -* @lib GSSimSecPlugin -* @since 3.1 -*/ -class MGSSettingPSObserver - { - public: // New functions - - /** - * Handler for setting changed event - * @param aUid uid of setting - * @param aId id of setting - * @param aStatus status of completed AO operation - */ - virtual void HandleNotifyPSL( const TUid aUid, const TInt& aKey, - const TRequestStatus& aStatus ) = 0; - }; - -#endif // MGSSETTINGPSOBSERVER_H - -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/GSSimSecPlugin/Src/GSPubSubsListener.cpp --- a/securitydialogs/SecUi/GSSimSecPlugin/Src/GSPubSubsListener.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,155 +0,0 @@ -/* -* Copyright (c) 2005 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: Publish and subscribe settings listener. -* -*/ - - -// INCLUDE FILES -#include "GSPubSubsListener.h" -#include "MGSSettingPSObserver.h" - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CGSPubSubsListener::CGSPubSubsListener -// C++ constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CGSPubSubsListener::CGSPubSubsListener( const TUid aUid, const TInt aKey, - MGSSettingPSObserver* aObserver ) - : CActive( CActive::EPriorityStandard ) - { - iUid = aUid; - iId = aKey; - iCallback = aObserver; - } - -// ----------------------------------------------------------------------------- -// CGSPubSubsListener::~CGSPubSubsListener -// Destructor. -// ----------------------------------------------------------------------------- -// -CGSPubSubsListener::~CGSPubSubsListener() - { - Cancel(); - iProperty.Close(); - } - -// ----------------------------------------------------------------------------- -// CGSPubSubsListener::RunL -// From CActive. -// ----------------------------------------------------------------------------- -// -void CGSPubSubsListener::RunL() - { - const TRequestStatus status( iStatus ); - StartListening(); - iCallback->HandleNotifyPSL( iUid, iId, status ); - } - -// ----------------------------------------------------------------------------- -// CGSPubSubsListener::DoCancel -// From CActive. -// ----------------------------------------------------------------------------- -// -void CGSPubSubsListener::DoCancel() - { - iProperty.Cancel(); - } - -// ----------------------------------------------------------------------------- -// CGSPubSubsListener::RunError -// From CActive. -// ----------------------------------------------------------------------------- -// -TInt CGSPubSubsListener::RunError( TInt /*aError*/ ) - { - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CGSPubSubsListener::NewL -// -// Symbian OS two phased constructor -// ----------------------------------------------------------------------------- -// -CGSPubSubsListener* CGSPubSubsListener::NewL( const TUid aUid, const TInt aKey, - MGSSettingPSObserver* aObserver ) - { - CGSPubSubsListener* self = new( ELeave ) - CGSPubSubsListener( aUid, aKey, aObserver ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); - return self; - } - -// ----------------------------------------------------------------------------- -// CGSPubSubsListener::StartListening -// ----------------------------------------------------------------------------- -// -void CGSPubSubsListener::StartListening() - { - iProperty.Subscribe( iStatus ); - SetActive(); - } - -// ----------------------------------------------------------------------------- -// CGSPubSubsListener::ConstructL -// -// Symbian OS default constructor -// ----------------------------------------------------------------------------- -// -void CGSPubSubsListener::ConstructL() - { - CActiveScheduler::Add( this ); - - User::LeaveIfError ( iProperty.Attach( iUid, iId, EOwnerThread ) ); - StartListening(); - } - -// ----------------------------------------------------------------------------- -// CGSPubSubsListener::Get -// Read integer value. -// ----------------------------------------------------------------------------- -// -TInt CGSPubSubsListener::Get( TInt& aVal ) - { - return iProperty.Get( iUid, iId, aVal ); - } - -// ----------------------------------------------------------------------------- -// CGSPubSubsListener::Get -// Read binary value. -// ----------------------------------------------------------------------------- -// -TInt CGSPubSubsListener::Get( TDes8& aVal ) - { - return iProperty.Get( iUid, iId, aVal ); - } - -// ----------------------------------------------------------------------------- -// CGSPubSubsListener::Get -// Read string value. -// ----------------------------------------------------------------------------- -// -TInt CGSPubSubsListener::Get( TDes16& aVal ) - { - return iProperty.Get( iUid, iId, aVal ); - } - -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/GSSimSecPlugin/Src/GSSimSecPlugin.cpp --- a/securitydialogs/SecUi/GSSimSecPlugin/Src/GSSimSecPlugin.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,830 +0,0 @@ -/* -* Copyright (c) 2005 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: View for Device & SIM Security sub-folder -* -*/ - - -// INCLUDE FILES -#include -#include // For HlpLauncher -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "GSSimSecPlugin.h" -#include "GSSimSecPluginContainer.h" -#include "GSSimSecPlugin.hrh" - - -#ifdef RD_REMOTELOCK -#include -#endif // RD_REMOTELOCK - - -// EXTERNAL DATA STRUCTURES - -// EXTERNAL FUNCTION PROTOTYPES - -// CONSTANTS - -// MACROS - -// LOCAL CONSTANTS AND MACROS -const TInt KEmptyCugIndex( -100000000 ); -_LIT( KGSSimSecPluginResourceFileName, "z:GSSimSecPluginRsc.rsc" ); - -// MODULE DATA STRUCTURES - -// LOCAL FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -/** -* CCugQuery -* It defines CCugQuery used in closed user group settings -*/ -class CCugQuery - : public CAknNumberQueryDialog - { - public: // Constructors and destructors - /** - * C++ constructor. - */ - CCugQuery( TInt& aNumber,const TTone aTone = ENoTone ); - /** - * Prepares the dialog, by constructing it from the specified resource. Overwrite the base class. - * @param aResourceId The resource ID of the dialog. - */ - void PrepareLC( TInt aResourceId ); - - protected: // From base classes - /** - * From CCAknNumberQueryDialog Left softkey is allways OK. - */ - void UpdateLeftSoftKeyL(); - }; - -// ============================= LOCAL FUNCTIONS ============================== - -// ========================= MEMBER FUNCTIONS ================================= - -// --------------------------------------------------------------------------- -// GSSimSecPlugin::NewL() -// -// --------------------------------------------------------------------------- -CGSSimSecPlugin* CGSSimSecPlugin::NewL( TAny* /*aInitParams*/ ) - { - CGSSimSecPlugin* self = new( ELeave ) CGSSimSecPlugin(); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - - -// --------------------------------------------------------------------------- -// GSSimSecPlugin::CGSSimSecPlugin() -// -// --------------------------------------------------------------------------- -CGSSimSecPlugin::CGSSimSecPlugin() - : iResourceLoader( *iCoeEnv ) - { - } - - -// --------------------------------------------------------------------------- -// CGSSimSecPlugin::ConstructL() -// -// Symbian OS two-phased constructor -// --------------------------------------------------------------------------- -void CGSSimSecPlugin::ConstructL() - { - FeatureManager::InitializeLibL(); - - iModel = CGSSimSecPluginModel::NewL(); - //PS listener initialization - iBtSapListener = CGSPubSubsListener::NewL( - KPSUidBluetoothSapConnectionState, - KBTSapConnectionState, this ); - - iSecurity= CSecuritySettings::NewL(); - if(!FeatureManager::FeatureSupported( KFeatureIdFfNoCugSupport )) - { - User::LeaveIfError( iCugSettings.Open() ); - } - // Find the resource file - TParse parse; - parse.Set( KGSSimSecPluginResourceFileName, - &KDC_RESOURCE_FILES_DIR, NULL ); - TFileName fileName( parse.FullName() ); - - // Get language of resource file - BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName ); - - // Open resource file - iResourceLoader.OpenL( fileName ); - - BaseConstructL( R_GS_SIM_SECURITY_VIEW ); - - // secui resource file - TSecUi::InitializeLibL(); - } - - -// --------------------------------------------------------------------------- -// CGSSimSecPlugin::~CGSSettListSecurityView() -// -// -// --------------------------------------------------------------------------- -CGSSimSecPlugin::~CGSSimSecPlugin() - { - FeatureManager::UnInitializeLib(); - // close resource loader - iResourceLoader.Close(); - if(!FeatureManager::FeatureSupported( KFeatureIdFfNoCugSupport )) - { - iCugSettings.Close(); - } - if ( iSecurity ) - { - delete iSecurity; - } - - if ( iModel ) - { - delete iModel; - } - delete iBtSapListener; - - TSecUi::UnInitializeLib(); - } - - -// --------------------------------------------------------------------------- -// TUid CGSSettSimListSecurityView::Id() -// -// -// --------------------------------------------------------------------------- -TUid CGSSimSecPlugin::Id() const - { - return KGSSimSecPluginUid; - } - - -// --------------------------------------------------------------------------- -// CGSSimSecPlugin::HandleCommandL() -// -// -// --------------------------------------------------------------------------- -void CGSSimSecPlugin::HandleCommandL( TInt aCommand ) - { - switch ( aCommand ) - { - case EGSCmdAppChange: - case EAknSoftkeyChange: - { - const TInt currentFeatureId = Container()->CurrentFeatureId(); - - if ( currentFeatureId != EGSSettIdSatOperations ) - { - HandleListBoxSelectionL(); - } - else - { - if(aCommand == EGSCmdAppChange) - SetSatWithSettingPageL(); - else //user pressed MSK, don't show setting page. - SetSatOperationsL(); - } - } - break; - case EAknSoftkeyBack: - iAppUi->ActivateLocalViewL( KGSSecurityPluginUid ); - break; - case EAknCmdHelp: - { - if( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) - { - HlpLauncher::LaunchHelpApplicationL( - iEikonEnv->WsSession(), iAppUi->AppHelpContextL() ); - } - } - break; - default: - iAppUi->HandleCommandL( aCommand ); - break; - } - } - - -// --------------------------------------------------------------------------- -// CGSSimSecPlugin::UpdateListBoxL -// -// Update the current item in the listbox. -// --------------------------------------------------------------------------- -void CGSSimSecPlugin::UpdateListBoxL( TInt aItemId ) - { - Container()->UpdateListBoxL( aItemId ); - } - - -// --------------------------------------------------------------------------- -// CGSSimSecPlugin::DoActivateL(...) -// -// -// --------------------------------------------------------------------------- -void CGSSimSecPlugin::DoActivateL( const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ) - { - CGSBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage ); - } - - -// ---------------------------------------------------------------------------- -// CGSSimSecPlugin::Container -// -// Return handle to container class. -// ---------------------------------------------------------------------------- -// -CGSSimSecPluginContainer* CGSSimSecPlugin::Container() - { - return static_cast( iContainer ); - } - - -// --------------------------------------------------------------------------- -// CGSSimSecPlugin::NewContainerL() -// -// Creates new iContainer. -// --------------------------------------------------------------------------- -// -void CGSSimSecPlugin::NewContainerL() - { - iContainer = new( ELeave ) CGSSimSecPluginContainer( iModel ); - } - - -// --------------------------------------------------------------------------- -// CGSSimSecPlugin::HandleListBoxSelectionL() -// -// -// --------------------------------------------------------------------------- -void CGSSimSecPlugin::HandleListBoxSelectionL() - { - const TInt currentFeatureId = Container()->CurrentFeatureId(); - TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); - switch ( currentFeatureId ) - { - case EGSSettIdCodeInUse: - if(wcdmaSupported || upinSupported) - { - if(iSecurity->SwitchPinCodesL()) - { - UpdateListBoxL( currentFeatureId ); - } - } - break; - case EGSSettIdUpinRequest: - if(wcdmaSupported || upinSupported) - { - if(iSecurity->ChangeUPinRequestL()) - { - UpdateListBoxL( currentFeatureId ); - } - } - break; - case EGSSettIdUpinCode: - if(wcdmaSupported || upinSupported) - { - iSecurity->ChangeUPinL(); - } - break; - case EGSSettIdPinRequest: - if(iSecurity->ChangePinRequestL()) - { - UpdateListBoxL( currentFeatureId ); - } - break; - case EGSSettIdPinCode: - iSecurity->ChangePinL(); - break; - case EGSSettIdPin2Code: - iSecurity->ChangePin2L(); - break; - case EGSSettIdAutolock: - SetAutolockTimeL( iSecurity->ChangeAutoLockPeriodL( - iModel->AutoLockPeriod() ) ); - break; - case EGSSettIdSecurityCode: - iSecurity->ChangeSecCodeL(); - break; - case EGSSettIdSimChange: - if(iSecurity->ChangeSimSecurityL()) - { - UpdateListBoxL( currentFeatureId ); - } - break; - -#ifdef RD_REMOTELOCK - case EGSSettIdRemoteLock: - SetRemoteLockStatusL( iModel->AutoLockPeriod() ); - break; - -#endif - case EGSSettIdClosedUserGroup: - if(!FeatureManager::FeatureSupported( KFeatureIdFfNoCugSupport )) - { - CugModeL(); - UpdateListBoxL( currentFeatureId ); - } - break; - case EGSSettIdSatOperations: - SetSatOperationsL(); - break; - default: - break; - } - - } - -// --------------------------------------------------------------------------- -// CGSSimSecPlugin::SetAutolockTimeL() -// -// -// --------------------------------------------------------------------------- -void CGSSimSecPlugin::SetAutolockTimeL( TInt aPeriod ) - { - iModel->SetAutoLockPeriod( aPeriod ); - UpdateListBoxL( EGSSettIdAutolock ); - } - -// --------------------------------------------------------------------------- -// CGSSimSecPlugin::SetSatOperationsL() -// -// -// --------------------------------------------------------------------------- -void CGSSimSecPlugin::SetSatOperationsL() - { - TInt i = iModel->SatOperations(); - - if ( i == 0 ) - { - iModel->SetSatOperations( 1 ); - } - else - { - iModel->SetSatOperations( 0 ); - } - UpdateListBoxL( EGSSettIdSatOperations ); - } - -// --------------------------------------------------------------------------- -// CGSSimSecPlugin::SetSatOperationsL() -// -// -// --------------------------------------------------------------------------- -void CGSSimSecPlugin::SetSatWithSettingPageL() - { - TInt currentItem = iModel->SatOperations(); - - CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL( R_SAT_ARRAY ); - CleanupStack::PushL( items ); - - CAknRadioButtonSettingPage* page = - new( ELeave ) CAknRadioButtonSettingPage( R_SAT_SETTING_PAGE, - currentItem, items ); - - if ( page->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) - { - iModel->SetSatOperations( currentItem ); - } - - CleanupStack::PopAndDestroy( items ); - - UpdateListBoxL( EGSSettIdSatOperations ); - } - - -// --------------------------------------------------------------------------- -// CGSSimSecPlugin::CugModeL() -// -// -// --------------------------------------------------------------------------- -void CGSSimSecPlugin::CugModeL() - { - TInt cugIndex = 0; - TInt currentItem = 0; - TInt cugMode = 0; - TInt cugDefault; - TInt err = KErrNone; - - err = iCugSettings.Get( ESSSettingsDefaultCug, cugDefault ); - User::LeaveIfError( err ); - - - if ( iCugSettings.Get( ESSSettingsCug, cugMode ) != KErrNone ) - {// getting mode was not succesful - cugMode = cugDefault; - } - - if ( cugMode == cugDefault ) - { - currentItem = EGSCugNetworkDefault; - if ( iCugSettings.PreviousCugValue( cugIndex ) != KErrNone ) - { - cugIndex = 0; - } - } - else - { - switch ( cugMode ) - { - case ESSSettingsCugSuppress: - currentItem = EGSCugOff; - if ( iCugSettings.PreviousCugValue( cugIndex ) != KErrNone ) - { - cugIndex = 0; - } - break; - default: - currentItem = EGSCugOn; - cugIndex = cugMode; - break; - } - } - - - CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL( R_CUG_LBX ); - CleanupStack::PushL( items ); - - CAknRadioButtonSettingPage* page = - new( ELeave ) CAknRadioButtonSettingPage( R_CUG_SETTING_PAGE, - currentItem, items ); - - // call the appropriate cug- methods here - if ( page->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) - { - - switch ( currentItem ) - { - case EGSCugNetworkDefault://cug mode set default, - User::LeaveIfError( iCugSettings.Set( ESSSettingsCug, - cugDefault ) ); - break; - case EGSCugOn: //1, index is queried, if query ok then - // set the index and mode - if ( CugIndexQueryL( cugIndex, cugDefault ) ) - { - if ( iCugSettings.IsValueValidCugIndex( cugIndex ) ) - { - User::LeaveIfError( iCugSettings.Set( ESSSettingsCug, - cugIndex ) ); - } - else - { - User::LeaveIfError( iCugSettings.Set( ESSSettingsCug, - cugDefault ) ); - User::LeaveIfError( iCugSettings.ResetPreviousCugValue() ); - } - } - break; - case EGSCugOff://2, sets cug mode "inactive" - User::LeaveIfError( iCugSettings.Set( ESSSettingsCug, - ESSSettingsCugSuppress ) ); - break; - default: - break; - } - } - CleanupStack::PopAndDestroy( items ); - return; - } - - -// --------------------------------------------------------------------------- -// CGSSimSecPlugin::CugIndexQueryL() -// -// -// --------------------------------------------------------------------------- -TInt CGSSimSecPlugin::CugIndexQueryL( TInt& aCugIndex, TInt& aCugDefault ) - { - while ( ETrue ) - { - CCugQuery* dlg = new( ELeave ) CCugQuery( aCugIndex, - CAknQueryDialog::ENoTone ); - dlg->PrepareLC( R_CUG_INDEX ); - if ( dlg->RunLD() ) - { - // check content validity (?-32767), - // ui spec concerned only values above limit - if( !iCugSettings.IsValueValidCugIndex( aCugIndex ) - && ( aCugIndex != KEmptyCugIndex ) - && ( aCugIndex != aCugDefault ) ) - { - CAknNoteDialog* dlg = new ( ELeave ) - CAknNoteDialog( CAknNoteDialog::EErrorTone, - CAknNoteDialog::ELongTimeout ); - dlg->ExecuteLD( R_CUG_INDEX_ERROR_NOTE ); - } - else //index ok, break - { - break; - } - } - else // query cancelled - { - return EFalse; - } - } - - return ETrue; - } - - -// --------------------------------------------------------------------------- -// CCugQuery::CCugQuery() -// -// --------------------------------------------------------------------------- -// -CCugQuery::CCugQuery( TInt& aNumber, const TTone aTone ) - : CAknNumberQueryDialog( aNumber, aTone ) - { - } - - -// --------------------------------------------------------------------------- -// CCugQuery::UpdateLeftSoftKeyL() -// Left softkey is allways visible -// --------------------------------------------------------------------------- -// -void CCugQuery::UpdateLeftSoftKeyL() - { - MakeLeftSoftkeyVisible( ETrue ); - } - -// --------------------------------------------------------------------------- -// CCugQuery::PrepareLC( TInt aResourceId ) -// -// --------------------------------------------------------------------------- -// -void CCugQuery::PrepareLC( TInt aResourceId ) - { - CAknNumberQueryDialog::PrepareLC( aResourceId ); - CAknQueryControl* queryControl = QueryControl(); - if( queryControl ) - { - CEikEdwin* edwin = static_cast< CEikEdwin* >( queryControl->ControlByLayoutOrNull( ENumberLayout ) ); - if( edwin ) - { - edwin->SetAknEditorNumericKeymap( EAknEditorPlainNumberModeKeymap ); - } - } - } - -// --------------------------------------------------------------------------- -// CGSSimSecPlugin::HandleResourceChangeL( TInt aType ) -// Updates view layout -// -// --------------------------------------------------------------------------- -// -void CGSSimSecPlugin::HandleResourceChangeL( TInt aType ) - { - if( aType == KAknsMessageSkinChange || - aType == KEikDynamicLayoutVariantSwitch ) - { - //iContainer->HandleResourceChangeL( aType ); - } - } - - -// --------------------------------------------------------------------------- -// CGSSimSecPlugin::HandleNotifyPSL -// -// Handling PS keys change -// --------------------------------------------------------------------------- -// -void CGSSimSecPlugin::HandleNotifyPSL( const TUid aUid, const TInt& aKey, - const TRequestStatus& /* aStatus */ ) - { - if ( aUid == KPSUidBluetoothSapConnectionState && - aKey == KBTSapConnectionState ) - { - Visible(); - } - } - - -// ========================= From CGSPluginInterface ================== - -// ---------------------------------------------------------------------------- -// CGSSimSecPlugin::GetCaption -// -// Return application/view caption. -// ---------------------------------------------------------------------------- -// -void CGSSimSecPlugin::GetCaptionL( TDes& aCaption ) const - { - // the resource file is already opened. - HBufC* result = StringLoader::LoadL( R_GS_SIM_SECURITY_VIEW_CAPTION ); - - aCaption.Copy( *result ); - delete result; - } - - -// ---------------------------------------------------------------------------- -// CGSSimSecPlugin::PluginProviderCategory -// -// A means to identify the location of this plug-in in the framework. -// ---------------------------------------------------------------------------- -// -TInt CGSSimSecPlugin::PluginProviderCategory() const - { - //To identify internal plug-ins. - return KGSPluginProviderInternal; - } - - -// ---------------------------------------------------------------------------- -// CGSSimSecPlugin::Visible -// -// Provides the visibility status of self to framework. -// ---------------------------------------------------------------------------- -// -TBool CGSSimSecPlugin::Visible() const - { - TInt btSapConnectionState; - TBool visible = ETrue; - - iBtSapListener->Get( btSapConnectionState ); - - if ( btSapConnectionState == EBTSapConnected ) - { - visible = EFalse; - } - - return visible; - } - - - -// --------------------------------------------------------------------------- -// CGSSimSecPlugin::SetRemoteLockStatusL() -// -// -// --------------------------------------------------------------------------- -TInt CGSSimSecPlugin::SetRemoteLockStatusL( TInt aAutoLockPeriod ) - { - #ifdef RD_REMOTELOCK - #ifdef _DEBUG - RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - Enter" ) ); - #endif // DEBUG - - TInt retValue( KErrNone ); - TBool remoteLockStatus( EFalse ); - TBuf remoteLockCode; - - CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewLC(); - - // Get the current remote lock status - if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) - { - // Show remote lock setting page - retValue = iSecurity->ChangeRemoteLockStatusL( remoteLockStatus, remoteLockCode, aAutoLockPeriod ); - - if ( retValue == KErrNone ) - { - if ( remoteLockStatus ) - { - // Set remote lock status - if ( remoteLockSettings->SetEnabledL( remoteLockCode ) ) - { - // Remote lock status was set successfully - #ifdef _DEBUG - RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - Remote lock enabled and code set" ) ); - #endif // DEBUG - } - else - { - // Failed to enabled remote lock - retValue = KErrGeneral; - - #ifdef _DEBUG - RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - remoteLockSettings->SetEnabledL failed" ) ); - #endif // DEBUG - } - } - else - { - // Disable remote lock - if ( remoteLockSettings->SetDisabled() ) - { - // Remote lock disabled - #ifdef _DEBUG - RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - Remote lock disabled" ) ); - #endif // DEBUG - } - else - { - // Failed to disable remote lock - retValue = KErrGeneral; - - #ifdef _DEBUG - RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - remoteLockSettings->SetDisabled failed" ) ); - #endif // DEBUG - } - } - } - else - { - // User interaction (setting page) failed for some reason - #ifdef _DEBUG - RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - iSecurity->ChangeRemoteLockStatusL failed" ) ); - #endif // DEBUG - } - } - else - { - // Failed to retreive the current remote lock status - retValue = KErrGeneral; - - #ifdef _DEBUG - RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - remoteLockSettings->GetEnabled failed" ) ); - #endif // DEBUG - } - - CleanupStack::PopAndDestroy( remoteLockSettings ); - remoteLockSettings = NULL; - - UpdateListBoxL( EGSSettIdRemoteLock ); - - #ifdef _DEBUG - RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - Exit" ) ); - #endif // DEBUG - return retValue; - #else //!RD_REMOTELOCK - return KErrNotSupported; - #endif // RD_REMOTELOCK - } - - -// ---------------------------------------------------------------------------- -// CGSSimSecPlugin::DynInitMenuPaneL() -// -// Display the dynamic menu -// ---------------------------------------------------------------------------- -void CGSSimSecPlugin::DynInitMenuPaneL( TInt aResourceId, - CEikMenuPane* aMenuPane ) - { - - // show or hide the 'help' menu item when supported - if( aResourceId == R_GS_SIM_SEC_MENU_ITEM_HELP ) - { - User::LeaveIfNull( aMenuPane ); - if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) - { - aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse ); - } - else - { - aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); - } - } - - } -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/GSSimSecPlugin/Src/GSSimSecPluginContainer.cpp --- a/securitydialogs/SecUi/GSSimSecPlugin/Src/GSSimSecPluginContainer.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,943 +0,0 @@ -/* -* Copyright (c) 2005 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: Container for the Device & SIM security sub-folder -* -*/ - - -#include "GSSimSecPluginContainer.h" -#include "GSSimSecPluginModel.h" -#include "GSSimSecPlugin.hrh" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#ifdef RD_REMOTELOCK -#include -_LIT( KRemoteLockEmptyItem, " " ); -#endif - -#include -// EXTERNAL DATA STRUCTURES - -// EXTERNAL FUNCTION PROTOTYPES - -// CONSTANTS - -// MACROS - -// LOCAL CONSTANTS AND MACROS -_LIT( CodeItem,"****" ); -_LIT( SecurityCodeItem, "*****" ); - -const TInt KMaxStringLength = 50; - -// MODULE DATA STRUCTURES - -// LOCAL FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -// ============================= LOCAL FUNCTIONS ============================== - - -// --------------------------------------------------------------------------- -// CGSSimSecPluginContainer::ConstructL() -// -// Symbian OS two phased constructor -// --------------------------------------------------------------------------- -// -void CGSSimSecPluginContainer::ConstructL( const TRect& aRect ) - { - iListBox = new( ELeave ) CAknSettingStyleListBox; - BaseConstructL( aRect, R_GS_SIM_SECURITY_VIEW_TITLE, R_SIM_SECURITY_LBX ); - FeatureManager::InitializeLibL(); - } - - -// --------------------------------------------------------------------------- -// CGSSimSecPluginContainer::~CGSSettListSecurityContainer() -// -// Destructor -// --------------------------------------------------------------------------- -// - -CGSSimSecPluginContainer::~CGSSimSecPluginContainer() - { - if(iCodeItems) - delete iCodeItems; - if(iUpinItems) - delete iUpinItems; - if(iAutoLockItems) - delete iAutoLockItems; - if(iPinItems) - delete iPinItems; - if(iSecurityItems) - delete iSecurityItems; - if(iSatItems) - delete iSatItems; - if(iSecurity) - delete iSecurity; - if(iListboxItemArray) - delete iListboxItemArray; -#ifdef RD_REMOTELOCK - if(iRemoteLockItems) - delete iRemoteLockItems; -#endif // RD_REMOTELOCK -FeatureManager::UnInitializeLib(); - } - - -// --------------------------------------------------------------------------- -// CGSSimSecPluginContainer::CGSSimSecPluginContainer() -// -// Constructor -// --------------------------------------------------------------------------- -// -CGSSimSecPluginContainer::CGSSimSecPluginContainer( - CGSSimSecPluginModel* aModel ) - : iModel ( aModel ) - { - } - - -// --------------------------------------------------------------------------- -// CGSSimSecPluginContainer::ConstructListBoxL() -// -// -// --------------------------------------------------------------------------- -// -void CGSSimSecPluginContainer::ConstructListBoxL( TInt aResLbxId ) - { - iSecurity= CSecuritySettings::NewL(); - TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); - if(wcdmaSupported || upinSupported) - { - //check if UPIN code is supported and not rejected - TBool resp = iSecurity->IsUpinSupportedL(); - if( resp ) - { - iUpinCodeSupported = ETrue; - - //check if UPIN code is active - if( iSecurity->IsUpinActive() ) - { - iUpinCodeActive = ETrue; - } - else - { - iUpinCodeActive = EFalse; - } - - //Check whether UPIN is blocked - resp = iSecurity->IsUpinBlocked(); - - if( !resp ) - { - iUpinCodeRejected = EFalse; - } - else - { - iUpinCodeRejected = ETrue; - } - } - else - { - iUpinCodeSupported = EFalse; - iUpinCodeActive = EFalse; - } - } - - - iListBox->ConstructL( this, EAknListBoxSelectionList ); - iListboxItemArray = CGSListBoxItemTextArray::NewL( aResLbxId, - *iListBox, *iCoeEnv ); - iListBox->Model()->SetItemTextArray( iListboxItemArray ); - iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - - iAutoLockItems = iCoeEnv->ReadDesC16ArrayResourceL( R_AUTOLOCK_ARRAY ); - -#ifdef RD_REMOTELOCK - #ifdef _DEBUG - RDebug::Print( _L( "(GS)CGSSettListSimSecurityContainer::ConstructListBoxL() - Reading R_REMOTELOCK_ARRAY resource" ) ); - #endif // DEBUG - - iRemoteLockItems = iCoeEnv->ReadDesC16ArrayResourceL( R_REMOTELOCK_ARRAY ); -#endif // RD_REMOTELOCK - - - if(wcdmaSupported || upinSupported) - { - iUpinItems = iCoeEnv->ReadDesC16ArrayResourceL( R_UPIN_ARRAY ); - iCodeItems = iCoeEnv->ReadDesC16ArrayResourceL( R_CODE_ARRAY ); - } - else - { - iUpinItems = NULL; - iCodeItems = NULL; - } - - iPinItems = iCoeEnv->ReadDesC16ArrayResourceL( R_PIN_ARRAY ); - iSecurityItems = iCoeEnv->ReadDesC16ArrayResourceL( R_SECURITY_ARRAY ); - iSatItems = iCoeEnv->ReadDesC16ArrayResourceL( R_SAT_ARRAY ); - - CreateListBoxItemsL(); - } - - -// --------------------------------------------------------------------------- -// CGSSettListIdleContainer::CreateListBoxItemsL() -// -// -// --------------------------------------------------------------------------- -// -void CGSSimSecPluginContainer::CreateListBoxItemsL() - { - TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); - - if(wcdmaSupported || upinSupported) - { - if( iUpinCodeSupported && !iUpinCodeRejected ) - { - MakeCodeInUseItemL(); - } - - if( iUpinCodeActive ) - { - MakeUpinRequestItemL(); - MakeCodeItemL( EGSSettIdUpinCode ); - } - else - { - MakePinRequestItemL(); - MakeCodeItemL( EGSSettIdPinCode ); - } - } - else //not wcdma or upin - { - MakePinRequestItemL(); - MakeCodeItemL( EGSSettIdPinCode ); - } - - MakeCodeItemL( EGSSettIdPin2Code ); - MakeAutolockItemL(); - -#ifdef RD_REMOTELOCK - MakeRemoteLockItemL(); -#endif // RD_REMOTELOCK - - MakeCodeItemL( EGSSettIdSecurityCode ); - MakeSimChangeItemL(); - if(!FeatureManager::FeatureSupported( KFeatureIdFfNoCugSupport )) - { - #ifdef _DEBUG - RDebug::Print( _L( "(GS)CGSSettListSimSecurityContainer::CreateListBoxItemsL() CUG supported!" ) ); - #endif // DEBUG - MakeClosedUserGroupItemL(); - } - else - { - #ifdef _DEBUG - RDebug::Print( _L( "(GS)CGSSettListSimSecurityContainer::CreateListBoxItemsL() CUG Not supported!" ) ); - #endif // DEBUG - } - - TInt support = iModel->ConfirmSatOperationsSupport(); - - if ( support == 1 ) // Confirmation allowed. - { - MakeSatOperationsItemL(); - } - } - -// --------------------------------------------------------------------------- -// CGSSettListIdleContainer::UpdateListBoxL( TInt aFeatureId ) -// -// -// --------------------------------------------------------------------------- -// -void CGSSimSecPluginContainer::UpdateListBoxL( TInt aFeatureId ) - { - TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); - switch( aFeatureId ) - { - case EGSSettIdCodeInUse: - if(wcdmaSupported || upinSupported) - { - RecreatePinItemsL(); - } - break; - case EGSSettIdUpinRequest: - if(wcdmaSupported || upinSupported) - { - MakeUpinRequestItemL(); - } - break; - case EGSSettIdUpinCode: - if(wcdmaSupported || upinSupported) - { - MakeCodeItemL( EGSSettIdUpinCode ); - } - break; - case EGSSettIdPinRequest: - MakePinRequestItemL(); - break; - case EGSSettIdPinCode: - MakeCodeItemL( EGSSettIdPinCode ); - break; - case EGSSettIdPin2Code: - MakeCodeItemL( EGSSettIdPin2Code ); - break; - case EGSSettIdAutolock: - MakeAutolockItemL(); - break; - case EGSSettIdSecurityCode: - MakeCodeItemL( EGSSettIdSecurityCode ); - break; - case EGSSettIdSimChange: - MakeSimChangeItemL(); - break; - - #ifdef RD_REMOTELOCK - case EGSSettIdRemoteLock: - MakeRemoteLockItemL(); - break; - #endif // RD_REMOTELOCK - case EGSSettIdClosedUserGroup: - if(!FeatureManager::FeatureSupported( KFeatureIdFfNoCugSupport )) - { - MakeClosedUserGroupItemL(); - } - break; - case EGSSettIdSatOperations: - MakeSatOperationsItemL(); - break; - default: - return; - } - - iListBox->HandleItemAdditionL(); - } - -// --------------------------------------------------------------------------- -// CGSSimSecPluginContainer::MakeCodeItemL() -// -// -// --------------------------------------------------------------------------- -// -void CGSSimSecPluginContainer::MakeCodeItemL( const TInt aItemType ) - { - HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 ); - TPtr ptrBuffer ( dynamicText->Des() ); - - TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); - - if(wcdmaSupported || upinSupported) - { - iUpinCodeSupported = iSecurity->IsUpinSupportedL(); - iUpinCodeActive = iSecurity->IsUpinActive(); - iUpinCodeRejected = iSecurity->IsUpinBlocked(); - } - else - { - iUpinCodeSupported = EFalse; - iUpinCodeActive = EFalse; - iUpinCodeRejected = EFalse; - } - - switch ( aItemType ) - { - case EGSSettIdUpinCode: - if( iUpinCodeSupported && !iUpinCodeRejected && iUpinCodeActive ) - { - ptrBuffer = CodeItem; - iListboxItemArray->SetDynamicTextL( EGSSettIdUpinCode, ptrBuffer ); - iListboxItemArray->SetItemVisibilityL( EGSSettIdUpinCode, - CGSListBoxItemTextArray::EVisible ); - } - else - { - iListboxItemArray->SetItemVisibilityL( EGSSettIdUpinCode, - CGSListBoxItemTextArray::EInvisible ); - } - break; - case EGSSettIdPin2Code: - ptrBuffer = CodeItem; - iListboxItemArray->SetDynamicTextL( EGSSettIdPin2Code, ptrBuffer ); - iListboxItemArray->SetItemVisibilityL( EGSSettIdPin2Code, - CGSListBoxItemTextArray::EVisible ); - break; - case EGSSettIdSecurityCode: - ptrBuffer = SecurityCodeItem; - iListboxItemArray->SetDynamicTextL( EGSSettIdSecurityCode, - ptrBuffer ); - if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) - { - - { - // Check the code change policy from the SCP server. - TInt allowChange = 1; - - RSCPClient scpClient; - TInt ret = scpClient.Connect(); - if ( ret == KErrNone ) - { - TBuf policyBuf; - policyBuf.Zero(); - if ( scpClient.GetParamValue( ESCPCodeChangePolicy, policyBuf ) == KErrNone ) - { - TLex lex( policyBuf ); - lex.Val( allowChange ); - #if defined(_DEBUG) - RDebug::Print(_L("(GS)CGSSettListSimSecurityContainer::\ - MakeCodeInUseItemL(): Policy retrieved: %d"), allowChange ); - #endif //DEBUG - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(GS)CGSSettListSimSecurityContainer::\ - MakeCodeInUseItemL(): ERROR: Failed to retrieve the policy value") ); - #endif //DEBUG - } - scpClient.Close(); - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(GS)CGSSettListSimSecurityContainer::MakeCodeInUseItemL(): \ - ERROR: Failed to connect to SCP") ); - #endif //DEBUG - } - - if ( allowChange == 1 ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(GS)CGSSettListSimSecurityContainer::MakeCodeInUseItemL(): \ - Code change allowed")); - #endif //DEBUG - - iListboxItemArray->SetItemVisibilityL( EGSSettIdSecurityCode, - CGSListBoxItemTextArray::EVisible ); - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(GS)CGSSettListSimSecurityContainer::MakeCodeInUseItemL():\ - Code change disallowed")); - #endif //DEBUG - - iListboxItemArray->SetItemVisibilityL( EGSSettIdSecurityCode, - CGSListBoxItemTextArray::EInvisible ); - } - } - - } - else - { - - iListboxItemArray->SetItemVisibilityL( EGSSettIdSecurityCode, - CGSListBoxItemTextArray::EVisible ); - - } - break; - case EGSSettIdPinCode: - default: - if( !iUpinCodeSupported || iUpinCodeRejected || !iUpinCodeActive ) - { - ptrBuffer = CodeItem; - iListboxItemArray->SetDynamicTextL( EGSSettIdPinCode, - ptrBuffer ); - iListboxItemArray->SetItemVisibilityL( EGSSettIdPinCode, - CGSListBoxItemTextArray::EVisible ); - } - else - { - iListboxItemArray->SetItemVisibilityL( EGSSettIdPinCode, - CGSListBoxItemTextArray::EInvisible ); - } - break; - } - CleanupStack::PopAndDestroy( dynamicText ); - - } - - -// --------------------------------------------------------------------------- -// CGSSimSecPluginContainer::MakeAutolockItemL() -// -// -// --------------------------------------------------------------------------- -// -void CGSSimSecPluginContainer::MakeAutolockItemL() - { - HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 ); - TPtr ptrBuffer ( dynamicText->Des() ); - - TInt period = iModel->AutoLockPeriod(); - - switch ( period ) - { - case 0: - ptrBuffer = ( *iAutoLockItems )[ 0 ]; - break; - case 1: - { - TBuf tempString; - StringLoader::Format( tempString, - ( ( *iAutoLockItems )[1] ), - -1, // no index in the key string - period ); - ptrBuffer = tempString; - } - break; - default: - { - TBuf tempString; - StringLoader::Format( tempString, - ( ( *iAutoLockItems )[2] ), - -1, // no index in the key string - period ); - ptrBuffer = tempString; - } - break; - } - iListboxItemArray->SetDynamicTextL( EGSSettIdAutolock, ptrBuffer ); - CleanupStack::PopAndDestroy( dynamicText ); - iListboxItemArray->SetItemVisibilityL( EGSSettIdAutolock, - CGSListBoxItemTextArray::EVisible ); - } - -// --------------------------------------------------------------------------- -// CGSSimSecPluginContainer::MakeSimChangeItemL() -// -// -// --------------------------------------------------------------------------- -// -void CGSSimSecPluginContainer::MakeSimChangeItemL() - { - HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 ); - TPtr ptrBuffer ( dynamicText->Des() ); - - if ( iSecurity->IsLockEnabledL( RMobilePhone::ELockPhoneToICC ) ) - { - ptrBuffer = ( *iSecurityItems )[0]; - } - else - { - ptrBuffer = ( *iSecurityItems )[1]; - } - - iListboxItemArray->SetDynamicTextL( EGSSettIdSimChange, ptrBuffer ); - CleanupStack::PopAndDestroy( dynamicText ); - iListboxItemArray->SetItemVisibilityL( EGSSettIdSimChange, - CGSListBoxItemTextArray::EVisible ); - } - - -// --------------------------------------------------------------------------- -// CGSSimSecPluginContainer:: MakePinRequestItemL() -// -// -// --------------------------------------------------------------------------- -// -void CGSSimSecPluginContainer:: MakePinRequestItemL() - { - HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 ); - TPtr ptrBuffer ( dynamicText->Des() ); - - TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); - if(wcdmaSupported || upinSupported) - { - iUpinCodeSupported = iSecurity->IsUpinSupportedL(); - iUpinCodeActive = iSecurity->IsUpinActive(); - iUpinCodeRejected = iSecurity->IsUpinBlocked(); - } - else - { - iUpinCodeSupported = EFalse; - iUpinCodeActive = EFalse; - iUpinCodeRejected = EFalse; - } - - if( !iUpinCodeSupported || !iUpinCodeActive || iUpinCodeRejected ) - { - if ( iSecurity->IsLockEnabledL( RMobilePhone::ELockICC ) ) - { - ptrBuffer = ( *iPinItems )[0]; - } - else - { - ptrBuffer = ( *iPinItems )[1]; - } - - iListboxItemArray->SetDynamicTextL( EGSSettIdPinRequest, ptrBuffer ); - iListboxItemArray->SetItemVisibilityL( EGSSettIdPinRequest, - CGSListBoxItemTextArray::EVisible ); - } - else - { - iListboxItemArray->SetItemVisibilityL( EGSSettIdPinRequest, - CGSListBoxItemTextArray::EInvisible ); - } - CleanupStack::PopAndDestroy( dynamicText ); - } - - -// --------------------------------------------------------------------------- -// CGSSimSecPluginContainer:: MakeUpinRequestItemL() -// -// -// --------------------------------------------------------------------------- -// -void CGSSimSecPluginContainer:: MakeUpinRequestItemL() - { - TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); - if(wcdmaSupported || upinSupported) - { - HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 ); - TPtr ptrBuffer ( dynamicText->Des() ); - - iUpinCodeSupported = iSecurity->IsUpinSupportedL(); - iUpinCodeActive = iSecurity->IsUpinActive(); - iUpinCodeRejected = iSecurity->IsUpinBlocked(); - - - if( iUpinCodeSupported && !iUpinCodeRejected && iUpinCodeActive ) - { - - if ( iSecurity->IsLockEnabledL( RMobilePhone::ELockUniversalPin ) ) - { - ptrBuffer = ( *iPinItems )[0]; - } - else - { - ptrBuffer = ( *iPinItems )[1]; - } - - iListboxItemArray->SetDynamicTextL( EGSSettIdUpinRequest, ptrBuffer ); - iListboxItemArray->SetItemVisibilityL( EGSSettIdUpinRequest, - CGSListBoxItemTextArray::EVisible ); - } - else - { - iListboxItemArray->SetItemVisibilityL( EGSSettIdUpinRequest, - CGSListBoxItemTextArray::EInvisible ); - } - - CleanupStack::PopAndDestroy( dynamicText ); - } - } - - -// --------------------------------------------------------------------------- -// CGSSimSecPluginContainer:: MakeCodeInUseItemL() -// -// -// --------------------------------------------------------------------------- -// -void CGSSimSecPluginContainer:: MakeCodeInUseItemL() - { - TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); - if(wcdmaSupported || upinSupported) - { - HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 ); - TPtr ptrBuffer ( dynamicText->Des() ); - iUpinCodeSupported = iSecurity->IsUpinSupportedL(); - iUpinCodeRejected = iSecurity->IsUpinBlocked(); - if( iUpinCodeSupported && !iUpinCodeRejected ) - { - if ( !iSecurity->IsUpinActive() ) - { - ptrBuffer = ( *iCodeItems )[0]; - } - else - { - ptrBuffer = ( *iCodeItems )[1]; - } - - iListboxItemArray->SetDynamicTextL( EGSSettIdCodeInUse, ptrBuffer ); - iListboxItemArray->SetItemVisibilityL( EGSSettIdCodeInUse, - CGSListBoxItemTextArray::EVisible ); - } - else - { - - iListboxItemArray->SetItemVisibilityL( EGSSettIdCodeInUse, - CGSListBoxItemTextArray::EInvisible ); - } - - CleanupStack::PopAndDestroy( dynamicText ); - } - } - - -// --------------------------------------------------------------------------- -// CGSSimSecPluginContainer:: MakeClosedUserGroupItemL() -// -// -// --------------------------------------------------------------------------- -// -void CGSSimSecPluginContainer::MakeClosedUserGroupItemL() - { - HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 ); - TPtr ptrBuffer ( dynamicText->Des() ); - - TInt cugMode = 0; - TInt cugDefault; - TInt err = KErrNone; - - RSSSettings cugSettings; - User::LeaveIfError( cugSettings.Open() ); - - err = cugSettings.Get( ESSSettingsDefaultCug, cugDefault ); - User::LeaveIfError( err ); - - if ( cugSettings.Get( ESSSettingsCug , cugMode ) != KErrNone ) - {// getting mode was not succesful - cugMode = cugDefault; - } - - TBuf string; - - if ( cugMode == cugDefault ) - { - StringLoader::Load( string, R_CUG_NETWORK_DEFAULT ); - ptrBuffer = string; - } - else - { - switch ( cugMode ) - { - case ESSSettingsCugSuppress: - StringLoader::Load( string, R_CUG_OFF ); - ptrBuffer = string; - break; - default: - StringLoader::Load( string, R_CUG_ON ); - ptrBuffer = string; - break; - } - } - - cugSettings.Close(); - - iListboxItemArray->SetDynamicTextL( EGSSettIdClosedUserGroup, ptrBuffer ); - iListboxItemArray->SetItemVisibilityL( EGSSettIdClosedUserGroup, - CGSListBoxItemTextArray::EVisible ); - CleanupStack::PopAndDestroy( dynamicText ); - - } - - -// --------------------------------------------------------------------------- -// CGSSimSecPluginContainer:: MakeSatOperationsItemL() -// -// -// --------------------------------------------------------------------------- -// -void CGSSimSecPluginContainer::MakeSatOperationsItemL() - { - HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 ); - TPtr ptrBuffer ( dynamicText->Des() ); - - TInt satOperation = iModel->SatOperations(); - - if ( satOperation == 1 ) - { - ptrBuffer = ( *iSatItems )[1]; - } - else - { - ptrBuffer = ( *iSatItems )[0]; - } - - iListboxItemArray->SetDynamicTextL( EGSSettIdSatOperations, ptrBuffer ); - iListboxItemArray->SetItemVisibilityL( EGSSettIdSatOperations, - CGSListBoxItemTextArray::EVisible ); - CleanupStack::PopAndDestroy( dynamicText ); - - } - - -// --------------------------------------------------------------------------- -// CGSSimSecPluginContainer::CurrentFeatureId() -// -// --------------------------------------------------------------------------- -// -TInt CGSSimSecPluginContainer::CurrentFeatureId() const - { - return iListboxItemArray->CurrentFeature( ); - } - - -// --------------------------------------------------------------------------- -// CGSSimSecPluginContainer::GetHelpContext() const -// Gets Help -// -// --------------------------------------------------------------------------- -// -void CGSSimSecPluginContainer::GetHelpContext( TCoeHelpContext& aContext ) const - { - aContext.iMajor = KUidGS; - aContext.iContext = KSET_HLP_SECURITY_DEVICE_SIM; - } - - -// --------------------------------------------------------------------------- -// CGSSettListIdleContainer::RecreatePinItemsL() -// -// -// --------------------------------------------------------------------------- -// -void CGSSimSecPluginContainer::RecreatePinItemsL() - { - TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); - if(wcdmaSupported || upinSupported) - { - //check if UPIN code is supported and not rejected - if( iSecurity->IsUpinSupportedL() ) - { - iUpinCodeSupported = ETrue; - - //check if UPIN code is active - if( iSecurity->IsUpinActive() ) - { - iUpinCodeActive = ETrue; - } - else - { - iUpinCodeActive = EFalse; - } - - //Check whether UPIN is blocked - - if( !iSecurity->IsUpinBlocked() ) - { - iUpinCodeRejected = EFalse; - } - else - { - iUpinCodeRejected = ETrue; - } - } - else - { - iUpinCodeSupported = EFalse; - iUpinCodeActive = EFalse; - } - - MakeCodeInUseItemL(); - MakeUpinRequestItemL(); - MakeCodeItemL( EGSSettIdUpinCode ); - MakePinRequestItemL(); - MakeCodeItemL( EGSSettIdPinCode ); - } - } - - -// --------------------------------------------------------------------------- -// CGSSimSecPluginContainer::HandleResourceChangeL() -// -// Updates view layout -// --------------------------------------------------------------------------- -// -void CGSSimSecPluginContainer::HandleResourceChangeL( TInt aType ) - { - if( aType == KAknsMessageSkinChange || - aType == KEikDynamicLayoutVariantSwitch ) - { - TRect mainPaneRect; - AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, - mainPaneRect ); - SetRect( mainPaneRect ); - DrawNow(); - } - } - - - -// --------------------------------------------------------------------------- -// CGSSimSecPluginContainer::MakeRemoteLockItemL() -// -// -// --------------------------------------------------------------------------- -// -void CGSSimSecPluginContainer::MakeRemoteLockItemL() - { - #ifdef RD_REMOTELOCK - #ifdef _DEBUG - RDebug::Print( _L( "(SECUI)CGSSimSecPluginContainer::MakeRemoteLockItemL() - Enter" ) ); - #endif // DEBUG - - HBufC* statusItemText = HBufC::NewLC( KGSBufSize128 ); - TPtr ptrRemoteLockStatus( statusItemText->Des() ); - TBool remoteLockStatus( EFalse ); - CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewLC(); - - if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) - { - if ( remoteLockStatus ) - { - // Remote lock enabled - ptrRemoteLockStatus = (*iRemoteLockItems)[0]; - } - else - { - // Remote lock disabled - ptrRemoteLockStatus = (*iRemoteLockItems)[1]; - } - } - else - { - // Failed to get remote lock status - // Undefined situation. Display empty item - ptrRemoteLockStatus = KRemoteLockEmptyItem; - } - - CleanupStack::PopAndDestroy( remoteLockSettings ); - remoteLockSettings = NULL; - - // Remote Lock item - iListboxItemArray->SetDynamicTextL( EGSSettIdRemoteLock, ptrRemoteLockStatus ); - CleanupStack::PopAndDestroy( statusItemText ); - iListboxItemArray->SetItemVisibilityL( EGSSettIdRemoteLock, CGSListBoxItemTextArray::EVisible ); - - #ifdef _DEBUG - RDebug::Print( _L( "(SECUI)CGSSimSecPluginContainer::MakeRemoteLockItemL() - Exit" ) ); - #endif // DEBUG - #endif // RD_REMOTELOCK - return; - } - - -//End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/GSSimSecPlugin/Src/GSSimSecPluginImplementationTable.cpp --- a/securitydialogs/SecUi/GSSimSecPlugin/Src/GSSimSecPluginImplementationTable.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* -* Copyright (c) 2005 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: ECOM proxy table for this plugin -* -*/ - - -// System includes -#include -#include - -// User includes -#include "GSSimSecPlugin.h" - -// Constants -const TImplementationProxy KGSSimSecPluginImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY( 0x10207439, CGSSimSecPlugin::NewL ) - }; - - -// --------------------------------------------------------------------------- -// ImplementationGroupProxy -// Gate/factory function -// -// --------------------------------------------------------------------------- -// -EXPORT_C const TImplementationProxy* ImplementationGroupProxy( - TInt& aTableCount ) - { - aTableCount = sizeof( KGSSimSecPluginImplementationTable ) - / sizeof( TImplementationProxy ); - return KGSSimSecPluginImplementationTable; - } - - -// --------------------------------------------------------------------------- -// E32Dll -// EKA1 entry point -// -// --------------------------------------------------------------------------- -// -#ifndef EKA2 -GLDEF_C TInt E32Dll( TDllReason /*aReason*/ ) - { - return( KErrNone ); - } -#endif // EKA2 - -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/GSSimSecPlugin/Src/GSSimSecPluginModel.cpp --- a/securitydialogs/SecUi/GSSimSecPlugin/Src/GSSimSecPluginModel.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +0,0 @@ -/* -* Copyright (c) 2005 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: Model for Device & SIM security plug-in. -* -*/ - - -// INCLUDES -#include "GSSimSecPluginModel.h" - -#include - -// EXTERNAL DATA STRUCTURES - -// EXTERNAL FUNCTION PROTOTYPES - -// CONSTANTS - -// MACROS - -// LOCAL CONSTANTS AND MACROS -const TInt KGSSettingOff = 0; -// default value for autolock period -const TInt KGSDefaultAutoLockTime = 0; - -// MODULE DATA STRUCTURES - -// LOCAL FUNCTION PROTOTYPES - -// ============================= LOCAL FUNCTIONS ============================== - -// ========================= MEMBER FUNCTIONS ================================= - -// ---------------------------------------------------------------------------- -// CGSSimSecPluginModel::NewL -// -// Symbian OS two-phased constructor -// ---------------------------------------------------------------------------- -// -CGSSimSecPluginModel* CGSSimSecPluginModel::NewL() - { - CGSSimSecPluginModel* self = new( ELeave ) CGSSimSecPluginModel; - CleanupStack::PushL( self ); - self->ConstructL(); - - CleanupStack::Pop( self ); - return self; - } - - -// ---------------------------------------------------------------------------- -// CGSSimSecPluginModel::CGSSimSecPluginModel -// -// -// C++ default constructor can NOT contain any code, that might leave. -// ---------------------------------------------------------------------------- -// -CGSSimSecPluginModel::CGSSimSecPluginModel() - { - - } - - -// ---------------------------------------------------------------------------- -// CGSSimSecPluginModel::ConstructL -// -// Symbian OS default constructor can leave. -// ---------------------------------------------------------------------------- -// -void CGSSimSecPluginModel::ConstructL() - { - iSecurityRepository = CRepository::NewL( KCRUidSecuritySettings ); - iPersonalizationRepository = - CRepository::NewL( KCRUidPersonalizationSettings ); - } - - -// ---------------------------------------------------------------------------- -// CGSSimSecPluginModel::~CGSSimSecPluginModel -// -// Destructor -// ---------------------------------------------------------------------------- -// -CGSSimSecPluginModel::~CGSSimSecPluginModel() - { - delete iSecurityRepository; - iSecurityRepository = NULL; - - delete iPersonalizationRepository; - iPersonalizationRepository = NULL; - } - - -// ---------------------------------------------------------------------------- -// CGSSimSecPluginModel::AutoLockPeriod() -// -// Reads Autolock period from .ini file and returns it -// ---------------------------------------------------------------------------- -// -TInt CGSSimSecPluginModel::AutoLockPeriod() - { - TInt period = KGSSettingOff; - - if ( iSecurityRepository-> - Get( KSettingsAutoLockTime, period ) != KErrNone ) - { - period = KGSDefaultAutoLockTime; - iSecurityRepository->Set( KSettingsAutoLockTime, period ); - } - - return period; - } - -// ---------------------------------------------------------------------------- -// CGSSimSecPluginModel::SetAutoLockPeriod -// -// Writes Autolock period time to Cenrep -// ---------------------------------------------------------------------------- -// -TBool CGSSimSecPluginModel::SetAutoLockPeriod( TInt aLockTime ) - { - TInt ret = iSecurityRepository->Set( KSettingsAutoLockTime, aLockTime ); - - return ret; - } - -// ---------------------------------------------------------------------------- -// CGSSimSecPluginModel::SatOperations() -// -// Reads SatOperations value from .ini file and returns it -// ---------------------------------------------------------------------------- -// -TInt CGSSimSecPluginModel::SatOperations() - { - TInt value = KGSSettingOff; - - iPersonalizationRepository->Get( KSettingsConfirmSatOperations, value ); - - return value; - } - - -// ---------------------------------------------------------------------------- -// CGSSimSecPluginModel::SetSatOperations -// -// Write user changes to the .ini file -// ---------------------------------------------------------------------------- -// -TBool CGSSimSecPluginModel::SetSatOperations( TInt aValue ) - { - TInt ret = iPersonalizationRepository-> - Set( KSettingsConfirmSatOperations, aValue ); - - return ret; - } - - -// ---------------------------------------------------------------------------- -// CGSSimSecPluginModel::ConfirmSatOperationsSupport -// -// Get Confirm Sat Operations supported value -// ---------------------------------------------------------------------------- -// -TInt CGSSimSecPluginModel::ConfirmSatOperationsSupport() - { - TInt ret = 0; - iPersonalizationRepository-> - Get( KSettingsConfirmSatOperationsSupported, ret ); - - return ret; - } - -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/GSSimSecPlugin/loc/gssecurity.loc --- a/securitydialogs/SecUi/GSSimSecPlugin/loc/gssecurity.loc Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,233 +0,0 @@ -/* -* Copyright (c) 2005 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: Localization strings for Device & SIM Security view -* -*/ - - -//------------------------------------------------------------- -// security view -//------------------------------------------------------------- - -//d: Command in general settings security folder, opens Device & Sim security view -//l: list_setting_pane_t1 -//w: -//r:3.0 -#define qtn_set_dev_sim_security "Device & Sim security" - -//d:Text in title pane -//d:Device and SIM Security view -//l:title_pane_t2/opt9 -//w: -//r: 3.1 -#define qtn_set_title_security_phone_and_sim "Phone and SIM" - -//------------------------------------------------------------- -// device & sim security view -//------------------------------------------------------------- -//d:Code in use setting item in device & sim security settings folder -//l: list_setting_pane_t1 -//w: -//r:3.0 -#define qtn_set_code_in_use "Code in use" - - -//d: pin code request setting item in device & sim security settings folder -//l: list_setting_pane_t1 -//w: -//r:3.0 -#define text_pin_code_cntrl "PIN code request" - -//d: Upin code request setting item in device & sim security settings folder -//l: list_setting_pane_t1 -//w: -//r:3.0 -#define qtn_set_upin_code_req "UPIN code request" - - -//d: sim change security setting item in device & sim security settings folder -//l: list_setting_pane_t1 -//w: -//r:3.0 -#define qtn_set_sim_change_sec "SIM change security" - -//d: atulock period setting item in device & sim security settings folder -//l: list_setting_pane_t1 -//w: -//r:3.0 -#define qtn_set_autolock "Autolock period" - -//d: security code setting item in device & sim security settings folder -//l: list_setting_pane_t1 -//w: -//r:3.0 -#define qtn_set_sec_code "Security code" - -//d:Number query: autolock period time in minutes. -//l:popup_query_data_window -//w: -//r:3.0 -#define qtn_set_autolock_define_time "Autolock period time (min)" - -//d: pin code setting item in device & sim security settings folder -//l: list_setting_pane_t1 -//w: -//r:3.0 -#define text_pin_change "PIN code" - -//d: upin code setting item in device & sim security settings folder -//l: list_setting_pane_t1 -//w: -//r:3.0 -#define qtn_set_upin_code "UPIN code" - -//d: pin2 code setting item in device & sim security settings folder -//l: list_setting_pane_t1 -//w: -//r:3.0 -#define text_pin2_change "PIN2 code" - -//d: closed user group setting item in device & sim security settings folder -//l: list_setting_pane_t1 -//w: -//r:3.0 -#define text_closed_user_groups "Closed user group" - -//d: item, network default, to closed user group popup list -//l: list_set_graphic_pane_t1 -//w: -//r:3.0 -#define text_cug_default "Network default" - -//d: item, on, to closed user group popup list -//l: list_set_graphic_pane_t1 -//w: -//r:3.0 -#define text_cug_group "On" - -//d: item, off, to closed user group popup list -//l: list_set_graphic_pane_t1 -//w: -//r:3.0 -#define text_cug_suppress "Off" - -//d: text to number query asking for cug index -//l: popup_query_data_window -//w: -//r:3.0 -#define text_give_group_number "Group number:" - -//d: text to cug error note when entered index is too large -//l: popup_note_window -//w: -//r:3.0 -#define text_cug_error "Value too large" - -//d:sat operations setting item in device & sim security settings folder -//l:list_setting_pane_t1 -//w: -//r:3.0 -#define text_simatk_setting "Confirm SAT operations" - -//d:list item in pin code request setting page -//l:list_set_graphic_pane_t1 -//w: -//r:3.0 -#define text_pin_code_off "Off" - -//d:list item in pin code request setting page -//l:list_set_graphic_pane_t1 -//w: -//r:3.0 -#define text_pin_code_on "On" - -//d:list item in code in use setting page -//l:list_set_graphic_pane_t1 -//w: -//r:3.0 -#define qtn_set_pin "PIN" - -//d:list item in code in use setting page -//l:list_set_graphic_pane_t1 -//w: -//r:3.0 -#define qtn_set_upin "UPIN" - -//d:list item in sim change security setting page -//l:list_set_graphic_pane_t1 -//w: -//r:3.0 -#define qtn_set_sim_change_sec_off "Off" - -//d:list item in sim change security setting page -//l:list_set_graphic_pane_t1 -//w: -//r:3.0 -#define qtn_set_sim_change_sec_on "On" - -//d:List item in autolock period setting page -//l:list_set_graphic_pane_t1 -//w: -//r:3.0 -#define qtn_set_autolock_off "Autolock off" - -//d:List item in autolock period setting page -//l:list_set_graphic_pane_t1 -//w: -//r:3.0 -#define qtn_set_autolock_defined "User defined" - -//d:Autolock period settings (plural) item edit - setting selection data, %N is number 2-999 -//l:list_set_graphic_pane_t1 -//w: -//r:3.0 -#define qtn_set_autolock_value_min "%N minutes" - -//d:Autolock period settings (singular) item edit - setting selection data, %N is number 1 -//l:list_set_graphic_pane_t1 -//w: -//r:3.0 -#define qtn_set_autolock_min_one "%N minute" - -//d:Confirm SAT operations value on -//l:list_set_graphic_pane_t1 -//w: -//r:3.0 -#define text_simatk_notes_on "Asked" - -//d:Confirm SAT operations value off -//l:list_set_graphic_pane_t1 -//w: -//r:3.0 -#define text_simatk_notes_off "Not asked" - -//d: Remote lock setting item in device & sim security settings folder -//l: list_setting_pane_t1 -//w: -//r:3.2 -#define qtn_set_remotelock_status "Allow remote lock" - -//d:Remote lock setting state in remote lock setting item in device & sim security settings folder -//l:list_set_graphic_pane_t1 -//w: -//r:3.2 -#define qtn_set_remotelock_off "No" - -//d:Remote lock setting state in remote lock setting item in device & sim security settings folder -//l:list_set_graphic_pane_t1 -//w: -//r:3.2 -#define qtn_set_remotelock_on "Yes" - -//End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/Inc/SecQueryUi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/Inc/SecQueryUi.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,249 @@ +/* +* Copyright (c) 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" +* 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: CSecQueryUi API can be used to implement UI dialogs for +* SecUi plugins. +*/ + + +#ifndef C_SECQUERYUI_H +#define C_SECQUERYUI_H + +#include // CActive +#include // MHbDeviceDialogObserver +#include +#include + +#define ESecUiTypeMask 0x0FFFFFF +#define ESecUiBasicTypeMask 0x00F0000 + +#define ESecUiCancelSupported 0x1000000 +#define ESecUiCancelNotSupported 0x0000000 + +#define ESecUiEmergencySupported 0x2000000 +#define ESecUiEmergencyNotSupported 0x0000000 + +#define ESecUiAlphaSupported 0x4000000 +#define ESecUiAlphaNotSupported 0x0000000 + +#define ESecUiSecretSupported 0x8000000 +#define ESecUiSecretNotSupported 0x0000000 + +#define ESecUiBasicTypeCheck 0x0010000 +#define ESecUiBasicTypeMultiCheck 0x0020000 + +class MSecQueryUiCertificateDetailsProvider; +class MSecQueryUiDrmDetailsProvider; +class CHbDeviceDialogSymbian; +class CHbSymbianVariantMap; +class CActiveSchedulerWait; +class CApaMaskedBitmap; + +typedef TBuf<80> TSecUiPassword; + +enum R_SECUI_ERROR_CODES + { + R_CODE_ERROR=0x58ED0100, + R_SEC_BLOCKED, + R_CONFIRMATION_NOTE, + R_PIN_CODE_CHANGED_NOTE, + R_PIN2_CODE_CHANGED_NOTE, + R_PIN2_REJECTED, + R_UPIN_CODE_CHANGED_NOTE, + R_SIM_NOT_ALLOWED, + R_SIM_ALLREADY_OFF, + R_SIM_OFF, + R_SIM_ALLREADY_ON, + R_OPERATION_NOT_ALLOWED, + R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE, + R_PIN_NOT_ALLOWED, + R_REMOTELOCK_INVALID_CODE, + R_SIM_ON, + R_INSERT_SIM, + R_CODES_DONT_MATCH, + R_PIN_BLOCKED_NOTE, + R_UPIN_NOT_ALLOWED, + R_SECURITY_CODE_CHANGED_NOTE, + R_SECUI_ERROR_CODE_LAST + }; + +/** + * CSecQueryUi provides UI dialogs for SW installation. UI dialogs are + * global and they can be used in a non-UI code (like in SIF plugins). + * SW install device dialog plugin implements the UI dialogs. + * + * @lib SecQueryUi.lib + * @since 10.1 + */ +typedef TBuf<80> TSecUiPassword; + +class CSecQueryUi : public CActive, public MHbDeviceDialogObserver + { + public: // constructor and destructor + /** + * Creates new CSecQueryUi object and pushes it into cleanup stack. + * @returns CSecQueryUi* -- new CSecQueryUi object + */ + IMPORT_C static CSecQueryUi* NewLC(); + + /** + * Creates new CSecQueryUi object. + * @returns CSecQueryUi* -- new CSecQueryUi object + */ + IMPORT_C static CSecQueryUi* NewL(); + + /** + * Destructor. + */ + CSecQueryUi::~CSecQueryUi(); + + public: // new functions + /** + * Displays install confirmation query synchronously. Synchronous function + * returns after the user has accepted or cancelled the query. + * @param aAppDetails - other application details (like supplier) + * @return TBool - ETrue if user accepted the query, EFalse otherwise + */ + IMPORT_C TBool InstallConfirmationQueryL( TInt aType, RMobilePhone::TMobilePassword& password ); + IMPORT_C TInt SecQueryDialog(const TDesC& aCaption, TDes& aDataText, TInt aMinLength,TInt aMaxLength,TInt aMode); + /* + IMPORT_C TBool InstallConfirmationQueryL( const TDesC& aAppName, + const TDesC& aIconFile, const TDesC& aAppVersion, TInt aAppSize, + const TDesC& aAppDetails ); + */ + + /** + * Displays information note. If the information note is already displayed, then + * only the dialog text is updated. Information note is closed automatically after + * pre-defined time (e.g. after 1.5 seconds). User can also press any key to close + * the note faster. + * @param aText - info text to be displayed + */ + IMPORT_C void DisplayInformationNoteL( const TDesC& aText ); + + /** + * Displays warning note. If the warning note is already displayed, then only the note + * text is updated. Warning note is closed automatically after pre-defined time (e.g. + * after three seconds). User can also press any key to close the note faster. + * @param aText - error text to be displayed + */ + IMPORT_C void DisplayWarningNoteL( const TDesC& aText ); + + /** + * Displays error note. If the error note is already displayed, then only the dialog + * text is updated. Error note is closed automatically after pre-defined time (e.g. + * after three seconds). User can also press any key to close the note faster. + * @param aText - error text to be displayed + */ + IMPORT_C void DisplayErrorNoteL( const TDesC& aText ); + + /** + * Displays permanent note. If the permanent note is already displayed, then only the + * dialog text is updated. User cannot cancel or close permanent notes. Permanent note + * is displayed until ClosePermanentNote() is called. Delayed notes are displayed after + * pre-defined delay time, and they may be closed before they appear on the screen. + * @param aText - text to be displayed + * @param aIsDelayed - ETrue if delayed dialog should be used + */ + IMPORT_C void DisplayPermanentNoteL( const TDesC& aText ); + + /** + * Closes the permanent note. + */ + IMPORT_C void ClosePermanentNote(); + + /** + * Displays progress note using aFinalValue. Use UpdateProgressNoteValueL() to + * update the progress bar. If the progress note is already active, then only + * the note text and final value are updated. + * @param aText - text displayed in progress note + * @param aFinalValue - final value of the progress bar + */ + IMPORT_C void DisplayProgressNoteL( const TDesC& aText, TInt aFinalValue ); + + /** + * Updates the progress bar in progress note. Progress bar shows 0% when + * aNewValue is zero (or less than zero), and full 100% when aNewValue is + * equal (or more than) the final value set with SetProgressNoteFinalValueL(). + * @param aNewValue - new value for the progress bar + */ + IMPORT_C void UpdateProgressNoteValueL( TInt aNewValue ); + + /** + * Closes the progress note. TRequestStatus set in DisplayProgressNoteL() is + * completed with KErrNone. Note that it is completed with KErrCancel if user + * cancels the note, or with error code if some error happens. + */ + IMPORT_C void CloseProgressNoteL(); + + /** + * Displays wait note. If the wait note is already displayed, then only the note + * text is updated. Wait note is like progress note, except that it is not known + * how long the operation takes. User can cancel the operation as in progress note. + * @param aText - text to be displayed + * @param aStatus - request status that indicates if user cancels the note + */ + IMPORT_C void DisplayWaitNoteL( const TDesC& aText, TRequestStatus& aStatus ); + + /** + * Closes the wait note. + */ + IMPORT_C void CloseWaitNote(); + + /** + * Launches help with the help context aContext for application aUid. + * @param aContext - help context to be displayed + * @param aUid - application which help needs to be launched + */ + IMPORT_C void LaunchHelpL( const TDesC& aContext, const TUid& aUid ); + + /** + * Launches SW Install application (UID 0x101F8512) help using the + * help context aContext. + * @param aContext - help context to be displayed + */ + IMPORT_C void LaunchHelpL( const TDesC& aContext ); + + protected: // from CActive + void DoCancel(); + void RunL(); + + private: // from MHbDeviceDialogObserver + void DataReceived( CHbSymbianVariantMap& aData ); + void DeviceDialogClosed( TInt aCompletionCode ); + + private: // new functions + CSecQueryUi(); + void ConstructL(); + void ClearParamsL(); + void ClearParamsAndSetNoteTypeL( TInt aType ); + void AddParamL( const TDesC& aKey, TInt aValue ); + void AddParamL( const TDesC& aKey, const TDesC& aValue ); + void DisplayDeviceDialogL(); + TInt WaitUntilDeviceDialogClosed(); + + private: // data + CHbDeviceDialogSymbian* iDeviceDialog; + CHbSymbianVariantMap* iVariantMap; + CActiveSchedulerWait* iWait; + TBool iIsDisplayingDialog; + TInt iCompletionCode; + TInt iReturnValue; +public: + // previoulsy it was RMobilePhone::TMobilePassword iPassword; but this was only 10 bytes + TSecUiPassword iPassword; + }; + + +#endif // C_SECQUERYUI_H + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/Inc/SecUiAutoLockSettingPage.h --- a/securitydialogs/SecUi/Inc/SecUiAutoLockSettingPage.h Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/SecUi/Inc/SecUiAutoLockSettingPage.h Tue Aug 31 16:04:40 2010 +0300 @@ -23,7 +23,7 @@ #include #include -class CAutoLockSettingPage : public CAknRadioButtonSettingPage +class CAutoLockSettingPage : public CBase { public: /** @@ -59,6 +59,7 @@ void HandlePointerEventL(const TPointerEvent& aPointerEvent); private: // data + // CEikButtonGroupContainer* iPopoutCba; TInt& iAutoLockValue; TInt iMaximum; TInt iOriginalIndex; diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/Inc/SecUiRemoteLockSettingPage.h --- a/securitydialogs/SecUi/Inc/SecUiRemoteLockSettingPage.h Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/SecUi/Inc/SecUiRemoteLockSettingPage.h Tue Aug 31 16:04:40 2010 +0300 @@ -71,6 +71,8 @@ private: // data + CEikButtonGroupContainer* iPopoutCba; + /** Remote lock status */ TInt& iRemoteLockStatus; TInt iPrevSelectionItem; diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/Inc/SecUiWait.h --- a/securitydialogs/SecUi/Inc/SecUiWait.h Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/SecUi/Inc/SecUiWait.h Tue Aug 31 16:04:40 2010 +0300 @@ -76,9 +76,24 @@ TInt iRequestType; }; +// CAutolockQuery, absorbs all the key presses. +class CAutolockQuery : public CBase + { + public: + static CAutolockQuery* NewLC(); + virtual ~CAutolockQuery(); + private: + virtual TKeyResponse OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/); + private: + CAutolockQuery(); + void ConstructL(); + private: // Data + CEikAppUi* iAppUi; + + }; // CWaitAbsorbingControl, absorbs all the key presses. -class CWaitAbsorbingControl : public CCoeControl +class CWaitAbsorbingControl : public CBase { public: static CWaitAbsorbingControl* NewLC(); diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/Src/SecQueryUi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/SecUi/Src/SecQueryUi.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,603 @@ +/* +* Copyright (c) 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" +* 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: Implementation of RSecQueryUiCli class. +* +*/ + +#include "SecQueryUi.h" // CSecQueryUi +// #include // SIF UI device dialog parameters +#include // CHbDeviceDialogSymbian +#include // CHbSymbianVariantMap +#include // CApaMaskedBitmap +#include + +#include +#include +#include "SecUi.h" + +const TUid KSWInstHelpUid = + { + 0x101F8512 + }; // TODO + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CSecQueryUi::NewLC() +// --------------------------------------------------------------------------- +// +EXPORT_C CSecQueryUi* CSecQueryUi::NewLC() + { + CSecQueryUi* self = new (ELeave) CSecQueryUi(); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::NewL() +// --------------------------------------------------------------------------- +// +EXPORT_C CSecQueryUi* CSecQueryUi::NewL() + { + CSecQueryUi* self = CSecQueryUi::NewLC(); + CleanupStack::Pop(self); + return self; + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::~CSecQueryUi() +// --------------------------------------------------------------------------- +// +CSecQueryUi::~CSecQueryUi() + { + Cancel(); + delete iWait; + delete iDeviceDialog; + delete iVariantMap; + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::InstallConfirmationQueryL() +// --------------------------------------------------------------------------- +// +EXPORT_C TBool CSecQueryUi::InstallConfirmationQueryL(TInt aType, + RMobilePhone::TMobilePassword& password) +/* + const TDesC& aAppName, + const TDesC& aIconFile, const TDesC& aAppVersion, TInt aAppSize, + const TDesC& aAppDetails ) */ + { + // this is never used. Kept as a reference + RDEBUG("This should never be called. Obsolete aType", aType); + return KErrAbort; + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::SecQueryDialog() +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CSecQueryUi::SecQueryDialog(const TDesC& aCaption, + TDes& aDataText, TInt aMinLength, TInt aMaxLength, TInt aMode) + { + RDEBUG("aCaption", 0); + RDEBUGSTR(aCaption); + RDEBUG("aMode", aMode); + TInt secUiOriginatedQuery(ESecurityUIsSecUIOriginatedUninitialized); + TInt err = RProperty::Get(KPSUidSecurityUIs, + KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); + RDEBUG("secUiOriginatedQuery", secUiOriginatedQuery); + if (secUiOriginatedQuery == ESecurityUIsSecUIOriginatedUninitialized ) // && ) + { + // set only if not set + err = RProperty::Set(KPSUidSecurityUIs, + KSecurityUIsSecUIOriginatedQuery, + ESecurityUIsETelAPIOriginated); + RDEBUG("setting secUiOriginatedQuery", ESecurityUIsETelAPIOriginated); + } + else if ( secUiOriginatedQuery != ESecurityUIsSecUIOriginated ) + { + RDEBUG("!!!! warning: secUiOriginatedQuery", secUiOriginatedQuery); + // The query is already shown. This is valid for ESecurityUIsSecUIOriginated, and maybe for ESecurityUIsETelAPIOriginated + // For ESecurityUIsSystemLockOriginated it means that the "lock" dialog is already present. + // Try to dismiss the dialog. Do same as CSecurityHandler::CancelSecCodeQuery + TInt aDismissDialog = -1; + err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsDismissDialog, aDismissDialog); + // it might happen that the dialog is already dismissing. Well, it won't harm to try again. + RDEBUG("aDismissDialog", aDismissDialog); + RDEBUG("err", err); + RDEBUG("set KSecurityUIsDismissDialog", ESecurityUIsDismissDialogOn); + err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsDismissDialog, ESecurityUIsDismissDialogOn); + RDEBUG("err", err); + } + RDEBUG("calling ClearParamsAndSetNoteTypeL aMode", aMode); + ClearParamsAndSetNoteTypeL(aMode); + AddParamL(_L("KSecQueryUiApplicationName"), aCaption); + + _LIT(KTitle, "title"); + // _LIT(KTitleValue1, "Enter PIN"); + AddParamL(KTitle, aCaption); + AddParamL(_L("MinLength"), aMinLength); + AddParamL(_L("MaxLength"), aMaxLength); + + switch (aMode & ESecUiBasicTypeMask) { + case ESecUiBasicTypeCheck: + _LIT(KChecboxDialog, "ChecboxDialog"); + _LIT(KChecbox, "ChecboxDialog"); + AddParamL(KChecboxDialog,KChecbox); + break; + case ESecUiBasicTypeMultiCheck: + _LIT(KMultiChecboxDialog, "MultiChecboxDialog"); + _LIT(KMultiChecbox, "MultiChecboxDialog"); + AddParamL(KMultiChecboxDialog,KMultiChecbox); + break; + default: + _LIT(KCodeTop, "codeTop"); + _LIT(KCodeTopValue, "codeTop"); + AddParamL(KCodeTop, KCodeTopValue); + } + + if (aCaption.Find(_L("|")) > 0) + { + RDEBUG("codeBottom aMode", aMode); + _LIT(KCodeBottom, "codeBottom"); + _LIT(KCodeBottomValue, "codeBottom"); + AddParamL(KCodeBottom, KCodeBottomValue); + } + if (aDataText.Length() > 0) + { + RDEBUG("aDataText", 1); + _LIT(KDefaultCode, "DefaultCode"); + AddParamL(KDefaultCode, aDataText); + } + + RDEBUG("0", 0); + DisplayDeviceDialogL(); + TSecUi::UnInitializeLib(); // the counterpart is at DisplayDeviceDialogL + TInt error = WaitUntilDeviceDialogClosed(); + RDEBUG("error", error); + User::LeaveIfError(error); + RDEBUG("iPassword", 0); + RDEBUGSTR(iPassword); + aDataText.Copy(iPassword); + + err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, + ESecurityUIsSecUIOriginatedUninitialized); + RDEBUG("clearing secUiOriginatedQuery", + ESecurityUIsSecUIOriginatedUninitialized); + + RDEBUG("iReturnValue", iReturnValue); + return iReturnValue; + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::DisplayInformationNoteL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CSecQueryUi::DisplayInformationNoteL(const TDesC& aText) + { + // this is never used. Kept as a reference + RDEBUG("This should never be called. Obsolete", 0); + /* + ClearParamsAndSetNoteTypeL( SecQueryUiInformationNote ); + AddParamL( KNotifDeviceDialogKeyText, aText ); + AddParamL( KNotifDeviceDialogKeyTimeOut, 0 ); + iDeviceDialog->Show( KNotifDeviceDialogLiteral, *iVariantMap, this ); + User::LeaveIfError( WaitUntilDeviceDialogClosed() ); + */ + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::DisplayWarningNoteL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CSecQueryUi::DisplayWarningNoteL(const TDesC& aText) + { + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::DisplayErrorNoteL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CSecQueryUi::DisplayErrorNoteL(const TDesC& aText) + { + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::DisplayPermanentNoteL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CSecQueryUi::DisplayPermanentNoteL(const TDesC& aText) + { + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::ClosePermanentNote() +// --------------------------------------------------------------------------- +// +EXPORT_C void CSecQueryUi::ClosePermanentNote() + { + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::DisplayProgressNoteL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CSecQueryUi::DisplayProgressNoteL(const TDesC& aText, + TInt aFinalValue) + { + /* + ClearParamsAndSetNoteTypeL( ESecQueryUiProgressNoteType ); + AddParamL( KSecQueryUiProgressNoteText, aText ); + AddParamL( KSecQueryUiProgressNoteFinalValue, aFinalValue ); + DisplayDeviceDialogL(); + */} + +// --------------------------------------------------------------------------- +// CSecQueryUi::UpdateProgressNoteValueL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CSecQueryUi::UpdateProgressNoteValueL(TInt aNewValue) + { + /* + ClearParamsAndSetNoteTypeL( ESecQueryUiProgressNoteType ); + AddParamL( KSecQueryUiProgressNoteValue, aNewValue ); + DisplayDeviceDialogL(); + */} + +// --------------------------------------------------------------------------- +// CSecQueryUi::CloseProgressNoteL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CSecQueryUi::CloseProgressNoteL() + { + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::DisplayWaitNoteL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CSecQueryUi::DisplayWaitNoteL(const TDesC& aText, + TRequestStatus& aStatus) + { + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::CloseWaitNote() +// --------------------------------------------------------------------------- +// +EXPORT_C void CSecQueryUi::CloseWaitNote() + { + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::LaunchHelpL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CSecQueryUi::LaunchHelpL(const TDesC& aContext, + const TUid& aUid) + { + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::LaunchHelpL() +// --------------------------------------------------------------------------- +// +EXPORT_C void CSecQueryUi::LaunchHelpL(const TDesC& aContext) + { + LaunchHelpL(aContext, KSWInstHelpUid); + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::DoCancel() +// --------------------------------------------------------------------------- +// +void CSecQueryUi::DoCancel() + { + RDEBUG("0", 0); + if (iWait && iWait->IsStarted() && iWait->CanStopNow()) + { + iCompletionCode = KErrCancel; + iWait->AsyncStop(); + } + RDEBUG("0", 0); + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::RunL() +// --------------------------------------------------------------------------- +// +void CSecQueryUi::RunL() + { + RDEBUG("0", 0); + if (iWait) + { + iWait->AsyncStop(); + } + RDEBUG("0", 0); + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::DataReceived() +// --------------------------------------------------------------------------- +// +void CSecQueryUi::DataReceived(CHbSymbianVariantMap& aData) + { + RDEBUG("0", 0); + const CHbSymbianVariant* acceptedVariant = aData.Get(_L("accepted")); // KSecQueryUiQueryAccepted + RDEBUG("0", 0); + if (acceptedVariant) + { + RDEBUG("0", 0); + TInt* acceptedValue = acceptedVariant->Value (); + RDEBUG("acceptedValue", acceptedValue); + RDEBUG("*acceptedValue", *acceptedValue); + if (acceptedValue) + { + iReturnValue = *acceptedValue; + } + } + const CHbSymbianVariant* acceptedVariantTop = aData.Get(_L("codeTop")); // KSecQueryUiQueryAccepted + RDEBUG("0", 0); + if (acceptedVariantTop) + { + TPtrC acceptedValueTop = *acceptedVariantTop->Value (); + RDEBUG("acceptedValueTop", 0); + RDEBUGSTR(acceptedValueTop); + iPassword.Copy(acceptedValueTop); + + if (iReturnValue == KErrCompletion) // the user didn't OK. It was send automatically because validating new lock code through TARM + { + _LIT(KInvalidNewLockCode, "invalidNewLockCode"); + _LIT(KInvalidNewLockCode0, "invalidNewLockCode$-1"); + AddParamL(KInvalidNewLockCode, KInvalidNewLockCode0); // for starter + RSCPClient scpClient; + TSCPSecCode newCode; + newCode.Copy(acceptedValueTop); + RDEBUG("scpClient.Connect", 0); + if (scpClient.Connect() == KErrNone) + { + RArray aFailedPolicies; + TDevicelockPolicies failedPolicy; + TInt retLockcode = KErrNone; + TInt nPoliciesFailed = 0; + RDEBUG( "scpClient.VerifyNewLockcodeAgainstPolicies", 0 ); + retLockcode = scpClient.VerifyNewLockcodeAgainstPolicies( newCode, aFailedPolicies ); + RDEBUG( "retLockcode", retLockcode ); + nPoliciesFailed = aFailedPolicies.Count(); + RDEBUG( "nPoliciesFailed", nPoliciesFailed ); + for(TInt i=0; i KInvalidNewLockCodeX; KInvalidNewLockCodeX.Zero(); KInvalidNewLockCodeX.Append(_L("invalidNewLockCode")); KInvalidNewLockCodeX.Append(_L("$")); + KInvalidNewLockCodeX.AppendNum(failedPolicy); + AddParamL( KInvalidNewLockCode, KInvalidNewLockCodeX ); // it overwrites the previous one + } + // TODO this should be able to modify MinLenght, MaxLenght + scpClient.Close(); + } + RDEBUG("iDeviceDialog->Update", 0); + iDeviceDialog->Update(*iVariantMap); + } // KErrCompletion + + if (acceptedValueTop.Length() <= 4) // TODO store aMinLenght and check it here, instead of "4" + { + RDEBUG("CPhCltEmergencyCall", 0); + CPhCltEmergencyCall* emergencyCall = CPhCltEmergencyCall::NewL( + NULL); + RDEBUG("PushL", 0); + CleanupStack::PushL(emergencyCall); + TPhCltEmergencyNumber emNumber; + + // this relies on the fact that emergency has 3 digits, and password needs at least 4 + TBool isEmergency(EFalse); + RDEBUG("calling IsEmergencyPhoneNumber", 0); + TInt error = emergencyCall->IsEmergencyPhoneNumber( + acceptedValueTop, isEmergency); + RDEBUG("error", error); + RDEBUG("emNumber", 0); + + RDEBUG("isEmergency", isEmergency); +#ifdef __WINS__ + RDEBUG( "__WINS__ checking", 0 ); + if(!acceptedValueTop.CompareF(_L("112")) || !acceptedValueTop.CompareF(_L("911")) || !acceptedValueTop.CompareF(_L("555")) ) + { + isEmergency = ETrue; + error = KErrNone; + RDEBUG( "__WINS__ isEmergency", isEmergency ); + } +#endif + + if (!error) // oddly enough, missing capabilities also gives KErrNone + { + if (iReturnValue == KErrAbort) // the user didn't OK. It was send automatically because short code + { + _LIT(KEmergency, "emergency"); + _LIT(KEmergencyValueYes, "emergencyYes"); + _LIT(KEmergencyValueNo, "emergencyNo"); + if (isEmergency) + { + RDEBUG("KEmergencyValueYes", 1); + AddParamL(KEmergency, KEmergencyValueYes); + } + else + { + RDEBUG("KEmergencyValueNo", 0); + AddParamL(KEmergency, KEmergencyValueNo); + } + iDeviceDialog->Update(*iVariantMap); + } + else if (iReturnValue == KErrNone) + { // user pressed Call and number is valid + if (isEmergency) + { + RDEBUG("DialEmergencyCallL", isEmergency); + emergencyCall->DialEmergencyCallL(emNumber); + iReturnValue = KErrAbort; // this means emergency call + } + } + } // if !error + RDEBUG("0", 0); + CleanupStack::PopAndDestroy(emergencyCall); + } // lenght<3 + } // acceptedVariantTop + RDEBUG("iReturnValue", iReturnValue); + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::DeviceDialogClosed() +// --------------------------------------------------------------------------- +// +void CSecQueryUi::DeviceDialogClosed(TInt aCompletionCode) + { + RDEBUG("aCompletionCode", aCompletionCode); + iCompletionCode = aCompletionCode; + iIsDisplayingDialog = EFalse; + + TRequestStatus* status(&iStatus); + RDEBUG("0", 0); + User::RequestComplete(status, KErrNone); + RDEBUG("0", 0); + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::CSecQueryUi() +// --------------------------------------------------------------------------- +// +CSecQueryUi::CSecQueryUi() : + CActive(CActive::EPriorityStandard) + { + RDEBUG("0", 0); + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::ConstructL() +// --------------------------------------------------------------------------- +// +void CSecQueryUi::ConstructL() + { + RDEBUG("0", 0); + iWait = new (ELeave) CActiveSchedulerWait; + // iDeviceDialog is allocated later, first call of DisplayDeviceDialogL() + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::ClearParamsL() +// --------------------------------------------------------------------------- +// +void CSecQueryUi::ClearParamsL() + { + RDEBUG("0", 0); + if (iVariantMap) + { + delete iVariantMap; + iVariantMap = NULL; + } + iVariantMap = CHbSymbianVariantMap::NewL(); + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::ClearParamsAndSetNoteTypeL() +// --------------------------------------------------------------------------- +// +void CSecQueryUi::ClearParamsAndSetNoteTypeL(TInt aType) + { + RDEBUG("aType", aType); + ClearParamsL(); + AddParamL(_L("type"), aType); + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::AddParamL() +// --------------------------------------------------------------------------- +// +void CSecQueryUi::AddParamL(const TDesC& aKey, TInt aValue) + { + RDEBUG("aValue", aValue); + CHbSymbianVariant* variant = NULL; + variant = CHbSymbianVariant::NewL(&aValue, CHbSymbianVariant::EInt); + iVariantMap->Add(aKey, variant); + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::AddParamL() +// --------------------------------------------------------------------------- +// +void CSecQueryUi::AddParamL(const TDesC& aKey, const TDesC& aValue) + { + RDEBUG("0", 0); + CHbSymbianVariant* variant = NULL; + variant = CHbSymbianVariant::NewL(&aValue, CHbSymbianVariant::EDes); + iVariantMap->Add(aKey, variant); + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::DisplayDeviceDialogL() +// --------------------------------------------------------------------------- +// +void CSecQueryUi::DisplayDeviceDialogL() + { + RDEBUG("0", 0); + TInt err = KErrNone; + RDEBUG("iIsDisplayingDialog", iIsDisplayingDialog); + if (iDeviceDialog && iIsDisplayingDialog) + { + RDEBUG("iDeviceDialog", 1); + iDeviceDialog->Update(*iVariantMap); + } + else + { + RDEBUG("!iDeviceDialog", 0); + if (!iDeviceDialog) + { + RDEBUG("new iDeviceDialog", 0); + iDeviceDialog = CHbDeviceDialogSymbian::NewL(); + } + _LIT(KSecQueryUiDeviceDialog, "com.nokia.secuinotificationdialog/1.0"); + RDEBUG("Show", 0); + err = iDeviceDialog->Show(KSecQueryUiDeviceDialog, *iVariantMap, this); + RDEBUG("err", err); + TSecUi::InitializeLibL(); + RDEBUG("iIsDisplayingDialog", iIsDisplayingDialog); + iIsDisplayingDialog = ETrue; + RDEBUG("iIsDisplayingDialog", iIsDisplayingDialog); + } + RDEBUG("0", 0); + } + +// --------------------------------------------------------------------------- +// CSecQueryUi::WaitUntilDeviceDialogClosed() +// --------------------------------------------------------------------------- +// +TInt CSecQueryUi::WaitUntilDeviceDialogClosed() + { + RDEBUG("0", 0); + iCompletionCode = KErrInUse; + iReturnValue = KErrUnknown; + if (!IsActive() && iWait && !iWait->IsStarted()) + { + RDEBUG("KRequestPending", KRequestPending); + iStatus = KRequestPending; + SetActive(); + RDEBUG("Start", 0); + iWait->Start(); + RDEBUG("Started", 1); + } + RDEBUG("iCompletionCode", iCompletionCode); + return iCompletionCode; + } + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/Src/SecUi.cpp --- a/securitydialogs/SecUi/Src/SecUi.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUi.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -24,9 +24,6 @@ #include "secui.h" #include -_LIT(KDirAndFile,"z:SecUi.rsc"); - - // ================= MEMBER FUNCTIONS ======================= // // ---------------------------------------------------------- @@ -38,20 +35,19 @@ { if (Dll::Tls()!=NULL) {//Secui has been initialized already; increase client count. - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI): InitializeLibL: Secui has been initialized already")); - #endif + RDEBUG("Secui has been initialized already", 0); TSecUi* instance=(TSecUi*) Dll::Tls(); instance->IncreaseClientCount(); + instance->iDialogOpened++; + RDEBUG("instance->iDialogOpened", instance->iDialogOpened); return; } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI): InitializeLibL: First initialization")); - #endif + RDEBUG("First initialization", 0); TSecUi* self = new (ELeave) TSecUi(); CleanupStack::PushL(self); self->ConstructL(); self->IncreaseClientCount(); + self->iDialogOpened=0; Dll::SetTls(self); CleanupStack::Pop(); } @@ -63,19 +59,19 @@ // EXPORT_C void TSecUi::UnInitializeLib() { + RDEBUG("0", 0); if (Dll::Tls()==NULL) + { + RDEBUG("!!!!!!!!!! Dll::Tls not yet initialized: 0", 0); return; - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI): UnInitializeLibL")); - #endif + } + RDEBUG("0", 0); TSecUi* instance=(TSecUi*) Dll::Tls(); instance->DecreaseClientCount(); //only delete the lib is there are no clients using it if(instance->CanBeFreed()) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI): UnInitializeLibL: Last uninitialize")); - #endif + RDEBUG("Last uninitialize", 0); delete instance; Dll::SetTls(NULL); } @@ -89,7 +85,6 @@ // TSecUi::TSecUi() { - } // // ---------------------------------------------------------- @@ -99,10 +94,6 @@ // TSecUi::~TSecUi() { - if (iResourceFileOffset >= 0) - { - CEikonEnv::Static()->DeleteResourceFile(iResourceFileOffset); - } } // // ---------------------------------------------------------- @@ -112,25 +103,9 @@ // void TSecUi::ConstructL() { - iResourceFileOffset = CCoeEnv::Static()->AddResourceFileL(ResourceFileName()); + RDEBUG("iClientCount", iClientCount); iClientCount = 0; } -// -// ---------------------------------------------------------- -// TSecUi::ResourceFileName -// Returns the resource file name of SecurityUI dll. -// ---------------------------------------------------------- -// -TFileName TSecUi::ResourceFileName() - { - - TParse parse; - parse.Set(KDirAndFile, &KDC_RESOURCE_FILES_DIR, NULL); - TFileName resourceFileName(parse.FullName()); - BaflUtils::NearestLanguageFile(CCoeEnv::Static()->FsSession(), resourceFileName); - return resourceFileName; - - } // ----------------------------------------------------------------------------- // TSecUi::CanBeFreed() @@ -138,18 +113,13 @@ // TBool TSecUi::CanBeFreed() { + RDEBUG("iClientCount", iClientCount); if (iClientCount <= 0) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI): No clients; Can be freed: clients(%d) "), iClientCount); - #endif return ETrue; } else { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI): Can NOT be freed: clients(%d) "), iClientCount); - #endif return EFalse; } } @@ -161,9 +131,7 @@ void TSecUi::IncreaseClientCount() { ++iClientCount; - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI): IncreaseClientCount, clients now(%d) "), iClientCount); - #endif + RDEBUG("iClientCount", iClientCount); } // ----------------------------------------------------------------------------- @@ -174,9 +142,7 @@ void TSecUi::DecreaseClientCount() { --iClientCount; - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI): DecreaseClientCount, clients now(%d) "), iClientCount); - #endif + RDEBUG("iClientCount", iClientCount); } diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/Src/SecUiAutoLockSettingPage.cpp --- a/securitydialogs/SecUi/Src/SecUiAutoLockSettingPage.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiAutoLockSettingPage.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -23,23 +23,8 @@ #include "SecUiAutoLockSettingPage.h" #include "secui.hrh" #include -/** -*CAutolockQuery used in autolock period query -*/ -class CAutolockQuery - : public CAknNumberQueryDialog - { - public: // Constructors and destructors - /** - * C++ constructor. - */ - CAutolockQuery(TInt& aNumber,const TTone aTone = ENoTone); - protected: // From base classes - /** - * From CCAknNumberQueryDialog - */ - void PreLayoutDynInitL(); - }; + + // // ---------------------------------------------------------- // CAutoLockSettingPage::CAutoLockSettingPage() @@ -47,10 +32,9 @@ // ---------------------------------------------------------- // CAutoLockSettingPage::CAutoLockSettingPage(TInt aResourceId, TInt& aCurrentSelectionItem, CDesCArrayFlat* aItemArray, TInt& aAutoLockValue) : - CAknRadioButtonSettingPage(aResourceId, aCurrentSelectionItem, aItemArray),iAutoLockValue(aAutoLockValue) + CBase(),iAutoLockValue(aAutoLockValue) { - iOriginalIndex = aCurrentSelectionItem; } // @@ -61,9 +45,6 @@ // void CAutoLockSettingPage::ConstructL() { - CAknRadioButtonSettingPage::ConstructL(); - const TSize screenSize = iCoeEnv->ScreenDevice()->SizeInPixels(); - FeatureManager::InitializeLibL(); } // @@ -74,7 +55,6 @@ // CAutoLockSettingPage::~CAutoLockSettingPage() { - FeatureManager::UnInitializeLib(); } // @@ -85,54 +65,7 @@ // void CAutoLockSettingPage::ProcessCommandL(TInt aCommandId) { - TInt cur = ListBoxControl()->CurrentItemIndex(); - // Respond to softkey events - - switch (aCommandId) - { - case EAknSoftkeySelect: - case EAknSoftkeyOk: - // autolock off - if (cur == 0) - { - iAutoLockValue = 0; - if(iOriginalIndex == 0) - { //User re-selected "Autolock off"; no use in changing lock setting - AttemptExitL(EFalse); - } - else - { - AttemptExitL(ETrue); - } - - } - // user defined - if (cur == 1) - { - CAutolockQuery* dlg = new (ELeave) CAutolockQuery(iAutoLockValue); - dlg->PrepareLC(R_AUTOLOCK_TIME_QUERY); - if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) - { - //set min and max values from SCP server to the dialog. - TInt minimum = 0; - if(iMaximum <= 0) //maximum value has not been defined; default value used instead. - iMaximum = 1440; - dlg->SetMinimumAndMaximum(minimum, iMaximum); - } - if(dlg->RunLD()) - { - AttemptExitL(ETrue); - } - else - AttemptExitL(EFalse); - } - break; - - default: - CAknSettingPage::ProcessCommandL(aCommandId); - break; - } - + } // // ---------------------------------------------------------- @@ -142,10 +75,6 @@ // void CAutoLockSettingPage::SetPeriodMaximumValue(TInt aMaximumValue) { - if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) - { - iMaximum = aMaximumValue; -} } //--------------------------------------------------------------------------------------- @@ -157,80 +86,6 @@ void CAutoLockSettingPage::HandlePointerEventL(const TPointerEvent& aPointerEvent) { - if ( AknLayoutUtils::PenEnabled() ) - { - TInt cur = ListBoxControl()->CurrentItemIndex(); - CAknRadioButtonSettingPage::HandlePointerEventL(aPointerEvent); - //only take into account the "Up" event. Otherwise we'll end up having 2 dialogs. - if(aPointerEvent.iType == TPointerEvent::EButton1Up) - { - - //only react to the event if the pen is actually inside the dialog. - if(ListBoxControl()->Rect().Contains(aPointerEvent.iPosition)) - { - // autolock off - if (cur == 0) - { - iAutoLockValue = 0; - if(iOriginalIndex == 0) - { //User re-selected "Autolock off"; no use in changing lock setting - AttemptExitL(EFalse); - } - else - { - AttemptExitL(ETrue); - } - } - // user defined - if (cur == 1) - { - CAutolockQuery* dlg = new (ELeave) CAutolockQuery(iAutoLockValue); - dlg->PrepareLC(R_AUTOLOCK_TIME_QUERY); - if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) - { - //set min and max values from SCP server to the dialog. - TInt minimum = 0; - if(iMaximum <= 0) //maximum value has not been defined; default value used instead. - iMaximum = 1440; - dlg->SetMinimumAndMaximum(minimum, iMaximum); - } - if(dlg->RunLD()) - { - AttemptExitL(ETrue); - } - else - AttemptExitL(EFalse); - } - - } - } - } - } -// -// --------------------------------------------------------- -// CAutolockQuery::CAutolockQuery() -// -// --------------------------------------------------------- -// -CAutolockQuery::CAutolockQuery(TInt& aNumber,const TTone aTone) - : CAknNumberQueryDialog( aNumber, aTone) - { - } - -// -// --------------------------------------------------------- -// CAutolockQuery::PreLayoutDynInitL() -// -// --------------------------------------------------------- -// -void CAutolockQuery::PreLayoutDynInitL() - { - CAknNumberQueryDialog::PreLayoutDynInitL(); - if (iNumber == 0) - { - MakeLeftSoftkeyVisible(EFalse); - } - } - + } // End of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/Src/SecUiCodeQueryControl.cpp --- a/securitydialogs/SecUi/Src/SecUiCodeQueryControl.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiCodeQueryControl.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -16,7 +16,7 @@ * * */ - +#include #include #include #include diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/Src/SecUiCodeQueryDialog.cpp --- a/securitydialogs/SecUi/Src/SecUiCodeQueryDialog.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiCodeQueryDialog.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -18,13 +18,6 @@ #include #include "secuicodequerydialog.h" -#include -#include "SecUiCodeQueryControl.h" -#include "secui.hrh" -#include -#include -#include -#include // ================= MEMBER FUNCTIONS ======================= // @@ -33,9 +26,7 @@ // C++ constructor // ---------------------------------------------------------- // -EXPORT_C CCodeQueryDialog::CCodeQueryDialog(TDes& aDataText,TInt aMinLength,TInt aMaxLength,TInt aMode, TBool aIsRemoteLockQuery): - CAknTextQueryDialog(aDataText,ENoTone), iMinLength(aMinLength), iMaxLength(aMaxLength), iMode(aMode), iIsRemoteLockQuery(aIsRemoteLockQuery) - +EXPORT_C CCodeQueryDialog::CCodeQueryDialog(TDes& aDataText,TInt aMinLength,TInt aMaxLength,TInt aMode, TBool aIsRemoteLockQuery) : CBase() { } // @@ -46,462 +37,7 @@ // CCodeQueryDialog::~CCodeQueryDialog() { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::~CCodeQueryDialog()")); - #endif - - if ( AknLayoutUtils::PenEnabled() ) - { - TRAP_IGNORE ( SetIncallBubbleAllowedInUsualL( ETrue ) ); - } - - if (iFront) - { - // uncapture keys - if (iMode != ESecUiNone) - { - RWindowGroup& groupWin=iCoeEnv->RootWin(); - groupWin.CancelCaptureKeyUpAndDowns(iAppKey); - groupWin.CancelCaptureKeyUpAndDowns(iVoiceKey2); - groupWin.CancelCaptureKey(iVoiceKey1); - } - - CAknAppUi* aknappui =static_cast(iEikonEnv->EikAppUi()); - - if(!iIsRemoteLockQuery) - { - // return normal high-priority in case there are other notifiers active - // and were are not going to lose foregroung right after following call - if (!aknappui->IsFullScreenApp())//check that we are autolock and not a "normal" i.e. full screen application. - iEikonEnv->RootWin().SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront); - } - - - iEikonEnv->BringForwards(EFalse); - iEikonEnv->EikAppUi()->RemoveFromStack(this); - aknappui->KeySounds()->ReleaseContext(); - aknappui->KeySounds()->PopContext(); - iFront = EFalse; - } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::~CCodeQueryDialog() END")); - #endif } -// -// ---------------------------------------------------------- -// CCodeQueryDialog::PreLayoutDynInitL() -// Called by framework before dialog is shown -// ---------------------------------------------------------- -// -void CCodeQueryDialog::PreLayoutDynInitL() - { - CAknTextQueryDialog::PreLayoutDynInitL(); - - //disable in call bubble. - if ( AknLayoutUtils::PenEnabled() ) - { - SetIncallBubbleAllowedInUsualL( EFalse ); - } - - SetMaxLength(iMaxLength); - // Add this higher than the environment filter, otherwise - // we cannot capture keys from the EikSrvUi KeyFilter. - // Used because this query might be called from notifier - if (iMode == ESecUiNone) - { - iEikonEnv->EikAppUi()->AddToStackL(this,ECoeStackPriorityEnvironmentFilter+100,ECoeStackFlagRefusesAllKeys); - } - else - { - iEikonEnv->EikAppUi()->AddToStackL(this,ECoeStackPriorityEnvironmentFilter+100,ECoeStackFlagRefusesFocus); - } - - // capture app,voice and end keys if necessary - if (iMode != ESecUiNone) - { - - RWindowGroup& groupWin=iCoeEnv->RootWin(); - // Capture app key - iAppKey = groupWin.CaptureKeyUpAndDowns(EStdKeyApplication0, 0, 0); - // capture voice key - iVoiceKey1 = groupWin.CaptureKey(EKeySide,0,0); - iVoiceKey2 = groupWin.CaptureKeyUpAndDowns(EStdKeyDevice6, 0, 0); - } - if (!iIsRemoteLockQuery) - { - MakeLeftSoftkeyVisible(EFalse); - - RWsSession& wsSession = iEikonEnv->WsSession(); - TInt myWgId = iEikonEnv->RootWin().Identifier(); - - TInt wgPrio = wsSession.GetWindowGroupOrdinalPriority(myWgId); - // we are already on forgeround, need to update priority differently - /* - if (wgPrio == ECoeWinPriorityAlwaysAtFront) - { - iEikonEnv->RootWin().SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront+1); - } - */ - - // this must be done always to keep the reference count in synch - // this does not have any effect if autoforwarding has not been set true (normal application.) - iEikonEnv->BringForwards(ETrue, ECoeWinPriorityAlwaysAtFront + 1); - - /// -- Change Window Priority for dialog and CBA - DrawableWindow()->SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront); // - ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition( - 0, ECoeWinPriorityAlwaysAtFront); - } - - //key sounds - static_cast(iEikonEnv->EikAppUi())->KeySounds()->PushContextL(R_AVKON_DEFAULT_SKEY_LIST); - static_cast(iEikonEnv->EikAppUi())->KeySounds()->BringToForeground(); - static_cast(iEikonEnv->EikAppUi())->KeySounds()->LockContext(); - iFront = ETrue; - - } -// -// --------------------------------------------------------- -// CCodeQueryDialog::OfferKeyEventL -// called by framework when any key is pressed -// --------------------------------------------------------- -// -TKeyResponse CCodeQueryDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OfferKeyEventL")); - TInt keycode = aKeyEvent.iCode; - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OfferKeyEventL keycode: %d"), keycode); - TInt scancode = aKeyEvent.iScanCode; - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OfferKeyEventL scancode: %d"), scancode); - #endif - if(!iIsRemoteLockQuery) - { - // '#' key - if( aKeyEvent.iScanCode == EStdKeyHash && aType == EEventKeyUp) - { - TryExitL(EEikBidOk); - return EKeyWasConsumed; - } - - // '*' key - if (aKeyEvent.iCode == '*') - { - return EKeyWasConsumed; - } - - } - - // app key - if (aKeyEvent.iScanCode == EStdKeyApplication0) - { - if (iMode == ESecUiNone) - { - TryExitL(EAknSoftkeyCancel); - return EKeyWasNotConsumed; - } - return EKeyWasConsumed; - } - - // end key - if (aKeyEvent.iCode == EKeyPhoneEnd) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OfferKeyEventL: EKeyPhoneEnd")); - #endif - TryExitL(EAknSoftkeyCancel); - return EKeyWasConsumed; - } - if ((aKeyEvent.iScanCode == EStdKeyYes)) - {//Since dialler listens to down/up event, - //have to consume those to prevent it from opening - if(AknLayoutUtils::PenEnabled()) - { - CCodeQueryControl* control = STATIC_CAST(CCodeQueryControl*,Control(EGeneralQuery)); - if(!control->IsEmergencyCallSupportOn()) - { //Only needed in dialogs where there is no emergency call support - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OfferKeyEventL: Send down/up event consumed.")); - #endif - return EKeyWasConsumed; - } - } - } - if (aKeyEvent.iCode == EKeyPhoneSend) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OfferKeyEventL: EKeyPhoneSend")); - #endif - if(AknLayoutUtils::PenEnabled()) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OfferKeyEventL: pen enabled")); - #endif - CCodeQueryControl* control = STATIC_CAST(CCodeQueryControl*,Control(EGeneralQuery)); - if(control->IsEmergencyCallSupportOn()) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OfferKeyEventL: ECS on")); - #endif - if(!control->IsEmergencyNumber()) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OfferKeyEventL: Not E number!")); - #endif - - ShowWarningNoteL(); - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OfferKeyEventL: send key consumed!")); - #endif - return EKeyWasConsumed; - } - } - else //consume the key to prevent dialler from opening - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OfferKeyEventL: No ECS. send key consumed!")); - #endif - return EKeyWasConsumed; - } - } - } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OfferKeyEventL: To AVKON")); - #endif - return CAknTextQueryDialog::OfferKeyEventL(aKeyEvent,aType); - } -// -// --------------------------------------------------------- -// CCodeQueryDialog::NeedToDismissQueryL() -// Handles '#' key called by CAknTextQueryDialog::OfferKeyEventL() -// --------------------------------------------------------- -// -TBool CCodeQueryDialog::NeedToDismissQueryL(const TKeyEvent& /*aKeyEvent*/) - { - return EFalse; - } -// -// --------------------------------------------------------- -// CCodeQueryDialog::OkToExitL() -// called by framework when the Softkey is pressed -// --------------------------------------------------------- -// -TBool CCodeQueryDialog::OkToExitL(TInt aButtonId) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OkToExitL:%d"), aButtonId); - #endif - CCodeQueryControl* control = STATIC_CAST(CCodeQueryControl*,Control(EGeneralQuery)); - TInt lenght = 0; - TBool returnvalue; - switch(aButtonId) - { - case EAknSoftkeyOk: - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OkToExitL:EAknSoftkeyOk")); - #endif - if(control) - { - lenght = control->GetTextLength(); - } - if (lenght < iMinLength) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OkToExitL:length < MIN: %d"), lenght); - #endif - // code was too short -> play error tone & clear editor - if (lenght != 0) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OkToExitL:length < MIN, Play Sound")); - #endif - if(control) - { - - control->PlaySound(EAvkonSIDErrorTone); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OkToExitL:length < MIN, Reset Editor")); - #endif - control->ResetEditorL(); - } - } - returnvalue = EFalse; - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OkToExitL:length >= MIN: %d"), lenght); - #endif - returnvalue = CAknTextQueryDialog::OkToExitL(aButtonId); - } - break; - - case EEikBidCancel: //Also includes EAknSoftkeyCancel as they have the same numerical value - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OkToExitL:EEikBidCancel")); - #endif - if(iMode != ESecUiNone) //PUK1 code or PIN1 in boot. Must not exit until code has been input. - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OkToExitL:EEikBidCancel: get length.")); - #endif - if(control) - { - lenght = control->GetTextLength(); - } - returnvalue = EFalse; - if (lenght > 0) //reset editor - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OkToExitL:EEikBidCancel: length >0.")); - #endif - if (control) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OkToExitL:EEikBidCancel, reset editor")); - #endif - control->ResetEditorL(); - } - } - } - else - returnvalue = ETrue; - break; - case ESecUiEmergencyCall: //user has called emergency number from dialog; exit. - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OkToExitL:Emergency Call")); - #endif - returnvalue = ETrue; - break; - case EAknSoftkeyEmergencyCall: - returnvalue = ETrue; - CAknTextQueryDialog::OkToExitL(aButtonId); - break; - case ESecUiDeviceLocked: //Dialog was left open when Device lock was activated by timer and must be closed. - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OkToExitL:Phone Locked")); - #endif - if(iMode == ESecUiNone) - returnvalue = ETrue;//Not a PUK1 code query. - else - returnvalue = EFalse; - break; - default: - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OkToExitL:DEFAULT!")); - #endif - if(iMode == ESecUiNone) - returnvalue = ETrue; - else - returnvalue = EFalse; - break; - } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::OkToExitL:END: %d"), returnvalue); - #endif - return returnvalue; - } -// -// --------------------------------------------------------- -// CCodeQueryDialog::HandleQueryEditorStateEventL() -// Gets called when editor sends state event -// --------------------------------------------------------- -// -TBool CCodeQueryDialog::HandleQueryEditorStateEventL(CAknQueryControl* aQueryControl, - TQueryControlEvent aEventType, - TQueryValidationStatus aStatus) -{ - - if (aEventType == MAknQueryControlObserver::EEmergencyCallAttempted) - { - TryExitL(ESecUiEmergencyCall); - return EFalse; - } - else - { - return CAknQueryDialog::HandleQueryEditorStateEventL(aQueryControl, aEventType, aStatus ); - } - - -} -// -// --------------------------------------------------------- -// CCodeQueryDialog::TryCancelQueryL() -// Gets called when a client wishes to cancel the query -// --------------------------------------------------------- -// -void CCodeQueryDialog::TryCancelQueryL(TInt aReason) -{ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::TryCancelQuery BEGIN")); - #endif - TryExitL(aReason); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::TryCancelQuery END")); - #endif -} - -// ----------------------------------------------------------------------------- -// CCodeQueryDialog::CheckIfEntryTextOk() -// ----------------------------------------------------------------------------- -// -TBool CCodeQueryDialog::CheckIfEntryTextOk() const - { - CCodeQueryControl* control = STATIC_CAST(CCodeQueryControl*,Control(EGeneralQuery)); - if (control) - { - control->GetText(iDataText); - } - const TInt textLength = Text().Length(); - return (textLength <= iMaxLength && textLength >= iMinLength); - } - -// ----------------------------------------------------------------------------- -// CCTPinQueryDialog::UpdateLeftSoftKeyL() -// ----------------------------------------------------------------------------- -// -void CCodeQueryDialog::UpdateLeftSoftKeyL() - { - CAknTextQueryDialog::UpdateLeftSoftKeyL(); - if(iIsRemoteLockQuery) - MakeLeftSoftkeyVisible(CheckIfEntryTextOk()); - } -// ----------------------------------------------------------------------------- -// CCodeQueryDialog::ShowWarningNoteL() -// ----------------------------------------------------------------------------- -// -void CCodeQueryDialog::ShowWarningNoteL() - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::ShowWarningNoteL BEGIN")); - #endif - - CAknNoteDialog* noteDlg = new (ELeave) CAknNoteDialog(); - noteDlg->PrepareLC(R_EMERGENCY_CALLS_ONLY); - noteDlg->SetTimeout(CAknNoteDialog::ELongTimeout); - noteDlg->SetTone(CAknNoteDialog::EErrorTone); - - noteDlg->DrawableWindow()->SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront+1); // - noteDlg->ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront+1); - - noteDlg->RunLD(); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CCodeQueryDialog::ShowWarningNoteL END")); - #endif - } - -// ----------------------------------------------------------------------------- -// CCodeQueryDialog::SetIncallBubbleAllowedInUsualL() -// ----------------------------------------------------------------------------- -// -void CCodeQueryDialog::SetIncallBubbleAllowedInUsualL(TBool aAllowed) - { - CAknIncallBubble *incallBubble = CAknIncallBubble::NewL(); - CleanupStack::PushL(incallBubble); - incallBubble->SetIncallBubbleAllowedInUsualL( aAllowed ); - CleanupStack::PopAndDestroy(); - } // End of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/Src/SecUiManualSecuritySettings.cpp --- a/securitydialogs/SecUi/Src/SecUiManualSecuritySettings.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiManualSecuritySettings.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -18,9 +18,11 @@ #include -#include +#include "SecQueryUi.h" #include "secuimanualsecuritysettings.h" +#include "secuisecuritysettings.h" #include +#include "SecUi.h" #include "SecUiWait.h" #include /***************************************************** @@ -107,6 +109,7 @@ // May also return KErrAlreadyExists if something else // has already loaded the TSY module. And that is // not an error. + RDEBUG("err", err); User::LeaveIfError( err ); } @@ -132,15 +135,11 @@ * Series 60 Customer / TSY * Needs customer TSY implementation *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::~CManualSecuritySettings()")); - #endif + RDEBUG("0", 0); // Cancel active requests if(iWait->IsActive()) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::~CManualSecuritySettings() CANCEL REQ")); - #endif + RDEBUG("CancelAsyncRequest", 0); iPhone.CancelAsyncRequest(iWait->GetRequestType()); } // close phone @@ -157,9 +156,7 @@ } delete iNote; delete iWait; - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::~CManualSecuritySettings() END")); - #endif + RDEBUG("0", 0); } // @@ -174,14 +171,10 @@ * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::ChangePinL()")); - #endif + RDEBUG("aPin", aPin); if (aPin == EPin1) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::ChangePinL() PIN1")); - #endif + RDEBUG("EPin1", EPin1); RMobilePhone::TMobilePhoneLock lockType; RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); @@ -192,13 +185,12 @@ // The following is required, since the new multimode Etel is asynchronous // rather than synchronous. - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::ChangePinL() GetLockInfo")); - #endif - + RDEBUG("SetRequestType", EMobilePhoneGetLockInfo); iWait->SetRequestType(EMobilePhoneGetLockInfo); iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); + RDEBUG("WaitForRequestL", 0); TInt res = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); if (res != KErrNone) return EFalse; @@ -210,9 +202,7 @@ } } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::ChangePinL() CompareF")); - #endif + RDEBUG("CompareF", 0); if (aNew.CompareF(aVerifyNew) != 0) { // codes do not match note @@ -235,17 +225,13 @@ aChange.iOldPassword = aOld; aChange.iNewPassword = aNew; - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::ChangePinL() ChangeSecurityCode")); - #endif + RDEBUG("EMobilePhoneChangeSecurityCode", EMobilePhoneChangeSecurityCode); iWait->SetRequestType(EMobilePhoneChangeSecurityCode); iPhone.ChangeSecurityCode(iWait->iStatus,secCodeType,aChange); + RDEBUG("WaitForRequestL", 0); TInt res = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::ChangePinL() ChangeSecurityCode RES: %d"), res); - #endif - switch(res) { case KErrNone: @@ -267,7 +253,9 @@ else { iCustomPhone.CheckSecurityCode(iWait->iStatus,RMmCustomAPI::ESecurityCodePuk2); + RDEBUG("WaitForRequestL", 0); TInt res = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); } break; case KErrGsm0707OperationNotAllowed: @@ -288,9 +276,7 @@ // EXPORT_C void CManualSecuritySettings::CancelChangePin() { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::CancelChangePin()")); - #endif + RDEBUG("0", 0); delete iNote; iNote = NULL; } @@ -306,9 +292,7 @@ * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::UnblockPinL()")); - #endif + RDEBUG("0", 0); if (aNew.CompareF(aVerifyNew) != 0) { // codes do not match note @@ -326,10 +310,12 @@ { blockCodeType = RMobilePhone::ESecurityCodePuk2; } - + RDEBUG("blockCodeType", blockCodeType); iWait->SetRequestType(EMobilePhoneVerifySecurityCode); iPhone.VerifySecurityCode(iWait->iStatus, blockCodeType, aNew, aPuk); + RDEBUG("WaitForRequestL", 0); TInt res = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); switch(res) { @@ -368,9 +354,7 @@ // EXPORT_C void CManualSecuritySettings::CancelUnblockPin() { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::CancelUnblockPinL()")); - #endif + RDEBUG("0", 0); delete iNote; iNote = NULL; } @@ -386,19 +370,15 @@ * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::LockSimL()")); - #endif - - + RDEBUG("0", 0); RMmCustomAPI::TLockNumber aLockType; TInt ret = KErrGsm0707IncorrectPassword; TInt length = aLockCode.Length(); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::LockSimL(): Param length: %d"), length); - #endif - + RDEBUG("length", length); + // from now on, it accepts restricted lengths, although some locks are 20, others are 13 + if(aLockCode.Length() <= KSimLockMaxPasswordSize) + { if (aType.CompareF(Operator) == 0) { aLockType = RMmCustomAPI::EOperator; @@ -434,10 +414,9 @@ aLockType = RMmCustomAPI::EOperator_Gid2; ret = iCustomPhone.ActivateSimLock( aLockCode,aLockType ); } + } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::LockSimL() RESULT: %d"), ret); - #endif + RDEBUG("ret", ret); switch (ret) { case KErrNone: @@ -472,9 +451,7 @@ // EXPORT_C void CManualSecuritySettings::CancelLockSim() { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::CancelLockSimL()")); - #endif + RDEBUG("0", 0); delete iNote; iNote = NULL; } @@ -490,17 +467,15 @@ * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::UnLockSimL()")); - #endif + RDEBUG("0", 0); RMmCustomAPI::TLockNumber aLockType; TInt ret = KErrGsm0707IncorrectPassword; TInt length = aUnlockCode.Length(); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::UnLockSimL(): Param length: %d"), length); - #endif - + RDEBUG("length", length); + // from now on, it accepts restricted lengths, although some locks are 20, others are 13 + if(aUnlockCode.Length() <= KSimLockMaxPasswordSize) + { if (aType.CompareF(Operator) == 0) { aLockType = RMmCustomAPI::EOperator; @@ -542,9 +517,8 @@ ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType ); } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::UnLockSimL() RESULT: %d"), ret); - #endif + } + RDEBUG("ret", ret); switch (ret) { case KErrNone: @@ -577,9 +551,7 @@ // EXPORT_C void CManualSecuritySettings::CancelUnlockSim() { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::CancelUnLockSimL()")); - #endif + RDEBUG("0", 0); delete iNote; iNote = NULL; } @@ -592,13 +564,8 @@ // void CManualSecuritySettings::ShowResultNoteL(CAknNoteDialog::TTone aTone, TInt aResourceID) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::CancelUnLockSimL()")); - #endif - iNote = new (ELeave) CAknNoteDialog(REINTERPRET_CAST(CEikDialog**,&iNote)); - iNote->SetTimeout(CAknNoteDialog::ELongTimeout); - iNote->SetTone(aTone); - iNote->ExecuteLD(aResourceID); + RDEBUG("aResourceID", aResourceID); + CSecuritySettings::ShowResultNoteL(aResourceID, aTone); } // End of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/Src/SecUiRemoteLockSettingPage.cpp --- a/securitydialogs/SecUi/Src/SecUiRemoteLockSettingPage.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiRemoteLockSettingPage.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -54,6 +54,8 @@ CAknRadioButtonSettingPage::ConstructL(); const TSize screenSize = iCoeEnv->ScreenDevice()->SizeInPixels(); + iPopoutCba = CEikButtonGroupContainer::NewL( CEikButtonGroupContainer::ECba, CEikButtonGroupContainer::EHorizontal, this, R_AVKON_SOFTKEYS_OK_CANCEL__OK ); + iPopoutCba->SetBoundingRect( TRect( screenSize ) ); #ifdef _DEBUG RDebug::Print( _L( "(SecUi)CRemoteLockSettingPage::ConstructL() - Exit" ) ); @@ -74,6 +76,9 @@ RDebug::Print( _L( "(SecUi)CRemoteLockSettingPage::~CRemoteLockSettingPage() - Enter" ) ); #endif // DEBUG + delete iPopoutCba; + iPopoutCba = NULL; + #ifdef _DEBUG RDebug::Print( _L( "(SecUi)CRemoteLockSettingPage::~CRemoteLockSettingPage() - Exit" ) ); #endif // DEBUG diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp --- a/securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -1,64 +1,65 @@ /* -* Copyright (c) 2002 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: Provides api for handling security events. -* -* -*/ - - + * Copyright (c) 2002 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: Provides api for handling security events. + * + * + */ +#include #include #include -#include +// #include #include #include #ifdef __COVER_DISPLAY #include -#include #endif //__COVER_DISPLAY +#include +#include -#include -#include //used for RemoveSplashScreen -#include #include // Property values #include #include -#include +// #include #include #include -#include +// #include #include #include #include "secui.hrh" +#include "SecUi.h" #include "secuisecurityhandler.h" #include "secuicodequerydialog.h" #include "secuisecuritysettings.h" #include "SecUiWait.h" -#include "SecUiLockObserver.h" -#ifdef RD_REMOTELOCK +// #include "SecUiLockObserver.h" #include -#endif // RD_REMOTELOCK #include #include +#include + +#include "SecQueryUi.h" + // LOCAL CONSTANTS AND MACROS const TInt KMaxNumberOfPUKAttempts(10); const TInt KMaxNumberOfPINAttempts(3); -const TInt KLastRemainingInputAttempt(1); +// not used +// const TInt KLastRemainingInputAttempt(1); -const TInt KTriesToConnectServer( 2 ); -const TInt KTimeBeforeRetryingRequest( 50000 ); +const TInt KTriesToConnectServer(2); +const TInt KTimeBeforeRetryingRequest(50000); // ================= MEMBER FUNCTIONS ======================= // @@ -66,12 +67,21 @@ // CSecurityHandler::CSecurityHandler() // C++ constructor // ---------------------------------------------------------- -// -EXPORT_C CSecurityHandler::CSecurityHandler(RMobilePhone& aPhone): - iPhone(aPhone), iQueryCanceled(ETrue), iSecurityDlg(NULL), iNoteDlg(NULL) +// qtdone +EXPORT_C CSecurityHandler::CSecurityHandler(RMobilePhone& aPhone) : + iPhone(aPhone), iQueryCanceled(ETrue), iSecurityDlg(NULL), iNoteDlg(NULL) { - TInt result = iCustomPhone.Open(aPhone); - TRAP_IGNORE( FeatureManager::InitializeLibL() ); //Shouldn't this panic if FM does not initialise?? + RDEBUG("0", 0); + + TInt result = iCustomPhone.Open(aPhone); + RDEBUG("result", result); + TRAP_IGNORE(FeatureManager::InitializeLibL()); //Shouldn't this panic if FM does not initialise?? + + _LIT(KFileName, "secui_"); + _LIT(KPath, "z:/resource/qt/translations/"); + RDEBUG("HbTextResolverSymbian", 0); + result = HbTextResolverSymbian::Init(KFileName, KPath); + RDEBUG("result", result); } // @@ -79,32 +89,49 @@ // CSecurityHandler::~CSecurityHandler() // Destructor // ---------------------------------------------------------- -// +// qtdone EXPORT_C CSecurityHandler::~CSecurityHandler() { - #if defined(_DEBUG) - RDebug::Print(_L("CSecurityHandler::~CSecurityHandler()")); - #endif - if ( iDestroyedPtr ) + RDEBUG("0", 0); + + if (iDestroyedPtr) { *iDestroyedPtr = ETrue; iDestroyedPtr = NULL; } - CancelSecCodeQuery(); + RDEBUG("calling CancelOpenQuery", 0); + TInt err = CancelOpenQuery(-1); + RDEBUG("err", err); iCustomPhone.Close(); FeatureManager::UnInitializeLib(); + RDEBUG("1", 1); } // // ---------------------------------------------------------- // CSecurityHandler::HandleEventL() // Handles different security events // ---------------------------------------------------------- +// qtdone +EXPORT_C void CSecurityHandler::HandleEventL(RMobilePhone::TMobilePhoneSecurityEvent aEvent) + { + RDEBUG("0", 0); + + TInt result = KErrNone; + HandleEventL(aEvent, result); + } + // -EXPORT_C void CSecurityHandler::HandleEventL( - RMobilePhone::TMobilePhoneSecurityEvent aEvent ) +// ---------------------------------------------------------- +// CSecurityHandler::HandleEventL() +// Handles different security events +// ---------------------------------------------------------- +// qtdone +EXPORT_C void CSecurityHandler::HandleEventL(RMobilePhone::TMobilePhoneSecurityEvent aEvent, TBool aStartup, TInt& aResult) { - TInt result = KErrNone; - HandleEventL( aEvent, result ); + RDEBUG("0", 0); + + iStartup = aStartup; + HandleEventL(aEvent, aResult); } // @@ -112,422 +139,300 @@ // CSecurityHandler::HandleEventL() // Handles different security events // ---------------------------------------------------------- -// -EXPORT_C void CSecurityHandler::HandleEventL( - RMobilePhone::TMobilePhoneSecurityEvent aEvent, - TBool aStartup, TInt& aResult ) +// qtdone +EXPORT_C void CSecurityHandler::HandleEventL(RMobilePhone::TMobilePhoneSecurityEvent aEvent, TInt& aResult) { - iStartup = aStartup; - HandleEventL( aEvent, aResult ); - } - -// -// ---------------------------------------------------------- -// CSecurityHandler::HandleEventL() -// Handles different security events -// ---------------------------------------------------------- -// -EXPORT_C void CSecurityHandler::HandleEventL( - RMobilePhone::TMobilePhoneSecurityEvent aEvent, TInt& aResult ) - { + RDEBUG("0", 0); + /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::HandleEventL()")); - RDebug::Print(_L("(SECUI)CSecurityHandler::HandleEventL() EVENT: %d"), aEvent); - #endif - TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); - - switch(aEvent) - { - case RMobilePhone::EPin1Required: - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::HandleEventL() Pin1Required")); - #endif - aResult = Pin1RequiredL(); - break; - case RMobilePhone::EPuk1Required: - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::HandleEventL() PUK1Required")); - #endif - ((CAknNotifierAppServerAppUi*)(CEikonEnv::Static())->EikAppUi())->SuppressAppSwitching(ETrue); - TRAPD(err,aResult = Puk1RequiredL()); - ((CAknNotifierAppServerAppUi*)(CEikonEnv::Static())->EikAppUi())->SuppressAppSwitching(EFalse); - User::LeaveIfError(err); - break; - case RMobilePhone::EPin2Required: - Pin2RequiredL(); - break; - case RMobilePhone::EPuk2Required: - Puk2RequiredL(); - break; - case RMobilePhone::EUniversalPinRequired: - if(wcdmaSupported || upinSupported) - { - aResult = UPinRequiredL(); - } - else - aResult = KErrNotSupported; - break; - case RMobilePhone::EUniversalPukRequired: - if(wcdmaSupported || upinSupported) - { - aResult = UPukRequiredL(); - } - else - aResult = KErrNotSupported; - break; - case RMobilePhone::EPhonePasswordRequired: - aResult = PassPhraseRequiredL(); - break; - case RMobilePhone::EICCTerminated: - SimLockEventL(); - break; - default: - break; - } - #if defined(_DEBUG) - RDebug::Print( _L( "CSecurityHandler::HandleEventL() returning %d." ), aResult ); - #endif + * Series 60 Customer / ETel + * Series 60 ETel API + *****************************************************/ + TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); + TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); + RDEBUG("aEvent", aEvent); + + switch (aEvent) + { + case RMobilePhone::EPin1Required: + RDEBUG("RMobilePhone::EPin1Required", 0) + ; + aResult = Pin1RequiredL(); + break; + case RMobilePhone::EPuk1Required: + RDEBUG("RMobilePhone::EPuk1Required", 0) + ; + Puk1RequiredL(); + break; + case RMobilePhone::EPin2Required: + Pin2RequiredL(); + break; + case RMobilePhone::EPuk2Required: + Puk2RequiredL(); + break; + case RMobilePhone::EUniversalPinRequired: + if (wcdmaSupported || upinSupported) + { + aResult = UPinRequiredL(); + } + else + aResult = KErrNotSupported; + break; + case RMobilePhone::EUniversalPukRequired: + if (wcdmaSupported || upinSupported) + { + aResult = UPukRequiredL(); + } + else + aResult = KErrNotSupported; + break; + case RMobilePhone::EPhonePasswordRequired: + aResult = PassPhraseRequiredL(); + break; + case RMobilePhone::EICCTerminated: + SimLockEventL(); + break; + default: + RDEBUG("default", aEvent) + ; + break; + } + RDEBUG("aResult", aResult); } // // ---------------------------------------------------------- // CSecurityHandler::AskSecCodeL() // For asking security code e.g in settings // ---------------------------------------------------------- -// +// qtdone EXPORT_C TBool CSecurityHandler::AskSecCodeL() - { + { /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeL()")); - #endif + * Series 60 Customer / ETel + * Series 60 ETel API + *****************************************************/ + RDEBUG("0", 0); + // if code is still not initialized, then there's no need to ask it. This fixes the error when the RFS requests the code. + const TUid KCRUidSCPLockCode = + { + 0x2002677B + }; + const TUint32 KSCPLockCodeDefaultLockCode = 0x00000001; - /* if code is still not initialized, then there's no need to ask it. This fixes the error when the RFS requests the code */ - const TUid KCRUidSCPLockCode = {0x2002677B}; - const TUint32 KSCPLockCodeDefaultLockCode = 0x00000001; - CRepository* repository = CRepository::NewL(KCRUidSCPLockCode); TInt currentLockStatus = -1; - TInt res=-1; + TInt res = -1; + TInt lAlphaSupported = 0; + TInt lCancelSupported = 0; + RMobilePhone::TMobilePassword iSecUi_password; - res = repository->Get(KSCPLockCodeDefaultLockCode , currentLockStatus); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) res=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, res ); - RDebug::Printf( "%s %s (%u) currentLockStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, currentLockStatus ); - #endif + res = repository->Get(KSCPLockCodeDefaultLockCode, currentLockStatus); // 0x3039 = 12345 + RDEBUG("res", res); + RDEBUG("currentLockStatus", currentLockStatus); delete repository; - if(res==0 && currentLockStatus>=1 ) + if (res == 0 && (currentLockStatus == 1 || currentLockStatus == 12345) ) { - // code is the default one; no need to request it. - return ETrue; + // code is the default one + RDEBUG("code is the default one; supply as default", 1); + iSecUi_password.Copy(_L("12345")); + // RDEBUG("code is the default one; no need to request it", 1); + // return ETrue; } - /* end check for default code */ + // end check for default code - // Destructor sets thisDestroyed to ETrue - TBool thisDestroyed( EFalse ); - iDestroyedPtr = &thisDestroyed; - - iQueryCanceled = EFalse; - RMobilePhone::TMobilePassword password; RMobilePhone::TMobilePassword required_fourth; - + TInt ret = KErrNone; - TInt err = KErrNone; TInt status = KErrNone; - if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ) && - FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) - { - // Connect to the SCP server, and request the code query - RSCPClient scpClient; - User::LeaveIfError( scpClient.Connect() ); - CleanupClosePushL( scpClient ); - status = scpClient.SecCodeQuery( password, - RSCPClient::SCP_OK_CANCEL, - EFalse, - 0 ); - - if ( status != KErrCancel ) - { - // Set this "true" to indicate that the input wasn't cancelled - ret = ETrue; - } - else + + TInt queryAccepted = KErrCancel; + + while (queryAccepted != KErrNone) + { + RMobilePhone::TMobilePhoneSecurityCode secCodeType; + secCodeType = RMobilePhone::ESecurityCodePhonePassword; + + /* request PIN using QT */ + CSecQueryUi *iSecQueryUi; + RDEBUG("CSecQueryUi", 0); + iSecQueryUi = CSecQueryUi::NewL(); + iQueryCanceled = EFalse; + lAlphaSupported = ESecUiAlphaSupported; + lCancelSupported = ESecUiCancelSupported; + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_sec_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("$")); + title.AppendNum(-1); // Don't know the number of remaining attempts + queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, ESecUiSecretSupported | lAlphaSupported + | lCancelSupported | secCodeType); + RDEBUG("iSecUi_password", 0); + RDEBUGSTR(iSecUi_password); + RDEBUG("delete", 0); + iQueryCanceled = ETrue; + delete iSecQueryUi; + RDEBUG("queryAccepted", queryAccepted); + /* end request PIN using QT */ + if (queryAccepted != KErrNone) { ret = EFalse; + return ret; } - - CleanupStack::PopAndDestroy(); //scpClient - } - else - { - iSecurityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_MAX_LENGTH,ESecUiNone); - #ifdef __COVER_DISPLAY - iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); - CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided - if (covercl) // returns null if __COVER_DISPLAY is not defined - { - // … - add data that cover ui is interested in - covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowSecCode);// adds int to additional data to be posted to cover ui - covercl->BufStream().CommitL(); // no more data to send so commit buf - } - #endif //__COVER_DISPLAY - CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); - CleanupStack::PushL(deviceLockStatusObserver); - err =KErrNone; - TRAP(err,ret = iSecurityDlg->ExecuteLD(R_SECURITY_QUERY)); - CleanupStack::PopAndDestroy(deviceLockStatusObserver); - } - - // check if CSecurityHandler has been "killed" - if ( thisDestroyed ) - { - return EFalse; - } - iDestroyedPtr = NULL; - iSecurityDlg = NULL; + CWait* wait = CWait::NewL(); + RDEBUG("VerifySecurityCode", 0); + iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, required_fourth); + RDEBUG("WaitForRequestL", 0); + status = wait->WaitForRequestL(); + RDEBUG("status", status); + delete wait; +#ifdef __WINS__ + if (status == KErrNotSupported || status == KErrTimedOut) + { + RDEBUG("status", status); + status = KErrNone; + } +#endif - if (err != KErrNone) - { - User::Leave(err); - } - - if (ret) - { - while (!iQueryCanceled) + ret = ETrue; + queryAccepted = KErrCancel; // because it's not yet validated + switch (status) { - if (!FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) - { - RMobilePhone::TMobilePhoneSecurityCode secCodeType; - secCodeType = RMobilePhone::ESecurityCodePhonePassword; - CWait* wait = CWait::NewL(); - iPhone.VerifySecurityCode(wait->iStatus,secCodeType, password, required_fourth); - status = wait->WaitForRequestL(); - delete wait; - - } - - switch(status) - { - case KErrNone: + case KErrNone: + { + if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw) && !(FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements))) { - if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ) && - !(FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements))) - { - RSCPClient scpClient; - User::LeaveIfError( scpClient.Connect() ); - CleanupClosePushL( scpClient ); - - TSCPSecCode newCode; - newCode.Copy( password ); - scpClient.StoreCode( newCode ); + RDEBUG("calling RSCPClient", 0); + RSCPClient scpClient; + User::LeaveIfError(scpClient.Connect()); + CleanupClosePushL(scpClient); - CleanupStack::PopAndDestroy(); //scpClient - } - - iQueryCanceled = ETrue; - return ETrue; - } - case KErrGsmSSPasswordAttemptsViolation: - case KErrLocked: - { - iDestroyedPtr = &thisDestroyed; - // security code blocked! - iNoteDlg = new (ELeave) CAknNoteDialog(REINTERPRET_CAST(CEikDialog**,&iNoteDlg)); - iNoteDlg->SetTimeout(CAknNoteDialog::ELongTimeout); - iNoteDlg->SetTone(CAknNoteDialog::EErrorTone); - err =KErrNone; - TRAP(err,iNoteDlg->ExecuteLD(R_SEC_BLOCKED)); - - // check if CSecurityHandler has been "killed" - if ( thisDestroyed ) - { - return EFalse; - } - - iDestroyedPtr = NULL; - iNoteDlg = NULL; + TSCPSecCode newCode; + RDEBUG("iSecUi_password", 1); + RDEBUGSTR(iSecUi_password); + newCode.Copy(iSecUi_password); + RDEBUG( + "!!!!!!! ***** deprecated **** !!!!! scpClient.StoreCode", + 0); + scpClient.StoreCode(newCode); + RDEBUG("called StoreCode", 1); - if (err != KErrNone) - { - User::Leave(err); - } - break; + CleanupStack::PopAndDestroy(); //scpClient + queryAccepted = KErrNone; } - case KErrGsm0707IncorrectPassword: - case KErrAccessDenied: - { - iDestroyedPtr = &thisDestroyed; - // code was entered erroneusly - iNoteDlg = new (ELeave) CAknNoteDialog(REINTERPRET_CAST(CEikDialog**,&iNoteDlg)); - iNoteDlg->SetTimeout(CAknNoteDialog::ELongTimeout); - iNoteDlg->SetTone(CAknNoteDialog::EErrorTone); - err =KErrNone; - TRAP(err,iNoteDlg->ExecuteLD(R_CODE_ERROR)); - - // check if CSecurityHandler has been "killed" - if ( thisDestroyed ) - { - return EFalse; - } - - iDestroyedPtr = NULL; - iNoteDlg = NULL; - - if (err != KErrNone) - { - User::Leave(err); - } - break; - } - default: - { - iDestroyedPtr = &thisDestroyed; - err =KErrNone; - TRAP(err,ShowGenericErrorNoteL(status)); - - // check if CSecurityHandler has been "killed" - if ( thisDestroyed ) - { - return EFalse; - } - - iDestroyedPtr = NULL; - iNoteDlg = NULL; - - if (err != KErrNone) - { - User::Leave(err); - } - break; - } - } - - if (iQueryCanceled) + + iQueryCanceled = ETrue; + return ETrue; + } + case KErrGsmSSPasswordAttemptsViolation: + case KErrLocked: { - ret = EFalse; + // security code blocked! + CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); break; - } - - password = _L(""); - iDestroyedPtr = &thisDestroyed; - if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ) && - FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) - { - // Connect to the SCP server, and request the code query - RSCPClient scpClient; - User::LeaveIfError( scpClient.Connect() ); - CleanupClosePushL( scpClient ); - status = scpClient.SecCodeQuery( password, - RSCPClient::SCP_OK_CANCEL, - EFalse, - 0 ); - - if ( status != KErrCancel ) - { - // Set this "true" to indicate that the input wasn't cancelled - ret = ETrue; - } - else - { - ret = EFalse; - } - - CleanupStack::PopAndDestroy(); //scpClient - } - else - { - iSecurityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_MAX_LENGTH,ESecUiNone); - CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); - CleanupStack::PushL(deviceLockStatusObserver); - err =KErrNone; - TRAP(err,ret = iSecurityDlg->ExecuteLD(R_SECURITY_QUERY)); - CleanupStack::PopAndDestroy(deviceLockStatusObserver); - } - - // check if CSecurityHandler has been "killed" - if ( thisDestroyed ) + } + case KErrGsm0707IncorrectPassword: + case KErrAccessDenied: { - return EFalse; + // code was entered erroneusly + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + break; } - - iDestroyedPtr = NULL; - iSecurityDlg = NULL; - - if (err != KErrNone) + default: { - User::Leave(err); + CSecuritySettings::ShowResultNoteL(status, CAknNoteDialog::EErrorTone); } - - if (!ret) - break; + } } // while - } // if iQueryCanceled = ETrue; return ret; } // // ---------------------------------------------------------- -// CSecurityHandler::CancelSecCodeQuery() -// Cancels PIN2 and security code queries +// Cancels all security code queries +// aStatus = -1 from destructor +// aStatus = 1 from API. Will kill all dialogs through signal P&S // ---------------------------------------------------------- -// -EXPORT_C void CSecurityHandler::CancelSecCodeQuery() +// qtdone +TInt CSecurityHandler::CancelOpenQuery(TInt aStatus) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::CancelSecCodeQuery()")); - #endif + RDEBUG("aStatus", aStatus); + RDEBUG("iQueryCanceled", iQueryCanceled); + TInt res = 0; + + if (aStatus == 1) // also signal all other dialogs + { + RDEBUG( + "set KSecurityUIsDismissDialog to ESecurityUIsDismissDialogOn", + ESecurityUIsDismissDialogOn); + TInt err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsDismissDialog, ESecurityUIsDismissDialogOn); + RDEBUG("err", err); + res += 1; + } + if (!iQueryCanceled) { + // notify all dialogs, in particular SecUiNotificationDialog::subscriberKSecurityUIsDismissDialogChanged + // this will cancel only the dialog which was opened by same client. + res += 0x10; iQueryCanceled = ETrue; if (iSecurityDlg != NULL) { + RDEBUG("deleting iSecurityDlg", 0); + res += 0x100; delete iSecurityDlg; } if (iNoteDlg != NULL) { + RDEBUG("deleting iNoteDlg", 0); + res += 0x1000; delete iNoteDlg; } iNoteDlg = NULL; iSecurityDlg = NULL; } + res += 0x10000; + RDEBUG("res", res); + return res; + } + +// +// ---------------------------------------------------------- +// CSecurityHandler::CancelSecCodeQuery() +// Cancels PIN2 and security code queries +// this is used by rfsHandler +// ---------------------------------------------------------- +// qtdone +EXPORT_C void CSecurityHandler::CancelSecCodeQuery() + { + RDEBUG("0", 0); + + TInt err = CancelOpenQuery(1); + + RDEBUG("err", err); } // // ---------------------------------------------------------- // CSecurityHandler::AskSecCodeInAutoLock() // for asking security code in autolock // ---------------------------------------------------------- -// +// qtdone EXPORT_C TBool CSecurityHandler::AskSecCodeInAutoLockL() { /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ - - #ifdef __WINS__ - return ETrue; - #else - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL()")); - #endif + * Series 60 Customer / ETel + * Series 60 ETel API + *****************************************************/ + + RDEBUG("0", 0); TInt res; CWait* wait; - + RMobilePhone::TMobilePhoneLockSetting lockChange(RMobilePhone::ELockSetDisabled); RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() get autolock period")); - #endif // get autolock period from Central Repository. CRepository* repository = CRepository::NewL(KCRUidSecuritySettings); @@ -535,650 +440,591 @@ res = repository->Get(KSettingsAutoLockTime, period); delete repository; - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() autolock period:%d"), res); - #endif + RDEBUG("res", res); + RDEBUG("period", period); + if (res == KErrNone) { // disable autolock in Domestic OS side too if autolock period is 0. - if (period == 0 ) + if (period == 0) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() Call SetLockSetting")); - #endif - -#ifdef RD_REMOTELOCK + RDEBUG("period", period); // If remote lock is enabled, don't disable the domestic OS device lock // since that would render the RemoteLock useless. // Instead just re-set the DOS lock to enabled which as a side effect // requests the security code from the user. - TBool remoteLockStatus( EFalse ); + TBool remoteLockStatus(EFalse); CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); - if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) + if (remoteLockSettings->GetEnabled(remoteLockStatus)) { - if ( remoteLockStatus ) + RDEBUG("0", 0); + if (remoteLockStatus) { // Remote lock is enabled - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecurityHandler::AskSecCodeInAutoLockL() - RemoteLock is enabled: lockChange = RMobilePhone::ELockSetEnabled" ) ); - #endif // _DEBUG - lockChange = RMobilePhone::ELockSetEnabled; + RDEBUG("lockChange", lockChange); } else { // Remote lock is disabled - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecurityHandler::AskSecCodeInAutoLockL() - RemoteLock is disabled: lockChange = RMobilePhone::ELockSetDisabled" ) ); - #endif // _DEBUG - lockChange = RMobilePhone::ELockSetDisabled; + RDEBUG("lockChange", lockChange); } } else { // Failed to get remote lock status - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecurityHandler::AskSecCodeInAutoLockL() - Failed to get RemoteLock status" ) ); - #endif // _DEBUG + RDEBUG("Failed", lockChange); } delete remoteLockSettings; remoteLockSettings = NULL; -#else // not defined RD_REMOTELOCK - - lockChange = RMobilePhone::ELockSetDisabled; - -#endif // RD_REMOTELOCK - - wait = CWait::NewL(); - iPhone.SetLockSetting(wait->iStatus,lockType,lockChange); - res = wait->WaitForRequestL(); - delete wait; - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() SetLockSetting RESULT:%d"), res); - #endif - } + RDEBUG("lockChange", lockChange); + wait = CWait::NewL(); + RDEBUG("0", 0); + // this also calls PassPhraseRequiredL ??? + RDEBUG("SetLockSetting", 1); + iPhone.SetLockSetting(wait->iStatus, lockType, lockChange); + res = KErrNone; + RDEBUG("WaitForRequestL", 0); + res = wait->WaitForRequestL(); + RDEBUG("res", res); + delete wait; + } // from period == 0 else - { // ask security code - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() Ask sec code via notifier")); - #endif - RNotifier codeQueryNotifier; - User::LeaveIfError(codeQueryNotifier.Connect()); - CWait* wait = CWait::NewL(); - CleanupStack::PushL(wait); - TInt queryResponse = 0; - TPckg response(queryResponse); - TSecurityNotificationPckg params; - params().iEvent = static_cast(RMobilePhone::EPhonePasswordRequired); - params().iStartup = EFalse; - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() Start Notifier")); - #endif - codeQueryNotifier.StartNotifierAndGetResponse(wait->iStatus, KSecurityNotifierUid,params, response); - res = wait->WaitForRequestL(); - CleanupStack::PopAndDestroy(); // wait - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() results:")); - RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() res:%d"), res); - RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() queryResponse:%d"), queryResponse); - #endif - if(res == KErrNone) - res = queryResponse; - } + { // ask security code + RDEBUG("codeQueryNotifier 0", 0); + RNotifier codeQueryNotifier; + User::LeaveIfError(codeQueryNotifier.Connect()); + CWait* wait = CWait::NewL(); + CleanupStack::PushL(wait); + TInt queryResponse = 0; + TPckg response(queryResponse); + RDEBUG("0", 0); + TSecurityNotificationPckg params; + params().iEvent = static_cast (RMobilePhone::EPhonePasswordRequired); + params().iStartup = EFalse; + + RDEBUG("StartNotifierAndGetResponse", 0); + codeQueryNotifier.StartNotifierAndGetResponse(wait->iStatus, KSecurityNotifierUid, params, response); + // this will eventually call PassPhraseRequiredL + RDEBUG("WaitForRequestL", 0); + res = wait->WaitForRequestL(); + RDEBUG("WaitForRequestL", 1); + RDEBUG("res", res); + CleanupStack::PopAndDestroy(); // wait + if (res == KErrNone) + res = queryResponse; + } // from else period == 0 + RDEBUG("0", 0); } else - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() KERRSOMETHING:Call SetLockSetting")); - #endif - -#ifdef RD_REMOTELOCK + { // can't read repository for KSettingsAutoLockTime + RDEBUG("KERRSOMETHING:Call SetLockSetting", 0); // If remote lock is enabled, don't disable the domestic OS device lock // since that would render the RemoteLock useless. // Instead just re-set the DOS lock to enabled which as a side effect // requests the security code from the user. - TBool remoteLockStatus( EFalse ); + TBool remoteLockStatus(EFalse); CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); - if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) + if (remoteLockSettings->GetEnabled(remoteLockStatus)) { - if ( remoteLockStatus ) + if (remoteLockStatus) { // Remote lock is enabled - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecurityHandler::AskSecCodeInAutoLockL() - Failed to get AutoLock status and RemoteLock is enabled: lockChange = RMobilePhone::ELockSetEnabled" ) ); - #endif // _DEBUG - lockChange = RMobilePhone::ELockSetEnabled; + RDEBUG("lockChange", lockChange); } else { // Remote lock is disabled - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecurityHandler::AskSecCodeInAutoLockL() - Failed to get AutoLock status and RemoteLock is disabled: lockChange = RMobilePhone::ELockSetDisabled" ) ); - #endif // _DEBUG - lockChange = RMobilePhone::ELockSetDisabled; + RDEBUG("lockChange", lockChange); } } else { // Failed to get remote lock status - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecurityHandler::AskSecCodeInAutoLockL() - Failed to get AutoLock status and failed to get RemoteLock status" ) ); - #endif // _DEBUG + RDEBUG("Failed", lockChange); } delete remoteLockSettings; remoteLockSettings = NULL; -#else // not defined RD_REMOTELOCK - - // could not get the current autolock time... disable autolock in Domestic OS side. - lockChange = RMobilePhone::ELockSetDisabled; - -#endif // RD_REMOTELOCK - + RDEBUG("0", 0); wait = CWait::NewL(); - iPhone.SetLockSetting(wait->iStatus,lockType,lockChange); + RDEBUG("SetLockSetting", 0); + iPhone.SetLockSetting(wait->iStatus, lockType, lockChange); + RDEBUG("WaitForRequestL", 0); res = wait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); delete wait; - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() KES: SetLockSetting RESULT:%d"), res); - #endif } - + + RDEBUG("res", res); switch (res) { case KErrNone: { - return ETrue; + return ETrue; } - case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: case KErrGsm0707IncorrectPassword: case KErrAccessDenied: { - return AskSecCodeInAutoLockL(); + RDEBUG("KErrAccessDenied", KErrAccessDenied); + return AskSecCodeInAutoLockL(); + } + case KErrInUse: + { + RDEBUG("KErrInUse", KErrInUse); + return EFalse; + } + case KErrDied: + { + RDEBUG("KErrDied ", KErrDied); + return EFalse; + } + case KErrServerTerminated: + { + RDEBUG("KErrServerTerminated ", KErrServerTerminated); + return EFalse; + } + case KErrServerBusy: + { + RDEBUG("KErrServerBusy ", KErrServerBusy); + return EFalse; } case KErrAbort: + { + RDEBUG("KErrAbort", KErrAbort); + return EFalse; + } case KErrCancel: + { + RDEBUG("KErrCancel", KErrCancel); // user pressed "cancel" return EFalse; + } default: { + RDEBUG("default", res); return AskSecCodeInAutoLockL(); } } -#endif // WINS } // // ---------------------------------------------------------- // CSecurityHandler::PassPhraseRequired() // Handles PassPhraseRequired event // ---------------------------------------------------------- -// +// qtdone TInt CSecurityHandler::PassPhraseRequiredL() { /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL()")); - #endif + * Series 60 Customer / ETel + * Series 60 ETel API + *****************************************************/ + RDEBUG("0", 0); TBool StartUp = iStartup; - RMobilePhone::TMobilePassword password; + RMobilePhone::TMobilePassword iSecUi_password; RMobilePhone::TMobilePassword required_fourth; - TInt status; - TInt autolockState; - TInt err( KErrGeneral ); + TInt queryAccepted = KErrCancel; + + TInt autolockState = 0; + TInt lCancelSupported = 0; + TInt lEmergencySupported = 0; + + TInt err(KErrGeneral); err = RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolockState); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() Autolock Status result: %d"), err); - #endif - if(!StartUp) - User::LeaveIfError( err ); -TBool isConditionSatisfied = EFalse; -TInt tarmFlag=0; -if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) - { - TInt tRet = RProperty::Get( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag ); - - if ( tRet != KErrNone ) + RDEBUG("StartUp", StartUp); + RDEBUG("err", err); + if (!StartUp) + { + RDebug::Printf("%s %s (%u) might leave if StartUp=0 and err=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, err); + User::LeaveIfError(err); + } + TBool isConditionSatisfied = EFalse; + TInt tarmFlag = 0; + if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw)) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL():\ - Warning: failed to get TARM Admin Flag state")); - #endif + TInt tRet = RProperty::Get(KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag); + + if (tRet != KErrNone) + { + RDEBUG("Warning: failed to get TARM Admin Flag state", tRet); + } + else + { + RDEBUG("TARM flag", tarmFlag); + } + + if ((StartUp) || (tarmFlag & KSCPFlagResyncQuery)) + isConditionSatisfied = ETrue; } else { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL(): TARM flag: %d"), tarmFlag ); - #endif - } - - if ( ( StartUp ) || ( tarmFlag & KSCPFlagResyncQuery ) ) - isConditionSatisfied = ETrue; - } - else - { - if (StartUp) - isConditionSatisfied = ETrue; - } + if (StartUp) + isConditionSatisfied = ETrue; + } - // call TARM so that it verifies that configuration is in sync. This might internally accept the (default) lock code, but doesn't dismiss the query. - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) pre isConditionSatisfied=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, isConditionSatisfied ); - #endif - RSCPClient scpClientConfiguration; - User::LeaveIfError( scpClientConfiguration.Connect() ); - CleanupClosePushL( scpClientConfiguration ); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) calling CheckConfiguration KSCPComplete=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, KSCPComplete ); - #endif - TInt finalConfStatus = scpClientConfiguration.CheckConfiguration( KSCPComplete ); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) finalConfStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, finalConfStatus ); - RDebug::Printf( "%s %s (%u) isConditionSatisfied=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, isConditionSatisfied ); - #endif - CleanupStack::PopAndDestroy(); // scpClientConfiguration - - if (isConditionSatisfied) + // Security code at bootup: No "cancel" softkey; Emergency calls enabled. + RMobilePhone::TMobilePhoneSecurityCode secCodeTypeToAsk = RMobilePhone::ESecurityCodePhonePassword; + RDEBUG("isConditionSatisfied", isConditionSatisfied); + if (isConditionSatisfied) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() Dialog 1")); - #endif - // Security code at bootup: No "cancel" softkey; Emergency calls enabled. - if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ) && - FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) - { - // Connect to the SCP server, and request the code query - RSCPClient scpClient; - User::LeaveIfError( scpClient.Connect() ); - CleanupClosePushL( scpClient ); - - status = scpClient.SecCodeQuery( password, - RSCPClient::SCP_OK_ETEL, - ETrue, - KSCPEtelRequest ); - // Note that SecCodeQuery doesn't indicate the return value from the dialog - - CleanupStack::PopAndDestroy(); //scpClient - } - else - { - CCodeQueryDialog* securityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_MAX_LENGTH,ESecUiCodeEtelReqest); - if(AknLayoutUtils::PenEnabled()) - securityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - securityDlg->SetEmergencyCallSupport(ETrue); - #ifdef __COVER_DISPLAY - securityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); - CAknMediatorFacade* covercl = AknMediatorFacade(securityDlg); // uses MOP, so control provided - if (covercl) // returns null if __COVER_DISPLAY is not defined - { - // … - add data that cover ui is interested in - covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowSecCode); // adds int to additional data to be posted to cover ui - covercl->BufStream().CommitL(); // no more data to send so commit buf - } - #endif //__COVER_DISPLAY - status = securityDlg->ExecuteLD(R_SECURITY_REQUEST_QUERY); - } + // starter or special TARM. NoCancel+Emergency + lCancelSupported = ESecUiCancelNotSupported; + lEmergencySupported = ESecUiEmergencySupported; } - else if ( (autolockState > EAutolockOff)) + else if (autolockState > EAutolockOff) + { + // from unlock. Cancel+Emergency + lCancelSupported = ESecUiCancelSupported; + lEmergencySupported = ESecUiEmergencySupported; + } + else { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() Dialog 2")); - #endif - // Autolock is On. Security event came from user pressing "unlock". - // Emergency call support must be enabled and there must be a "cancel" softkey. - if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ) && - FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) - { - // Connect to the SCP server, and request the code query - RSCPClient scpClient; - User::LeaveIfError( scpClient.Connect() ); - CleanupClosePushL( scpClient ); - - status = scpClient.SecCodeQuery( password, - RSCPClient::SCP_OK_CANCEL, - ETrue, - KSCPEtelRequest ); - // Note that SecCodeQuery doesn't indicate the return value from the dialog - - CleanupStack::PopAndDestroy(); //scpClient - } - else - { - CCodeQueryDialog* securityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_MAX_LENGTH,ESecUiNone); - if(AknLayoutUtils::PenEnabled()) - securityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - securityDlg->SetEmergencyCallSupport(ETrue); - #ifdef __COVER_DISPLAY - securityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); - CAknMediatorFacade* covercl = AknMediatorFacade(securityDlg); // uses MOP, so control provided - if (covercl) // returns null if __COVER_DISPLAY is not defined - { - // … - add data that cover ui is interested in - covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowSecCode); // adds int to additional data to be posted to cover ui - covercl->BufStream().CommitL(); // no more data to send so commit buf - } - #endif //__COVER_DISPLAY - status = securityDlg->ExecuteLD(R_SECURITY_QUERY); - } + // from settings. Cancel+NoEmergency + lCancelSupported = ESecUiCancelSupported; + lEmergencySupported = ESecUiEmergencyNotSupported; } - else + + CSecQueryUi *iSecQueryUi; + iSecQueryUi = CSecQueryUi::NewL(); + iQueryCanceled = EFalse; + TInt lType = ESecUiSecretSupported | ESecUiAlphaSupported | lCancelSupported | lEmergencySupported | secCodeTypeToAsk; + RDEBUG("lType", lType); + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_sec_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, lType); + RDEBUG("iSecUi_password", 0); + RDEBUGSTR(iSecUi_password); + RDEBUG("queryAccepted", queryAccepted); + iQueryCanceled = ETrue; + delete iSecQueryUi; + + TBool wasCancelledOrEmergency = EFalse; + RDEBUG("KFeatureIdSapDeviceLockEnhancements", + KFeatureIdSapDeviceLockEnhancements); + if ((queryAccepted == KErrAbort /* =emergency */) || (queryAccepted == KErrCancel)) + wasCancelledOrEmergency = ETrue; + RDEBUG("wasCancelledOrEmergency", wasCancelledOrEmergency); + if (wasCancelledOrEmergency) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() Dialog 3")); - #endif - // Code query due to a setting change; "Cancel" softkey active; - // no emergency call support. - if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ) && - FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) - { - // Connect to the SCP server, and request the code query - RSCPClient scpClient; - User::LeaveIfError( scpClient.Connect() ); - CleanupClosePushL( scpClient ); - - status = scpClient.SecCodeQuery( password, - RSCPClient::SCP_OK_CANCEL, - EFalse, - KSCPEtelRequest ); - // Note that SecCodeQuery doesn't indicate the return value from the dialog - - CleanupStack::PopAndDestroy(); //scpClient - } - else - { - iSecurityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_MAX_LENGTH,ESecUiNone); - #ifdef __COVER_DISPLAY - iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); - CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided - if (covercl) // returns null if __COVER_DISPLAY is not defined - { - covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowSecCode); // adds int to additional data to be posted to cover ui - covercl->BufStream().CommitL(); // no more data to send so commit buf - } - #endif //__COVER_DISPLAY - // read a flag to see whether the query is SecUi originated. - TInt secUiOriginatedQuery(ESecurityUIsETelAPIOriginated); - RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); - CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); - CleanupStack::PushL(deviceLockStatusObserver); - CSecUiLockObserver* queryStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg, ESecUiRequestStateObserver); - CleanupStack::PushL(queryStatusObserver); - CSecUiLockObserver* callStatusObserver = NULL; - if(secUiOriginatedQuery == ESecurityUIsSystemLockOriginated) - { - callStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg, ESecUiCallStateObserver); - CleanupStack::PushL(callStatusObserver); - } - status = iSecurityDlg->ExecuteLD(R_SECURITY_QUERY); - - if(callStatusObserver == NULL) - CleanupStack::PopAndDestroy(2); //deviceLockStatusObserver, queryStatusObserver - else - CleanupStack::PopAndDestroy(3); //deviceLockStatusObserver, queryStatusObserver, callStatusObserver - iSecurityDlg = NULL; - } - } -TBool isCondition = EFalse; -if(!FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) -{ - if (!status || (status == ESecUiEmergencyCall) - || (status == EAknSoftkeyEmergencyCall) || (status == ESecUiDeviceLocked)) - isCondition = ETrue; -} -else -{ - if ( ( status == KErrCancel ) || (status == ESecUiEmergencyCall) || - (status == EAknSoftkeyEmergencyCall) || (status == ESecUiDeviceLocked)) - isCondition = ETrue; -} - if (isCondition) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() DIALOG ERROR")); - #endif + RDEBUG("StartUp", StartUp); if (!StartUp) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() ABORT CALLED!!!!!!")); - #endif + RDEBUG("AbortSecurityCode", 0); iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePhonePassword); + RDEBUG("AbortSecurityCode", 1); } return KErrCancel; } RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePhonePassword; - CWait* wait = NULL; -if(!FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) -{ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() VerifySecurityCode")); - #endif + CWait* wait = NULL; + TInt status = KErrNone; + + // Validate the code using SCP. This is needed to check expiration + RDEBUG("AbortSecurityCode", 0); + RSCPClient scpClient; + RDEBUG("scpClient.Connect", 0); + TInt tRet = scpClient.Connect(); + RDEBUG("tRet", tRet); + + CleanupClosePushL(scpClient); + + RArray aFailedPolicies; + TDevicelockPolicies failedPolicy; + TInt retLockcode = KErrNone; + RMobilePhone::TMobilePassword aISACode; + TInt aFlags = 0; + RDEBUG("scpClient.VerifyCurrentLockcode", 0); + // this validate on ISA . No need to do iPhone.VerifySecurityCode + retLockcode = scpClient.VerifyCurrentLockcode(iSecUi_password, aISACode, aFailedPolicies, aFlags); + RDEBUG("retLockcode", retLockcode); + + RDEBUG("aISACode", 0); + RDEBUGSTR(aISACode); + + RDEBUG("aFailedPolicies.Count()", aFailedPolicies.Count()); + RDEBUG("EDeviceLockPasscodeExpiration", EDeviceLockPasscodeExpiration); // 8 + TInt failedEDeviceLockPasscodeExpiration = 0; + for (TInt i = 0; i < aFailedPolicies.Count(); i++) + { + failedPolicy = aFailedPolicies[i]; + RDEBUG("failedPolicy", failedPolicy); + if (failedPolicy == EDeviceLockPasscodeExpiration) + failedEDeviceLockPasscodeExpiration = EDeviceLockPasscodeExpiration; + } + RDEBUG("Close", 0); + scpClient.Close(); + RDEBUG("PopAndDestroy", 0); + CleanupStack::PopAndDestroy(); //scpClient + + RDEBUG("failedEDeviceLockPasscodeExpiration", failedEDeviceLockPasscodeExpiration); + if (failedEDeviceLockPasscodeExpiration > 0) + { + // the password has expired. Note that it has NOT been validated. It will be revalidated inside ChangeSecCodeParamsL + RMobilePhone::TMobilePassword iNewPassword; + TInt iFlags = 0; + iNewPassword.Copy(_L("")); + TBuf<0x80> iCaption; + iCaption.Copy(_L("ChangeSecCodeL")); // no need to translate because it's not used + TInt iShowError = 1; + CSecuritySettings* iSecSettings; + iSecSettings = CSecuritySettings::NewL(); + TSecUi::InitializeLibL(); + RDEBUG("calling ChangeSecCodeParamsL", 0); + status = iSecSettings->ChangeSecCodeParamsL(iSecUi_password, iNewPassword, iFlags, iCaption, iShowError); + // note that it might have been aborted. The error KErrAbort is shown in this method, not inside ChangeSecCodeParamsL + if(status==KErrAccessDenied || status==KErrGsm0707IncorrectPassword) + { + // the password expired, but the user typed wrongly. The error was already displayed. + RDEBUG("SCP returned ", KErrAccessDenied); + status=R_CODES_DONT_MATCH; + RDEBUG("SCP changed to R_CODES_DONT_MATCH", R_CODES_DONT_MATCH); + } + RDEBUG("status", status); + RDEBUG("iNewPassword", 0); + RDEBUGSTR(iNewPassword); + TSecUi::UnInitializeLib(); + RDEBUG("deleting iSecSettings", 0); + delete iSecSettings; + RDEBUG("deleted iSecSettings", 1); + } + else + { + RDEBUG( "wait", 0 ); wait = CWait::NewL(); - iPhone.VerifySecurityCode(wait->iStatus,secCodeType, password, required_fourth); + RDEBUG("VerifySecurityCode", 0); + iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, required_fourth); + RDEBUG("WaitForRequestL", + 0); status = wait->WaitForRequestL(); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() VerifySecurityCode STATUS: %d"), status); - #endif + RDEBUG("WaitForRequestL status", + status); delete wait; - } - else - { - wait = NULL; - } - +#ifdef __WINS__ + if (status == KErrNotSupported || status == KErrTimedOut) + { + RDEBUG( "status", status ); + status = KErrNone; + } +#endif + } + TInt returnValue = status; - switch(status) - { + RDEBUG("tarmFlag", tarmFlag); + RDEBUG("StartUp", StartUp); + RDEBUG("status", status); + switch (status) + { case KErrNone: - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() KErrNone")); - #endif - // code approved - if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw)) - { + // code approved + { + RDEBUG("KErrNone", KErrNone); + if( failedEDeviceLockPasscodeExpiration > 0) + { + RDEBUG("code has just been changed. No need to show Confirmation note. failedEDeviceLockPasscodeExpiration", failedEDeviceLockPasscodeExpiration); + } + else + { + CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone); + } + RDEBUG("R_CONFIRMATION_NOTE", R_CONFIRMATION_NOTE); + if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw)) + { + RDEBUG("KFeatureIdSapTerminalControlFw", + KFeatureIdSapTerminalControlFw); // Unset the admin flag if set - if ( tarmFlag & KSCPFlagResyncQuery ) + if (tarmFlag & KSCPFlagResyncQuery) { - TInt tRet = RProperty::Get( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag ); - - if ( tRet == KErrNone ) - { - tarmFlag &= ~KSCPFlagResyncQuery; - tRet = RProperty::Set( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag ); - } - - if ( tRet != KErrNone ) + TInt tRet = RProperty::Get(KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag); + + if (tRet == KErrNone) + { + tarmFlag &= ~KSCPFlagResyncQuery; + tRet = RProperty::Set(KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag); + } + + if (tRet != KErrNone) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL():\ - FAILED to unset TARM Admin Flag")); - #endif - } - } - if(!FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) - { - RSCPClient scpClient; - User::LeaveIfError( scpClient.Connect() ); - CleanupClosePushL( scpClient ); - TSCPSecCode newCode; - newCode.Copy( password ); - scpClient.StoreCode( newCode ); - CleanupStack::PopAndDestroy(); //scpClient + RDEBUG( + "FAILED to unset TARM Admin Flag tRet=", + tRet); + } + } + if (!FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) + { + RDEBUG("KFeatureIdSapDeviceLockEnhancements", KFeatureIdSapDeviceLockEnhancements); + RSCPClient scpClient; + RDEBUG("scpClient.Connect", 0); + TInt tRet = scpClient.Connect(); + RDEBUG("tRet", tRet); + User::LeaveIfError(tRet); + RDEBUG("scpClient.Connect", 1); + CleanupClosePushL(scpClient); + TSCPSecCode newCode; + newCode.Copy(iSecUi_password); + RDEBUG( + "!!!!!!! ***** TODO deprecated **** !!!!! scpClient.StoreCode", + 0); + scpClient.StoreCode(newCode); + RDEBUG("scpClient.StoreCode", 1); + // TODO check whether code is expired. + // This should be done by TARM, and they should ask to change the code + CleanupStack::PopAndDestroy(); //scpClient + } + } - - } - + RDEBUG("StartUp", StartUp); if (StartUp) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL()KErrNone: Startup; get autolock period.")); - #endif - // get autolock period from Central Repository. CRepository* repository = CRepository::NewL(KCRUidSecuritySettings); TInt period = 0; TInt res = repository->Get(KSettingsAutoLockTime, period); delete repository; - - _LIT_SECURITY_POLICY_PASS(KReadPolicy); - _LIT_SECURITY_POLICY_C1(KWritePolicy, ECapabilityWriteDeviceData); - RProperty::Define(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, RProperty::EInt, KReadPolicy, KWritePolicy); + RDEBUG("res", res); + RDEBUG("period", period); + _LIT_SECURITY_POLICY_PASS( KReadPolicy); + _LIT_SECURITY_POLICY_C1(KWritePolicy, + ECapabilityWriteDeviceData); + RProperty::Define(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, RProperty::EInt, KReadPolicy, KWritePolicy); RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOff); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() EAutolockOff")); - #endif + RDEBUG("KCoreAppUIsAutolockStatus", + KCoreAppUIsAutolockStatus); if (res == KErrNone) { // disable autolock in Domestic OS side too if autolock period is 0. - if (period == 0 ) + if (period == 0) { -#ifdef RD_REMOTELOCK - // If remote lock is enabled, don't disable the domestic OS device lock + // Don't disable the domestic OS device lock // since that would render the RemoteLock useless. - TBool remoteLockStatus( EFalse ); + TBool remoteLockStatus(EFalse); CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); - if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) + if (remoteLockSettings->GetEnabled(remoteLockStatus)) { - if ( !remoteLockStatus ) + if (!remoteLockStatus) { // Remote lock is disabled - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecurityHandler::PassPhraseRequiredL() - Autolock and RemoteLock are disabled -> disable DOS device lock" ) ); - #endif // _DEBUG - + RDEBUG( + "Autolock and RemoteLock are disabled -> disable DOS device lock", + 0); // Disable DOS device lock setting + RDEBUG( + "iCustomPhone.DisablePhoneLock", + 0); wait = CWait::NewL(); - iCustomPhone.DisablePhoneLock(wait->iStatus,password); - wait->WaitForRequestL(); + iCustomPhone.DisablePhoneLock(wait->iStatus, iSecUi_password); + RDEBUG("WaitForRequestL", 0); + status = wait->WaitForRequestL(); + RDEBUG("WaitForRequestL", status); delete wait; } } else { // Failed to get remote lock status - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecurityHandler::PassPhraseRequiredL() - Autolock is disabled, but failed to get RemoteLock status, so do nothing." ) ); - #endif // _DEBUG + RDEBUG( + "Autolock is disabled, but failed to get RemoteLock status, so do nothing", + 0); } delete remoteLockSettings; remoteLockSettings = NULL; -#else // not defined RD_REMOTELOCK - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL()KErrNone: Startup; DisablePhoneLock.")); - #endif - wait = CWait::NewL(); - iCustomPhone.DisablePhoneLock(wait->iStatus,password); - wait->WaitForRequestL(); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL()KErrNone: Startup; DisablePhoneLock completed.")); - #endif - delete wait; -#endif // RD_REMOTELOCK } } - else + else // error getting repository { -#ifdef RD_REMOTELOCK - // If remote lock is enabled, don't disable the domestic OS device lock + RDEBUG("error getting repository", 0); + // Don't disable the domestic OS device lock // since that would render the RemoteLock useless. - TBool remoteLockStatus( EFalse ); + TBool remoteLockStatus(EFalse); CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); - if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) + if (remoteLockSettings->GetEnabled(remoteLockStatus)) { - if ( !remoteLockStatus ) + if (!remoteLockStatus) { // Remote lock is disabled - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecurityHandler::PassPhraseRequiredL() - Failed to get Autolock period and RemoteLock is disabled -> disable DOS device lock" ) ); - #endif // _DEBUG - + RDEBUG("iCustomPhone.DisablePhoneLock", 0); wait = CWait::NewL(); - iCustomPhone.DisablePhoneLock(wait->iStatus,password); - wait->WaitForRequestL(); + iCustomPhone.DisablePhoneLock(wait->iStatus, iSecUi_password); + RDEBUG("WaitForRequestL", 0); + status = wait->WaitForRequestL(); + RDEBUG("WaitForRequestL status", status); delete wait; } } else { // Failed to get remote lock status - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecurityHandler::PassPhraseRequiredL() - Failed to get Autolock period and RemoteLock status, so do nothing." ) ); - #endif // _DEBUG + RDEBUG( + "Failed to get Autolock period and RemoteLock status, so do nothing", + 0); } delete remoteLockSettings; remoteLockSettings = NULL; -#else // not defined RD_REMOTELOCK + } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL()KErrNone: Startup; Could not get autolock period.")); - #endif - // could not get the current autolock time... disable autolock in Domestic OS side. - wait = CWait::NewL(); - iCustomPhone.DisablePhoneLock(wait->iStatus,password); - wait->WaitForRequestL(); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL()KErrNone: Startup; NO AUTOLOCK PERIOD; DisablePhoneLock completed.")); - #endif - delete wait; - -#endif // RD_REMOTELOCK - } - - } - - break; + } // no Startup + } + break; case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: + { // security code blocked! - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() ErrGsmSSPasswordAttemptsViolation")); - #endif + RDEBUG("KErrLocked", KErrLocked) + ; CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); + } break; case KErrGsm0707IncorrectPassword: case KErrAccessDenied: - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() KErrGsm0707IncorrectPassword")); - #endif + { + RDEBUG("KErrAccessDenied", KErrAccessDenied); + // The Settings caller might retry CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + } + break; + case R_CODES_DONT_MATCH: // if password was supposed to be changed, but it failed (the initial verification) + { + RDEBUG("R_CODES_DONT_MATCH", R_CODES_DONT_MATCH); + // Error was already displayed + returnValue = KErrAccessDenied; + } break; default: - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() DEFAULT")); - #endif + { + RDEBUG("default", status); CSecuritySettings::ShowErrorNoteL(status); + // The Settings caller might retry + } break; } - + RDEBUG("returnValue", returnValue); return returnValue; } // @@ -1186,208 +1032,166 @@ // CSecurityHandler::Pin1Required() // Handles Pin1Required event // ---------------------------------------------------------- -// +// qtdone TInt CSecurityHandler::Pin1RequiredL() { /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ - - RMobilePhone::TMobilePassword password; + * Series 60 Customer / ETel + * Series 60 ETel API + *****************************************************/ + RDEBUG("0", 0); + + RMobilePhone::TMobilePassword iSecUi_password; + TInt lCancelSupported = ESecUiCancelNotSupported; + TInt lEmergencySupported = ESecUiEmergencyNotSupported; + TInt queryAccepted = KErrCancel; + TInt lAlphaSupported = 0; RMobilePhone::TMobilePassword required_fourth; RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePin1; RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); - TBool StartUp = ETrue; + TBool StartUp = ETrue; TInt secUiOriginatedQuery(ESecurityUIsSecUIOriginatedUninitialized); TInt err = KErrNone; TInt res = KErrGeneral; CWait* wait = CWait::NewL(); CleanupStack::PushL(wait); - + RDEBUG("0", 0); StartUp = iStartup; - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin1RequiredL()")); - #endif - - if(!StartUp) - { - // read a flag to see whether the query is SecUi originated. + RDEBUG("StartUp", StartUp); + if (!StartUp) + { + // read a flag to see whether the query is SecUi originated. For example, from CSecuritySettings::ChangePinRequestParamsL err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); - - if ( err != KErrNone ) + if (err != KErrNone) + { + RDEBUG("FAILED to get the SECUI query Flag err", err); + } + } + RDEBUG("err", err); + RDEBUG("secUiOriginatedQuery", secUiOriginatedQuery); + RDEBUG("ESecurityUIsSecUIOriginated", ESecurityUIsSecUIOriginated); + if (StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) || (err != KErrNone)) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin1RequiredL():\ - FAILED to get the SECUI query Flag: %d"), err); - #endif + RDEBUG("0", 0); + lCancelSupported = ESecUiCancelNotSupported; + lEmergencySupported = ESecUiEmergencySupported; } else - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin1RequiredL():\ - SECUI query Flag: %d"), secUiOriginatedQuery); - #endif - } - } - #if defined(_DEBUG) - RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() Execute dlg")); - #endif + { + lCancelSupported = ESecUiCancelSupported; + lEmergencySupported = ESecUiEmergencyNotSupported; + // it will be RMobilePhone::ESecurityCodePin1 , equivalent to ESecUiNone + } + wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); + RDEBUG("GetSecurityCodeInfo", 0); + iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); + res = wait->WaitForRequestL(); - if(StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) || (err != KErrNone)) - { - iSecurityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiCodeEtelReqest); - if(AknLayoutUtils::PenEnabled()) - iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - iSecurityDlg->SetEmergencyCallSupport(ETrue); - #ifdef __COVER_DISPLAY - iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); - CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided - if (covercl) // returns null if __COVER_DISPLAY is not defined - { - // … - add data that cover ui is interested in - covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowPIN1); // adds int to additional data to be posted to cover ui - covercl->BufStream().CommitL(); // no more data to send so commit buf - } - #endif //__COVER_DISPLAY + RDEBUG("res", res); +#ifdef __WINS__ + RDEBUG("emulator can't read PIN attempts", res); + res = KErrNone; + codeInfo.iRemainingEntryAttempts = 3; +#endif + User::LeaveIfError(res); + + RDEBUG("codeInfo.iRemainingEntryAttempts", + codeInfo.iRemainingEntryAttempts); + if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) + codeInfo.iRemainingEntryAttempts = -1; - wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); - iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); - res = wait->WaitForRequestL(); - #if defined(_DEBUG) - TInt attempts(codeInfo.iRemainingEntryAttempts); - RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() Remaining Attempts query status: %d"), res); - RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() Remaining Attempts: %d"), attempts); - #endif - User::LeaveIfError(res); - - if( codeInfo.iRemainingEntryAttempts >= KMaxNumberOfPINAttempts ) - res = iSecurityDlg->ExecuteLD(R_PIN_REQUEST_QUERY); - else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PIN_ATTEMPTS, codeInfo.iRemainingEntryAttempts); - res = iSecurityDlg->ExecuteLD(R_PIN_REQUEST_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - else - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PIN_ATTEMPT); - res = iSecurityDlg->ExecuteLD(R_PIN_REQUEST_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - - iSecurityDlg = NULL; - #if defined(_DEBUG) - RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() Execute dlg RESULT: %d"), res); - #endif - if ((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) - { - #if defined(_DEBUG) - RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() R_PIN_REQUEST_QUERY CANCEL!")); - #endif - CleanupStack::PopAndDestroy(wait); - return KErrCancel; - } - } - else - { - iSecurityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - #ifdef __COVER_DISPLAY - iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); - CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided - if (covercl) // returns null if __COVER_DISPLAY is not defined - { - // … - add data that cover ui is interested in - covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowPIN1); // adds int to additional data to be posted to cover ui - covercl->BufStream().CommitL(); // no more data to send so commit buf - } - #endif //__COVER_DISPLAY - - wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); - iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); - res = wait->WaitForRequestL(); - User::LeaveIfError(res); - - CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); - CleanupStack::PushL(deviceLockStatusObserver); - CSecUiLockObserver* queryStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg, ESecUiRequestStateObserver); - CleanupStack::PushL(queryStatusObserver); - - if( codeInfo.iRemainingEntryAttempts >= KMaxNumberOfPINAttempts ) - res = iSecurityDlg->ExecuteLD(R_PIN_QUERY); - else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PIN_ATTEMPTS, codeInfo.iRemainingEntryAttempts ); - res = iSecurityDlg->ExecuteLD(R_PIN_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - else - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PIN_ATTEMPT); - res = iSecurityDlg->ExecuteLD(R_PIN_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - - CleanupStack::PopAndDestroy(2); //deviceLockStatusObserver, queryStatusObserver - iSecurityDlg = NULL; - if( !res || (res == ESecUiDeviceLocked)) - { - #if defined(_DEBUG) - RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() R_PIN_QUERY cancel!")); - #endif - // cancel code request - iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePin1); - CleanupStack::PopAndDestroy(wait); - return KErrCancel; - } - } - #if defined(_DEBUG) - RDebug::Print(_L("CSecurityNotifier::Pin1RequiredL()VerifySecurityCode")); - #endif - iPhone.VerifySecurityCode(wait->iStatus,secCodeType, password, required_fourth); + /* request PIN using QT */ + CSecQueryUi *iSecQueryUi; + RDEBUG("CSecQueryUi", 0); + iSecQueryUi = CSecQueryUi::NewL(); + iQueryCanceled = EFalse; + RDEBUG("SecQueryDialog", 1); + // ESecUiCodeEtelReqest/ESecUiNone might be useful + lAlphaSupported = ESecUiAlphaNotSupported; + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("$")); + title.AppendNum(codeInfo.iRemainingEntryAttempts); + TInt amode = ESecUiSecretSupported | lAlphaSupported | lCancelSupported | lEmergencySupported | secCodeType; + RDEBUG("amode", amode); + queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, amode); + RDEBUG("iSecUi_password", 0); + RDEBUGSTR(iSecUi_password); + iQueryCanceled = ETrue; + delete iSecQueryUi; + RDEBUG("queryAccepted", queryAccepted); + /* end request PIN using QT */ + + if (queryAccepted == KErrAbort) // emergency call + { + RDEBUG("queryAccepted", queryAccepted); + CleanupStack::PopAndDestroy(wait); // this is needed + return KErrCancel; + } + if (lCancelSupported && (queryAccepted == KErrCancel)) + { + // cancel code request + RDEBUG("AbortSecurityCode", 0); + iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePin1); + RDEBUG("AbortSecurityCode", 1); + CleanupStack::PopAndDestroy(wait); // this is needed + return KErrCancel; + } + + RDEBUG("iSecUi_password", 0); + RDEBUGSTR(iSecUi_password); + RDEBUG("VerifySecurityCode", 0); + iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, required_fourth); + RDEBUG("WaitForRequestL", 0); res = wait->WaitForRequestL(); - CleanupStack::PopAndDestroy(wait); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin1RequiredL() VerifySecurityCode STATUS: %d"), res); - #endif + RDEBUG("WaitForRequestL res", res); + CleanupStack::PopAndDestroy(wait); + TInt returnValue = res; - switch(res) - { + switch (res) + { case KErrNone: - // code approved - #if defined(_DEBUG) - RDebug::Print(_L("CSecurityHandler::Pin1RequiredL()code approved ")); - #endif - CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone); + // code approved + RDEBUG("code approved", res) + ; + if (lCancelSupported == ESecUiCancelNotSupported) + { // OK note is not displayed in boot-up, to make things faster + CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone); + } break; case KErrGsm0707IncorrectPassword: case KErrAccessDenied: // code was entered erroneously CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); - if(StartUp) - { - returnValue = Pin1RequiredL(); - } + if (StartUp) + { + returnValue = Pin1RequiredL(); + } break; case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: // code blocked; show error note and terminate. - // code blocked - if(StartUp) - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + // what if not during Startup? Probably it's Ok since the SIM would had also failed at StartUp + if (StartUp) + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); break; case KErrGsm0707SimWrong: // sim lock active + // no error? This is strange break; default: - CSecuritySettings::ShowErrorNoteL(res); - if(StartUp) - { - returnValue = Pin1RequiredL(); + { + CSecuritySettings::ShowErrorNoteL(res); + if (StartUp) + { + returnValue = Pin1RequiredL(); + } } break; } @@ -1397,178 +1201,180 @@ // ---------------------------------------------------------- // CSecurityHandler::Puk1Required() // Handles Puk1Required event +// First asks the PUK1, then verifies, then the newPIN + re-type , and then writes . This is odd, but the API needs the PUK and newPIN in same step. +// Afterwards, the PIN1 might be asked (because the initial program still needs it) // ---------------------------------------------------------- -// +// qtdone TInt CSecurityHandler::Puk1RequiredL() { /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL()")); - #endif - RMobilePhone::TMobilePassword aPassword; - RMobilePhone::TMobilePassword aNewPassword; + * Series 60 Customer / ETel + * Series 60 ETel API + *****************************************************/ + RDEBUG("0", 0); + TInt queryAccepted = KErrCancel; + RMobilePhone::TMobilePassword puk1_password; + RMobilePhone::TMobilePassword aNewPinPassword; RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); RMobilePhone::TMobilePhoneSecurityCode blockCodeType; blockCodeType = RMobilePhone::ESecurityCodePuk1; CWait* wait = CWait::NewL(); CleanupStack::PushL(wait); - + TBool StartUp(ETrue); StartUp = iStartup; - TInt res(KErrNone); + TInt res(KErrCancel); // for the first try wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Get Code info")); - #endif - iPhone.GetSecurityCodeInfo(wait->iStatus, blockCodeType, codeInfoPkg); - res = wait->WaitForRequestL(); - + TInt thisTry = 0; - // If there was a problem (as there might be in case we're dropping off SIM Access Profile); try again a couple of times. - while ( res != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) + // If there was a problem (as there might be in case we're dropping off SIM Access Profile); try again a couple of times. + while (res != KErrNone && (thisTry++) <= KTriesToConnectServer) { - User::After( KTimeBeforeRetryingRequest ); + if (thisTry > 0) + User::After(KTimeBeforeRetryingRequest); + RDEBUG("GetSecurityCodeInfo", 0); iPhone.GetSecurityCodeInfo(wait->iStatus, blockCodeType, codeInfoPkg); + RDEBUG("WaitForRequestL", 0); res = wait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Get Code info result: %d"), res); - #endif - //If there's still an error we're doomed. Bail out. + RDEBUG("res", res); + // If there's still an error we're doomed. Bail out. User::LeaveIfError(res); - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Show last note")); - #endif - //show the last "Code Error" note of PIN verify result here so it won't be left under the PUK1 dialog - if(!StartUp && (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts)) + + RDEBUG("StartUp", StartUp); + RDEBUG("codeInfo.iRemainingEntryAttempts", + codeInfo.iRemainingEntryAttempts); + TInt attempts(codeInfo.iRemainingEntryAttempts); + RDEBUG("attempts", attempts); + // show the last "Code Error" note of PIN verify result here so it won't be left under the PUK1 dialog + if (!StartUp && (attempts == KMaxNumberOfPUKAttempts)) CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); - - // ask PUK code - iSecurityDlg = new (ELeave) CCodeQueryDialog (aPassword,SEC_C_PUK_CODE_MIN_LENGTH,SEC_C_PUK_CODE_MAX_LENGTH,ESecUiPukRequired); - if(AknLayoutUtils::PenEnabled()) - iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - iSecurityDlg->SetEmergencyCallSupport(ETrue); - #ifdef __COVER_DISPLAY - iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); - CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided - if (covercl) // returns null if __COVER_DISPLAY is not defined - { - // … - add data that cover ui is interested in - covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowPUK1); // adds int to additional data to be posted to cover ui - covercl->BufStream().CommitL(); // no more data to send so commit buf - } - #endif //__COVER_DISPLAY - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Show dialog")); - #endif - if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts) - res = iSecurityDlg->ExecuteLD(R_PUK_REQUEST_QUERY); - else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PUK_ATTEMPTS, codeInfo.iRemainingEntryAttempts); - res = iSecurityDlg->ExecuteLD(R_PUK_REQUEST_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - else - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PUK_ATTEMPT); - res = iSecurityDlg->ExecuteLD(R_PUK_REQUEST_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - - if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) + + if (attempts == KMaxNumberOfPINAttempts) + attempts = -1; + + CSecQueryUi *iSecQueryUi; + RDEBUG("CSecQueryUi", 0); + iSecQueryUi = CSecQueryUi::NewL(); + iQueryCanceled = EFalse; + RDEBUG("SecQueryDialog", 1); + // ESecUiCodeEtelReqest/ESecUiNone might be useful + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_puk_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("$")); + title.AppendNum(attempts); + TInt lSecUiCancelSupported = ESecUiCancelSupported | ESecUiEmergencyNotSupported; + if (StartUp) // how to know whether PUK comes from failing at Starter, or failing at any other PIN (i.e. changing PIN, or changing PIN-request) ??? + lSecUiCancelSupported = ESecUiCancelNotSupported | ESecUiEmergencySupported; + queryAccepted = iSecQueryUi->SecQueryDialog(title, puk1_password, SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, ESecUiSecretNotSupported | ESecUiAlphaNotSupported + | lSecUiCancelSupported | ESecUiPukRequired); + RDEBUG("puk1_password", 0); + RDEBUGSTR(puk1_password); + iQueryCanceled = ETrue; + delete iSecQueryUi; + RDEBUG("queryAccepted", queryAccepted); + + if ((queryAccepted == KErrAbort) || (queryAccepted == KErrCancel)) + { + CleanupStack::PopAndDestroy(wait); // this is needed + return KErrCancel; + } + + // send code + // first we verify the puk. For this, we reset the PIN to the same as the PUK + // Hopefully this will never fail in the case "new PIN too long" + RDEBUG("VerifySecurityCode", 0); + iPhone.VerifySecurityCode(wait->iStatus, blockCodeType, puk1_password, puk1_password); + RDEBUG("WaitForRequestL", 0); + res = wait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); + CleanupStack::PopAndDestroy(wait); + + TInt returnValue = res; + switch (res) + { + case KErrNone: + // code approved -> note . The process continue and new-pin is requested + CSecuritySettings::ShowResultNoteL(res, CAknNoteDialog::EConfirmationTone); + break; + case KErrGsm0707IncorrectPassword: + case KErrAccessDenied: + // wrong PUK code -> note -> ask PUK code again + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + returnValue = Puk1RequiredL(); + break; + case KErrGsm0707SimWrong: + // sim lock active + // no message ? + break; + case KErrGsmSSPasswordAttemptsViolation: + case KErrLocked: + // sim card rejected. + break; + default: + CSecuritySettings::ShowErrorNoteL(res); + returnValue = Puk1RequiredL(); + break; + } + + // Now the PUK1 is validated. It's time for asking the new PIN1 + RDEBUG("new wait", 0); + wait = CWait::NewL(); + CleanupStack::PushL(wait); + { + // new-pin query + CSecQueryUi * iSecQueryUi; + RDEBUG("CSecQueryUi", 0); + iSecQueryUi = CSecQueryUi::NewL(); + iQueryCanceled = EFalse; + RDEBUG("SecQueryDialog", 1); + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_pin_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("|")); + HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_verify_new_pin_code")); + title.Append(stringHolder2->Des()); + CleanupStack::PopAndDestroy(stringHolder2); + queryAccepted = iSecQueryUi->SecQueryDialog(title, aNewPinPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported + | ESecUiPukRequired); + RDEBUG("aNewPinPassword", 0); + RDEBUGSTR(aNewPinPassword); + iQueryCanceled = ETrue; + delete iSecQueryUi; + RDEBUG("queryAccepted", queryAccepted); + } + + if ((queryAccepted == KErrAbort) || (queryAccepted == KErrCancel)) { CleanupStack::PopAndDestroy(wait); return KErrCancel; } - - RMobilePhone::TMobilePassword verifcationPassword; - // new pin code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); - if(AknLayoutUtils::PenEnabled()) - iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - iSecurityDlg->SetEmergencyCallSupport(ETrue); - res = iSecurityDlg->ExecuteLD(R_NEW_PIN_CODE_REQUEST_QUERY); - if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) - { - CleanupStack::PopAndDestroy(wait); - return KErrCancel; - } - - // verification code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); - if(AknLayoutUtils::PenEnabled()) - iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - iSecurityDlg->SetEmergencyCallSupport(ETrue); - res = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_PIN_CODE_REQUEST_QUERY); - if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) - { - CleanupStack::PopAndDestroy(wait); - return KErrCancel; - } - - while (aNewPassword.CompareF(verifcationPassword) != 0) - { - // codes do not match -> note -> ask new pin and verification codes again - CSecuritySettings::ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); - - verifcationPassword = _L(""); - aNewPassword = _L(""); - // new pin code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); - if(AknLayoutUtils::PenEnabled()) - iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - iSecurityDlg->SetEmergencyCallSupport(ETrue); - res = iSecurityDlg->ExecuteLD(R_NEW_PIN_CODE_REQUEST_QUERY); - if ((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) - { - CleanupStack::PopAndDestroy(wait); - return KErrCancel; - } - - // verification code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); - if(AknLayoutUtils::PenEnabled()) - iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - iSecurityDlg->SetEmergencyCallSupport(ETrue); - res = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_PIN_CODE_REQUEST_QUERY); - if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) - { - CleanupStack::PopAndDestroy(wait); - return KErrCancel; - } - } - - // send code - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Verify Code")); - #endif - iPhone.VerifySecurityCode(wait->iStatus,blockCodeType,aNewPassword,aPassword); + // send code again, now with the user pin + RDEBUG("VerifySecurityCode", 0); + iPhone.VerifySecurityCode(wait->iStatus, blockCodeType, aNewPinPassword, puk1_password); + RDEBUG("WaitForRequestL", 0); res = wait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); CleanupStack::PopAndDestroy(wait); - - TInt returnValue = res; - switch(res) + + returnValue = res; + switch (res) { case KErrNone: // code approved -> note CSecuritySettings::ShowResultNoteL(R_PIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); break; - case KErrGsm0707IncorrectPassword: + case KErrGsm0707IncorrectPassword: case KErrAccessDenied: // wrong PUK code -> note -> ask PUK code again CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); @@ -1576,121 +1382,104 @@ break; case KErrGsm0707SimWrong: // sim lock active + // no message ? break; case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: // sim card rejected. break; default: - CSecuritySettings::ShowErrorNoteL(res); + CSecuritySettings::ShowErrorNoteL(res); returnValue = Puk1RequiredL(); break; - } - - return returnValue; + } + RDEBUG("returnValue", returnValue); + return returnValue; } // // ---------------------------------------------------------- // CSecurityHandler::Pin2Required() // Handles Pin2Required event // ---------------------------------------------------------- -// +// qtdone void CSecurityHandler::Pin2RequiredL() { /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL() BEGIN")); - #endif - RMobilePhone::TMobilePassword password; + * Series 60 Customer / ETel + * Series 60 ETel API + *****************************************************/ + + RDEBUG("0", 0); + TInt queryAccepted = KErrCancel; + RMobilePhone::TMobilePassword iSecUi_password; RMobilePhone::TMobilePassword required_fourth; RMobilePhone::TMobilePhoneSecurityCode secCodeType(RMobilePhone::ESecurityCodePin2); RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); CWait* wait = CWait::NewL(); CleanupStack::PushL(wait); - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): create dialog")); - #endif - iSecurityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); - #ifdef __COVER_DISPLAY - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): publish dialog")); - #endif - iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); - CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided - if (covercl) // returns null if __COVER_DISPLAY is not defined - { - // … - add data that cover ui is interested in - covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowPIN2); // adds int to additional data to be posted to cover ui - covercl->BufStream().CommitL(); // no more data to send so commit buf - } - #endif //__COVER_DISPLAY - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): get PIN2 info")); - #endif - - wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); + + wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); + RDEBUG("GetSecurityCodeInfo", 0); iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); + RDEBUG("WaitForRequestL", 0); TInt ret = wait->WaitForRequestL(); - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): get PIN2 info result: %d"), ret); - TInt attempts(codeInfo.iRemainingEntryAttempts); - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): attempts remaining: %d"), attempts); - #endif + RDEBUG("WaitForRequestL ret", ret); User::LeaveIfError(ret); - - CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); - CleanupStack::PushL(deviceLockStatusObserver); - CSecUiLockObserver* queryStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg, ESecUiRequestStateObserver); - CleanupStack::PushL(queryStatusObserver); - - if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) - ret = iSecurityDlg->ExecuteLD(R_PIN2_QUERY); - else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PIN2_ATTEMPTS, codeInfo.iRemainingEntryAttempts ); - ret = iSecurityDlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - else - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PIN2_ATTEMPT); - ret = iSecurityDlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - CleanupStack::PopAndDestroy(2); //deviceLockStatusObserver, queryStatusObserver - iSecurityDlg = NULL; - if (!ret || (ret == ESecUiDeviceLocked)) + + RDEBUG("codeInfo.iRemainingEntryAttempts", + codeInfo.iRemainingEntryAttempts); + if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) + codeInfo.iRemainingEntryAttempts = -1; + + /* request PIN using QT */ + CSecQueryUi *iSecQueryUi; + RDEBUG("CSecQueryUi", 0); + iSecQueryUi = CSecQueryUi::NewL(); + iQueryCanceled = EFalse; + RDEBUG("SecQueryDialog", 1); + // ESecUiCodeEtelReqest/ESecUiNone might be useful against KLastRemainingInputAttempt + + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin2_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("$")); + title.AppendNum(codeInfo.iRemainingEntryAttempts); + queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiSecretNotSupported | ESecUiAlphaNotSupported + | ESecUiCancelSupported | secCodeType); + RDEBUG("iSecUi_password", 0); + RDEBUGSTR(iSecUi_password); + RDEBUG("queryAccepted", queryAccepted); + iQueryCanceled = ETrue; + delete iSecQueryUi; + + // If failed or device became locked, any pending request should be cancelled. + if (queryAccepted != KErrNone) { - iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePin2); + RDEBUG("AbortSecurityCode", 0); + iPhone.AbortSecurityCode(secCodeType); + RDEBUG("AbortSecurityCode", 1); CleanupStack::PopAndDestroy(wait); return; } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): Verify Code")); - #endif - iPhone.VerifySecurityCode(wait->iStatus,secCodeType,password,required_fourth); + RDEBUG("VerifySecurityCode", 0); + iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, required_fourth); + RDEBUG("WaitForRequestL", 0); TInt status = wait->WaitForRequestL(); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): destroy wait")); - #endif + RDEBUG("WaitForRequestL status", status); CleanupStack::PopAndDestroy(wait); - switch(status) - { + switch (status) + { case KErrNone: break; case KErrGsm0707IncorrectPassword: case KErrAccessDenied: // code was entered erroneously - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); break; case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: @@ -1698,164 +1487,159 @@ CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); break; default: - CSecuritySettings::ShowErrorNoteL(status); + CSecuritySettings::ShowErrorNoteL(status); break; } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): END")); - #endif } // // ---------------------------------------------------------- // CSecurityHandler::Puk2Required() // Handles Puk2Required event // ---------------------------------------------------------- -// +// qtdone void CSecurityHandler::Puk2RequiredL() - { + { /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ - RMobilePhone::TMobilePassword aPassword; + * Series 60 Customer / ETel + * Series 60 ETel API + *****************************************************/ + RDEBUG("0", 0); + TInt queryAccepted = KErrCancel; + RMobilePhone::TMobilePassword iSecUi_password; RMobilePhone::TMobilePassword aNewPassword; RMobilePhone::TMobilePassword verifcationPassword; RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); - - RMobilePhone::TMobilePhoneSecurityCode blockCodeType; - blockCodeType = RMobilePhone::ESecurityCodePuk2; + + RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePuk2; CWait* wait = CWait::NewL(); CleanupStack::PushL(wait); - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Puk2RequiredL()")); - #endif + // ask PUK2 - iSecurityDlg = new (ELeave) CCodeQueryDialog (aPassword,SEC_C_PUK2_CODE_MIN_LENGTH,SEC_C_PUK2_CODE_MAX_LENGTH,ESecUiNone); - #ifdef __COVER_DISPLAY - iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); - CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided - if (covercl) // returns null if __COVER_DISPLAY is not defined - { - // … - add data that cover ui is interested in - covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowPUK2); // adds int to additional data to be posted to cover ui - covercl->BufStream().CommitL(); // no more data to send so commit buf - } - #endif //__COVER_DISPLAY - CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); - CleanupStack::PushL(deviceLockStatusObserver); - - TInt ret(KErrNone); + + TInt ret(KErrNone); wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); - iPhone.GetSecurityCodeInfo(wait->iStatus, blockCodeType, codeInfoPkg); + RDEBUG("GetSecurityCodeInfo", 0); + iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); + RDEBUG("WaitForRequestL", 0); ret = wait->WaitForRequestL(); + RDEBUG("WaitForRequestL ret", ret); User::LeaveIfError(ret); - - if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts) - ret = iSecurityDlg->ExecuteLD(R_PUK2_REQUEST_QUERY); - else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PUK2_ATTEMPTS, codeInfo.iRemainingEntryAttempts); - ret = iSecurityDlg->ExecuteLD(R_PUK2_REQUEST_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - else - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PUK2_ATTEMPT); - ret = iSecurityDlg->ExecuteLD(R_PUK2_REQUEST_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - - iSecurityDlg = NULL; - if(!ret || (ret == ESecUiDeviceLocked)) + + /* request PIN using QT */ + CSecQueryUi *iSecQueryUi; + RDEBUG("CSecQueryUi", 0); + iSecQueryUi = CSecQueryUi::NewL(); + iQueryCanceled = EFalse; + RDEBUG("SecQueryDialog", 1); + // ESecUiCodeEtelReqest/ESecUiNone might be useful + + RDEBUG("codeInfo.iRemainingEntryAttempts", + codeInfo.iRemainingEntryAttempts); + if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) // TODO this might be 10 ? + codeInfo.iRemainingEntryAttempts = -1; + + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_puk2_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("$")); + title.AppendNum(codeInfo.iRemainingEntryAttempts); + queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PUK2_CODE_MIN_LENGTH, SEC_C_PUK2_CODE_MAX_LENGTH, ESecUiSecretNotSupported | ESecUiAlphaNotSupported + | ESecUiCancelSupported | secCodeType); + RDEBUG("iSecUi_password", 0); + RDEBUGSTR(iSecUi_password); + iQueryCanceled = ETrue; + delete iSecQueryUi; + RDEBUG("queryAccepted", queryAccepted); + + if (queryAccepted != KErrNone) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Puk2RequiredL() PUK QUERY CANCEL")); - #endif // cancel "get security unblock code" request - iPhone.AbortSecurityCode(blockCodeType); - CleanupStack::PopAndDestroy(2); //wait, deviceLockStatusObserver - return; - } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Puk2RequiredL() NEW QUERY")); - #endif - // new pin2 code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); - deviceLockStatusObserver->SetAddress(iSecurityDlg); - ret = iSecurityDlg->ExecuteLD(R_NEW_PIN2_CODE_QUERY); - if(!ret || (ret == ESecUiDeviceLocked)) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Puk2RequiredL() NEW QUERY CANCEL")); - #endif - // cancel "get security unblock code" request - iPhone.AbortSecurityCode(blockCodeType); - CleanupStack::PopAndDestroy(2); //wait, deviceLockStatusObserver + RDEBUG("AbortSecurityCode", 0); + iPhone.AbortSecurityCode(secCodeType); + RDEBUG("AbortSecurityCode", 1); + CleanupStack::PopAndDestroy(1); //wait return; } - // verification code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - deviceLockStatusObserver->SetAddress(iSecurityDlg); - ret = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_PIN2_CODE_QUERY); - if (!ret || (ret == ESecUiDeviceLocked)) + RDEBUG("VerifySecurityCode", 0); + iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, iSecUi_password); + // this writes the newPIN2 with the value of PUK2. It's ok, since the user forgot it + RDEBUG("WaitForRequestL", 0); + TInt res = wait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); + CleanupStack::PopAndDestroy(wait); + + switch (res) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Puk2RequiredL() VERIFY QUERY CANCEL")); - #endif - // cancel "get security unblock code" request - iPhone.AbortSecurityCode(blockCodeType); - CleanupStack::PopAndDestroy(2); //wait, deviceLockStatusObserver - return; + case KErrNone: + // code approved -> note + CSecuritySettings::ShowResultNoteL(res, CAknNoteDialog::EConfirmationTone); + break; + case KErrGsm0707IncorrectPassword: + case KErrAccessDenied: + // wrong PUK2 code -> note -> ask PUK2 code again + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + Puk2RequiredL(); + break; + case KErrGsmSSPasswordAttemptsViolation: + case KErrLocked: + // Pin2 features blocked permanently! + CSecuritySettings::ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); + break; + default: + CSecuritySettings::ShowErrorNoteL(res); + Puk2RequiredL(); + break; } - - while (aNewPassword.CompareF(verifcationPassword) != 0) + + // now the PUK2 is valid. Time to get the new PIN2 + wait = CWait::NewL(); + CleanupStack::PushL(wait); { - // codes do not match -> note -> ask new pin and verification codes again - CSecuritySettings::ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); - - verifcationPassword = _L(""); - aNewPassword = _L(""); - // new pin2 code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); - deviceLockStatusObserver->SetAddress(iSecurityDlg); - deviceLockStatusObserver->StartObserver(); - - ret = iSecurityDlg->ExecuteLD(R_NEW_PIN2_CODE_QUERY); - - if(!ret || (ret == ESecUiDeviceLocked)) + CSecQueryUi * iSecQueryUi; + RDEBUG("CSecQueryUi", 0); + iSecQueryUi = CSecQueryUi::NewL(); + iQueryCanceled = EFalse; + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_pin2_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("|")); + HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify")); + title.Append(stringHolder2->Des()); + CleanupStack::PopAndDestroy(stringHolder2); + // ESecUiCodeEtelReqest/ESecUiNone might be useful + queryAccepted = iSecQueryUi->SecQueryDialog(title, aNewPassword, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported + | secCodeType); + RDEBUG("aNewPassword", 0); + RDEBUGSTR(aNewPassword); + iQueryCanceled = ETrue; + delete iSecQueryUi; + RDEBUG("queryAccepted", queryAccepted); + if (queryAccepted != KErrNone) { // cancel "get security unblock code" request - iPhone.AbortSecurityCode(blockCodeType); - CleanupStack::PopAndDestroy(2); //wait, deviceLockStatusObserver + RDEBUG("AbortSecurityCode", 0); + iPhone.AbortSecurityCode(secCodeType); + RDEBUG("AbortSecurityCode", 1); + CleanupStack::PopAndDestroy(1); //wait return; } - - // verification code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - deviceLockStatusObserver->SetAddress(iSecurityDlg); - deviceLockStatusObserver->StartObserver(); - ret = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_PIN2_CODE_QUERY); - - if (!ret || (ret == ESecUiDeviceLocked)) - { - // cancel "get security unblock code" request - iPhone.AbortSecurityCode(blockCodeType); - CleanupStack::PopAndDestroy(2); //wait, deviceLockStatusObserver - return; - } - } - CleanupStack::PopAndDestroy(deviceLockStatusObserver); - // send code - - iPhone.VerifySecurityCode(wait->iStatus,blockCodeType,aNewPassword,aPassword); - TInt res = wait->WaitForRequestL(); + } + // send code. The code was temporarilly changed before. Thus, this really done to set the new-new one + RDEBUG("VerifySecurityCode", 0); + iPhone.VerifySecurityCode(wait->iStatus, secCodeType, aNewPassword, iSecUi_password); + RDEBUG("WaitForRequestL", 0); + res = wait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); CleanupStack::PopAndDestroy(wait); - - switch(res) + + switch (res) { case KErrNone: // code approved -> note @@ -1870,13 +1654,13 @@ case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: // Pin2 features blocked permanently! - CSecuritySettings::ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); - break; + CSecuritySettings::ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); + break; default: - CSecuritySettings::ShowErrorNoteL(res); + CSecuritySettings::ShowErrorNoteL(res); Puk2RequiredL(); break; - } + } } // @@ -1884,187 +1668,130 @@ // CSecurityHandler::UPinRequiredL() // Hendles UniversalPinRequired event // ---------------------------------------------------------- -// +// qtdone TInt CSecurityHandler::UPinRequiredL() { /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ - TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); - if(wcdmaSupported || upinSupported) - { - RMobilePhone::TMobilePassword password; + * Series 60 Customer / ETel + * Series 60 ETel API + *****************************************************/ + TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); + TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); + RDEBUG("wcdmaSupported", wcdmaSupported); + RDEBUG("upinSupported", upinSupported); + if (wcdmaSupported || upinSupported) + { + TInt queryAccepted = KErrCancel; + TInt lCancelSupported = ESecUiCancelNotSupported; + RMobilePhone::TMobilePassword iSecUi_password; RMobilePhone::TMobilePassword required_fourth; RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityUniversalPin; CWait* wait = CWait::NewL(); CleanupStack::PushL(wait); - TBool StartUp = ETrue; + TBool StartUp = ETrue; TInt secUiOriginatedQuery(ESecurityUIsSecUIOriginatedUninitialized); TInt err = KErrNone; TInt res = KErrGeneral; - + StartUp = iStartup; - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::UPinRequiredL()")); - #endif - - if(!StartUp) - { + RDEBUG("StartUp", StartUp); + + wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); + RDEBUG("GetSecurityCodeInfo", 0); + iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); + RDEBUG("WaitForRequestL", 0); + res = wait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); + User::LeaveIfError(res); + + if (!StartUp) + { // read a flag to see whether the query is SecUi originated. err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); - } - - #if defined(_DEBUG) - RDebug::Print(_L("CSecurityHandler::UPinRequiredL() Execute dlg")); - #endif - if(StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) || (err != KErrNone)) - { - iSecurityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiCodeEtelReqest); - if(AknLayoutUtils::PenEnabled()) - iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - iSecurityDlg->SetEmergencyCallSupport(ETrue); - #ifdef __COVER_DISPLAY - iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); - CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided - if (covercl) // returns null if __COVER_DISPLAY is not defined - { - // … - add data that cover ui is interested in - covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowUPIN); // adds int to additional data to be posted to cover ui - covercl->BufStream().CommitL(); // no more data to send so commit buf - } - #endif //__COVER_DISPLAY - - wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); - iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); - res = wait->WaitForRequestL(); - User::LeaveIfError(res); - - if( codeInfo.iRemainingEntryAttempts >= KMaxNumberOfPINAttempts ) - res = iSecurityDlg->ExecuteLD(R_UPIN_REQUEST_QUERY); - else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_UPIN_ATTEMPTS, codeInfo.iRemainingEntryAttempts); - res = iSecurityDlg->ExecuteLD(R_UPIN_REQUEST_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - else - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_UPIN_ATTEMPT); - res = iSecurityDlg->ExecuteLD(R_UPIN_REQUEST_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - - - if ((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) - { - CleanupStack::PopAndDestroy(wait); - return KErrCancel; - } - } + } + + /* request PIN using QT */ + CSecQueryUi *iSecQueryUi; + RDEBUG("CSecQueryUi", 0); + iSecQueryUi = CSecQueryUi::NewL(); + iQueryCanceled = EFalse; + // ESecUiCodeEtelReqest/ESecUiNone might be useful + // TODO also support Emergency + if (StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) || (err != KErrNone)) + lCancelSupported = ESecUiCancelNotSupported; else - { - iSecurityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - #ifdef __COVER_DISPLAY - iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); - CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided - if (covercl) // returns null if __COVER_DISPLAY is not defined - { - // … - add data that cover ui is interested in - covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowUPIN); // adds int to additional data to be posted to cover ui - covercl->BufStream().CommitL(); // no more data to send so commit buf - } - #endif //__COVER_DISPLAY - - wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); - iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); - res = wait->WaitForRequestL(); - User::LeaveIfError(res); - - CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); - CleanupStack::PushL(deviceLockStatusObserver); - CSecUiLockObserver* queryStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg, ESecUiRequestStateObserver); - CleanupStack::PushL(queryStatusObserver); - - if( codeInfo.iRemainingEntryAttempts >= KMaxNumberOfPINAttempts ) - res = iSecurityDlg->ExecuteLD(R_UPIN_QUERY); - else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_UPIN_ATTEMPTS, codeInfo.iRemainingEntryAttempts); - res = iSecurityDlg->ExecuteLD(R_UPIN_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - else - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_UPIN_ATTEMPT); - res = iSecurityDlg->ExecuteLD(R_UPIN_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - - CleanupStack::PopAndDestroy(2); //deviceLockStatusObserver, queryStatusObserver - iSecurityDlg = NULL; - if( !res || (res == ESecUiDeviceLocked)) - { - // cancel code request - CleanupStack::PopAndDestroy(wait); - iPhone.AbortSecurityCode(RMobilePhone::ESecurityUniversalPin); - return KErrCancel; - } - } - - #if defined(_DEBUG) - RDebug::Print(_L("CSecurityNotifier::UPinRequiredL()VerifySecurityCode")); - #endif - iPhone.VerifySecurityCode(wait->iStatus,secCodeType, password, required_fourth); + lCancelSupported = ESecUiCancelSupported; + + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_upin_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("$")); + title.AppendNum(codeInfo.iRemainingEntryAttempts); + queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiSecretSupported | ESecUiAlphaNotSupported + | lCancelSupported | ESecUiCodeEtelReqest); + RDEBUG("iSecUi_password", 0); + RDEBUGSTR(iSecUi_password); + iQueryCanceled = ETrue; + delete iSecQueryUi; + RDEBUG("queryAccepted", queryAccepted); + if (queryAccepted != KErrNone) + { + CleanupStack::PopAndDestroy(wait); + RDEBUG("AbortSecurityCode", 0); + iPhone.AbortSecurityCode(RMobilePhone::ESecurityUniversalPin); + RDEBUG("AbortSecurityCode", 1); + + return KErrCancel; + } + RDEBUG("VerifySecurityCode", 0); + iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, required_fourth); + RDEBUG("WaitForRequestL", 0); res = wait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); CleanupStack::PopAndDestroy(wait); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::UPinRequiredL() VerifySecurityCode STATUS: %d"), res); - #endif + TInt returnValue = res; - switch(res) - { + switch (res) + { case KErrNone: // code approved - #if defined(_DEBUG) - RDebug::Print(_L("CSecurityHandler::UPinRequiredL()code approved ")); - #endif + RDEBUG("code approved ", 0) + ; CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone); break; case KErrGsm0707IncorrectPassword: case KErrAccessDenied: // code was entered erroneously CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); - if(StartUp) - { - returnValue = UPinRequiredL(); - } + if (StartUp) + { + returnValue = UPinRequiredL(); + } break; case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: // code blocked; show error note and terminate. - if(StartUp) - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + if (StartUp) + CSecuritySettings::ShowResultNoteL(res, CAknNoteDialog::EErrorTone); break; case KErrGsm0707SimWrong: // sim lock active break; - default: + default: // for example, KErrArgument CSecuritySettings::ShowErrorNoteL(res); - if(StartUp) - { - returnValue = UPinRequiredL(); - } + if (StartUp) + { + returnValue = UPinRequiredL(); + } break; } - + return returnValue; - } + } else return KErrNone; } @@ -2073,146 +1800,113 @@ // CSecurityHandler::UPukRequiredL() // Handles UPukRequired event // ---------------------------------------------------------- -// +// qtdone TInt CSecurityHandler::UPukRequiredL() { - TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); - if(wcdmaSupported || upinSupported) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::UPukRequiredL()")); - #endif - RMobilePhone::TMobilePassword aPassword; + TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); + TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); + if (wcdmaSupported || upinSupported) + { + RDEBUG("0", 0); + TInt queryAccepted = KErrCancel; + RMobilePhone::TMobilePassword iSecUi_password; RMobilePhone::TMobilePassword aNewPassword; RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); - + RMobilePhone::TMobilePhoneSecurityCode blockCodeType; blockCodeType = RMobilePhone::ESecurityUniversalPuk; CWait* wait = CWait::NewL(); CleanupStack::PushL(wait); - + TBool StartUp(ETrue); StartUp = iStartup; - + TInt res(KErrNone); wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); + RDEBUG("GetSecurityCodeInfo", 0); iPhone.GetSecurityCodeInfo(wait->iStatus, blockCodeType, codeInfoPkg); + RDEBUG("WaitForRequestL", 0); res = wait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); User::LeaveIfError(res); //show last "Code Error" note for UPIN verify result so it won't be left under the PUK1 dialog - if(!StartUp && (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts)) + if (!StartUp && (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts)) CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); - + // ask UPUK code - iSecurityDlg = new (ELeave) CCodeQueryDialog (aPassword,SEC_C_PUK_CODE_MIN_LENGTH,SEC_C_PUK_CODE_MAX_LENGTH,ESecUiPukRequired); - if(AknLayoutUtils::PenEnabled()) - iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - iSecurityDlg->SetEmergencyCallSupport(ETrue); - #ifdef __COVER_DISPLAY - iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); - CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided - if (covercl) // returns null if __COVER_DISPLAY is not defined - { - // … - add data that cover ui is interested in - covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowUPUK);// adds int to additional data to be posted to cover ui - covercl->BufStream().CommitL(); // no more data to send so commit buf - } - #endif //__COVER_DISPLAY - - - if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts) - res = iSecurityDlg->ExecuteLD(R_UPUK_REQUEST_QUERY); - else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_UPUK_ATTEMPTS, codeInfo.iRemainingEntryAttempts); - res = iSecurityDlg->ExecuteLD(R_UPUK_REQUEST_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - else - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_UPUK_ATTEMPT); - res = iSecurityDlg->ExecuteLD(R_UPUK_REQUEST_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - - if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) + /* request PIN using QT */ { - CleanupStack::PopAndDestroy(wait); - return KErrCancel; - } - - RMobilePhone::TMobilePassword verifcationPassword; - // new upin code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); - if(AknLayoutUtils::PenEnabled()) - iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - iSecurityDlg->SetEmergencyCallSupport(ETrue); - res = iSecurityDlg->ExecuteLD(R_NEW_UPIN_CODE_REQUEST_QUERY); - if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) - { - CleanupStack::PopAndDestroy(wait); - return KErrCancel; - } - - // verification code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); - if(AknLayoutUtils::PenEnabled()) - iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - iSecurityDlg->SetEmergencyCallSupport(ETrue); - res = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_UPIN_CODE_REQUEST_QUERY); - if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) - { - CleanupStack::PopAndDestroy(wait); - return KErrCancel; - } - - while (aNewPassword.CompareF(verifcationPassword) != 0) - { - // codes do not match -> note -> ask new upin and verification codes again - CSecuritySettings::ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); - - verifcationPassword = _L(""); - aNewPassword = _L(""); - - // new upin code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); - if(AknLayoutUtils::PenEnabled()) - iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - iSecurityDlg->SetEmergencyCallSupport(ETrue); - res = iSecurityDlg->ExecuteLD(R_NEW_UPIN_CODE_REQUEST_QUERY); - if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) + CSecQueryUi *iSecQueryUi; + RDEBUG("CSecQueryUi", 0); + iSecQueryUi = CSecQueryUi::NewL(); + iQueryCanceled = EFalse; + // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful + // TODO also support Emergency + + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_puk_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("$")); + title.AppendNum(codeInfo.iRemainingEntryAttempts); + queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, ESecUiAlphaNotSupported + | ESecUiCancelSupported | ESecUiPukRequired); + RDEBUG("iSecUi_password", 0); + RDEBUGSTR(iSecUi_password); + iQueryCanceled = ETrue; + delete iSecQueryUi; + RDEBUG("queryAccepted", queryAccepted); + + if (queryAccepted != KErrNone) { CleanupStack::PopAndDestroy(wait); return KErrCancel; } - - // verification code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); - if(AknLayoutUtils::PenEnabled()) - iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - iSecurityDlg->SetEmergencyCallSupport(ETrue); - res = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_UPIN_CODE_REQUEST_QUERY); - if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) + } + + { + /* request PIN using QT */ + CSecQueryUi *iSecQueryUi; + RDEBUG("CSecQueryUi", 0); + iSecQueryUi = CSecQueryUi::NewL(); + iQueryCanceled = EFalse; + // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful + // TODO also support Emergency + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_upin_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("|")); + HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify")); + title.Append(stringHolder2->Des()); + CleanupStack::PopAndDestroy(stringHolder2); + queryAccepted = iSecQueryUi->SecQueryDialog(title, aNewPassword, SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported + | ESecUiPukRequired); + RDEBUG("aNewPassword", 0); + RDEBUGSTR(aNewPassword); + iQueryCanceled = ETrue; + delete iSecQueryUi; + RDEBUG("queryAccepted", queryAccepted); + if (queryAccepted != KErrNone) { CleanupStack::PopAndDestroy(wait); return KErrCancel; } - } - + } + // send code - iPhone.VerifySecurityCode(wait->iStatus,blockCodeType,aNewPassword,aPassword); + RDEBUG("VerifySecurityCode", 0); + iPhone.VerifySecurityCode(wait->iStatus, blockCodeType, aNewPassword, iSecUi_password); + RDEBUG("WaitForRequestL", 0); res = wait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); CleanupStack::PopAndDestroy(wait); - + TInt returnValue = res; - switch(res) + switch (res) { case KErrNone: // code approved -> note @@ -2232,14 +1926,15 @@ // sim card rejected. break; default: - CSecuritySettings::ShowErrorNoteL(res); + CSecuritySettings::ShowErrorNoteL(res); returnValue = UPukRequiredL(); break; - } - + } + return returnValue; - } + } else + // not wcdmaSupported || upinSupported return KErrNone; } @@ -2248,13 +1943,11 @@ // CSecurityHandler::SimLockEventL() // Shows "SIM restriction on" note // ---------------------------------------------------------- -// +// qtdone void CSecurityHandler::SimLockEventL() { - #if defined(_DEBUG) - RDebug::Print(_L("CSecurityHandler::SimLockEventL()")); - #endif - CSecuritySettings::ShowResultNoteL(R_SIM_ON, CAknNoteDialog::EConfirmationTone); + RDEBUG("0", 0); + CSecuritySettings::ShowResultNoteL(R_SIM_ON, CAknNoteDialog::EConfirmationTone); } // --------------------------------------------------------- // CSecurityHandler::RemoveSplashScreenL() @@ -2269,20 +1962,14 @@ // CSecurityHandler::ShowGenericErrorNoteL(TInt aStatus) // Shows a generic error note // --------------------------------------------------------- - +// qtdone void CSecurityHandler::ShowGenericErrorNoteL(TInt aStatus) { - // Let's create TextResolver instance for error resolving... - CTextResolver* textresolver = CTextResolver::NewLC(); - // Resolve the error - TPtrC errorstring; - errorstring.Set( textresolver->ResolveErrorString( aStatus ) ); - iNoteDlg = new (ELeave) CAknNoteDialog(REINTERPRET_CAST(CEikDialog**,&iNoteDlg)); - iNoteDlg->PrepareLC(R_CODE_ERROR); - iNoteDlg->SetTextL((TDesC&)errorstring); - iNoteDlg->RunDlgLD(CAknNoteDialog::ELongTimeout, CAknNoteDialog::EErrorTone); - CleanupStack::PopAndDestroy(textresolver); + // Let's create TextResolver instance for error resolving... + RDEBUG("aStatus", aStatus); + RDEBUG("!!!!! this should never be called !!!!", 0); + + CSecuritySettings::ShowResultNoteL(aStatus, CAknNoteDialog::EErrorTone); } - // End of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/Src/SecUiSecuritySettings.cpp --- a/securitydialogs/SecUi/Src/SecUiSecuritySettings.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiSecuritySettings.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -1,26 +1,24 @@ /* -* Copyright (c) 2002 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: Provides api for changing security settings. -* -* -*/ - + * Copyright (c) 2002 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: Provides api for changing security settings. + * + * + */ #include #include #include -#include #include #include #include @@ -31,39 +29,42 @@ #include // Property values #include #include +#include "SecUi.h" #include "secuisecuritysettings.h" -#include "SecUiAutoLockSettingPage.h" #include "secui.hrh" #include "secuisecurityhandler.h" #include "secuicodequerydialog.h" #include "SecUiWait.h" - -#ifdef RD_REMOTELOCK +#include #include #include #include -#include "SecUiRemoteLockSettingPage.h" -#endif // RD_REMOTELOCK #include - /***************************************************** - * Series 60 Customer / TSY - * Needs customer TSY implementation - *****************************************************/ + +#include "SecQueryUi.h" +#include + +/***************************************************** + * Series 60 Customer / TSY + * Needs customer TSY implementation + *****************************************************/ // LOCAL CONSTANTS AND MACROS -const TInt KTriesToConnectServer( 2 ); -const TInt KTimeBeforeRetryingServerConnection( 50000 ); -const TInt PhoneIndex( 0 ); +const TInt KTriesToConnectServer(2); +const TInt KTimeBeforeRetryingServerConnection(50000); +const TInt PhoneIndex(0); -const TInt KMaxNumberOfPINAttempts(3); -const TInt KLastRemainingInputAttempt(1); +const TInt KMaxNumberOfPINAttempts(3); // is this valid also for PIN2 ? + +#define ESecUiTypeLock 0x00100000 +#define KErrTDevicelockPolicies 0x10207837 // ================= MEMBER FUNCTIONS ======================= // // ---------------------------------------------------------- // CSecuritySettings::NewL() // ---------------------------------------------------------- -// +// qtdone EXPORT_C CSecuritySettings* CSecuritySettings::NewL() { CSecuritySettings* self = new (ELeave) CSecuritySettings(); @@ -77,7 +78,7 @@ // CSecuritySettings::CSecuritySettings() // constructor // ---------------------------------------------------------- -// +// qtdone EXPORT_C CSecuritySettings::CSecuritySettings() { } @@ -86,91 +87,93 @@ // CSecuritySettings::ConstructL() // Symbian OS constructor. // ---------------------------------------------------------- -// +// qtdone EXPORT_C void CSecuritySettings::ConstructL() { /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ + * Series 60 Customer / ETel + * Series 60 ETel API + *****************************************************/ /***************************************************** - * Series 60 Customer / TSY - * Needs customer TSY implementation - *****************************************************/ + * Series 60 Customer / TSY + * Needs customer TSY implementation + *****************************************************/ - TInt err( KErrGeneral ); - TInt thisTry( 0 ); + RDEBUG("0", 0); + TInt err(KErrGeneral); + TInt thisTry(0); iWait = CWait::NewL(); RTelServer::TPhoneInfo PhoneInfo; /* All server connections are tried to be made KTriesToConnectServer times because occasional - fails on connections are possible, at least on some servers */ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ConstructL()")); - #endif - + fails on connections are possible, at least on some servers */ + FeatureManager::InitializeLibL(); // connect to ETel server - while ( ( err = iServer.Connect() ) != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) + while ((err = iServer.Connect()) != KErrNone && (thisTry++) <= KTriesToConnectServer) { - User::After( KTimeBeforeRetryingServerConnection ); + User::After( KTimeBeforeRetryingServerConnection); } - User::LeaveIfError( err ); + User::LeaveIfError(err); // load TSY - err = iServer.LoadPhoneModule( KMmTsyModuleName ); - if ( err != KErrAlreadyExists ) + err = iServer.LoadPhoneModule(KMmTsyModuleName); + if (err != KErrAlreadyExists) { // May return also KErrAlreadyExists if something else // has already loaded the TSY module. And that is // not an error. - User::LeaveIfError( err ); + User::LeaveIfError(err); } // open phones User::LeaveIfError(iServer.SetExtendedErrorGranularity(RTelServer::EErrorExtended)); User::LeaveIfError(iServer.GetPhoneInfo(PhoneIndex, PhoneInfo)); - User::LeaveIfError(iPhone.Open(iServer,PhoneInfo.iName)); + User::LeaveIfError(iPhone.Open(iServer, PhoneInfo.iName)); User::LeaveIfError(iCustomPhone.Open(iPhone)); - iSecurityHandler = new( ELeave ) CSecurityHandler( iPhone ); + iSecurityHandler = new (ELeave) CSecurityHandler(iPhone); + _LIT(KFileName, "secui_"); + _LIT(KPath, "z:/resource/qt/translations/"); + RDEBUG("HbTextResolverSymbian", 0); + TBool result = HbTextResolverSymbian::Init(KFileName, KPath); + RDEBUG("result", result); + } // // ---------------------------------------------------------- // CSecuritySettings::~CSecuritySettings() // Destructor // ---------------------------------------------------------- -// +// qtdone EXPORT_C CSecuritySettings::~CSecuritySettings() { /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ + * Series 60 Customer / ETel + * Series 60 ETel API + *****************************************************/ /***************************************************** - * Series 60 Customer / TSY - * Needs customer TSY implementation - *****************************************************/ + * Series 60 Customer / TSY + * Needs customer TSY implementation + *****************************************************/ delete iSecurityHandler; // Cancel active requests - if(iWait->IsActive()) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::~CSecuritySettings() CANCEL REQ")); - #endif + if (iWait->IsActive()) + { + RDEBUG("CancelAsyncRequest", 0); iPhone.CancelAsyncRequest(iWait->GetRequestType()); - - switch(iWait->GetRequestType()) - { //inform query that it has beeen canceled - case EMobilePhoneSetLockSetting: - case EMobilePhoneSetFdnSetting: - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestCanceled); - break; - default: - break; - } - - } + + switch (iWait->GetRequestType()) + { //inform query that it has beeen canceled + case EMobilePhoneSetLockSetting: + case EMobilePhoneSetFdnSetting: + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestCanceled); + break; + default: + break; + } + + } // close phone if (iPhone.SubSessionHandle()) iPhone.Close(); @@ -191,173 +194,21 @@ // CSecuritySettings::ChangePinL() // Changes PIN1 // ---------------------------------------------------------- -// +// qtdone EXPORT_C void CSecuritySettings::ChangePinL() { - /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ - - TInt simState; - TInt err( KErrGeneral ); - err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); - User::LeaveIfError( err ); - TBool simRemoved(simState == ESimNotPresent); - - if ( simRemoved ) - { - ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); - return; - } - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinL()")); - #endif - RMobilePhone::TMobilePhoneSecurityCode secCodeType; - secCodeType = RMobilePhone::ESecurityCodePin1; - - RMobilePhone::TMobilePassword oldPassword; - RMobilePhone::TMobilePassword newPassword; - RMobilePhone::TMobilePassword verifcationPassword; - RMobilePhone::TMobilePhonePasswordChangeV1 passwords; - RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; - RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); - - CCodeQueryDialog* verdlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - CleanupStack::PushL(verdlg); - - CCodeQueryDialog* newdlg = new (ELeave) CCodeQueryDialog(newPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - CleanupStack::PushL(newdlg); - - CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (oldPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - CleanupStack::PushL(dlg); - - RMobilePhone::TMobilePhoneLock lockType; - RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; - - lockType = RMobilePhone::ELockICC; - - RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); - iWait->SetRequestType(EMobilePhoneGetLockInfo); - iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); - TInt res = iWait->WaitForRequestL(); - User::LeaveIfError(res); + RDEBUG("0", 0); + RMobilePhone::TMobilePassword iOldPassword; + RMobilePhone::TMobilePassword iNewPassword; + TInt iFlags = ESecUiTypeLock; + iOldPassword.Copy(_L("")); + iNewPassword.Copy(_L("")); - if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) - { - CleanupStack::PopAndDestroy(3,verdlg); - ShowResultNoteL(R_PIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); - return; - } - - CleanupStack::Pop(); // dlg - iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); - iPhone.GetSecurityCodeInfo(iWait->iStatus, secCodeType, codeInfoPkg); - res = iWait->WaitForRequestL(); - User::LeaveIfError(res); - // ask pin - if( codeInfo.iRemainingEntryAttempts >= KMaxNumberOfPINAttempts ) - res = dlg->ExecuteLD(R_PIN_QUERY); - else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PIN_ATTEMPTS, codeInfo.iRemainingEntryAttempts); - res = dlg->ExecuteLD(R_PIN_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - else - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PIN_ATTEMPT); - res = dlg->ExecuteLD(R_PIN_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - - if( !res ) - { - CleanupStack::PopAndDestroy(2,verdlg); - return; - } - CleanupStack::Pop(); // newdlg - // new pin code query - if (!(newdlg->ExecuteLD(R_NEW_PIN_CODE_QUERY))) - { - CleanupStack::PopAndDestroy(verdlg); - return; - } - - CleanupStack::Pop(); // verdlg - // verification code query - if (!(verdlg->ExecuteLD(R_VERIFY_NEW_PIN_CODE_QUERY))) - return; - - while (newPassword.CompareF(verifcationPassword) != 0) - { - // codes do not match -> note -> ask new pin and verification codes again - ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); - - newPassword = _L(""); - verifcationPassword = _L(""); - - // new pin code query - CCodeQueryDialog* newdlg = new (ELeave) CCodeQueryDialog (newPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - if (!(newdlg->ExecuteLD(R_NEW_PIN_CODE_QUERY))) - return; - - // verification code query - CCodeQueryDialog* verdlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - if (!(verdlg->ExecuteLD(R_VERIFY_NEW_PIN_CODE_QUERY))) - return; - } - - // send code - passwords.iOldPassword = oldPassword; - passwords.iNewPassword = newPassword; - iWait->SetRequestType(EMobilePhoneChangeSecurityCode); - iPhone.ChangeSecurityCode(iWait->iStatus, secCodeType, passwords); - res = iWait->WaitForRequestL(); - #if defined(_DEBUG) - RDebug::Print( _L("(SECUI)CSecuritySettings::ChangePinL(): RETURN CODE: %d"), res); - #endif - switch(res) - { - case KErrNone: - { - // code changed - ShowResultNoteL(R_PIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); - break; - } - case KErrGsm0707IncorrectPassword: - case KErrAccessDenied: - { - // code was entered erroneously - ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); - ChangePinL(); - break; - } - case KErrGsmSSPasswordAttemptsViolation: - case KErrLocked: - { - // Pin1 blocked! - return; - } - case KErrGsm0707OperationNotAllowed: - { - // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); - return; - } - case KErrAbort: - { - break; - } - default: - { - ShowErrorNoteL(res); - ChangePinL(); - break; - } - } - + TBuf<0x80> iCaption; + iCaption.Copy(_L("ChangePinL")); // no need to translate. Not used + TInt iShowError = 1; + TInt err = ChangePinParamsL(iOldPassword, iNewPassword, iFlags, iCaption, iShowError); + RDEBUG("err", err); } // @@ -365,174 +216,21 @@ // CSecuritySettings::ChangeUPinL() // Changes Universal PIN // ---------------------------------------------------------- -// +// qtdone EXPORT_C void CSecuritySettings::ChangeUPinL() { - TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); - if(wcdmaSupported || upinSupported) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinL()")); - #endif - TInt simState; - TInt err( KErrGeneral ); - err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); - User::LeaveIfError( err ); - TBool simRemoved(simState == ESimNotPresent); - - if ( simRemoved ) - { - ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); - return; - } - - RMobilePhone::TMobilePhoneSecurityCode secCodeType; - secCodeType = RMobilePhone::ESecurityUniversalPin; - - RMobilePhone::TMobilePassword oldPassword; - RMobilePhone::TMobilePassword newPassword; - RMobilePhone::TMobilePassword verifcationPassword; - RMobilePhone::TMobilePhonePasswordChangeV1 passwords; - RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; - RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); - - CCodeQueryDialog* verdlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - CleanupStack::PushL(verdlg); - - CCodeQueryDialog* newdlg = new (ELeave) CCodeQueryDialog(newPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - CleanupStack::PushL(newdlg); - - CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (oldPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - CleanupStack::PushL(dlg); - - RMobilePhone::TMobilePhoneLock lockType; - RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; - - lockType = RMobilePhone::ELockUniversalPin; - - RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); - iWait->SetRequestType(EMobilePhoneGetLockInfo); - iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); - TInt res = iWait->WaitForRequestL(); - User::LeaveIfError(res); - - if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) - { - CleanupStack::PopAndDestroy(3,verdlg); - ShowResultNoteL(R_UPIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); - return; - } - - CleanupStack::Pop(); // dlg - // ask pin - iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); - iPhone.GetSecurityCodeInfo(iWait->iStatus, secCodeType, codeInfoPkg); - res = iWait->WaitForRequestL(); - User::LeaveIfError(res); - - if( codeInfo.iRemainingEntryAttempts >= KMaxNumberOfPINAttempts ) - res = dlg->ExecuteLD(R_UPIN_QUERY); - else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_UPIN_ATTEMPTS, codeInfo.iRemainingEntryAttempts); - res = dlg->ExecuteLD(R_UPIN_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - else - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_UPIN_ATTEMPT); - res = dlg->ExecuteLD(R_UPIN_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - - - - if( !res ) - { - CleanupStack::PopAndDestroy(2,verdlg); - return; - } - CleanupStack::Pop(); // newdlg - // new pin code query - if (!(newdlg->ExecuteLD(R_NEW_UPIN_CODE_QUERY))) - { - CleanupStack::PopAndDestroy(verdlg); - return; - } - - CleanupStack::Pop(); // verdlg - // verification code query - if (!(verdlg->ExecuteLD(R_VERIFY_NEW_UPIN_CODE_QUERY))) - return; - - while (newPassword.CompareF(verifcationPassword) != 0) - { - // codes do not match -> note -> ask new pin and verification codes again - ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); - - newPassword = _L(""); - verifcationPassword = _L(""); - - // new pin code query - CCodeQueryDialog* newdlg = new (ELeave) CCodeQueryDialog (newPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - if (!(newdlg->ExecuteLD(R_NEW_UPIN_CODE_QUERY))) - return; - - // verification code query - CCodeQueryDialog* verdlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - if (!(verdlg->ExecuteLD(R_VERIFY_NEW_UPIN_CODE_QUERY))) - return; - } - - // send code - passwords.iOldPassword = oldPassword; - passwords.iNewPassword = newPassword; - iWait->SetRequestType(EMobilePhoneChangeSecurityCode); - iPhone.ChangeSecurityCode(iWait->iStatus, secCodeType, passwords); - res = iWait->WaitForRequestL(); - #if defined(_DEBUG) - RDebug::Print( _L("(SECUI)CSecuritySettings::ChangePinL(): RETURN CODE: %d"), res); - #endif - switch(res) - { - case KErrNone: - { - // code changed - ShowResultNoteL(R_UPIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); - break; - } - case KErrGsm0707IncorrectPassword: - case KErrAccessDenied: - { - // code was entered erroneously - ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); - ChangeUPinL(); - break; - } - case KErrGsmSSPasswordAttemptsViolation: - case KErrLocked: - { - return; - } - case KErrGsm0707OperationNotAllowed: - { - // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); - return; - } - case KErrAbort: - { - break; - } - default: - { - ShowErrorNoteL(res); - ChangeUPinL(); - break; - } - } - } + RDEBUG("0", 0); + RMobilePhone::TMobilePassword iOldPassword; + RMobilePhone::TMobilePassword iNewPassword; + TInt iFlags = ESecUiTypeLock; + iOldPassword.Copy(_L("")); + iNewPassword.Copy(_L("")); + + TBuf<0x80> iCaption; + iCaption.Copy(_L("ChangeUPinL")); // no need to translate. Not used + TInt iShowError = 1; + TInt err = ChangeUPinParamsL(iOldPassword, iNewPassword, iFlags, iCaption, iShowError); + RDEBUG("err", err); } @@ -541,48 +239,873 @@ // CSecuritySettings::ChangePin2L() // Changes PIN2 // ---------------------------------------------------------- +// qtdone +EXPORT_C void CSecuritySettings::ChangePin2L() + { + RDEBUG("0", 0); + RMobilePhone::TMobilePassword iOldPassword; + RMobilePhone::TMobilePassword iNewPassword; + TInt iFlags = ESecUiTypeLock; + iOldPassword.Copy(_L("")); + iNewPassword.Copy(_L("")); + + TBuf<0x80> iCaption; + iCaption.Copy(_L("ChangePin2L")); // no need to translate. Not used + TInt iShowError = 1; + TInt err = ChangePin2ParamsL(iOldPassword, iNewPassword, iFlags, iCaption, iShowError); + RDEBUG("err", err); + } // -EXPORT_C void CSecuritySettings::ChangePin2L() +// ---------------------------------------------------------- +// CSecuritySettings::ChangeSecCodeL() +// Changes security code +// ---------------------------------------------------------- +// qtdone +EXPORT_C void CSecuritySettings::ChangeSecCodeL() + { + RDEBUG("0", 0); + RMobilePhone::TMobilePassword iOldPassword; + RMobilePhone::TMobilePassword iNewPassword; + TInt iFlags = 0; + iOldPassword.Copy(_L("")); + iNewPassword.Copy(_L("")); + + TBuf<0x80> iCaption; + iCaption.Copy(_L("ChangeSecCodeL")); // no need to translate. Not used + TInt iShowError = 1; + TInt err = ChangeSecCodeParamsL(iOldPassword, iNewPassword, iFlags, iCaption, iShowError); + RDEBUG("err", err); + } +// +// ---------------------------------------------------------- +// CSecuritySettings::ChangeAutoLockPeriodL() +// Changes autolock period +// ---------------------------------------------------------- +// qtdone +EXPORT_C TInt CSecuritySettings::ChangeAutoLockPeriodL(TInt aPeriod) + { + TInt ret = 0; + RDEBUG("aPeriod", aPeriod); + RMobilePhone::TMobilePassword iOldPassword; + TInt iFlags = 0; + TInt iShowError = 1; + TBuf<0x80> iCaption; + iCaption.Copy(_L("ChangeAutoLockPeriodL")); // no need to translate. Not used + iOldPassword.Copy(_L("")); + ret = ChangeAutoLockPeriodParamsL(aPeriod, iOldPassword, iFlags, iCaption, iShowError); + RDEBUG("ret", ret); + return ret; + } + +// +// ---------------------------------------------------------- +// CSecuritySettings::ChangeRemoteLockStatusL() +// Changes remote lock status (on/off) +// ---------------------------------------------------------- +// no qtdone +EXPORT_C TInt CSecuritySettings::ChangeRemoteLockStatusL(TBool& aRemoteLockStatus, TDes& aRemoteLockCode, TInt aAutoLockPeriod) + { + TInt retValue(KErrNone); + RDEBUG("aRemoteLockStatus", aRemoteLockStatus); + RDEBUG("aAutoLockPeriod", aAutoLockPeriod); + + if (aRemoteLockStatus) + { + aRemoteLockStatus = ETrue; + + // If user wishes to enable remote lock + // a new remote lock code is required. + // RemoteLockCodeQueryL also + retValue = RemoteLockCodeQueryL(aRemoteLockCode); + } + else + { + aRemoteLockStatus = EFalse; + retValue = KErrNone; + // TODO this should calculate aAutoLockPeriod itself, and not trust the input + + // Check whether AutoLock is enabled (timeout value greater + // than zero) or not. If AutoLock is enabled the domestic OS + // device lock should be left enabled. + if (aAutoLockPeriod == 0) + { + // Disable lock setting from domestic OS + retValue = RemoteLockSetLockSettingL(EFalse); + } + else + { + // If AutoLock is enabled, don't disable the DOS device lock + // Re-set (enable) the domestic OS device lock because as a + // side effect it requires the security code from the user + retValue = RemoteLockSetLockSettingL(ETrue); + } + } + RDEBUG( "retValue", retValue ); + return retValue; + } +// +// ---------------------------------------------------------- +// CSecuritySettings::RemoteLockCodeQueryL() +// Pops up remote lock code query. Requires user to enter a new remote lock +// code (RemoteMsg) twice and if they match enables the domestic OS device lock (which as +// a side effect pops up security code query). +// Note: if the RemoteMsg is cancelled, nevertheless the lock is activated. This is done because the code is askedirst, and the only way to do so is by enabling the lock. +// This is not a problem, because: +// a) first the RemoteMsg is enable, and this function is used to change it +// b) if lock was disabled, the "change RemoteMsg" menu is not available. +// ---------------------------------------------------------- +// qtdone +TInt CSecuritySettings::RemoteLockCodeQueryL(TDes& aRemoteLockCode) + { + + TInt retValue(KErrNone); + + // This is done because lock-code needs to be asked first. + // Enable lock setting in domestic OS. It is safe to enable the + // lock setting since RemoteLock API requires remote locking to + // be enabled when changing or setting the remote lock message. + retValue = RemoteLockSetLockSettingL(ETrue); + RDEBUG( "retValue", retValue ); + if (retValue != KErrNone) + return retValue; + aRemoteLockCode.Zero(); + + TInt queryAccepted = KErrCancel; + queryAccepted = KErrCancel; + CSecQueryUi * iSecQueryUi; + iSecQueryUi = CSecQueryUi::NewL(); + // this queries both, and verifies itself + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_rem_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("|")); + HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify")); + title.Append(stringHolder2->Des()); + CleanupStack::PopAndDestroy(stringHolder2); + queryAccepted = iSecQueryUi->SecQueryDialog(title, aRemoteLockCode, SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiAlphaSupported + | ESecUiCancelSupported | ESecUiEmergencyNotSupported | ESecUiNone); + RDEBUG("aRemoteLockCode", 0); + RDEBUGSTR(aRemoteLockCode); + RDEBUG("queryAccepted", queryAccepted); + delete iSecQueryUi; + if (queryAccepted != KErrNone) + return KErrAbort; + + // Check that the new remote lock code doesn't match the security code of the device. + RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePhonePassword; + RMobilePhone::TMobilePassword securityCode; + RMobilePhone::TMobilePassword unblockCode; // Required here only as a dummy parameter + + + securityCode = aRemoteLockCode; + RDEBUG( "EMobilePhoneVerifySecurityCode", EMobilePhoneVerifySecurityCode ); + iWait->SetRequestType(EMobilePhoneVerifySecurityCode); + RDEBUG( "VerifySecurityCode", 0 ); + iPhone.VerifySecurityCode(iWait->iStatus, secCodeType, securityCode, unblockCode); + RDEBUG( "WaitForRequestL", 0 ); + TInt res = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL res", res ); +#ifdef __WINS__ + if (res == KErrNotSupported || res == KErrTimedOut) + res = KErrGsm0707IncorrectPassword; // KErrGsm0707IncorrectPassword = incorrect code +#endif + RDEBUG( "KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword ); + if (res == KErrNone) + { + // The message is also valid as a lock-code, this means that + // remote lock code matches the security code + // and that is not allowed + RDEBUG( "return KErrCancel because msg matches code", KErrCancel ); + ShowResultNoteL(R_REMOTELOCK_INVALID_CODE, CAknNoteDialog::EErrorTone); + return KErrCancel; + } + + RDEBUG( "retValue", retValue ); + return retValue; + } +// +// ---------------------------------------------------------- +// CSecuritySettings::RemoteLockSetLockSettingL() +// Changes lock setting in domestic OS. Changing the domestic OS lock setting +// requires user to enter the security code. +// ---------------------------------------------------------- +// qtdone +TInt CSecuritySettings::RemoteLockSetLockSettingL(TBool aLockSetting) + { + TInt retValue(KErrNone); + RDEBUG( "aLockSetting", aLockSetting ); + + RMobilePhone::TMobilePhoneLockSetting lockSetting = RMobilePhone::ELockSetEnabled; + RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; + + RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; + RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); + + //get lock info + iWait->SetRequestType(EMobilePhoneGetLockInfo); + RDEBUG("GetLockInfo", 0); + iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); + RDEBUG("WaitForRequestL", 0); + TInt status = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL status", status); + +#ifdef __WINS__ + if (status == KErrNotSupported || status == KErrTimedOut) + { + lockInfo.iSetting = RMobilePhone::ELockSetDisabled; + status = KErrNone; + } +#endif + User::LeaveIfError(status); + RDEBUG("current lockInfo.iSetting", lockInfo.iSetting); + + // disabled->disabled should not happen + // enabled->enabled happens because a change of message also forces a code re-validation + if (aLockSetting) + { + lockSetting = RMobilePhone::ELockSetEnabled; + } + else + { + lockSetting = RMobilePhone::ELockSetDisabled; + } + RDEBUG("future lockSetting", lockSetting); + + iWait->SetRequestType(EMobilePhoneSetLockSetting); + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); + RDEBUG( "SetLockSetting", 0 ); + iPhone.SetLockSetting(iWait->iStatus, lockType, lockSetting); // this will PassPhraseRequiredL + RDEBUG( "WaitForRequestL", 0 ); + retValue = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL retValue", retValue ); +#ifdef __WINS__ + if (retValue == KErrNotSupported || retValue == KErrTimedOut) + retValue = KErrNone; +#endif + + switch (retValue) + { + case KErrNone: + break; + + case KErrGsmSSPasswordAttemptsViolation: + case KErrLocked: + case KErrGsm0707IncorrectPassword: + case KErrAccessDenied: + // Security code was entered erroneously + //Error note is shown in CSecurityHandler::PassPhraseRequired() + break; + + case KErrAbort: + break; + + default: + break; + } + + RDEBUG( "retValue", retValue ); + return retValue; + } + +// +// ---------------------------------------------------------- +// CSecuritySettings::ChangeSimSecurityL() +// Changes SIM security +// ---------------------------------------------------------- +// qtdone +EXPORT_C TBool CSecuritySettings::ChangeSimSecurityL() { /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePin2L()")); - #endif - TInt simState; - TInt err( KErrGeneral ); - err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); - User::LeaveIfError( err ); - TBool simRemoved(simState == ESimNotPresent); + * Series 60 Customer / ETel + * Series 60 ETel API + *****************************************************/ + RDEBUG("0", 0); + RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; + RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); + RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneToICC; + RMobilePhone::TMobilePhoneLockSetting lockChangeSetting; + + //get lock info + iWait->SetRequestType(EMobilePhoneGetLockInfo); + RDEBUG("GetLockInfo", 0); + iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); + RDEBUG("WaitForRequestL", 0); + TInt status = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL status", status); + +#ifdef __WINS__ + if (status == KErrNotSupported || status == KErrTimedOut) + { + lockInfo.iSetting = RMobilePhone::ELockSetDisabled; + status = KErrNone; + } +#endif + User::LeaveIfError(status); + TInt currentItem = 0; + RDEBUG("lockInfo.iSetting", lockInfo.iSetting); + if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) + { + currentItem = 1; // off + } - if ( simRemoved ) + if (currentItem == 0) // switch the flag + { + lockChangeSetting = RMobilePhone::ELockSetDisabled; + } + else { - ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); - return; + lockChangeSetting = RMobilePhone::ELockSetEnabled; + } + RDEBUG("lockChangeSetting", lockChangeSetting); + + iWait->SetRequestType(EMobilePhoneSetLockSetting); + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); + RDEBUG("SetLockSetting", 0); + iPhone.SetLockSetting(iWait->iStatus, lockType, lockChangeSetting); // this invokes the handler + RDEBUG("WaitForRequestL", 0); + status = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL status", status); +#ifdef __WINS__ + if (status == KErrNotSupported || status == KErrTimedOut) + status = KErrNone; +#endif + + // the error was displayed in the handler + RDEBUG("status", status); + switch (status) + { + case KErrNone: + { + break; + } + case KErrGsm0707IncorrectPassword: + case KErrAccessDenied: + { + // code was entered erroneously + return ChangeSimSecurityL(); + } + case KErrGsmSSPasswordAttemptsViolation: + case KErrLocked: + { + return ChangeSimSecurityL(); + } + case KErrAbort: + { + return EFalse; + } + default: + { + ShowErrorNoteL(status); + return ChangeSimSecurityL(); + } } - RMmCustomAPI::TSecurityCodeType secCodeType; - RMobilePhone::TMobilePhoneSecurityCode EtelsecCodeType; - secCodeType = RMmCustomAPI::ESecurityCodePin2; - RMobilePhone::TMobilePassword oldPassword; - RMobilePhone::TMobilePassword newPassword; - RMobilePhone::TMobilePassword verifcationPassword; - RMobilePhone::TMobilePhonePasswordChangeV1 passwords; + return ETrue; + } +// +// ---------------------------------------------------------- +// CSecuritySettings::ChangePinRequestL() +// Changes PIN1 request +// ---------------------------------------------------------- +// qtdone +EXPORT_C TBool CSecuritySettings::ChangePinRequestL() + { + RDEBUG("0", 0); + + RMobilePhone::TMobilePassword iOldPassword; + TInt iFlags = 0; + iOldPassword.Copy(_L("")); + + TBuf<0x80> iCaption; + iCaption.Copy(_L("ChangePinRequestL")); // no need to translate. Not used + TInt iShowError = 1; + TInt err = ChangePinRequestParamsL(1/* it's imposible to know if we want to set or clear*/, iOldPassword, iFlags, iCaption, iShowError); + RDEBUG("err", err); + if (err == KErrNone) + return ETrue; + else + return EFalse; + } + +// +// ---------------------------------------------------------- +// CSecuritySettings::ChangeUPinRequestL() +// Changes UPIN request on/off +// ---------------------------------------------------------- +// qtdone +EXPORT_C TBool CSecuritySettings::ChangeUPinRequestL() + { + TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); + TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); + RDEBUG("wcdmaSupported", wcdmaSupported); + RDEBUG("upinSupported", upinSupported); + if (wcdmaSupported || upinSupported) + { + TInt simState; + TInt err(KErrGeneral); + err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); + User::LeaveIfError(err); + TBool simRemoved(simState == ESimNotPresent); + + if (simRemoved) + { + ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); + return EFalse; + } + + RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; + RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); + RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockUniversalPin; + + RMobilePhone::TMobilePhoneLockSetting lockChangeSetting = RMobilePhone::ELockSetDisabled; + + //get lock info + iWait->SetRequestType(EMobilePhoneGetLockInfo); + RDEBUG("GetLockInfo", 0); + iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); + RDEBUG("WaitForRequestL", 0); + TInt status = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL status", status); +#ifdef __WINS__ + if (status == KErrNotSupported || status == KErrTimedOut) + status = KErrNone; +#endif + User::LeaveIfError(status); + TInt currentItem = 0; + + RDEBUG("lockInfo.iSetting", lockInfo.iSetting); + if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) + { + currentItem = 1; // off + } + + if (currentItem == 0) // switch the flag + { + lockChangeSetting = RMobilePhone::ELockSetDisabled; + } + else + { + lockChangeSetting = RMobilePhone::ELockSetEnabled; + } + RDEBUG("lockChangeSetting", lockChangeSetting); + // Raise a flag to indicate that the UPIN + // request coming from ETEL has originated from SecUi and not from Engine. + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginated); + // Change the lock setting + iWait->SetRequestType(EMobilePhoneSetLockSetting); + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); + RDEBUG("SetLockSetting", 0); + iPhone.SetLockSetting(iWait->iStatus, lockType, lockChangeSetting); // this calls something in the handler + RDEBUG("WaitForRequestL", 0); + status = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL status", status); + // Lower the flag + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginatedUninitialized); +#ifdef __WINS__ + if (status == KErrNotSupported || status == KErrTimedOut) + status = KErrNone; +#endif + + // no need to show errors because they were displayed in the Handler + switch (status) + { + case KErrNone: + { + break; + } + case KErrGsm0707OperationNotAllowed: + { + // not allowed with this sim + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + return EFalse; + } + case KErrGsm0707IncorrectPassword: + case KErrAccessDenied: + { + // code was entered erroneously + return ChangeUPinRequestL(); + } + case KErrGsmSSPasswordAttemptsViolation: + case KErrLocked: + { + return EFalse; + } + case KErrAbort: + { + return EFalse; + } + default: + { + ShowErrorNoteL(status); + return ChangeUPinRequestL(); + } + } + + return ETrue; + } + else + return EFalse; + + } + +// +// ---------------------------------------------------------- +// CSecuritySettings::SwitchPinCodesL() +// Changes the pin code currently in use (PIN/UPIN) +// ---------------------------------------------------------- +// qtdone +EXPORT_C TBool CSecuritySettings::SwitchPinCodesL() + { + TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); + TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); + RDEBUG("wcdmaSupported", wcdmaSupported); + RDEBUG("upinSupported", upinSupported); + if (wcdmaSupported || upinSupported) + { + // If we are in simless offline mode the PIN codes can't obviously be switched + TInt simState; + TInt err(KErrGeneral); + err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); + User::LeaveIfError(err); + TBool simRemoved(simState == ESimNotPresent); + + if (simRemoved) + { + ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); + return EFalse; + } + + RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockUniversalPin; + RMobilePhone::TMobilePhoneLockSetting lockChangeSetting = RMobilePhone::ELockReplaced; + RMobilePhone::TMobilePhoneSecurityCode activeCode; + + iCustomPhone.GetActivePin(activeCode); + + RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; + RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); + RDEBUG("EMobilePhoneGetLockInfo", EMobilePhoneGetLockInfo); + iWait->SetRequestType(EMobilePhoneGetLockInfo); + + if (activeCode == RMobilePhone::ESecurityUniversalPin) + { + lockType = RMobilePhone::ELockUniversalPin; + iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); + RDEBUG("WaitForRequestL", 0); + TInt res = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); +#ifdef __WINS__ + if (res == KErrNotSupported || res == KErrTimedOut) + res = KErrNone; +#endif + User::LeaveIfError(res); + } + else + { + lockType = RMobilePhone::ELockICC; + iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); + RDEBUG("WaitForRequestL", 0); + TInt res = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); +#ifdef __WINS__ + if (res == KErrNotSupported || res == KErrTimedOut) + res = KErrNone; +#endif + User::LeaveIfError(res); + } + + // code request must be ON to change active code. + RDEBUG("lockInfo.iSetting", lockInfo.iSetting); + if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) + { + + if (activeCode != RMobilePhone::ESecurityUniversalPin) + { + ShowResultNoteL(R_UPIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + } + else + { + ShowResultNoteL(R_PIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + } + return EFalse; + } + + iCustomPhone.GetActivePin(activeCode); + TInt currentItem = 0; + + RDEBUG("activeCode", activeCode); + if (activeCode == RMobilePhone::ESecurityUniversalPin) + { + currentItem = 1; // UPIN + } + if (currentItem == 0) // switch the flag + { + lockType = RMobilePhone::ELockUniversalPin; + } + else + { + lockType = RMobilePhone::ELockICC; + } + RDEBUG("lockType", lockType); + + // Raise a flag to indicate that the code + // request coming from ETEL has originated from SecUi and not from Engine. + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginated); + // Change the lock setting + iWait->SetRequestType(EMobilePhoneSetLockSetting); + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); + RDEBUG("SetLockSetting", 0); + iPhone.SetLockSetting(iWait->iStatus, lockType, lockChangeSetting); // request from handler + RDEBUG("WaitForRequestL", 0); + TInt status = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL status", status); + // Lower the flag + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginatedUninitialized); +#ifdef __WINS__ + if (status == KErrNotSupported || status == KErrTimedOut) + status = KErrNone; +#endif + + // errors are shown in the handler + switch (status) + { + case KErrNone: + { + break; + } + case KErrGsm0707OperationNotAllowed: + { + // not allowed with this sim + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + return EFalse; + } + case KErrGsm0707IncorrectPassword: + case KErrAccessDenied: + { + // code was entered erroneously + return SwitchPinCodesL(); + } + case KErrGsmSSPasswordAttemptsViolation: + case KErrLocked: + { + return EFalse; + } + case KErrAbort: + { + return EFalse; + } + default: + { + ShowErrorNoteL(status); + return SwitchPinCodesL(); + } + } + + return ETrue; + } + else + return EFalse; + } + +// +// ---------------------------------------------------------- +// CSecuritySettings::IsLockEnabledL() +// Return is lock enabled/disabled +// ---------------------------------------------------------- +// qtdone +EXPORT_C TBool CSecuritySettings::IsLockEnabledL(RMobilePhone::TMobilePhoneLock aLockType) + { + TBool ret = EFalse; + RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; + //get lock info + RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); + iWait->SetRequestType(EMobilePhoneGetLockInfo); + RDEBUG("GetLockInfo", 0); + iPhone.GetLockInfo(iWait->iStatus, aLockType, lockInfoPkg); + RDEBUG("WaitForRequestL", 0); + TInt res = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); + + if (res != KErrNone) + ret = ETrue; + //lock is enabled return true + else if (lockInfo.iSetting == RMobilePhone::ELockSetEnabled) + { + ret = ETrue; + } + RDEBUG("ret", ret); + return ret; + } +// +// ---------------------------------------------------------- +// CSecuritySettings::AskSecCodeL() +// For asking security code e.g in settings +// ---------------------------------------------------------- +// qtdone +EXPORT_C TBool CSecuritySettings::AskSecCodeL() + { + return iSecurityHandler->AskSecCodeL(); + } +// +// ---------------------------------------------------------- +// CSecuritySettings::AskPin2L() +// Asks PIN2 +// ---------------------------------------------------------- +// qtdone +EXPORT_C TBool CSecuritySettings::AskPin2L() + { + /***************************************************** + * Series 60 Customer / ETel + * Series 60 ETel API + *****************************************************/ + RDEBUG("0", 0); + TInt retPhone = 0; + // check if pin2 is blocked... + RMmCustomAPI::TSecurityCodeType secCodeType = RMmCustomAPI::ESecurityCodePin2; + RMobilePhone::TMobilePhoneSecurityCode etelsecCodeType(RMobilePhone::ESecurityCodePin2); RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); - - // check if pin2 is blocked... + RMobilePhone::TMobilePassword password; TBool isBlocked = EFalse; + TInt queryAccepted = KErrCancel; + //Check whether PIN2 is blocked + retPhone = iCustomPhone.IsBlocked(secCodeType, isBlocked); + + RDEBUG("retPhone", retPhone); + RDEBUG("isBlocked", isBlocked); +#ifdef __WINS__ + if (retPhone == KErrNotSupported || retPhone == KErrTimedOut) + retPhone = KErrNone; +#endif + if (isBlocked) + return EFalse; + + if (retPhone != KErrNone) + { + switch (retPhone) + { + // PIN2 Blocked. + case KErrGsm0707SIMPuk2Required: + break; + case KErrGsmSSPasswordAttemptsViolation: + case KErrLocked: + // Pin2 features blocked permanently! + ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); + break; + case KErrGsm0707SimNotInserted: + // not allowed with this sim + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + break; + default: + ShowErrorNoteL(retPhone); + break; + } + return EFalse; + } + iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); + RDEBUG("GetSecurityCodeInfo", 0); + iPhone.GetSecurityCodeInfo(iWait->iStatus, etelsecCodeType, codeInfoPkg); + RDEBUG("WaitForRequestL", 0); + retPhone = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL retPhone", retPhone); +#ifdef __WINS__ + if (retPhone == KErrNotSupported || retPhone == KErrTimedOut) + { + retPhone = KErrNone; + codeInfo.iRemainingEntryAttempts = 3; + } +#endif + User::LeaveIfError(retPhone); + + RDEBUG("codeInfo.iRemainingEntryAttempts", + codeInfo.iRemainingEntryAttempts); + if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) + codeInfo.iRemainingEntryAttempts = -1; - TInt ret = iCustomPhone.IsBlocked(secCodeType,isBlocked); - - if(isBlocked) + // ask pin2 code + /* request PIN using QT */ + queryAccepted = KErrCancel; + CSecQueryUi *iSecQueryUi; + iSecQueryUi = CSecQueryUi::NewL(); + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin2_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("$")); + title.AppendNum(codeInfo.iRemainingEntryAttempts); + queryAccepted = iSecQueryUi->SecQueryDialog(title, password, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported + | ESecUiEmergencyNotSupported | secCodeType); + RDEBUG("password", 0); + RDEBUGSTR(password); + RDEBUG("queryAccepted", queryAccepted); + delete iSecQueryUi; + if (queryAccepted != KErrNone) + return EFalse; + + // verify code + RMobilePhone::TMobilePassword required_fourth; + iWait->SetRequestType(EMobilePhoneVerifySecurityCode); + RDEBUG("VerifySecurityCode", 0); + iPhone.VerifySecurityCode(iWait->iStatus, etelsecCodeType, password, required_fourth); + RDEBUG("WaitForRequestL", 0); + retPhone = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL retPhone", retPhone); +#ifdef __WINS__ + if (retPhone == KErrNotSupported) + retPhone = KErrNone; +#endif + + switch (retPhone) + { + case KErrNone: + break; + case KErrGsm0707IncorrectPassword: + case KErrAccessDenied: + // code was entered erroneously + ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + return AskPin2L(); + case KErrGsm0707OperationNotAllowed: + // not allowed with this sim + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + return EFalse; + case KErrGsmSSPasswordAttemptsViolation: + case KErrLocked: + // code was blocked + ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + return EFalse; + default: + ShowErrorNoteL(retPhone); + return AskPin2L(); + } + + return ETrue; + } +// +// ---------------------------------------------------------- +// CSecuritySettings::SetFdnModeL() +// Activates or deactivates Fixed Dialling Numbers (FDN) mode. +// ---------------------------------------------------------- +// not qtdone +EXPORT_C void CSecuritySettings::SetFdnModeL() + { + /***************************************************** + * Series 60 Customer / ETel + * Series 60 ETel API + *****************************************************/ + RDEBUG("0", 0); + RMmCustomAPI::TSecurityCodeType secCodeType = RMmCustomAPI::ESecurityCodePin2; + + TBool isBlocked = EFalse; + TInt ret = iCustomPhone.IsBlocked(secCodeType, isBlocked); + RDEBUG("isBlocked", isBlocked); + RDEBUG("ret", ret); + if (isBlocked) return; - + if (ret != KErrNone) - { + { switch (ret) { // PIN2 Blocked. @@ -603,1785 +1126,39 @@ } return; } - - CCodeQueryDialog* verdlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); - CleanupStack::PushL(verdlg); - CCodeQueryDialog* newdlg = new (ELeave) CCodeQueryDialog(newPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); - CleanupStack::PushL(newdlg); - - CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (oldPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); - CleanupStack::PushL(dlg); - - - // Security code must be changed to Etel API format - // Custom API Pin1 and Pin2 have the same enum values as the Etel ones - EtelsecCodeType = (RMobilePhone::TMobilePhoneSecurityCode)secCodeType; - #ifndef __WINS__ - iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); - iPhone.GetSecurityCodeInfo(iWait->iStatus, EtelsecCodeType, codeInfoPkg); - ret = iWait->WaitForRequestL(); - User::LeaveIfError(ret); - #else - codeInfo.iRemainingEntryAttempts = 1; - #endif //__WINS__ - - if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) - ret = dlg->ExecuteLD(R_PIN2_QUERY); - else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PIN2_ATTEMPTS, codeInfo.iRemainingEntryAttempts ); - ret = dlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - else - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PIN2_ATTEMPT); - ret = dlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - - CleanupStack::Pop(); // dlg - if(!ret) - { - CleanupStack::PopAndDestroy(2,verdlg); - return; - } - - // new pin code query - CleanupStack::Pop(); // newdlg - if(!(newdlg->ExecuteLD(R_NEW_PIN2_CODE_QUERY))) - { - CleanupStack::PopAndDestroy(verdlg); - return; - } - - // verification code query - CleanupStack::Pop(); // verdlg - if(!(verdlg->ExecuteLD(R_VERIFY_NEW_PIN2_CODE_QUERY))) - { - return; - } - - while (newPassword.CompareF(verifcationPassword) != 0) - { - // codes do not match -> note -> ask new pin and verification codes again - ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); - - newPassword = _L(""); - verifcationPassword = _L(""); - - // new pin code query - CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (newPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); - if(!(dlg->ExecuteLD(R_NEW_PIN2_CODE_QUERY))) - return; - - // verification code query - CCodeQueryDialog* dlg2 = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); - if(!(dlg2->ExecuteLD(R_VERIFY_NEW_PIN2_CODE_QUERY))) - return; - } - - - passwords.iOldPassword = oldPassword; - passwords.iNewPassword = newPassword; - iWait->SetRequestType(EMobilePhoneChangeSecurityCode); - iPhone.ChangeSecurityCode(iWait->iStatus,EtelsecCodeType,passwords); - TInt res = iWait->WaitForRequestL(); - #if defined(_DEBUG) - RDebug::Print( _L("(SECUI)CSecuritySettings::ChangePin2L(): RETURN CODE: %d"), res); - #endif - switch(res) - { - case KErrNone: - { - // code changed - ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); - break; - } - case KErrGsm0707IncorrectPassword: - case KErrAccessDenied: - { - ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); - ChangePin2L(); - break; - } - case KErrGsmSSPasswordAttemptsViolation: - case KErrLocked: - { - // Pin2 blocked! - ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); - CSecurityHandler* handler = new(ELeave) CSecurityHandler(iPhone); - CleanupStack::PushL(handler); - handler->HandleEventL(RMobilePhone::EPuk2Required); - CleanupStack::PopAndDestroy(handler); // handler - return; - } - case KErrGsm0707OperationNotAllowed: - { - // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); - return; - } - case KErrAbort: - { - break; - } - default: - { - ShowErrorNoteL(res); - ChangePin2L(); - break; - } - } - } -// -// ---------------------------------------------------------- -// CSecuritySettings::ChangeSecCodeL() -// Changes security code -// ---------------------------------------------------------- -// -EXPORT_C void CSecuritySettings::ChangeSecCodeL() - { - /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeSecCodeL()")); - #endif - TInt res; - RMobilePhone::TMobilePassword newPassword; -if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ) && - (FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements ))) -{ - - // Connect to the SCP server, and request the code change - RSCPClient scpClient; - User::LeaveIfError( scpClient.Connect() ); - CleanupClosePushL( scpClient ); - res = scpClient.ChangeCodeRequest(); - CleanupStack::PopAndDestroy(); // scpClient - -} -else -{ - - RMobilePhone::TMobilePhoneSecurityCode secCodeType; - secCodeType = RMobilePhone::ESecurityCodePhonePassword; - RMobilePhone::TMobilePassword oldPassword; - RMobilePhone::TMobilePassword verifcationPassword; - RMobilePhone::TMobilePassword required_fourth; - RMobilePhone::TMobilePhonePasswordChangeV1 passwords; - - CCodeQueryDialog* verdlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_CHANGE_MAX_LENGTH,ESecUiNone); - CleanupStack::PushL(verdlg); - - CCodeQueryDialog* newdlg = new (ELeave) CCodeQueryDialog(newPassword,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_CHANGE_MAX_LENGTH,ESecUiNone); - CleanupStack::PushL(newdlg); - - CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (oldPassword,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_MAX_LENGTH,ESecUiNone); - CleanupStack::PushL(dlg); - - // ask security code - CleanupStack::Pop(); // dlg - if (!(dlg->ExecuteLD(R_SECURITY_QUERY))) - { - CleanupStack::PopAndDestroy(2,verdlg); - return; - } - // new security code query - CleanupStack::Pop(); // newdlg - if(!(newdlg->ExecuteLD(R_NEW_SECURITY_CODE_QUERY))) - { - CleanupStack::PopAndDestroy(verdlg); - return; - } - - // verification code query - CleanupStack::Pop(); // verdlg - if(!(verdlg->ExecuteLD(R_VERIFY_NEW_SECURITY_CODE_QUERY))) - { - return; - } - - while (newPassword.CompareF(verifcationPassword) != 0) - { - // codes do not match -> note -> ask new pin and verification codes again - ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); - - newPassword = _L(""); - verifcationPassword = _L(""); - - // new pin code query - CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (newPassword,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_CHANGE_MAX_LENGTH,ESecUiNone); - if(!(dlg->ExecuteLD(R_NEW_SECURITY_CODE_QUERY))) - return; - - // verification code query - CCodeQueryDialog* dlg2 = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_CHANGE_MAX_LENGTH,ESecUiNone); - if(!(dlg2->ExecuteLD(R_VERIFY_NEW_SECURITY_CODE_QUERY))) - return; - } - iWait->SetRequestType(EMobilePhoneVerifySecurityCode); - // check code - iPhone.VerifySecurityCode(iWait->iStatus,secCodeType, oldPassword, required_fourth); - res = iWait->WaitForRequestL(); - #if defined(_DEBUG) - RDebug::Print( _L("(SECUI)CSecuritySettings::ChangeSecCode(): CODE VERIFY RESP: %d"), res); - #endif - // change code - if (res == KErrNone) - { - passwords.iOldPassword = oldPassword; - passwords.iNewPassword = newPassword; - iWait->SetRequestType(EMobilePhoneChangeSecurityCode); - iPhone.ChangeSecurityCode(iWait->iStatus,secCodeType,passwords); - res = iWait->WaitForRequestL(); - } - -} - - #if defined(_DEBUG) - RDebug::Print( _L("(SECUI)CSecuritySettings::ChangeSecCode(): RETURN CODE: %d"), res); - #endif - switch(res) - { - case KErrNone: - { - // code changed - ShowResultNoteL(R_SECURITY_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); - if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ) && - !(FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements ))) - { - // Send the changed code to the SCP server. Not used with device lock enhancements. - - RSCPClient scpClient; - TSCPSecCode newCode; - newCode.Copy( newPassword ); - if ( scpClient.Connect() == KErrNone ) - { - scpClient.StoreCode( newCode ); - scpClient.Close(); - } - } - - break; - } - case KErrGsmSSPasswordAttemptsViolation: - case KErrLocked: - { - ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); - ChangeSecCodeL(); - break; - } - case KErrGsm0707IncorrectPassword: - case KErrAccessDenied: - { - // code was entered erroneously - ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); - ChangeSecCodeL(); - break; - } - case KErrAbort: - { - break; - } - default: - { - ShowErrorNoteL(res); - ChangeSecCodeL(); - break; - } - } - } -// -// ---------------------------------------------------------- -// CSecuritySettings::ChangeAutoLockPeriodL() -// Changes autolock period -// ---------------------------------------------------------- -// -EXPORT_C TInt CSecuritySettings::ChangeAutoLockPeriodL(TInt aPeriod) - { - /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodLXXXX()")); - #endif - RMobilePhone::TMobilePhoneLockSetting lockChange(RMobilePhone::ELockSetDisabled); - RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; - TInt currentItem = 0; - TInt oldPeriod = aPeriod; - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() ReadDesC16ArrayResourceL")); - #endif - - - CCoeEnv* coeEnv = CCoeEnv::Static(); - CDesCArrayFlat* items = coeEnv->ReadDesC16ArrayResourceL(R_AUTOLOCK_LBX); - CleanupStack::PushL(items); - - if (aPeriod == 0) - { - currentItem = 0; // autolock off - } - else - { - currentItem = 1; // user defined - } - - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() New autolocksettingpage")); - #endif - - CAutoLockSettingPage* dlg = new (ELeave)CAutoLockSettingPage(R_AUTOLOCK_SETTING_PAGE, currentItem, items, aPeriod); - CleanupStack::PushL(dlg); - dlg->ConstructL(); - TInt maxPeriod; - if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) - { - // Retrieve the current autolock period max. value from the SCP server, - // and check that the value the user - // selected is ok from the Corporate Policy point of view. - RSCPClient scpClient; - TInt ret = scpClient.Connect(); - if ( ret == KErrNone ) - { - CleanupClosePushL( scpClient ); - TBuf maxPeriodBuf; - if ( scpClient.GetParamValue( ESCPMaxAutolockPeriod, maxPeriodBuf ) == KErrNone ) - { - TLex lex( maxPeriodBuf ); - if ( ( lex.Val( maxPeriod ) == KErrNone ) && ( maxPeriod > 0 ) ) - { - dlg->SetPeriodMaximumValue(maxPeriod); - } - else - { - maxPeriod = 0; - dlg->SetPeriodMaximumValue(maxPeriod); - } - - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL():\ - ERROR: Failed to retrieve max period")); - #endif - } - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL():\ - ERROR: Failed to connect to SCP.")); - #endif - } - CleanupStack::PopAndDestroy(); // scpClient -} - CleanupStack::Pop(); //dlg - if (!dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged)) - { - CleanupStack::PopAndDestroy(items); - return oldPeriod; - } - - CleanupStack::PopAndDestroy(); // items - - if ( FeatureManager::FeatureSupported( KFeatureIdSapTerminalControlFw ) ) - { - // define a flag indicating whether disable autolock is allowed. - TBool allowDisableAL = ETrue; - - if ( ( aPeriod == 0 ) && ( maxPeriod > 0 ) ) - { - #if defined( _DEBUG ) - RDebug::Print( - _L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() \ - The period: %d is not allowed by TARM; max: %d" ), - aPeriod, maxPeriod ); - #endif - allowDisableAL = EFalse; - HBufC* prompt = NULL; - prompt = StringLoader::LoadLC( - R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE ); - CAknNoteDialog* noteDlg = new ( ELeave ) CAknNoteDialog( - REINTERPRET_CAST( CEikDialog**,¬eDlg ) ); - noteDlg->PrepareLC( R_CODE_ERROR ); - noteDlg->SetTextL( *prompt ); - noteDlg->SetTimeout( CAknNoteDialog::ELongTimeout ); - noteDlg->SetTone( CAknNoteDialog::EErrorTone ); - noteDlg->RunLD(); - CleanupStack::PopAndDestroy( prompt ); - } - - if ( !allowDisableAL ) - { - return ChangeAutoLockPeriodL( oldPeriod ); - } - } - - if (aPeriod == 0) - { - - #ifdef RD_REMOTELOCK - - // If remote lock is enabled, don't disable the domestic OS device lock - // since that would render the RemoteLock useless. - // Instead just re-set the DOS lock to enabled which as a side effect - // requests the security code from the user. - - TBool remoteLockStatus( EFalse ); - CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); - - if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) - { - if ( remoteLockStatus ) - { - // Remote lock is enabled - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeAutoLockPeriodL() - RemoteLock is enabled: lockChange = RMobilePhone::ELockSetEnabled" ) ); - #endif // _DEBUG - - lockChange = RMobilePhone::ELockSetEnabled; - } - else - { - // Remote lock is disabled - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeAutoLockPeriodL() - RemoteLock is disabled: lockChange = RMobilePhone::ELockSetDisabled" ) ); - #endif // _DEBUG - - lockChange = RMobilePhone::ELockSetDisabled; - } - } - else - { - // Failed to get remote lock status - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeAutoLockPeriodL() - Failed to get RemoteLock status" ) ); - #endif // _DEBUG - } - - delete remoteLockSettings; - remoteLockSettings = NULL; - - #else // not defined RD_REMOTELOCK - - lockChange = RMobilePhone::ELockSetDisabled; - - #endif // RD_REMOTELOCK - } - else - { - lockChange = RMobilePhone::ELockSetEnabled; - } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() SetLockSetting")); - #endif - iWait->SetRequestType(EMobilePhoneSetLockSetting); - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); - iPhone.SetLockSetting(iWait->iStatus,lockType,lockChange); - TInt status = iWait->WaitForRequestL(); - #if defined(_DEBUG) - RDebug::Print( _L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL(): RETURN CODE: %d"), status); - #endif - switch(status) - { - case KErrNone: - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() KErrNone")); - #endif - break; - case KErrGsmSSPasswordAttemptsViolation: - case KErrLocked: - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() PasswordAttemptsViolation")); - #endif - return ChangeAutoLockPeriodL(oldPeriod); - case KErrGsm0707IncorrectPassword: - case KErrAccessDenied: - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() IncorrectPassword")); - #endif - // code was entered erroneously - return ChangeAutoLockPeriodL(oldPeriod); - case KErrAbort: - // User pressed "cancel" in the code query dialog. - return oldPeriod; - default: - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() default")); - #endif - return ChangeAutoLockPeriodL(oldPeriod); - } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() END")); - #endif - return aPeriod; - } - - - -// -// ---------------------------------------------------------- -// CSecuritySettings::ChangeRemoteLockStatusL() -// Changes remote lock status (on/off) -// ---------------------------------------------------------- -// -EXPORT_C TInt CSecuritySettings::ChangeRemoteLockStatusL( TBool& aRemoteLockStatus, TDes& aRemoteLockCode, TInt aAutoLockPeriod ) - { - #ifdef RD_REMOTELOCK - TInt retValue( KErrNone ); - - #ifdef _DEBUG - RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - Enter, aRemoteLockStatus == %d, aAutoLockPeriod == %d" ), aRemoteLockStatus, aAutoLockPeriod ); - #endif // _DEBUG - - CCoeEnv* coeEnv = CCoeEnv::Static(); - CDesCArrayFlat* items = coeEnv->ReadDesC16ArrayResourceL( R_REMOTELOCK_LBX ); - CleanupStack::PushL( items ); - - // Store the current remote lock setting - TInt previousItem( 0 ); - TInt currentItem( 0 ); - - if ( aRemoteLockStatus ) - { - previousItem = KRemoteLockSettingItemOn; - currentItem = KRemoteLockSettingItemOn; - } - else - { - previousItem = KRemoteLockSettingItemOff; - currentItem = KRemoteLockSettingItemOff; - } - - // Create Remote Lock setting page for user to enable or disable remote locking - CRemoteLockSettingPage* remoteLockSettingPage = new( ELeave ) CRemoteLockSettingPage( R_REMOTELOCK_SETTING_PAGE, currentItem, items ); - - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - Executing CRemoteLockSettingPage dialog" ) ); - #endif // _DEBUG - - // Execute the remote lock enable/disable dialog - TBool ret = remoteLockSettingPage->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ); - - // Setting page list box items (texts) no longer needed - CleanupStack::PopAndDestroy( items ); - - if ( ret ) - { - if ( currentItem == KRemoteLockSettingItemOn ) - { - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - Remote lock status set to ON" ) ); - #endif // _DEBUG - - aRemoteLockStatus = ETrue; - - // If user wishes to enable remote lock - // a new remote lock code is required. - // RemoteLockCodeQueryL also - retValue = RemoteLockCodeQueryL( aRemoteLockCode ); - } - else if ( currentItem == KRemoteLockSettingItemOff ) - { - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - Remote lock status set to OFF" ) ); - #endif // _DEBUG - - aRemoteLockStatus = EFalse; - retValue = KErrNone; - - // Check whether the status was already off - // If not don't make the user enter the security code - // (which occurs when setting the DOS lock setting) for no reason. - if ( currentItem != previousItem ) - { - // Check whether AutoLock is enabled (timeout value greater - // than zero) or not. If AutoLock is enabled the domestic OS - // device lock should be left enabled. - if ( aAutoLockPeriod == 0 ) - { - // Disable lock setting from domestic OS - retValue = RemoteLockSetLockSettingL( EFalse ); - } - else - { - // If AutoLock is enabled, don't disable the DOS device lock - // Re-set (enable) the domestic OS device lock because as a - // side effect it requires the security code from the user - retValue = RemoteLockSetLockSettingL( ETrue ); - } - } - } - else - { - // This should never happen. But if it does don't change anything - retValue = KErrUnknown; - } - } - else - { - // Something went wrong with the RemoteLockSettingPage dialog - retValue = KErrGeneral; - - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - CRemoteLockSettingPage::ExecuteLD() failed" ) ); - #endif // _DEBUG - } - - #ifdef _DEBUG - RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - Exit" ) ); - #endif - - return retValue; - #else //! RD_REMOTELOCK - return KErrNotSupported; - #endif //RD_REMOTELOCK - } -// -// ---------------------------------------------------------- -// CSecuritySettings::RemoteLockCodeQueryL() -// Pops up remote lock code query. Requires user to enter a new remote lock -// code twice and if they match enables the domestic OS device lock (which as -// a side effect pops up security code query). -// ---------------------------------------------------------- -// -TInt CSecuritySettings::RemoteLockCodeQueryL( TDes& aRemoteLockCode ) - { - #ifdef RD_REMOTELOCK - TInt retValue( KErrNone ); - - #ifdef _DEBUG - RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Enter" ) ); - #endif // _DEBUG - - // Clear the remote lock code buffer - aRemoteLockCode.Zero(); - - // ----- Remote lock code query ------------------------------------------- - - // Execute Remote Lock code query - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Executing remote lock code query" ) ); - #endif // _DEBUG - - // Load the query prompt from resources - CCodeQueryDialog* codeQuery = new( ELeave ) CCodeQueryDialog( aRemoteLockCode, SEC_REMOTELOCK_CODE_MIN_LENGTH,SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); - TInt buttonId = codeQuery->ExecuteLD( R_REMOTELOCK_CODE_QUERY ); - if ( buttonId == EEikBidOk ) - { - // Ok was pressed and the remote lock code seems fine - retValue = KErrNone; - } - else - { - // User pressed Cancel - // Set the code length to zero leaving no trash for possible retry - aRemoteLockCode.Zero(); - retValue = KErrAbort; - } - - if ( retValue != KErrNone ) - { - #ifdef _DEBUG - RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Exit, Remote lock code error" ) ); - #endif // _DEBUG - - // Can't continue beyond this - return retValue; - } - - // ----- Remote lock code confirm query ----------------------------------- - - // Confirm the code by asking it again - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Executing remote lock code verify query" ) ); - #endif // _DEBUG - - // Buffer for the confirmation code - TBuf confirmCode; - - // Load the confirmation query prompt from resources - CCodeQueryDialog* codeConfirmQuery = new( ELeave ) CCodeQueryDialog( confirmCode, SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); - buttonId = codeConfirmQuery->ExecuteLD( R_VERIFY_REMOTELOCK_CODE_QUERY); - - - if ( buttonId == EEikBidOk ) - { - // Compare codes. Compare returns zero if descriptors have - // the same length and the same content - while ( (aRemoteLockCode.CompareF( confirmCode ) != 0) && (buttonId == EEikBidOk)) - { - //Codes didn't match; zero the bufffers and show the dialog again - aRemoteLockCode.Zero(); - confirmCode.Zero(); - // Codes don't match. Notify user - ShowResultNoteL( R_REMOTELOCK_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone ); - codeQuery = new( ELeave ) CCodeQueryDialog( aRemoteLockCode, SEC_REMOTELOCK_CODE_MIN_LENGTH,SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); - buttonId = codeQuery->ExecuteLD( R_REMOTELOCK_CODE_QUERY ); - //Unless user pressed Cancel show the verification query - if(buttonId == EEikBidOk) - { - codeConfirmQuery = new( ELeave ) CCodeQueryDialog( confirmCode, SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); - buttonId = codeConfirmQuery->ExecuteLD( R_VERIFY_REMOTELOCK_CODE_QUERY); - } - - } - //User pressed cancel - if(buttonId != EEikBidOk) - { - // Set the code length to zero leaving no trash for possible retry - // Report error and let the user try again - aRemoteLockCode.Zero(); - confirmCode.Zero(); - retValue = KErrAbort; - } - else - { - // Codes match - confirmCode.Zero(); - - // ----- Check against security code ------------------------------ - - // Check that the new remote lock code doesn't match the security - // code of the device. - - RMobilePhone::TMobilePhoneSecurityCode secCodeType; - secCodeType = RMobilePhone::ESecurityCodePhonePassword; - RMobilePhone::TMobilePassword securityCode; - RMobilePhone::TMobilePassword unblockCode; // Required here only as a dummy parameter - - if ( aRemoteLockCode.Length() <= RMobilePhone::KMaxMobilePasswordSize ) - { - securityCode = aRemoteLockCode; - iWait->SetRequestType( EMobilePhoneVerifySecurityCode ); - iPhone.VerifySecurityCode( iWait->iStatus, secCodeType, securityCode, unblockCode ); - TInt res = iWait->WaitForRequestL(); - // The remote lock code matches the security code - // and that is not allowed - while ( (res == KErrNone) && (buttonId == EEikBidOk)) - { - #ifdef _DEBUG - RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Unacceptable remote lock code" ) ); - #endif // _DEBUG - aRemoteLockCode.Zero(); - confirmCode.Zero(); - - ShowResultNoteL( R_REMOTELOCK_INVALID_CODE, CAknNoteDialog::EErrorTone ); - - codeQuery = new( ELeave ) CCodeQueryDialog( aRemoteLockCode, SEC_REMOTELOCK_CODE_MIN_LENGTH,SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); - buttonId = codeQuery->ExecuteLD( R_REMOTELOCK_CODE_QUERY ); - //Unless user pressed Cancel show the verification query - if(buttonId == EEikBidOk) - { - codeConfirmQuery = new( ELeave ) CCodeQueryDialog( confirmCode, SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); - buttonId = codeConfirmQuery->ExecuteLD( R_VERIFY_REMOTELOCK_CODE_QUERY); - - // Compare codes. Compare returns zero if descriptors have - // the same length and the same content - while ( (aRemoteLockCode.CompareF( confirmCode ) != 0) && (buttonId == EEikBidOk)) - { - //Codes didn't match; zero the bufffers and show the dialog again - aRemoteLockCode.Zero(); - confirmCode.Zero(); - // Codes don't match. Notify user - ShowResultNoteL( R_REMOTELOCK_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone ); - codeQuery = new( ELeave ) CCodeQueryDialog( aRemoteLockCode, SEC_REMOTELOCK_CODE_MIN_LENGTH,SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); - buttonId = codeQuery->ExecuteLD( R_REMOTELOCK_CODE_QUERY ); - //Unless user pressed Cancel show the verification query - if(buttonId == EEikBidOk) - { - codeConfirmQuery = new( ELeave ) CCodeQueryDialog( confirmCode, SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); - buttonId = codeConfirmQuery->ExecuteLD( R_VERIFY_REMOTELOCK_CODE_QUERY); - } - - } - //User pressed cancel - if(buttonId != EEikBidOk) - { - // Set the code length to zero leaving no trash for possible retry - // Report error and let the user try again - aRemoteLockCode.Zero(); - confirmCode.Zero(); - retValue = KErrAbort; - } - else //Check against security code - { - securityCode = aRemoteLockCode; - iWait->SetRequestType( EMobilePhoneVerifySecurityCode ); - iPhone.VerifySecurityCode( iWait->iStatus, secCodeType, securityCode, unblockCode ); - res = iWait->WaitForRequestL(); - } - } - - } - //User pressed cancel - if(buttonId != EEikBidOk) - { - // Set the code length to zero leaving no trash for possible retry - // Report error and let the user try again - aRemoteLockCode.Zero(); - confirmCode.Zero(); - retValue = KErrAbort; - } - } - - // ----- Enable DOS device lock (Security code query) ------------- - - if ( retValue == KErrNone ) - { - // Enable lock setting in domestic OS. It is safe to enable the - // lock setting since RemoteLock API requires remote locking to - // be enabled when changing or setting the remote lock message. - retValue = RemoteLockSetLockSettingL( ETrue ); - } - } - } - else //User pressed Cancel - { - // Set the code length to zero leaving no trash for possible retry - aRemoteLockCode.Zero(); - confirmCode.Zero(); - retValue = KErrAbort; - } - - #ifdef _DEBUG - RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Exit" ) ); - #endif // _DEBUG - - return retValue; - #else //! RD_REMOTELOCK - return KErrNotSupported; - #endif //RD_REMOTELOCK - } -// -// ---------------------------------------------------------- -// CSecuritySettings::RemoteLockSetLockSettingL() -// Changes lock setting in domestic OS. Changing the domestic OS lock setting -// requires user to enter the security code. -// ---------------------------------------------------------- -// -TInt CSecuritySettings::RemoteLockSetLockSettingL( TBool aLockSetting ) - { - #ifdef RD_REMOTELOCK - TInt retValue( KErrNone ); - - #ifdef _DEBUG - RDebug::Print(_L("(SecUi)CSecuritySettings::RemoteLockSetLockSettingL( %d ) - Enter" ), aLockSetting ); - #endif // _DEBUG - - RMobilePhone::TMobilePhoneLockSetting lockSetting = RMobilePhone::ELockSetEnabled; - RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; - - if ( aLockSetting ) - { - lockSetting = RMobilePhone::ELockSetEnabled; - } - else - { - lockSetting = RMobilePhone::ELockSetDisabled; - } - - iWait->SetRequestType( EMobilePhoneSetLockSetting ); - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); - iPhone.SetLockSetting( iWait->iStatus, lockType, lockSetting ); - - // Wait for code verify to complete - retValue = iWait->WaitForRequestL(); - - switch( retValue ) - { - case KErrNone: - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecuritySettings::RemoteLockSetLockSettingL() - EMobilePhoneSetLockSetting request returned KErrNone" ) ); - #endif // _DEBUG - break; - - case KErrGsmSSPasswordAttemptsViolation: - case KErrLocked: - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecuritySettings::RemoteLockSetLockSettingL() - EMobilePhoneSetLockSetting request returned KErrLocked" ) ); - #endif // _DEBUG - //Error note is shown in CSecurityHandler::PassPhraseRequired() - break; - - case KErrGsm0707IncorrectPassword: - case KErrAccessDenied: - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecuritySettings::RemoteLockSetLockSettingL() - EMobilePhoneSetLockSetting request returned KErrAccessDenied" ) ); - #endif // _DEBUG - // Security code was entered erroneously - //Error note is shown in CSecurityHandler::PassPhraseRequired() - break; - - case KErrAbort: - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecuritySettings::RemoteLockSetLockSettingL() - EMobilePhoneSetLockSetting request returned KErrAbort" ) ); - #endif // _DEBUG - break; - - default: - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecuritySettings::RemoteLockSetLockSettingL() - EMobilePhoneSetLockSetting request returned: %d"), retValue ); - #endif // _DEBUG - break; - } - - #ifdef _DEBUG - RDebug::Print(_L("(SecUi)CSecuritySettings::RemoteLockSetLockSettingL() - Exit" ) ); - #endif // _DEBUG - - return retValue; - #else //! RD_REMOTELOCK - return KErrNotSupported; - #endif //RD_REMOTELOCK - } - - - -// -// ---------------------------------------------------------- -// CSecuritySettings::ChangeSimSecurityL() -// Changes SIM security -// ---------------------------------------------------------- -// -EXPORT_C TBool CSecuritySettings::ChangeSimSecurityL() - { - /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeSimSecurityL()")); - #endif - - RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; - RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); - RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneToICC; - RMobilePhone::TMobilePhoneLockSetting lockChangeSetting; - CCoeEnv* coeEnv = CCoeEnv::Static(); - CDesCArrayFlat* items = coeEnv->ReadDesC16ArrayResourceL(R_SECURITY_LBX); - CleanupStack::PushL(items); - - //get lock info - iWait->SetRequestType(EMobilePhoneGetLockInfo); - iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); - TInt status = iWait->WaitForRequestL(); - User::LeaveIfError(status); - TInt currentItem = 0; - - if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeSimSecurityL()lockInfo: ELockSetDisabled")); - #endif - currentItem = 1; // off - } - - TInt oldItem = currentItem; - - CAknRadioButtonSettingPage* dlg = new (ELeave)CAknRadioButtonSettingPage(R_SECURITY_SETTING_PAGE, currentItem, items); - CleanupStack::PushL(dlg); - - - CleanupStack::Pop(); // dlg - if ( !(dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged)) || oldItem==currentItem ) - { - CleanupStack::PopAndDestroy(); // items - return EFalse; - } - - - - if (currentItem == 1) - { - lockChangeSetting = RMobilePhone::ELockSetDisabled; - } - else - { - lockChangeSetting = RMobilePhone::ELockSetEnabled; - } - - CleanupStack::PopAndDestroy(); // items - - iWait->SetRequestType(EMobilePhoneSetLockSetting); - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); - iPhone.SetLockSetting(iWait->iStatus,lockType,lockChangeSetting); - status = iWait->WaitForRequestL(); - - #if defined(_DEBUG) - RDebug::Print( _L("(SECUI)CSecuritySettings::ChangeSimSecurityL(): RETURN CODE: %d"), status); - #endif - switch(status) - { - case KErrNone: - { - break; - } - case KErrGsm0707IncorrectPassword: - case KErrAccessDenied: - { - // code was entered erroneously - return ChangeSimSecurityL(); - } - case KErrGsmSSPasswordAttemptsViolation: - case KErrLocked: - { - return ChangeSimSecurityL(); - } - case KErrAbort: - { - return EFalse; - } - default: - { - ShowErrorNoteL(status); - return ChangeSimSecurityL(); - } - } - - return ETrue; - } -// -// ---------------------------------------------------------- -// CSecuritySettings::ChangePinRequestL() -// Changes PIN1 request -// ---------------------------------------------------------- -// -EXPORT_C TBool CSecuritySettings::ChangePinRequestL() - { - /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL()")); - #endif - TInt simState; - TInt err( KErrGeneral ); - err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); - User::LeaveIfError( err ); - TBool simRemoved(simState == ESimNotPresent); - - if ( simRemoved ) - { - ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); - return EFalse;; - } - - RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; - RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); - RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockICC; - - RMobilePhone::TMobilePhoneLockSetting lockChangeSetting; - - CCoeEnv* coeEnv = CCoeEnv::Static(); - CDesCArrayFlat* items = coeEnv->ReadDesC16ArrayResourceL(R_PIN_LBX); - CleanupStack::PushL(items); - - //get lock info - iWait->SetRequestType(EMobilePhoneGetLockInfo); - iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); - TInt status = iWait->WaitForRequestL(); - User::LeaveIfError(status); - TInt currentItem = 0; - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL() GetLockInfo")); - #endif - - if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL() lockInfo: ELockSetDisabled")); - #endif - currentItem = 1; // off - } - - TInt oldItem = currentItem; - - CAknRadioButtonSettingPage* dlg = new (ELeave)CAknRadioButtonSettingPage(R_PIN_SETTING_PAGE, currentItem, items); - CleanupStack::PushL(dlg); - - - CleanupStack::Pop(); // dlg - if ( !(dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged)) || oldItem==currentItem ) - { - CleanupStack::PopAndDestroy(); // items - return EFalse; - } - - - if (currentItem == 1) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL() currentItem: ELockSetDisabled")); - #endif - lockChangeSetting = RMobilePhone::ELockSetDisabled; - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL() currentItem: ELockSetEnabled")); - #endif - lockChangeSetting = RMobilePhone::ELockSetEnabled; - } - - CleanupStack::PopAndDestroy(); // items - - // Raise a flag to indicate that the PIN - // request coming from ETEL has originated from SecUi and not from Engine. - TInt tRet = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginated); - if ( tRet != KErrNone ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL():\ - FAILED to set the SECUI query Flag: %d"), tRet); - #endif - } - // Change the lock setting - iWait->SetRequestType(EMobilePhoneSetLockSetting); - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); - iPhone.SetLockSetting(iWait->iStatus,lockType,lockChangeSetting); - status = iWait->WaitForRequestL(); - #if defined(_DEBUG) - RDebug::Print( _L("(SECUI)CSecuritySettings::ChangePinRequestL(): RETURN CODE: %d"), status); - #endif - - // Lower the flag - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsETelAPIOriginated); - - switch(status) - { - case KErrNone: - { - break; - } - case KErrGsm0707OperationNotAllowed: - { - // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); - return EFalse; - } - case KErrGsm0707IncorrectPassword: - case KErrAccessDenied: - { - // code was entered erroneously - return ChangePinRequestL(); - } - case KErrGsmSSPasswordAttemptsViolation: - case KErrLocked: - { - return ETrue; - } - case KErrAbort: - { - return EFalse; - } - default: - { - return ChangePinRequestL(); - } - } - - return ETrue; - } - -// -// ---------------------------------------------------------- -// CSecuritySettings::ChangeUPinRequestL() -// Changes UPIN request on/off -// ---------------------------------------------------------- -// -EXPORT_C TBool CSecuritySettings::ChangeUPinRequestL() - { - TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); - if(wcdmaSupported || upinSupported) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinRequestL()")); - #endif - - TInt simState; - TInt err( KErrGeneral ); - err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); - User::LeaveIfError( err ); - TBool simRemoved(simState == ESimNotPresent); - - if ( simRemoved ) - { - ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); - return EFalse; - } - - RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; - RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); - RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockUniversalPin; - - RMobilePhone::TMobilePhoneLockSetting lockChangeSetting = RMobilePhone::ELockSetDisabled; - - CCoeEnv* coeEnv = CCoeEnv::Static(); - CDesCArrayFlat* items = coeEnv->ReadDesC16ArrayResourceL(R_UPIN_LBX); - CleanupStack::PushL(items); - - //get lock info - iWait->SetRequestType(EMobilePhoneGetLockInfo); - iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); - TInt status = iWait->WaitForRequestL(); - User::LeaveIfError(status); - TInt currentItem = 0; - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinRequestL() GetLockInfo")); - #endif - - if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinRequestL() lockInfo: ELockSetDisabled")); - #endif - currentItem = 1; // off - } - - TInt oldItem = currentItem; - - CAknRadioButtonSettingPage* dlg = new (ELeave)CAknRadioButtonSettingPage(R_UPIN_SETTING_PAGE, currentItem, items); - CleanupStack::PushL(dlg); - - - CleanupStack::Pop(); // dlg - if ( !(dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged)) || oldItem==currentItem ) - { - CleanupStack::PopAndDestroy(); // items - return EFalse; - } - - - if (currentItem == 1) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL() currentItem: ELockSetDisabled")); - #endif - lockChangeSetting = RMobilePhone::ELockSetDisabled; - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL() currentItem: ELockSetEnabled")); - #endif - lockChangeSetting = RMobilePhone::ELockSetEnabled; - } - - CleanupStack::PopAndDestroy(); // items - - // Raise a flag to indicate that the UPIN - // request coming from ETEL has originated from SecUi and not from Engine. - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginated); - // Change the lock setting - iWait->SetRequestType(EMobilePhoneSetLockSetting); - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); - iPhone.SetLockSetting(iWait->iStatus,lockType,lockChangeSetting); - status = iWait->WaitForRequestL(); - #if defined(_DEBUG) - RDebug::Print( _L("(SECUI)CSecuritySettings::ChangeUPinRequestL(): RETURN CODE: %d"), status); - #endif - - // Lower the flag - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsETelAPIOriginated); - - switch(status) - { - case KErrNone: - { - break; - } - case KErrGsm0707OperationNotAllowed: - { - // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); - return EFalse; - } - case KErrGsm0707IncorrectPassword: - case KErrAccessDenied: - { - // code was entered erroneously - return ChangeUPinRequestL(); - } - case KErrGsmSSPasswordAttemptsViolation: - case KErrLocked: - { - return EFalse; - } - case KErrAbort: - { - return EFalse; - } - default: - { - ShowErrorNoteL(status); - return ChangeUPinRequestL(); - } - } - - return ETrue; - } - else - return EFalse; - - } - -// -// ---------------------------------------------------------- -// CSecuritySettings::SwitchPinCodesL() -// Changes the pin code currently in use (PIN/UPIN) -// ---------------------------------------------------------- -// -EXPORT_C TBool CSecuritySettings::SwitchPinCodesL() - { - TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); - if(wcdmaSupported || upinSupported) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL()")); - #endif - - // If we are in simless offline mode the PIN codes can't obviously be switched - TInt simState; - TInt err( KErrGeneral ); - err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); - User::LeaveIfError( err ); - TBool simRemoved(simState == ESimNotPresent); - - if ( simRemoved ) - { - ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); - return EFalse; - } - - - RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockUniversalPin; - RMobilePhone::TMobilePhoneLockSetting lockChangeSetting = RMobilePhone::ELockReplaced; - RMobilePhone::TMobilePhoneSecurityCode activeCode; - - iCustomPhone.GetActivePin(activeCode); - - RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; - RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() GetLockInfo")); - #endif - iWait->SetRequestType(EMobilePhoneGetLockInfo); - - if (activeCode == RMobilePhone::ESecurityUniversalPin) - { - lockType = RMobilePhone::ELockUniversalPin; - iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); - TInt res = iWait->WaitForRequestL(); - User::LeaveIfError(res); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() Lock Info got: UPIN")); - #endif - } - else - { - lockType = RMobilePhone::ELockICC; - iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); - TInt res = iWait->WaitForRequestL(); - User::LeaveIfError(res); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() Lock Info got: PIN")); - #endif - } - - // code request must be ON to change active code. - if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() CODE REQ NOT ON.")); - #endif - if (activeCode == RMobilePhone::ESecurityUniversalPin) - { - ShowResultNoteL(R_UPIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); - } - else - { - ShowResultNoteL(R_PIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); - } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() CODE REQ NOT ON NOTE END.")); - #endif - return EFalse; - } - - - - CCoeEnv* coeEnv = CCoeEnv::Static(); - CDesCArrayFlat* items = coeEnv->ReadDesC16ArrayResourceL(R_CODE_LBX); - CleanupStack::PushL(items); - - iCustomPhone.GetActivePin(activeCode); - TInt currentItem = 0; - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() GetLockInfo")); - #endif - - if (activeCode == RMobilePhone::ESecurityUniversalPin) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() active code: UPIN")); - #endif - currentItem = 1; // UPIN - } - - TInt oldItem = currentItem; - - CAknRadioButtonSettingPage* dlg = new (ELeave)CAknRadioButtonSettingPage(R_CODE_IN_USE_SETTING_PAGE, currentItem, items); - CleanupStack::PushL(dlg); - - - CleanupStack::Pop(); // dlg - if ( !(dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged)) || oldItem==currentItem ) - { - CleanupStack::PopAndDestroy(); // items - return EFalse; - } - - - if (currentItem == 1) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() currentItem: UPIN")); - #endif - lockType = RMobilePhone::ELockUniversalPin; - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() currentItem: PIN1")); - #endif - lockType = RMobilePhone::ELockICC; - } - - CleanupStack::PopAndDestroy(); // items - - // Raise a flag to indicate that the code - // request coming from ETEL has originated from SecUi and not from Engine. - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginated); - // Change the lock setting - iWait->SetRequestType(EMobilePhoneSetLockSetting); - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); - iPhone.SetLockSetting(iWait->iStatus,lockType,lockChangeSetting); - TInt status = iWait->WaitForRequestL(); - #if defined(_DEBUG) - RDebug::Print( _L("(SECUI)CSecuritySettings::SwitchPinCodesL(): RETURN CODE: %d"), status); - #endif - // Lower the flag - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsETelAPIOriginated); - - switch(status) - { - case KErrNone: - { - break; - } - case KErrGsm0707OperationNotAllowed: - { - // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); - return EFalse; - } - case KErrGsm0707IncorrectPassword: - case KErrAccessDenied: - { - // code was entered erroneously - return SwitchPinCodesL(); - } - case KErrGsmSSPasswordAttemptsViolation: - case KErrLocked: - { - return EFalse; - } - case KErrAbort: - { - return EFalse; - } - default: - { - ShowErrorNoteL(status); - return SwitchPinCodesL(); - } - } - - return ETrue; - } - else - return EFalse; - } - -// -// ---------------------------------------------------------- -// CSecuritySettings::IsLockEnabledL() -// Return is lock enabled/disabled -// ---------------------------------------------------------- -// -EXPORT_C TBool CSecuritySettings::IsLockEnabledL(RMobilePhone::TMobilePhoneLock aLockType) - { - /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsLockEnabledL()")); - #endif - #ifdef __WINS__ - - return EFalse; - - #else //WINS - - RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; - - //get lock info - RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); - iWait->SetRequestType(EMobilePhoneGetLockInfo); - iPhone.GetLockInfo(iWait->iStatus, aLockType, lockInfoPkg); - TInt res = iWait->WaitForRequestL(); - - if (res != KErrNone) - return ETrue; - - //lock is enabled return true - if (lockInfo.iSetting == RMobilePhone::ELockSetEnabled) - { - return ETrue; - } - - // lock is disabled return false - return EFalse; - - #endif - - } -// -// ---------------------------------------------------------- -// CSecuritySettings::AskSecCodeL() -// For asking security code e.g in settings -// ---------------------------------------------------------- -// -EXPORT_C TBool CSecuritySettings::AskSecCodeL() - { - return iSecurityHandler->AskSecCodeL(); - } -// -// ---------------------------------------------------------- -// CSecuritySettings::AskPin2L() -// Asks PIN2 -// ---------------------------------------------------------- -// -EXPORT_C TBool CSecuritySettings::AskPin2L() - { - /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::AskPin2L()")); - #endif - TInt ret = 0; - // check if pin2 is blocked... - RMmCustomAPI::TSecurityCodeType secCodeType = RMmCustomAPI::ESecurityCodePin2; - RMobilePhone::TMobilePhoneSecurityCode etelsecCodeType(RMobilePhone::ESecurityCodePin2); - RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; - RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); - TBool isBlocked = EFalse; - //Check whether PIN2 is blocked - ret = iCustomPhone.IsBlocked(secCodeType,isBlocked); - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::AskPin2L() IsBlocked return value: %d"), ret); - #endif - if(isBlocked) - return EFalse; - - if (ret != KErrNone) - { - switch (ret) - { - // PIN2 Blocked. - case KErrGsm0707SIMPuk2Required: - break; - case KErrGsmSSPasswordAttemptsViolation: - case KErrLocked: - // Pin2 features blocked permanently! - ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); - break; - case KErrGsm0707SimNotInserted: - // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); - break; - default: - ShowErrorNoteL(ret); - break; - } - return EFalse; - } - iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); - iPhone.GetSecurityCodeInfo(iWait->iStatus, etelsecCodeType, codeInfoPkg); - ret = iWait->WaitForRequestL(); - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): get PIN2 info result: %d"), ret); - TInt attempts(codeInfo.iRemainingEntryAttempts); - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): attempts remaining: %d"), attempts); - #endif - User::LeaveIfError(ret); - - // ask pin2 code - RMobilePhone::TMobilePassword password; - CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (password,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) - ret = dlg->ExecuteLD(R_PIN2_QUERY); - else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PIN2_ATTEMPTS, codeInfo.iRemainingEntryAttempts ); - ret = dlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - else - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PIN2_ATTEMPT); - ret = dlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - - if (!ret) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::AskPin2L(): Cancel pressed")); - #endif - return EFalse; - } - - // verify code - RMobilePhone::TMobilePassword required_fourth; - iWait->SetRequestType(EMobilePhoneVerifySecurityCode); - iPhone.VerifySecurityCode(iWait->iStatus,etelsecCodeType, password, required_fourth); - TInt res = iWait->WaitForRequestL(); - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::AskPin2L() VerifySecurityCode return value: %d"), res); - #endif - - switch(res) - { - case KErrNone: - break; - case KErrGsm0707IncorrectPassword: - case KErrAccessDenied: - // code was entered erroneously - ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); - return AskPin2L(); - case KErrGsm0707OperationNotAllowed: - // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); - return EFalse; - case KErrGsmSSPasswordAttemptsViolation: - case KErrLocked: - // code was blocked - ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); - return EFalse; - default: - ShowErrorNoteL(res); - return AskPin2L(); - } - - return ETrue; - } -// -// ---------------------------------------------------------- -// CSecuritySettings::SetFdnModeL() -// Activates or deactivates Fixed Dialling Numbers (FDN) mode. -// ---------------------------------------------------------- -// -EXPORT_C void CSecuritySettings::SetFdnModeL() - { - /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::SetFdnModeL()")); - #endif - RMmCustomAPI::TSecurityCodeType secCodeType = RMmCustomAPI::ESecurityCodePin2; - - TBool isBlocked = EFalse; - TInt ret = iCustomPhone.IsBlocked(secCodeType,isBlocked); - - if(isBlocked) - return; - - if (ret != KErrNone) - { - switch (ret) - { - // PIN2 Blocked. - case KErrGsm0707SIMPuk2Required: - break; - case KErrGsmSSPasswordAttemptsViolation: - case KErrLocked: - // Pin2 features blocked permanently! - ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); - break; - case KErrGsm0707SimNotInserted: - // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); - break; - default: - ShowErrorNoteL(ret); - break; - } - return; - } - - TInt status = KErrNone; RMobilePhone::TMobilePhoneFdnStatus fdnMode; RMobilePhone::TMobilePhoneFdnSetting fdnSet; - + iPhone.GetFdnStatus(fdnMode); - + if (fdnMode == RMobilePhone::EFdnActive) { fdnSet = RMobilePhone::EFdnSetOff; } else { - fdnSet = RMobilePhone::EFdnSetOn; + fdnSet = RMobilePhone::EFdnSetOn; } - - // Change the FDN setting + RDEBUG("fdnSet", fdnSet); + // Change the FDN setting iWait->SetRequestType(EMobilePhoneSetFdnSetting); RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); + RDEBUG("SetFdnSetting", 0); iPhone.SetFdnSetting(iWait->iStatus, fdnSet); + RDEBUG("WaitForRequestL", 0); status = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL status", status); +#ifdef __WINS__ + if (status == KErrNotSupported) + status = KErrNone; +#endif - #if defined(_DEBUG) - RDebug::Print( _L("(SECUI)CSecuritySettings::SetFdnModeL(): RETURN CODE: %d"), status); - #endif - switch(status) - { + RDEBUG("status", status); + switch (status) + { case KErrNone: break; case KErrGsm0707IncorrectPassword: @@ -2401,23 +1178,21 @@ default: ShowErrorNoteL(status); break; - } - } + } + } // // ---------------------------------------------------------- // CSecuritySettings::GetFndMode() // Retrieves the current Fixed Dialling Numbers mode // ---------------------------------------------------------- -// -EXPORT_C TInt CSecuritySettings::GetFdnMode (RMobilePhone::TMobilePhoneFdnStatus& aFdnMode) +// qtdone +EXPORT_C TInt CSecuritySettings::GetFdnMode(RMobilePhone::TMobilePhoneFdnStatus& aFdnMode) { /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::GetFdnMode()")); - #endif + * Series 60 Customer / ETel + * Series 60 ETel API + *****************************************************/ + RDEBUG("0", 0); return iPhone.GetFdnStatus(aFdnMode); } @@ -2426,24 +1201,12 @@ // CSecuritySettings::ShowErrorNoteL() // Shows error note // ---------------------------------------------------------- -// +// qtdone void CSecuritySettings::ShowErrorNoteL(TInt aError) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ShowErrorNoteL()")); - #endif - // Let's create TextResolver instance for error resolving... - CTextResolver* textresolver = CTextResolver::NewLC(); - // Resolve the error - TPtrC errorstring; - errorstring.Set( textresolver->ResolveErrorString( aError ) ); - CAknNoteDialog* noteDlg = new (ELeave) CAknNoteDialog(REINTERPRET_CAST(CEikDialog**,¬eDlg)); - noteDlg->PrepareLC(R_CODE_ERROR); - noteDlg->SetTextL((TDesC&)errorstring); - noteDlg->SetTimeout(CAknNoteDialog::ELongTimeout); - noteDlg->SetTone(CAknNoteDialog::EErrorTone); - noteDlg->RunLD(); - CleanupStack::PopAndDestroy(); // resolver + RDEBUG("aError", aError); + + ShowResultNoteL(aError, CAknNoteDialog::EErrorTone); } // @@ -2451,17 +1214,258 @@ // CSecuritySettings::ShowResultNoteL() // Shows result note // ---------------------------------------------------------- -// +// qtdone void CSecuritySettings::ShowResultNoteL(TInt aResourceID, CAknNoteDialog::TTone aTone) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ShowResultNoteL()")); - RDebug::Print(_L("(SECUI)CSecuritySettings::ShowResultNoteL() Resource ID: %d"), aResourceID); - #endif - CAknNoteDialog* noteDlg = new (ELeave) CAknNoteDialog(REINTERPRET_CAST(CEikDialog**,¬eDlg)); - noteDlg->SetTimeout(CAknNoteDialog::ELongTimeout); - noteDlg->SetTone(aTone); - noteDlg->ExecuteLD(aResourceID); + { + RDEBUG("aResourceID", aResourceID); + + CHbDeviceMessageBoxSymbian* messageBox = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EWarning); + CleanupStack::PushL(messageBox); + TInt satisfactoryIcon = 0; // might change later, in some scenarios + _LIT(KText, "ShowResultNoteL: "); + TBuf<0x200> title; + TBuf<0x200> titleTr; + title.Zero(); + titleTr.Zero(); + title.Append(KText); + title.AppendNum(aResourceID); + _LIT(KSeparator, " "); + title.Append(KSeparator); + switch (aResourceID) + { + case 0: + titleTr.Append(_L("OK")); + title.Append(_L("OK")); + satisfactoryIcon = 1; + break; + case KErrGsm0707IncorrectPassword: + titleTr.Append(_L("txt_pin_code_dpophead_wrong_pin_code")); // TODO this also happens for lock-code + title.Append(_L("Incorrect Password")); + break; + case KErrAccessDenied: + titleTr.Append(_L("txt_pin_code_dpopinfo_access_denied")); + title.Append(_L("Access Denied")); + break; + case KErrGsmSSPasswordAttemptsViolation: + titleTr.Append(_L("KErrGsmSSPasswordAttemptsViolation")); + title.Append(_L("Password Attempts Violation")); + break; + case KErrLocked: + titleTr.Append(_L("KErrLocked")); + title.Append(_L("Locked")); + break; + case KErrGsm0707OperationNotAllowed: + titleTr.Append(_L("KErrGsm0707OperationNotAllowed")); + title.Append(_L("Operation Not Allowed")); + break; + case KErrAbort: + titleTr.Append(_L("KErrAbort")); + title.Append(_L("Abort")); + break; + case KErrNotSupported: + titleTr.Append(_L("txt_pin_code_dpopinfo_operation_not_supported")); + title.Append(_L("Not Supported")); + break; + case R_SEC_BLOCKED: + titleTr.Append(_L("txt_pin_code_dpopinfo_security_blocked")); + title.Append(_L("BLOCKED")); + break; + case R_CODE_ERROR: + titleTr.Append(_L("R_CODE_ERROR")); + title.Append(_L("ERROR")); + break; + case KErrGsmInvalidParameter: + titleTr.Append(_L("txt_pin_code_dpopinfo_gsm_invalid_parameter")); + title.Append(_L("Invalid Parameter")); + break; + case R_CONFIRMATION_NOTE: + titleTr.Append(_L("R_CONFIRMATION_NOTE")); + title.Append(_L("CONFIRMED")); + satisfactoryIcon = 1; + break; + case R_CODES_DONT_MATCH: + titleTr.Append(_L("R_CODES_DONT_MATCH")); + title.Append(_L("CODES DONT MATCH")); + break; + case R_PIN_CODE_CHANGED_NOTE: + titleTr.Append(_L("txt_pin_code_dpopinfo_code_chaged")); // note the spelling mistake "chaged" + title.Append(_L("PIN CODE CHANGED")); + satisfactoryIcon = 1; + break; + case R_SECURITY_CODE_CHANGED_NOTE: + titleTr.Append(_L("R_SECURITY_CODE_CHANGED_NOTE")); + title.Append(_L("SECURITY CODE CHANGED")); + satisfactoryIcon = 1; + break; + case R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE: + titleTr.Append(_L("txt_pin_code_dpopinfo_autolock_must_be_active")); + title.Append(_L("AUTOLOCK MUST BE ACTIVE")); + break; + case KErrServerTerminated: + titleTr.Append(_L("KErrServerTerminated")); + title.Append(_L("Server Terminated")); + break; + case KErrServerBusy: + titleTr.Append(_L("KErrServerBusy")); + title.Append(_L("Server Busy")); + break; + case R_PIN2_REJECTED: + titleTr.Append(_L("txt_pin_code_dpopinfo_pin2_rejected")); + title.Append(_L("PIN2 REJECTED")); + break; + case R_OPERATION_NOT_ALLOWED: + titleTr.Append(_L("R_OPERATION_NOT_ALLOWED")); + title.Append(_L("OPERATION NOT ALLOWED")); + break; + case R_UPIN_NOT_ALLOWED: + titleTr.Append(_L("txt_pin_code_dpopinfo_upin_not_allowed")); + title.Append(_L("UPIN NOT ALLOWED")); + break; + case R_PIN_NOT_ALLOWED: + titleTr.Append(_L("R_PIN_NOT_ALLOWED")); + title.Append(_L("PIN NOT ALLOWED")); + break; + case R_INSERT_SIM: + titleTr.Append(_L("txt_pin_code_dpopinfo_insert_sim")); + title.Append(_L("INSERT SIM")); + break; + case R_SIM_ON: + titleTr.Append(_L("R_SIM_ON")); + title.Append(_L("SIM ON")); + break; + case KErrTimedOut: + titleTr.Append(_L("KErrTimedOut")); + title.Append(_L("Timed Out")); + break; + case R_PIN2_CODE_CHANGED_NOTE: + titleTr.Append(_L("R_PIN2_CODE_CHANGED_NOTE")); + title.Append(_L("PIN2 CODE CHANGED")); + break; + case KErrArgument: + titleTr.Append(_L("KErrArgument")); + title.Append(_L("Error Argument")); + break; + case R_SIM_OFF: + titleTr.Append(_L("R_SIM_OFF")); + title.Append(_L("SIM OFF")); + break; + case R_SIM_ALLREADY_OFF: + titleTr.Append(_L("R_SIM_ALLREADY_OFF")); + title.Append(_L("SIM ALLREADY OFF")); + break; + case R_SIM_NOT_ALLOWED: + titleTr.Append(_L("R_SIM_NOT_ALLOWED")); + title.Append(_L("SIM NOT ALLOWED")); + break; + case R_REMOTELOCK_INVALID_CODE: + titleTr.Append(_L("R_REMOTELOCK_INVALID_CODE")); + title.Append(_L("REMOTELOCK INVALID CODE")); + break; + + case KErrTDevicelockPolicies+EDeviceLockAutolockperiod: + titleTr.Append(_L("EDeviceLockAutolockperiod")); + title.Append(_L("EDeviceLockAutolockperiod")); + break; + case KErrTDevicelockPolicies+EDeviceLockMaxAutolockPeriod: + titleTr.Append(_L("EDeviceLockMaxAutolockPeriod")); + title.Append(_L("EDeviceLockMaxAutolockPeriod")); + break; + case KErrTDevicelockPolicies+EDeviceLockMinlength: + titleTr.Append(_L("EDeviceLockMinlength")); + title.Append(_L("EDeviceLockMinlength")); + break; + case KErrTDevicelockPolicies+EDeviceLockMaxlength: + titleTr.Append(_L("EDeviceLockMaxlength")); + title.Append(_L("EDeviceLockMaxlength")); + break; + case KErrTDevicelockPolicies+EDeviceLockRequireUpperAndLower: + titleTr.Append(_L("EDeviceLockRequireUpperAndLower")); + title.Append(_L("EDeviceLockRequireUpperAndLower")); + break; + case KErrTDevicelockPolicies+EDeviceLockRequireCharsAndNumbers: + titleTr.Append(_L("EDeviceLockRequireCharsAndNumbers")); + title.Append(_L("EDeviceLockRequireCharsAndNumbers")); + break; + case KErrTDevicelockPolicies+EDeviceLockAllowedMaxRepeatedChars: + titleTr.Append(_L("EDeviceLockAllowedMaxRepeatedChars")); + title.Append(_L("EDeviceLockAllowedMaxRepeatedChars")); + break; + case KErrTDevicelockPolicies+EDeviceLockHistoryBuffer: + titleTr.Append(_L("EDeviceLockHistoryBuffer")); + title.Append(_L("EDeviceLockHistoryBuffer")); + break; + case KErrTDevicelockPolicies+EDeviceLockPasscodeExpiration: + titleTr.Append(_L("EDeviceLockPasscodeExpiration")); + title.Append(_L("EDeviceLockPasscodeExpiration")); + break; + case KErrTDevicelockPolicies+EDeviceLockMinChangeTolerance: + titleTr.Append(_L("EDeviceLockMinChangeTolerance")); + title.Append(_L("EDeviceLockMinChangeTolerance")); + break; + case KErrTDevicelockPolicies+EDeviceLockMinChangeInterval: + titleTr.Append(_L("EDeviceLockMinChangeInterval")); + title.Append(_L("EDeviceLockMinChangeInterval")); + break; + case KErrTDevicelockPolicies+EDeviceLockDisallowSpecificStrings: + titleTr.Append(_L("EDeviceLockDisallowSpecificStrings")); + title.Append(_L("EDeviceLockDisallowSpecificStrings")); + break; + case KErrTDevicelockPolicies+EDeviceLockAllowedMaxAtempts: + titleTr.Append(_L("EDeviceLockAllowedMaxAtempts")); + title.Append(_L("EDeviceLockAllowedMaxAtempts")); + break; + case KErrTDevicelockPolicies+EDeviceLockConsecutiveNumbers: + titleTr.Append(_L("EDeviceLockConsecutiveNumbers")); + title.Append(_L("EDeviceLockConsecutiveNumbers")); + break; + case KErrTDevicelockPolicies+EDeviceLockMinSpecialCharacters: + titleTr.Append(_L("EDeviceLockMinSpecialCharacters")); + title.Append(_L("EDeviceLockMinSpecialCharacters")); + break; + case KErrTDevicelockPolicies+EDeviceLockSingleCharRepeatNotAllowed: + titleTr.Append(_L("EDeviceLockSingleCharRepeatNotAllowed")); + title.Append(_L("EDeviceLockSingleCharRepeatNotAllowed")); + break; + case KErrTDevicelockPolicies+EDevicelockTotalPolicies: + titleTr.Append(_L("EDevicelockTotalPolicies")); + title.Append(_L("EDevicelockTotalPolicies")); + break; + + default: // " " + titleTr.Append(_L("Specific Error")); + title.Append(_L("Specific Error")); + break; + /* These ones are still unused */ + // txt_pin_code_dpopinfo_ln_attempts_remaining + // txt_pin_code_dpopinfo_emergency_calls_only + // txt_pin_code_dpopinfo_if_failed_be_ready_with_puk + } + + HBufC* stringHolder; + RDEBUG("titleTr", 1); + stringHolder = HbTextResolverSymbian::LoadLC(titleTr); // titleTr should I TRAP( err, ? + RDEBUG("got stringHolder", 1); + messageBox->SetTextL(stringHolder->Des()); // title + RDEBUG("aResourceID", aResourceID); + RDEBUGSTR(titleTr); + _LIT(KIconNameWondering, "qtg_small_smiley_wondering"); + _LIT(KIconNameSmile, "qtg_small_smiley_smile"); + if (satisfactoryIcon==1) + messageBox->SetIconNameL(KIconNameSmile); + else + messageBox->SetIconNameL(KIconNameWondering); + + if (aTone == CAknNoteDialog::EErrorTone) // another case is EConfirmationTone + { + messageBox->SetTimeout(messageBox->Timeout() * 2); // errors are displayed double time + } + // messageBox->ShowL(); + RDEBUG("calling ExecL", 0); + CHbDeviceMessageBoxSymbian::TButtonId selection = messageBox->ExecL(); // this guarantees that it waits for the dismiss/timeout + RDEBUG("called ExecL.selection", selection); + CleanupStack::PopAndDestroy(stringHolder); + CleanupStack::PopAndDestroy(); // messageBox + } // @@ -2469,139 +1473,1316 @@ // CSecuritySettings::IsUpinSupportedL() // Return is UPIN supported // ---------------------------------------------------------- -// +// qtdone EXPORT_C TBool CSecuritySettings::IsUpinSupportedL() -{ - TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); - if(wcdmaSupported || upinSupported) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported() BEGIN")); - #endif - #ifdef __WINS__ - - return EFalse; - - #else //WINS - + { + TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); + TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); + TBool isSupported = EFalse; + RDEBUG("wcdmaSupported", wcdmaSupported); + RDEBUG("upinSupported", upinSupported); + if (wcdmaSupported || upinSupported) + { RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; - + //get lock info RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); iWait->SetRequestType(EMobilePhoneGetLockInfo); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported() GetLockInfo")); - #endif + RDEBUG("GetLockInfo", 0); iPhone.GetLockInfo(iWait->iStatus, RMobilePhone::ELockUniversalPin, lockInfoPkg); + RDEBUG("WaitForRequestL", 0); TInt res = iWait->WaitForRequestL(); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported() GetLockInfo DONE")); - #endif + RDEBUG("WaitForRequestL res", res); if ((res == KErrNotSupported) || (res == KErrGsmInvalidParameter)) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported(): NOT SUPPORTED")); - #endif - return EFalse; + { + RDEBUG("0", 0); + isSupported = EFalse; + } + else + { + RDEBUG("1", 1); + isSupported = ETrue; + } } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported(): SUPPORTED: %d"), res); - #endif - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported() END")); - #endif - return ETrue; - - #endif //WINS - } else - return EFalse; -} + isSupported = EFalse; + RDEBUG("isSupported", isSupported); + return isSupported; + } // // ---------------------------------------------------------- -// CSecuritySettings::IsCodeBlocked() +// CSecuritySettings::IsUpinBlocked() // Return is a code blocked // ---------------------------------------------------------- -// +// qtdone EXPORT_C TBool CSecuritySettings::IsUpinBlocked() -{ -TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); - if(wcdmaSupported || upinSupported) - { - #ifdef __WINS__ - return EFalse; - #else//__WINS__ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinBlocked() BEGIN")); - #endif - RMmCustomAPI::TSecurityCodeType secCodeType; + { + TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); + TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); + if (wcdmaSupported || upinSupported) + { + RMmCustomAPI::TSecurityCodeType secCodeType; secCodeType = RMmCustomAPI::ESecurityUniversalPin; TBool isBlocked = EFalse; - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinBlocked() IsBlocked")); - #endif - TInt ret = iCustomPhone.IsBlocked(secCodeType,isBlocked); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinBlocked() DONE.RETURN: %d"), ret); - #endif - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinBlocked():isblocked: %d"), isBlocked); - #endif - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinBlocked() END")); - #endif + RDEBUG("IsBlocked", 0); + TInt ret = iCustomPhone.IsBlocked(secCodeType, isBlocked); + RDEBUG("ret", ret); + RDEBUG("isBlocked", isBlocked); return isBlocked; - #endif //__WINS__ - } + } else return EFalse; -} + } // // ---------------------------------------------------------- -// CSecuritySettings::GetActivePinCode() +// CSecuritySettings::IsUpinActive() // Return the code active in current application (PIN/UPIN) // ---------------------------------------------------------- -// +// qtdone EXPORT_C TBool CSecuritySettings::IsUpinActive() -{ - TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); - if(wcdmaSupported || upinSupported) - { - #ifdef __WINS__ - return EFalse; - #else//__WINS__ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive() BEGIN")); - #endif - RMobilePhone::TMobilePhoneSecurityCode activePin; - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive() GetActivePin")); - #endif + { + TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); + TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); + if (wcdmaSupported || upinSupported) + { + RMobilePhone::TMobilePhoneSecurityCode activePin; + RDEBUG("GetActivePin", 0); iCustomPhone.GetActivePin(activePin); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive() GetActivePin DONE")); - #endif - if(activePin == RMobilePhone::ESecurityUniversalPin) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive(): UPIN ACTIVE")); - #endif - return ETrue; + RDEBUG("activePin", activePin); + RDEBUG("RMobilePhone::ESecurityUniversalPin", + RMobilePhone::ESecurityUniversalPin); + if (activePin == RMobilePhone::ESecurityUniversalPin) + { + return ETrue; + } + return EFalse; } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive(): UPIN NOT ACTIVE")); - #endif - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive(): END")); - #endif - return EFalse; - #endif //__WINS__ - } else return EFalse; -} + } + +/**************************/ +// qtdone +EXPORT_C TInt CSecuritySettings::ChangePinParamsL(RMobilePhone::TMobilePassword aOldPassword, RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, TDes& aCaption, + TInt aShowError) + { + RDEBUG("aFlags", aFlags); + RDEBUG("aOldPassword", 0); + RDEBUGSTR(aOldPassword); + RDEBUG("aNewPassword", 0); + RDEBUGSTR(aNewPassword); + RDEBUG("aCaption", 0); + RDEBUGSTR(aCaption); + RDEBUG("aShowError", aShowError); + + /***************************************************** + * Series 60 Customer / ETel + * Series 60 ETel API + *****************************************************/ + + TInt simState; + TInt err(KErrGeneral); + err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); + User::LeaveIfError(err); + TBool simRemoved(simState == ESimNotPresent); + + RDEBUG("simRemoved", simRemoved); + if (simRemoved) + { + ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); + return KErrAccessDenied; + } + RMobilePhone::TMobilePhoneSecurityCode secCodeType; + secCodeType = RMobilePhone::ESecurityCodePin1; + + RMobilePhone::TMobilePassword oldPassword; + RMobilePhone::TMobilePassword newPassword; + RMobilePhone::TMobilePhonePasswordChangeV1 passwords; + RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; + RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); + RMobilePhone::TMobilePassword required_fourth; + TInt queryAccepted = KErrCancel; + + RDEBUG("0", 0); + + RMobilePhone::TMobilePhoneLock lockType; + RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; + + lockType = RMobilePhone::ELockICC; + + RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); + RDEBUG("0", 0); + iWait->SetRequestType(EMobilePhoneGetLockInfo); + TInt res = KErrNone; + RDEBUG("GetLockInfo", 0); + iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); + RDEBUG("WaitForRequestL", 0); + res = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); +#ifdef __WINS__ + if (res == KErrTimedOut) + { + lockInfo.iSetting = RMobilePhone::ELockSetEnabled; + res = KErrNone; + } +#endif + + User::LeaveIfError(res); + + if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) + { + RDEBUG("RMobilePhone::ELockSetDisabled", + RMobilePhone::ELockSetDisabled); + ShowResultNoteL(R_PIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + return KErrAccessDenied; + } + + RDEBUG("0", 0); + iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); + RDEBUG("GetSecurityCodeInfo", 0); + iPhone.GetSecurityCodeInfo(iWait->iStatus, secCodeType, codeInfoPkg); + RDEBUG("WaitForRequestL", 0); + res = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); +#ifdef __WINS__ + if (res == KErrNotSupported || res == KErrTimedOut) + { + res = KErrNone; + codeInfo.iRemainingEntryAttempts = KMaxNumberOfPINAttempts; + } +#endif + User::LeaveIfError(res); + + RDEBUG("codeInfo.iRemainingEntryAttempts", + codeInfo.iRemainingEntryAttempts); + if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) + codeInfo.iRemainingEntryAttempts = -1; + + RDEBUG("checking aOldPassword", 0); + if (aOldPassword.Length() == 0) + { + RDEBUG("asking aOldPassword", 0); + /* request PIN using QT */ + queryAccepted = KErrCancel; + CSecQueryUi *iSecQueryUi; + iSecQueryUi = CSecQueryUi::NewL(); + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("$")); + title.AppendNum(codeInfo.iRemainingEntryAttempts); + queryAccepted = iSecQueryUi->SecQueryDialog(title, oldPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported + | ESecUiEmergencyNotSupported | secCodeType); + RDEBUG("oldPassword", 0); + RDEBUGSTR(oldPassword); + RDEBUG("queryAccepted", queryAccepted); + delete iSecQueryUi; + if (queryAccepted != KErrNone) + return KErrAbort; + /* end request PIN using QT */ + + // verify it now, so that the user doesn't need to see the error _after_ typing the new ones + RDEBUG("VerifySecurityCode", 0); + iPhone.VerifySecurityCode(iWait->iStatus, secCodeType, oldPassword, required_fourth); + RDEBUG("WaitForRequestL", 0); + res = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); +#ifdef __WINS__ + if (res == KErrNotSupported) + res = KErrNone; +#endif + if (res != KErrNone) + { + ShowResultNoteL(res, CAknNoteDialog::EErrorTone); + return res; // not sure if it's wise to exit now. + } + + newPassword = _L(""); + } + else + { + oldPassword.Copy(aOldPassword); + newPassword.Copy(aNewPassword); + } + + RDEBUG("res", res); + while (newPassword.Length() == 0) + { + // this is not needed because the dialog won't allow to close, unless codes match + // codes do not match -> note -> ask new pin and verification codes again + // if(newPassword.Length()>0) + // ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); + + newPassword = _L(""); + + // new pin code query + if (aOldPassword.Length() == 0) // only if input parameters are empty + { + queryAccepted = KErrCancel; + CSecQueryUi *iSecQueryUi; + iSecQueryUi = CSecQueryUi::NewL(); + // this queries both, and verifies itself + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_pin_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("|")); + HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_verify_new_pin_code")); + title.Append(stringHolder2->Des()); + CleanupStack::PopAndDestroy(stringHolder2); + queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported + | ESecUiEmergencyNotSupported | secCodeType); + RDEBUG("newPassword", 1); + RDEBUGSTR(newPassword); + RDEBUG("queryAccepted", queryAccepted); + delete iSecQueryUi; + if (queryAccepted != KErrNone) + return KErrAbort; + RDEBUG("0", 0); + } + } + + // send code + passwords.iOldPassword = oldPassword; + passwords.iNewPassword = newPassword; + RDEBUG("passwords", 0); + RDEBUGSTR(passwords.iOldPassword); + RDEBUGSTR(passwords.iNewPassword); + RDEBUG("SetRequestType", 0); + iWait->SetRequestType(EMobilePhoneChangeSecurityCode); + RDEBUG("ChangeSecurityCode", 0); + iPhone.ChangeSecurityCode(iWait->iStatus, secCodeType, passwords); + RDEBUG("WaitForRequestL", 0); + res = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); +#ifdef __WINS__ + if (res == KErrNotSupported) + res = KErrNone; +#endif + + switch (res) + { + case KErrNone: + { + // code changed + ShowResultNoteL(R_PIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); + break; + } + case KErrGsm0707IncorrectPassword: + case KErrAccessDenied: + { + // code was entered erroneously. This is strange, because it was verified before + ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + ChangePinParamsL(_L(""), _L(""), aFlags, aCaption, aShowError); + break; + } + case KErrGsmSSPasswordAttemptsViolation: + case KErrLocked: + { + // Pin1 blocked! + return KErrLocked; + } + case KErrGsm0707OperationNotAllowed: + { + // not allowed with this sim + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + return KErrGsm0707OperationNotAllowed; + } + case KErrAbort: + { + break; + } + default: + { + ShowErrorNoteL(res); + ChangePinParamsL(_L(""), _L(""), aFlags, aCaption, aShowError); + break; + } + } + return res; + } +/*********************************************/ +// qtdone +EXPORT_C TInt CSecuritySettings::ChangeUPinParamsL(RMobilePhone::TMobilePassword aOldPassword, RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, TDes& aCaption, + TInt aShowError) + { + RDEBUG("aFlags", aFlags); + // the password parameters are not used + if (aOldPassword.Length() > 0) + RDEBUGSTR(aOldPassword); + if (aNewPassword.Length() > 0) + RDEBUGSTR(aNewPassword); + + if (aCaption.Length() > 0) + RDEBUGSTR(aCaption); + + TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); + TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); + if (!(wcdmaSupported || upinSupported)) + { + RDEBUG("! upinSupported", upinSupported); + return KErrAccessDenied; + } + + RDEBUG("upinSupported", upinSupported); + TInt simState; + TInt err(KErrGeneral); + err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); + User::LeaveIfError(err); + TBool simRemoved(simState == ESimNotPresent); + + if (simRemoved) + { + ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); + return KErrAccessDenied; + } + + RMobilePhone::TMobilePhoneSecurityCode secCodeType; + secCodeType = RMobilePhone::ESecurityUniversalPin; + + RMobilePhone::TMobilePassword oldPassword; + RMobilePhone::TMobilePassword newPassword; + RMobilePhone::TMobilePassword verifcationPassword; + RMobilePhone::TMobilePhonePasswordChangeV1 passwords; + RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; + RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); + RMobilePhone::TMobilePhoneLock lockType; + RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; + TInt queryAccepted = KErrCancel; + + lockType = RMobilePhone::ELockUniversalPin; + + RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); + iWait->SetRequestType(EMobilePhoneGetLockInfo); + RDEBUG("GetLockInfo", 0); + iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); + RDEBUG("WaitForRequestL", 0); + TInt res = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); +#ifdef __WINS__ + if (res == KErrNotSupported) + { + res = KErrNone; + lockInfo.iSetting = RMobilePhone::ELockSetEnabled; + } +#endif + User::LeaveIfError(res); + + RDEBUG("lockInfo.iSetting", lockInfo.iSetting); + RDEBUG("RMobilePhone::ELockSetDisabled", RMobilePhone::ELockSetDisabled); + if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) + { + ShowResultNoteL(R_UPIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + return KErrAccessDenied; + } + + iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); + RDEBUG("GetSecurityCodeInfo", 0); + iPhone.GetSecurityCodeInfo(iWait->iStatus, secCodeType, codeInfoPkg); + RDEBUG("WaitForRequestL", 0); + res = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); +#ifdef __WINS__ + if (res == KErrNotSupported || res == KErrTimedOut) + { + res = KErrNone; + codeInfo.iRemainingEntryAttempts = KMaxNumberOfPINAttempts; + } +#endif + User::LeaveIfError(res); + + RDEBUG("codeInfo.iRemainingEntryAttempts", + codeInfo.iRemainingEntryAttempts); + if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) + codeInfo.iRemainingEntryAttempts = -1; + + queryAccepted = KErrCancel; + CSecQueryUi *iSecQueryUi; + iSecQueryUi = CSecQueryUi::NewL(); + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_upin_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("$")); + title.AppendNum(codeInfo.iRemainingEntryAttempts); + queryAccepted = iSecQueryUi->SecQueryDialog(title, oldPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported + | ESecUiEmergencyNotSupported | secCodeType); + RDEBUG("oldPassword", 0); + RDEBUGSTR(oldPassword); + RDEBUG("queryAccepted", queryAccepted); + delete iSecQueryUi; + if (queryAccepted != KErrNone) + return KErrAbort; + res = KErrNone; // indicate that everything is ok + + { + queryAccepted = KErrCancel; + CSecQueryUi * iSecQueryUi; + iSecQueryUi = CSecQueryUi::NewL(); + // this queries both, and verifies itself + TBuf<0x100> title; + title.Zero(); + + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_upin_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("|")); + HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_retype_upin_code")); + title.Append(stringHolder2->Des()); + CleanupStack::PopAndDestroy(stringHolder2); + queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported + | ESecUiEmergencyNotSupported | secCodeType); + RDEBUG("newPassword", 0); + RDEBUGSTR(newPassword); + RDEBUG("queryAccepted", queryAccepted); + delete iSecQueryUi; + if (queryAccepted != KErrNone) + return KErrAbort; + } + // send code + passwords.iOldPassword = oldPassword; + passwords.iNewPassword = newPassword; + iWait->SetRequestType(EMobilePhoneChangeSecurityCode); + RDEBUG("ChangeSecurityCode", 0); + iPhone.ChangeSecurityCode(iWait->iStatus, secCodeType, passwords); + RDEBUG("WaitForRequestL", 0); + res = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); +#ifdef __WINS__ + if (res == KErrNotSupported) + res = KErrNone; +#endif + switch (res) + { + case KErrNone: + { + // code changed + ShowResultNoteL(R_UPIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); + break; + } + case KErrGsm0707IncorrectPassword: + case KErrAccessDenied: + { + // code was entered erroneously + ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + ChangeUPinParamsL(_L(""), _L(""), aFlags, aCaption, aShowError); + break; + } + case KErrGsmSSPasswordAttemptsViolation: + case KErrLocked: + { + return KErrLocked; + } + case KErrGsm0707OperationNotAllowed: + { + // not allowed with this sim + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + return KErrGsm0707OperationNotAllowed; + } + case KErrAbort: + { + break; + } + default: + { + ShowErrorNoteL(res); + ChangeUPinParamsL(_L(""), _L(""), aFlags, aCaption, aShowError); + break; + } + } + return res; + } +/***************************************/ +// qtdone +EXPORT_C TInt CSecuritySettings::ChangePin2ParamsL(RMobilePhone::TMobilePassword aOldPassword, RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, TDes& aCaption, + TInt aShowError) + { + RDEBUG("aFlags", aFlags); + // the password parameters are not used + if (aOldPassword.Length() > 0) + RDEBUGSTR(aOldPassword); + if (aNewPassword.Length() > 0) + RDEBUGSTR(aNewPassword); + + if (aCaption.Length() > 0) + RDEBUGSTR(aCaption); + + TInt simState; + TInt err(KErrGeneral); + err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); + User::LeaveIfError(err); + TBool simRemoved(simState == ESimNotPresent); + + if (simRemoved) + { + ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); + return KErrAccessDenied; + } + + RMmCustomAPI::TSecurityCodeType secCodeType; + RMobilePhone::TMobilePhoneSecurityCode EtelsecCodeType; + secCodeType = RMmCustomAPI::ESecurityCodePin2; + RMobilePhone::TMobilePassword oldPassword; + RMobilePhone::TMobilePassword newPassword; + RMobilePhone::TMobilePassword verifcationPassword; + RMobilePhone::TMobilePhonePasswordChangeV1 passwords; + RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; + RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); + TInt queryAccepted = KErrCancel; + + // check if pin2 is blocked... + TBool isBlocked = EFalse; + + TInt ret = iCustomPhone.IsBlocked(secCodeType, isBlocked); + RDEBUG("isBlocked", isBlocked); + if (isBlocked) + return KErrAccessDenied; + RDEBUG("ret", ret); +#ifdef __WINS__ + if (ret == KErrNotSupported) + ret = KErrNone; +#endif + + if (ret != KErrNone) + { + switch (ret) + { + // PIN2 Blocked. + case KErrGsm0707SIMPuk2Required: + break; + case KErrGsmSSPasswordAttemptsViolation: + case KErrLocked: + // Pin2 features blocked permanently! + ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); + break; + case KErrGsm0707SimNotInserted: + // not allowed with this sim + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + break; + default: + ShowErrorNoteL(ret); + break; + } + return KErrAccessDenied; + } + + // Security code must be changed to Etel API format + // Custom API Pin1 and Pin2 have the same enum values as the Etel ones + EtelsecCodeType = (RMobilePhone::TMobilePhoneSecurityCode) secCodeType; + iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); + RDEBUG("GetSecurityCodeInfo", 0); + iPhone.GetSecurityCodeInfo(iWait->iStatus, EtelsecCodeType, codeInfoPkg); + RDEBUG("WaitForRequestL", 0); + ret = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL ret", ret); +#ifdef __WINS__ + if (ret == KErrNotSupported || ret == KErrTimedOut) + { + codeInfo.iRemainingEntryAttempts = 1; + ret = KErrNone; + } +#endif + User::LeaveIfError(ret); + + RDEBUG("codeInfo.iRemainingEntryAttempts", + codeInfo.iRemainingEntryAttempts); + if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) + codeInfo.iRemainingEntryAttempts = -1; + + /* request PIN using QT */ + queryAccepted = KErrCancel; + CSecQueryUi *iSecQueryUi; + iSecQueryUi = CSecQueryUi::NewL(); + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin2_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("$")); + title.AppendNum(codeInfo.iRemainingEntryAttempts); + queryAccepted = iSecQueryUi->SecQueryDialog(title, oldPassword, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported + | ESecUiEmergencyNotSupported | secCodeType); + RDEBUG("oldPassword", 0); + RDEBUGSTR(oldPassword); + RDEBUG("queryAccepted", queryAccepted); + delete iSecQueryUi; + if (queryAccepted != KErrNone) + return KErrAbort; + /* end request PIN using QT */ + + /* request PIN using QT */ + { + queryAccepted = KErrCancel; + CSecQueryUi * iSecQueryUi; + iSecQueryUi = CSecQueryUi::NewL(); + // this queries both, and verifies itself + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_pin2_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("|")); + HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify")); + title.Append(stringHolder2->Des()); + CleanupStack::PopAndDestroy(stringHolder2); + queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported + | ESecUiEmergencyNotSupported | secCodeType); + RDEBUG("newPassword", 0); + RDEBUGSTR(newPassword); + RDEBUG("queryAccepted", queryAccepted); + delete iSecQueryUi; + if (queryAccepted != KErrNone) + return KErrAbort; + } + /* end request PIN using QT */ + + passwords.iOldPassword = oldPassword; + passwords.iNewPassword = newPassword; + iWait->SetRequestType(EMobilePhoneChangeSecurityCode); + RDEBUG("ChangeSecurityCode", 0); + iPhone.ChangeSecurityCode(iWait->iStatus, EtelsecCodeType, passwords); + RDEBUG("WaitForRequestL", 0); + TInt res = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); +#ifdef __WINS__ + if (res == KErrNotSupported) + res = KErrNone; +#endif + switch (res) + { + case KErrNone: + { + // code changed + ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); + break; + } + case KErrGsm0707IncorrectPassword: + case KErrAccessDenied: + { + ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + ChangePin2ParamsL(_L(""), _L(""), aFlags, aCaption, aShowError); + break; + } + case KErrGsmSSPasswordAttemptsViolation: + case KErrLocked: + { + // Pin2 blocked! + ShowResultNoteL(KErrLocked, CAknNoteDialog::EErrorTone); + CSecurityHandler* handler = new (ELeave) CSecurityHandler(iPhone); + CleanupStack::PushL(handler); + handler->HandleEventL(RMobilePhone::EPuk2Required); + CleanupStack::PopAndDestroy(handler); // handler + return KErrLocked; + } + case KErrGsm0707OperationNotAllowed: + { + // not allowed with this sim + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + return KErrGsm0707OperationNotAllowed; + } + case KErrAbort: + { + break; + } + default: + { + ShowErrorNoteL(res); + ChangePin2ParamsL(_L(""), _L(""), aFlags, aCaption, aShowError); + break; + } + } + return res; + } +/************************************************/ +// qtdone +EXPORT_C TInt CSecuritySettings::ChangeSecCodeParamsL(RMobilePhone::TMobilePassword aOldPassword, RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, TDes& aCaption, + TInt aShowError) + { + RDEBUG("aFlags", aFlags); + RDEBUG("aShowError", aShowError); + /***************************************************** + * Series 60 Customer / ETel + * Series 60 ETel API + *****************************************************/ + TInt res = KErrNone; + TInt queryAccepted = KErrCancel; + RMobilePhone::TMobilePassword newPassword; + + RMobilePhone::TMobilePhoneSecurityCode secCodeType; + secCodeType = RMobilePhone::ESecurityCodePhonePassword; + RMobilePhone::TMobilePassword oldPassword; + RMobilePhone::TMobilePassword required_fourth; + RMobilePhone::TMobilePhonePasswordChangeV1 passwords; + + // confirm that it can be changed now + { + RArray aFailedPolicies; + TDevicelockPolicies failedPolicy; + TInt retLockcode = KErrNone; + RSCPClient scpClient; + retLockcode = scpClient.Connect(); + RDEBUG( "retLockcode", retLockcode ); + if(retLockcode == KErrNone ) + { + RDEBUG( "scpClient.VerifyNewLockcodeAgainstPolicies", 0 ); + retLockcode = scpClient.IsLockcodeChangeAllowedNow( aFailedPolicies ); + RDEBUG( "retLockcode", retLockcode ); + RDEBUG( "aFailedPolicies.Count()", aFailedPolicies.Count() ); + res = retLockcode; + for(TInt i=0; i title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_sec_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + queryAccepted = iSecQueryUi->SecQueryDialog(title, oldPassword, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, ESecUiAlphaSupported + | ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType); + RDEBUG("oldPassword", 0); + RDEBUGSTR(oldPassword); + RDEBUG("queryAccepted", queryAccepted); + delete iSecQueryUi; + if (queryAccepted != KErrNone) + return KErrAbort; + newPassword = _L(""); + } + else + { + RDEBUG("parameter includes oldPassword", 1); + oldPassword.Copy(aOldPassword); + newPassword.Copy(aNewPassword); + } + + // check current code before proceeding + RDEBUG("EMobilePhoneVerifySecurityCode", EMobilePhoneVerifySecurityCode); + iWait->SetRequestType(EMobilePhoneVerifySecurityCode); // 0x59F1 + RDEBUG("VerifySecurityCode", 0); + iPhone.VerifySecurityCode(iWait->iStatus, secCodeType, oldPassword, required_fourth); + RDEBUG("WaitForRequestL", 0); + res = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); +#ifdef __WINS__ + if (res == KErrNotSupported) + res = KErrNone; +#endif + + if (res != KErrNone) + { + ShowResultNoteL(res, CAknNoteDialog::EErrorTone); + return res; + } + + while (newPassword.Length() == 0) + { + // codes do not match -> note -> ask new pin and verification codes again + // note that this never happens because the dialog doesn't dismiss until both codes match + if (newPassword.Length() > 0) + ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); + + { + queryAccepted = KErrCancel; + CSecQueryUi *iSecQueryUi; + iSecQueryUi = CSecQueryUi::NewL(); + // will ask both codes and compare itself + // mix, max , alpha is handled using TARM params, in the dialog itself + TInt lType = ESecUiAlphaSupported | ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType; + RDEBUG("lType", lType); + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_sec_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("|")); + HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify")); + title.Append(stringHolder2->Des()); + CleanupStack::PopAndDestroy(stringHolder2); + queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, lType); + RDEBUG("newPassword", 0); + RDEBUGSTR(newPassword); + RDEBUG("queryAccepted", queryAccepted); + delete iSecQueryUi; + if (queryAccepted != KErrNone) + return KErrAbort; + } + + } // while + + // Confirm that the new code is nice. + // This is also done on every key-press in the dialog, but it doesn't harm to repeat. + // In fact this is needed for the case when newPassword is provided. + RArray aFailedPolicies; + TDevicelockPolicies failedPolicy; + TInt retLockcode = KErrNone; + RSCPClient scpClient; + retLockcode = scpClient.Connect(); + RDEBUG( "retLockcode", retLockcode ); + if(retLockcode == KErrNone ) + { + RDEBUG( "scpClient.VerifyNewLockcodeAgainstPolicies", 0 ); + retLockcode = scpClient.VerifyNewLockcodeAgainstPolicies( newPassword, aFailedPolicies ); + RDEBUG( "retLockcode", retLockcode ); + RDEBUG( "aFailedPolicies.Count()", aFailedPolicies.Count() ); + for(TInt i=0; iSetRequestType(EMobilePhoneChangeSecurityCode); + RDEBUG("ChangeSecurityCode", 0); + iPhone.ChangeSecurityCode(iWait->iStatus, secCodeType, passwords); + RDEBUG("WaitForRequestL", 0); + res = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); +#ifdef __WINS__ + if (res == KErrNotSupported) + res = KErrNone; +#endif + + if (res == KErrNone && 1 == 0) // TODO not possible to enable because it asks code again + { + RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; + RMobilePhone::TMobilePhoneLockSetting lockChangeSetting = RMobilePhone::ELockSetEnabled; + iWait->SetRequestType(EMobilePhoneSetLockSetting); + RDEBUG("SetLockSetting", 0); + iPhone.SetLockSetting(iWait->iStatus, lockType, lockChangeSetting); + RDEBUG("WaitForRequestL", 0); + res = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); +#ifdef __WINS__ + if (res == KErrNotSupported || res == KErrTimedOut) + res = KErrNone; +#endif + } + } + + RDEBUG("res", res); + switch (res) + { + case KErrNone: + { + // code changed ... unless TARM rejects it + { + // Send the changed code to the SCP server, even with device lock enhancements. + RDEBUG("scpClient.Connect", 0); + RSCPClient scpClient; + TSCPSecCode newScpCode; + TSCPSecCode oldScpCode; + newScpCode.Copy(newPassword); + oldScpCode.Copy(oldPassword); + if (scpClient.Connect() == KErrNone) + { + RDEBUG("scpClient.StoreLockcode", 0); + // this is the old method. Obsolete now + // scpClient.StoreCode( newCode ); + RArray aFailedPolicies; + TDevicelockPolicies failedPolicy; + TInt retLockcode = KErrNone; + retLockcode = scpClient.StoreLockcode(newScpCode, oldScpCode, aFailedPolicies); + RDEBUG( "retLockcode", retLockcode ); + RDEBUG( "KErrAccessDenied", KErrAccessDenied ); + RDEBUG( "aFailedPolicies.Count()", aFailedPolicies.Count() ); + for (TInt i = 0; i < aFailedPolicies.Count(); i++) + { + failedPolicy = aFailedPolicies[i]; + RDEBUG( "failedPolicy", failedPolicy ); + } + // Don't know what to do if TARM fails. Hopefully it was stopped at typing, as well as VerifyNewLockcodeAgainstPolicies + // The code is already changed in iPhone ! + // For now, just undo the changed password + if(retLockcode!=KErrNone) + { + RDEBUG("Undo password change because retLockcode", retLockcode); + ShowResultNoteL(retLockcode, CAknNoteDialog::EConfirmationTone); + + // go back to previous password. + passwords.iOldPassword = newPassword; + passwords.iNewPassword = oldPassword; + iWait->SetRequestType(EMobilePhoneChangeSecurityCode); + RDEBUG("ChangeSecurityCode", 0); + iPhone.ChangeSecurityCode(iWait->iStatus, secCodeType, passwords); + RDEBUG("WaitForRequestL", 0); + res = iWait->WaitForRequestL(); // this can't fail. ISA is always allowing to undo the password change. + RDEBUG("WaitForRequestL res", res); + #ifdef __WINS__ + if (res == KErrNotSupported) + res = KErrNone; + #endif + res = retLockcode; + } + scpClient.Close(); + } + if(res==KErrNone) + { + RDEBUG( "showing R_SECURITY_CODE_CHANGED_NOTE", R_SECURITY_CODE_CHANGED_NOTE ); + ShowResultNoteL(R_SECURITY_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); + } + } + break; + } + case KErrGsmSSPasswordAttemptsViolation: + case KErrLocked: + { + ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); + ChangeSecCodeParamsL(aOldPassword, aNewPassword, aFlags, aCaption, aShowError); + break; + } + case KErrGsm0707IncorrectPassword: + case KErrAccessDenied: + { + // code was entered erroneously + ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + ChangeSecCodeParamsL(aOldPassword, aNewPassword, aFlags, aCaption, aShowError); + break; + } + case KErrAbort: + { + break; + } + default: + { + ShowErrorNoteL(res); + ChangeSecCodeParamsL(aOldPassword, aNewPassword, aFlags, aCaption, aShowError); + break; + } + } // switch + RDEBUG("return res", res); + return res; + } + +/**************************************/ +// qtdone +// the params are changed in the settings,. This only asks for password. +EXPORT_C TInt CSecuritySettings::ChangeAutoLockPeriodParamsL(TInt aPeriod, RMobilePhone::TMobilePassword aOldPassword, TInt aFlags, TDes& aCaption, TInt aShowError) + { + RDEBUG("aPeriod", aPeriod); + RDEBUG("aFlags", aFlags); + /***************************************************** + * Series 60 Customer / ETel + * Series 60 ETel API + *****************************************************/ + + RMobilePhone::TMobilePhoneLockSetting lockChange(RMobilePhone::ELockSetDisabled); + RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; + TInt oldPeriod = aPeriod; + + TInt maxPeriod = 0; + if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw)) + { + // Retrieve the current autolock period max. value from the SCP server, + // and check that the value the user + // selected is ok from the Corporate Policy point of view. + RSCPClient scpClient; + TInt ret = scpClient.Connect(); + if (ret == KErrNone) + { + CleanupClosePushL(scpClient); + TBuf maxPeriodBuf; + if (scpClient.GetParamValue(ESCPMaxAutolockPeriod, maxPeriodBuf) == KErrNone) + { + TLex lex(maxPeriodBuf); + if ((lex.Val(maxPeriod) == KErrNone) && (maxPeriod > 0)) + { + RDEBUG("from SCP maxPeriod", maxPeriod); + } + else + { + maxPeriod = 0; + RDEBUG("not from SCP maxPeriod", maxPeriod); + } + } + else + { + RDEBUG("Failed to retrieve max period", maxPeriod); + } + } + else + { + RDEBUG("Failed to connect to SCP", 0); + } + CleanupStack::PopAndDestroy(); // scpClient + } + RDEBUG("maxPeriod", maxPeriod); + if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw)) + { + TBool allow = ETrue; + + if ((aPeriod == 0) && (maxPeriod > 0)) + { + RDEBUG("The period is not allowed by TARM", aPeriod); + RDEBUG( "maxPeriod", maxPeriod ); + allow = EFalse; + ShowResultNoteL(R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE, CAknNoteDialog::EErrorTone); + } + if (!allow) + { + return ChangeAutoLockPeriodParamsL(aPeriod, aOldPassword, aFlags, aCaption, aShowError); // ask again + } + } + + if (aPeriod == 0) + { + // If remote lock is enabled, don't disable the domestic OS device lock + // since that would render the RemoteLock useless. + // Instead just re-set the DOS lock to enabled which as a side effect + // requests the security code from the user. + + TBool remoteLockStatus(EFalse); + CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); + + if (remoteLockSettings->GetEnabled(remoteLockStatus)) + { + if (remoteLockStatus) + { + // Remote lock is enabled + lockChange = RMobilePhone::ELockSetEnabled; + RDEBUG( "RemoteLock is enabled lockChange", lockChange ); + } + else + { + // Remote lock is disabled + lockChange = RMobilePhone::ELockSetDisabled; + RDEBUG( "RemoteLock is disabled lockChange", lockChange ); + } + } + else + { + // Failed to get remote lock status + RDEBUG( "Failed to get remote lock status lockChange", lockChange ); + } + + delete remoteLockSettings; + remoteLockSettings = NULL; + + } + else + { + lockChange = RMobilePhone::ELockSetEnabled; + RDEBUG("aPeriod != 0 lockChange", lockChange); + } + + iWait->SetRequestType(EMobilePhoneSetLockSetting); + RDEBUG("lockChange", lockChange); + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); + RDEBUG("SetLockSetting", 0); + iPhone.SetLockSetting(iWait->iStatus, lockType, lockChange); // this eventually calls PassPhraseRequiredL + RDEBUG("WaitForRequestL", 0); + TInt status = KErrNone; + status = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL status", status); +#ifdef __WINS__ + if (status == KErrNotSupported || status == KErrTimedOut) + status = KErrNone; +#endif + switch (status) + { + case KErrNone: + break; + case KErrGsmSSPasswordAttemptsViolation: + case KErrLocked: + RDEBUG("KErrLocked", KErrLocked) + ; + ShowResultNoteL(KErrLocked, CAknNoteDialog::EErrorTone); // the old code didn't show messages + return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, aFlags, aCaption, aShowError); // ask again + case KErrGsm0707IncorrectPassword: + case KErrAccessDenied: + RDEBUG("KErrAccessDenied", KErrAccessDenied) + ; + // code was entered erroneously + ShowResultNoteL(KErrAccessDenied, CAknNoteDialog::EErrorTone); // the old code didn't show messages + return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, aFlags, aCaption, aShowError); // ask again + case KErrAbort: + // User pressed "cancel" in the code query dialog. + return oldPeriod; + default: + RDEBUG("default", status) + ; + ShowResultNoteL(status, CAknNoteDialog::EErrorTone); // the old code didn't show messages + return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, aFlags, aCaption, aShowError); // ask again + } + RDEBUG("aPeriod", aPeriod); + return aPeriod; + } +/*****************************/ +// qtdone +EXPORT_C TInt CSecuritySettings::ChangePinRequestParamsL(TInt aEnable, RMobilePhone::TMobilePassword aOldPassword, TInt aFlags, TDes& aCaption, TInt aShowError) + { + RDEBUG("aEnable", aEnable); + RDEBUG("aFlags", aFlags); + TInt simState = 0; + TInt lEnable = aEnable; + TInt err(KErrGeneral); + err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); + User::LeaveIfError(err); + TBool simRemoved(simState == ESimNotPresent); + + if (simRemoved) + { + ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); + return KErrAccessDenied; + } + + RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; + RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); + RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockICC; + + RMobilePhone::TMobilePhoneLockSetting lockChangeSetting; + + //get lock info + iWait->SetRequestType(EMobilePhoneGetLockInfo); + iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); + RDEBUG("WaitForRequestL", 0); + TInt status = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL status", status); +#ifdef __WINS__ + if (status == KErrNotSupported || status == KErrTimedOut) + { + lockInfo.iSetting = RMobilePhone::ELockSetDisabled; + status = KErrNone; + } +#endif + User::LeaveIfError(status); + + if (aOldPassword.Length() == 0) // only if input parameters are empty + { + // switch the value. + if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) + lEnable = 1; // on + else + lEnable = 0; // off + } + + RDEBUG("lEnable", lEnable); + if (lEnable == 0) + { + lockChangeSetting = RMobilePhone::ELockSetDisabled; + } + else + { + lockChangeSetting = RMobilePhone::ELockSetEnabled; + } + + RDEBUG("lockChangeSetting", lockChangeSetting); + // Raise a flag to indicate that the PIN + // request coming from ETEL has originated from SecUi and not from Engine. + TInt tRet = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginated); + RDEBUG("tRet", tRet); + + // Change the lock setting + iWait->SetRequestType(EMobilePhoneSetLockSetting); + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); + RDEBUG("SetLockSetting", 0); + iPhone.SetLockSetting(iWait->iStatus, lockType, lockChangeSetting); // this will trigger Pin1RequiredL + RDEBUG("WaitForRequestL", 0); + status = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL status", status); +#ifdef __WINS__ + if (status == KErrNotSupported || status == KErrTimedOut) + status = KErrNone; +#endif + + // Lower the flag + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginatedUninitialized); + + switch (status) + { + case KErrNone: + { + break; + } + case KErrGsm0707OperationNotAllowed: + { + // not allowed with this sim + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + return KErrGsm0707OperationNotAllowed; + } + case KErrGsm0707IncorrectPassword: + case KErrAccessDenied: + { + // code was entered erroneously + return ChangePinRequestParamsL(aEnable, aOldPassword, aFlags, aCaption, aShowError); + } + case KErrGsmSSPasswordAttemptsViolation: + case KErrLocked: + { + return KErrLocked; + } + case KErrAbort: + { + return KErrAbort; + } + default: + { + return ChangePinRequestParamsL(aEnable, aOldPassword, aFlags, aCaption, aShowError); + } + } + return KErrNone; + } + +// +// ---------------------------------------------------------- +// CSecuritySettings::AskSecCodeParamsL() +// For asking security code e.g in settings +// not used +// ---------------------------------------------------------- +// qtdone +EXPORT_C TBool CSecuritySettings::AskSecCodeParamsL(RMobilePhone::TMobilePassword &aOldPassword, TInt aFlags, TDes& aCaption, TInt aShowError) + { + RDEBUG("aFlags", aFlags); + RDEBUG("aShowError", aShowError); + RDEBUG("This doesn't do anything", 0); + RDEBUG("aFlags", aFlags); + + // the password parameters are not used + if (aOldPassword.Length() > 0) + RDEBUGSTR(aOldPassword); + + return EFalse; + } // End of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/Src/SecUiSystemLock.cpp --- a/securitydialogs/SecUi/Src/SecUiSystemLock.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiSystemLock.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -22,7 +22,7 @@ #include #include "SecUiSystemLock.h" #include -#include +// #include #include #include "secuisecuritysettings.h" #include "SecUiWait.h" @@ -30,6 +30,8 @@ #include #include #include +#include + /***************************************************** * Series 60 Customer / TSY * Needs customer TSY implementation @@ -48,6 +50,7 @@ // EXPORT_C CSystemLock* CSystemLock::NewL() { + RDebug::Printf( "%s %s (%u) this should not be called=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); CSystemLock* self = new(ELeave) CSystemLock(); CleanupStack::PushL(self); self->ConstructL(); @@ -62,6 +65,7 @@ // void CSystemLock::ConstructL() { + RDebug::Printf( "%s %s (%u) this should not be called=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); /***************************************************** * Series 60 Customer / ETel * Series 60 ETel API @@ -141,7 +145,8 @@ // // ---------------------------------------------------------- // CSystemLock::SetLockedL() -// Activates system lock +// Activates system lock +// this was used by SysAp, but it's not longer used // ---------------------------------------------------------- // EXPORT_C void CSystemLock::SetLockedL() @@ -150,97 +155,29 @@ * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ + RDebug::Printf( "%s %s (%u) this should not be called=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); #if defined(_DEBUG) RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL()")); #endif // close fast-swap window - CEikonEnv::Static()->DismissTaskList(); - -#ifdef __WINS__ - // can not verify security code in emulator ---> lock system -#ifdef RD_REMOTELOCK - iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EManualLocked); -#else// !RD_REMOTELOCK - iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOn); -#endif//RD_REMOTELOCK -#else //__WINS__ - - if(IsActive()) - return; - - - RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; - RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; - RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); - RMobilePhone::TMobilePhoneLockSetting lockChange(RMobilePhone::ELockSetDisabled); - CWait* wait = CWait::NewL(); - CleanupStack::PushL( wait ); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() GetLockInfo")); - #endif - iPhone.GetLockInfo(wait->iStatus, lockType, lockInfoPkg); - if (wait->WaitForRequestL() == KErrNone) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() KErrNone")); - #endif - if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() ELockSetDisabled")); - #endif - // ask code - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() SetLockSetting")); - #endif - //iCustomPhone.CheckSecurityCode(iStatus, RMmCustomAPI::ESecurityCodePassPhrase); - lockChange = RMobilePhone::ELockSetEnabled; - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSystemLockOriginated); - iPhone.SetLockSetting(iStatus, lockType, lockChange); - SetActive(); - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() Lock System")); - #endif - // lock system -#ifdef RD_REMOTELOCK - iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EManualLocked); -#else// !RD_REMOTELOCK - iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOn); -#endif //RD_REMOTELOCK - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() Lock System OK")); - #endif - } - } - else - { - // ask code - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() ask code (SLS) ")); - #endif - lockChange = RMobilePhone::ELockSetEnabled; - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSystemLockOriginated); - iPhone.SetLockSetting(iStatus, lockType, lockChange); - SetActive(); - } - CleanupStack::PopAndDestroy(); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() END")); - #endif // DEBUG - #endif // WINS + RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + CDevicelockAccessApi* iDevicelockAccess = CDevicelockAccessApi::NewL( ); + RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + iDevicelockAccess->OfferDevicelock(); + // this will do EnableDevicelock( EDevicelockManual ); + RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); } // // ---------------------------------------------------------- // CSystemLock::RunL() // Handles query result +// this was used by SysAp, but it's not longer used // ---------------------------------------------------------- // void CSystemLock::RunL() { + RDebug::Printf( "%s %s (%u) this should not be called=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + #if defined(_DEBUG) TInt status(iStatus.Int()); RDebug::Print(_L("(SECUI)CSystemLock::RunL(): %d"), status); @@ -258,14 +195,16 @@ RDebug::Print(_L("(SECUI)CSystemLock::RunL() KErrNone")); #endif // clear notifiers - AknNotifierController::HideAllNotifications(ETrue); + // not any more. Avkon is deprecated. Besides, this function should not be called. + // AknNotifierController::HideAllNotifications(ETrue); // query approved -> lock system #ifdef RD_REMOTELOCK iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EManualLocked); #else// !RD_REMOTELOCK iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOn); #endif//RD_REMOTELOCK - AknNotifierController::HideAllNotifications(EFalse); + // not any more. Avkon is deprecated. Besides, this function should not be called. + // AknNotifierController::HideAllNotifications(EFalse); } } else if((iStatus != KErrCancel) && (iStatus != KErrAbort)) diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/Src/SecUiWait.cpp --- a/securitydialogs/SecUi/Src/SecUiWait.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiWait.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -77,10 +77,8 @@ // TInt CWait::WaitForRequestL() { - CWaitAbsorbingControl* absorbing = CWaitAbsorbingControl::NewLC(); SetActive(); iWait.Start(); - CleanupStack::PopAndDestroy(absorbing); return iStatus.Int(); } // @@ -128,6 +126,33 @@ return iRequestType; } // +// class CAutolockQuery +// +CAutolockQuery::CAutolockQuery() + { + } + +CAutolockQuery::~CAutolockQuery() + { + + } + +CAutolockQuery* CAutolockQuery::NewLC() + { + return NULL; + } + +void CAutolockQuery::ConstructL() + { + + } + +TKeyResponse CAutolockQuery::OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/) + { + return EKeyWasConsumed; + } +/***********/ +// // class CWaitAbsorbingControl // CWaitAbsorbingControl::CWaitAbsorbingControl() @@ -136,32 +161,22 @@ CWaitAbsorbingControl::~CWaitAbsorbingControl() { - if (iCoeEnv && iAppUi) - iAppUi->RemoveFromStack(this); + } CWaitAbsorbingControl* CWaitAbsorbingControl::NewLC() { - CWaitAbsorbingControl* self= new(ELeave) CWaitAbsorbingControl(); - CleanupStack::PushL(self); - self->ConstructL(); - return self; + return NULL; } void CWaitAbsorbingControl::ConstructL() { - CreateWindowL(); - SetExtent(TPoint(0,0), TSize(0,0)); - ActivateL(); - SetPointerCapture(ETrue); - ClaimPointerGrab(ETrue); - iAppUi=iEikonEnv->EikAppUi(); - iAppUi->AddToStackL(this, ECoeStackPriorityEnvironmentFilter); + } TKeyResponse CWaitAbsorbingControl::OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/) { - return EKeyWasConsumed; + return EKeyWasConsumed; } // End of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/group/SecUi.mmp --- a/securitydialogs/SecUi/group/SecUi.mmp Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/SecUi/group/SecUi.mmp Tue Aug 31 16:04:40 2010 +0300 @@ -20,6 +20,8 @@ #include #include +SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore + TARGET secui.dll TARGETTYPE dll UID 0x1000006C 0x100058ED @@ -40,81 +42,27 @@ MW_LAYER_SYSTEMINCLUDE ../../../inc - -#ifdef __PROTOCOL_CDMA - - SOURCEPATH ../Cdma/Src - SOURCE SecUiSecuritySettingsCdma.cpp - SOURCE SecUiSecurityHandlerCdma.cpp - SOURCE SecUiObsStartterCdma.cpp - SOURCE SecUiAutoLockSettingPageCdma.cpp - SOURCE SecUiSystemLockCdma.cpp - - SOURCEPATH ../Src - SOURCE SecUi.cpp - SOURCE SecUiCodeQueryDialog.cpp - SOURCE SecUiCodeQueryControl.cpp - SOURCE SecUiManualSecuritySettings.cpp - SOURCE SecUiWait.cpp - - - library EUSER.LIB BAFL.LIB CONE.LIB - library EIKCORE.LIB EIKCOCTL.LIB - library avkon.lib eikdlg.lib - library etel.lib etelmm.lib - library eikctl.lib - library ws32.lib commonengine.lib - library efsrv.lib - LIBRARY centralrepository.lib - LIBRARY aknNotifierWrapper.lib - library customapi.lib - library securityclient.lib //Security Engine - library apparc.lib //For starting application in secuiobsstartter - - LIBRARY SCPClient.lib // SCP server - -#else //If GSM: - - - SOURCEPATH ../Src +SOURCEPATH ../Src - SOURCE ../Src/SecUi.cpp - SOURCE ../Src/SecUiCodeQueryDialog.cpp - SOURCE ../Src/SecUiSecuritySettings.cpp - SOURCE ../Src/SecUiSecurityHandler.cpp - SOURCE ../Src/SecUiCodeQueryControl.cpp - SOURCE ../Src/SecUiAutoLockSettingPage.cpp - SOURCE ../Src/SecUiObsStartter.cpp - SOURCE ../Src/SecUiManualSecuritySettings.cpp - SOURCE ../Src/SecUiSystemLock.cpp - SOURCE ../Src/SecUiWait.cpp - SOURCE ../Src/SecUiLockObserver.cpp -#ifdef RD_REMOTELOCK - SOURCE ../Src/SecUiRemoteLockSettingPage.cpp -#endif +SOURCE ../Src/SecUi.cpp +SOURCE ../Src/SecUiCodeQueryDialog.cpp +SOURCE ../Src/SecUiSecuritySettings.cpp +SOURCE ../Src/SecUiSecurityHandler.cpp +SOURCE ../Src/SecUiAutoLockSettingPage.cpp +SOURCE ../Src/SecUiObsStartter.cpp +SOURCE ../Src/SecUiManualSecuritySettings.cpp +SOURCE ../Src/SecUiSystemLock.cpp +SOURCE ../Src/SecUiWait.cpp +SOURCE ../Src/SecQueryUi.cpp - library euser.lib bafl.lib cone.lib - library eikcore.lib eikcoctl.lib - library avkon.lib eikdlg.lib - library etel.lib etelmm.lib - library eikctl.lib - library ws32.lib commonengine.lib - library efsrv.lib - library eiksrvui.lib - library customapi.lib - LIBRARY starterclient.lib //use of Starter to remove splash screen - library sysutil.lib - library estor.lib - -#ifdef RD_REMOTELOCK - library rlocksettings.lib -#endif - - - LIBRARY scpclient.lib // SCP server - LIBRARY centralrepository.lib - LIBRARY aknnotifierwrapper.lib -#endif //__PROTOCOL_CDMA +// library avkon.lib eikdlg.lib +library euser.lib +library etel.lib etelmm.lib +library commonengine.lib +library customapi.lib +library rlocksettings.lib +LIBRARY scpclient.lib // SCP server +LIBRARY centralrepository.lib // Modified by build team #if defined(WINSCW) @@ -123,6 +71,11 @@ LIBRARY featmgr.lib LIBRARY aknnotify.lib +LIBRARY HbCore.lib +LIBRARY HbWidgets.lib +LIBRARY lockclient.lib +LIBRARY phoneclient.lib + SMPSAFE // end of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/group/bld.inf --- a/securitydialogs/SecUi/group/bld.inf Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/SecUi/group/bld.inf Tue Aug 31 16:04:40 2010 +0300 @@ -26,18 +26,13 @@ //SecUi iby files ../rom/SecUi.iby CORE_MW_LAYER_IBY_EXPORT_PATH(secui.iby) ../rom/SecUiResources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(secuiresources.iby) -//Sim Sec Plugin iby files -../rom/GSSimSecPlugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(gssimsecplugin.iby) -../rom/GSSimSecPluginResources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(gssimsecpluginresources.iby) + //localisation files ../loc/SecUi.loc MW_LAYER_LOC_EXPORT_PATH(secui.loc) -../GSSimSecPlugin/loc/gssecurity.loc MW_LAYER_LOC_EXPORT_PATH(gssecurity.loc) + //ADO internal APIs ../Inc/SecUiSystemLock.h MW_LAYER_PLATFORM_EXPORT_PATH(secuisystemlock.h) PRJ_MMPFILES ../group/SecUi.mmp -//SIM security plugin for General Settings -../GSSimSecPlugin/GSSimSecPlugin.mmp - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/rom/GSSimSecPlugin.iby --- a/securitydialogs/SecUi/rom/GSSimSecPlugin.iby Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2005 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: GSAccsPlugin ROM files. -* -*/ - -#ifndef GSSIMSECPLUGIN_IBY -#define GSSIMSECPLUGIN_IBY - - #ifdef RD_GS_RENOVATION - - ECOM_PLUGIN( GSSimSecPlugin.dll, 10207438.rsc ) - - #endif // RD_GS_RENOVATION - -#endif // GSSIMSECPLUGIN_IBY -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/SecUi/rom/GSSimSecPluginResources.iby --- a/securitydialogs/SecUi/rom/GSSimSecPluginResources.iby Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2005 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: GSSecurityPlugin ROM resources. -* -*/ - -#ifndef GSSIMSECPLUGINRESOURCES_IBY -#define GSSIMSECPLUGINRESOURCES_IBY - - #ifdef RD_GS_RENOVATION - - data=DATAZ_\RESOURCE_FILES_DIR\GSSimSecPluginRsc.rsc RESOURCE_FILES_DIR\GSSimSecPluginRsc.rsc - - #endif // RD_GS_RENOVATION - -#endif // GSSIMSECPLUGINRESOURCES_IBY -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Securitynotifier/Group/Securitynotifier.mmp --- a/securitydialogs/Securitynotifier/Group/Securitynotifier.mmp Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/Securitynotifier/Group/Securitynotifier.mmp Tue Aug 31 16:04:40 2010 +0300 @@ -51,7 +51,7 @@ #if defined(WINSCW) DEFFILE ../BWinsCw/SecurityNotifierU.def #endif -LIBRARY featmgr.lib apgrfx.lib apparc.lib +LIBRARY featmgr.lib apgrfx.lib apparc.lib SMPSAFE diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Securitynotifier/Src/SecurityNotifier.cpp --- a/securitydialogs/Securitynotifier/Src/SecurityNotifier.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/Securitynotifier/Src/SecurityNotifier.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -34,10 +34,10 @@ #include // LOCAL CONSTANTS AND MACROS - /***************************************************** - * Series 60 Customer / TSY - * Needs customer TSY implementation - *****************************************************/ + /***************************************************** + * Series 60 Customer / TSY + * Needs customer TSY implementation + *****************************************************/ const TInt KTriesToConnectServer( 2 ); const TInt KTimeBeforeRetryingServerConnection( 50000 ); @@ -92,10 +92,10 @@ if ( scpClient.QueryAdminCmd( ESCPCommandLockPhone ) ) { #if defined(_DEBUG) - RDebug::Print(_L("CSecObsNotify::SCP admin command, no action required")); - #endif + RDebug::Print(_L("CSecObsNotify::SCP admin command, no action required")); + #endif - isAdminCall = ETrue; + isAdminCall = ETrue; } scpClient.Close(); @@ -137,7 +137,7 @@ // CSecurityNotifier::~CSecurityNotifier() { - FeatureManager::UnInitializeLib(); + FeatureManager::UnInitializeLib(); } // // ---------------------------------------------------------- @@ -158,9 +158,9 @@ // MEikSrvNotifierBase2::TNotifierInfo CSecurityNotifier::RegisterL() { - #if defined(_DEBUG) + #if defined(_DEBUG) RDebug::Print(_L("(SECURITYNOTIFIER)CSecurityNotifier::RegisterL()")); - #endif + #endif iInfo.iUid = KSecurityNotifierUid; iInfo.iChannel = KSecurityNotifierChannel; iInfo.iPriority = ENotifierPriorityHigh; @@ -174,9 +174,9 @@ // MEikSrvNotifierBase2::TNotifierInfo CSecurityNotifier::Info() const { - #if defined(_DEBUG) + #if defined(_DEBUG) RDebug::Print(_L("(SECURITYNOTIFIER)CSecurityNotifier::Info()")); - #endif + #endif return iInfo; } @@ -190,9 +190,9 @@ // TPtrC8 CSecurityNotifier::StartL(const TDesC8& /*aBuffer*/) { - #if defined(_DEBUG) + #if defined(_DEBUG) RDebug::Print(_L("(SECURITYNOTIFIER)CSecurityNotifier::StartL()")); - #endif + #endif TPtrC8 ret(KNullDesC8); return (ret); } @@ -204,9 +204,9 @@ // void CSecurityNotifier::StartL(const TDesC8& aBuffer, TInt aReturnVal,const RMessagePtr2& aMessage) { - #if defined(_DEBUG) + #if defined(_DEBUG) RDebug::Print(_L("(SECURITYNOTIFIER)CSecurityNotifier::StartL2()")); - #endif + #endif TRAPD(err, GetParamsL(aBuffer, aReturnVal, aMessage)); if (err) { @@ -225,15 +225,44 @@ // void CSecurityNotifier::GetParamsL(const TDesC8& aBuffer, TInt aReturnVal, const RMessagePtr2& aMessage) { - /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ + #if defined(_DEBUG) + RDebug::Printf( "%s %s (%u) searching for autolock.exe =%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x0 ); + #endif + + TApaTaskList taskList( CCoeEnv::Static()->WsSession() ); + const TUid KAutolockUid = { 0x100059B5 }; + TApaTask task( taskList.FindApp( KAutolockUid ) ); + if ( !task.Exists() ) + { + #if defined(_DEBUG) + RDebug::Printf( "%s %s (%u) autolock.exe not running. Starting now=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x1 ); + #endif + RApaLsSession ls; + User::LeaveIfError(ls.Connect()); + CleanupClosePushL(ls); + + CApaCommandLine* commandLine = CApaCommandLine::NewLC(); + commandLine->SetExecutableNameL( _L("autolock.exe" ) ); + commandLine->SetCommandL( EApaCommandRun ); + + // Try to launch the application. + TInt err = ls.StartApp(*commandLine); + #if defined(_DEBUG) + RDebug::Printf( "%s %s (%u) autolock.exe err=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, err ); + #endif + + CleanupStack::PopAndDestroy(2); // commandLine, ls + } + + /***************************************************** + * Series 60 Customer / ETel + * Series 60 ETel API + *****************************************************/ iMessage = aMessage; iReturnVal = aReturnVal; TBool skipQuery = EFalse; // In some cases the query is handled by some other entity and SecurityNotifier should skip it. - #if defined(_DEBUG) + #if defined(_DEBUG) RDebug::Print(_L("(SECURITYNOTIFIER)CSecurityNotifier::GetParamsL() Start BEGIN")); #endif @@ -243,38 +272,9 @@ iStartup = pckg().iStartup; iEvent = static_cast(pckg().iEvent); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) searching for autolock.exe =%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x0 ); - RDebug::Printf( "%s %s (%u) iEvent=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iEvent ); - RDebug::Printf( "%s %s (%u) 2 RMobilePhone::EPin1Required=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, RMobilePhone::EPin1Required ); - #endif - TApaTaskList taskList( CCoeEnv::Static()->WsSession() ); - const TUid KAutolockUid = { 0x100059B5 }; - TApaTask task( taskList.FindApp( KAutolockUid ) ); - if ( !task.Exists() && iEvent != RMobilePhone::EPin1Required ) // PIN-request should not start autolock, to prevent that lock-code is secretly accepted by TARM. Rely on Startup. - { - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) autolock.exe not running. Starting now=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x1 ); - #endif - RApaLsSession ls; - User::LeaveIfError(ls.Connect()); - CleanupClosePushL(ls); - - CApaCommandLine* commandLine = CApaCommandLine::NewLC(); - commandLine->SetExecutableNameL( _L("autolock.exe" ) ); - commandLine->SetCommandL( EApaCommandRun ); - - // Try to launch the application. - User::LeaveIfError(ls.StartApp(*commandLine)); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) autolock.exe created=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x2 ); - #endif - - CleanupStack::PopAndDestroy(2); // commandLine, ls - } if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) - { + { if(iEvent == RMobilePhone::EPhonePasswordRequired) { skipQuery = IsAdminCall(); // SCP handles the call. @@ -292,7 +292,7 @@ SetActive(); iStatus = KRequestPending; TRequestStatus* stat = &iStatus; - #if defined(_DEBUG) + #if defined(_DEBUG) RDebug::Print(_L("CSecurityNotifier::GetParamsL() End")); #endif User::RequestComplete(stat, KErrNone); // jump to RunL @@ -305,26 +305,26 @@ // ---------------------------------------------------------- void CSecurityNotifier::RunL() { - /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ - /***************************************************** - * Series 60 Customer / TSY - * Needs customer TSY implementation - *****************************************************/ + /***************************************************** + * Series 60 Customer / ETel + * Series 60 ETel API + *****************************************************/ + /***************************************************** + * Series 60 Customer / TSY + * Needs customer TSY implementation + *****************************************************/ TInt err( KErrGeneral ); TInt thisTry( 0 ); - RTelServer::TPhoneInfo PhoneInfo; - #if defined(_DEBUG) + RTelServer::TPhoneInfo PhoneInfo; + #if defined(_DEBUG) RDebug::Print(_L("CSecurityNotifier::RunL() Start")); #endif /*All server connections are tried to be made KTriesToConnectServer times because occasional fails on connections are possible, at least on some servers*/ // connect to ETel server - #if defined(_DEBUG) + #if defined(_DEBUG) RDebug::Print(_L("CSecurityNotifier::RunL() connect to ETel server")); #endif while ( ( err = iServer.Connect() ) != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) @@ -336,11 +336,14 @@ thisTry = 0; // load TSY - #if defined(_DEBUG) + #if defined(_DEBUG) RDebug::Print(_L("CSecurityNotifier::RunL() load TSY")); #endif - err = iServer.LoadPhoneModule( KMmTsyModuleName ); - if ( err != KErrAlreadyExists ) + + if ( !iPhone.SubSessionHandle() ) + { + err = iServer.LoadPhoneModule( KMmTsyModuleName ); + if ( err != KErrAlreadyExists ) { // may also return KErrAlreadyExists if something // else has already loaded the TSY module. And that is @@ -348,20 +351,22 @@ User::LeaveIfError( err ); } - // open phones - #if defined(_DEBUG) - RDebug::Print(_L("CSecurityNotifier::RunL() open phones")); - #endif - User::LeaveIfError(iServer.SetExtendedErrorGranularity(RTelServer::EErrorExtended)); - User::LeaveIfError(iServer.GetPhoneInfo(PhoneIndex, PhoneInfo)); - User::LeaveIfError(iPhone.Open(iServer,PhoneInfo.iName)); + // open phones + #if defined(_DEBUG) + RDebug::Print(_L("CSecurityNotifier::RunL() open phones")); + #endif + User::LeaveIfError(iServer.SetExtendedErrorGranularity(RTelServer::EErrorExtended)); + User::LeaveIfError(iServer.GetPhoneInfo(PhoneIndex, PhoneInfo)); + User::LeaveIfError(iPhone.Open(iServer,PhoneInfo.iName)); + } + RProperty Property; CleanupClosePushL( Property ); err = Property.Set(KPSUidStartup, KStartupSecurityCodeQueryStatus, ESecurityQueryActive); User::LeaveIfError( err ); // initialize security ui - #if defined(_DEBUG) + #if defined(_DEBUG) RDebug::Print(_L("CSecurityNotifier::RunL() initialize security ui")); #endif CSecurityHandler* handler = new(ELeave) CSecurityHandler(iPhone); @@ -388,11 +393,11 @@ // if something went wrong cancel the code request if (error) { - #if defined(_DEBUG) - RDebug::Print(_L("CSecurityNotifier::RunL() ERROR: %d"), error); - #endif - TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); + #if defined(_DEBUG) + RDebug::Print(_L("CSecurityNotifier::RunL() ERROR: %d"), error); + #endif + TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); + TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); switch (iEvent) { case RMobilePhone::EUniversalPinRequired: @@ -407,19 +412,19 @@ iPhone.AbortSecurityCode(RMobilePhone::ESecurityUniversalPuk); } break; - case RMobilePhone::EPin1Required: + case RMobilePhone::EPin1Required: iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePin1); break; - case RMobilePhone::EPuk1Required: + case RMobilePhone::EPuk1Required: iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePuk1); break; - case RMobilePhone::EPin2Required: + case RMobilePhone::EPin2Required: iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePin2); break; - case RMobilePhone::EPuk2Required: + case RMobilePhone::EPuk2Required: iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePuk2); break; - case RMobilePhone::EPhonePasswordRequired: + case RMobilePhone::EPhonePasswordRequired: iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePhonePassword); break; default: @@ -449,9 +454,9 @@ iReturnVal = KErrNone; //Leave the window group to foreground for a short time to absorb key presses so that autolock has time to activate. if(!StartUp) - User::After(KDelayPeriod); - ( CEikonEnv::Static() )->BringForwards(EFalse); - #if defined(_DEBUG) + User::After(KDelayPeriod); + ( CEikonEnv::Static() )->BringForwards(EFalse); + #if defined(_DEBUG) RDebug::Print(_L("CSecurityNotifier::RunL() End")); #endif } diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/Securitynotifier/Src/Securitynotifierwrapper.cpp --- a/securitydialogs/Securitynotifier/Src/Securitynotifierwrapper.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/Securitynotifier/Src/Securitynotifierwrapper.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -18,7 +18,9 @@ #include - +#include +#include +#include #include // link against aknnotifierwrapper.lib #define KMyNotifierUid TUid::Uid(0x10005988) // uid @@ -48,6 +50,9 @@ // Create Wrappers // Session owning notifier(if default implementation is enough) + RDebug::Printf( "%s %s (%u) !!!!** creating SecurityNotifier.dll . This means that PIN/unlock queries will work **!!!! 0=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + + CAknCommonNotifierWrapper* master = CAknCommonNotifierWrapper::NewL( KMyNotifierUid, KMyNotifierUid, @@ -58,6 +63,7 @@ subjects->AppendL( master ); + CleanupStack::Pop(); // array cleanup #if defined(_DEBUG) RDebug::Print(_L("(SECURITYNOTIFIER)WRAPPER DoCreateNotifierArrayL END")); diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/group/bld.inf --- a/securitydialogs/group/bld.inf Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/group/bld.inf Tue Aug 31 16:04:40 2010 +0300 @@ -24,14 +24,14 @@ PRJ_MMPFILES #include "../keylockpolicyapi/group/bld.inf" -#include "../Autolock/group/bld.inf" +// Autolock is now a QT project built from Autolock.pro +// #include "../Autolock/group/bld.inf" #include "../SecUi/group/bld.inf" #include "../Securitynotifier/Group/bld.inf" #include "../Securityobserver/Group/bld.inf" +// As far as I know, lockclient is also a QT project. I wonder why it's left as .inf #include "../lockclient/group/bld.inf" #include "../lockapp/group/bld.inf" -#include "../simlockui/group/bld.inf" - PRJ_TESTMMPFILES diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/cenrep/AutolockPrivateCRKeys.h --- a/securitydialogs/lockapp/cenrep/AutolockPrivateCRKeys.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2004 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: Autolock local variation Central Repository keys. - * -*/ - - -#ifndef AUTOLOCKPRIVATECRKEYS_H -#define AUTOLOCKPRIVATECRKEYS_H - -// ============================================================================= -// Autolock Configuration API -// ============================================================================= -const TUid KCRUidAutolockConf = { 0x102824AE }; - -/** - * Bitmask used in configuring automatic keylock. - */ -const TUint32 KAutoKeyLockConf = 0x00000001; - -// ============================================================================= -// Automatic Keylock Local Variation constants (KAutoKeyLockConf) -// ============================================================================= - -/** - * KAutolockFeatureIdFlipOpenDisabled is an on/off setting for - * disabling automatic keyguard locking when flip is open. By default off. - * Possible values: 0 (locking enabled), 1 (locking diabled) <-- - */ -const TInt KAutoKeylockFeatureIdFlipOpenDisabled= 0x01; // 2^0 - -#endif diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/data/lockapp.rss --- a/securitydialogs/lockapp/data/lockapp.rss Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -* Copyright (c) 2007 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: LockApp resource file - * -*/ - - -// RESOURCE IDENTIFIER -NAME LOCK - -// INCLUDES -#include "lockapp.loc" -#include -#include -#include -#include - -// RESOURCE DEFINITIONS - -// --------------------------------------------------------- -// Define the resource file signature -// This resource should be empty. -// --------------------------------------------------------- -// -RESOURCE RSS_SIGNATURE { } - -// --------------------------------------------------------- -// Default Document Name -// --------------------------------------------------------- -// -RESOURCE TBUF r_default_document_name { buf=""; } - -// --------------------------------------------------------- -// Define default menu and CBA key. -// --------------------------------------------------------- -// -RESOURCE EIK_APP_INFO - { - } - -// --------------------------------------------------------- -// Define title pane in devicelock mode. -// --------------------------------------------------------- -// -RESOURCE TBUF r_title_pane_locked - { - buf = qtn_set_sec_title_locked; - } diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/data/lockapp_reg.rss --- a/securitydialogs/lockapp/data/lockapp_reg.rss Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2007 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: RSS for creating the registration file for LockApp. - * -*/ - - -#include - -UID2 KUidAppRegistrationResourceFile -UID3 0x10283322 - -RESOURCE APP_REGISTRATION_INFO - { - app_file = "!LockApp"; - hidden = KAppIsHidden; - } diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/group/ABLD.BAT --- a/securitydialogs/lockapp/group/ABLD.BAT Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -@ECHO OFF - -REM Bldmake-generated batch file - ABLD.BAT -REM ** DO NOT EDIT ** - -perl -S ABLD.PL "\sf\mw\securitysrv\securitydialogs\lockapp\group\\" %1 %2 %3 %4 %5 %6 %7 %8 %9 -if errorlevel==1 goto CheckPerl -goto End - -:CheckPerl -perl -v >NUL -if errorlevel==1 echo Is Perl, version 5.003_07 or later, installed? -goto End - -:End diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/group/bld.inf --- a/securitydialogs/lockapp/group/bld.inf Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/lockapp/group/bld.inf Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2005 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" @@ -11,33 +11,16 @@ * * Contributors: * -* Description: LockApp build info - * +* Description: build info file for lockapp +* */ #include -PRJ_PLATFORMS -DEFAULT PRJ_EXPORTS ../rom/lockapp.iby CORE_MW_LAYER_IBY_EXPORT_PATH(lockapp.iby) -../rom/lockappresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(lockappresources.iby) -../loc/lockapp.loc MW_LAYER_LOC_EXPORT_PATH(lockapp.loc) -../pubsub/SecurityUIsPrivatePSKeys.h |../../../inc/securityuisprivatepskeys.h -../sis/lockapp_stub.sis /epoc32/data/z/system/install/lockapp_stub.sis - -PRJ_EXTENSIONS - -START EXTENSION s60/mifconv -OPTION TARGETFILE lockapp.mif -OPTION HEADERFILE lockapp.mbg -OPTION SOURCES -c8,8 qgn_graf_phone_locked -END PRJ_MMPFILES -//gnumakefile lockapp_icons_dc.mk lockapp.mmp - -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/group/lockapp.mmp --- a/securitydialogs/lockapp/group/lockapp.mmp Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/lockapp/group/lockapp.mmp Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2005 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" @@ -11,126 +11,40 @@ * * Contributors: * -* Description: Keyguard and Devicelock application server LockApp - * +* Description: Implementation of lockapp +* */ - +// To get the APP_LAYER_SYSTEMINCLUDE-definition #include -#include -TARGET lockapp.exe -TARGETTYPE exe -EPOCSTACKSIZE 0x5000 +#include "defaultcaps.hrh" +CAPABILITY CAP_APPLICATION ProtServ NetworkControl -VENDORID VID_DEFAULT +TARGET lockapp.exe -// ProtServ for being a server -// WriteDeviceData Devicelock configuration needs it -// SWEvent for capturing/generating key events -// NetworkServices for remote lock for devicelock +targettype exe -CAPABILITY CAP_APPLICATION ProtServ NetworkControl +EPOCSTACKSIZE 0x5000 UID 0x100039CE 0x10283322 - -SECUREID 0x100059B5 - -//LANG SC +SECUREID 0x100059B5 +VENDORID VID_DEFAULT SOURCEPATH ../src - -// AppArc framework -SOURCE lockappapplication.cpp -SOURCE lockappappui.cpp -SOURCE lockappdocument.cpp - -// State control -SOURCE lockappobserverlist.cpp -SOURCE lockappstatecontrol.cpp -SOURCE lockappbasecontrol.cpp - -// State observers -SOURCE lockappidlecontrol.cpp -SOURCE lockappkeyguardcontrol.cpp -SOURCE lockappdevicelockcontrol.cpp -SOURCE lockappdevicelockcontainer.cpp -SOURCE lockappecsdetector.cpp -SOURCE lockappstatepublisher.cpp - -// CenRep and PS observers -SOURCE lockappcenrepobserver.cpp -SOURCE lockapppubsubobserver.cpp +SOURCE lockapp.cpp -// Keyguard notes -SOURCE lockappsleepingnote.cpp -SOURCE lockapplockednote.cpp -SOURCE lockappecsnote.cpp - -// LockApp Server -SOURCE lockappserver.cpp -SOURCE lockappsession.cpp +USERINCLUDE . ../inc -// LockApp Utils -SOURCE lockappkeycapturecontroller.cpp -SOURCE lockappkeypattern.cpp -SOURCE lockapputils.cpp -SOURCE lockappwait.cpp - -SOURCEPATH ../group - -USERINCLUDE ../inc ../loc ../cenrep - -APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE ../../../inc - +MW_LAYER_SYSTEMINCLUDE -LIBRARY euser.lib // USER services -LIBRARY apparc.lib // application architecture -LIBRARY cone.lib // Cone -LIBRARY bafl.lib // BaflUtils, reading localisation resources -LIBRARY ws32.lib // accessing window groups -LIBRARY apgrfx.lib // accessing window group names -LIBRARY eikcore.lib // eikon environment -LIBRARY eikcoctl.lib // ceikstatuspane -LIBRARY eikdlg.lib // eikdialogs -LIBRARY gdi.lib // drawing -LIBRARY fbscli.lib // required for CFbsBitmap -LIBRARY efsrv.lib // server library -LIBRARY etel.lib // telephony -LIBRARY etelmm.lib // telephony -LIBRARY customapi.lib // custom api -LIBRARY centralrepository.lib // central repository -LIBRARY cenrepnotifhandler.lib // central repository notify handler -LIBRARY featmgr.lib // feature manager -LIBRARY cdlengine.lib // layout engine -LIBRARY avkon.lib // Avkon -LIBRARY aknicon.lib // icon support -LIBRARY aknlayout2.lib // old layouts -LIBRARY aknlayout2scalable.lib // new layouts -LIBRARY aknskins.lib // skins -LIBRARY aknnotify.lib // aknsmallindicator -LIBRARY activitymanager.lib // Activity manager -LIBRARY secui.lib // Security UI - -LIBRARY flogger.lib // File logging - -LIBRARY keylockpolicyapi.lib // Keylock policy - -#ifdef __SAP_TERMINAL_CONTROL_FW -LIBRARY scpclient.lib -#endif // __SAP_TERMINAL_CONTROL_FW - -START RESOURCE ../data/lockapp.rss -HEADER -TARGETPATH APP_RESOURCE_DIR -//LANG SC -LANGUAGE_IDS -END - -START RESOURCE ../data/lockapp_reg.rss -TARGETPATH /private/10003a3f/apps -END - +// Symbian +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY ws32.lib +LIBRARY eikcore.lib +LIBRARY apgrfx.lib +LIBRARY apparc.lib +LIBRARY cone.lib SMPSAFE diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/group/lockapp_icons_dc.mk --- a/securitydialogs/lockapp/group/lockapp_icons_dc.mk Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -# -# Copyright (c) 2004 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: -# - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) - ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z -else - ZDIR=\epoc32\data\z -endif - -# ---------------------------------------------------------------------------- -# TODO: Configure these -# ---------------------------------------------------------------------------- - -TARGETDIR=$(ZDIR)\resource\apps -ICONTARGETFILENAME=$(TARGETDIR)\lockapp.mif - -HEADERDIR=\epoc32\include -HEADERFILENAME=$(HEADERDIR)\lockapp.mbg - -do_nothing : - @rem do_nothing - -MAKMAKE : do_nothing - -BLD : do_nothing - -CLEAN : do_nothing - -LIB : do_nothing - -CLEANLIB : do_nothing - -# ---------------------------------------------------------------------------- -# TODO: Configure these. -# -# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by -# MifConv if the mask detph is defined. -# -# NOTE 2: Usually, source paths should not be included in the bitmap -# definitions. MifConv searches for the icons in all icon directories in a -# predefined order, which is currently \s60\icons, \s60\bitmaps2, \s60\bitmaps. -# The directory \s60\icons is included in the search only if the feature flag -# __SCALABLE_ICONS is defined. -# ---------------------------------------------------------------------------- - -RESOURCE : - mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ - /c8,8 qgn_graf_phone_locked \ - - -FREEZE : do_nothing - -SAVESPACE : do_nothing - -RELEASABLES : - @echo $(HEADERFILENAME)&& \ - @echo $(ICONTARGETFILENAME) - -FINAL : do_nothing diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockapp.hrh --- a/securitydialogs/lockapp/inc/lockapp.hrh Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* -* Copyright (c) 2007 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: General application spesific enumeration values - * -*/ - - -#ifndef __LOCKAPP_HRH__ -#define __LOCKAPP_HRH__ - -/** - * LockApp panic codes - * - * @lib lockapp - * @since 5.0 - * @author Joona Petrell - * @author Tamas Koteles - */ -enum TLockAppPanic - { - ELockPanicGeneral, - ELockPanicIllegalMessage, - ELockUnknownValue, - ELockIllegalState, - ELockPanicOutOfRange, - ELockPanicObserverAlreadyExists, - ELockPanicObserverNotFound, - }; - -/** - * Three possible states of LockApp: unlocked, keyguard active, devicelock active - * - * @lib lockapp - * @since 5.0 - * @author Joona Petrell - * @author Tamas Koteles - */ -enum TLockStatus - { - ELockNotActive = 0, - EKeyguardActive, - EDevicelockActive - }; - -/** - * Three possible reason for devicelock: manual, remote, timer - * - * @lib lockapp - * @since 5.0 - * @author Joona Petrell - * @author Tamas Koteles - */ -enum TDevicelockReason - { - EDevicelockManual = 1, - EDevicelockRemote, - EDevicelockTimer - }; - -/** - * Bit-field representing screen saver status - */ -const TUint KLockAppEnvScreenSaverOn = 1; - -/** - * Bit-field representing phonecall status - */ -const TUint KLockAppEnvPhonecallOngoing = 2; - -/** - * Bit-field representing idle status - */ -const TUint KLockAppEnvIdleOnForeground = 4; - -/** - * Bit-field representing grip status - */ -const TUint KLockAppEnvGrip = 8; - -/** - * Bit-field representing FPS status - */ -const TUint KLockAppEnvFPS = 0x10; - -#endif // __LOCKAPP_HRH__ diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockappapplication.h --- a/securitydialogs/lockapp/inc/lockappapplication.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2007 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: Application class that also creates the appserver - * -*/ - - -#ifndef __LOCKAPP_APPLICATION_H__ -#define __LOCKAPP_APPLICATION_H__ - -// INCLUDES -#include - -/** - * CLockAppApplication class, is the application part of the Avkon - * framework. - * - * @lib lockapp - * @since 5.0 - * @author Joona Petrell - * @author Tamas Koteles - */ -class CLockAppApplication : public CAknApplication - { - public: - - /** - * @return LockApp application Uid. - */ - TUid AppDllUid( ) const; - - protected: - - CApaDocument* CreateDocumentL( ); - - }; - -#endif // __LOCKAPP_APPLICATION_H__ diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockappappui.h --- a/securitydialogs/lockapp/inc/lockappappui.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* -* Copyright (c) 2007 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: LockApp Application UI class - * -*/ - - -#ifndef __LOCKAPP_APPUI_H__ -#define __LOCKAPP_APPUI_H__ - -// INCLUDES -#include -#include "lockapp.hrh" - -// FORWARD DECLARATIONS -class CLockAppAppView; -class MLockAppStateControl; -class CLockAppStateControl; -class CLockAppServer; - -/** - * CLockAppApplication class is the central user interface class in Avkon. - * Owns the LockApp state control and the server component. - * - * @lib lockapp - * @since 5.0 - * @author Joona Petrell - * @author Tamas Koteles - */ -class CLockAppAppUi : public CAknAppUi - { - public: - - /** - * Second constructor that can fail (leave). - */ - void ConstructL( ); - - /** - * C++ default constructor. - */ - CLockAppAppUi( ); - - /** - * Destructor. - */ - ~CLockAppAppUi( ); - - public: - - /** - * @see CAknAppUi::HandleResourceChangeL(TInt aType) - */ - void HandleResourceChangeL( TInt aType ); - - public: - - /** - * Access to main lock state control (used by the server). - * - * @return pointer to state control - */ - MLockAppStateControl* StateControl( ); - - protected: - -#ifdef __SAP_TERMINAL_CONTROL_FW - - /** - * From CEikAppUi, handles the TARM unlock message, other messages - * are propagated to the superclass handler. - * - * @param aClientHandleOfTargetWindowGroup The window group that the message was sent to. - * @param aMessageUid The message UID. - * @param aMessageParameters The message parameters - * @return TMessageResponse EMessageHandled if the message was the TARM unlock message, - * otherwise the return value from the superclass handler. - */ - MCoeMessageObserver::TMessageResponse HandleMessageL( - TUint32 aClientHandleOfTargetWindowGroup, - TUid aMessageUid, - const TDesC8& aMessageParameters ); - -#endif // __SAP_TERMINAL_CONTROL_FW - - /** - * @see CAknAppUi::HandleWsEventL(const TWsEvent& aEvent,CCoeControl* aDestination) - */ - void HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination ); - - private: - - /** - * Main control of the LockApp. - * Owned. - */ - CLockAppStateControl* iStateControl; - - /** - * Main server of the LockApp. - * Own. - */ - CLockAppServer* iLockServer; - }; - -#endif // __LOCKAPP_APPUI_H__ diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockappbasecontrol.h --- a/securitydialogs/lockapp/inc/lockappbasecontrol.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,158 +0,0 @@ -/* -* Copyright (c) 2007 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: Base control for logical UI components - * -*/ - - -#ifndef __LOCKAPPBASECONTROL_H__ -#define __LOCKAPPBASECONTROL_H__ - -// INCLUDES -#include -#include "lockappstateobserver.h" -#include "lockapplockednote.h" -#include "lockappkeypattern.h" -#include - -// FORWARD DECLARATIONS -class MLockAppStateControl; -class CEikButtonGroupContainer; - -/** - * CLockAppBaseControl class is the base control of lockapp state controls, - * provides common interface and some protected utility methods. - * - * @lib lockapp - * @since 5.0 - * @author Joona Petrell - * @author Tamas Koteles - */ -class CLockAppBaseControl : public CCoeControl, public MLockAppStateObserver - { - public: - - /** - * Destructor. - */ - ~CLockAppBaseControl( ); - - /** - * From @c MLockAppStateObserver. Method handles the lock state changes. - * - * @param aStatus The new lock state - */ - virtual void HandleLockStatusChangedL( TLockStatus aStatus ); - - /** - * Handles control activation. - * - * @param aEnvMask environment bitmask - */ - virtual void HandleActivateEventL( TUint aEnvMask ); - - /** - * Handles control deactivation. - * - * @param aEnvMask environment bitmask - */ - virtual void HandleDeActivateEventL( TUint aEnvMask ); - - /** - * Handle environment bitmask change. - * - * @param aEnvMask environment bitmask - * @param aEventMask event bitmask - */ - virtual void HandleEnvironmentChange( TUint aEnvMask, TUint aEventMask ); - - protected: - - /** - * Default Constructor. - * - * @param aStateControl state control interface - */ - CLockAppBaseControl( MLockAppStateControl& aStateControl ); - - /** - * 2nd phase constructor. - */ - void ConstructL( ); - - /** - * Set up the control's keypattern matcher with the specified keylockpolicy. - * - * @param aType keylock policy type (lock,unlock,devicelock) - */ - TBool SetupKeyPatternsWithPolicyL( TLockPolicyType aType ); - - /** - * Show a note. (cancels previous one if shown) - * - * @param aNote note to be shown - * @param aTimeout timeout for the note - * @param aTone tone type - */ - void ShowNote( CLockAppLockedNote* aNote, const TInt aTimeout, - const CAknNoteDialog::TTone aTone ); - - /** - * Dismisses a note. - */ - void CancelNote( ); - - /** - * Capture/Release primary keys. - */ - void CapturePrimaryKeys( const TBool aCapture ); - - /** - * Show/Hide softkey cba. - */ - void ShowCba( const TBool aShow ); - - /** - * Capture/Release pointer events. - */ - void SetPointerEventCapture( const TBool aEnable ); - - /** - * Show/Hide keyguard indicator state. - */ - void SetKeyguardIndicatorStateL( const TBool aEnable ); - - protected: - - // interface to parent state control - MLockAppStateControl& iStateControl; - - // application's window group - RWindowGroup& iWindowGroup; - - // control's currently shown note (not owned) - CLockAppLockedNote* iCurrentNote; - - // control's Cba (owned) - CEikButtonGroupContainer* iCba; - - // key pattern matching (owned) - CLockAppKeyPattern* iKeyPattern; - - // if control is active - TBool iActive; - - }; - -#endif // __LOCKAPPBASECONTROL_H__ diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockappcenrepobserver.h --- a/securitydialogs/lockapp/inc/lockappcenrepobserver.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -/* -* Copyright (c) 2007 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: Central Repository key observer - * -*/ - - -#ifndef __LOCKAPPCENREPOBSERVER_H__ -#define __LOCKAPPCENREPOBSERVER_H__ - -// INCLUDES -#include -#include -#include "lockappobserverinterface.h" - -/** - * CLockAppCenRepObserver class is a Central Repository key observer - * which can be used to monitor and set a CenRep value. - * - * @lib lockapp - * @since 5.0 - * @author Tamas Koteles - */ -class CLockAppCenRepObserver : public CBase, public MCenRepNotifyHandlerCallback - { - public: - - /** - * Two-phased constructor. - * - * @param aObserver pointer to observer - * @param aCenRepUid repository Uid - * @param aKeyId repository key Id - * @return the instance just created - */ - static CLockAppCenRepObserver* NewL( MLockAppObserverInterface* aObserver, TUid aCenRepUid, - TUint32 aKeyId ); - - /** - * Destructor. - */ - ~CLockAppCenRepObserver( ); - - /** - * Get key value from CenRep. - */ - TInt GetValue( TInt& aValue ); - - /** - * Get the value from a different CenRep key. - */ - TInt GetKeyValue( TUint32 aKey, TInt& aValue ); - - /** - * Set key value to CenRep. - */ - TInt SetValue( TInt aValue ); - - /** - * Set the value of a different CenRep key. - */ - TInt SetKeyValue( TUint32 aKey, TInt aValue ); - - public: - - /** - * From MCenRepNotifyHandlerCallback. Handles change event. Called by CenRep. - * - * @param aId the id of the changed setting - * @param aNewValue the new value of the changed setting - */ - void HandleNotifyInt( TUint32 aId, TInt aNewValue ); - - void HandleNotifyError( TUint32 aId, TInt error, CCenRepNotifyHandler* aHandler ); - - void HandleNotifyGeneric( TUint32 aId ); - - protected: - - /** - * C++ default constructor. - * - * @param aObserver pointer to observer - * @param aCenRepUid central repository Uid - * @param aKeyId key Id - */ - CLockAppCenRepObserver( MLockAppObserverInterface* aObserver, TUid aCenRepUid, - TUint32 aKeyId ); - - /** - * Symbian OS constructor. - */ - void ConstructL( ); - - protected: - - /** - * Observer's callback interface. Not owned. - */ - MLockAppObserverInterface* iObserver; - - /** - * CenRep value notifier. - */ - CCenRepNotifyHandler* iNotifyHandler; - - /** - * Access to central repository. - */ - CRepository* iRepository; - - /** - * Repository Uid. - */ - TUid iCenRepUid; - - /** - * Repository key Id. - */ - TUint32 iKeyId; - - }; - -#endif // __LOCKAPPCENREPOBSERVER_H__ -// END OF FILE diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockappdevicelockcontainer.h --- a/securitydialogs/lockapp/inc/lockappdevicelockcontainer.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/* -* Copyright (c) 2007 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: Devicelock Background UI (window owning control) - * -*/ - - -#ifndef LOCKAPPDEVICELOCKCONTAINER_H -#define LOCKAPPDEVICELOCKCONTAINER_H - -// INCLUDES -#include -#include -#include -#include - -// FORWARD DECLARATIONS -class CAknsLayeredBackgroundControlContext; - -/** - * CLockAppDevicelockContainer class contains UI components - * for the devicelock control. - * - * @lib lockapp - * @since 5.0 - * @author Joona Petrell - * @author Tamas Koteles - * @see CLockAppDevicelockControl - */ -class CLockAppDevicelockContainer : public CCoeControl, MCoeControlObserver - { - public: - - /** - * Two-phased constructor. - */ - static CLockAppDevicelockContainer* CLockAppDevicelockContainer::NewL( RWindowGroup& aWg ); - - /** - * Destructor. - */ - ~CLockAppDevicelockContainer( ); - - public: - - /** - * From CCoeControl, MopSupplyObject - */ - TTypeUid::Ptr MopSupplyObject( TTypeUid aId ); - - private: - - /** - * 2nd stage construction - */ - void ConstructL( RWindowGroup& aWg ); - - TRect GetMainPaneRect( ); - - private: - - void SizeChanged( ); - - TInt CountComponentControls( ) const; - - CCoeControl* ComponentControl( TInt aIndex ) const; - - void Draw( const TRect& aRect ) const; - - void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ); - - private: - - CEikImage* iEikBitmap; - CFbsBitmap* iBitmap; - CFbsBitmap* iMask; - - // Owned background context. - CAknsLayeredBackgroundControlContext* iBgContext; - - // Clock for landscape. - CAknSkinnableClock* iClock; - }; - -#endif - -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockappdevicelockcontrol.h --- a/securitydialogs/lockapp/inc/lockappdevicelockcontrol.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,238 +0,0 @@ -/* -* Copyright (c) 2007 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: Devicelock UI - * -*/ - - -#ifndef LOCKAPPDEVICELOCKCONTROL_H -#define LOCKAPPDEVICELOCKCONTROL_H - -// INCLUDES -#include "lockappbasecontrol.h" -#include "lockappobserverinterface.h" -#include -#include -#include - -// FORWARD DECLARATIONS -class CLockAppDevicelockContainer; -class CUserActivityManager; -class CLockAppPubSubObserver; -class CLockAppCenRepObserver; - -/** - * CLockAppDevicelockControl represents the devicelock state in the state machine. - * Window-owning compound control that provides visible user interface, - * shows the lock bitmap by its child container, handles all events - * and asks for security code if "unlock" is pressed. - * - * @lib lockapp - * @since 5.0 - * @author Joona Petrell - * @author Tamas Koteles - * @see CLockAppBaseControl - * @see CLockAppDevicelockContainer - * @see MLockAppStateControl - * @see CUserActivityManager - * @see CLockAppPubSubObserver - * @see CLockAppCenRepObserver - */ -class CLockAppDevicelockControl : public CLockAppBaseControl, public MEikCommandObserver, - public MLockAppObserverInterface - { - public: - - /** - * Two-phased constructor. - */ - static CLockAppDevicelockControl* NewL( MLockAppStateControl& aStateControl, - RWindowGroup& aWg ); - - /** - * Destructor. - */ - ~CLockAppDevicelockControl( ); - - /** - * Finalize the construction by connecting to Phone side. - */ - void CLockAppDevicelockControl::ConnectToPhoneL( RWindowGroup& aWg ); - - /** - * Is it allowed to activate control. - */ - TBool ActivationAllowedL( TDevicelockReason aReason ); - - /** - * is it allowed to deactivate control. - */ - TBool DeActivationAllowedL( ); - - virtual void HandleActivateEventL( TUint aEnvMask ); - - virtual void HandleDeActivateEventL( TUint aEnvMask ); - - virtual void HandleEnvironmentChange( TUint aEnvMask, TUint aEventMask ); - - /** - * Set the reason for devicelock. - */ - void SetLockingReason( TDevicelockReason aReason ); - - private: - - /** - * Constructor for performing 1st stage construction - */ - CLockAppDevicelockControl( MLockAppStateControl& aStateControl ); - - /** - * 2nd stage construction - */ - void ConstructL( RWindowGroup& aWg ); - - void DefinePubSubKeysL( ); - - void HandleUnlockCommandL( ); - - public: - - /** - * Handle Central Repository observer callback. - */ - void HandleCenRepNotify( TUid aCenRepUid, TUint32 aKeyId, TInt aValue ); - - /** - * Handle Publish & Subscribe observer callback. - */ - void HandlePubSubNotify( TUid aPubSubUid, TUint aKeyId, TInt aValue ); - - public: - - void HandleResourceChange( TInt aType ); - - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); - - private: - - TInt CountComponentControls( ) const; - - CCoeControl* ComponentControl( TInt aIndex ) const; - - private: - - /* - * Checks whether we are booting from a Hidden Reset - */ - TBool IsHiddenReset( ); - - /* - * Checks whether the pin is blocked. - */ - TBool IsPinBlocked( ); - - /* - * Checks whether TARM admin flag is set (optionally unsets it). - */ - TBool TarmAdminFlag( TBool unSetFlag ); - - TBool ETelActivationAllowed( ); - - // Get autolock timeout (in seconds) - TInt GetAutoLockTimeout( ); - - // Starts monitoring user activity - void StartActivityMonitoringL( ); - - // Gets new autolock period and starts monitoring user activity - void ResetInactivityTimeout( ); - - // Stop monitoring user activity. - void StopActivityMonitoring( ); - - // Handles Active event. Called by ActivityManager - static TInt HandleActiveEventL( TAny* aPtr ); - - // Handles Inactive event. Called by ActivityManager - static TInt HandleInactiveEventL( TAny* aPtr ); - - // Set custom status pane visible/invisible - void ShowStatusPane( const TBool aVisible ); - - private: - - /** - * From @c MEikCommandObserver. Dialogs and CBA send - * UI commands to parent using method ProcessCommandL. - * - * @param aCommandId Command to be handled - */ - void ProcessCommandL( TInt aCommandId ); - - private: - - /***************************************************** - * S60 Customer / ETel - * S60 ETel API - *****************************************************/ - - RTelServer iTelServer; - int iTelServerInitialized; - RMobilePhone iPhone; - int iPhoneInitialized; - RMmCustomAPI iCustomPhone; - int iCustomPhoneInitialized; - - /** - * Devicelock auto-locking timeout observer - * (value in minutes) - */ - CLockAppCenRepObserver* iCRAutoLockTime; - - /** - * Devicelock status publisher. - * (Permamanent setting: On/Off) - */ - CLockAppCenRepObserver* iCRAutoLockStatus; - - /** - * Autolock state PubSub publisher. - * (Runtime setting) - */ - CLockAppPubSubObserver* iPSAutolockState; - - /** - * User activity manager/observer - */ - CUserActivityManager* iActivityManager; - - /** - * Background image container control - */ - CLockAppDevicelockContainer* iContainer; - - /** - * Feature manager value for CDMA protocol - */ - TBool iFeatureProtocolCdma; - - /** - * Is security code query shown - */ - TBool iShowingSecCodeQuery; - - }; - -#endif // LOCKAPPDEVICELOCKCONTROL_H diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockappdocument.h --- a/securitydialogs/lockapp/inc/lockappdocument.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* -* Copyright (c) 2007 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: LockApp application document class - * -*/ - - -#ifndef __LOCKAPP_DOCUMENT_H__ -#define __LOCKAPP_DOCUMENT_H__ - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class CLockAppAppUi; -class CEikApplication; - -/** - * CLockAppDocument class is derived from CAknDocument, - * based on standard Avkon document template. - * - * @lib lockapp - * @since 5.0 - * @author Joona Petrell - * @author Tamas Koteles - */ -class CLockAppDocument : public CAknDocument - { - public: - - /** - * Two-phased constructor. - * - * @param aApp application class - */ - static CLockAppDocument* NewL( CEikApplication& aApp ); - static CLockAppDocument* NewLC( CEikApplication& aApp ); - - /** - * Destructor - */ - ~CLockAppDocument( ); - - public: - - /* - * From @c CAknDocument. Creates AppUi. - * - * @return generic AppUI object - */ - CEikAppUi* CreateAppUiL( ); - - private: - - /** - * Second constructor that can fail (leave). - */ - void ConstructL( ); - - /** - * C++ default constructor. - */ - CLockAppDocument( CEikApplication& aApp ); - - }; - -#endif // __LOCKAPP_DOCUMENT_H__ diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockappecsdetector.h --- a/securitydialogs/lockapp/inc/lockappecsdetector.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -/* -* Copyright (c) 2007 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: Provides emergency call support for keyguard/devicelock - * -*/ - - -#ifndef __LOCKAPPSTATEDETECTOR_H__ -#define __LOCKAPPSTATEDETECTOR_H__ - -// INCLUDES -#include "lockappstateobserver.h" -#include // MAknEcsObserver and CAknEcsDetector - -// FORWARD DECLARATIONS -class CLockAppEcsNote; - -/** - * CLockAppEcsDetector class owns emergency note and emergency detector. - * Taps directly to AppUi windowserver event source for receiving key events. - * If user presses emergency numbers defined in SIM, emergency note is shown. - * Only works when keyguard or devicelock is activated. - * - * @lib lockapp - * @since 5.0 - * @author Joona Petrell - * @author Tamas Koteles - */ -class CLockAppEcsDetector : public CBase, public MLockAppStateObserver, public MAknEcsObserver - { - public: - - /** - * Two-phased constructor. - */ - static CLockAppEcsDetector* NewL( ); - - /** - * Destructor - */ - ~CLockAppEcsDetector( ); - - private: - - /** - * C++ default constructor. - */ - CLockAppEcsDetector( ); - - /** - * Second constructor that can fail (leave). - */ - void ConstructL( ); - - public: - - /** - * From @c CLockAppStateObserver. Method handles the lock state changes. - * - * @param aLockStatus The new lock state - */ - virtual void HandleLockStatusChangedL( TLockStatus aLockStatus ); - - private: - - /** - * From @c MAknEcsObserver. Handles changes in emergency call detector. - * @param aEcsDetector a pointer to ecsdetector component - * @param aState the new emergency detector state. - */ - void HandleEcsEvent( CAknEcsDetector* aEcsDetector, CAknEcsDetector::TState aState ); - - public: - - /** - * Emergency note is visible. - * - * @return true if emergency note is on the screen. - */ - TBool EcsNoteOnScreen( ) const; - - /** - * Internal Method only used for testing since emergency number - * detection does not work in emulator. - * - * @return KErrNone if there were no problems - */ - TInt TestEcsNote( ); - - private: - - /** - * Receives emergency number key events and handles emergency dialing. - * Own. - */ - CAknEcsDetector* iEcsDetector; - - /** - * Emergency note to be shown when user has dialed emergency number. - * Own. - */ - CLockAppEcsNote* iEcsNote; - - }; - -#endif // __LOCKAPPSTATEDETECTOR_H__ -// End of File - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockappecsnote.h --- a/securitydialogs/lockapp/inc/lockappecsnote.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* -* Copyright (c) 2007 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: Emergency number dialog - * -*/ - - -#ifndef __LOCKAPPECSNOTE_H__ -#define __LOCKAPPECSNOTE_H__ - -// INCLUDES -#include - -/** - * CLockAppEcsNote class is derived from Avkon note implementation; - * shows emergency numbers on a dialog once the user has dialed - * the numbers. - * - * @lib lockapp - * @since 5.0 - * @author Joona Petrell - * @author Tamas Koteles - */ -class CLockAppEcsNote : public CAknNoteDialog - { - public: - - /** - * C++ constructor. - */ - CLockAppEcsNote( ); - - /** - * Destructor. - */ - ~CLockAppEcsNote( ); - - public: - - /** - * Constructs sleeping note - */ - void ConstructSleepingNoteL( TInt aResourceId ); - - /** - * Shows sleeping note - */ - TInt ShowNote( ); - - /** - * Hides sleeping note - */ - void SleepNote( ); - - /** - * Consume key events - */ - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); - - /** - * API to set the emergency number to be displayed - * - * aMatchedNumber text to display (e.g. "112" ) - */ - void SetEmergencyNumber( const TDesC& aMatchedNumber ); - - public: - - TBool iNoteOnScreen; - - }; - -#endif // __LOCKAPPECSNOTE_H__ -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockappidlecontrol.h --- a/securitydialogs/lockapp/inc/lockappidlecontrol.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* -* Copyright (c) 2007 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: Idle (unlocked) UI - * -*/ - - -#ifndef LOCKAPPIDLECONTROL_H -#define LOCKAPPIDLECONTROL_H - -// INCLUDES -#include -#include -#include -#include -#include -#include // phone query -#include "lockappbasecontrol.h" - -/** - * CLockAppIdleControl class represents the unlocked state in the locking state machine. - * - * @lib lockapp - * @since 5.0 - * @author Joona Petrell - * @author Tamas Koteles - * @see CLockAppBaseControl - * @see MLockAppStateControl - */ -class CLockAppIdleControl : public CLockAppBaseControl, public MEikCommandObserver - { - public: - - /** - * Two-phased constructor. - */ - static CLockAppIdleControl* NewL( MLockAppStateControl& aStateControl ); - - /** - * Destructor. - */ - ~CLockAppIdleControl( ); - - private: - - /** - * Constructor for performing 1st stage construction - */ - CLockAppIdleControl( MLockAppStateControl& aStateControl ); - - /** - * EPOC default constructor for performing 2nd stage construction - */ - void ConstructL( ); - - public: - - void OfferKeyLock( ); - - void CancelOfferKeyLock( ); - - void HandleActivateEventL( TUint aEnvMask ); - - void HandleDeActivateEventL( TUint aEnvMask ); - - public: - - void HandleResourceChange( TInt aType ); - - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); - - private: - - TInt CountComponentControls( ) const; - - CCoeControl* ComponentControl( TInt aIndex ) const; - - private: - /** - * From @c MEikCommandObserver. Dialogs and CBA send - * UI commands to parent using method ProcessCommandL. - * - * @param aCommandId Command to be handled - */ - void ProcessCommandL( TInt aCommandId ); - - private: - - // "offer to lock keys" note - CLockAppLockedNote* iOfferLockNote; - - }; - -#endif // LOCKAPPIDLECONTROL_H diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockappkeycapturecontroller.h --- a/securitydialogs/lockapp/inc/lockappkeycapturecontroller.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +0,0 @@ -/* -* Copyright (c) 2007 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: Key capture controller - * -*/ - - -#ifndef __LOCKAPPKEYCAPTURECONTROLLER_H__ -#define __LOCKAPPKEYCAPTURECONTROLLER_H__ - -// INCLUDES -#include -#include - -// enumerated type for captured key events -enum TPhoneKeyCaptureType - { - EKeyCaptureEvent, - EKeyCaptureUpAndDownEvents, - EKeyCaptureAllEvents - }; - -// Key capture data structure -class TPhoneKeyCapture - { - public: - TStdScanCode iKey; // primary identifier - TKeyCode iKeyCode; - TPhoneKeyCaptureType iType; - TInt32 iHandle; - TInt32 iHandleForUpAndDown; - }; - -// FORWARD DECLARATIONS -class RWindowGroup; - -/** - * CLockAppKeyCaptureController class is a simple key capture utily that - * provides a way to capture/release keys for the current window group. - * - * @lib lockapp - * @since 5.0 - * @author Joona Petrell - * @author Tamas Koteles - */ -class CLockAppKeyCaptureController : public CBase - { - public: - - /** - * Initialize the utility - */ - static CLockAppKeyCaptureController* InitL( RWindowGroup& aWindowGroup ); - - /** - * Destroy the utility - */ - static void Destroy( ); - - /** - * Set key to be captured - */ - static void CaptureKey( TUint32 aKey, TUint32 aKeyCode, TPhoneKeyCaptureType aType ); - - /** - * Set key to be released - */ - static void ReleaseKey( TUint32 aKey ); - - private: - - /** - * C++ default constructor. - */ - CLockAppKeyCaptureController( RWindowGroup& aWindowGroup ); - - /** - * Destructor. - */ - virtual ~CLockAppKeyCaptureController( ); - - private: - - /** - * Set key to be captured - */ - void StartCapturingKey( TUint32 aKey, TUint32 aKeyCode, TPhoneKeyCaptureType aType ); - - /** - * Set key not to be captured - */ - void StopCapturingKey( TUint32 aKey ); - - /** - * May be used to ask whether a key has been set to be captured or not - * @param aKey is the iScanCode of the key - * @return ETrue if the key is currently captured via this mechanism - */ - TBool IsKeyCaptured( TUint32 aKey ) const; - - /** - * Set key not to be captured - * @param aKeyCapture is the key not to be captured - */ - void StopKeyCapture( TPhoneKeyCapture aKeyCapture ); - - private: - - /** - * Private instance of the utility - */ - static CLockAppKeyCaptureController* instance; - - /** - * Array of keycodes currently captured which includes the window - * server handles for the captured keys. - */ - RArray iCapturedKeys; - - /** - * application's window group - */ - RWindowGroup& iWindowGroup; - - }; - -#endif // LOCKAPPKEYCAPTURECONTROLLER_H - -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockappkeyguardcontrol.h --- a/securitydialogs/lockapp/inc/lockappkeyguardcontrol.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,207 +0,0 @@ -/* -* Copyright (c) 2007 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: Keyguard UI (window-owning compound control) - * -*/ - - -#ifndef __LOCKAPPKEYGUARDCONTROL_H__ -#define __LOCKAPPKEYGUARDCONTROL_H__ - -// INCLUDES -#include "lockappbasecontrol.h" -#include "lockappobserverinterface.h" -#include - -// FORWARD DECLARATIONS -class CLockAppPubSubObserver; -class CLockAppCenRepObserver; -class CUserActivityManager; - -/** - * CLockAppKeyguardControl class represents the keyguard state in the state machine. - * Window-owning compound control that provides visible keyguard user interface. - * Owns all keyguard dialogs and commands received from the child controls like - * dialogs and cba. - * - * @lib lockapp - * @since 5.0 - * @author Joona Petrell - * @author Tamas Koteles - * @see CLockAppBaseControl - * @see MLockAppStateControl - * @see CUserActivityManager - * @see CLockAppPubSubObserver - * @see CLockAppCenRepObserver - */ -class CLockAppKeyguardControl : public CLockAppBaseControl, public MEikCommandObserver, - public MLockAppObserverInterface - { - public: - - /** - * Two-phased constructor. - * - * @param aStateControl reference to the main state control - */ - static CLockAppKeyguardControl* NewL( MLockAppStateControl& aStateControl ); - - /** - * Destructor. - */ - ~CLockAppKeyguardControl( ); - - TBool ActivationAllowedL( ); - - TBool DeActivationAllowedL( ); - - virtual void HandleActivateEventL( TUint aEnvMask ); - - virtual void HandleDeActivateEventL( TUint aEnvMask ); - - virtual void HandleEnvironmentChange( TUint aEnvMask, TUint aEventMask ); - - private: - - /** - * C++ default constructor. - * - * @param aStateControl reference to the main state control - */ - CLockAppKeyguardControl( MLockAppStateControl& aStateControl ); - - /** - * Second constructor that can fail (leave). - */ - void ConstructL( ); - - public: - - void DisplayLockedNote( ); - - void DisplayKeysLockedNote( ); - - void DisplayKeysActiveNote( ); - - public: - - void HandleResourceChange( TInt aType ); - - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); - - public: - - /** - * Handle Central Repository observer callback. - */ - void HandleCenRepNotify( TUid aCenRepUid, TUint32 aKeyId, TInt aValue ); - - /** - * Handle Publish & Subscribe observer callback. - */ - void HandlePubSubNotify( TUid aPubSubUid, TUint aKeyId, TInt aValue ); - - private: - - TInt CountComponentControls( ) const; - - CCoeControl* ComponentControl( TInt aIndex ) const; - - private: - - /** - * UI commands to parent using method ProcessCommandL. - * - * @param aCommandId Command to be handled - */ - void ProcessCommandL( TInt aCommandId ); - - private: - - void DisplayConfirmationNote( ); - - // Is allowed to auto lock keys - TBool AutoActivationAllowedL( ); - - // Get auto keyguard timeout - TInt GetAutoKeyguardTimeout( ); - - // Starts monitoring user activity - void StartActivityMonitoringL( ); - - // Gets new autolock period and starts monitoring user activity - void ResetInactivityTimeout( ); - - // Stop monitoring user activity. - void StopActivityMonitoring( ); - - // Handles Active event. Called by ActivityManager - static TInt HandleActiveEventL( TAny* aPtr ); - - // Handles Inactive event. Called by ActivityManager - static TInt HandleInactiveEventL( TAny* aPtr ); - - private: - - /** - * "Now press *" confirmation note. - */ - CLockAppLockedNote* iConfirmationNote; - - /** - * "Keys are locked. Press Unlock" note. - */ - CLockAppLockedNote* iLockedNote; - - /** - * "Keys locked" note - */ - CLockAppLockedNote* iKeypadLockedNote; - - /** - * "Keys activated" note - */ - CLockAppLockedNote* iKeypadUnlockedNote; - - /** - * CenRep observers - */ - CLockAppCenRepObserver* iCRAutoKeyguardTime; - CLockAppCenRepObserver* iCRPersistentKeyguardStatus; - - /** - * PubSub observers - */ - CLockAppPubSubObserver* iPSStartupObserver; - - /** - * User activity manager - */ - CUserActivityManager* iActivityManager; - - /** - * Hardware support for keyguard - */ - TLockHardware iHardwareSupport; - - /** - * Flags if we had already normal state - */ - TBool iAlreadyNormalState; - - }; - -#endif // __LOCKAPPKEYGUARDCONTROL_H__ - -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockappkeypattern.h --- a/securitydialogs/lockapp/inc/lockappkeypattern.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,183 +0,0 @@ -/* -* Copyright (c) 2007 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: Key pattern matching component. - * -*/ - - -#ifndef __LOCKAPPKEYPATTERN__ -#define __LOCKAPPKEYPATTERN__ - -// INCLUDES -#include -#include - -enum TPatternState - { - EPatternNotInitialized = 1, - EPatternNotEnabled, - EPatternNoMatch, - EPatternPrimaryMatch, - EPatternSecondaryMatch, - }; - -/** - * CLockAppKeyPattern class implements a 2-key pattern matcher. - * Can be used for both iCodes and iScancodes, as it matches integer numbers. - * The caller's responsability is to make sense what is beeing matched. - * Multiple patterns can be defined. - * - * @lib lockapp - * @since 5.0 - * @author Tamas Koteles - */ -class CLockAppKeyPattern : public CBase - { - public: - - /** - * Two phased constructor. - */ - static CLockAppKeyPattern* NewL( ); - - /** - * Destructor. - */ - ~CLockAppKeyPattern( ); - - /** - * If no patterns have been defined it cannot be used. - * @return ETrue if has succesfully loaded policy - */ - TBool HasPatterns( ); - - /** - * Gets the enabled state. - * - * @return true if the patterns are enabled, false othewise - */ - TBool IsEnabled( ); - - /** - * Sets the enabled state. - */ - void SetEnabled( TBool aEnabled ); - - /** - * Gets the primary key timeout. - * - * @return the timeout in miliseconds - */ - TUint GetKeyTimeOut( ); - - /** - * Sets the primary key timeout. - * - */ - void SetKeyTimeOut( TUint aTimeOut ); - - /** - * Adds a key combination. - * - * @param aPrimaryKey code for primary key - * @param aSecondaryKey code for secondary key - * @return standard Symbian error code - */ - TInt AddPattern( TUint32 aPrimaryKey, TUint32 aSecondaryKey ); - - /** - * Gets a key combination. - * - * @param aIndex index of the key combination - * @param aPrimaryKey primary key code if found - * @param aSecondaryKey secondary key code if found - * @return standard Symbian error code - */ - TInt GetPattern( TInt aIndex, TUint32& aPrimaryKey, TUint32& aSecondaryKey ); - - /** - * Clears all the defined key combinations. - * - * @return standard Symbian error code - */ - TInt ClearPatterns( ); - - /** - * Handles Key events. Result of the event is returned in the pattern state. - * - * @param aKey the actual key event (code or scancode) - * @return TPatternState caused by the event. - */ - TPatternState HandleKeyEvent( TUint32 aKey ); - - protected: - - /** - * C++ default constructor (private so cannot be derived). - */ - CLockAppKeyPattern( ); - - /** - * Second constructor initializes the policy - */ - void ConstructL( ); - - private: - - /** - * A primary key has been received, set primary-match state. - */ - void HandlePrimaryKeyEvent( TUint32 aKey ); - - /** - * A secondary key has been received, set secondary-match state. - */ - void HandleSecondaryKeyEvent( ); - - /** - * Any other key has been received, set no-match state. - */ - void HandleOtherKeyEvent( ); - - /** - * A call back to the keylock timer - * param TAny aSelf a pointer to the parent class - */ - static TInt HandleKeyTimerTimeout( TAny* aSelf ); - - private: - - // defined configurations - RArray iPrimaryKeys; - RArray iSecondaryKeys; - RArray iWaitingKeys; - - // defined timeout - TUint iKeyTimeOut; - - // first key pressed - TPatternState iState; - - // if the keypatterns are enabled - TBool iEnabled; - - // if the keylock policy exists - TBool iHasPatterns; - - // timer used between primary and secondary keys - CPeriodic* iKeyTimer; - - }; - -#endif // __LOCKAPPKEYPATTERN__ diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockapplockednote.h --- a/securitydialogs/lockapp/inc/lockapplockednote.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2007 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: Sleeping note with timeout and a reference flag that informs - * the parent when the note is visible - * -*/ - - -#include "lockappsleepingnote.h" - -#ifndef __LOCKAPPLOCKEDNOTE_H__ -#define __LOCKAPPLOCKEDNOTE_H__ - -const TInt KNoteCmdFocusLost = 3100; - -/** - * CLockAppLockedNote class is used as the basic dismissable note in Lockapp. - * - * @lib lockapp - * @since 5.0 - * @author Joona Petrell - * @author Tamas Koteles - */ -class CLockAppLockedNote : public CLockAppSleepingNote - { - public: - - /** - * C++ default constructor. - * - * @param aCommandObserver pointer to parent implementing observer interface - */ - CLockAppLockedNote( MEikCommandObserver* aCommandObserver = NULL ); - - /** - * Destructor. - */ - ~CLockAppLockedNote( ); - - /** - * Locked note can be canceled. - */ - void CancelNote( ); - - /** - * From @c CCoeControl. Used to inform parent that - * dialog is no longer in focus. - */ - void FocusChanged( TDrawNow aDrawNow ); - - }; - -#endif // __LOCKAPPLOCKEDNOTE_H__ diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockappobserverinterface.h --- a/securitydialogs/lockapp/inc/lockappobserverinterface.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -* Copyright (c) 2007 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: Interface for CenRep and PubSub observers - * -*/ - - -#ifndef __LOCKAPPOBSERVERINTERFACE_H__ -#define __LOCKAPPOBSERVERINTERFACE_H__ - -// INCLUDES -#include "lockapp.hrh" - -/** - * MLockAppObserverInterface class offers a CenRep/PubSub observer interface. - * Observer classes should implement this interface to get callback notifications - * on value changes. - * - * @lib lockapp - * @since 5.0 - * @author Tamas Koteles - */ -class MLockAppObserverInterface - { - public: - - /** - * Handle Central Repository observer callback. - * - * @param aCenRepUid Central Repository category id - * @param aKeyId Central Repository key id - * @param aValue Central Repository key's new value - */ - virtual void HandleCenRepNotify( TUid aCenRepUid, TUint32 aKeyId, TInt aValue ) = 0; - - /** - * Handle Publish & Subscribe observer callback. - * - * @param aPubSubUid Publish & Subscribe category id - * @param aKeyId Publish & Subscribe key id - * @param aValue Publish & Subscribe key's new value - */ - virtual void HandlePubSubNotify( TUid aPubSubUid, TUint aKeyId, TInt aValue ) = 0; - - }; - -#endif // __LOCKAPPOBSERVERINTERFACE_H__ -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockappobserverlist.h --- a/securitydialogs/lockapp/inc/lockappobserverlist.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -/* -* Copyright (c) 2007 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: Controls observers and publishes state changes - * -*/ - - -#ifndef __LOCKAPPOBSERVERLIST_H__ -#define __LOCKAPPOBSERVERLIST_H__ - -// INCLUDES -#include -#include "lockapp.hrh" - -// FORWARD DECLARATIONS -class MLockAppStateObserver; - -/** - * CLockAppObserverList class publishes lock state changes to all implemented state - * observers. The list owns all childs and it is responsible for deleting them. - * - * @lib lockapp - * @since 5.0 - * @author Joona Petrell - * @author Tamas Koteles - */ -class CLockAppObserverList : public CCoeControl - { - public: - - /** - * C++ default constructor. - */ - CLockAppObserverList( ); - - /** - * Destructor. - */ - virtual ~CLockAppObserverList( ); - - public: - - /** - * Add new state observer. - * @param aObserver lock state observer - */ - void AddObserverL( MLockAppStateObserver* aObserver ); - - /** - * Remove lock state observer. - * @param aObserver lock state observer - */ - void RemoveObserver( MLockAppStateObserver* aObserver ); - - protected: - - /** - * Has to be called by the derived class in the construction. - */ - void BaseConstructL( ); - - /** - * Informs all observers about the status change. - * - * @param aStatusChange the new lock state. - */ - void PostStatusChangeL( TLockStatus aStatusChange ); - - /** - * Class that derives from observer list will have first - * notification about the lock status chane. - * - * @param aLockStatus the new lock state. - */ - virtual void HandleLockStatusChangedL( TLockStatus aLockStatus ); - - private: - - /** - * Dynamic list storing observers. Both the list and observers are owned. - * Own. - */ - RPointerArray* iObserverList; - - }; - -#endif // __LOCKAPPOBSERVERLIST_H__ -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockapppubsubobserver.h --- a/securitydialogs/lockapp/inc/lockapppubsubobserver.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -/* -* Copyright (c) 2007 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: Publish & Subscribe key observer - * -*/ - - -#ifndef __LOCKAPPPUBSUBOBSERVER_H__ -#define __LOCKAPPPUBSUBOBSERVER_H__ - -// INCLUDES -#include -#include -#include -#include "lockappobserverinterface.h" - -/** - * CLockAppPubSubObserver class implements a Publish & Subscribe key observer. - * It can be used to monitor and also to set a PubSub key. - * - * @lib lockapp - * @since 5.0 - * @author Tamas Koteles - */ -class CLockAppPubSubObserver : public CActive - { - public: - - /** - * Two-phased constructor. - * - * @param aObserver pointer to observer - * @param aPubSubUid publish & subscribe Uid - * @param aKeyId publish & subscribe key id - * @return the instance just created. - */ - static CLockAppPubSubObserver* NewL( MLockAppObserverInterface* aObserver, TUid aPubSubUid, - TUint32 aKeyId ); - - /** - * Destructor. - */ - ~CLockAppPubSubObserver( ); - - /** - * Start obsering PubSub key - */ - TInt Start( ); - - /** - * Stop observing PubSub key - */ - void Stop( ); - - /** - * Get key value from P&S. - */ - TInt GetKeyValue( TInt& aValue ); - - /** - * Set key value to P&S. - */ - TInt SetKeyValue( TInt aValue ); - - protected: - - /** - * C++ default constructor. - * - * @param aObserver observer - * @param aPubSubUid publish & subscribe Uid - * @param aKeyId key id - */ - CLockAppPubSubObserver( MLockAppObserverInterface* aObserver, TUid aPubSubUid, - TUint32 aKeyId ); - - /** - * Symbian OS constructor. - */ - void ConstructL( ); - - private: - - void RunL( ); - - void DoCancel( ); - - protected: - - /** - * Observer's callback interface. Not owned. - */ - MLockAppObserverInterface* iObserver; - - /** - * Access to Publish & Subscribe. - */ - RProperty iProperty; - - /** - * Publish & Subscribe Uid. - */ - TUid iPubSubUid; - - /** - * Publish & Subscribe key Id. - */ - TUint32 iKeyId; - - /** - * Publish & Subscribe key's value. - */ - TInt iValue; - - }; - -#endif // __LOCKAPPPUBSUBOBSERVER_H__ -// END OF FILE diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockappserver.h --- a/securitydialogs/lockapp/inc/lockappserver.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* -* Copyright (c) 2007 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: Server implementation that responses to client API in - * lockclient - * -*/ - - -#ifndef __LOCKAPPSERVER_H__ -#define __LOCKAPPSERVER_H__ - -// INCLUDES -#include - -/** - * CLockAppServer class implements the application server of LockApp. - * The server is created with a fixed server name and offers only one service. - * - * @lib lockapp - * @since 5.0 - * @author Joona Petrell - * @author Tamas Koteles - */ -class CLockAppServer : public CApaAppServer - { - public: - - /** - * Two-phased constructor. - */ - static CLockAppServer* NewL( const TDesC& aFixedServerName ); - - /** - * Offers support for multiple services, but only one is supported/used by LockApp Server. - * - * @param aServiceType uid used to identify different services. - */ - CApaAppServiceBase* CreateServiceL( TUid aServiceType ) const; - - private: - - /** - * C++ default constructor. - */ - CLockAppServer( ); - - /** - * Establishes a new session between client and server. - * - * @param aVersion for support of new server client-server API variations (not used). - * @param aMessage message that started the session. - */ - CSession2* NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) const; - - private: - - // how many sessions are created to the server - TInt iSessionCount; - - }; - -#endif //__LOCKAPPSERVER_H__ diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockappsession.h --- a/securitydialogs/lockapp/inc/lockappsession.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -/* -* Copyright (c) 2007 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: LockApp server session requested by lockclient - * -*/ - - -#ifndef __LOCKAPPSESSION_H__ -#define __LOCKAPPSESSION_H__ - -// INCLUDES -#include -#include "lockapp.hrh" - -// FORWARD DECLARATIONS -class MLockAppStateControl; - -/** - * CLockAppSession class is the server side implementation of the Lockapp API. - * The session class offers keyguard and devicelock API for clients wanting to - * alter phone lock states. - * - * @lib lockapp - * @since 5.0 - * @author Joona Petrell - * @author Tamas Koteles - */ -class CLockAppSession : public CApaAppServiceBase - { - public: - - /** - * C++ default constructor. - */ - CLockAppSession( ); - - private: - /** - * Destructor. - */ - ~CLockAppSession( ); - - /** - * From @c CApaAppServiceBase. Handles possible error in - * service. Method is empty. - * @param aMessage received message - * @param aError an error id - */ - void ServiceError( const RMessage2& aMessage, TInt aError ); - - /** - * From @c CApaAppServiceBase. Receives messages. - * @param aMessage received message - */ - void ServiceL( const RMessage2& aMessage ); - - private: - - /** - * Ask state control to activate keyguard lock. - * - * @param aWithNote if "keys locked" note is shown - * @return error code - */ - TInt DoEnableKeyguardL( TBool aWithNote ); - - /** - * Ask state control to deacctivate keyguard lock. - * - * @param aWithNote if "keys active" note is shown. - * @return error code - */ - TInt DoDisableKeyguardL( TBool aWithNote ); - - /** - * Ask state control to activate devicelock. - * @return error code - */ - TInt DoEnableDevicelockL( TDevicelockReason aReason ); - - /** - * Ask state control to deactivate devicelock. - * @return error code - */ - TInt DoDisableDevicelockL( ); - - /** - * Ask state control to offer to enable keyguard. - * by showing "offerkeylock" note. - * @return error code - */ - TInt DoOfferKeyguardL( ); - - /** - * Ask state control to inform user that keys are locked. - * @return error code - */ - TInt DoShowKeysLockedNoteL( ); - - private: - - /** - * Access to lock state control - * @return the main state control, from which lock states are changed - */ - MLockAppStateControl* StateControlL( ); - - /** - * The main state control - * Not owned. - */ - MLockAppStateControl* iStateControl; - }; - -#endif //__LOCKAPPSESSION_H__ diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockappsleepingnote.h --- a/securitydialogs/lockapp/inc/lockappsleepingnote.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* -* Copyright (c) 2007 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: Sleeping note with timeout - * -*/ - - -#include - -#ifndef __LOCKAPPSLEEPINGNOTE_H__ -#define __LOCKAPPSLEEPINGNOTE_H__ - -/** - * CLockAppSleepingNote class implement notes that are not destroyed between use. - * Note is shown with timeout and internal changes are reported to parent - * trough command observer interface. - * - * @lib lockapp - * @since 5.0 - * @author Joona Petrell - * @author Tamas Koteles - */ -class CLockAppSleepingNote : public CAknNoteDialog - { - public: - - /** - * C++ default constructor. - * - * @param aCommandObserver pointer to parent - * implementing observer interface - */ - CLockAppSleepingNote( MEikCommandObserver* aCommandObserver = NULL ); - - /** - * Sleeping note is constructed from a resource - */ - void ConstructSleepingNoteL( TInt aResourceId ); - - /** - * Destructor. - */ - ~CLockAppSleepingNote( ); - - /** - * Show sleeping note with given timeout. - * @param aTimeout how long note will be displayed. - * @param aTone tone to be played. - */ - TInt ShowNote( const TInt aTimeout, const TTone aTone ); - - /** - * Always called when note is dismissed - * - * @param aCommand reason for exit. - */ - TBool OkToExitL( TInt aCommand ); - - /** - * Handles key events (from CoeControl) - */ - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); - - protected: - - void HandleResourceChange( TInt aType ); - - // pointer to keyguard UI - MEikCommandObserver* iCommandObserver; - - // resource id is reserved for animation skin change - TInt iResourceId; - - }; - -#endif // __LOCKAPPSLEEPINGNOTE_H__ diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockappstatecontrol.h --- a/securitydialogs/lockapp/inc/lockappstatecontrol.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,322 +0,0 @@ -/* -* Copyright (c) 2007 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: Controls lock states (keyguard locked/unlocked, devicelock) - * -*/ - - -#ifndef __LOCKAPPSTATECONTROL_H__ -#define __LOCKAPPSTATECONTROL_H__ - -// INCLUDES -#include "lockappobserverlist.h" -#include "lockappstatecontrolinterface.h" -#include "lockappobserverinterface.h" -#include - -// FORWARD DECLARATIONS -class CLockAppBaseControl; -class CLockAppIdleControl; -class CLockAppKeyguardControl; -class CLockAppDevicelockControl; -class CLockAppEcsDetector; -class CLockAppPubSubObserver; -class CAknIncallBubble; - -/** - * CLockAppStateControl class is the main locking state control class. - * Class is derived from CLockAppObserverList observer list class. - * Does not own visible user interface, but directs window server events like - * key events to window-owning child controls (keyguard ui, emergency support). - * All lock state changes should be handled through this class. - * - * @lib lockapp - * @since 5.0 - * @author Joona Petrell - * @author Tamas Koteles - */ -class CLockAppStateControl : public CLockAppObserverList, public MLockAppStateControl, - public MLockAppObserverInterface - { - public: - - /** - * Two-phased constructor. - */ - static CLockAppStateControl* NewL( ); - - /** - * Destructor. - */ - ~CLockAppStateControl( ); - - private: - - /** - * C++ default constructor. - */ - CLockAppStateControl( ); - - /** - * Second phase constructor allowed to fail (leave). - */ - void ConstructL( ); - - public: - - /** - * Activate keyguard lock. - * - * @param aWithNote if "keys locked" note is shown - * @return KErrAlreadyExists if already enabled - * KErrPermissionDenied if devicelock is activated - * KErrNone if succeeded - */ - TInt EnableKeyguardL( TBool aWithNote ); - - /** - * Dectivate keyguard lock. - * - * @param aWithNote if "keys active" note is shown. - * @return KErrAlreadyExists if already disabled - * KErrPermissionDenied if devicelock is activated - * KErrNone if succeeded - */ - TInt DisableKeyguardL( TBool aWithNote ); - - /** - * Activate devicelock. - * - * @param aReason the device locking reason. - * @return KErrAlreadyExists if already enabled. - * KErrNone if succeeded - */ - TInt EnableDevicelockL( TDevicelockReason aReason = EDevicelockManual ); - - /** - * Dectivate devicelock. - * - * @return KErrAlreadyExists if already disabled - * KErrPermissionDenied if keyguard is activated - * KErrNone if succeeded - */ - TInt DisableDevicelockL( ); - - /** - * Offer to enable keyguard by showing "offerkeylock" note. - * @return KErrPermissionDenied if keyguard/devicelock already activated - * KErrNone if succeeded - */ - TInt OfferKeyguard( ); - - /** - * Offer to enable keyguard by showing "offerkeylock" note. - * - * @return KErrNone if succeeded - * KErrPermissionDenied if keyguard not enabled - */ - TInt ShowKeysLockedNote( ); - - /** - * External access to lock state - * - * @return Current lock state - */ - TLockStatus LockStatus( ) const; - - /** - * External access to lock environment - * - * @return Current environment state mask - */ - TUint EnvironmentStatus( ) const; - - /** - * Only used for internal testing. - * @return error code - */ - TInt ExecuteInternalTest( ); - - public: - // From MLockAppObserverInterface - - /** - * Handle Central Repository observer callback. - */ - void HandleCenRepNotify( TUid aCenRepUid, TUint32 aKeyId, TInt aValue ); - - /** - * Handle Publish & Subscribe observer callback. - */ - void HandlePubSubNotify( TUid aPubSubUid, TUint aKeyId, TInt aValue ); - - public: - // from CCoeControl - - TInt CountComponentControls( ) const; - - CCoeControl* ComponentControl( TInt aIndex ) const; - - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); - - void HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination ); - - void HandleResourceChange( TInt aType ); - - private: - - /** - * Creates the second "visibility gate" window group. - */ - void CreateVisibilityGateWgL( ); - - /** - * Logs the telephony P&S call state. - */ - void PrintCallState( TInt aValue ); - - /** - * Update the environment variable with the event. - * @return ETrue if the environment value has changed - * EFalse otherwise - */ - TBool HandleEnvironmentChange( TUint aEventMask, TBool aEnable ); - - /** - * Check if given transition is valid. - * @return KErrNone if transition is legal - * KErrAlreadyExists if LockApp already is in requested state - * KErrPermissionDenied if illegal transition - */ - TInt CheckIfLegal( TLockAppMessageReason aReason ); - - /** - * Handle lock state change. Should only called from - * method PostStatusChangeL. - * - * @param aLockStatus The new lock state - */ - void HandleLockStatusChangedL( TLockStatus aLockStatus ); - - void BringForward( TBool aForeground ); - - /** - * Mute/Unmute key sounds when phone is locked/unlocked. - * - * @param aMuteSounds mute switch - */ - void MuteSounds( TBool aMuteSounds ); - - /** - * Prescreen key events for special cases before giving them to child controls. - */ - TKeyResponse PreCheckKeyEvents( const TKeyEvent& aKeyEvent, TEventCode aType ); - - /** - * Power key needs to always activate lights. - */ - void CheckForPowerKeyLights( const TKeyEvent& aKeyEvent, TEventCode aType ); - - /** - * Green and Red keys should be passed to Phone during phone call. - * @return ETrue if the keys have been forwarded - * EFalse otherwise - */ - TBool CheckForPhoneKeys( const TKeyEvent& aKeyEvent, TEventCode aType ); - - private: - - /** - * Internal lock state. - */ - TLockStatus iLockStatus; - - /** - * Current control; - */ - CLockAppBaseControl* iCurrentControl; - - /** - * Idle UI. - * Owned by superclass. - */ - CLockAppIdleControl* iIdle; // owned by superclass - - /** - * Keyguard UI. - * Owned by superclass. - */ - CLockAppKeyguardControl* iKeyguard; // owned by superclass - - /** - * Autolock UI - * Owned by superclass. - */ - CLockAppDevicelockControl* iDevicelock; - - /** - * Emergency call detector with emergency note. - * Owned by superclass. - */ - CLockAppEcsDetector* iLockEcsDetector; - - /** - * PubSub observers - */ - CLockAppPubSubObserver* iPSScreenSaverObserver; - CLockAppPubSubObserver* iPSTelephonyObserver; - CLockAppPubSubObserver* iPSGripObserver; - CLockAppPubSubObserver* iPSFPSObserver; - - /** - * Application's main window group - Event gate - */ - RWindowGroup& iWGEventGate; - - /** - * Visibility gate (owned) - */ - RWindowGroup iWGVisibilityGate; - - /** - * Incall Bubble. (owned) - */ - CAknIncallBubble* iIncallBubble; - - private: - - /** - * feature manager keys - */ - TBool iFeatureNoPowerkey; - - /** - * Offset value used to free reserved localization resources - */ - TInt iResourceFileOffset; - - /** - * if sounds are muted - */ - TBool iSoundsMuted; - - /** - * Environment state descriptor bit-mask - */ - TUint iEnvState; - - }; - -#endif // __LOCKAPPSTATECONTROL_H__ -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockappstatecontrolinterface.h --- a/securitydialogs/lockapp/inc/lockappstatecontrolinterface.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* -* Copyright (c) 2007 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: Interface for controls that want to modify lock status - * -*/ - - -#ifndef __LOCKAPPSTATECONTROLINTERFACE_H__ -#define __LOCKAPPSTATECONTROLINTERFACE_H__ - -// INCLUDES -#include "lockapp.hrh" - -/** - * MLockAppStateControl class offers safe interface methods for lockapp controls. - * All internal child controls should use this interface for modifying - * the phone lock state. - * - * @lib lockapp - * @since 5.0 - * @author Joona Petrell - * @author Tamas Koteles - */ -class MLockAppStateControl - { - public: - - /** - * Activate keyguard lock. - * - * @param aWithNote if "keys locked" note is shown - * @return KErrAlreadyExists if already enabled - * KErrPermissionDenied if devicelock is activated - * KErrNone if succeeded - */ - virtual TInt EnableKeyguardL( TBool aWithNote ) = 0; - - /** - * Dectivate keyguard lock. - * - * @param aWithNote if "keys active" note is shown. - * @return KErrAlreadyExists if already disabled - * KErrPermissionDenied if devicelock is activated - * KErrNone if succeeded - */ - virtual TInt DisableKeyguardL( TBool aWithNote ) = 0; - - /** - * Activate devicelock. - * - * @param aReason the device locking reason. - * @return KErrAlreadyExists if already enabled. - * KErrNone if succeeded - */ - virtual TInt EnableDevicelockL( TDevicelockReason aReason = EDevicelockManual ) = 0; - - /** - * Dectivate devicelock. - * - * @return KErrAlreadyExists if already disabled - * KErrPermissionDenied if keyguard is activated - * KErrNone if succeeded - */ - virtual TInt DisableDevicelockL( ) = 0; - - /** - * Offer to enable keyguard by showing "offerkeylock" note. - * - * @return KErrPermissionDenied if keyguard/devicelock already activated - * KErrNone if succeeded - */ - virtual TInt OfferKeyguard( ) = 0; - - /** - * Offer to enable keyguard by showing "offerkeylock" note. - * - * @return KErrNone if succeeded - * KErrPermissionDenied if keyguard is not enabled - */ - virtual TInt ShowKeysLockedNote( ) = 0; - - /** - * External access to lock state - * - * @return Current lock state - */ - virtual TLockStatus LockStatus( ) const = 0; - - /** - * External access to lock environment - * - * @return Current environment state - */ - virtual TUint EnvironmentStatus( ) const = 0; - - /** - * Used for internal testing only, disabled normally - * - * @return error code - */ - virtual TInt ExecuteInternalTest( ) = 0; - - }; - -#endif // __LOCKAPPSTATECONTROLINTERFACE_H__ -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockappstateobserver.h --- a/securitydialogs/lockapp/inc/lockappstateobserver.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2007 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: Interface for controls that want to be informed about lock status - * -*/ - - -#ifndef __LOCKAPPSTATEOBSERVER_H__ -#define __LOCKAPPSTATEOBSERVER_H__ - -// INCLUDES -#include -#include -#include "lockapp.hrh" - -/** - * CLockAppStateObserver class offers a lockstate observer interface. - * All observer classes derived from MLockAppStateObserver should be added to - * the lockapp observer list in order to get notifications about lock state changes. - * - * @lib lockapp - * @since 5.0 - * @author Joona Petrell - * @author Tamas Koteles - */ -class MLockAppStateObserver - { - public: - - /** - * Lock status changes are handled trough HandleLockStatusChangedL method. - * Must be overriden by derived class for observing. - */ - virtual void HandleLockStatusChangedL( TLockStatus aLockStatus ) = 0; - - }; - -#endif // __LOCKAPPSTATEOBSERVER_H__ -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockappstatepublisher.h --- a/securitydialogs/lockapp/inc/lockappstatepublisher.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* -* Copyright (c) 2007 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: Publishes LockApp states to other applications - * -*/ - - -#ifndef __LOCKAPPSTATEPUBLISHER_H__ -#define __LOCKAPPSTATEPUBLISHER_H__ - -// INCLUDES -#include "lockappstateobserver.h" -#include - -/** - * CLockAppStatePublisher class publishes lock state to external parties using P&S key. - * - * @lib lockapp - * @since 5.0 - * @author Joona Petrell - * @author Tamas Koteles - **/ -class CLockAppStatePublisher : public CBase, public MLockAppStateObserver - { - public: - /** - * Two-phased constructor. - */ - static CLockAppStatePublisher* NewL( ); - - /** - * C++ default constructor. - */ - CLockAppStatePublisher( ); - - /** - * Destructor. - */ - ~CLockAppStatePublisher( ); - private: - - /** - * Second constructor that can fail (leave). - */ - void ConstructL( ); - - public: - // from CLockAppStateObserver - - virtual void HandleLockStatusChangedL( TLockStatus aLockStatus ); - - private: - - // stores locking state property - RProperty iStatusProperty; - - }; - -#endif // __LOCKAPPSTATEPUBLISHER_H__ -// End of File - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockapptrace.h --- a/securitydialogs/lockapp/inc/lockapptrace.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,392 +0,0 @@ -/* -* Copyright (c) 2007 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: Trace macro support for lockapp - * -*/ - - -#ifndef LOCKAPPTRACE_H -#define LOCKAPPTRACE_H - -#include "lockapptraceconfiguration.hrh" - -#ifdef TRACE_INTO_FILE -#include // RFileLogger -#else -#include // RDebug -#endif - -//----------------------------------------------------------------------------- -// Constants -//----------------------------------------------------------------------------- -// - -/** -* Prefix trace macro to complete tracing with component name. -* Returns TDesC which can be used directly with RDebug or RFileLogger. -*/ -#define _PREFIX_TRACE( aMsg ) TPtrC( (const TText*)L"[LockApp]: " L##aMsg ) - -/** -* Prefix error trace -*/ -#define _PREFIX_ERROR( aMsg ) _PREFIX_TRACE( "[ERROR: %d]: " L##aMsg ) - -/** -* Prefix info trace. -*/ -#define _PREFIX_INFO( aMsg ) _PREFIX_TRACE( "[INFO]: " L##aMsg ) - -/** -* Prefix macro for strings -*/ -#define _PREFIX_CHAR( aMsg ) (const char*)"[LockApp]: " ##aMsg - -/** -* Define needed directories if TRACE_INTO_FILE macro in use -*/ -#ifdef TRACE_INTO_FILE - - _LIT( KDir, "lockapp" ); - _LIT( KFile, "lockapp_log.txt" ); - _LIT( KFullPath, "c:\\logs\\lockapp\\" ); - -#endif - -//----------------------------------------------------------------------------- -// Error trace macros -//----------------------------------------------------------------------------- -// -#ifdef ERROR_TRACE - - /** - * Error trace definitions. - */ - #ifdef TRACE_INTO_FILE - - #define ERROR( aErr, aMsg )\ - {\ - if( aErr < KErrNone )\ - {\ - RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_ERROR( aMsg ), aErr );\ - }\ - } - #define ERROR_1( aErr, aMsg, aP1 )\ - {\ - if( aErr < KErrNone )\ - {\ - RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_ERROR( aMsg ), aErr, aP1 );\ - }\ - } - #define ERROR_2( aErr, aMsg, aP1, aP2 )\ - {\ - if( aErr < KErrNone )\ - {\ - RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_ERROR( aMsg ), aErr, aP1, aP2 );\ - }\ - } - #define ERROR_3( aErr, aMsg, aP1, aP2, aP3 )\ - {\ - if( aErr < KErrNone )\ - {\ - RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_ERROR( aMsg ), aErr, aP1, aP2, aP3 );\ - }\ - } - - #else//TRACE_INTO_FILE not defined - - #define ERROR( aErr, aMsg )\ - {\ - if( aErr < KErrNone )\ - {\ - RDebug::Print( _PREFIX_ERROR( aMsg ), aErr );\ - }\ - } - #define ERROR_1( aErr, aMsg, aP1 )\ - {\ - if( aErr < KErrNone )\ - {\ - RDebug::Print( _PREFIX_ERROR( aMsg ), aErr, aP1 );\ - }\ - } - #define ERROR_2( aErr, aMsg, aP1, aP2 )\ - {\ - if( aErr < KErrNone )\ - {\ - RDebug::Print( _PREFIX_ERROR( aMsg ), aErr, aP1, aP2 );\ - }\ - } - #define ERROR_3( aErr, aMsg, aP1, aP2, aP3 )\ - {\ - if( aErr < KErrNone )\ - {\ - RDebug::Print( _PREFIX_ERROR( aMsg ), aErr, aP1, aP2, aP3 );\ - }\ - } - - #endif//TRACE_INTO_FILE - - #define ERROR_GEN( aMsg ) ERROR( KErrGeneral, aMsg ) - #define ERROR_GEN_1( aMsg, aP1 ) ERROR_1( KErrGeneral, aMsg, aP1 ) - #define ERROR_GEN_2( aMsg, aP1, aP2 ) ERROR_2( KErrGeneral, aMsg, aP1, aP2 ) - #define ERROR_GEN_3( aMsg, aP1, aP2, aP3 ) ERROR_3( KErrGeneral, aMsg, aP1, aP3 ) - -#else//ERROR_TRACE not defined - - #define ERROR( aErr, aMsg ) - #define ERROR_1( aErr, aMsg, aP1 ) - #define ERROR_2( aErr, aMsg, aP1, aP2 ) - #define ERROR_3( aErr, aMsg, aP1, aP2, aP3 ) - #define ERROR_GEN( aMsg ) - #define ERROR_GEN_1( aMsg, aP1 ) - #define ERROR_GEN_2( aMsg, aP1, aP2 ) - #define ERROR_GEN_3( aMsg, aP1, aP2, aP3 ) - -#endif//ERROR_TRACE - -//----------------------------------------------------------------------------- -// Info trace macros -//----------------------------------------------------------------------------- -// -#ifdef INFO_TRACE - - /** - * Info log message definitions. - */ - #ifdef TRACE_INTO_FILE - - #define INFO( aMsg )\ - {\ - RDebug::Print( _PREFIX_INFO( aMsg ) );\ - RFileLogger::Write( KDir, KFile, EFileLoggingModeAppend, _PREFIX_INFO( aMsg ) );\ - } - #define INFO_1( aMsg, aP1 )\ - {\ - RDebug::Print( _PREFIX_INFO( aMsg ), aP1 );\ - RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_INFO( aMsg ), aP1 );\ - } - #define INFO_2( aMsg, aP1, aP2 )\ - {\ - RDebug::Print( _PREFIX_INFO( aMsg ), aP1, aP2 );\ - RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_INFO( aMsg ), aP1, aP2 );\ - } - #define INFO_3( aMsg, aP1, aP2, aP3 )\ - {\ - RDebug::Print( _PREFIX_INFO( aMsg ), aP1, aP2, aP3 );\ - RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_INFO( aMsg ), aP1, aP2, aP3 );\ - } - #define INFO_4( aMsg, aP1, aP2, aP3, aP4 )\ - {\ - RDebug::Print( _PREFIX_INFO( aMsg ), aP1, aP2, aP3, aP4 );\ - RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_INFO( aMsg ), aP1, aP2, aP3, aP4 );\ - } - - #else//TRACE_INTO_FILE not defined - - #define INFO( aMsg )\ - {\ - RDebug::Print( _PREFIX_INFO( aMsg ) );\ - } - #define INFO_1( aMsg, aP1 )\ - {\ - RDebug::Print( _PREFIX_INFO( aMsg ), aP1 );\ - } - #define INFO_2( aMsg, aP1, aP2 )\ - {\ - RDebug::Print( _PREFIX_INFO( aMsg ), aP1, aP2 );\ - } - #define INFO_3( aMsg, aP1, aP2, aP3 )\ - {\ - RDebug::Print( _PREFIX_INFO( aMsg ), aP1, aP2, aP3 );\ - } - #define INFO_4( aMsg, aP1, aP2, aP3, aP4 )\ - {\ - RDebug::Print( _PREFIX_INFO( aMsg ), aP1, aP2, aP3, aP4 );\ - } - - #endif//TRACE_INTO_FILE - -#else//INFO_TRACE not defined - - #define INFO( aMsg ) - #define INFO_1( aMsg, aP1 ) - #define INFO_2( aMsg, aP1, aP2 ) - #define INFO_3( aMsg, aP1, aP2, aP3 ) - #define INFO_4( aMsg, aP1, aP2, aP3, aP4 ) - -#endif//INFO_TRACE - -//----------------------------------------------------------------------------- -// Trace current client thread name and process id -//----------------------------------------------------------------------------- -// -#ifdef CLIENT_TRACE - - #define CLIENT( aMessage )\ - {\ - RThread thread;\ - TInt err = aMessage.Client( thread );\ - if( err == KErrNone )\ - {\ - RProcess process;\ - err = thread.Process( process );\ - if( err == KErrNone )\ - {\ - TPtrC thredName( thread.Name() );\ - TUid processUid( process.SecureId() );\ - INFO_2( "Current client process UID: [%x], thread name: [%S]",\ - processUid,\ - &thredName );\ - }\ - process.Close();\ - }\ - thread.Close();\ - } - -#else - - #define CLIENT( aMessage ) - -#endif - -//----------------------------------------------------------------------------- -// Function trace macros -//----------------------------------------------------------------------------- -// -#ifdef FUNC_TRACE - - /** - * Function logging definitions. - */ - #ifdef TRACE_INTO_FILE - - #define FUNC( aMsg, aP1 )\ - {\ - TPtrC8 trace( _S8( aMsg ) );\ - RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, trace, aP1 );\ - }\ - - #else//TRACE_INTO_FILE not defined - - #define FUNC( aMsg, aP1 )\ - {\ - RDebug::Printf( aMsg, aP1 );\ - }\ - - #endif//TRACE_INTO_FILE - - /** - * Function trace helper class. - * - * NOTE: - * LC -methods cannot be trapped. Therefore if LC -method leaves - * END trace is used instead of LEAVE trace. - * If you have an idea how to round this problem please tell. - */ - _LIT8( KFuncNameTerminator, "(" ); - _LIT8( KFuncLeavePatternL, "L" ); - class TFuncLog - { - public: - static void Cleanup( TAny* aPtr ) - { - TFuncLog* self = static_cast< TFuncLog* >( aPtr ); - self->iLeft = ETrue; - FUNC( _PREFIX_CHAR("%S-LEAVE"), &self->iFunc ); // Leave detected - } - inline TFuncLog( const char* aFunc ) : - iFunc( aFunc ? _S8( aFunc ) : _S8("") ), - iLeft( EFalse ), - iCleanupItem( Cleanup, this ), - iCanLeave( EFalse ) - { - TInt pos( iFunc.Find( KFuncNameTerminator ) ); - if( pos != KErrNotFound ) - { - iFunc.Set( iFunc.Left( pos ) ); - iCanLeave = !iFunc.Right( KFuncLeavePatternL().Length() ).Compare( KFuncLeavePatternL ); - if ( iCanLeave ) - { - CleanupStack::PushL( iCleanupItem ); // Ignore warnings - } - } - FUNC( _PREFIX_CHAR("%S-START"), &iFunc ); - } - - inline ~TFuncLog() - { - if ( !iLeft ) - { - if ( iCanLeave ) - { - CleanupStack::Pop( this ); // Pop the cleanup item - } - FUNC( _PREFIX_CHAR("%S-END"), &iFunc ); // Normally finished - } - } - - private: // Data - TPtrC8 iFunc; - TBool iLeft; - TCleanupItem iCleanupItem; - TBool iCanLeave; - }; - #define FUNC_LOG TFuncLog _fl( __PRETTY_FUNCTION__ ); - -#else//FUNC_TRACE not defined - - #define FUNC_LOG - -#endif//FUNC_TRACE - -//----------------------------------------------------------------------------- -// Timestamp trace macros -//----------------------------------------------------------------------------- -// -#ifdef TIMESTAMP_TRACE - - #ifdef TRACE_INTO_FILE - - #define TIMESTAMP( aCaption )\ - {\ - TTime t;\ - t.HomeTime();\ - TDateTime dt = t.DateTime();\ - _LIT( KCaption, aCaption );\ - RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend,\ - _PREFIX_TRACE("[TIMESTAMP] %S %d:%02d:%02d.%d us"),\ - &KCaption, dt.Hour(), dt.Minute(), dt.Second(), dt.MicroSecond() );\ - } - - #else//TRACE_INTO_FILE not defined - - #define TIMESTAMP( aCaption )\ - {\ - TTime t;\ - t.HomeTime();\ - TDateTime dt = t.DateTime();\ - _LIT( KCaption, aCaption );\ - RDebug::Print( _PREFIX_TRACE("[TIMESTAMP] %S %d:%02d:%02d.%d us"),\ - &KCaption, dt.Hour(), dt.Minute(), dt.Second(), dt.MicroSecond() );\ - } - - #endif//TRACE_INTO_FILE - -#else//TIMESTAMP_TRACE not defined - - #define TIMESTAMP( aCaption ) - -#endif//TIMESTAMP_TRACE - -#endif diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockapptraceconfiguration.hrh --- a/securitydialogs/lockapp/inc/lockapptraceconfiguration.hrh Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* -* Copyright (c) 2007 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: Trace definitions for lockapp - * -*/ - - - -#ifndef LOCKAPPTRACECONFIGURATION_HRH -#define LOCKAPPTRACECONFIGURATION_HRH - -//----------------------------------------------------------------------------- -// Trace definitions -//----------------------------------------------------------------------------- - -/** -* Error trace enabled -*/ -#ifdef _DEBUG - #define ERROR_TRACE -#else - #undef ERROR_TRACE -#endif - -/** -* Info trace enabled -*/ -#ifdef _DEBUG - #define INFO_TRACE -#else - #undef INFO_TRACE -#endif - -/** -* Function trace enabled -*/ -#ifdef _DEBUG - #define FUNC_TRACE -#else - #undef FUNC_TRACE -#endif - -/** -* Timestamp tracing on -*/ -#ifdef _DEBUG - #define TIMESTAMP_TRACE -#else - #undef TIMESTAMP_TRACE -#endif - -/** -* Tracing current client process and thread -*/ -#ifdef _DEBUG - #define CLIENT_TRACE -#else - #undef CLIENT_TRACE -#endif - -/** -* Tracing into file enabled, default RDebug -*/ -//#undef TRACE_INTO_FILE -#define TRACE_INTO_FILE - -#endif \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockapputils.h --- a/securitydialogs/lockapp/inc/lockapputils.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* -* Copyright (c) 2007 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: Internally used panic functions and test macros - * -*/ - - -#ifndef __LOCKAPPUTILS_H__ -#define __LOCKAPPUTILS_H__ - -// INCLUDES -#include "lockapp.hrh" -#include "lockapptrace.h" -#include - -/** - * Queries bits in aStatusMask specified by the aQueryMask - */ -TBool IsBitFieldSet( TUint aStatusMask, TUint aQueryMask ); - -/** - * Sets bits in aResultMask specified by the aSetMask - */ -void SetBitField( TUint &aResultMask, TUint aSetMask, TBool aSet ); - -/** - * Panic the LockApp (should only be used in debug) - * - * @param aPanic Identifies the reason to Panic - */ -void DoPanic( TLockAppPanic aPanic ); - -/** - * Panic LockAppServer client for sending - * illegal message - * - * @param aMessage Event id - * @param aPanic Identifies the reason to Panic - */ -void PanicClient( const RMessagePtr2& aMessage, TLockAppPanic aPanic ); - -/** - * Sends application spesific events to Sysap. - * Used mainly for lights control. - * - * @param aMessage Event id - */ -void SendMessageToSysAp(TInt aMessage); - -/** - * Sends a key event to the windowgroup in background. - * Used mainly for sending red and green keys to phone app when - * devicelock or keyguard is in foreground. - * - * @param aKey key event - * @param aType key event type - */ -void SendKeyToPhoneApp(const TKeyEvent& aKey, TEventCode aType); - -#endif // __LOCKAPPTILS_H__ - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/inc/lockappwait.h --- a/securitydialogs/lockapp/inc/lockappwait.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,130 +0,0 @@ -/* -* Copyright (c) 2007 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: Async-Sync utility class - * -*/ - - -#ifndef __LOCKAPPWAIT_H -#define __LOCKAPPWAIT_H - -// INCLUDES - -#include -#include -#include - -// CLASS DEFINITIONS -class CWait : public CActive - { -public: - /** - * Creates instance of the CWait class. - * - * @return Returns the instance just created. - */ - static CWait* NewL( ); - - /** - * Destructor. - */ - ~CWait( ); - - /** - * Starts waiting for aReqStatus. - */ - TInt WaitForRequestL( ); - - /** - * Sets active request type. - */ - void SetRequestType(TInt aRequestType ); - - /** - * Gets active request type. - */ - TInt GetRequestType( ); - -private: - - /** - * C++ default constructor. - */ - CWait( ); - - /** - * Symbian OS constructor. - */ - void ConstructL( ); - -private: // from CActive - - /** @see CActive::RunL() */ - void RunL( ); - - /** @see CActive::DoCancel() */ - void DoCancel( ); - -private: // data - - RTimer iTimer; - - CActiveSchedulerWait iWait; - - // Used if there is a need to cancel an active request; - // namely in situations where destructor is called when Wait - // is active. - TInt iRequestType; - }; - -// ---------------------------------------------------------- -// CWaitAbsorbingControl -// absorbs all the key presses. -// ---------------------------------------------------------- -// -class CWaitAbsorbingControl : public CCoeControl - { -public: - - /** - * Creates instance of the CWaitAbsorbingControl class. - * - * @return Returns the instance just created. - */ - static CWaitAbsorbingControl* NewLC( ); - - /** - * Destructor. - */ - virtual ~CWaitAbsorbingControl( ); - -private: - - virtual TKeyResponse OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/); - -private: - - CWaitAbsorbingControl( ); - - void ConstructL( ); - -private: // data - - CEikAppUi* iAppUi; - - }; - -#endif - -// End of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/loc/lockapp.loc --- a/securitydialogs/lockapp/loc/lockapp.loc Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* Copyright (c) 2007 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: Localisation strings for LockApp - * -*/ - - -// LOCALISATION STRINGS - -//d:Title pane text in System Lock View.(Phone is in locked mode) -//l:title_pane_t2/opt9 -// -#define qtn_set_sec_title_locked "Locked" - -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/pubsub/SecurityUIsPrivatePSKeys.h --- a/securitydialogs/lockapp/pubsub/SecurityUIsPrivatePSKeys.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* -* Copyright (c) 2007 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: Private Publish&Subscribe definitions of the - * Security UIs subsystem - * -*/ - - -#ifndef SECURITYUISPRIVATEPSKEYS_H -#define SECURITYUISPRIVATEPSKEYS_H - -// INCLUDES - -//CONSTANTS - -const TUid KPSUidSecurityUIs = { 0x100059b5 }; -// ============================================================================= -// Security Code UI Originator API -// ============================================================================= - -// Use TUid KPSUidSecurityUIs = { 0x100059b5 } - -/** - * Used by SecUI to differentiate between ETel API originated and SecUI originated - * security queries. - * Old Shared Data constant name: KSecUIOriginatedQuery - */ -const TUint32 KSecurityUIsSecUIOriginatedQuery = 0x00000301; -enum TSecurityUIsSecUIOriginatedQuery - { - ESecurityUIsSecUIOriginatedUninitialized = 0, - ESecurityUIsETelAPIOriginated, - ESecurityUIsSecUIOriginated, - ESecurityUIsSystemLockOriginated, - ESecurityUIsFpsOriginated - }; - -/** - * Used by SecUI to tell if a query request set by some ETELMM API lock setting function (i.e. SetXXXXSetting) - * has been canceled sinnce canceling the setting request does not prompt a query cancel event from ETEL. - * Old Shared Data constant name: KSecUIOriginatedQuery - */ -const TUint32 KSecurityUIsQueryRequestCancel = 0x00000302; -enum TSecurityUIsQueryRequestCancel - { - ESecurityUIsQueryRequestUninitialized = 0, - ESecurityUIsQueryRequestOk, - ESecurityUIsQueryRequestCanceled - }; - -#endif // SECURITYUISPRIVATEPSKEYS_H - -// End of File - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/rom/lockapp.iby --- a/securitydialogs/lockapp/rom/lockapp.iby Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/lockapp/rom/lockapp.iby Tue Aug 31 16:04:40 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 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" @@ -11,20 +11,12 @@ * * Contributors: * -* Description: LockApp files needed to image - * +* Description: Implementation of lockapp +* */ - - #ifndef __LOCKAPP_IBY__ #define __LOCKAPP_IBY__ -#include - -S60_APP_EXE(lockapp) -S60_APP_AIF_RSC(lockapp) +S60_APP_EXE(LockApp) -// To enable updating -data=ZSYSTEM\install\lockapp_stub.sis system\install\lockapp_stub.sis - -#endif // __LOCKAPP_IBY__ +#endif diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/rom/lockappresources.iby --- a/securitydialogs/lockapp/rom/lockappresources.iby Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* Copyright (c) 2007 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: LockApp resources needed to image - * -*/ - - -#ifndef __LOCKAPPRESOURCES_IBY__ -#define __LOCKAPPRESOURCES_IBY__ - -#include - -S60_APP_RESOURCE(lockapp) - -#endif // __LOCKAPPRESOURCES_IBY__ diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/sis/lockapp.pkg --- a/securitydialogs/lockapp/sis/lockapp.pkg Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -; -; Copyright (c) 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: ;Language - standard language definitions -; -;Language - standard language definitions -;Language - standard language definitions -&EN - -; standard SIS file header -#{"LockApp"}, (0x10283322), 1, 0, 0, TYPE=SA - -;Localised Vendor name -%{"Nokia"} - -;Unique Vendor name -:"Nokia" - -;Supports Series 60 v 3.0 -[0x101F7961], 0, 0, 0, {"Series60ProductID"} - -;Files to install -"\Epoc32\release\armv5\udeb\lockapp.exe"-"z:\sys\bin\lockapp.exe" -"\Epoc32\data\z\resource\apps\lockapp.rsc"-"z:\resource\apps\lockapp.rsc" -"\Epoc32\data\z\private\10003a3f\apps\lockapp_reg.rsc"-"z:\private\10003a3f\import\apps\lockapp_reg.rsc" -"\Epoc32\data\z\resource\apps\lockapp.mif"-"z:\resource\apps\lockapp.mif" diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/sis/lockapp_stub.sis Binary file securitydialogs/lockapp/sis/lockapp_stub.sis has changed diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/sis/make_stubsis.bat --- a/securitydialogs/lockapp/sis/make_stubsis.bat Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -rem -rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -rem All rights reserved. -rem This component and the accompanying materials are made available -rem under the terms of "Eclipse Public License v1.0" -rem which accompanies this distribution, and is available -rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -rem -rem Initial Contributors: -rem Nokia Corporation - initial contribution. -rem -rem Contributors: -rem -rem Description: -rem - -makesis -s lockapp.pkg lockapp_stub.sis diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/sis/rd-key.pem --- a/securitydialogs/lockapp/sis/rd-key.pem Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQDLRF+r1FGGkCwTrb420kbnAps7gi1yYUcXYUdWeFTuBeQe5eW4 -6Y+LWaA8HMlDdoHRB0FgASisYcFagwno9+oFf4AJka4H1gWEs5XTGwAA1s0d8XGh -7W7Dt9F5FZij8F7/9Pi6+FhhxZFIf1DD+yry9D7+Sp+BgdNALe4XOpf25QIBAwKB -gQCHgupyjYuvCsgNHn7PNtnvVxInrB5MQNoPli+O+uNJWUK/Q+57Rl+yO8AoEzDX -pFaLWiuVVhsdloDnAgabT/FXzYncs6uOHyEUV+dSXb78vtLPJqAX+Fg2i3hOXreB -yskcZ13/OsKVOu5wgrJkx2baZufkqMwOSytf5y9nwjEIKwJBAP+inobagVNrN62j -KQva3cC+UN/6XnKdTc0CA6bHyLOaJoH1xiMwG/VS2PGjHI0tiSMNtLn/QPpHJ003 -iabGhdUCQQDLjp/9UjFT6K6CF66Chqf30pZXhx+GTSQZmv/gvZiMly7X9fX9BGX3 -2MbJohBC4yI21XKTbisWywkF73Hwh+TRAkEAqmxprzxWN5zPyRdwspHpKymLP/w+ -9xOJM1atGdqFzRFvAU6EF3Vn+OHl9my9s3OwwgkjJqorUYTE3iUGby8D4wJBAIe0 -aqjhdjfwdFa6dFcEb/qMZDpaFQQzbWZnVUB+ZbMPdI/5TqitmU/l2dvBYCyXbCSO -TGJJcg8yBgP09qBamIsCQFL7j1tM0XPVQJQ89WpKCld7O9ORxRGVj1eG0tWijrH8 -mGbYh8SGCVoWV3vrKSS8GBrFVgQnqUaHuEdtM7tpCAQ= ------END RSA PRIVATE KEY----- diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/sis/rd.cer --- a/securitydialogs/lockapp/sis/rd.cer Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICzDCCAjWgAwIBAgIBADANBgkqhkiG9w0BAQUFADArMRAwDgYDVQQKEwdSRCBD -ZXJ0MRcwFQYDVQQDEw5SRCBDZXJ0aWZpY2F0ZTAeFw0wNDExMTUxMjQyMDZaFw0z -NzA5MjMxMjQyMDZaMCsxEDAOBgNVBAoTB1JEIENlcnQxFzAVBgNVBAMTDlJEIENl -cnRpZmljYXRlMIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQDLRF+r1FGGkCwT -rb420kbnAps7gi1yYUcXYUdWeFTuBeQe5eW46Y+LWaA8HMlDdoHRB0FgASisYcFa -gwno9+oFf4AJka4H1gWEs5XTGwAA1s0d8XGh7W7Dt9F5FZij8F7/9Pi6+FhhxZFI -f1DD+yry9D7+Sp+BgdNALe4XOpf25QIBA6OCAQAwgf0wDAYDVR0TBAUwAwEB/zAL -BgNVHQ8EBAMCAoQwHQYDVR0OBBYEFFi/kuGzxhVpjGxe9ZwlxC3fH9jFMFMGA1Ud -IwRMMEqAFFi/kuGzxhVpjGxe9ZwlxC3fH9jFoS+kLTArMRAwDgYDVQQKEwdSRCBD -ZXJ0MRcwFQYDVQQDEw5SRCBDZXJ0aWZpY2F0ZYIBADBsBgNVHSAEZTBjMGEGBFUd -IAAwWTATBggrBgEFBQcCARYHaHR0cDovLzBCBggrBgEFBQcCAjA2GjRGb3IgUiZE -IHVzYWdlIG9ubHkuIFRoaXMgY2VydGlmaWNhdGUgaXMgbm90IHRydXN0ZWQuMA0G -CSqGSIb3DQEBBQUAA4GBAHGB4RQMAgBdeT2hxfOr6f2nA/dZm+M5yX5daUtZnET9 -Ed0A9sazLawfN2G1KFQT9kxEParAyoAkpbMAsRrnRz/9cM3OHgFm/NiKRnf50DpT -7oCx0I/65mVD2kt+xXE62/Ii5KPnTufIkPi2uLvURCia1tTS8JmJ8dtxDGyQt8BR ------END CERTIFICATE----- diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockapp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/lockapp/src/lockapp.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2000 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: Very small version of lockapp, which simply launches Autolock + * This is needed becauses starter has the hardcoded name "lockapp" + * + */ + +// INCLUDES + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +// ---------------------------------------------------------------------------------------- +// Server startup code +// ---------------------------------------------------------------------------------------- +static void RunServerL() + { + CActiveScheduler* s = new (ELeave) CActiveScheduler; + CleanupStack::PushL(s); + CActiveScheduler::Install(s); + + // start autolock instead of lockapp . This is a backup solution to use in case that not all SysAp and Avkon changes are implemented + /* No need to check the task. A process should not run twice + TApaTaskList taskList( CCoeEnv::Static()->WsSession() ); // can also use CCoeEnv::Static() CEikonEnv::Static() + const TUid KAutolockSrvAppUid = { 0x100059B5 }; + TApaTask task( taskList.FindApp( KAutolockSrvAppUid ) ); + if( !task.Exists()) + */ + + RApaLsSession ls; + User::LeaveIfError(ls.Connect()); + CleanupClosePushL(ls); + + /************/ + _LIT_SECURITY_POLICY_C1(KWritePolicy, ECapabilityWriteDeviceData); + TInt ret = RProperty::Define(KPSUidCoreApplicationUIs, + KCoreAppUIsAutolockStatus, RProperty::EInt, TSecurityPolicy(TSecurityPolicy::EAlwaysPass), + TSecurityPolicy(TSecurityPolicy::EAlwaysPass)); + + TInt autolockState; + RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolockState); + if(autolockState==EAutolockStatusUninitialized) + { + autolockState = EAutolockOff; // not-initialized means that the unlock-query hasn't been displayed. Therefore the device should not stay locked. + } + ret = RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, + autolockState); // this might re-set it. That's not bad. It will re-notify all listeners. + RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolockState); + RDebug::Printf("%s %s (%u) autolockState=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, autolockState); + /************/ + + CApaCommandLine* commandLine = CApaCommandLine::NewLC(); + commandLine->SetExecutableNameL(_L("autolock.exe")); + commandLine->SetCommandL(EApaCommandRun); + // Try to launch the application. + TInt err = ls.StartApp(*commandLine); // this migh fail + RDebug::Printf("%s %s (%u) Start: autolock.exe err=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, err); + + CleanupStack::PopAndDestroy(2); // commandLine, ls + + // Initialisation complete, now signal the client + RProcess::Rendezvous( KErrNone); + + // Ready to run + CActiveScheduler::Start(); + + // Cleanup the server and scheduler + CleanupStack::PopAndDestroy(2); + } + +// Server process entry-point +TInt E32Main() + { + CTrapCleanup* cleanup = CTrapCleanup::New(); + TInt r = KErrNoMemory; + if (cleanup) + { + TRAP(r, RunServerL()); + delete cleanup; + } + RDebug::Printf("%s %s (%u) r=%x", __FILE__, __PRETTY_FUNCTION__, + __LINE__, r); + return r; + } + +// End of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockappapplication.cpp --- a/securitydialogs/lockapp/src/lockappapplication.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2007 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: Application class that also creates the appserver - * -*/ - - -#include -#include -#include "lockappdocument.h" -#include "lockappserver.h" -#include "lockappapplication.h" - -// UID for the application, this should correspond to the uid defined in the mmp file -static const TUid KUidLockAppApp = - { - 0x10283322 - }; - -// --------------------------------------------------------------------------- -// Create an application, and return a pointer to it -// --------------------------------------------------------------------------- -CApaApplication* NewApplication( ) - { - return new CLockAppApplication; - } - -// --------------------------------------------------------------------------- -// Main function of the application executable. -// --------------------------------------------------------------------------- -TInt E32Main( ) - { - return EikStart::RunApplication( NewApplication ); - } - -// --------------------------------------------------------------------------- -// Returns the UID for the application -// --------------------------------------------------------------------------- -TUid CLockAppApplication::AppDllUid( ) const - { - // Return the UID for the LockApp application - return KUidLockAppApp; - } - -// --------------------------------------------------------------------------- -// Creates a document object and passes ownership. -// --------------------------------------------------------------------------- -CApaDocument* CLockAppApplication::CreateDocumentL( ) - { - // Create an LockApp document, and return a pointer to it - CApaDocument* document = CLockAppDocument::NewL( *this ); - return document; - } diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockappappui.cpp --- a/securitydialogs/lockapp/src/lockappappui.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,229 +0,0 @@ -/* -* Copyright (c) 2007 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: LockApp Application UI class -* -*/ - - -#include "lockappappui.h" -#include "lockappstatecontrol.h" -#include "lockappserver.h" -#include "lockapptrace.h" -#include -#include -#include - -#ifdef __SAP_TERMINAL_CONTROL_FW -#include -#endif // __SAP_TERMINAL_CONTROL_FW - -// --------------------------------------------------------------------------- -// Second phase constructor -// --------------------------------------------------------------------------- -void CLockAppAppUi::ConstructL( ) - { - #if defined(_DEBUG) - INFO_4( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x8 ); - #endif - - // default appui constructor has to be called - BaseConstructL( ); - - TInt use_old_autolock=1; - if(use_old_autolock) - { - // start autolock instead of lockapp . This is a backup solution to use in case that not all SysAp and Avkon changes are implemented - #if defined(_DEBUG) - INFO_4( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x1 ); - #endif - TApaTaskList taskList( iCoeEnv->WsSession() ); - TApaTask task( taskList.FindApp( _L("autolock.exe" )) ); - if ( !task.Exists() ) - { - RApaLsSession ls; - User::LeaveIfError(ls.Connect()); - CleanupClosePushL(ls); - - CApaCommandLine* commandLine = CApaCommandLine::NewLC(); - commandLine->SetExecutableNameL( _L("autolock.exe" ) ); - commandLine->SetCommandL( EApaCommandRun ); - - // Try to launch the application. - User::LeaveIfError(ls.StartApp(*commandLine)); - #if defined(_DEBUG) - INFO_4( "%s %s (%u) autolock.exe created=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x7 ); - #endif - - CleanupStack::PopAndDestroy(2); // commandLine, ls - } - Exit(); - } - - #if defined(_DEBUG) - INFO( "CLockAppAppUi::ConstructL started" ); - #endif - - // start the server with the specified name - iLockServer = CLockAppServer::NewL( KLockAppServerName ); - - // status pane is should not be visible - StatusPane()->MakeVisible( EFalse ); - - // we need high priority even if lockapp is not in the foreground - iEikonEnv->WsSession().ComputeMode( RWsSession::EPriorityControlDisabled ); - RThread().SetProcessPriority( EPriorityHigh ); - - /* - * LockApp is set as system application (Symbian terminology). - * This means it does not get closed when system is asked to close applications. - */ - iEikonEnv->SetSystem( ETrue ); - -#ifdef _GLOBAL_PRIORITY_SUPPORTED - // Enable global popup notes - AknGlobalPopupPriorityController::EnablePriorityControlL(); - AknGlobalPopupPriorityController::AllowGlobalPopups( ETrue ); -#endif - - // main control storing and controling phone keylock/devicelock status - iStateControl = CLockAppStateControl::NewL( ); - - // the main control is given high stack priority - // ECoeStackPriorityEnvironmentFilter-1 used to allow hw keys for keyfiler even if keypad is locked. - AddToStackL( iStateControl, ECoeStackPriorityEnvironmentFilter-1, ECoeStackFlagStandard ); - #if defined(_DEBUG) - INFO( "CLockAppAppUi::ConstructL finished" ); - #endif - } - -// --------------------------------------------------------------------------- -// Default Constructor -// --------------------------------------------------------------------------- -CLockAppAppUi::CLockAppAppUi( ) - { - // no implementation required - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -CLockAppAppUi::~CLockAppAppUi( ) - { - if ( iLockServer ) - { - delete iLockServer; - iLockServer = NULL; - } - if ( iStateControl ) - { - // remove main control from stack - RemoveFromStack( iStateControl ); - delete iStateControl; - iStateControl = NULL; - } - } - -// --------------------------------------------------------------------------- -// Returns interface to LockAppServer sessions for changing lock states -// --------------------------------------------------------------------------- -MLockAppStateControl* CLockAppAppUi::StateControl( ) - { - return iStateControl; - } - -#ifdef __SAP_TERMINAL_CONTROL_FW -// --------------------------------------------------------------- -// Handles the TARM command to unlock the phone from WindowServer. -// --------------------------------------------------------------- -MCoeMessageObserver::TMessageResponse CLockAppAppUi::HandleMessageL( - TUint32 aClientHandleOfTargetWindowGroup, - TUid aMessageUid, - const TDesC8& aMessageParameters ) - { - MCoeMessageObserver::TMessageResponse messageResponse( EMessageHandled); - if ( aMessageUid.iUid == SCP_CMDUID_UNLOCK) - { - // For security reasons we must check from the SCP server - // did this command originate from it. - RSCPClient scpClient; - if ( scpClient.Connect() == KErrNone ) - { - CleanupClosePushL( scpClient ); - if ( scpClient.QueryAdminCmd( ESCPCommandUnlockPhone ) ) - { - #if defined(_DEBUG) - INFO( "CLockAppAppUi::HandleMessageL(): Admin command received, unlocking" ); - #endif - iStateControl->DisableDevicelockL(); - } - else - { - #if defined(_DEBUG) - INFO( "CLockAppAppUi::HandleMessageL(): Unauthorized attempt to unlock" ); - #endif - } - CleanupStack::PopAndDestroy(); // calls Close() on scpClient - } - else - { - #if defined(_DEBUG) - INFO( "CLockAppAppUi::HandleMessageL(): Failed to connect to SCP, ignoring unlock-message." ); - #endif - } - } - else // aMessageUid.iUid != SCP_CMDUID_UNLOCK - { - messageResponse = CAknAppUi::HandleMessageL( - aClientHandleOfTargetWindowGroup, - aMessageUid, - aMessageParameters); - } - return messageResponse; - } -#endif // __SAP_TERMINAL_CONTROL_FW - -// ---------------------------------------------------------- -// Handle window-server events -// ---------------------------------------------------------- -void CLockAppAppUi::HandleWsEventL( const TWsEvent& aEvent, CCoeControl* aDestination ) - { - #if defined(_DEBUG) - INFO_4( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - #endif - if ( aEvent.Type() == TRawEvent::EKeyDown ) - { - #if defined(_DEBUG) - INFO_1("CLockAppAppUi::HandleWsEventL() - aEvent.Key()->iCode: %d", aEvent.Key()->iCode ); - #endif - } - - // call super-class - CAknAppUi::HandleWsEventL( aEvent, aDestination ); - // propagate call - iStateControl->HandleWsEventL( aEvent, aDestination); - } - -// --------------------------------------------------------------------------- -// From @c CAknAppUiBase. Overriden the parent method, because otherwise -// the main lock state control would not receive the call, because is is not -// window-owning control (=without window->not visible). The call is needed -// because the main state control owns window-owning child controls. -// --------------------------------------------------------------------------- -void CLockAppAppUi::HandleResourceChangeL( TInt aType ) - { - // call super-class - CAknAppUi::HandleResourceChangeL( aType ); - // propagate call - since does not own window - iStateControl->HandleResourceChange( aType ); - } diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockappbasecontrol.cpp --- a/securitydialogs/lockapp/src/lockappbasecontrol.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,277 +0,0 @@ -/* -* Copyright (c) 2007 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: Base control for logical UI components - * -*/ - - -#include "lockappbasecontrol.h" -#include "lockappkeycapturecontroller.h" -#include "lockapputils.h" - -#include -#include -#include -#include // CAknSmallIndicator -#include - -// --------------------------------------------------------------------------- -// Constructor. -// --------------------------------------------------------------------------- -CLockAppBaseControl::CLockAppBaseControl( MLockAppStateControl& aStateControl ) : - iStateControl(aStateControl), iWindowGroup( iEikonEnv->RootWin()) - { - INFO_4( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - } - -// --------------------------------------------------------------------------- -// Second phase constructor. -// --------------------------------------------------------------------------- -void CLockAppBaseControl::ConstructL( ) - { - INFO_4( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - iKeyPattern = CLockAppKeyPattern::NewL( ); - } - -// --------------------------------------------------------------------------- -// Destructor. -// --------------------------------------------------------------------------- -CLockAppBaseControl::~CLockAppBaseControl( ) - { - CancelNote( ); - if ( iActive ) - { - TRAP_IGNORE(HandleDeActivateEventL( NULL )); - } - delete iCba; - delete iKeyPattern; - } - -// --------------------------------------------------------------------------- -// Setup key pattern matcher. -// --------------------------------------------------------------------------- -TBool CLockAppBaseControl::SetupKeyPatternsWithPolicyL( TLockPolicyType aType ) - { - INFO_1( "CLockAppBaseControl::SetupKeyPatternsL( type=%d )", aType ); - TBool ret(EFalse); - __ASSERT_DEBUG( iKeyPattern, DoPanic(ELockIllegalState)); - if ( iKeyPattern ) - { - CKeyLockPolicyApi* keylockPolicy = CKeyLockPolicyApi::NewL( aType ); - - // if the keylockpolicy has keycombinations - if ( keylockPolicy->HasConfiguration( ) ) - { - // TESTING1! - INFO( "CLockAppBaseControl::SetupKeyPatternsWithPolicyL - HasConfiguration!" ); - - TUint32 index(0), k1(0), k2(0); - while ( keylockPolicy->GetKeyCombination( index, k1, k2 )== KErrNone ) - { - // TESTING2! - INFO( "CLockAppBaseControl::SetupKeyPatternsWithPolicyL - key combination found!" ); - - // add each combination to our pattern matcher - iKeyPattern->AddPattern( k1, k2 ); - index++; - } - - ret = ETrue; - INFO_1( "CLockAppBaseControl::SetupKeyPatternsL: added %d patterns", index ); - } - delete keylockPolicy; - } - return ret; - } - -// --------------------------------------------------------------------------- -// Show note -// --------------------------------------------------------------------------- -void CLockAppBaseControl::ShowNote( CLockAppLockedNote* aNote, const TInt aTimeout, - const CAknNoteDialog::TTone aTone ) - { - if ( aNote ) - { - // cancel the current note if any - if ( iCurrentNote != aNote ) - { - CancelNote( ); - iCurrentNote = aNote; - } - iCurrentNote->ShowNote( aTimeout, aTone ); - } - } - -// --------------------------------------------------------------------------- -// Cancel currently shown note -// --------------------------------------------------------------------------- -void CLockAppBaseControl::CancelNote( ) - { - if ( iCurrentNote ) - { - if ( iCurrentNote->IsVisible( ) ) - { - iCurrentNote->CancelNote( ); - } - iCurrentNote = NULL; - } - } - -// --------------------------------------------------------------------------- -// Internal lock state has been changed. -// --------------------------------------------------------------------------- -void CLockAppBaseControl::HandleLockStatusChangedL( TLockStatus aStatus ) - { - switch ( aStatus ) - { - case ELockNotActive: - break; - case EKeyguardActive: - break; - case EDevicelockActive: - break; - default: - DoPanic( ELockPanicGeneral ); - break; - } - } - -// --------------------------------------------------------------------------- -// Handle activate event -// --------------------------------------------------------------------------- -void CLockAppBaseControl::HandleActivateEventL( TUint /*aEnvMask*/ ) - { - __ASSERT_DEBUG( !iActive, DoPanic(ELockIllegalState)); - if ( !iActive ) - { - iActive = ETrue; - } - } - -// --------------------------------------------------------------------------- -// Handle de-activate event -// --------------------------------------------------------------------------- -void CLockAppBaseControl::HandleDeActivateEventL( TUint /*aEnvMask*/ ) - { - __ASSERT_DEBUG( iActive, DoPanic(ELockIllegalState)); - if ( iActive ) - { - iActive = EFalse; - } - } - -// --------------------------------------------------------------------------- -// Capture/uncapture primary keys -// --------------------------------------------------------------------------- -void CLockAppBaseControl::CapturePrimaryKeys( const TBool aCapture ) - { - INFO_4( "%s %s (%u) aCapture=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aCapture ); - INFO_4( "%s %s (%u) iKeyPattern=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iKeyPattern ); - if ( iKeyPattern ) - { - if ( aCapture ) - { - // capture primary keys - TUint32 index( 0), primaryKey( 0), secondaryKey( 0); - while (iKeyPattern->GetPattern( index, primaryKey, secondaryKey )== KErrNone ) - { - CLockAppKeyCaptureController::CaptureKey( primaryKey, 0, EKeyCaptureUpAndDownEvents ); - index++; - } - } - else - { - // uncapture primary keys - TUint32 index( 0), primaryKey( 0), secondaryKey( 0); - while (iKeyPattern->GetPattern( index, primaryKey, secondaryKey )== KErrNone ) - { - CLockAppKeyCaptureController::ReleaseKey( primaryKey ); - index++; - } - } - } - } - -// --------------------------------------------------------------------------- -// Bring keyguard cba forwards/backwards. -// --------------------------------------------------------------------------- -void CLockAppBaseControl::ShowCba( const TBool aShow ) - { - if ( iCba ) - { - RDrawableWindow* cbaWindow = iCba->ButtonGroup()->AsControl()->DrawableWindow( ); - if ( aShow ) - { - cbaWindow->SetNonFading( ETrue ); - cbaWindow->SetOrdinalPosition( 0 ); - iCba->MakeVisible( ETrue ); - } - else - { - // hide the window - iCba->MakeVisible( EFalse ); - } - } - } - -// --------------------------------------------------------------------------- -// Method used for capturing/releasing pointer events when key lock is enabled. -// Capturing is done using button/cba group window. -// --------------------------------------------------------------------------- -void CLockAppBaseControl::SetPointerEventCapture(const TBool aEnable ) - { -#ifdef RD_SCALABLE_UI_V2 - if ( AknLayoutUtils::PenEnabled( )&& iCba ) - { - // cba captures all pointer events - RDrawableWindow* cbaWindow = iCba->ButtonGroup()->AsControl()->DrawableWindow( ); - if ( aEnable ) - { - cbaWindow->SetPointerCapture( RWindowBase::TCaptureDragDrop ); - } - else - { - cbaWindow->SetPointerCapture( RWindowBase::TCaptureDisabled ); - } - cbaWindow->ClaimPointerGrab( aEnable ); - } -#endif // RD_SCALABLE_UI_V2 - } - -// --------------------------------------------------------------------------- -// Set Keyguard indicator on Idle. -// --------------------------------------------------------------------------- -void CLockAppBaseControl::SetKeyguardIndicatorStateL( const TBool aEnable ) - { - CAknSmallIndicator* theIndicator = CAknSmallIndicator::NewLC( TUid::Uid( EAknIndicatorKeyguard ) ); - if ( aEnable ) - { - theIndicator->SetIndicatorStateL( EAknIndicatorStateOn ); - } - else - { - theIndicator->SetIndicatorStateL( EAknIndicatorStateOff ); - } - CleanupStack::PopAndDestroy( theIndicator ); - } - -// --------------------------------------------------------------------------- -// Handle environment changes (Screensaver, Telephony, etc.) -// --------------------------------------------------------------------------- -void CLockAppBaseControl::HandleEnvironmentChange( TUint /*aEnvMask*/, TUint /*aEventMask*/ ) - { - // no implementation needed - virtual function - } - -// END OF FILE diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockappcenrepobserver.cpp --- a/securitydialogs/lockapp/src/lockappcenrepobserver.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,146 +0,0 @@ -/* -* Copyright (c) 2007 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: Central Repository key observer - * -*/ - - -#include -#include "lockappcenrepobserver.h" -#include "lockapputils.h" - -// --------------------------------------------------------------------------- -// Two-phased constructor. -// --------------------------------------------------------------------------- -CLockAppCenRepObserver* CLockAppCenRepObserver::NewL( MLockAppObserverInterface* aObserver, - TUid aCenRepUid, TUint32 aKeyId ) - { - CLockAppCenRepObserver* self = new (ELeave) CLockAppCenRepObserver(aObserver, aCenRepUid, aKeyId); - CleanupStack::PushL( self ); - self->ConstructL( ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -CLockAppCenRepObserver::~CLockAppCenRepObserver( ) - { - if ( iNotifyHandler ) - { - iNotifyHandler->StopListening( ); - delete iNotifyHandler; - iNotifyHandler = NULL; - } - if ( iRepository ) - { - delete iRepository; - iRepository = NULL; - } - } - -// --------------------------------------------------------------------------- -// C++ default constructor -// --------------------------------------------------------------------------- -CLockAppCenRepObserver::CLockAppCenRepObserver( MLockAppObserverInterface* aObserver, - TUid aCenRepUid, TUint32 aKeyId ) : - iObserver(aObserver), - iCenRepUid(aCenRepUid), - iKeyId(aKeyId) - { - } - -// --------------------------------------------------------------------------- -// Symbian OS default constructor -// --------------------------------------------------------------------------- -void CLockAppCenRepObserver::ConstructL( ) - { - // init cenrep connection -INFO_4( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - iRepository = CRepository::NewL( iCenRepUid ); - iNotifyHandler = CCenRepNotifyHandler::NewL( *this, *iRepository, - CCenRepNotifyHandler::EIntKey, iKeyId ); - iNotifyHandler->StartListeningL( ); - } - -// --------------------------------------------------------------------------- -// Gets value of the default key from CenRep. -// --------------------------------------------------------------------------- -TInt CLockAppCenRepObserver::GetValue(TInt& aValue ) - { - return iRepository->Get( iKeyId, aValue ); - } - -// --------------------------------------------------------------------------- -// Gets value of the key from CenRep. -// --------------------------------------------------------------------------- -TInt CLockAppCenRepObserver::GetKeyValue(TUint32 aKey, TInt& aValue ) - { - INFO_4( "%s %s (%u) aKey=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aKey ); - - return iRepository->Get( aKey, aValue ); - } - -// --------------------------------------------------------------------------- -// Sets a value for the default key in CenRep. -// --------------------------------------------------------------------------- -TInt CLockAppCenRepObserver::SetValue(TInt aValue ) - { - return iRepository->Set( iKeyId, aValue ); - } - -// --------------------------------------------------------------------------- -// Sets a value for the key in CenRep. -// --------------------------------------------------------------------------- -TInt CLockAppCenRepObserver::SetKeyValue(TUint32 aKey, TInt aValue ) - { - return iRepository->Set( aKey, aValue ); - } - -// --------------------------------------------------------------------------- -// Handles changes. Called by CenRep. -// --------------------------------------------------------------------------- -void CLockAppCenRepObserver::HandleNotifyInt(TUint32 aKeyId, TInt aValue ) - { -INFO_4( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - if ( aKeyId == iKeyId ) - { - if ( iObserver ) - { - iObserver->HandleCenRepNotify( iCenRepUid, iKeyId, aValue ); - } - } - } - -// --------------------------------------------------------------------------- -// Handles errors. Called by CenRep. -// --------------------------------------------------------------------------- -void CLockAppCenRepObserver::HandleNotifyError(TUint32 aId, TInt error, CCenRepNotifyHandler* /*aHandler*/) - { - ERROR_1(error, "CLockAppCenRepObserver::HandleNotifyError - %d", aId); - } - -// --------------------------------------------------------------------------- -// Handles Repository wide reset caused generic notifications. Called by CenRep. -// --------------------------------------------------------------------------- -void CLockAppCenRepObserver::HandleNotifyGeneric(TUint32 aId ) - { - if ( aId == NCentralRepositoryConstants::KInvalidNotificationId ) - { - // TODO implement what to do in this case - } - } - -// END OF FILE diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockappdevicelockcontainer.cpp --- a/securitydialogs/lockapp/src/lockappdevicelockcontainer.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,300 +0,0 @@ -/* -* Copyright (c) 2007 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: Devicelock Background UI (window owning control) - * -*/ - - -// INCLUDE FILES -#include "lockappdevicelockcontainer.h" -#include "lockapputils.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -_LIT(LOCKBITMAPNAME, "AutoLock.mbm"); // TODO change filename - -// CONSTANTS - -#ifdef RD_FULLSCREEN_WALLPAPER -enum TAutolockBgLayers - { - EAutolockBgLayerWallpaper = 0, - EAutolockBgLayerBackground = 1, - EAutolockBgLayersN = 2 - }; -#else -enum TAutolockBgLayers - { - EAutolockBgLayerBackground = 0, - EAutolockBgLayerWallpaper = 1, - EAutolockBgLayersN = 2 - }; -#endif //RD_FULLSCREEN_WALLPAPER - -// --------------------------------------------------------------------------- -// Standard Symbian OS construction sequence -// --------------------------------------------------------------------------- -CLockAppDevicelockContainer* CLockAppDevicelockContainer::NewL( RWindowGroup& aWg ) - { - CLockAppDevicelockContainer* self = new (ELeave) CLockAppDevicelockContainer( ); - CleanupStack::PushL( self ); - self->ConstructL( aWg ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------- -// Symbian OS two phased constructor -// --------------------------------------------------------- -void CLockAppDevicelockContainer::ConstructL( RWindowGroup& aWg ) - { - INFO( "CLockAppDevicelockContainer::ConstructL started" ); - - CreateWindowL( aWg ); - MakeVisible( EFalse ); - - HBufC* bitMapPath = HBufC::NewLC( KMaxPath ); - TPtr BitmapFile( bitMapPath->Des( ) ); - BitmapFile.Append( _L("Z:") ); - BitmapFile.Append( KDC_APP_BITMAP_DIR ); - BitmapFile.Append( LOCKBITMAPNAME ); - - TRect mainPaneRect = GetMainPaneRect( ); - - iClock = NULL; - iEikBitmap = NULL; - AknsUtils::CreateIconL( AknsUtils::SkinInstance( ), KAknsIIDQgnGrafPhoneLocked, iBitmap, iMask, - BitmapFile, EMbmLockappQgn_graf_phone_locked, EMbmLockappQgn_graf_phone_locked_mask ); - -#ifdef RD_FULLSCREEN_WALLPAPER - TSize screenSize = iCoeEnv->ScreenDevice()->SizeInPixels( ); - TRect wallpaperRect( TPoint( 0, 0 ), screenSize); - iBgContext = CAknsLayeredBackgroundControlContext::NewL( KAknsIIDWallpaper, wallpaperRect, - ETrue, EAutolockBgLayersN ); -#else - // Create background control context for skins. Use parent absolute mode, - // as this is window owning control - iBgContext = CAknsLayeredBackgroundControlContext::NewL( - KAknsIIDQsnBgAreaMainIdle, mainPaneRect, ETrue, EAutolockBgLayersN ); - iBgContext->SetLayerImage( EAutolockBgLayerWallpaper, KAknsIIDWallpaper ); - iBgContext->SetLayerRect( EAutolockBgLayerWallpaper, mainPaneRect ); -#endif // RD_FULLSCREEN_WALLPAPER - - SetRect( mainPaneRect ); - CleanupStack::PopAndDestroy( bitMapPath ); //bitMapPath - INFO( "CLockAppDevicelockContainer::ConstructL completed" ); - } - -// --------------------------------------------------------- -// Destructor -// --------------------------------------------------------- -CLockAppDevicelockContainer::~CLockAppDevicelockContainer( ) - { - delete iBgContext; - delete iBitmap; - delete iMask; - delete iClock; - } - -// --------------------------------------------------------- -// Return the rectangle for this control -// --------------------------------------------------------- -TRect CLockAppDevicelockContainer::GetMainPaneRect( ) - { - TRect screen( iAvkonAppUi->ApplicationRect()); - TAknLayoutRect applicationWindow; - applicationWindow.LayoutRect( screen, AknLayoutScalable_Avkon::application_window( 0 ) ); - TInt mainPaneVariety = ( Layout_Meta_Data::IsLandscapeOrientation() ? 4 : 3 ); - TAknLayoutRect mainPane; - mainPane.LayoutRect( applicationWindow.Rect( ), - AknLayoutScalable_Avkon::main_pane( mainPaneVariety ) ); - return mainPane.Rect( ); - } - -// --------------------------------------------------------- -// Called by framework when the view size is changed -// --------------------------------------------------------- -void CLockAppDevicelockContainer::SizeChanged() - { - INFO( "CLockAppDevicelockContainer::SizeChanged" ); - TRect mainPaneRect( Rect( )); - TAknLayoutRect idleTradPane; - idleTradPane.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::main_idle_trad_pane( ) ); - - TInt variety = ( Layout_Meta_Data::IsLandscapeOrientation() ? 2 : 3 ); - - TAknLayoutRect idlePaneG2; - idlePaneG2.LayoutRect( idleTradPane.Rect( ), - AknLayoutScalable_Avkon::main_idle_pane_g2( variety ) ); - AknIconUtils::SetSize( iBitmap, idlePaneG2.Rect().Size( ) ); - - TPoint parentPos( 0, 0); -#ifdef RD_FULLSCREEN_WALLPAPER - TSize screenSize = iCoeEnv->ScreenDevice()->SizeInPixels( ); - TRect wallpaperRect( TPoint( 0, 0 ), screenSize); - iBgContext->SetLayerRect( EAutolockBgLayerBackground, Rect( ) ); - iBgContext->SetLayerRect( EAutolockBgLayerWallpaper, wallpaperRect ); -#else - iBgContext->SetLayerRect( EAutolockBgLayerBackground, Rect() ); - iBgContext->SetLayerRect( EAutolockBgLayerWallpaper, Rect() ); - //parent must be set when using parent absolute mode. - parentPos = PositionRelativeToScreen(); -#endif //RD_FULLSCREEN_WALLPAPER - - iBgContext->SetParentPos( parentPos ); - - if ( !Layout_Meta_Data::IsLandscapeOrientation() ) - { - // the screen is in portrait mode - if ( iClock ) - { - // remove clock, if it exists - delete iClock; - iClock = NULL; - } - RRegion autolockRegion; -#ifdef RD_FULLSCREEN_WALLPAPER - autolockRegion.AddRect( wallpaperRect ); -#else - autolockRegion.AddRect( Rect() ); -#endif //RD_FULLSCREEN_WALLPAPER - Window().SetShape( autolockRegion ); - autolockRegion.Close( ); - } - else - { - // the screen is in landscape mode. - // get the correct area from layout utils. - TAknLayoutRect popupClockDigitalAnalogueWindowLayoutRect; - popupClockDigitalAnalogueWindowLayoutRect.LayoutRect( idleTradPane.Rect( ), - AknLayoutScalable_Avkon::popup_clock_digital_analogue_window( 3 ) ); - TRect popupClockDigitalAnalogueWindowRect(popupClockDigitalAnalogueWindowLayoutRect.Rect( )); - - // since the clock is not shown in app shell when the screen is in landscape, - // we'll show a clock here. - if ( !iClock ) - { - TRAP_IGNORE({ - CAknSkinnableClock* clock = CAknSkinnableClock::NewL( this, ETrue, EFalse ); - CleanupStack::PushL( clock ); - clock->SetRect( popupClockDigitalAnalogueWindowRect ); - clock->ActivateL(); - CleanupStack::Pop( clock ); - iClock = clock; - }); - } - else - { - iClock->SetRect( popupClockDigitalAnalogueWindowRect ); - } - RRegion autolockRegion; -#ifdef RD_FULLSCREEN_WALLPAPER - autolockRegion.AddRect( wallpaperRect ); -#else - autolockRegion.AddRect( Rect() ); -#endif //RD_FULLSCREEN_WALLPAPER - autolockRegion.AddRect( iClock->Rect( ) ); - Window().SetShape( autolockRegion ); - autolockRegion.Close( ); - } - } - -// --------------------------------------------------------- -// CLockAppDevicelockContainer::CountComponentControls() const -// --------------------------------------------------------- -TInt CLockAppDevicelockContainer::CountComponentControls( ) const - { - TInt controlCount = 0; - if ( Layout_Meta_Data::IsLandscapeOrientation( ) ) - { - if ( iClock ) - { - controlCount++; - } - } - return controlCount; - } - -// --------------------------------------------------------- -// CLockAppDevicelockContainer::ComponentControl(TInt aIndex) const -// --------------------------------------------------------- -CCoeControl* CLockAppDevicelockContainer::ComponentControl(TInt /*aIndex*/) const - { - return iClock; - } - -// --------------------------------------------------------- -// CLockAppDevicelockContainer::Draw(const TRect& aRect) const -// --------------------------------------------------------- -void CLockAppDevicelockContainer::Draw(const TRect& aRect) const - { - CWindowGc& gc = SystemGc( ); - gc.SetPenStyle( CGraphicsContext::ENullPen ); - gc.SetBrushColor( KRgbWhite ); - gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); - MAknsSkinInstance* skin = AknsUtils::SkinInstance( ); - MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); - AknsDrawUtils::Background( skin, cc, this, gc, aRect ); - - if ( iBitmap ) - { - // Draw "lock" icon centered to this control - TInt x = (Rect().Width( ) - iBitmap->SizeInPixels().iWidth) / 2; - TInt y = (Rect().Height( ) - iBitmap->SizeInPixels().iHeight) / 2; - if ( iMask ) - { - gc.BitBltMasked( TPoint( x, y ), iBitmap, TRect( TPoint( 0, 0 ), - iBitmap->SizeInPixels( ) ), iMask, ETrue ); - } - else - { - gc.BitBlt( TPoint( x, y ), iBitmap ); - } - } - } - -// --------------------------------------------------------- -// CLockAppDevicelockContainer::HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType) -// --------------------------------------------------------- -void CLockAppDevicelockContainer::HandleControlEventL(CCoeControl* /*aControl*/, TCoeEvent /*aEventType*/) - { - } - -// --------------------------------------------------------- -// CLockAppDevicelockContainer::MopSupplyObject -// --------------------------------------------------------- -TTypeUid::Ptr CLockAppDevicelockContainer::MopSupplyObject( TTypeUid aId ) - { - if ( aId.iUid == MAknsControlContext::ETypeId ) - { - return MAknsControlContext::SupplyMopObject( aId, iBgContext ); - } - return CCoeControl::MopSupplyObject( aId ); - } - -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockappdevicelockcontrol.cpp --- a/securitydialogs/lockapp/src/lockappdevicelockcontrol.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1178 +0,0 @@ -/* -* Copyright (c) 2007 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: Devicelock UI - * -*/ - - -#include "lockappdevicelockcontrol.h" -#include "lockappdevicelockcontainer.h" -#include "lockappstatecontrolinterface.h" -#include "lockapppubsubobserver.h" -#include "lockappcenrepobserver.h" -#include "lockapputils.h" -#include "lockappwait.h" -#include "lockappkeycapturecontroller.h" - -#include // general avkon resources -#include // general avkon resources -#include // keyguard spesific resources -#include -#include // CAknTitlePane -#include -#include -#include -#include -#include -#include -#include - -#include // KSettingsAutolockStatus -#include -#include -#include -#include -#include - -#ifdef __SAP_TERMINAL_CONTROL_FW -#include -#endif // __SAP_TERMINAL_CONTROL_FW - -const TInt KAutoDeviceLockOff( 60000 ); -const TInt KPhoneIndex( 0 ); -const TInt KTriesToConnectServer( 2 ); -const TInt KTimeBeforeRetryingServerConnection( 50000 ); - -// --------------------------------------------------------------------------- -// Standard Symbian OS construction sequence -// --------------------------------------------------------------------------- -CLockAppDevicelockControl* CLockAppDevicelockControl::NewL(MLockAppStateControl& aStateControl, RWindowGroup& aWg ) - { - CLockAppDevicelockControl* self = new (ELeave) CLockAppDevicelockControl( aStateControl ); - INFO_4( "%s %s (%u) self=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, self ); - - CleanupStack::PushL( self ); - self->ConstructL( aWg ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Constructor passes the reference to the main state control. -// --------------------------------------------------------------------------- -CLockAppDevicelockControl::CLockAppDevicelockControl(MLockAppStateControl& aStateControl) : - CLockAppBaseControl(aStateControl), iShowingSecCodeQuery(EFalse) - { - INFO_4( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - - } - -// --------------------------------------------------------------------------- -// Destructor. -// --------------------------------------------------------------------------- -CLockAppDevicelockControl::~CLockAppDevicelockControl( ) - { - INFO_4( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - - /***************************************************** - * S60 Customer / ETel - * S60 ETel API - *****************************************************/ - /***************************************************** - * S60 Customer / TSY - * Needs customer TSY implementation - *****************************************************/ - INFO_4( "%s %s (%u) iCustomPhoneInitialized=%x -> -1 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iCustomPhoneInitialized ); - iCustomPhoneInitialized=-1; - if ( iCustomPhone.SubSessionHandle( ) ) - { - iCustomPhone.Close( ); - INFO_4( "%s %s (%u) iCustomPhoneInitialized=%x -> -2 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iCustomPhoneInitialized ); - iCustomPhoneInitialized=-2; - } - - INFO_4( "%s %s (%u) iPhoneInitialized=%x -> -1 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPhoneInitialized ); - iPhoneInitialized=-1; - if ( iPhone.SubSessionHandle( ) ) - { - iPhone.Close( ); - INFO_4( "%s %s (%u) iPhoneInitialized=%x -> -2 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPhoneInitialized ); - iPhoneInitialized=-2; - } - - INFO_4( "%s %s (%u) iTelServerInitialized=%x -> -1 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iTelServerInitialized ); - iTelServerInitialized=-1; - if ( iTelServer.Handle( ) ) - { - iTelServer.UnloadPhoneModule( KMmTsyModuleName ); - iTelServer.Close( ); - INFO_4( "%s %s (%u) iTelServerInitialized=%x -> -2 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iTelServerInitialized ); - iTelServerInitialized=-2; - } - if ( iActivityManager ) - { - iActivityManager->Cancel( ); - delete iActivityManager; - iActivityManager = NULL; - } - // CenRep observers - if ( iCRAutoLockTime ) - { - delete iCRAutoLockTime; - iCRAutoLockTime = NULL; - } - if ( iCRAutoLockStatus ) - { - delete iCRAutoLockStatus; - iCRAutoLockStatus = NULL; - } - // PuSub observers - if ( iPSAutolockState ) - { - delete iPSAutolockState; - iPSAutolockState = NULL; - } - if ( iContainer ) - { - delete iContainer; - iContainer = NULL; - } - } - -// --------------------------------------------------------------------------- -// Devicelock UI constructor reserves localized resources, configures itself -// using CenRep and FeatureManager and reserves child controls. -// --------------------------------------------------------------------------- -void CLockAppDevicelockControl::ConstructL( RWindowGroup& aWg ) - { - INFO( "CLockAppDevicelockControl::ConstructL started" ); - CLockAppBaseControl::ConstructL( ); - - // feature manager is used for determining if the phone is a slider - FeatureManager::InitializeLibL( ); - iFeatureProtocolCdma = FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ); - INFO_1("CLockAppDevicelockControl::ConstructL - iFeatureProtocolCdma: %d", iFeatureProtocolCdma); - FeatureManager::UnInitializeLib( ); - - // Cba control - iCba = CEikButtonGroupContainer::NewL( CEikButtonGroupContainer::ECba, - CEikButtonGroupContainer::EHorizontal, this, - R_KEYLOCK_SOFTKEYS_UNLOCK_EMPTY ); - - TRect screenRect; - AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect ); - iCba->SetBoundingRect( screenRect ); - iCba->MakeVisible( EFalse ); - - // Set up the status pane - CEikStatusPane* sp = iAvkonAppUi->StatusPane(); - if ( sp ) - { - // Switch the layout to show analog clock - TRAPD(err, sp->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_IDLE ) ) - ERROR(err, "CLockAppDevicelockControl::ConstructL - failed to switch status pane layout"); - if ( sp->PaneCapabilities(TUid::Uid(EEikStatusPaneUidTitle)).IsPresent( ) ) - { - // Get the title pane control from status pane - CAknTitlePane* titlePane = NULL; - TRAPD(err2, titlePane = static_cast( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle) ) ) ) - ERROR(err2, "CLockAppDevicelockControl::ConstructL - failed to get status title pane"); - if ( titlePane ) - { - // Read localized "Locked" text from resource. - HBufC* lockedString = iCoeEnv->AllocReadResourceL( R_TITLE_PANE_LOCKED ); - // Set as title pane text - titlepane takes ownership of the string - titlePane->SetText( lockedString ); - } - } - } - - INFO( "CLockAppDevicelockControl::ConstructL completed" ); - } - -void CLockAppDevicelockControl::ConnectToPhoneL( RWindowGroup& aWg ) - { - INFO( "CLockAppDevicelockControl::ConnectToPhoneL - connecting to etel server" ); - // All server connections are tried to be made KTiesToConnectServer times because - // occasional fails on connections are possible at least on some servers - TInt err( KErrGeneral); - TInt thisTry( 0); - while ( ( err = iTelServer.Connect() ) != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) - { - User::After( KTimeBeforeRetryingServerConnection ); - } - ERROR(err, "CLockAppDevicelockControl::ConnectToPhoneL - connecting to etel server"); - User::LeaveIfError( err ); - INFO_4( "%s %s (%u) iTelServerInitialized=%x -> 2 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iTelServerInitialized ); - iTelServerInitialized=2; - - - /***************************************************** - * S60 Customer / ETel - * S60 ETel API - *****************************************************/ - /***************************************************** - * S60 Customer / TSY - * Needs customer TSY implementation - *****************************************************/ - INFO( "CLockAppDevicelockControl::ConnectToPhoneL - loading TSY"); - err = iTelServer.LoadPhoneModule( KMmTsyModuleName ); - if ( err != KErrAlreadyExists ) - { - // may return also KErrAlreadyExists if some other - // is already loaded the tsy module. And that is not an error. - ERROR(err, "CLockAppDevicelockControl::ConnectToPhoneL - loading TSY"); - User::LeaveIfError( err ); - } - INFO_4( "%s %s (%u) iTelServerInitialized=%x -> 3 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iTelServerInitialized ); - iTelServerInitialized=3; - - /***************************************************** - * S60 Customer / ETel - * S60 ETel API - *****************************************************/ - INFO( "CLockAppDevicelockControl::ConnectToPhoneL - opening phone"); - RTelServer::TPhoneInfo PhoneInfo; - User::LeaveIfError( iTelServer.SetExtendedErrorGranularity( RTelServer::EErrorExtended ) ); - INFO_4( "%s %s (%u) iTelServerInitialized=%x -> 5 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iTelServerInitialized ); - iTelServerInitialized=5; - User::LeaveIfError( iTelServer.GetPhoneInfo( KPhoneIndex, PhoneInfo ) ); - INFO_4( "%s %s (%u) iTelServerInitialized=%x -> 6 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iTelServerInitialized ); - iTelServerInitialized=6; - User::LeaveIfError( iPhone.Open( iTelServer, PhoneInfo.iName ) ); - INFO_4( "%s %s (%u) iPhoneInitialized=%x -> 2 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPhoneInitialized ); - iPhoneInitialized=2; - User::LeaveIfError( iCustomPhone.Open( iPhone ) ); - INFO_4( "%s %s (%u) iCustomPhoneInitialized=%x -> 2 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iCustomPhoneInitialized ); - iCustomPhoneInitialized=2; - - INFO( "CLockAppDevicelockControl::ConnectToPhoneL - phone opened"); - - - TBool systemLocked(EFalse); - - // Set up CenRep observers - iCRAutoLockTime = CLockAppCenRepObserver::NewL(this, KCRUidSecuritySettings, KSettingsAutoLockTime); - iCRAutoLockStatus = CLockAppCenRepObserver::NewL(this, KCRUidSecuritySettings, KSettingsAutolockStatus); - - #ifndef __WINS__ - - /***************************************************** - * S60 Customer / ETel - * S60 ETel API - *****************************************************/ - - RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; - RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; - RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); - - TRequestStatus getLockInfoStatus; - iPhone.GetLockInfo( getLockInfoStatus, lockType, lockInfoPkg ); - INFO_4( "%s %s (%u) iPhoneInitialized=%x -> 3 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPhoneInitialized ); - iPhoneInitialized=3; - User::WaitForRequest( getLockInfoStatus ); - - TInt lockValue(0); - TInt cRresult = iCRAutoLockStatus->GetValue( lockValue ); - INFO_2( "CLockAppDevicelockControl::ConnectToPhoneL - CR autolockstatus=%d , res=%d", lockValue, cRresult); - TBool hiddenReset = IsHiddenReset( ); - INFO_1( "CLockAppDevicelockControl::ConnectToPhoneL - hiddenReset=%d", hiddenReset ); - if ( lockInfo.iSetting == RMobilePhone::ELockSetDisabled ) - { - INFO( "CLockAppDevicelockControl::ConnectToPhoneL - ELockSetDisabled"); - iCRAutoLockTime->SetValue( 0 ); - if ( iFeatureProtocolCdma ) - { - iCRAutoLockTime->SetKeyValue( KSettingsLockOnPowerUp, 0 ); - } - } - else - { - if ( iFeatureProtocolCdma || (hiddenReset && (lockValue == 1)) ) - { - // In CDMA, the system can stay locked on after the boot-up sequence. - INFO( "CLockAppDevicelockControl::ConnectToPhoneL - Hidden reset when locked"); - systemLocked = ETrue; - } - } - #endif //__WINS__ - - // Create devicelock UI container - INFO_1( "CLockAppDevicelockControl::ConnectToPhoneL - creating CLockAppDevicelockContainer=%d", 1 ); - iContainer = CLockAppDevicelockContainer::NewL( aWg ); - INFO_1( "CLockAppDevicelockControl::ConnectToPhoneL - creating CLockAppDevicelockContainer=%d done", 1 ); - - INFO_1( "CLockAppDevicelockControl::ConnectToPhoneL - creating DefinePubSubKeysL=%d", 1 ); - DefinePubSubKeysL( ); - INFO_1( "CLockAppDevicelockControl::ConnectToPhoneL - creating DefinePubSubKeysL=%d", 1 ); - - // The following sequence is used to validate the configuration on SCP server. - // This is needed on the first boot (initial or RFS) or if the C-drive - // has been formatted (3-button format) and Autolock is not active. -#ifdef __SAP_TERMINAL_CONTROL_FW - // This seems to be defined always. - INFO( "CLockAppDevicelockControl::ConnectToPhoneL - Validate SCP Config" ); - RSCPClient scpClient; - if ( scpClient.Connect() == KErrNone ) - { - CleanupClosePushL( scpClient ); - TInt confStatus = scpClient.CheckConfiguration( KSCPInitial ); - if ( confStatus == KErrAccessDenied ) - { -#ifndef __WINS__ - if ( ( lockInfo.iSetting == RMobilePhone::ELockSetDisabled ) ) -#else // __WINS__ - if ( ETrue ) // DOS lock is never active in WINS -#endif // __WINS__ - { - // DOS lock is not active. Note that if DOS is locked, checking the code here will - // mess up the query sequence. On initial startup DOS is not locked. - TInt finalConfStatus = scpClient.CheckConfiguration( KSCPComplete ); - if ( finalConfStatus == KErrAccessDenied ) - { -#ifdef __WINS__ - ERROR(finalConfStatus, "CLockAppDevicelockControl::ConnectToPhoneL - DOS validation FAILED in WINS!"); -#else // !__WINS__ - // The SCP server is out of sync and Autolock is not active. (c-drive formatted) - // We must ask the security code. ( Note that it is very rare that this is executed ) - INFO( "CLockAppDevicelockControl::ConnectToPhoneL - Lock setting disabled, calling setlocksetting"); - - // Wait here until the startup is complete - TInt tarmErr(KErrNone); - while ( tarmErr == KErrNone ) - { - TInt sysState; - tarmErr = RProperty::Get(KPSUidStartup, KPSGlobalSystemState, sysState); - if ((sysState == ESwStateNormalRfOn) || - (sysState == ESwStateNormalRfOff) || - (sysState == ESwStateNormalBTSap)) - { - break; - } - User::After(500000); // half a second - } - - // Just change the lock setting again to disabled to request the security code. - // Set the TARM flag so SecUi knows it should display the "login" query. - TInt tarmFlag; - TInt tRet = RProperty::Get( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag ); - if ( tRet == KErrNone ) - { - tarmFlag |= KSCPFlagResyncQuery; - tRet = RProperty::Set( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag ); - } - ERROR(tRet, "CLockAppDevicelockControl::ConnectToPhoneL - FAILED to set TARM Admin Flag" ); - - TRequestStatus setLockSettingStatus; - RMobilePhone::TMobilePhoneLockSetting lockChange = RMobilePhone::ELockSetDisabled; - iPhone.SetLockSetting( setLockSettingStatus, lockType, lockChange ); - User::WaitForRequest( setLockSettingStatus ); -#endif // __WINS__ - } - } - } - CleanupStack::PopAndDestroy(); // calls Close() on scpClient - } -#endif // __SAP_TERMINAL_CONTROL_FW - - // Set up P&S observers - iPSAutolockState = CLockAppPubSubObserver::NewL( this, KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus ); - - if ( systemLocked ) - { - INFO( "CLockAppDevicelockControl::ConnectToPhoneL - Lock system"); - INFO_4( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - iStateControl.EnableDevicelockL( EDevicelockManual ); - INFO( "CLockAppDevicelockControl::ConnectToPhoneL - Lock system. Done"); - } - - // Activity manager - iActivityManager = CUserActivityManager::NewL( CActive::EPriorityStandard ); - StartActivityMonitoringL( ); - - // Setup key pattern matcher - if ( !SetupKeyPatternsWithPolicyL( EPolicyDevicelockQuery ) ) - { - INFO( "CLockAppDevicelockControl::ConnectToPhoneL - No CenRep policy defined" ); - iKeyPattern->AddPattern( EStdKeyDevice0, 0 ); // '0' = second key code doesnt matter - } -#ifdef __WINS__ - iKeyPattern->AddPattern( EStdKeyDevice0, 0 ); // LSK + * -#endif - - INFO( "CLockAppDevicelockControl::ConstructL completed" ); - } - -// --------------------------------------------------------------------------- -// Define internal P&S autolock status key -// --------------------------------------------------------------------------- -void CLockAppDevicelockControl::DefinePubSubKeysL() - { - INFO( "CLockAppDevicelockControl::DefinePubSubKeysL" ); - - // Create the write policy. Also processes with write device data can write the value. - TSecurityPolicy writePolicy( ECapabilityWriteDeviceData ); - // Create the read policy. Also processes with read device data can read the value. - TSecurityPolicy readPolicy( ECapabilityReadDeviceData ); - - TInt ret = RProperty::Define( KPSUidSecurityUIs, - KSecurityUIsSecUIOriginatedQuery, RProperty::EInt, readPolicy, writePolicy ); - ERROR(ret, "CLockAppDevicelockControl::DefinePubSubKeysL - FAILED to define the SECUI query Flag"); - - ret = RProperty::Define( KPSUidSecurityUIs, - KSecurityUIsQueryRequestCancel, RProperty::EInt, readPolicy, writePolicy ); - ERROR(ret, "CLockAppDevicelockControl::DefinePubSubKeysL - FAILED to define the SECUI query request state Flag"); - - _LIT_SECURITY_POLICY_PASS(KReadPolicy); - _LIT_SECURITY_POLICY_C1(KWritePolicy, ECapabilityWriteDeviceData); - ret = RProperty::Define( KPSUidCoreApplicationUIs, - KCoreAppUIsAutolockStatus, RProperty::EInt, KReadPolicy, KWritePolicy); - RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOff); - if (ret != KErrAlreadyExists) - { - ERROR(ret, "CLockAppDevicelockControl::DefinePubSubKeysL - FAILED to set autolock status"); - User::LeaveIfError(ret); - } - - #ifdef __SAP_TERMINAL_CONTROL_FW - // Define the TARM admin flag. - ret = RProperty::Define( KSCPSIDAutolock, - SCP_TARM_ADMIN_FLAG_UID, RProperty::EInt, readPolicy, writePolicy ); - ERROR(ret, "CLockAppDevicelockControl::DefinePubSubKeysL - FAILED to define the TARM Admin Flag"); - #endif // __SAP_TERMINAL_CONTROL_FW - } - -// ---------------------------------------------------------- -// Checks whether we are booting from a Hidden Reset -// ---------------------------------------------------------- -TBool CLockAppDevicelockControl::IsHiddenReset( ) - { - INFO_4( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - - TBool ret( EFalse ); - TInt startupReason( ENormalStartup ); - TInt err( KErrNone); - err = RProperty::Get( KPSUidStartup, KPSStartupReason, startupReason ); - ERROR(err, "CLockAppDevicelockControl::IsHiddenReset - error getting startup reason" ); - ret = (startupReason != ENormalStartup); - INFO_1( "CLockAppDevicelockControl::IsHiddenReset = %d", ret ); - #ifdef _DEBUG - // test to simulate HiddenReset - RFs fs; - _LIT(KTestHiddenReset,"f:\\TestHiddenReset.txt"); - RFile file; - User::LeaveIfError(fs.Connect()); - err=file.Open(fs, KTestHiddenReset, EFileStreamText|EFileRead|EFileShareReadersOnly); - if(err==KErrNone) - { - INFO_4( "%s %s (%u) ??? TestHiddenReset=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - ret = ETrue; - } - file.Close(); - fs.Close(); - #endif - return ret; - } - -// ---------------------------------------------------------- -// Checks whether PIN1/UPIN is blocked -// ---------------------------------------------------------- -TBool CLockAppDevicelockControl::IsPinBlocked( ) - { - INFO( "CLockAppDevicelockControl::IsPinBlocked" ); - TBool ret( EFalse ); - RMmCustomAPI::TSecurityCodeType secCodeType; -#if defined(__PROTOCOL_WCDMA) || defined(__UPIN) - RMobilePhone::TMobilePhoneSecurityCode activePin; - iCustomPhone.GetActivePin( activePin ); - if ( activePin == RMobilePhone::ESecurityUniversalPin ) - secCodeType = RMmCustomAPI::ESecurityUniversalPin; - else - secCodeType = RMmCustomAPI::ESecurityCodePin1; -#else - secCodeType = RMmCustomAPI::ESecurityCodePin1; -#endif //(__PROTOCOL_WCDMA) || defined(__UPIN) - iCustomPhone.IsBlocked( secCodeType, ret ); - INFO_1( "CLockAppDevicelockControl::IsPinBlocked = %d", ret ); - return ret; - } - -// ---------------------------------------------------------- -// Try to get (and optionally unset) the TARM Admin Flag -// ---------------------------------------------------------- -TBool CLockAppDevicelockControl::TarmAdminFlag( TBool unSetFlag ) - { - INFO_1( "CLockAppDevicelockControl::TarmAdminFlag(unSet = %d)", unSetFlag ); - TBool ret(EFalse); -#ifdef __SAP_TERMINAL_CONTROL_FW - // Get the TARM admin flag value - TInt tarmFlag; - TInt err = RProperty::Get( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag ); - if ( err != KErrNone ) - { - ERROR(err, "CLockAppDevicelockControl::TarmAdminFlag - Failed to get TARM flag" ); - } - else - { - INFO_1( "CLockAppDevicelockControl::TarmAdminFlag - TARM flag: %d", tarmFlag ); - } - - if ( tarmFlag & KSCPFlagAdminLock ) - { - ret = ETrue; - // Unset the TARM admin flag if set - if ( unSetFlag ) - { - tarmFlag &= ~KSCPFlagAdminLock; - err = RProperty::Set( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag ); - ERROR(err, "CLockAppDevicelockControl::TarmAdminFlag - FAILED to unset TARM flag" ); - } - } -#endif // __SAP_TERMINAL_CONTROL_FW - INFO_1( "CLockAppDevicelockControl::TarmAdminFlag = %d", ret ); - return ret; - } - -// --------------------------------------------------------------------------- -// Check ETEL lock info and ask sec code if neccessary -// --------------------------------------------------------------------------- -TBool CLockAppDevicelockControl::ETelActivationAllowed( ) - { - INFO( "CLockAppDevicelockControl::ETelActivationAllowed" ); - TBool ret(EFalse); -#ifdef __WINS__ - ret = ETrue; -#else //__WINS__ - - /***************************************************** - * S60 Customer / ETel - * S60 ETel API - *****************************************************/ - - - INFO_4( "%s %s (%u) 111 value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - - // INFO_4( "%s %s (%u) iStateControl=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iStateControl ); - - INFO_4( "%s %s (%u) checking iPhoneInitialized=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - INFO_4( "%s %s (%u) iPhoneInitialized=%x -> 4 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPhoneInitialized ); - iPhoneInitialized=4; - - RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; - RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; - RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); - RMobilePhone::TMobilePhoneLockSetting lockChange(RMobilePhone::ELockSetDisabled); - - INFO_4( "%s %s (%u) before getLockInfoStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - TRequestStatus getLockInfoStatus; - INFO_4( "%s %s (%u) after getLockInfoStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - - INFO_4( "%s %s (%u) iPhoneInitialized=%x -> 5 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPhoneInitialized ); - iPhoneInitialized=5; - iPhone.GetLockInfo( getLockInfoStatus, lockType, lockInfoPkg ); - INFO_4( "%s %s (%u) iPhoneInitialized=%x -> 6 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPhoneInitialized ); - iPhoneInitialized=6; - User::WaitForRequest( getLockInfoStatus ); - - INFO_1( "CLockAppDevicelockControl::ETelActivationAllowed - GetLockInfo status: %d ", getLockInfoStatus.Int() ); - if ( getLockInfoStatus.Int( )== KErrNone ) - { - if ( lockInfo.iSetting == RMobilePhone::ELockSetDisabled ) - { - // ask code - INFO( "CLockAppDevicelockControl::ETelActivationAllowed - ETel ELockSetDisabled, Ask Code" ); - // Raise a flag to indicate that the UPIN request coming from ETEL - // has originated from SecUi and not from Engine. - RProperty::Set( KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSystemLockOriginated ); - TRequestStatus setLockSettingStatus; - lockChange = RMobilePhone::ELockSetEnabled; - iPhone.SetLockSetting( setLockSettingStatus, lockType, lockChange ); - User::WaitForRequest( setLockSettingStatus ); - INFO_1( "CLockAppDevicelockControl::ETelActivationAllowed - SetLockSetting status: %d ", setLockSettingStatus.Int() ); - // Lower the flag - RProperty::Set( KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsETelAPIOriginated ); - if (setLockSettingStatus.Int() == KErrNone) - { - ret = ETrue; - } - } - else - { - INFO( "CLockAppDevicelockControl::ETelActivationAllowed - Lock System Ok" ); - ret = ETrue; - } - } - else - { - INFO( "CLockAppDevicelockControl::ETelActivationAllowed - Error getting LockInfo - Ask code (SLS)" ); - // Raise a flag to indicate that the UPIN request coming from ETEL - // has originated from SecUi and not from Engine. - RProperty::Set( KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSystemLockOriginated ); - TRequestStatus setLockSettingStatus; - lockChange = RMobilePhone::ELockSetEnabled; - INFO_4( "%s %s (%u) iPhoneInitialized=%x -> 8 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPhoneInitialized ); - iPhoneInitialized=8; - iPhone.SetLockSetting( setLockSettingStatus, lockType, lockChange ); - INFO_4( "%s %s (%u) iPhoneInitialized=%x -> 9 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPhoneInitialized ); - iPhoneInitialized=9; - User::WaitForRequest(setLockSettingStatus); - INFO_1( "CLockAppDevicelockControl::ETelActivationAllowed - SetLockSetting status: %d ", setLockSettingStatus.Int() ); - // Lower the flag - RProperty::Set( KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsETelAPIOriginated ); - if (setLockSettingStatus.Int() == KErrNone) - { - ret = ETrue; - } - } -#endif - INFO_1( "CLockAppDevicelockControl::ETelActivationAllowed = %d", ret ); - return ret; - } - -// --------------------------------------------------------------------------- -// Check weather its allowed to activate the control -// --------------------------------------------------------------------------- -TBool CLockAppDevicelockControl::ActivationAllowedL( TDevicelockReason aReason ) - { - INFO_1( "CLockAppDevicelockControl::ActivationAllowedL aReason= %d", aReason ); - - if (aReason==ETimerLocked) - { - { // REQ 414-5466 Prevention of device lock in context of Hands Free Voice UI - TInt vuiValue = 0; - TUid KHFVuiModePSUid = { 0x102818E7 }; - enum THFVuiModePSKeys - { - EHFVuiPSModeId = 1000 - }; - TInt tRet = RProperty::Get(KHFVuiModePSUid, EHFVuiPSModeId, vuiValue); // also 0 if can't get because permissions or because doesn't exists - #if defined(_DEBUG) - INFO_4( "%s %s (%u) getting KHFVuiModePSUid+EHFVuiPSModeId=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, tRet ); - INFO_4( "%s %s (%u) vuiValue=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, vuiValue ); - #endif - if(vuiValue) - { - #if defined(_DEBUG) - RDebug::Print(_L("(LOCKAPP)CLockAppDevicelockControl::ActivationAllowedL() Voice functions active. No locking possible.")); - #endif - return EFalse; - } - } - { // if another query is displayed, the future un-lock query will crash. Don't allow time-lock in this case. - TInt secQueryStatus = ESecurityQueryUninitialized; - TInt tRet = RProperty::Get(KPSUidStartup, KStartupSecurityCodeQueryStatus, secQueryStatus); // also 0 if can't get because permissions or because doesn't exists - #if defined(_DEBUG) - INFO_4( "%s %s (%u) getting KPSUidStartup+KStartupSecurityCodeQueryStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, tRet ); - INFO_4( "%s %s (%u) secQueryStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, secQueryStatus ); - #endif - if(secQueryStatus==ESecurityQueryActive) - { - #if defined(_DEBUG) - RDebug::Print(_L("(LOCKAPP)CLockAppDevicelockControl::ActivationAllowedL() Asking some other security code. No locking possible.")); - #endif - return EFalse; - } - } - } - - TInt lightStatus=EForcedLightsUninitialized; - RProperty::Get(KPSUidCoreApplicationUIs,KLightsVTForcedLightsOn,lightStatus ); - //If display is forced on. don't lock - if(lightStatus == EForcedLightsOn ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(LOCKAPP)CLockAppDevicelockControl::ActivationAllowedL() Display is forced on deivce not locked")); - #endif - return EFalse; - } - - // first check ETEL side - and ask sec code if needed - if ( !ETelActivationAllowed() ) - { - return EFalse; - } - - if ( IsPinBlocked( ) ) - { - return EFalse; - } - - TBool ret(EFalse); - TInt sysState(0); - RProperty::Get( KPSUidStartup, KPSGlobalSystemState, sysState ); - //If NOT in CDMA the Autolock should come up only after the phone has booted up. - if ( iFeatureProtocolCdma || IsHiddenReset( ) ) - { - if ( sysState == ESwStateNormalRfOn || - sysState == ESwStateNormalRfOff || - sysState == ESwStateCriticalPhaseOK ) - { - INFO( "CLockAppDevicelockControl::ActivationAllowedL - Locked after Hidden Reset" ); - ret = ETrue; - } - } - else - { - if ( sysState == ESwStateNormalRfOn || sysState == ESwStateNormalRfOff ) - { - ret = ETrue; - } - } - - if ( IsBitFieldSet( iStateControl.EnvironmentStatus( ), KLockAppEnvPhonecallOngoing ) && !TarmAdminFlag(EFalse) ) - { - if ( aReason == EDevicelockRemote ) - { - INFO( "CLockAppDevicelockControl::ActivationAllowedL - remote lock allowed" ); - ret = ETrue; - } - } - return ret; - } - -// --------------------------------------------------------------------------- -// Check weather its allowed to deactivate the control -// --------------------------------------------------------------------------- -TBool CLockAppDevicelockControl::DeActivationAllowedL() - { - if ( iShowingSecCodeQuery ) - { - return ETrue; - } - else - { - return EFalse; - } - } - -// --------------------------------------------------------------------------- -// Set the devicelocking reason -// --------------------------------------------------------------------------- -void CLockAppDevicelockControl::SetLockingReason( TDevicelockReason aReason ) - { -#ifndef RD_REMOTELOCK - iPSAutolockState->SetKeyValue( EAutolockOn ); -#else - switch ( aReason ) - { - case EDevicelockManual: - iPSAutolockState->SetKeyValue( EManualLocked ); - break; - case EDevicelockRemote: - iPSAutolockState->SetKeyValue( ERemoteLocked ); - break; - case EDevicelockTimer: - iPSAutolockState->SetKeyValue( ETimerLocked ); - break; - default: - DoPanic( ELockIllegalState ); - } -#endif // RD_REMOTELOCK - } - -// --------------------------------------------------------------------------- -// Activate control -// --------------------------------------------------------------------------- -void CLockAppDevicelockControl::HandleActivateEventL( TUint aEnvMask ) - { - INFO_1("CLockAppDevicelockControl::HandleActivateEventL - aEnvMask: %d", aEnvMask); - - CLockAppBaseControl::HandleActivateEventL( aEnvMask ); - - if ( IsBitFieldSet( aEnvMask, KLockAppEnvScreenSaverOn ) ) - { - // if screensaver is on - capture primary keys - CapturePrimaryKeys( ETrue ); - } - // capture keys - CLockAppKeyCaptureController::CaptureKey( EStdKeyApplication0, EKeyApplication0, EKeyCaptureAllEvents ); // App key - CLockAppKeyCaptureController::CaptureKey( EStdKeyDevice2, EKeyDevice2, EKeyCaptureAllEvents ); // Power key (for lights) - CLockAppKeyCaptureController::CaptureKey( EStdKeyDevice6, EKeyDevice6, EKeyCaptureAllEvents ); // Voice key (for lights) - CLockAppKeyCaptureController::CaptureKey( EStdKeyNo, EKeyNo, EKeyCaptureAllEvents ); // End key (for Rosetta lights) - CLockAppKeyCaptureController::CaptureKey( EStdKeyDeviceF, EKeyDeviceF, EKeyCaptureAllEvents ); // switch key (for touch devices) - - SetPointerEventCapture( ETrue ); - SetKeyguardIndicatorStateL( ETrue ); - iContainer->MakeVisible( ETrue ); // maybe not needed - as its in different windowgroup - ShowCba( ETrue ); - ShowStatusPane( ETrue ); - // close task-list in case it is displayed : fast-swap window - iEikonEnv->DismissTaskList( ); - iCRAutoLockStatus->SetValue( ETrue ); - } - -// --------------------------------------------------------------------------- -// DeActivate control -// --------------------------------------------------------------------------- -void CLockAppDevicelockControl::HandleDeActivateEventL( TUint aEnvMask ) - { - INFO_1("CLockAppDevicelockControl::HandleDeActivateEventL - aEnvMask: %d", aEnvMask); - - CLockAppBaseControl::HandleDeActivateEventL( aEnvMask ); - - if ( IsBitFieldSet( aEnvMask, KLockAppEnvScreenSaverOn ) ) - { - // if screensaver is on - uncapture primary keys - CapturePrimaryKeys( EFalse ); - } - - // uncapture keys - CLockAppKeyCaptureController::ReleaseKey( EStdKeyApplication0 ); - CLockAppKeyCaptureController::ReleaseKey( EStdKeyDevice2 ); - CLockAppKeyCaptureController::ReleaseKey( EStdKeyDevice6 ); - CLockAppKeyCaptureController::ReleaseKey( EStdKeyNo ); - CLockAppKeyCaptureController::ReleaseKey( EStdKeyDeviceF ); - - SetPointerEventCapture( EFalse ); - SetKeyguardIndicatorStateL( EFalse ); - iContainer->MakeVisible( EFalse ); // maybe not needed - as its in different windowgroup - ShowCba( EFalse ); - ShowStatusPane( EFalse ); - iPSAutolockState->SetKeyValue( EAutolockOff ); - iCRAutoLockStatus->SetValue( EFalse ); - } - -// --------------------------------------------------------------------------- -// Handle environment changes (Screensaver, Telephony, etc.) -// --------------------------------------------------------------------------- -void CLockAppDevicelockControl::HandleEnvironmentChange( TUint aEnvMask, TUint aEventMask ) - { - INFO_4( "%s %s (%u) aEnvMask=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aEnvMask ); - INFO_4( "%s %s (%u) aEventMask=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aEventMask ); - - if ( IsBitFieldSet( aEventMask, KLockAppEnvScreenSaverOn ) ) - { - // screen saver state changed - CapturePrimaryKeys( IsBitFieldSet( aEnvMask, KLockAppEnvScreenSaverOn ) ); - } - if ( IsBitFieldSet( aEventMask, KLockAppEnvFPS ) ) - { - TInt lockValue=0; - iPSAutolockState->GetKeyValue( lockValue ); - INFO_4( "%s %s (%u) lockValue=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, lockValue ); - if(lockValue>EAutolockOff) // device is locked and query is not open - { - // indicate to TARM that it should not ask for password - TInt secUiOriginatedQuery(ESecurityUIsSecUIOriginatedUninitialized); - RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); - INFO_4( "%s %s (%u) secUiOriginatedQuery=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, secUiOriginatedQuery ); - RProperty::Set( KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsFpsOriginated ); - - HandleUnlockCommandL( ); - RProperty::Set( KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery ); // reset to initial - } - else // device needs to be locked. Same happens in keyguard control becasue probably this is never called - iStateControl.EnableDevicelockL( EDevicelockManual ); - } - if ( IsBitFieldSet( aEnvMask, KLockAppEnvGrip ) ) - { - INFO_4( "%s %s (%u) iShowingSecCodeQuery=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iShowingSecCodeQuery ); - if ( IsBitFieldSet( aEventMask, KLockAppEnvGrip ) ) //Grip opened - { - if(iShowingSecCodeQuery==EFalse) - { - TInt lockValue=0; - iPSAutolockState->GetKeyValue( lockValue ); - INFO_4( "%s %s (%u) lockValue=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, lockValue ); - if(lockValue>EAutolockOff) - { - // ask unlock code by sending the menu key. This works on touch? - TApaTaskList tasklist( iEikonEnv->WsSession() ); - #define KAknCapServerUid TUid::Uid( 0x10207218 ) - TApaTask capserver = tasklist.FindApp( KAknCapServerUid ); - INFO_4( "%s %s (%u) KAknCapServerUid=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, KAknCapServerUid ); - if( capserver.Exists() ) - { - INFO_4( "%s %s (%u) capserver.Exists() EStdKeyDevice0=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EStdKeyDevice0 ); - TKeyEvent key; - key.iCode = EKeyDevice0; - key.iModifiers = 0; - key.iRepeats = 0; - key.iScanCode = EStdKeyDevice0; - capserver.SendKey( key ); - } - } - } - } - else - { - if(iShowingSecCodeQuery==EFalse) - { - //the device lock query is on top - //generate cancel key event - const TInt KCancelKeyCode( 165 ); - INFO_4( "%s %s (%u) KCancelKeyCode=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, KCancelKeyCode ); - - TRawEvent rawEvent; - rawEvent.Set( TRawEvent::EKeyDown, KCancelKeyCode ); - iEikonEnv->WsSession().SimulateRawEvent( rawEvent ); - } - } - } - } - -// --------------------------------------------------------------------------- -// Handle all Central Repository observer callbacks. -// --------------------------------------------------------------------------- -void CLockAppDevicelockControl::HandleCenRepNotify(TUid /*aCenRepUid*/, TUint32 aKeyId, TInt aValue ) - { - INFO_4( "%s %s (%u) aKeyId=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aKeyId ); - INFO_4( "%s %s (%u) aValue=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aValue ); - switch ( aKeyId ) - { - case KSettingsAutoLockTime: - { - INFO_1( "CLockAppDevicelockControl::HandleCenRepNotify - KSettingsAutoLockTime = %d", aValue ); - ResetInactivityTimeout( ); - } - break; - default: - break; - } - } - -// --------------------------------------------------------------------------- -// Handle all Publish & Subscribe observer callbacks. -// --------------------------------------------------------------------------- -void CLockAppDevicelockControl::HandlePubSubNotify(TUid aPubSubUid, TUint aKeyId, TInt aValue ) - { - INFO_4( "%s %s (%u) KPSUidCoreApplicationUIs=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, KPSUidCoreApplicationUIs ); - INFO_4( "%s %s (%u) aKeyId=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aKeyId ); - INFO_4( "%s %s (%u) aValue=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aValue ); - if ( aPubSubUid == KPSUidCoreApplicationUIs ) - { - switch ( aKeyId ) - { - case KCoreAppUIsAutolockStatus: - { - INFO_1( "CLockAppDevicelockControl::HandlePubSubNotify - KCoreAppUIsAutolockStatus = %d", aValue ); - // Autolock used to react to this PubSub key - but its unsafe and - // in future API will be used, and the key will be published by Lockapp - INFO_1( "CLockAppDevicelockControl::HandlePubSubNotify - nothing done. LockApp reacts only to API = %d", aValue ); - } - break; - default: - break; - } - } - } - -// --------------------------------------------------------------------------- -// Devicelock UI key events are handled trough here. -// --------------------------------------------------------------------------- -TKeyResponse CLockAppDevicelockControl::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType ) - { - INFO_4( "%s (%u) aKeyEvent.iCode=%x aType=%x", __FILE__, __LINE__, aKeyEvent.iCode, aType ); - INFO_4( "%s %s (%u) iActive=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iActive ); - if ( iActive ) - { - if(AknLayoutUtils::PenEnabled()) - { - if(aKeyEvent.iCode == EKeyDeviceF) // any Type - { - HandleUnlockCommandL( ); - } - } - if ( aType == EEventKeyDown ) - { - if ( !iShowingSecCodeQuery ) - { - switch ( iKeyPattern->HandleKeyEvent( aKeyEvent.iScanCode ) ) - { - case EPatternPrimaryMatch: - HandleUnlockCommandL( ); - break; - default: - break; - } - } - } - } - return EKeyWasConsumed; - } - -// --------------------------------------------------------------------------- -// Handle unlock command -// --------------------------------------------------------------------------- -void CLockAppDevicelockControl::HandleUnlockCommandL( ) - { - INFO( "CLockAppDevicelockControl::HandleUnlockCommandL" ); - // inform sysap to put lights on left soft key press - SendMessageToSysAp( EEikKeyLockLightsOnRequest ); - INFO_4( "%s %s (%u) iPhoneInitialized=%x -> 10 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPhoneInitialized ); - iPhoneInitialized=10; - CSecurityHandler* handler = new (ELeave) CSecurityHandler( iPhone ); - INFO_4( "%s %s (%u) got handler=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - CleanupStack::PushL( handler ); - TSecUi::InitializeLibL( ); - INFO_4( "%s %s (%u) got TSecUi::InitializeLibL=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - iShowingSecCodeQuery = ETrue; - TRAPD(err, { - INFO_4( "%s %s (%u) before AskSecCodeInAutoLockL=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - TBool ret = handler->AskSecCodeInAutoLockL(); - INFO_4( "%s %s (%u) after AskSecCodeInAutoLockL=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ret ); - INFO_1( "CLockAppDevicelockControl::HandleUnlockCommandL - AskSecCodeInAutoLockL = %d", ret ); - if ( ret ) - { - iStateControl.DisableDevicelockL(); - } - }) - ERROR(err, "CLockAppDevicelockControl::HandleUnlockCommandL - AskSecCodeInAutoLockL"); - iShowingSecCodeQuery = EFalse; - TSecUi::UnInitializeLib( ); - CleanupStack::PopAndDestroy( handler ); - } - -// --------------------------------------------------------------------------- -// Get autolock timeout (in seconds) -// --------------------------------------------------------------------------- -TInt CLockAppDevicelockControl::GetAutoLockTimeout( ) - { - TInt timeoutInMinutes = 0; - iCRAutoLockTime->GetValue( timeoutInMinutes ); - return timeoutInMinutes * 60; - } - -// ---------------------------------------------------------- -// Starts monitoring user activity -// ---------------------------------------------------------- -void CLockAppDevicelockControl::StartActivityMonitoringL( ) - { - __ASSERT_DEBUG( iActivityManager, DoPanic(ELockIllegalState)); - if ( iActivityManager && !iActivityManager->IsActive() ) - { - TInt value = GetAutoLockTimeout( ); - INFO_1( "CLockAppDevicelockControl::StartActivityMonitoringL - %d sec", value); - if ( value ) - { - iActivityManager->Start( value, - TCallBack( HandleInactiveEventL, this ), - TCallBack( HandleActiveEventL, this ) ); - } - else - { - iActivityManager->Start( KAutoDeviceLockOff, - TCallBack(HandleInactiveEventL, this ), - TCallBack(HandleActiveEventL, this ) ); - } - } - } - -// ---------------------------------------------------------- -// Gets autolock period and starts monitoring user activity -// ---------------------------------------------------------- -void CLockAppDevicelockControl::ResetInactivityTimeout( ) - { - __ASSERT_DEBUG( iActivityManager, DoPanic(ELockIllegalState)); - if ( iActivityManager ) - { - TInt value = GetAutoLockTimeout( ); - INFO_1( "CLockAppDevicelockControl::ResetInactivityTimeout - %d sec", value); - if ( value ) - { - iActivityManager->SetInactivityTimeout( value ); - } - else - { - iActivityManager->SetInactivityTimeout( KAutoDeviceLockOff ); - } - } - } - -// ---------------------------------------------------------- -// Stop monitoring user activity. -// ---------------------------------------------------------- -void CLockAppDevicelockControl::StopActivityMonitoring( ) - { - __ASSERT_DEBUG( iActivityManager, DoPanic(ELockIllegalState)); - if ( iActivityManager ) - { - iActivityManager->Cancel( ); - } - } - -// ---------------------------------------------------------- -// Handle Active event. Called by ActivityManager -// ---------------------------------------------------------- -TInt CLockAppDevicelockControl::HandleActiveEventL(TAny* /*aPtr*/) - { - return KErrNone; - } - -// ---------------------------------------------------------- -// Handles InActive event. Called by ActivityManager -// ---------------------------------------------------------- -TInt CLockAppDevicelockControl::HandleInactiveEventL(TAny* aPtr ) - { - CLockAppDevicelockControl* devicelock = STATIC_CAST(CLockAppDevicelockControl*, aPtr); - if ( devicelock->GetAutoLockTimeout( ) ) - { - devicelock->iStateControl.EnableDevicelockL( EDevicelockTimer ); - } - return KErrNone; - } - -// --------------------------------------------------------------------------- -// Set custom status pane visible -// --------------------------------------------------------------------------- -void CLockAppDevicelockControl::ShowStatusPane( const TBool aVisible ) - { - CEikStatusPane* statuspane = iAvkonAppUi->StatusPane(); - if ( statuspane ) - { - statuspane->MakeVisible( aVisible ); - } - } - -// --------------------------------------------------------------------------- -// Handle UI commands received from the child controls -// --------------------------------------------------------------------------- -void CLockAppDevicelockControl::ProcessCommandL(TInt aCommandId) - { - INFO_1("CLockAppDevicelockControl::ProcessCommandL : %d ", aCommandId ); - } - -TInt CLockAppDevicelockControl::CountComponentControls() const - { - return 2; - } - -CCoeControl* CLockAppDevicelockControl::ComponentControl(TInt aIndex ) const - { - switch ( aIndex ) - { - case 0: - return iCba; - case 1: - return iContainer; - default: - return NULL; - } - } - -// --------------------------------------------------------------------------- -// Notification if layout changes. -// --------------------------------------------------------------------------- -void CLockAppDevicelockControl::HandleResourceChange(TInt aType ) - { - if ( aType == KEikDynamicLayoutVariantSwitch && iCba ) - { - TRect screenRect; - AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect ); - iCba->SetBoundingRect( screenRect ); - } - CCoeControl::HandleResourceChange( aType ); - } - -// END OF FILE diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockappdocument.cpp --- a/securitydialogs/lockapp/src/lockappdocument.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/* -* Copyright (c) 2007 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: LockApp application document class - * -*/ - - -#include "lockappappui.h" -#include "lockappdocument.h" - -// --------------------------------------------------------------------------- -// Standard Symbian OS construction sequence -// --------------------------------------------------------------------------- -CLockAppDocument* CLockAppDocument::NewL(CEikApplication& aApp) - { - CLockAppDocument* self = NewLC(aApp); - CleanupStack::Pop(self); - return self; - } - -// --------------------------------------------------------------------------- -// Standard Symbian OS construction sequence -// --------------------------------------------------------------------------- -CLockAppDocument* CLockAppDocument::NewLC(CEikApplication& aApp) - { - CLockAppDocument* self = new (ELeave) CLockAppDocument(aApp); - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } - -CLockAppDocument::~CLockAppDocument() - { - // no implementation required - } - -// --------------------------------------------------------------------------- -// Create the application user interface, and return a pointer to it, -// The framework takes ownership of this object. -// --------------------------------------------------------------------------- -CEikAppUi* CLockAppDocument::CreateAppUiL() - { - CEikAppUi* appUi = new (ELeave) CLockAppAppUi; - return appUi; - } - -void CLockAppDocument::ConstructL() - { - // no implementation required - } - -CLockAppDocument::CLockAppDocument( CEikApplication& aApp ) : - CAknDocument(aApp) - { - // no implementation required - } diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockappecsdetector.cpp --- a/securitydialogs/lockapp/src/lockappecsdetector.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,159 +0,0 @@ -/* -* Copyright (c) 2007 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: Provides emergency call support for keyguard/devicelock - * -*/ - - -#include "lockappecsdetector.h" -#include "lockappecsnote.h" -#include "lockapputils.h" -#include -#include - -// --------------------------------------------------------------------------- -// Standard Symbian OS construction sequence -// --------------------------------------------------------------------------- -CLockAppEcsDetector* CLockAppEcsDetector::NewL( ) - { - CLockAppEcsDetector* self = new (ELeave) CLockAppEcsDetector(); - CleanupStack::PushL( self ); - self->ConstructL( ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Standard C++ constructor -// --------------------------------------------------------------------------- -CLockAppEcsDetector::CLockAppEcsDetector( ) - { - } - -// --------------------------------------------------------------------------- -// Constructs the emergency detector and the note. -// --------------------------------------------------------------------------- -void CLockAppEcsDetector::ConstructL( ) - { - // emergency call support - iEcsDetector = CAknEcsDetector::NewL( ); - iEcsDetector->SetObserver( this ); - - // emergency call note - iEcsNote = new (ELeave) CLockAppEcsNote(); - iEcsNote->ConstructSleepingNoteL( R_AVKON_EMERGENCY_CALL_NOTE ); - iEcsNote->ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition( 0, 2 ); - - // needs to be called for ecs detector to work/receive events. - iAvkonAppUi->EventMonitor()->Enable( ETrue ); - } - -// --------------------------------------------------------------------------- -// Destructor. -// --------------------------------------------------------------------------- -CLockAppEcsDetector::~CLockAppEcsDetector( ) - { - delete iEcsDetector; - delete iEcsNote; - } - -// --------------------------------------------------------------------------- -// Detector starts/stops listening to key events if keys are locked/unlocked. -// The detector key event queue is always reseted when lock status is changed. -// --------------------------------------------------------------------------- -void CLockAppEcsDetector::HandleLockStatusChangedL( TLockStatus aLockStatus ) - { - iEcsDetector->Reset( ); - switch ( aLockStatus ) - { - case ELockNotActive: - { - iEcsDetector->CloseEventSource( ); - } - break; - case EKeyguardActive: - case EDevicelockActive: - { - iEcsDetector->ConnectToEventSource( ); - } - break; - default: - DoPanic( ELockUnknownValue ); - break; - } - } - -// --------------------------------------------------------------------------- -// The main state controller needs to know if emergency call note is -// on the screen. -// --------------------------------------------------------------------------- -TBool CLockAppEcsDetector::EcsNoteOnScreen( ) const - { - return iEcsNote->iNoteOnScreen; - } - -// --------------------------------------------------------------------------- -// From @c MAknEcsObserver.. Handles changes in emergency the emergency number -// queue (i.e. if the user has dialed emergency numbers or not). -// --------------------------------------------------------------------------- -void CLockAppEcsDetector::HandleEcsEvent( CAknEcsDetector* aEcsDetector, - CAknEcsDetector::TState aState ) - { - switch ( aState ) - { - case CAknEcsDetector::ECompleteMatchThenSendKey: - // Do nothing since note will be removed on ECallAttempted event - break; - // user has successfully dialed emergency numbers - case CAknEcsDetector::ECompleteMatch: - iEcsNote->SetEmergencyNumber( aEcsDetector->CurrentMatch( ) ); - // Tell sysAp to switch lights on - SendMessageToSysAp( EEikEcsQueryLights ); - iEcsNote->ShowNote( ); - break; - case CAknEcsDetector::EPartialMatch: - iEcsNote->SleepNote( ); - break; - case CAknEcsDetector::ECallAttempted: - iEcsNote->SleepNote( ); - break; - case CAknEcsDetector::EEmpty: - iEcsNote->SleepNote( ); - break; - case CAknEcsDetector::ENoMatch: - iEcsNote->SleepNote( ); - break; - default: - break; - } - } - -// --------------------------------------------------------------------------- -// Tests the emergency note ui. Only used for testing purposes, -// Created, because emergency detector does not work in emulator. -// --------------------------------------------------------------------------- -TInt CLockAppEcsDetector::TestEcsNote( ) - { -#ifdef _DEBUG - HandleEcsEvent( iEcsDetector, CAknEcsDetector::EEmpty ); - HandleEcsEvent( iEcsDetector, CAknEcsDetector::ENoMatch ); - HandleEcsEvent( iEcsDetector, CAknEcsDetector::EPartialMatch ); - HandleEcsEvent( iEcsDetector, CAknEcsDetector::ECompleteMatch ); - _LIT( NText, "112Test"); - iEcsNote->SetEmergencyNumber( NText ); - SendMessageToSysAp( EEikEcsQueryLights ); - iEcsNote->ShowNote( ); -#endif - return KErrNone; - } diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockappecsnote.cpp --- a/securitydialogs/lockapp/src/lockappecsnote.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +0,0 @@ -/* -* Copyright (c) 2007 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: Emergency number dialog - * -*/ - - -#include "lockappecsnote.h" -#include "lockapputils.h" -#include -#include -#include -#include // for KAknEcsMaxMatchingLength - -#include -#include - -// --------------------------------------------------------------------------- -// Standard C++ constructor -// --------------------------------------------------------------------------- -CLockAppEcsNote::CLockAppEcsNote( ) : - iNoteOnScreen(EFalse) - { - // no implementation required - } - -// --------------------------------------------------------------------------- -// Destructor. -// --------------------------------------------------------------------------- -CLockAppEcsNote::~CLockAppEcsNote( ) - { -#ifdef _GLOBAL_PRIORITY_SUPPORTED - AknGlobalPopupPriorityController::RemovePopupPriority(*this); -#endif - } - -// --------------------------------------------------------------------------- -// Emergency note is a sleeping note -// --------------------------------------------------------------------------- -void CLockAppEcsNote::ConstructSleepingNoteL(TInt aResourceId ) - { - CAknNoteDialog::ConstructSleepingDialogL( aResourceId ); -#ifdef _GLOBAL_PRIORITY_SUPPORTED - // global ui component order is handled trhoug global popup priority controller - AknGlobalPopupPriorityController::SetPopupPriorityL( *this, KGlobalWindowPriority_KeyLock ); -#endif - } - -// --------------------------------------------------------------------------- -// Show note with time out. -// --------------------------------------------------------------------------- -TInt CLockAppEcsNote::ShowNote( ) - { - ReportUserActivity( ); - iTimeoutInMicroseconds = CAknNoteDialog::EUndefinedTimeout; - iTone = CAknNoteDialog::ENoTone; - TInt error = KErrNone; - if ( !iNoteOnScreen ) - { - error = RouseSleepingDialog( ); - } - iNoteOnScreen = ETrue; - // return value not used - return error; - } - -// --------------------------------------------------------------------------- -// Hide note from screen. -// --------------------------------------------------------------------------- -void CLockAppEcsNote::SleepNote( ) - { - if ( iNoteOnScreen ) - { - ExitSleepingDialog( ); // Causes flicker to other notes if called when note is not on screen - } - iNoteOnScreen = EFalse; - } - -// --------------------------------------------------------------------------- -// Emergency dialog consumes all key events it receives. -// --------------------------------------------------------------------------- -TKeyResponse CLockAppEcsNote::OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/) - { - return EKeyWasConsumed; - } - -// --------------------------------------------------------------------------- -// Format the emergency number for the dialog text. -// --------------------------------------------------------------------------- -void CLockAppEcsNote::SetEmergencyNumber( const TDesC& aMatchedNumber ) - { - TRect mainPaneRect; - AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect ); - TAknLayoutRect popupNoteWindow; - AknLayoutUtils::TAknCbaLocation cbaLocation( AknLayoutUtils::CbaLocation( )); - TInt variety( 0); - if ( cbaLocation == AknLayoutUtils::EAknCbaLocationRight ) - { - variety = 5; - } - else - if ( cbaLocation == AknLayoutUtils::EAknCbaLocationLeft ) - { - variety = 8; - } - else - { - variety = 2; - } - - popupNoteWindow.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_note_window( variety ) ); - TAknLayoutText textRect; - textRect.LayoutText( popupNoteWindow.Rect( ), AknLayoutScalable_Avkon::popup_note_window_t5(2).LayoutLine( ) ); - - // Size of a temporary buffer that contains new lines, spaces and - // emergency number for a note. - TBuf16 number; - number.Append( '\n' ); - number.Append( '\n' ); - - TInt spaceCharWidthInPixels = textRect.Font()->CharWidthInPixels( ' ' ); - if ( spaceCharWidthInPixels < 1 ) - { - // Avoid divide by zero situation even the space char would have zero length. - spaceCharWidthInPixels = 1; - } - - TInt length = (textRect.TextRect().Width() - textRect.Font()->TextWidthInPixels(aMatchedNumber))/ spaceCharWidthInPixels; - - const TInt matchedNumberLength = aMatchedNumber.Length( ); - const TInt numberLength = number.Length( ); - const TInt numberMaxLength = number.MaxLength( ); - - if ( numberLength + length + matchedNumberLength > numberMaxLength ) - { - // To make sure that buffer overflow does not happen. - length = numberMaxLength - numberLength - matchedNumberLength; - } - for (int i = 0; i < length; i++ ) - { - number.Append( ' ' ); - } - - number.Append( aMatchedNumber ); - TRAP_IGNORE(SetTextL(number)); - } diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockappidlecontrol.cpp --- a/securitydialogs/lockapp/src/lockappidlecontrol.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,223 +0,0 @@ -/* -* Copyright (c) 2007 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: Idle (unlocked) UI - * -*/ - - -#include "lockappidlecontrol.h" -#include "lockappstatecontrolinterface.h" -#include "lockapputils.h" -#include "lockapplockednote.h" // keyguard notes -#include "lockappkeycapturecontroller.h" - -#include // general avkon resources - -#include // keyguard spesific resources - -#include // feature manager - -// from keyguard ui spesification, 6 sec. -const TInt KAknOfferKeyguardTimeout = 6000000; - -// Asterisk key code for the keylock -const TUint KStdKeyAsterisk = 42; -//const TUint KAknChineseAsterisk = 0xFF0A; - -// --------------------------------------------------------------------------- -// Standard Symbian OS construction sequence -// --------------------------------------------------------------------------- -CLockAppIdleControl* CLockAppIdleControl::NewL(MLockAppStateControl& aStateControl ) - { - CLockAppIdleControl* self = new (ELeave) CLockAppIdleControl( aStateControl ); - CleanupStack::PushL( self ); - self->ConstructL( ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Constructor passes the reference of the main state control. -// --------------------------------------------------------------------------- -CLockAppIdleControl::CLockAppIdleControl( MLockAppStateControl& aStateControl ) : - CLockAppBaseControl( aStateControl ) - { - } - -// --------------------------------------------------------------------------- -// Destructor. -// --------------------------------------------------------------------------- -CLockAppIdleControl::~CLockAppIdleControl( ) - { - delete iOfferLockNote; - } - -// --------------------------------------------------------------------------- -// Idle UI constructor reserves localized resources, configures itself -// using CenRep and FeatureManager and reserves child controls. -// --------------------------------------------------------------------------- -void CLockAppIdleControl::ConstructL( ) - { - INFO( "CLockAppIdleControl::ConstructL started" ); - CLockAppBaseControl::ConstructL( ); - - iOfferLockNote = new (ELeave) CLockAppLockedNote(this); - iOfferLockNote->ConstructSleepingNoteL( R_KEYLOCK_OFFER_LOCK_NOTE ); - iOfferLockNote->ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition( 0, 2 ); - - // Setup key pattern matcher - if ( !SetupKeyPatternsWithPolicyL( EPolicyActivateKeyguard ) ) - { - INFO( "CLockAppIdleControl::ConstructL - No CenRep policy defined" ); - iKeyPattern->AddPattern( EStdKeyDevice0, KStdKeyAsterisk ); // LSK + * - } -#ifdef __WINS__ - iKeyPattern->AddPattern( EStdKeyDevice0, EStdKeyNkpAsterisk ); // LSK + * -#endif - - INFO( "CLockAppIdleControl::ConstructL completed" ); - } - -// --------------------------------------------------------------------------- -// Offers keylock. -// --------------------------------------------------------------------------- -void CLockAppIdleControl::OfferKeyLock( ) - { - ShowNote( iOfferLockNote, (CAknNoteDialog::TTimeout)KAknOfferKeyguardTimeout, CAknNoteDialog::ENoTone ); - } - -// --------------------------------------------------------------------------- -// Cancels offering keylock. -// --------------------------------------------------------------------------- -void CLockAppIdleControl::CancelOfferKeyLock( ) - { - CancelNote( ); - } - -// --------------------------------------------------------------------------- -// Activate control -// --------------------------------------------------------------------------- -void CLockAppIdleControl::HandleActivateEventL( TUint aEnvMask ) - { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - CLockAppBaseControl::HandleActivateEventL( aEnvMask ); - } - -// --------------------------------------------------------------------------- -// DeActivate control -// --------------------------------------------------------------------------- -void CLockAppIdleControl::HandleDeActivateEventL( TUint aEnvMask ) - { - CLockAppBaseControl::HandleDeActivateEventL( aEnvMask ); - CancelOfferKeyLock( ); - } - -// --------------------------------------------------------------------------- -// Idle UI key events are handled trough here. -// --------------------------------------------------------------------------- -TKeyResponse CLockAppIdleControl::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode /*aType*/ ) - { - RDebug::Printf( "%s %s (%u) aKeyEvent.iCode=%x 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aKeyEvent.iCode, 1 ); - TKeyResponse keyResponse = EKeyWasNotConsumed; - if ( iActive ) - { - if ( iOfferLockNote->IsVisible( ) ) - { - // if keylock has been offered - switch ( aKeyEvent.iCode ) - { - case EKeyOK: - iStateControl.EnableKeyguardL( ETrue ); - keyResponse = EKeyWasConsumed; - break; - case EKeyLeftArrow: - case EKeyRightArrow: - case EKeyUpArrow: - case EKeyDownArrow: - case EKeyApplication: - keyResponse = EKeyWasConsumed; - break; - default: - break; - } - } - else - { - // keys pressed normally in idle - however keys are not captured - // this is where locking policy could be monitored to check keyguard activation - /*if ( aType == EEventKeyDown ) - { - switch ( iKeyPattern->HandleKeyEvent( aKeyEvent.iScanCode ) ) - { - case EPatternNoMatch: - case EPatternPrimaryMatch: - break; - case EPatternSecondaryMatch: - iStateControl.EnableKeyguardL( ETrue ); - keyResponse = EKeyWasConsumed; - break; - default: - break; - } - } - */ - } - } - return keyResponse; - } - -// --------------------------------------------------------------------------- -// Handle UI commands received from the child controls -// --------------------------------------------------------------------------- -void CLockAppIdleControl::ProcessCommandL(TInt aCommandId ) - { - // handle command - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - switch ( aCommandId ) - { - case EAknSoftkeyLock: - { - // user has accepted offer keyguard enquiry - lock keys - iStateControl.EnableKeyguardL( ETrue ); - } - break; - case EAknSoftkeyExit: - case KNoteCmdFocusLost: - { - // user has declined offer keyguard enquiry - cancel offer - CancelOfferKeyLock( ); - } - break; - default: - break; - } - } - -TInt CLockAppIdleControl::CountComponentControls( ) const - { - return 0; - } - -CCoeControl* CLockAppIdleControl::ComponentControl(TInt /*aIndex*/) const - { - return NULL; - } - -// --------------------------------------------------------------------------- -// Notification if layout changes. -// --------------------------------------------------------------------------- -void CLockAppIdleControl::HandleResourceChange(TInt aType ) - { - CCoeControl::HandleResourceChange( aType ); - } diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockappkeycapturecontroller.cpp --- a/securitydialogs/lockapp/src/lockappkeycapturecontroller.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,224 +0,0 @@ -/* -* Copyright (c) 2007 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: Key capture utility - * -*/ - - -// INCLUDE FILES -#include "lockappkeycapturecontroller.h" -#include - -// ================= STATIC MEMBERS ========================= - -CLockAppKeyCaptureController* CLockAppKeyCaptureController::instance = NULL; - - -// ================= STATIC FUNCTIONS ======================= - -// --------------------------------------------------------- -// Initializes the key capture utility by creating an instance of it -// --------------------------------------------------------- -CLockAppKeyCaptureController* CLockAppKeyCaptureController::InitL( RWindowGroup& aWindowGroup ) - { - if ( !instance ) - { - instance = new ( ELeave ) CLockAppKeyCaptureController( aWindowGroup ); - } - return instance; - } - -// --------------------------------------------------------- -// Destroys the key capture utility's instance -// --------------------------------------------------------- -void CLockAppKeyCaptureController::Destroy( ) - { - if ( instance ) - { - delete instance; - instance = NULL; - } - } - -// --------------------------------------------------------- -// Capture a key -// --------------------------------------------------------- -void CLockAppKeyCaptureController::CaptureKey( TUint32 aKey, TUint32 aKeyCode, TPhoneKeyCaptureType aType ) - { - RDebug::Printf( "%s %s (%u) aKey=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aKey ); - RDebug::Printf( "%s %s (%u) aKeyCode=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aKeyCode ); - RDebug::Printf( "%s %s (%u) aType=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aType ); - - if ( instance ) - { - instance->StartCapturingKey( aKey, aKeyCode, aType ); - } - } - -// --------------------------------------------------------- -// Release a key (previously captured) -// --------------------------------------------------------- -void CLockAppKeyCaptureController::ReleaseKey( TUint32 aKey ) - { - RDebug::Printf( "%s %s (%u) aKey=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aKey ); - - if ( instance ) - { - instance->StopCapturingKey( aKey ); - } - } - -// ================= INSTANCE FUNCTIONS ============================ - -// --------------------------------------------------------- -// Private default constructor -// --------------------------------------------------------- -CLockAppKeyCaptureController::CLockAppKeyCaptureController( RWindowGroup& aWindowGroup ) : - iWindowGroup( aWindowGroup) - { - } - -// --------------------------------------------------------- -// Private destructor -// --------------------------------------------------------- -CLockAppKeyCaptureController::~CLockAppKeyCaptureController( ) - { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - - // should we have any captured keys, stop capturing now - TInt capturedKeyCount = iCapturedKeys.Count( ); - for (TInt i = 0; i < capturedKeyCount; i++ ) - { - StopKeyCapture( iCapturedKeys[i] ); - } - iCapturedKeys.Close( ); - } - -// --------------------------------------------------------- -// Starts capturing a key -// --------------------------------------------------------- -void CLockAppKeyCaptureController::StartCapturingKey( TUint32 aKey, TUint32 aKeyCode, TPhoneKeyCaptureType aType ) - { - TInt32 handle = KErrNotFound; - RDebug::Printf( "%s %s (%u) aKey=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aKey ); - RDebug::Printf( "%s %s (%u) aKeyCode=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aKeyCode ); - RDebug::Printf( "%s %s (%u) aType=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aType ); - - if ( !IsKeyCaptured( aKey ) ) - { - TPhoneKeyCapture keyCapture; - keyCapture.iKey = (TStdScanCode) aKey; - keyCapture.iKeyCode = (TKeyCode) aKeyCode; - keyCapture.iHandle = 0; // set as initial value - keyCapture.iHandleForUpAndDown = 0; // set as initial value - - switch( aType ) - { - case EKeyCaptureEvent: - keyCapture.iType = EKeyCaptureEvent; - keyCapture.iHandle = iWindowGroup.CaptureKey( keyCapture.iKeyCode, 0, 0 ); - handle = keyCapture.iHandle; - break; - case EKeyCaptureUpAndDownEvents: - keyCapture.iType = EKeyCaptureUpAndDownEvents; - keyCapture.iHandleForUpAndDown = iWindowGroup.CaptureKeyUpAndDowns( keyCapture.iKey, 0, 0 ); - handle = keyCapture.iHandleForUpAndDown; - break; - default: // EKeyCaptureAllEvents - { - keyCapture.iType = EKeyCaptureAllEvents; - keyCapture.iHandle = iWindowGroup.CaptureKey( keyCapture.iKeyCode, 0, 0 ); - if ( keyCapture.iHandle >= 0 ) - { - keyCapture.iHandleForUpAndDown = iWindowGroup.CaptureKeyUpAndDowns( keyCapture.iKey, 0, 0 ); - if ( keyCapture.iHandleForUpAndDown < 0 ) - { - iWindowGroup.CancelCaptureKey( keyCapture.iHandle ); - } - handle = keyCapture.iHandleForUpAndDown; - } - break; - } - } - - RDebug::Printf( "CLockAppKeyCaptureController::StartCapturingKey - handle: 0x%08x", handle ); - - if ( handle >= 0 ) - { - if ( iCapturedKeys.Append( keyCapture )!= KErrNone ) - { - StopKeyCapture( keyCapture ); - } - } - } - } - -// --------------------------------------------------------- -// Stops capturing a key -// --------------------------------------------------------- -void CLockAppKeyCaptureController::StopCapturingKey( TUint32 aKey ) - { - RDebug::Printf( "%s %s (%u) aKey=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aKey ); - const TInt capturedKeyCount = iCapturedKeys.Count( ); - TBool foundKey = EFalse; - for (TInt i = 0; ( i < capturedKeyCount ) && !foundKey; i++ ) - { - if ( iCapturedKeys[i].iKey == aKey ) - { - foundKey = ETrue; - StopKeyCapture( iCapturedKeys[i] ); - iCapturedKeys.Remove( i ); - } - } - } - -// --------------------------------------------------------- -// May be used to ask whether a key has been set to be captured -// --------------------------------------------------------- -TBool CLockAppKeyCaptureController::IsKeyCaptured( TUint32 aKey ) const - { - RDebug::Printf( "%s %s (%u) aKey=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aKey ); - const TInt capturedKeyCount = iCapturedKeys.Count( ); - TBool isCaptured = EFalse; - for (TInt i = 0; ( i < capturedKeyCount ) && !isCaptured; i++ ) - { - isCaptured = iCapturedKeys[i].iKey == aKey; - } - return isCaptured; - } - -// --------------------------------------------------------- -// Stops capturing a key -// --------------------------------------------------------- -void CLockAppKeyCaptureController::StopKeyCapture( TPhoneKeyCapture aKeyCapture ) - { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - switch ( aKeyCapture.iType ) - { - case EKeyCaptureEvent: - iWindowGroup.CancelCaptureKey( aKeyCapture.iHandle ); - break; - case EKeyCaptureUpAndDownEvents: - iWindowGroup.CancelCaptureKeyUpAndDowns( aKeyCapture.iHandleForUpAndDown ); - break; - default: // EPhoneKeyCaptureAllEvents - { - iWindowGroup.CancelCaptureKey( aKeyCapture.iHandle ); - iWindowGroup.CancelCaptureKeyUpAndDowns( aKeyCapture.iHandleForUpAndDown ); - break; - } - } - } - -// end of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockappkeyguardcontrol.cpp --- a/securitydialogs/lockapp/src/lockappkeyguardcontrol.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,695 +0,0 @@ -/* -* Copyright (c) 2007 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: Keyguard UI - * -*/ - - -#include "lockappkeyguardcontrol.h" -#include "lockappstatecontrolinterface.h" -#include "lockappcenrepobserver.h" -#include "lockapppubsubobserver.h" -#include "lockapputils.h" -#include "lockapplockednote.h" // keyguard notes -#include "lockappkeycapturecontroller.h" - -#include // general avkon resources -#include // keyguard spesific resources -#include -#include -// this is not needed -// #include // publishing keyguard notes to secondary display -#include // feature manager -#include // keyguard soft buttons -#include - -#include "AutolockPrivateCRKeys.h" -#include -#include -#include -#include -//#include TODO remove -#include -#include -#include - -// Asterisk key's scan code for the keylock -const TUint KStdKeyAsterisk = 42; -//const TUint KAknChineseAsterisk = 0xFF0A; - -// timeout defined in keyguard ui specification custom value -// since avkon note TTimeout values don't support 1 second timeout -const TInt KKeyLockCustomShortTimeout = 1000000; - -// Auto Keyguard Off value -const TInt KAutoKeyguardOff( 60000 ); - -// Flip open value -const TInt KFlipOpen = 1; - -// Screensaver started fron idle status value -const TInt KSsStartedFromIdle = 1; - -// --------------------------------------------------------------------------- -// Standard Symbian OS construction sequence -// --------------------------------------------------------------------------- -CLockAppKeyguardControl* CLockAppKeyguardControl::NewL(MLockAppStateControl& aStateControl ) - { - CLockAppKeyguardControl* self = new (ELeave) CLockAppKeyguardControl( aStateControl ); - CleanupStack::PushL( self ); - self->ConstructL( ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Notes, cba and localized resources are freed in Keyguard UI destruction. -// --------------------------------------------------------------------------- -CLockAppKeyguardControl::~CLockAppKeyguardControl( ) - { -#ifdef RD_AUTO_KEYGUARD - if ( iActivityManager ) - { - iActivityManager->Cancel( ); - delete iActivityManager; - iActivityManager = NULL; - } - // CenRep observers - if ( iCRAutoKeyguardTime ) - { - delete iCRAutoKeyguardTime; - iCRAutoKeyguardTime = NULL; - } -#endif //RD_AUTO_KEYGUARD - if ( iCRPersistentKeyguardStatus ) - { - delete iCRPersistentKeyguardStatus; - iCRPersistentKeyguardStatus = NULL; - } - if ( iPSStartupObserver ) - { - delete iPSStartupObserver; - iPSStartupObserver = NULL; - } - // child notes - delete iConfirmationNote; - delete iLockedNote; - delete iKeypadUnlockedNote; - delete iKeypadLockedNote; - } - -// --------------------------------------------------------------------------- -// Constructor passes the reference to the main state control. -// --------------------------------------------------------------------------- -CLockAppKeyguardControl::CLockAppKeyguardControl(MLockAppStateControl& aStateControl ) : - CLockAppBaseControl(aStateControl) - { - } - -// --------------------------------------------------------------------------- -// Keyguard UI constructor reserves localized resources, configures itself -// using CenRep and FeatureManager and reserves child controls. -// --------------------------------------------------------------------------- -void CLockAppKeyguardControl::ConstructL( ) - { - INFO( "CLockAppKeyguardControl::ConstructL started" ); - CLockAppBaseControl::ConstructL( ); - - // feature manager is used for determining if the phone is a slider - TBool aFeatureKeypadNoSlider(ETrue); - FeatureManager::InitializeLibL( ); - aFeatureKeypadNoSlider = FeatureManager::FeatureSupported( KFeatureIdKeypadNoSlider ); - INFO_1("CLockAppKeyguardControl::ConstructL - aFeatureKeypadNoSlider: %d", aFeatureKeypadNoSlider); - FeatureManager::UnInitializeLib( ); - - // keyguard hardware switch support - CRepository* repository = CRepository::NewLC( KCRUidLockConf ); - TInt hardwareSupport(0); - repository->Get( KKeyguardHardwareConf, hardwareSupport ); - CleanupStack::PopAndDestroy( repository ); - iHardwareSupport = TLockHardware( hardwareSupport ); - iHardwareSupport = TLockHardware( 0 ); - - TBool touchEnabled( AknLayoutUtils::PenEnabled() ); - - // Cba control - iCba = CEikButtonGroupContainer::NewL( CEikButtonGroupContainer::ECba, - CEikButtonGroupContainer::EHorizontal, - this, - touchEnabled ? R_AVKON_SOFTKEYS_EMPTY : - R_KEYLOCK_SOFTKEYS_UNLOCK_EMPTY ); - TRect screenRect; - AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect ); - iCba->SetBoundingRect( screenRect ); - iCba->MakeVisible( EFalse ); - - // Construct Keyguard Notes - iKeypadLockedNote = new (ELeave) CLockAppLockedNote(); - iKeypadLockedNote->ConstructSleepingNoteL( touchEnabled ? R_KEYLOCK_NOTE_DISPLAY_LOCK_ON_TOUCH : - R_KEYLOCK_NOTE_LOCK_ON ); - iKeypadLockedNote->ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition( 0, 2 ); - // this is not needed - // iKeypadLockedNote->PublishDialogL( EAknKeysLockedNote ); - - iKeypadUnlockedNote = new (ELeave) CLockAppLockedNote(); - iKeypadUnlockedNote->ConstructSleepingNoteL( touchEnabled ? R_KEYLOCK_NOTE_DISPLAY_LOCK_OFF_TOUCH : - R_KEYLOCK_NOTE_LOCK_OFF ); - iKeypadUnlockedNote->ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition( 0, 2 ); - // this is not needed - // iKeypadUnlockedNote->PublishDialogL( EAknKeysReleasedNote ); - - iLockedNote = new (ELeave) CLockAppLockedNote(); - if ( touchEnabled ) - { - iLockedNote->ConstructSleepingNoteL( R_KEYLOCK_NOTE_DISPLAY_LOCKED_TOUCH ); - } - else - { - switch ( iHardwareSupport ) - { - case EKeyguardOnePositionSwitch: - case EKeyguardTwoPositionSwitch: - { - iLockedNote->ConstructSleepingNoteL( R_KEYLOCK_NOTE_KEYLOCKED_SWITCH ); - break; - } - case EKeyguardDefaultHardware: - default: - { - iLockedNote->ConstructSleepingNoteL( R_KEYLOCK_NOTE_KEYLOCKED ); - break; - } - } - } - iLockedNote->ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition( 0, 2 ); - - // These are created only if touch is not enabled, since - // currently in touch devices the keylock state is controlled - // with switch. - if ( !touchEnabled ) - { - //Note showing "Now Press *" - when user has pressed "Unlock" in locked state. - if ( aFeatureKeypadNoSlider ) - { - // for normal phones - iConfirmationNote = new (ELeave) CLockAppLockedNote(); - iConfirmationNote->ConstructSleepingNoteL( R_KEYLOCK_NOTE_UNLOCK_ASTERISK ); - } - else - { - // for special slider phones - iConfirmationNote = new (ELeave) CLockAppLockedNote(); - iConfirmationNote->ConstructSleepingNoteL( R_KEYLOCK_NOTE_UNLOCK_CONFIRM ); - } - iConfirmationNote->ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition( 0, 2 ); - - } - - - // CenRep observers - // TODO create private CR key for storing persistent keyguard state (currently in Sysap) - // iCRPersistentKeyguardStatus = CLockAppCenRepObserver::NewL ( this, KCRUidCoreApplicationUIsSysAp, KSysApKeyguardActive ); - -#ifdef RD_AUTO_KEYGUARD - iCRAutoKeyguardTime = CLockAppCenRepObserver::NewL ( this, KCRUidSecuritySettings, KSettingsAutomaticKeyguardTime ); - // Activity manager - iActivityManager = CUserActivityManager::NewL( CActive::EPriorityStandard ); - StartActivityMonitoringL( ); -#endif //RD_AUTO_KEYGUARD - - // PubSub observers - iPSStartupObserver = CLockAppPubSubObserver::NewL( this, KPSUidStartup, KPSGlobalSystemState ); - - // Setup key pattern matcher - if ( !SetupKeyPatternsWithPolicyL( EPolicyDeactivateKeyguard ) ) - { - INFO( "CLockAppKeyguardControl::ConstructL - No CenRep policy defined" ); - if ( aFeatureKeypadNoSlider ) - { - iKeyPattern->AddPattern( EStdKeyDevice0, KStdKeyAsterisk ); // LSK + * - } - else - { - iKeyPattern->AddPattern( EStdKeyDevice0, EStdKeyDevice1 ); // LSK + RSK - } - } -#ifdef __WINS__ - // In Emulator add the LSK+* pattern also. - iKeyPattern->AddPattern( EStdKeyDevice0, EStdKeyNkpAsterisk ); // LSK + * -#endif - - INFO( "CLockAppKeyguardControl::ConstructL completed" ); - } - -// --------------------------------------------------------------------------- -// Check weather its allowed to automatically lock the keys -// --------------------------------------------------------------------------- -TBool CLockAppKeyguardControl::AutoActivationAllowedL( ) - { -#ifdef RD_AUTO_KEYGUARD - TInt value = 0; - TBool flipOpen(EFalse); - RProperty::Get( KPSUidHWRM, KHWRMFlipStatus, value ); - flipOpen = (value = KFlipOpen); - INFO_1("CLockAppKeyguardControl::AutoActivationAllowedL - flipOpen: %d", flipOpen); - if ( flipOpen ) - { - CRepository* repository = CRepository::NewL( KCRUidAutolockConf ); - repository->Get( KAutoKeyLockConf, value ); - delete repository; - if ( value & KAutoKeylockFeatureIdFlipOpenDisabled ) - { - INFO( "CLockAppKeyguardControl::AutoActivationAllowedL : False because flipOpenDisabled" ); - return EFalse; - } - } - - TInt lightStatus=EForcedLightsUninitialized; - RProperty::Get(KPSUidCoreApplicationUIs,KLightsVTForcedLightsOn,lightStatus ); - INFO_1("CLockAppKeyguardControl::AutoActivationAllowedL - lightStatus: %d", lightStatus); - if ( lightStatus == EForcedLightsOn ) - { - INFO( "CLockAppKeyguardControl::AutoActivationAllowedL : False because EForcedLightsOn" ); - return EFalse; - } - - TBool keysLocked(EFalse); - TBool idle(EFalse); - TBool ongoingCall(EFalse); - TBool screenSaverOn(EFalse); - TBool screenSaverStertedFromIdle(EFalse); - - keysLocked = (iStateControl.LockStatus() != ELockNotActive); - INFO_1("CLockAppKeyguardControl::AutoActivationAllowedL - keysLocked: %d", keysLocked); - value = 0; - RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, value ); - ongoingCall = (value > EPSCTsyCallStateNone); - INFO_2("CLockAppKeyguardControl::AutoActivationAllowedL - ongoingCall: %d %d", value, ongoingCall); - value = 0; - RProperty::Get( KPSUidAiInformation, KActiveIdleState, value ); - idle = (value == EPSAiForeground); - INFO_2("CLockAppKeyguardControl::AutoActivationAllowedL - idle: %d %d", value, idle); - value = 0; - RProperty::Get( KPSUidScreenSaver, KScreenSaverOn, value ); - screenSaverOn = (value > 0); - INFO_2("CLockAppKeyguardControl::AutoActivationAllowedL - screenSaverOn: %d %d", value, screenSaverOn); - value = 0; - RProperty::Get( KPSUidScreenSaver, KScreenSaverActivatedFromIdle, value ); - screenSaverStertedFromIdle = (value == KSsStartedFromIdle); - INFO_2("CLockAppKeyguardControl::AutoActivationAllowedL - screenSaverStertedFromIdle: %d %d", value, screenSaverStertedFromIdle); - - // If a call is ongoing or idle doesnt have foreground and - // screensaver is not started from idle -> dont lock keys - if ( keysLocked || ongoingCall || (!idle && !(screenSaverOn && screenSaverStertedFromIdle)) ) - { - INFO("CLockAppKeyguardControl::AutoActivationAllowedL : False"); - return EFalse; - } -#endif //RD_AUTO_KEYGUARD - INFO("CLockAppKeyguardControl::AutoActivationAllowedL : True"); - return ETrue; - } - -// --------------------------------------------------------------------------- -// Check weather its allowed to activate the control -// --------------------------------------------------------------------------- -TBool CLockAppKeyguardControl::ActivationAllowedL( ) - { - return ETrue; - } - -// --------------------------------------------------------------------------- -// Check weather its allowed to deactivate the control -// --------------------------------------------------------------------------- -TBool CLockAppKeyguardControl::DeActivationAllowedL( ) - { - return ETrue; - } - -// --------------------------------------------------------------------------- -// Activate control -// --------------------------------------------------------------------------- -void CLockAppKeyguardControl::HandleActivateEventL( TUint aEnvMask ) - { - INFO_1("CLockAppKeyguardControl::HandleActivateEventL - aEnvMask: %x", aEnvMask); - - CLockAppBaseControl::HandleActivateEventL( aEnvMask ); - - if ( IsBitFieldSet( aEnvMask, KLockAppEnvScreenSaverOn ) ) - { - // if screensaver is on - capture primary keys - CapturePrimaryKeys( ETrue ); - } - - // capture keys - CLockAppKeyCaptureController::CaptureKey( EStdKeyApplication0, EKeyApplication0, EKeyCaptureAllEvents ); // App key - CLockAppKeyCaptureController::CaptureKey( EStdKeyDevice2, EKeyDevice2, EKeyCaptureAllEvents ); // Power key (for lights) - CLockAppKeyCaptureController::CaptureKey( EStdKeyDevice6, EKeyDevice6, EKeyCaptureAllEvents ); // Voice key (for lights) - CLockAppKeyCaptureController::CaptureKey( EStdKeyNo, EKeyNo, EKeyCaptureAllEvents ); // End key (for Rosetta lights) - - SetPointerEventCapture( ETrue ); - SetKeyguardIndicatorStateL( ETrue ); - ShowCba( ETrue ); - // close task-list in case it is displayed : fast-swap window - iEikonEnv->DismissTaskList( ); - if ( iCba ) - { - TBool areWeInIdleState = CEikStatusPaneBase::Current()->PaneCapabilities(TUid::Uid(EEikStatusPaneUidClock)).IsInCurrentLayout( ); - if ( areWeInIdleState ) - { - (static_cast(iCba->ButtonGroup()))->SetSkinBackgroundId( KAknsIIDQsnBgAreaControlIdle ); - } - else - { - (static_cast(iCba->ButtonGroup()))->SetSkinBackgroundId( KAknsIIDQsnBgAreaControl ); - } - } - - if ( iCRPersistentKeyguardStatus ) - { - iCRPersistentKeyguardStatus->SetValue( 1 ); - } - } - -// --------------------------------------------------------------------------- -// DeActivate control -// --------------------------------------------------------------------------- -void CLockAppKeyguardControl::HandleDeActivateEventL( TUint aEnvMask ) - { - INFO_1("CLockAppKeyguardControl::HandleDeActivateEventL - aEnvMask: 0x%x", aEnvMask); - - CLockAppBaseControl::HandleDeActivateEventL( aEnvMask ); - - if ( IsBitFieldSet( aEnvMask, KLockAppEnvScreenSaverOn ) ) - { - // if screensaver is on - uncapture primary keys - CapturePrimaryKeys( EFalse ); - } - - // phonecall or not - uncapture keys anyway - CLockAppKeyCaptureController::ReleaseKey( EStdKeyApplication0 ); - CLockAppKeyCaptureController::ReleaseKey( EStdKeyDevice2 ); - CLockAppKeyCaptureController::ReleaseKey( EStdKeyDevice6 ); - CLockAppKeyCaptureController::ReleaseKey( EStdKeyNo ); - - SetPointerEventCapture( EFalse ); - SetKeyguardIndicatorStateL( EFalse ); - ShowCba( EFalse ); - - if ( iCRPersistentKeyguardStatus ) - { - iCRPersistentKeyguardStatus->SetValue( 0 ); - } - } - -// --------------------------------------------------------------------------- -// Handle environment changes (Screensaver, Telephony, etc.) -// --------------------------------------------------------------------------- -void CLockAppKeyguardControl::HandleEnvironmentChange( TUint aEnvMask, TUint aEventMask ) - { - if ( IsBitFieldSet( aEventMask, KLockAppEnvScreenSaverOn ) ) - { - // screen saver state changed - CapturePrimaryKeys( IsBitFieldSet( aEnvMask, KLockAppEnvScreenSaverOn ) ); - } - if ( IsBitFieldSet( aEventMask, KLockAppEnvFPS ) ) - { - // iStateControl.DisableKeyguardL( ETrue ); - // iStateControl.LockStatus() != ELockNotActive // no need to check, because keyguard will catch fingerprint only if not locked - iStateControl.EnableDevicelockL( EDevicelockManual ); - } - } - -// --------------------------------------------------------------------------- -// Inform the user that keys are locked (i.e. "Please press LSK+'*' to unlock). -// --------------------------------------------------------------------------- -void CLockAppKeyguardControl::DisplayLockedNote( ) - { - ShowNote( iLockedNote, CAknNoteDialog::ELongTimeout, CAknNoteDialog::ENoTone ); - } - -// --------------------------------------------------------------------------- -// Handle all Central Repository observer callbacks. -// --------------------------------------------------------------------------- -void CLockAppKeyguardControl::HandleCenRepNotify(TUid aCenRepUid, TUint32 aKeyId, TInt aValue ) - { - if ( aCenRepUid == KCRUidSecuritySettings ) - { - switch ( aKeyId ) - { - case KSettingsAutomaticKeyguardTime: - { - INFO_1( "CLockAppKeyguardControl::HandleCenRepNotify - KSettingsAutomaticKeyguardTime = %d", aValue ); - ResetInactivityTimeout( ); - } - break; - default: - break; - } - } - } - -// --------------------------------------------------------------------------- -// Handle all Publish & Subscribe observer callbacks. -// --------------------------------------------------------------------------- -void CLockAppKeyguardControl::HandlePubSubNotify(TUid aPubSubUid, TUint aKeyId, TInt aValue ) - { - if ( aPubSubUid == KPSUidStartup ) - { - switch ( aKeyId ) - { - case KPSGlobalSystemState: - { - // In case of unexpected reset (e.g. hidden boot) the keylock must be enabled silently. - if ( !iAlreadyNormalState && (aValue == ESwStateNormalRfOn || aValue == ESwStateNormalRfOff) ) - { - iAlreadyNormalState = ETrue; - TInt keylockWasEnabled = 0; - if ( iCRPersistentKeyguardStatus ) - { - iCRPersistentKeyguardStatus->GetValue( keylockWasEnabled ); - if ( keylockWasEnabled ) - { - TRAPD(err, iStateControl.EnableKeyguardL( EFalse )); - ERROR(err, "CLockAppKeyguardControl::HandlePubSubNotify - EnableKeyguardL"); - } - } - } - } - break; - default: - break; - } - } - INFO_3( "CLockAppKeyguardControl::HandlePubSubNotify %x %x = %x", aPubSubUid.iUid, aKeyId, aValue ); - } - -// --------------------------------------------------------------------------- -// Show that keys are locked. -// --------------------------------------------------------------------------- -void CLockAppKeyguardControl::DisplayKeysLockedNote( ) - { - ShowNote( iKeypadLockedNote, KKeyLockCustomShortTimeout, CAknNoteDialog::ENoTone ); - } - -// --------------------------------------------------------------------------- -// Show that keys are unlocked. -// --------------------------------------------------------------------------- -void CLockAppKeyguardControl::DisplayKeysActiveNote( ) - { - ShowNote( iKeypadUnlockedNote, KKeyLockCustomShortTimeout, CAknNoteDialog::ENoTone ); - } - -// --------------------------------------------------------------------------- -// Show confirmation note when user has pressed "Unlock". -// --------------------------------------------------------------------------- -void CLockAppKeyguardControl::DisplayConfirmationNote( ) - { - ShowNote( iConfirmationNote, CAknNoteDialog::EShortTimeout, CAknNoteDialog::EConfirmationTone ); - // inform sysap to put lights on left soft key press - SendMessageToSysAp( EEikKeyLockLightsOnRequest ); - } - -// --------------------------------------------------------------------------- -// Keyguard UI key events are handled trough here. -// --------------------------------------------------------------------------- -TKeyResponse CLockAppKeyguardControl::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType ) - { - - INFO_4( "%s %s (%u) iActive=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iActive ); - INFO_4( "%s (%u) aKeyEvent.iCode=%x aType=%x", __FILE__, __LINE__, aKeyEvent.iCode, aType ); - - if ( iActive ) - { - if(AknLayoutUtils::PenEnabled()) - { - if(aKeyEvent.iCode == EKeyDeviceF) // any Type - { - iStateControl.DisableKeyguardL( ETrue ); - } - } - if ( aType == EEventKeyDown ) - { - switch ( iKeyPattern->HandleKeyEvent( aKeyEvent.iScanCode ) ) - { - case EPatternNoMatch: - DisplayLockedNote( ); - break; - case EPatternPrimaryMatch: - DisplayConfirmationNote( ); - break; - case EPatternSecondaryMatch: - iStateControl.DisableKeyguardL( ETrue ); - break; - default: - INFO_4( "%s %s (%u) default=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - break; - } - } - } - return EKeyWasConsumed; - } - -// --------------------------------------------------------------------------- -// Get autokeyguard timeout (in seconds) -// @return 0 means Off -// --------------------------------------------------------------------------- -TInt CLockAppKeyguardControl::GetAutoKeyguardTimeout( ) - { - TInt timeoutInSeconds( 0 ); -#ifdef RD_AUTO_KEYGUARD - iCRAutoKeyguardTime->GetValue( timeoutInSeconds ); -#endif //RD_AUTO_KEYGUARD - return timeoutInSeconds; - } - -// ---------------------------------------------------------- -// Starts monitoring user activity -// ---------------------------------------------------------- -void CLockAppKeyguardControl::StartActivityMonitoringL( ) - { -#ifdef RD_AUTO_KEYGUARD - __ASSERT_DEBUG( iActivityManager, DoPanic(ELockIllegalState)); - if ( iActivityManager && !iActivityManager->IsActive() ) - { - TInt value = GetAutoKeyguardTimeout( ); - INFO_1( "CLockAppKeyguardControl::StartActivityMonitoringL - %d sec", value); - if ( value ) - { - iActivityManager->Start( value, - TCallBack( HandleInactiveEventL, this ), - TCallBack( HandleActiveEventL, this ) ); - } - else - { - iActivityManager->Start( KAutoKeyguardOff, - TCallBack( HandleInactiveEventL, this ), - TCallBack( HandleActiveEventL, this ) ); - } - } -#endif //RD_AUTO_KEYGUARD - } - -// ---------------------------------------------------------- -// Gets keyguard period and starts monitoring user activity -// ---------------------------------------------------------- -void CLockAppKeyguardControl::ResetInactivityTimeout( ) - { -#ifdef RD_AUTO_KEYGUARD - __ASSERT_DEBUG( iActivityManager, DoPanic(ELockIllegalState)); - if ( iActivityManager ) - { - TInt value = GetAutoKeyguardTimeout( ); - INFO_1( "CLockAppKeyguardControl::ResetInactivityTimeout - %d sec", value); - if ( value ) - { - iActivityManager->SetInactivityTimeout( value ); - } - else - { - iActivityManager->SetInactivityTimeout( KAutoKeyguardOff ); - } - } -#endif //RD_AUTO_KEYGUARD - } - -// ---------------------------------------------------------- -// Stop monitoring user activity. -// ---------------------------------------------------------- -void CLockAppKeyguardControl::StopActivityMonitoring( ) - { -#ifdef RD_AUTO_KEYGUARD - if ( iActivityManager ) - { - iActivityManager->Cancel( ); - } -#endif //RD_AUTO_KEYGUARD - } - -// ---------------------------------------------------------- -// Handle Active event. Called by ActivityManager -// ---------------------------------------------------------- -TInt CLockAppKeyguardControl::HandleActiveEventL(TAny* /*aPtr*/) - { - return KErrNone; - } - -// ---------------------------------------------------------- -// Handles InActive event. Called by ActivityManager -// ---------------------------------------------------------- -TInt CLockAppKeyguardControl::HandleInactiveEventL(TAny* aPtr ) - { -#ifdef RD_AUTO_KEYGUARD - CLockAppKeyguardControl* keyguard = STATIC_CAST(CLockAppKeyguardControl*, aPtr); - if ( keyguard->GetAutoKeyguardTimeout( ) && keyguard->AutoActivationAllowedL( ) ) - { - keyguard->iStateControl.EnableKeyguardL( EFalse ); - } -#endif //RD_AUTO_KEYGUARD - return KErrNone; - } - -// --------------------------------------------------------------------------- -// Handle UI commands received from the child controls -// --------------------------------------------------------------------------- -void CLockAppKeyguardControl::ProcessCommandL( TInt aCommandId ) - { - INFO_1("CLockAppKeyguardControl::ProcessCommandL : %d ", aCommandId ); - } - -TInt CLockAppKeyguardControl::CountComponentControls( ) const - { - return 1; - } - -CCoeControl* CLockAppKeyguardControl::ComponentControl(TInt /*aIndex*/) const - { - return iCba; - } - -// --------------------------------------------------------------------------- -// Notification if layout changes. -// --------------------------------------------------------------------------- -void CLockAppKeyguardControl::HandleResourceChange(TInt aType ) - { - if ( aType == KEikDynamicLayoutVariantSwitch && iCba ) - { - TRect screenRect; - AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect ); - iCba->SetBoundingRect( screenRect ); - } - CCoeControl::HandleResourceChange( aType ); - } - -// END OF FILE diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockappkeypattern.cpp --- a/securitydialogs/lockapp/src/lockappkeypattern.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,281 +0,0 @@ -/* -* Copyright (c) 2007 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: Key pattern matching component. - * -*/ - - -#include "lockapptrace.h" -#include "lockappkeypattern.h" - -const TInt KDefaultTimeout = 2000000; - -// --------------------------------------------------------------------------- -// Standard two-phased construction -// --------------------------------------------------------------------------- -CLockAppKeyPattern* CLockAppKeyPattern::NewL( ) - { - CLockAppKeyPattern *self = new ( ELeave ) CLockAppKeyPattern(); - CleanupStack::PushL( self ); - self->ConstructL( ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Default C++ constructor -// --------------------------------------------------------------------------- -CLockAppKeyPattern::CLockAppKeyPattern( ) : - iKeyTimeOut( KDefaultTimeout ), - iState( EPatternNoMatch ), - iEnabled ( ETrue ), - iHasPatterns( EFalse ) - { - // no implementation required - } - -// --------------------------------------------------------------------------- -// Key pattern construction -// --------------------------------------------------------------------------- -void CLockAppKeyPattern::ConstructL( ) - { - iKeyTimer = CPeriodic::NewL( CActive::EPriorityUserInput ); - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -CLockAppKeyPattern::~CLockAppKeyPattern( ) - { - ClearPatterns( ); - // timer between key presses is cancelled - if ( iKeyTimer ) - { - iKeyTimer->Cancel( ); - delete iKeyTimer; - } - } - -// --------------------------------------------------------------------------- -// Gets the enabled state. -// --------------------------------------------------------------------------- -TBool CLockAppKeyPattern::IsEnabled( ) - { - return iEnabled; - } - -// --------------------------------------------------------------------------- -// Sets the enabled state. -// --------------------------------------------------------------------------- -void CLockAppKeyPattern::SetEnabled(TBool aEnabled ) - { - iEnabled = aEnabled; - } - -// --------------------------------------------------------------------------- -// Gets the primary key timeout. -// --------------------------------------------------------------------------- -TUint CLockAppKeyPattern::GetKeyTimeOut( ) - { - return iKeyTimeOut; - } - -// --------------------------------------------------------------------------- -// Sets the primary key timeout. -// --------------------------------------------------------------------------- -void CLockAppKeyPattern::SetKeyTimeOut(TUint aTimeOut ) - { - iKeyTimeOut = aTimeOut; - } - -// --------------------------------------------------------------------------- -// Add new key combination -// --------------------------------------------------------------------------- -TInt CLockAppKeyPattern::AddPattern( TUint32 aPrimaryKey, TUint32 aSecondaryKey ) - { - TInt err(KErrNone); - iPrimaryKeys.Append( aPrimaryKey ); - iSecondaryKeys.Append( aSecondaryKey ); - iHasPatterns = ETrue; - return err; - } - -// --------------------------------------------------------------------------- -// Get key combination -// --------------------------------------------------------------------------- -TInt CLockAppKeyPattern::GetPattern(TInt aIndex, TUint32& aPrimaryKey, TUint32& aSecondaryKey ) - { - TInt err( KErrNone); - if ( iHasPatterns && aIndex < iPrimaryKeys.Count( )&& aIndex < iSecondaryKeys.Count( ) ) - { - aPrimaryKey = iPrimaryKeys[aIndex]; - aSecondaryKey = iSecondaryKeys[aIndex]; - } - else - { - err = KErrNotFound; - } - return err; - } - -// --------------------------------------------------------------------------- -// Returns true if the key pattern matcher has been initialized -// --------------------------------------------------------------------------- -TBool CLockAppKeyPattern::HasPatterns( ) - { - return (iHasPatterns && iPrimaryKeys.Count() > 0 && iSecondaryKeys.Count() > 0); - } - -// --------------------------------------------------------------------------- -// Clear all key combinations -// --------------------------------------------------------------------------- -TInt CLockAppKeyPattern::ClearPatterns( ) - { - TInt err( KErrNone); - if ( iHasPatterns ) - { - iPrimaryKeys.Reset( ); - iSecondaryKeys.Reset( ); - iWaitingKeys.Reset( ); - iHasPatterns = EFalse; - // cancel the timer - iKeyTimer->Cancel( ); - } - return err; - } - -// --------------------------------------------------------------------------- -// Receives keys and checks whether they match any primary+secondary key combination -// --------------------------------------------------------------------------- -TPatternState CLockAppKeyPattern::HandleKeyEvent( TUint32 aKey ) - { - if ( iEnabled ) - { - if ( iHasPatterns ) - { - switch (iState) - { - case EPatternNoMatch: - case EPatternSecondaryMatch: - { - if ( iPrimaryKeys.Find( aKey ) != KErrNotFound ) - { - HandlePrimaryKeyEvent( aKey ); - } - else - { - HandleOtherKeyEvent(); - } - } - break; - case EPatternPrimaryMatch: - { - if ( iWaitingKeys.Find( aKey ) != KErrNotFound ) - { - HandleSecondaryKeyEvent(); - } - else - { - if ( iPrimaryKeys.Find( aKey ) != KErrNotFound ) - { - HandlePrimaryKeyEvent( aKey ); - } - else - { - HandleOtherKeyEvent(); - } - } - } - break; - default: - break; - } - } - else - { - return EPatternNotInitialized; - } - } - else - { - return EPatternNotEnabled; - } - - return iState; - } - -// --------------------------------------------------------------------------- -// Handles primary key events -// --------------------------------------------------------------------------- -void CLockAppKeyPattern::HandlePrimaryKeyEvent( TUint32 aKey ) - { - // cancel the timer - iKeyTimer->Cancel( ); - // clear the waiting keys - iWaitingKeys.Reset( ); - // add those secondary keys to the waiting keys, which have the same primary key - for (TInt i( 0); i < iPrimaryKeys.Count( ); i++ ) - { - if ( iPrimaryKeys[i] == aKey && i < iSecondaryKeys.Count( ) ) - { - iWaitingKeys.Append( iSecondaryKeys[i] ); - } - } - - // start timer for primary key timeout - iKeyTimer->Start( iKeyTimeOut, iKeyTimeOut, TCallBack( HandleKeyTimerTimeout, this ) ); - - // set the state - iState = EPatternPrimaryMatch; - } - -// --------------------------------------------------------------------------- -// Handles secondary key events -// --------------------------------------------------------------------------- -void CLockAppKeyPattern::HandleSecondaryKeyEvent( ) - { - // cancel the timer - iKeyTimer->Cancel( ); - // clear the waiting keys - iWaitingKeys.Reset( ); - // set the state - iState = EPatternSecondaryMatch; - } - -// --------------------------------------------------------------------------- -// Handles other key events -// --------------------------------------------------------------------------- -void CLockAppKeyPattern::HandleOtherKeyEvent( ) - { - // cancel the timer - iKeyTimer->Cancel( ); - // clear the waiting keys - iWaitingKeys.Reset( ); - // set the state - iState = EPatternNoMatch; - } - -// --------------------------------------------------------------------------- -// A call back to the key pattern timer, the allowed time window for pressing -// the secondary key to get a match has passed. -// --------------------------------------------------------------------------- -TInt CLockAppKeyPattern::HandleKeyTimerTimeout( TAny* aSelf ) - { - CLockAppKeyPattern* self = reinterpret_cast< CLockAppKeyPattern* >( aSelf ); - // reset the state - self->HandleOtherKeyEvent( ); - return KErrNone; - } - -// End of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockapplockednote.cpp --- a/securitydialogs/lockapp/src/lockapplockednote.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 2007 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: Sleeping note with timeout and a reference flag that informs - * the parent when the note is visible - * -*/ - - -#include "lockapplockednote.h" - -// --------------------------------------------------------------------------- -// Construction passes the parent implementing command observer interface -// and a reference to variable that is true if note with timeout is shown, -// false if not -// --------------------------------------------------------------------------- -CLockAppLockedNote::CLockAppLockedNote( MEikCommandObserver* aCommandObserver ) : - CLockAppSleepingNote(aCommandObserver) - { - // no implementation required - } - -// --------------------------------------------------------------------------- -// In destruction set reference value (is note shown) to not true. -// --------------------------------------------------------------------------- -CLockAppLockedNote::~CLockAppLockedNote( ) - { - } - -// --------------------------------------------------------------------------- -// Method to cancel note from screen. -// --------------------------------------------------------------------------- -void CLockAppLockedNote::CancelNote( ) - { - ExitSleepingDialog( ); - } - -// --------------------------------------------------------------------------- -// Inform the command observer (parent) about the focus lost event. -// --------------------------------------------------------------------------- -void CLockAppLockedNote::FocusChanged( TDrawNow /*aDrawNow*/) - { - if ( !IsFocused( ) && iCommandObserver ) - { - TRAP_IGNORE(iCommandObserver->ProcessCommandL(KNoteCmdFocusLost)) - } - } diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockappobserverlist.cpp --- a/securitydialogs/lockapp/src/lockappobserverlist.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -/* -* Copyright (c) 2007 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: Lock App internal state control - * -*/ - - -#include "lockappstatecontrol.h" -#include "lockappstatepublisher.h" -#include "lockappkeyguardcontrol.h" -#include "lockapputils.h" -#include "lockappecsdetector.h" - -const TInt KLockAppObserverListGranularity = 4; - -// --------------------------------------------------------------------------- -// Standard C++ constructor -// --------------------------------------------------------------------------- -CLockAppObserverList::CLockAppObserverList( ) - { - // no implementation required - } - -// --------------------------------------------------------------------------- -// Destroys the observer list and all existing observers. -// --------------------------------------------------------------------------- -CLockAppObserverList::~CLockAppObserverList( ) - { - if ( iObserverList ) - { - TInt count = iObserverList->Count( ); - for (TInt index=0; indexReset( ); - delete iObserverList; - } - } - -// --------------------------------------------------------------------------- -// Adds lock state observer to the observer list. -// --------------------------------------------------------------------------- -void CLockAppObserverList::AddObserverL( MLockAppStateObserver* aObserver ) - { - if ( aObserver ) - { - TBool found(EFalse); - // check that the observer has not been added before - TInt count = iObserverList->Count( ); - for ( TInt index=0; indexAppendL( aObserver ); - } - } - } - -// --------------------------------------------------------------------------- -// Removes lock state observer from the observer list. -// --------------------------------------------------------------------------- -void CLockAppObserverList::RemoveObserver( MLockAppStateObserver* aObserver ) - { - if ( aObserver ) - { - TInt count = iObserverList->Count( ); - for ( TInt index=0; indexRemove( index ); - return; - } - } - } - } - -// --------------------------------------------------------------------------- -// Constructs the observer list. -// --------------------------------------------------------------------------- -void CLockAppObserverList::BaseConstructL( ) - { - // create observer list - iObserverList = new (ELeave) RPointerArray(KLockAppObserverListGranularity); - } - -// --------------------------------------------------------------------------- -// Not implemented, meant for derived classes -// --------------------------------------------------------------------------- -void CLockAppObserverList::HandleLockStatusChangedL( TLockStatus /*aLockStatus*/) - { - } - -// --------------------------------------------------------------------------- -// Informs observers that the lock state has changed. -// --------------------------------------------------------------------------- -void CLockAppObserverList::PostStatusChangeL( TLockStatus aStatusChange ) - { - // first inform the main control - HandleLockStatusChangedL( aStatusChange ); - - // for child observers - TInt count = iObserverList->Count( ); - for ( TInt index=count-1; index>=0; index-- ) - { - //TRAP_IGNORE - ((*iObserverList)[index])->HandleLockStatusChangedL( aStatusChange ); - } - } diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockapppubsubobserver.cpp --- a/securitydialogs/lockapp/src/lockapppubsubobserver.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,146 +0,0 @@ -/* -* Copyright (c) 2007 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: Publish & Subscribe key observer - * -*/ - - -#include "lockapppubsubobserver.h" -#include "lockapputils.h" - -// --------------------------------------------------------------------------- -// Two-phased constructor. -// --------------------------------------------------------------------------- -CLockAppPubSubObserver* CLockAppPubSubObserver::NewL(MLockAppObserverInterface* aObserver, - TUid aPubSubUid, TUint32 aKeyId ) - { - CLockAppPubSubObserver* self = new (ELeave) CLockAppPubSubObserver(aObserver, aPubSubUid, aKeyId); - CleanupStack::PushL( self ); - self->ConstructL( ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// C++ default constructor -// --------------------------------------------------------------------------- -CLockAppPubSubObserver::CLockAppPubSubObserver(MLockAppObserverInterface* aObserver, - TUid aPubSubUid, TUint32 aKeyId ) : - CActive( 0 ), - iObserver( aObserver ), - iPubSubUid( aPubSubUid ), - iKeyId( aKeyId ), - iValue( NULL ) - { - } - -// --------------------------------------------------------------------------- -// Destructor -// --------------------------------------------------------------------------- -CLockAppPubSubObserver::~CLockAppPubSubObserver( ) - { - Cancel( ); - iProperty.Close( ); - } - -// --------------------------------------------------------------------------- -// Symbian OS default constructor -// --------------------------------------------------------------------------- -void CLockAppPubSubObserver::ConstructL( ) - { - // Add this active object to the scheduler. - CActiveScheduler::Add( this ); - TInt err = iProperty.Attach( iPubSubUid, iKeyId ); - ERROR_2(err, "CLockAppPubSubObserver::ConstructL - Property(%d,%d) attach", iPubSubUid, iKeyId); - User::LeaveIfError( err ); - Start( ); - } - -// --------------------------------------------------------------------------- -// Starts listening -// --------------------------------------------------------------------------- -TInt CLockAppPubSubObserver::Start( ) - { - if ( !IsActive( ) ) - { - iStatus = KRequestPending; - iProperty.Subscribe( iStatus ); - SetActive( ); - return KErrNone; - } - else - { - return KErrInUse; - } - } - -// --------------------------------------------------------------------------- -// Stops listening -// --------------------------------------------------------------------------- -void CLockAppPubSubObserver::Stop( ) - { - if ( IsActive( ) ) - { - Cancel( ); - iProperty.Cancel( ); - } - } - -// --------------------------------------------------------------------------- -// Gets value of the key from P&S. -// --------------------------------------------------------------------------- -TInt CLockAppPubSubObserver::GetKeyValue(TInt& aValue ) - { - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - return iProperty.Get( aValue ); - } - -// --------------------------------------------------------------------------- -// Sets a value for the key in P&S. -// --------------------------------------------------------------------------- -TInt CLockAppPubSubObserver::SetKeyValue(TInt aValue ) - { - RDebug::Printf( "%s %s (%u) aValue=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aValue ); - return iProperty.Set( aValue ); - } - -// --------------------------------------------------------------------------- -// CLockAppPubSubObserver::RunL() -// --------------------------------------------------------------------------- -void CLockAppPubSubObserver::RunL( ) - { - TInt value( NULL); - iProperty.Get( value ); - if ( iValue != value ) - { - // on value change - iValue = value; - if ( iObserver ) - { - iObserver->HandlePubSubNotify( iPubSubUid, iKeyId, iValue ); - } - } - // re-subscribe to events - Start( ); - } - -// --------------------------------------------------------------------------- -// Cancels event listening -// --------------------------------------------------------------------------- -void CLockAppPubSubObserver::DoCancel( ) - { - iProperty.Cancel( ); - } - -// End of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockappserver.cpp --- a/securitydialogs/lockapp/src/lockappserver.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* -* Copyright (c) 2007 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: Server implementation that responds to client API in lockclient - * -*/ - - -#include "lockappserver.h" -#include "lockappsession.h" -#include -#include - -// --------------------------------------------------------------------------- -// Two-phased constructor. -// --------------------------------------------------------------------------- -CLockAppServer* CLockAppServer::NewL( const TDesC& aFixedServerName ) - { - - CLockAppServer* self = new (ELeave) CLockAppServer(); - CleanupStack::PushL( self ); - self->SetPriority( EActivePriorityIpcEventsHigh ); - self->ConstructL( aFixedServerName ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Constructor. -// --------------------------------------------------------------------------- -CLockAppServer::CLockAppServer( ) - { - - // no implementation required - } - -// --------------------------------------------------------------------------- -// From @c CApaAppServer. Creates LockApp Session, only one type of -// service is supported by the server. -// --------------------------------------------------------------------------- -CApaAppServiceBase* CLockAppServer::CreateServiceL( TUid aServiceType ) const - { - - // only one service is offered through server - if ( aServiceType == KLockAppServiceUid ) - { - return new (ELeave) CLockAppSession(); - } - else - { - return CApaAppServer::CreateServiceL( aServiceType ); - } - } - -// --------------------------------------------------------------------------- -// From @c CApaAppServer. Creates a new client session, version -// numbering not supported. -// --------------------------------------------------------------------------- -CSession2* CLockAppServer::NewSessionL( const TVersion&, const RMessage2& ) const - { - - return new (ELeave) CLockAppSession(); - } diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockappsession.cpp --- a/securitydialogs/lockapp/src/lockappsession.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,236 +0,0 @@ -/* -* Copyright (c) 2007 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: LockApp server session requested by lockclient - * -*/ - - -#include "lockapptrace.h" -#include "lockappsession.h" -#include "lockappappui.h" -#include "lockappstatecontrolinterface.h" -#include "lockapputils.h" -#include - -// --------------------------------------------------------------------------- -// Default Constructor. -// --------------------------------------------------------------------------- -CLockAppSession::CLockAppSession( ) - { - - // no implementation required - } - -// --------------------------------------------------------------------------- -// Default Destructor. -// --------------------------------------------------------------------------- -CLockAppSession::~CLockAppSession( ) - { - // no implementation required - } - -// --------------------------------------------------------------------------- -// From @c CApaAppServiceBase. Handles possible error in the lock app session -// Method is empty. -// --------------------------------------------------------------------------- -void CLockAppSession::ServiceError( const RMessage2& aMessage, TInt aError ) - { - - if ( aError == KErrNotReady ) - { - // initialization not yet ready - aMessage.Complete( KErrNotReady ); - ERROR( aError, "LockApp initialization not yet ready, KErrNotReady" ); - } - else - { - ERROR_1( aError, "Service request has caused a leave, message: %d", aMessage.Function()); - CApaAppServiceBase::ServiceError( aMessage, aError ); -#ifdef _DEBUG - if ( aMessage.Function( )== ELockAppTestDestruct ) - { - User::Leave( KErrGeneral ); - } -#endif - } - } - -// --------------------------------------------------------------------------- -// From @c CApaAppServiceBase. Handles a client request. Leaving is handled by -// CLockAppSession::ServiceError() which reports the error code to the client -// --------------------------------------------------------------------------- -void CLockAppSession::ServiceL(const RMessage2& aMessage ) - { - RThread clientThread; - TInt err=aMessage.Client(clientThread); - // RDebug::Print( _L("called by %S"), &(clientThread.FullName()) ); - // RDebug::Print( clientThread.FullName() ); - - TInt response = KErrNone; - // log the message - // whole provided server API is implemented here - - switch ( aMessage.Function( ) ) - { - case ELockAppEnableKeyguard: - // enable with or without note (depends on first parameter) - response = DoEnableKeyguardL( aMessage.Int0() ); - break; - case ELockAppDisableKeyguard: - // disable with or without note (depends on first parameter) - response = DoDisableKeyguardL( aMessage.Int0() ); - break; - case ELockAppEnableDevicelock: - // check that client has needed capabilities to enable devicelock - if ( aMessage.HasCapability( ECapabilityWriteDeviceData ) ) - { - // first parameter contains the reason - response = DoEnableDevicelockL( (TDevicelockReason) aMessage.Int0() ); - } - else - { - response = KErrPermissionDenied; - } - break; - case ELockAppDisableDevicelock: - // check that client has needed capabilities to disable devicelock - if ( aMessage.HasCapability( ECapabilityWriteDeviceData ) ) - { - response = DoDisableDevicelockL( ); - } - else - { - response = KErrPermissionDenied; - } - break; - case ELockAppOfferKeyguard: - // offer to lock keyguard - response = DoOfferKeyguardL( ); - break; - case ELockAppOfferDevicelock: - // TODO implement this someday if needed - response = KErrNotSupported; - break; - case ELockAppShowKeysLockedNote: - response = DoShowKeysLockedNoteL( ); - break; -#ifdef _DEBUG - case ELockAppTestDestruct: - // test for leave - User::Leave( KErrGeneral ); - break; - case ELockAppTestInternal: - // test internal functions (which cannot be tested trough client API) - response = StateControlL()->ExecuteInternalTest( ); - break; -#endif - default: - // illegal message call, panic the client process - PanicClient( aMessage, ELockPanicIllegalMessage ); - return; - } - - INFO_2( "CLockAppSession received service message: %d. Result: %d", aMessage.Function(), response ); - aMessage.Complete( response ); - } - -// --------------------------------------------------------------------------- -// Request lockapp to enable keyguard on device (might not be approved, e.g. -// devicelock activated). -// --------------------------------------------------------------------------- -TInt CLockAppSession::DoEnableKeyguardL( TBool aShowNote ) - { - // calls the main control - - return StateControlL()->EnableKeyguardL( aShowNote ); - } - -// --------------------------------------------------------------------------- -// Request lockapp to disable keyguard on device (might not be approved, e.g. -// already disabled). -// --------------------------------------------------------------------------- -TInt CLockAppSession::DoDisableKeyguardL( TBool aShowNote ) - { - // calls the main control - - return StateControlL()->DisableKeyguardL( aShowNote ); - } - -// --------------------------------------------------------------------------- -// Request lockapp to enable devicelock on device (might not be approved). -// --------------------------------------------------------------------------- -TInt CLockAppSession::DoEnableDevicelockL( TDevicelockReason aReason ) - { - // calls the main control - - return StateControlL()->EnableDevicelockL( aReason ); - } - -// --------------------------------------------------------------------------- -// Request lockapp to disable devicelock on device (might not be approved). -// --------------------------------------------------------------------------- -TInt CLockAppSession::DoDisableDevicelockL( ) - { - // TODO Investigate if this should be allowed in API or not - // calls the main control - // StateControlL()->DisableDevicelockL( ); - return KErrPermissionDenied; - } - -// --------------------------------------------------------------------------- -// Request to offer keyguard on device (might not be approved, e.g. -// already locked). -// --------------------------------------------------------------------------- -TInt CLockAppSession::DoOfferKeyguardL( ) - { - // calls the main control - return StateControlL()->OfferKeyguard( ); - } - -// --------------------------------------------------------------------------- -// Request to show keys locked note, only works if keyguard is enabled -// --------------------------------------------------------------------------- -TInt CLockAppSession::DoShowKeysLockedNoteL( ) - { - // calls the main control - - return StateControlL()->ShowKeysLockedNote( ); - } - -// --------------------------------------------------------------------------- -// Return the main state control to the server session. -// Application appui and the main state control might not be constructed yet. -// --------------------------------------------------------------------------- -MLockAppStateControl* CLockAppSession::StateControlL( ) - { - - // other parts of lockapp construction may not be finished - if ( !iStateControl ) - { - CLockAppAppUi* appUi = (CLockAppAppUi*) CEikonEnv::Static()->EikAppUi(); - if ( appUi ) - { - iStateControl = appUi->StateControl( ); - if ( !iStateControl ) - { - User::Leave( KErrNotReady ); - } - } - else - { - User::Leave( KErrNotReady ); - } - } - return iStateControl; - } diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockappsleepingnote.cpp --- a/securitydialogs/lockapp/src/lockappsleepingnote.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -/* -* Copyright (c) 2007 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: Sleeping note with timeout - * -*/ - - -#include "lockappsleepingnote.h" -#include // avkon animation resources -#include // keyguard note resources -#include // access to note control -#include "lockapputils.h" -#include - -// --------------------------------------------------------------------------- -// Pointer to parent (implements MEikCommandObserver) is given in construction. -// --------------------------------------------------------------------------- -CLockAppSleepingNote::CLockAppSleepingNote( MEikCommandObserver* aCommandObserver ) : - iCommandObserver(aCommandObserver) - { - } - -// --------------------------------------------------------------------------- -// Note construction on startup. -// Sleeping note owns a timer that controls the note timeout. -// --------------------------------------------------------------------------- -void CLockAppSleepingNote::ConstructSleepingNoteL( TInt aResourceId ) - { - iResourceId = aResourceId; - CAknNoteDialog::ConstructSleepingDialogL( aResourceId ); - // Construct now rather than in PreLayoutDynInit - } - -// --------------------------------------------------------------------------- -// In destruction set reference value (is note shown) to not true. -// --------------------------------------------------------------------------- -CLockAppSleepingNote::~CLockAppSleepingNote( ) - { - } - -// --------------------------------------------------------------------------- -// Show note with timeout. -// --------------------------------------------------------------------------- -TInt CLockAppSleepingNote::ShowNote( const TInt aTimeout, const TTone aTone ) - { - ReportUserActivity( ); - iTimeoutInMicroseconds = aTimeout; - iTone = aTone; - return RouseSleepingDialog( ); - } - -// --------------------------------------------------------------------------- -// Key events are handled here. -// --------------------------------------------------------------------------- -TKeyResponse CLockAppSleepingNote::OfferKeyEventL( const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/) - { - //return CAknNoteDialog::OfferKeyEventL( aKeyEvent, aType ); - return EKeyWasConsumed; - } - -// --------------------------------------------------------------------------- -// Always called when note exists, the reason (command) for exit -// is delivered to parent. -// --------------------------------------------------------------------------- -TBool CLockAppSleepingNote::OkToExitL( TInt aCommand ) - { - if ( iCommandObserver ) - { - iCommandObserver->ProcessCommandL( aCommand ); - } - return ETrue; - } - -// --------------------------------------------------------------------------- -// Always called when note exists, the reason (command) for exit -// is delivered to parent. -// --------------------------------------------------------------------------- -void CLockAppSleepingNote::HandleResourceChange( TInt aType ) - { - if ( aType == KAknsMessageSkinChange ) - { - TInt animationRes(0); - switch ( iResourceId ) - { - case R_KEYLOCK_NOTE_KEYLOCKED: - animationRes = R_QGN_NOTE_INFO_ANIM; - break; - case R_KEYLOCK_NOTE_UNLOCK_CONFIRM: - animationRes = R_QGN_NOTE_QUERY_ANIM; - break; - case R_KEYLOCK_NOTE_UNLOCK_ASTERISK: - animationRes = R_QGN_NOTE_INFO_ANIM; - break; - case R_KEYLOCK_NOTE_LOCK_ON: - animationRes = R_QGN_NOTE_KEYGUARD_LOCKED_ANIM; - break; - case R_KEYLOCK_NOTE_LOCK_OFF: - animationRes = R_QGN_NOTE_KEYGUARD_OPEN_ANIM; - break; - case R_KEYLOCK_OFFER_LOCK_NOTE: - animationRes = R_QGN_NOTE_QUERY_ANIM; - break; - default: - break; - } // end of switch - - if ( animationRes ) - { - CAknNoteControl* ctrl = NoteControl( ); - if ( ctrl ) - { - TRAP_IGNORE(ctrl->SetAnimationL( animationRes )); - } - } - } - CAknNoteDialog::HandleResourceChange( aType ); - } diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockappstatecontrol.cpp --- a/securitydialogs/lockapp/src/lockappstatecontrol.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,945 +0,0 @@ -/* -* Copyright (c) 2007 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: Controls lock states (unlocked, keylock, devicelock) - * -*/ - - -#include "lockappstatecontrol.h" - -// child controls -#include "lockappidlecontrol.h" -#include "lockappkeyguardcontrol.h" -#include "lockappdevicelockcontrol.h" - -#include "lockapppubsubobserver.h" -#include "lockappcenrepobserver.h" - -#include "lockappkeycapturecontroller.h" -#include "lockappstatepublisher.h" -#include "lockappecsdetector.h" -#include "lockapputils.h" -#include - -#include -#include -#include -#include - -#include "GlobalWindowPriorities.h" - -#include // general avkon resources -#include // keyguard spesific resources -#include -#include // incall bubble -#include // BaflUtils -#include - -#include - -#include - TUid KUidFpsCategory = {0x1020507E}; -const TInt KFpsAuthenticationKey = 1; - -// used avkon dialog resources -_LIT(KRESOURCEFILE, "z:\\resource\\aknnotpi.rsc"); - -// Visibility gate WG priority's relative offset from ECoeWinPriorityAlwaysAtFront -// Now equals -1000 to be an absolute 0. -const TInt KGlobalWindowPriority_LockVisibilityGate = -1000; - -// --------------------------------------------------------------------------- -// Standard Symbian OS construction sequence -// --------------------------------------------------------------------------- -CLockAppStateControl* CLockAppStateControl::NewL( ) - { - CLockAppStateControl* self = new (ELeave) CLockAppStateControl(); - CleanupStack::PushL( self ); - self->ConstructL( ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Destruction releases key captures. -// --------------------------------------------------------------------------- -CLockAppStateControl::~CLockAppStateControl( ) - { - // localized resources are freed - if ( iResourceFileOffset ) - { - // We implicitely trust that eikon env exists (though in practice it does not make the - // difference as this destructor is really never called...) - iEikonEnv->DeleteResourceFile(iResourceFileOffset); - } - - // PuSub observers - if ( iPSScreenSaverObserver ) - { - delete iPSScreenSaverObserver; - iPSScreenSaverObserver = NULL; - } - - if ( iPSTelephonyObserver ) - { - delete iPSTelephonyObserver; - iPSTelephonyObserver = NULL; - } - - if ( iPSGripObserver ) - { - delete iPSGripObserver; - iPSGripObserver = NULL; - } - - if ( iPSFPSObserver ) - { - delete iPSFPSObserver; - iPSFPSObserver = NULL; - } - - CLockAppKeyCaptureController::Destroy( ); - - if ( iIncallBubble ) - { - delete iIncallBubble; - iIncallBubble = NULL; - } - - if ( iSoundsMuted ) - { - MuteSounds( EFalse ); - } - } - -// --------------------------------------------------------------------------- -// The uninitialized status is ELockNoteActive. -// --------------------------------------------------------------------------- -CLockAppStateControl::CLockAppStateControl( ) : - iLockStatus( ELockNotActive), - iWGEventGate( iEikonEnv->RootWin()), - iEnvState( 0 ) - { - // no implementation required - } - -// --------------------------------------------------------------------------- -// All lock state observers are created here. -// --------------------------------------------------------------------------- -void CLockAppStateControl::ConstructL( ) - { - INFO( "CLockAppStateControl::ConstructL started" ); - - // creates observer list - BaseConstructL( ); - - // localized resources are loaded - TFileName resourceFile; - resourceFile.Append( KRESOURCEFILE ); - BaflUtils::NearestLanguageFile( iEikonEnv->FsSession(), resourceFile ); - iResourceFileOffset = iEikonEnv->AddResourceFileL(resourceFile); - - // fetch power key configuration from feature manager - FeatureManager::InitializeLibL( ); - iFeatureNoPowerkey = FeatureManager::FeatureSupported( KFeatureIdNoPowerkey ); - FeatureManager::UnInitializeLib( ); - - // allow autoforwarding for the application (stacked bringforwards) - iEikonEnv->SetAutoForwarding( ETrue ); - - CLockAppKeyCaptureController::InitL( iEikonEnv->RootWin() ); - - // Create second windowgroup for visibility gate - CreateVisibilityGateWgL( ); - - INFO_1( "CLockAppStateControl - EventGate WgID = %d", iWGEventGate.WindowGroupId() ); - INFO_1( "CLockAppStateControl - VisibilityGate WgID = %d", iWGVisibilityGate.WindowGroupId() ); - - // - // Construct Controls - // - iIdle = CLockAppIdleControl::NewL( *this ); - AddObserverL( iIdle ); // ownership is transfered - - iCurrentControl = iIdle; - iCurrentControl->HandleActivateEventL( iEnvState ); - - iKeyguard = CLockAppKeyguardControl::NewL( *this ); - AddObserverL( iKeyguard ); // ownership is transfered - - RDebug::Printf( "%s %s (%u) iDevicelock=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iDevicelock ); - iDevicelock = CLockAppDevicelockControl::NewL( *this, iWGVisibilityGate ); - RDebug::Printf( "%s %s (%u) iDevicelock=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iDevicelock ); - iDevicelock->ConnectToPhoneL( iWGVisibilityGate ); - RDebug::Printf( "%s %s (%u) iDevicelock=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iDevicelock ); - AddObserverL( iDevicelock ); // ownership is transfered - - // Emergency support - iLockEcsDetector = CLockAppEcsDetector::NewL( ); - AddObserverL( iLockEcsDetector ); // ownership is transfered - - // Lock state publisher - CLockAppStatePublisher* lockPublisher = CLockAppStatePublisher::NewL( ); - AddObserverL( lockPublisher ); // ownership is transfered - - // PubSub observers - iPSScreenSaverObserver = CLockAppPubSubObserver::NewL( this, KPSUidScreenSaver, KScreenSaverOn ); - iPSTelephonyObserver = CLockAppPubSubObserver::NewL( this, KPSUidCtsyCallInformation, KCTsyCallState ); - iPSGripObserver = CLockAppPubSubObserver::NewL( this, KPSUidHWRM, KHWRMGripStatus ); - - iPSFPSObserver = CLockAppPubSubObserver::NewL( this, KUidFpsCategory, KFpsAuthenticationKey ); - - // Call bubble - iIncallBubble = CAknIncallBubble::NewL( ); - - ActivateL( ); - - INFO( "CLockAppStateControl::ConstructL completed" ); - } - -// --------------------------------------------------------------------------- -// Create visibility gate window group -// --------------------------------------------------------------------------- -void CLockAppStateControl::CreateVisibilityGateWgL( ) - { - INFO( "CLockAppStateControl - CreateVisibilityGateL" ); - - iWGVisibilityGate = RWindowGroup( iCoeEnv->WsSession( ) ); - User::LeaveIfError( iWGVisibilityGate.Construct( (TUint32) &iWGVisibilityGate ) ); - - /* hide this window group from the app switcher */ - iWGVisibilityGate.SetOrdinalPosition( 0, ECoeWinPriorityNeverAtFront ); - iWGVisibilityGate.EnableReceiptOfFocus( EFalse ); - - /*CApaWindowGroupName* wn = CApaWindowGroupName::NewLC( ws ); - wn->SetHidden( ETrue ); - wn->SetWindowGroupName( iWGVisibilityGate ); - CleanupStack::PopAndDestroy( wn );*/ - } - -// --------------------------------------------------------------------------- -// This method should be called to enable keyguard. -// --------------------------------------------------------------------------- -TInt CLockAppStateControl::EnableKeyguardL( TBool aWithNote ) - { - INFO_1( "CLockAppStateControl::EnableKeyguardL aWithNote= %d", aWithNote ); - TInt err = CheckIfLegal( ELockAppEnableKeyguard ); - if ( err == KErrNone && !iKeyguard->ActivationAllowedL( ) ) - { - err = KErrPermissionDenied; - } - if ( err == KErrNone ) - { - PostStatusChangeL( EKeyguardActive ); - __ASSERT_DEBUG( iLockStatus == EKeyguardActive, DoPanic(ELockIllegalState)); - INFO( "CLockAppStateControl - Keyguard Enabled" ); - if ( aWithNote ) - { - iKeyguard->DisplayKeysLockedNote( ); - } - } - return err; - } - -// --------------------------------------------------------------------------- -// This method should be called to disable keyguard. -// --------------------------------------------------------------------------- -TInt CLockAppStateControl::DisableKeyguardL( TBool aWithNote ) - { - INFO_1( "CLockAppStateControl::DisableKeyguardL aWithNote= %d", aWithNote ); - TInt err = CheckIfLegal( ELockAppDisableKeyguard ); - if ( err == KErrNone && !iKeyguard->DeActivationAllowedL( ) ) - { - err = KErrPermissionDenied; - } - if ( err == KErrNone ) - { - PostStatusChangeL( ELockNotActive ); - __ASSERT_DEBUG( iLockStatus == ELockNotActive, DoPanic(ELockIllegalState)); - INFO( "CLockAppStateControl - Keyguard Disabled" ); - if ( aWithNote ) - { - iKeyguard->DisplayKeysActiveNote( ); - } - } - return err; - } - -// --------------------------------------------------------------------------- -// This method should be called to enable device lock. -// --------------------------------------------------------------------------- -TInt CLockAppStateControl::EnableDevicelockL( TDevicelockReason aReason ) - { - INFO_1( "CLockAppStateControl::EnableDevicelockL aReason= %d", aReason ); - RDebug::Printf( "%s %s (%u) iDevicelock=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iDevicelock ); - TInt err = CheckIfLegal( ELockAppEnableDevicelock ); - if ( err == KErrNone && !iDevicelock->ActivationAllowedL( aReason ) ) - { - err = KErrPermissionDenied; - } - if ( err == KErrNone ) - { - PostStatusChangeL( EDevicelockActive ); - __ASSERT_DEBUG( iLockStatus == EDevicelockActive, DoPanic(ELockIllegalState)); - iDevicelock->SetLockingReason( aReason ); - INFO( "CLockAppStateControl - Devicelock Enabled" ); - } - return err; - } - -// --------------------------------------------------------------------------- -// This method should be called to disable device lock. -// --------------------------------------------------------------------------- -TInt CLockAppStateControl::DisableDevicelockL( ) - { - INFO_1( "CLockAppStateControl::DisableDevicelockL 1= %d", 1 ); - TInt err = CheckIfLegal( ELockAppDisableDevicelock ); - if ( err == KErrNone && !iDevicelock->DeActivationAllowedL( ) ) - { - err = KErrPermissionDenied; - } - if ( err == KErrNone ) - { - PostStatusChangeL( ELockNotActive ); - __ASSERT_DEBUG( iLockStatus == ELockNotActive, DoPanic(ELockIllegalState)); - INFO( "CLockAppStateControl - Devicelock Disabled" ); - } - return err; - } - -// --------------------------------------------------------------------------- -// Checks if offer keyguard is allowed and if it is, offers to lock keyguard. -// --------------------------------------------------------------------------- -TInt CLockAppStateControl::OfferKeyguard( ) - { - INFO_1( "CLockAppStateControl::OfferKeyguard 1= %d", 1 ); - TInt err = CheckIfLegal( ELockAppOfferKeyguard ); - if ( err == KErrNone ) - { - __ASSERT_DEBUG( iLockStatus == ELockNotActive, DoPanic(ELockIllegalState)); - INFO( "CLockAppStateControl - OfferKeyguard" ); - iIdle->OfferKeyLock( ); - } - return err; - } - -// --------------------------------------------------------------------------- -// Shows keys locked note if keyguard is enabled. -// --------------------------------------------------------------------------- -TInt CLockAppStateControl::ShowKeysLockedNote( ) - { - INFO_1( "CLockAppStateControl::ShowKeysLockedNote 1= %d", 1 ); - TInt err = CheckIfLegal( ELockAppShowKeysLockedNote ); - if ( err == KErrNone ) - { - __ASSERT_DEBUG( iLockStatus == EKeyguardActive, DoPanic(ELockIllegalState)); - INFO( "CLockAppStateControl - ShowKeysLockedNote" ); - iKeyguard->DisplayLockedNote( ); - } - return err; - } - -// --------------------------------------------------------------------------- -// A method for returning the lock status. -// --------------------------------------------------------------------------- -TLockStatus CLockAppStateControl::LockStatus( ) const - { - INFO_1( "CLockAppStateControl::LockStatus iLockStatus= %d", iLockStatus ); - return iLockStatus; - } - -// --------------------------------------------------------------------------- -// A method for returning the environment status bitmask. -// --------------------------------------------------------------------------- -TUint CLockAppStateControl::EnvironmentStatus( ) const - { - return iEnvState; - } - -// --------------------------------------------------------------------------- -// A method for executing different internal tests. -// --------------------------------------------------------------------------- -TInt CLockAppStateControl::ExecuteInternalTest( ) - { -#ifdef _DEBUG - return iLockEcsDetector->TestEcsNote( ); -#else - return KErrNone; -#endif - } - -// --------------------------------------------------------------------------- -// Number of owned UI controls (idle, keyguard, devicelock) -// --------------------------------------------------------------------------- -TInt CLockAppStateControl::CountComponentControls( ) const - { - return 3; - } - -// --------------------------------------------------------------------------- -// Owned UI controls (idle, keyguard, devicelock) -// --------------------------------------------------------------------------- -CCoeControl* CLockAppStateControl::ComponentControl( TInt aIndex ) const - { - RDebug::Printf( "%s %s (%u) aIndex=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aIndex ); - switch ( aIndex ) - { - case 0: - return iIdle; - case 1: - return iKeyguard; - case 2: - RDebug::Printf( "%s %s (%u) iDevicelock=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iDevicelock ); - return iDevicelock; - default: - return NULL; - } - } - -// ---------------------------------------------------------- -// Handle window-server events -// ---------------------------------------------------------- -void CLockAppStateControl::HandleWsEventL( const TWsEvent& aEvent, CCoeControl* /*aDestination*/) - { - TInt type = aEvent.Type( ); - RDebug::Printf( "%s %s (%u) type=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, type ); - switch ( type ) - { - case KAknFullOrPartialForegroundLost: // partial or full fg lost - case KAknFullOrPartialForegroundGained: // partial or full fg gained - { - RDebug::Printf( "%s %s (%u) type=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, type ); - RWsSession& ws = iCoeEnv->WsSession( ); - TFileName windowName; - TInt fwgid = ws.GetFocusWindowGroup( ); - ws.GetWindowGroupNameFromIdentifier( fwgid, windowName ); - INFO_3( "CLockAppStateControl::HandleWsEventL type: %d - FocusWg: %d %S", type, fwgid, &windowName); - } - break; - case EEventKeyUp: - case EEventKey: - case EEventKeyDown: - { - RDebug::Printf( "%s %s (%u) EEventKey*=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EEventKeyDown ); - TKeyEvent* aKeyEvent = aEvent.Key(); - TKeyResponse response = OfferKeyEventL( *aKeyEvent, (TEventCode)type ); - } - break; - default: - break; - } - } - -// --------------------------------------------------------------------------- -// From @c CAknAppUiBase. Overriden the parent method, because otherwise -// the main lock state control would not receive the call, because is is not -// window-owning control (=without window->not visible). The call is needed -// because the main state control owns window-owning child controls. -// --------------------------------------------------------------------------- -void CLockAppStateControl::HandleResourceChange( TInt aType ) - { - // these would not normally get handleresource call since they do not own window - RDebug::Printf( "%s %s (%u) aType=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aType ); - if(iIdle) - iIdle->HandleResourceChange( aType ); - if(iKeyguard) - iKeyguard->HandleResourceChange( aType ); - if(iDevicelock) - iDevicelock->HandleResourceChange( aType ); - // call parent - CCoeControl::HandleResourceChange( aType ); - } - -// --------------------------------------------------------------------------- -// Update the environment state variable with the event. -// --------------------------------------------------------------------------- -TBool CLockAppStateControl::HandleEnvironmentChange( TUint aEventMask, TBool aEnable ) - { - // check if there will be a change - - if ( IsBitFieldSet( iEnvState, aEventMask ) != aEnable ) - { - // set the bit-field - SetBitField( iEnvState, aEventMask, aEnable ); - // notify current control - __ASSERT_DEBUG( iCurrentControl, DoPanic(ELockIllegalState)); - iCurrentControl->HandleEnvironmentChange( iEnvState, aEventMask ); - // return true because the environment changed - return ETrue; - } - return EFalse; - } - -// --------------------------------------------------------------------------- -// Handle all Central Repository observer callbacks. -// --------------------------------------------------------------------------- -void CLockAppStateControl::HandleCenRepNotify(TUid aCenRepUid, TUint32 aKeyId, TInt aValue ) - { - RDebug::Printf( "%s %s (%u) ???? Nothing done for aKeyId=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aKeyId ); - - INFO_3( "CLockAppStateControl::HandleCenRepNotify %d %d = %d", aCenRepUid.iUid, aKeyId, aValue ); - } - -// --------------------------------------------------------------------------- -// Handle all Publish & Subscribe observer callbacks. -// --------------------------------------------------------------------------- -void CLockAppStateControl::HandlePubSubNotify(TUid aPubSubUid, TUint aKeyId, TInt aValue ) - { - INFO_3( "CLockAppStateControl::HandlePubSubNotify %x %x = %d", aPubSubUid.iUid, aKeyId, aValue ); - INFO_3( "CLockAppStateControl::HandlePubSubNotify KPSUidScreenSaver=%x KPSUidCtsyCallInformation=%x KPSUidAiInformation=%x", KPSUidScreenSaver, KPSUidCtsyCallInformation, KPSUidAiInformation ); - INFO_3( "CLockAppStateControl::HandlePubSubNotify KPSUidHWRM=%x KHWRMGripStatus=%x KPSUidAiInformation=%x", KPSUidHWRM, KHWRMGripStatus, KPSUidAiInformation ); - if ( aPubSubUid == KPSUidScreenSaver ) - { - switch ( aKeyId ) - { - case KScreenSaverOn: - { - INFO_1("CLockAppStateControl::ScreenSaver - %d", (aValue > 0)); - HandleEnvironmentChange( KLockAppEnvScreenSaverOn, (aValue > 0) ); - } - break; - default: - break; - } - } - else if ( aPubSubUid == KPSUidCtsyCallInformation ) - { - switch ( aKeyId ) - { - case KCTsyCallState: - { - PrintCallState( aValue ); - HandleEnvironmentChange( KLockAppEnvPhonecallOngoing, (aValue > EPSCTsyCallStateNone) ); - } - break; - default: - break; - } - } - else if ( aPubSubUid == KPSUidAiInformation ) // ActiveIdle - { - switch ( aKeyId ) - { - case KActiveIdleState: - { - INFO_1("CLockAppStateControl::ActiveIdle - %d", (aValue == EPSAiForeground)); - HandleEnvironmentChange( KLockAppEnvIdleOnForeground, (aValue == EPSAiForeground) ); - } - break; - default: - break; - } - } - else if ( aPubSubUid == KPSUidHWRM ) - { - switch ( aKeyId ) - { - case KHWRMGripStatus: - { - INFO_1("CLockAppStateControl::Grip - %d", aValue ); - HandleEnvironmentChange( KLockAppEnvGrip, (aValue == EPSHWRMGripOpen) ); - } - break; - default: - break; - } - } - else if ( aPubSubUid == KUidFpsCategory ) - { - switch ( aKeyId ) - { - case KFpsAuthenticationKey: - { - INFO_1("CLockAppStateControl::Grip - %d", aValue ); - #define EAuthenticationSuccess 1 - HandleEnvironmentChange( KLockAppEnvFPS, (aValue == EAuthenticationSuccess) ); - } - break; - default: - break; - } - } - } - -// --------------------------------------------------------------------------- -// All keyevents should go trough here. -// --------------------------------------------------------------------------- -TKeyResponse CLockAppStateControl::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) - { - RDebug::Printf( "%s %s (%u) iDevicelock=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iDevicelock ); - RDebug::Printf( "%s %s (%u) aKeyEvent.iCode=%x aType=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aKeyEvent.iCode, aType ); - TKeyResponse keyResponse = PreCheckKeyEvents( aKeyEvent, aType ); - if ( keyResponse == EKeyWasNotConsumed ) - { - if ( aKeyEvent.iRepeats == 0 ) - { - // handle only without the repeats - INFO_3("KeyEvent %d, %d, %d", aType, aKeyEvent.iCode, aKeyEvent.iScanCode ); - __ASSERT_DEBUG( iCurrentControl, DoPanic(ELockIllegalState)); - keyResponse = iCurrentControl->OfferKeyEventL( aKeyEvent, aType ); - } - else - { - // set consumed which are repeated - keyResponse = EKeyWasConsumed; - } - } - - return keyResponse; - } - -// --------------------------------------------------------------------------- -// From @c CLockAppObserverList. The main state control is the first -// to handle the lock state changes, locks/unlocks the phone depending -// on the state change. -// --------------------------------------------------------------------------- -void CLockAppStateControl::HandleLockStatusChangedL( TLockStatus aLockStatus ) - { - __ASSERT_DEBUG( iCurrentControl, DoPanic(ELockIllegalState)); - INFO_1("CLockAppStateControl::HandleLockStatusChangedL - %d", aLockStatus); - iCurrentControl->HandleDeActivateEventL( iEnvState ); - - switch ( aLockStatus ) - { - case ELockNotActive: - { - iCurrentControl = iIdle; - MuteSounds( EFalse ); - BringForward( EFalse ); - } - break; - case EKeyguardActive: - { - iCurrentControl = iKeyguard; - MuteSounds( ETrue ); - BringForward( ETrue ); - } - break; - case EDevicelockActive: - { - RDebug::Printf( "%s %s (%u) iDevicelock=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iDevicelock ); - iCurrentControl = iDevicelock; - MuteSounds( ETrue ); - BringForward( ETrue ); - } - break; - default: - INFO_1("CLockAppStateControl::HandleLockStatusChangedL - ???? aLockStatus=%d", aLockStatus); - DoPanic( ELockUnknownValue ); - break; - } - - __ASSERT_DEBUG( iCurrentControl, DoPanic(ELockIllegalState)); - iCurrentControl->HandleActivateEventL( iEnvState ); - - // finally we update the value (only place were changing the status is allowed) - iLockStatus = aLockStatus; - } - -// --------------------------------------------------------------------------- -// Check if requested transition is valid. -// --------------------------------------------------------------------------- -TInt CLockAppStateControl::CheckIfLegal( TLockAppMessageReason aReason ) - { - INFO_1("CLockAppStateControl::CheckIfLegal aReason=%d", aReason); - INFO_1("CLockAppStateControl::CheckIfLegal iLockStatus=%d", iLockStatus); - switch ( aReason ) - { - case ELockAppEnableKeyguard: - { - RDebug::Printf( "%s %s (%u) ELockAppEnableKeyguard iLockStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iLockStatus ); - switch ( iLockStatus ) - { - case ELockNotActive: - if ( !CKeyLockPolicyApi::KeyguardAllowed() ) - return KErrPermissionDenied; - else - return KErrNone; - case EKeyguardActive: - return KErrAlreadyExists; - case EDevicelockActive: - return KErrPermissionDenied; - } - } - break; - case ELockAppDisableKeyguard: - { - RDebug::Printf( "%s %s (%u) ELockAppDisableKeyguard iLockStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iLockStatus ); - switch ( iLockStatus ) - { - case ELockNotActive: - return KErrAlreadyExists; - case EKeyguardActive: - return KErrNone; - case EDevicelockActive: - return KErrPermissionDenied; - } - } - break; - case ELockAppEnableDevicelock: - { - RDebug::Printf( "%s %s (%u) ELockAppEnableDevicelock iLockStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iLockStatus ); - switch ( iLockStatus ) - { - case ELockNotActive: - return KErrNone; - case EKeyguardActive: - return KErrNone; - case EDevicelockActive: - return KErrAlreadyExists; - } - } - break; - case ELockAppDisableDevicelock: - { - RDebug::Printf( "%s %s (%u) ELockAppDisableDevicelock iLockStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iLockStatus ); - switch ( iLockStatus ) - { - case ELockNotActive: - return KErrAlreadyExists; - case EKeyguardActive: - return KErrPermissionDenied; - case EDevicelockActive: - return KErrNone; - } - } - break; - case ELockAppOfferKeyguard: - { - RDebug::Printf( "%s %s (%u) ELockAppOfferKeyguard iLockStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iLockStatus ); - switch ( iLockStatus ) - { - case ELockNotActive: - return KErrNone; - case EKeyguardActive: - return KErrPermissionDenied; - case EDevicelockActive: - return KErrPermissionDenied; - } - } - break; - case ELockAppShowKeysLockedNote: - { - RDebug::Printf( "%s %s (%u) ELockAppShowKeysLockedNote iLockStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iLockStatus ); - switch ( iLockStatus ) - { - case ELockNotActive: - return KErrPermissionDenied; - case EKeyguardActive: - return KErrNone; - case EDevicelockActive: - return KErrPermissionDenied; - } - } - break; - } - return KErrPermissionDenied; - } - -// --------------------------------------------------------------------------- -// Prescreen key events for special cases before giving them to child controls -// --------------------------------------------------------------------------- -TKeyResponse CLockAppStateControl::PreCheckKeyEvents(const TKeyEvent& aKeyEvent, TEventCode aType ) - { - RDebug::Printf( "%s %s (%u) aKeyEvent.iCode=%x aType=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aKeyEvent.iCode, aType ); - TKeyResponse keyResponse = EKeyWasNotConsumed; - // power key always turns the lights on - CheckForPowerKeyLights( aKeyEvent, aType ); - if ( iLockEcsDetector->EcsNoteOnScreen( ) ) - { - // the key events are fully handled by the emergency - // detector when emergency note is shown - keyResponse = EKeyWasConsumed; - } - else - { - if ( CheckForPhoneKeys( aKeyEvent, aType ) ) - { - keyResponse = EKeyWasConsumed; - } - else if ( aKeyEvent.iCode == EKeyLeftShift || aKeyEvent.iCode == EKeyRightShift ) - { - // eat these modifier events as they just cause problems elsewhere - keyResponse = EKeyWasConsumed; - } - } - return keyResponse; - } - -// --------------------------------------------------------------------------- -// Checks if power key has been pressed and inform the sysap accordingly. -// --------------------------------------------------------------------------- -void CLockAppStateControl::CheckForPowerKeyLights( const TKeyEvent& aKeyEvent, TEventCode aType ) - { - // only handle power key when keys are locked - RDebug::Printf( "%s %s (%u) aKeyEvent.iCode=%x aType=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aKeyEvent.iCode, aType ); - RDebug::Printf( "%s %s (%u) iLockStatus=%x ELockNotActive=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iLockStatus, ELockNotActive ); - if ( iLockStatus != ELockNotActive ) - { - RDebug::Printf( "%s %s (%u) iFeatureNoPowerkey=%x EStdKeyDevice2=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iFeatureNoPowerkey, EStdKeyDevice2 ); - if ( (aType == EEventKey && aKeyEvent.iRepeats == 0) || (aType == EEventKeyDown && aKeyEvent.iScanCode == EStdKeyDevice2) ) // Power key - { - // If power key pressed, tell SysAp about if - if ( (aKeyEvent.iScanCode == EStdKeyDevice2 && aType == EEventKeyDown) || (iFeatureNoPowerkey && aKeyEvent.iCode == EKeyNo) ) - { - // normal power key event - RDebug::Printf( "%s %s (%u) EEikKeyLockPowerKeyPressed=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iFeatureNoPowerkey ); - SendMessageToSysAp( EEikKeyLockPowerKeyPressed ); - if ( iFeatureNoPowerkey ) - { - RDebug::Printf( "%s %s (%u) EEikKeyLockLightsOnRequest=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EEikKeyLockLightsOnRequest ); - // end key as power key needs additional info (ugly solution) - SendMessageToSysAp( EEikKeyLockLightsOnRequest ); - } - } - } - } - } - -// --------------------------------------------------------------------------- -// Checks if green or red key has been pressed and forward it to phone -// in case there is a phone call ongoing. -// --------------------------------------------------------------------------- -TBool CLockAppStateControl::CheckForPhoneKeys( const TKeyEvent& aKeyEvent, TEventCode aType ) - { - RDebug::Printf( "%s %s (%u) aKeyEvent.iCode=%x aType=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aKeyEvent.iCode, aType ); -#ifndef RD_GLOBALWG_PRIORITY_CHANGE - // only handle phone keys when locked and phonecall ongoing - RDebug::Printf( "%s %s (%u) iLockStatus=%x ELockNotActive=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iLockStatus, ELockNotActive ); - if ( iLockStatus != ELockNotActive ) - { - if ( aKeyEvent.iScanCode == EStdKeyYes || aKeyEvent.iScanCode == EStdKeyNo ) - { - if ( IsBitFieldSet( iEnvState, KLockAppEnvPhonecallOngoing ) ) // TODO what about video-call - { - // send Green and Red keys to phoneapp's windowgroup - INFO( "CLockAppStateControl::CheckForPhoneKeys - SendKeyToPhoneApp"); - SendKeyToPhoneApp( aKeyEvent, aType ); - return ETrue; - } - } - } -#endif // !RD_GLOBALWG_PRIORITY_CHANGE - return EFalse; - } - -// --------------------------------------------------------------------------- -// Brings foreground/background the root window. -// --------------------------------------------------------------------------- -void CLockAppStateControl::BringForward(TBool aForeground ) - { - RDebug::Printf( "%s %s (%u) aForeground=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aForeground ); - if ( aForeground ) - { - INFO_4( "CLockAppStateControl::BringForward(1) STA - EvWG(%d,%d) ViWG(%d,%d)", - iWGEventGate.OrdinalPosition(), iWGEventGate.OrdinalPriority(), - iWGVisibilityGate.OrdinalPosition(), iWGVisibilityGate.OrdinalPriority()); - // not sure if these cause flush in WindowServer - iWGVisibilityGate.SetOrdinalPosition( 0, ECoeWinPriorityAlwaysAtFront + KGlobalWindowPriority_LockVisibilityGate ); - iWGEventGate.SetOrdinalPosition( 0, ECoeWinPriorityAlwaysAtFront + KGlobalWindowPriority_LockVisibilityGate ); - iEikonEnv->BringForwards( ETrue, ECoeWinPriorityAlwaysAtFront + KGlobalWindowPriority_KeyLock ); - /*if ( iIncallBubble ) - { - iIncallBubble->SetIncallBubbleAllowedInIdleL( ETrue ); - }*/ - } - else - { - INFO_4( "CLockAppStateControl::BringForward(0) STA - EvWG(%d,%d) ViWG(%d,%d)", - iWGEventGate.OrdinalPosition(), iWGEventGate.OrdinalPriority(), - iWGVisibilityGate.OrdinalPosition(), iWGVisibilityGate.OrdinalPriority()); - - // not sure if these cause flush in WindowServer - iWGVisibilityGate.SetOrdinalPosition( 0, ECoeWinPriorityNeverAtFront ); - iWGEventGate.SetOrdinalPosition( 0, ECoeWinPriorityNeverAtFront ); - iEikonEnv->BringForwards( EFalse ); - /*if ( iIncallBubble ) - { - iIncallBubble->SetIncallBubbleAllowedInIdleL( EFalse ); - }*/ - } - - INFO_4( "CLockAppStateControl::BringForward END - EvWG(%d,%d) ViWG(%d,%d)", - iWGEventGate.OrdinalPosition(), iWGEventGate.OrdinalPriority(), - iWGVisibilityGate.OrdinalPosition(), iWGVisibilityGate.OrdinalPriority()); - } - -// --------------------------------------------------------------------------- -// Mute key sounds when phone is locked. -// --------------------------------------------------------------------------- -void CLockAppStateControl::MuteSounds(TBool aMuteSounds ) - { - RDebug::Printf( "%s %s (%u) aMuteSounds=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aMuteSounds ); - if ( iSoundsMuted != aMuteSounds ) - { - if ( aMuteSounds ) - { - TRAPD(err, iAvkonAppUiBase->KeySounds()->PushContextL(R_AVKON_SILENT_SKEY_LIST)) - if ( !err ) - { - iAvkonAppUiBase->KeySounds()->BringToForeground(); - iAvkonAppUiBase->KeySounds()->LockContext(); - iSoundsMuted = ETrue; - } - } - else - { - iAvkonAppUiBase->KeySounds()->ReleaseContext(); - iAvkonAppUiBase->KeySounds()->PopContext(); - iSoundsMuted = EFalse; - } - } - } - -// --------------------------------------------------------------------------- -// Print out call state. -// --------------------------------------------------------------------------- -void CLockAppStateControl::PrintCallState( TInt aValue ) - { - RDebug::Printf( "%s %s (%u) aValue=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aValue ); - switch ( aValue ) - { - case EPSCTsyCallStateUninitialized: - INFO("CLockAppStateControl::PrintCallState - Uninitialized") - break; - case EPSCTsyCallStateNone: - INFO("CLockAppStateControl::PrintCallState - None") - break; - case EPSCTsyCallStateAlerting: - INFO("CLockAppStateControl::PrintCallState - Alerting") - break; - case EPSCTsyCallStateRinging: - INFO("CLockAppStateControl::PrintCallState - Ringing") - break; - case EPSCTsyCallStateDialling: - INFO("CLockAppStateControl::PrintCallState - Dialling") - break; - case EPSCTsyCallStateAnswering: - INFO("CLockAppStateControl::PrintCallState - Answering") - break; - case EPSCTsyCallStateDisconnecting: - INFO("CLockAppStateControl::PrintCallState - Disconnecting") - break; - case EPSCTsyCallStateConnected: - INFO("CLockAppStateControl::PrintCallState - Connected") - break; - case EPSCTsyCallStateHold: - INFO("CLockAppStateControl::PrintCallState - Hold") - break; - default: - break; - } - } - -// END OF FILE diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockappstatepublisher.cpp --- a/securitydialogs/lockapp/src/lockappstatepublisher.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* -* Copyright (c) 2007 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: Publishes LockApp states to other applications - * -*/ - - -#include "lockappstatepublisher.h" -#include "lockapputils.h" - -// defines keys KPSUidAvkonDomain, KAknKeyguardStatus, TAknKeyguardStatus -#include - -// --------------------------------------------------------------------------- -// Standard Symbian OS construction sequence -// --------------------------------------------------------------------------- -CLockAppStatePublisher* CLockAppStatePublisher::NewL( ) - { - CLockAppStatePublisher* self = new (ELeave) CLockAppStatePublisher(); - CleanupStack::PushL( self ); - self->ConstructL( ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// Standard C++ constructor -// --------------------------------------------------------------------------- -CLockAppStatePublisher::CLockAppStatePublisher() - { - // no implementation required - } - -// --------------------------------------------------------------------------- -// Closes the property handle. -// --------------------------------------------------------------------------- -CLockAppStatePublisher::~CLockAppStatePublisher() - { - iStatusProperty.Close(); - } - -// --------------------------------------------------------------------------- -// Defines the P&S key storing keyguard status -// --------------------------------------------------------------------------- -void CLockAppStatePublisher::ConstructL() - { - // for some reason P&S capability policy macros do not work with codetest -#ifdef _LOCKAPP_CODETEST_DEBUG - RProperty::Define( - KPSUidAvkonDomain, - KAknKeyguardStatus, - RProperty::EInt, - TSecurityPolicy(TSecurityPolicy::EAlwaysPass), - TSecurityPolicy(TSecurityPolicy::EAlwaysPass)); -#else - // defines the P&S key - _LIT_SECURITY_POLICY_C1(KWritePolicy, ECapabilityWriteDeviceData); - RProperty::Define( - KPSUidAvkonDomain, - KAknKeyguardStatus, - RProperty::EInt, - TSecurityPolicy(TSecurityPolicy::EAlwaysPass), - KWritePolicy); -#endif - // creates handle to property - iStatusProperty.Attach(KPSUidAvkonDomain, KAknKeyguardStatus); - } - -// --------------------------------------------------------------------------- -// From @c CLockAppStateObserver. Used to publish lockapp state -// to external parties. -// --------------------------------------------------------------------------- -void CLockAppStatePublisher::HandleLockStatusChangedL( TLockStatus aLockStatus ) - { - switch ( aLockStatus ) - { - case ELockNotActive: - { - iStatusProperty.Set(EKeyguardNotActive); - } - break; - case EDevicelockActive: - { - iStatusProperty.Set(EKeyguardAutolockEmulation); - } - break; - case EKeyguardActive: - { - iStatusProperty.Set(EKeyguardLocked); - } - break; - default: - DoPanic(ELockUnknownValue); - break; - } - } diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockapputils.cpp --- a/securitydialogs/lockapp/src/lockapputils.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -/* -* Copyright (c) 2007 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: Lock App internal utils - * -*/ - - -#include -#include -#include -#include "lockapputils.h" - -#define KSysApUid TUid::Uid(0x100058F3) -#define KPhoneAppUid TUid::Uid(0x100058B3) - -// --------------------------------------------------------------------------- -// Queries bits in aStatusMask specified by the aQueryMask -// --------------------------------------------------------------------------- -TBool IsBitFieldSet( TUint aStatusMask, TUint aQueryMask ) - { - return (aStatusMask & aQueryMask); - } - -// --------------------------------------------------------------------------- -// Sets bits in aResultMask specified by the aSetMask -// --------------------------------------------------------------------------- -void SetBitField( TUint &aResultMask, TUint aSetMask, TBool aSet ) - { - if ( aSet ) - { - aResultMask = aResultMask | aSetMask; - } - else - { - aResultMask = aResultMask & ~ aSetMask; - } - } - -// --------------------------------------------------------------------------- -// Panic function for LockApp internal panics. -// --------------------------------------------------------------------------- -void DoPanic( TLockAppPanic aPanic ) - { - _LIT(KPanic,"LockApp"); - User::Panic( KPanic, aPanic ); - } - -// --------------------------------------------------------------------------- -// Causes client Panic (illegal use of the server services). -// Used RMessagePtr2::Panic() also completes the message. -// --------------------------------------------------------------------------- -void PanicClient(const RMessagePtr2& aMessage, TLockAppPanic aPanic ) - { - _LIT(KPanic, "LockAppServer"); - aMessage.Panic( KPanic, aPanic ); - } - -// --------------------------------------------------------------------------- -// Sends application spesific events to Sysap. -// Used mainly for lights control. -// --------------------------------------------------------------------------- -void SendMessageToSysAp( TInt aMessage ) - { - RWsSession& ws = CCoeEnv::Static()->WsSession( ); - TInt wgId = 0; - CApaWindowGroupName::FindByAppUid( KSysApUid, ws, wgId ); - - // if sysap window group exists - if ( wgId ) - { - TWsEvent event; - event.SetType( aMessage ); - event.SetTimeNow( ); - ws.SendEventToWindowGroup( wgId, event ); - } - } - -// --------------------------------------------------------------------------- -// Sends a key event to the windowgroup in background. -// Used mainly for sending red and green keys to phone app when -// devicelock or keyguard is in foreground. -// --------------------------------------------------------------------------- -void SendKeyToPhoneApp( const TKeyEvent& aKey, TEventCode aType ) - { - RWsSession& ws = CCoeEnv::Static()->WsSession( ); - TInt wgId = 0; - CApaWindowGroupName::FindByAppUid( KPhoneAppUid, ws, wgId ); - - // if sysap window group exists - if ( wgId ) - { - TWsEvent event; - *event.Key() = aKey; - event.SetType( aType ); - event.SetTimeNow( ); - ws.SendEventToWindowGroup( wgId, event ); - } - } - -// END OF FILE diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockapp/src/lockappwait.cpp --- a/securitydialogs/lockapp/src/lockappwait.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2007 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: Async-Sync utility class - * -*/ - - -#include -#include -#include -#include "lockappwait.h" - -// ---------------------------------------------------------- -// Standard Symbian OS construction sequence -// ---------------------------------------------------------- -// -CWait* CWait::NewL( ) - { - CWait* self = new (ELeave) CWait( ); - CleanupStack::PushL( self ); - self->ConstructL( ); - CleanupStack::Pop( self ); - return self; - } - -// ---------------------------------------------------------- -// 2nd phase constructor. -// ---------------------------------------------------------- -// -void CWait::ConstructL( ) - { - CActiveScheduler::Add( this ); - } - -// ---------------------------------------------------------- -// Constructor -// ---------------------------------------------------------- -// -CWait::CWait( ) : - CActive(0) - { - // no implementation required - } - -// ---------------------------------------------------------- -// Destructor. -// ---------------------------------------------------------- -// -CWait::~CWait( ) - { - Cancel( ); - } - -// ---------------------------------------------------------- -// -// ---------------------------------------------------------- -// -TInt CWait::WaitForRequestL( ) - { - CWaitAbsorbingControl* absorbing = CWaitAbsorbingControl::NewLC( ); - SetActive( ); - iWait.Start( ); - CleanupStack::PopAndDestroy( absorbing ); - return iStatus.Int( ); - } - -// ---------------------------------------------------------- -// -// ---------------------------------------------------------- -// -void CWait::RunL( ) - { - if ( iWait.IsStarted( ) ) - { - iWait.AsyncStop( ); - } - } - -// ---------------------------------------------------------- -// Cancels code request -// ---------------------------------------------------------- -// -void CWait::DoCancel( ) - { - if ( iWait.IsStarted( ) ) - { - iWait.AsyncStop( ); - } - } - -// ---------------------------------------------------------- -// Sets active request type -// ---------------------------------------------------------- -// -void CWait::SetRequestType(TInt aRequestType ) - { - iRequestType = aRequestType; - } - -// ---------------------------------------------------------- -// Gets active request type -// ---------------------------------------------------------- -// -TInt CWait::GetRequestType( ) - { - return iRequestType; - } - -// ---------------------------------------------------------- -// Standard Symbian OS construction sequence -// ---------------------------------------------------------- -// -CWaitAbsorbingControl* CWaitAbsorbingControl::NewLC( ) - { - CWaitAbsorbingControl* self= new (ELeave) CWaitAbsorbingControl(); - CleanupStack::PushL( self ); - self->ConstructL( ); - return self; - } - -// ---------------------------------------------------------- -// -// ---------------------------------------------------------- -// -CWaitAbsorbingControl::CWaitAbsorbingControl( ) - { - // no implementation required - } - -// ---------------------------------------------------------- -// Destructor. -// ---------------------------------------------------------- -// -CWaitAbsorbingControl::~CWaitAbsorbingControl( ) - { - if ( iCoeEnv && iAppUi ) - iAppUi->RemoveFromStack( this ); - } - -// ---------------------------------------------------------- -// -// ---------------------------------------------------------- -// -void CWaitAbsorbingControl::ConstructL( ) - { - CreateWindowL( ); - SetExtent( TPoint( 0, 0 ), TSize( 0, 0 ) ); - ActivateL( ); - SetPointerCapture( ETrue ); - ClaimPointerGrab( ETrue ); - iAppUi = iEikonEnv->EikAppUi(); - iAppUi->AddToStackL( this, ECoeStackPriorityEnvironmentFilter ); - } - -// ---------------------------------------------------------- -// -// ---------------------------------------------------------- -// -TKeyResponse CWaitAbsorbingControl::OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/) - { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - return EKeyWasConsumed; - } - -// End of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockclient/eabi/lockclientu.def --- a/securitydialogs/lockclient/eabi/lockclientu.def Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/lockclient/eabi/lockclientu.def Tue Aug 31 16:04:40 2010 +0300 @@ -21,8 +21,4 @@ _ZN20CDevicelockAccessApiD0Ev @ 20 NONAME _ZN20CDevicelockAccessApiD1Ev @ 21 NONAME _ZN20CDevicelockAccessApiD2Ev @ 22 NONAME - _ZTI18CKeyguardAccessApi @ 23 NONAME ; ## - _ZTI20CDevicelockAccessApi @ 24 NONAME ; ## - _ZTV18CKeyguardAccessApi @ 25 NONAME ; ## - _ZTV20CDevicelockAccessApi @ 26 NONAME ; ## diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockclient/group/ABLD.BAT --- a/securitydialogs/lockclient/group/ABLD.BAT Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -@ECHO OFF - -REM Bldmake-generated batch file - ABLD.BAT -REM ** DO NOT EDIT ** - -perl -S ABLD.PL "\sf\mw\securitysrv\securitydialogs\lockclient\group\\" %1 %2 %3 %4 %5 %6 %7 %8 %9 -if errorlevel==1 goto CheckPerl -goto End - -:CheckPerl -perl -v >NUL -if errorlevel==1 echo Is Perl, version 5.003_07 or later, installed? -goto End - -:End diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockclient/group/bld.inf --- a/securitydialogs/lockclient/group/bld.inf Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/lockclient/group/bld.inf Tue Aug 31 16:04:40 2010 +0300 @@ -20,8 +20,12 @@ PRJ_EXPORTS +/* this is also done in .pro , but doesn't harm to do it here, too */ ../rom/lockclient.iby CORE_MW_LAYER_IBY_EXPORT_PATH(lockclient.iby) PRJ_MMPFILES +/* +Not any more. This is done in the QT way, using lockclient.pro lockclient.mmp +*/ \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockclient/group/bwins/lockclientu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/lockclient/group/bwins/lockclientu.def Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,20 @@ +EXPORTS + ?ShowKeysLockedNote@CKeyguardAccessApi@@QAEHXZ @ 1 NONAME ; int CKeyguardAccessApi::ShowKeysLockedNote(void) + ?TestDestruct@CKeyguardAccessApi@@QAEHXZ @ 2 NONAME ; int CKeyguardAccessApi::TestDestruct(void) + ?NewL@CDevicelockAccessApi@@SAPAV1@XZ @ 3 NONAME ; class CDevicelockAccessApi * CDevicelockAccessApi::NewL(void) + ?OfferKeyguard@CKeyguardAccessApi@@QAEHXZ @ 4 NONAME ; int CKeyguardAccessApi::OfferKeyguard(void) + ?IsKeyguardEnabled@CKeyguardAccessApi@@QAEHXZ @ 5 NONAME ; int CKeyguardAccessApi::IsKeyguardEnabled(void) + ?EnableKeyguard@CKeyguardAccessApi@@QAEHH@Z @ 6 NONAME ; int CKeyguardAccessApi::EnableKeyguard(int) + ?IsKeylockEnabled@CKeyguardAccessApi@@QAEHXZ @ 7 NONAME ; int CKeyguardAccessApi::IsKeylockEnabled(void) + ?IsDevicelockEnabled@CDevicelockAccessApi@@QAEHXZ @ 8 NONAME ; int CDevicelockAccessApi::IsDevicelockEnabled(void) + ?DisableDevicelock@CDevicelockAccessApi@@QAEHXZ @ 9 NONAME ; int CDevicelockAccessApi::DisableDevicelock(void) + ?TestPanicClient@CKeyguardAccessApi@@QAEHXZ @ 10 NONAME ; int CKeyguardAccessApi::TestPanicClient(void) + ?TestInternal@CKeyguardAccessApi@@QAEHXZ @ 11 NONAME ; int CKeyguardAccessApi::TestInternal(void) + ?DisableKeyguard@CKeyguardAccessApi@@QAEHH@Z @ 12 NONAME ; int CKeyguardAccessApi::DisableKeyguard(int) + ?EnableDevicelock@CDevicelockAccessApi@@QAEHW4TDevicelockReason@@@Z @ 13 NONAME ; int CDevicelockAccessApi::EnableDevicelock(enum TDevicelockReason) + ?IsKeylockEnabled@CDevicelockAccessApi@@QAEHXZ @ 14 NONAME ; int CDevicelockAccessApi::IsKeylockEnabled(void) + ??1CKeyguardAccessApi@@UAE@XZ @ 15 NONAME ; CKeyguardAccessApi::~CKeyguardAccessApi(void) + ??1CDevicelockAccessApi@@UAE@XZ @ 16 NONAME ; CDevicelockAccessApi::~CDevicelockAccessApi(void) + ?OfferDevicelock@CDevicelockAccessApi@@QAEHXZ @ 17 NONAME ; int CDevicelockAccessApi::OfferDevicelock(void) + ?NewL@CKeyguardAccessApi@@SAPAV1@XZ @ 18 NONAME ; class CKeyguardAccessApi * CKeyguardAccessApi::NewL(void) + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockclient/group/eabi/lockclientu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/lockclient/group/eabi/lockclientu.def Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,24 @@ +EXPORTS + _ZN18CKeyguardAccessApi12TestDestructEv @ 1 NONAME + _ZN18CKeyguardAccessApi12TestInternalEv @ 2 NONAME + _ZN18CKeyguardAccessApi13OfferKeyguardEv @ 3 NONAME + _ZN18CKeyguardAccessApi14EnableKeyguardEi @ 4 NONAME + _ZN18CKeyguardAccessApi15DisableKeyguardEi @ 5 NONAME + _ZN18CKeyguardAccessApi15TestPanicClientEv @ 6 NONAME + _ZN18CKeyguardAccessApi16IsKeylockEnabledEv @ 7 NONAME + _ZN18CKeyguardAccessApi17IsKeyguardEnabledEv @ 8 NONAME + _ZN18CKeyguardAccessApi18ShowKeysLockedNoteEv @ 9 NONAME + _ZN18CKeyguardAccessApi4NewLEv @ 10 NONAME + _ZN18CKeyguardAccessApiD0Ev @ 11 NONAME + _ZN18CKeyguardAccessApiD1Ev @ 12 NONAME + _ZN18CKeyguardAccessApiD2Ev @ 13 NONAME + _ZN20CDevicelockAccessApi15OfferDevicelockEv @ 14 NONAME + _ZN20CDevicelockAccessApi16EnableDevicelockE17TDevicelockReason @ 15 NONAME + _ZN20CDevicelockAccessApi16IsKeylockEnabledEv @ 16 NONAME + _ZN20CDevicelockAccessApi17DisableDevicelockEv @ 17 NONAME + _ZN20CDevicelockAccessApi19IsDevicelockEnabledEv @ 18 NONAME + _ZN20CDevicelockAccessApi4NewLEv @ 19 NONAME + _ZN20CDevicelockAccessApiD0Ev @ 20 NONAME + _ZN20CDevicelockAccessApiD1Ev @ 21 NONAME + _ZN20CDevicelockAccessApiD2Ev @ 22 NONAME + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockclient/group/lockclient.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/lockclient/group/lockclient.pro Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,51 @@ +# +# Copyright (c) 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" +# 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: +# + + +TEMPLATE = lib +TARGET = lockclient + +TARGET.UID3 = 0x2000B124 + +TARGET.CAPABILITY = CAP_GENERAL_DLL + + +DEPENDPATH += . +DEPENDPATH += ../src +DEPENDPATH += ../inc + +INCLUDEPATH += . + +CONFIG += hb + +# Input +SOURCES += devicelockaccessapi.cpp \ + keyguardaccessapi.cpp \ + lockaccessextension.cpp + +HEADERS = lockaccessextension.h + +LIBS += -lxqservice +LIBS += -lxqserviceutil +LIBS += -lapparc +LIBS += -lapgrfx + +symbian*: { + TARGET.EPOCALLOWDLLDATA = 1 + MMP_RULES -= "OPTION_REPLACE ARMCC --export_all_vtbl -D__QT_NOEFFECTMACRO_DONOTUSE" + } + +BLD_INF_RULES.prj_exports += "../rom/lockclient.iby CORE_APP_LAYER_IBY_EXPORT_PATH(lockclient.iby)" diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockclient/inc/lockaccessextension.h --- a/securitydialogs/lockclient/inc/lockaccessextension.h Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/lockclient/inc/lockaccessextension.h Tue Aug 31 16:04:40 2010 +0300 @@ -21,6 +21,12 @@ #include +#if defined(_DEBUG) +#define RDEBUG( x, y ) RDebug::Printf( "%s %s (%u) %s=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, x, y ); +#else +#define RDEBUG( x, y ) +#endif + class RWsSession; /** diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockclient/lockclient.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/lockclient/lockclient.pro Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,21 @@ +# +# Copyright (c) 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: +# + +TEMPLATE = subdirs + +SYMBIAN_PLATFORMS = WINSCW ARMV5 + +SUBDIRS += group/lockclient.pro diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockclient/rom/lockclient.iby --- a/securitydialogs/lockclient/rom/lockclient.iby Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/lockclient/rom/lockclient.iby Tue Aug 31 16:04:40 2010 +0300 @@ -20,6 +20,6 @@ #include //file=ABI_DIR\BUILD_DIR\lockclient.dll SHARED_LIB_DIR\lockclient.dll -file=ABI_DIR\UDEB\lockclient.dll SHARED_LIB_DIR\lockclient.dll +file=ABI_DIR\BUILD_DIR\lockclient.dll SHARED_LIB_DIR\lockclient.dll #endif // __LOCKCLIENT_IBY__ diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockclient/src/devicelockaccessapi.cpp --- a/securitydialogs/lockclient/src/devicelockaccessapi.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/lockclient/src/devicelockaccessapi.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -29,6 +29,7 @@ // --------------------------------------------------------------------------- EXPORT_C CDevicelockAccessApi* CDevicelockAccessApi::NewL( ) { + RDEBUG("0", 0); CDevicelockAccessApi* self = new (ELeave) CDevicelockAccessApi( ); CleanupStack::PushL( self ); self->ConstructL( ); @@ -41,6 +42,7 @@ // --------------------------------------------------------------------------- CDevicelockAccessApi::CDevicelockAccessApi() { + RDEBUG("0", 0); } // --------------------------------------------------------------------------- @@ -69,6 +71,7 @@ // --------------------------------------------------------------------------- EXPORT_C TBool CDevicelockAccessApi::IsKeylockEnabled() { + RDEBUG("0", 0); TInt value; TInt err = RProperty::Get(KPSUidAvkonDomain, KAknKeyguardStatus, value); if ( err == KErrNone ) @@ -94,6 +97,7 @@ // --------------------------------------------------------------------------- EXPORT_C TBool CDevicelockAccessApi::IsDevicelockEnabled() { + RDEBUG("0", 0); TInt value; TInt err = RProperty::Get(KPSUidAvkonDomain, KAknKeyguardStatus, value); if ( err == KErrNone ) @@ -119,6 +123,7 @@ // --------------------------------------------------------------------------- EXPORT_C TInt CDevicelockAccessApi::EnableDevicelock( TDevicelockReason aReason ) { + RDEBUG("aReason", aReason); if ( iLockAccessExtension ) { switch (aReason) @@ -141,6 +146,7 @@ // --------------------------------------------------------------------------- EXPORT_C TInt CDevicelockAccessApi::OfferDevicelock() { + RDEBUG("0", 0); if ( iLockAccessExtension ) { return iLockAccessExtension->SendMessage( ELockAppOfferDevicelock ); @@ -157,6 +163,7 @@ // --------------------------------------------------------------------------- EXPORT_C TInt CDevicelockAccessApi::DisableDevicelock() { + RDEBUG("0", 0); if ( iLockAccessExtension ) { return iLockAccessExtension->SendMessage( ELockAppDisableDevicelock ); diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockclient/src/keyguardaccessapi.cpp --- a/securitydialogs/lockclient/src/keyguardaccessapi.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/lockclient/src/keyguardaccessapi.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -24,11 +24,15 @@ #include // P&S API #include +#include + // --------------------------------------------------------------------------- // Standard Symbian OS construction sequence // --------------------------------------------------------------------------- EXPORT_C CKeyguardAccessApi* CKeyguardAccessApi::NewL( ) { + RDEBUG("0", 0); + CKeyguardAccessApi* self = new (ELeave) CKeyguardAccessApi( ); CleanupStack::PushL( self ); self->ConstructL( ); @@ -41,6 +45,7 @@ // --------------------------------------------------------------------------- CKeyguardAccessApi::CKeyguardAccessApi() { + RDEBUG("0", 0); } // --------------------------------------------------------------------------- @@ -61,6 +66,7 @@ // --------------------------------------------------------------------------- void CKeyguardAccessApi::ConstructL( ) { + RDEBUG("0", 0); iLockAccessExtension = new (ELeave) RLockAccessExtension; } @@ -69,6 +75,8 @@ // --------------------------------------------------------------------------- EXPORT_C TBool CKeyguardAccessApi::IsKeylockEnabled() { + + RDEBUG("0", 0); TInt value; TInt err = RProperty::Get(KPSUidAvkonDomain, KAknKeyguardStatus, value); if ( err == KErrNone ) @@ -94,6 +102,7 @@ // --------------------------------------------------------------------------- EXPORT_C TBool CKeyguardAccessApi::IsKeyguardEnabled() { + RDEBUG("0", 0); TInt value; TInt err = RProperty::Get(KPSUidAvkonDomain, KAknKeyguardStatus, value); if ( err == KErrNone ) @@ -134,12 +143,15 @@ // --------------------------------------------------------------------------- EXPORT_C TInt CKeyguardAccessApi::DisableKeyguard( TBool aWithNote ) { + RDEBUG("aWithNote", aWithNote); if ( iLockAccessExtension ) { + RDEBUG("0", 1); return iLockAccessExtension->SendMessage( ELockAppDisableKeyguard, aWithNote ); } else { + RDEBUG("0", 0); return KErrNotFound; } } @@ -149,6 +161,7 @@ // --------------------------------------------------------------------------- EXPORT_C TInt CKeyguardAccessApi::OfferKeyguard() { + RDEBUG("0", 0); if ( iLockAccessExtension ) { return iLockAccessExtension->SendMessage( ELockAppOfferKeyguard ); @@ -164,6 +177,7 @@ // --------------------------------------------------------------------------- EXPORT_C TInt CKeyguardAccessApi::ShowKeysLockedNote() { + RDEBUG("0", 0); if ( iLockAccessExtension ) { return iLockAccessExtension->SendMessage( ELockAppShowKeysLockedNote ); diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/lockclient/src/lockaccessextension.cpp --- a/securitydialogs/lockclient/src/lockaccessextension.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/securitydialogs/lockclient/src/lockaccessextension.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -15,17 +15,20 @@ * */ - #include "lockaccessextension.h" #include #include // P&S API #include // TApaTask, TApaTaskList #include // CCoeEnv - +#include "../../Autolock/PubSub/securityuisprivatepskeys.h" +#include +#include -// Constants -const TInt KTimesToConnectServer( 2); -const TInt KTimeoutBeforeRetrying( 50000); +#include +#include +#include +#include +#include // --------------------------------------------------------------------------- // Gets server version, needed for connection @@ -41,6 +44,8 @@ TInt RLockAccessExtension::TryConnect( RWsSession& aWsSession ) { TInt ret(KErrNone); + /* + this is the old methd. Now we use QtHighway TApaTaskList list(aWsSession); // check that lockapp is running TApaTask task = list.FindApp( KLockAppUid ); @@ -62,6 +67,8 @@ RDebug::Printf( "%s %s (%u) ???? LockApp task not found=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, KLockAppUid ); ret = KErrNotReady; } + */ + RDEBUG("ret", ret); return ret; } @@ -71,7 +78,70 @@ TInt RLockAccessExtension::EnsureConnected( ) { TInt ret(KErrNone); + + // Now we use QtHighway, but nevertheless need to be sure that only 1 process is running + // This is done because Autolock.exe should start at the beginning, but it might not be ready yet. + // As Qthighway will start it, it's better to give time for the first one to prepare itself. + TInt err = KErrNone; + TInt numAttempts = 0; + TInt numberOfInstances = 0; + do + { + numberOfInstances=0; + TFullName processName; + TFindThread find(_L("*utolock*")); // first letter can can be uppercase or lowercase + while( find.Next( processName ) == KErrNone ) + { + // Autolock[100059b5]0002::Autolock in device + // autolock.exe[100059b5]0002::Main in emulator + RDEBUG("found process", 1); + numberOfInstances++; + } // end while + RDEBUG("numberOfInstances", numberOfInstances); + if(numberOfInstances<=0) + { + RDEBUG("Autolock.exe not running already. Starting.", 0 ); + RApaLsSession ls; + User::LeaveIfError(ls.Connect()); + CleanupClosePushL(ls); + RDEBUG("commandLine", 0); + CApaCommandLine* commandLine = CApaCommandLine::NewLC(); + commandLine->SetExecutableNameL(_L("autolock.exe")); + commandLine->SetCommandL(EApaCommandRun); + // Try to launch the application. + RDEBUG("StartApp", 0); + TInt err = ls.StartApp(*commandLine); // this migh fail + CleanupStack::PopAndDestroy(2); // commandLine, ls + + RDEBUG("Autolock.exe launched. Waiting a bit. err", err ); + User::After(1000*1000); + RDEBUG("re-verifying Autolock.exe process.", 1 ); + } + } while (numAttempts++ <3 && numberOfInstances<=0); + + + + TInt value = -1; + err = KErrNone; + numAttempts = 0; + while( value<1 && numAttempts++ <10 ) // wait max 5 seconds + { + // process was started, but still not fully running. Give a bit more time + err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsLockInitiatorUID, value); + RDEBUG("err", err); + RDEBUG("value", value); + if(value<1) + { + RDEBUG("Autolock.exe has started but it's not fully running", value); + User::After(5*100*1000); // half a second + } + } + RDEBUG("numAttempts", numAttempts); + /* + this is the old method. // we need CCoeEnv because of window group list + const TInt KTimesToConnectServer( 2); + const TInt KTimeoutBeforeRetrying( 50000); CCoeEnv* coeEnv = CCoeEnv::Static( ); if ( coeEnv ) { @@ -90,6 +160,8 @@ // No CCoeEnv ret = KErrNotSupported; } + */ + RDEBUG("ret", ret); return ret; } @@ -98,10 +170,12 @@ // --------------------------------------------------------------------------- TInt RLockAccessExtension::SendMessage( TInt aMessage ) { - TInt ret = EnsureConnected( ); + RDEBUG("0", 0); + TInt ret = KErrNone; if ( ret == KErrNone ) { - ret = SendReceive( aMessage ); + // ret = SendReceive( aMessage ); + ret = SendMessage( aMessage, -1, -1 ); } return ret; } @@ -111,12 +185,14 @@ // --------------------------------------------------------------------------- TInt RLockAccessExtension::SendMessage( TInt aMessage, TInt aParam1 ) { - TInt ret = EnsureConnected( ); + RDEBUG("0", 0); + TInt ret = KErrNone; if ( ret == KErrNone ) { // assign parameters to IPC argument TIpcArgs args(aParam1); - ret = SendReceive( aMessage, args ); + // ret = SendReceive( aMessage, args ); + ret = SendMessage( aMessage, aParam1, -1 ); } return ret; } @@ -126,13 +202,82 @@ // --------------------------------------------------------------------------- TInt RLockAccessExtension::SendMessage( TInt aMessage, TInt aParam1, TInt aParam2 ) { + RDEBUG("0", 0); TInt ret = EnsureConnected( ); + RDEBUG("ret", ret); if ( ret == KErrNone ) { // assign parameters to IPC argument - TIpcArgs args( aParam1, aParam2); - ret = SendReceive( aMessage, args ); + // TIpcArgs args( aParam1, aParam2); + // this is the old methd. Now we use QtHighway + // ret = SendReceive( aMessage, args ); + RDEBUG("aMessage", aMessage); + RDEBUG("aParam1", aParam1); + RDEBUG("aParam2", aParam2); + + + { // old method. Not used any more. Kept as reference + /* + XQServiceRequest* mServiceRequest; + RDEBUG("XQServiceRequest", 0); + mServiceRequest = new XQServiceRequest("com.nokia.services.Autolock.Autolock","service(QString,QString,QString)");// use , false to make async + RDEBUG("aMessage", 0); + QString label; + label = "" + QString("%1").arg(aMessage); + *mServiceRequest << QString(label); + RDEBUG("aParam1", 0); + label = "" + QString("%1").arg(aParam1); + *mServiceRequest << QString(label); + RDEBUG("aParam2", 0); + label = "" + QString("%1").arg(aParam2); + *mServiceRequest << QString(label); + int returnvalue; + RDEBUG("send", 0); + bool ret = mServiceRequest->send(returnvalue); + RDEBUG("ret", ret); + RDEBUG("returnvalue", returnvalue); + */ + } + + RDEBUG("args", 0); + QList args; + args << QVariant(QString(QString::number(aMessage))); + args << QVariant(QString(QString::number(aParam1))); + args << QVariant(QString(QString::number(aParam2))); + + XQApplicationManager mAppManager; + XQAiwRequest *request; + RDEBUG("create", 0); + request = mAppManager.create("com.nokia.services.Autolock", "Autolock", "service(QString,QString,QString)", false); + // also works with create("Autolock", "service(QString,QString,QString)", false); + if(request) + { + RDEBUG("got request", 0); + } + else + { + RDEBUG("not got request", 0); + RDebug::Printf( "%s %s (%u) not got request=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + return KErrAbort; + } + + RDEBUG("setArguments", 0); + request->setArguments(args); + RDEBUG("args", 0); + int returnvalue=0; + QVariant var = QVariant(returnvalue); + RDEBUG("send", 0); + bool retSend = request->send(var); + returnvalue = var.toInt(); + RDEBUG("retSend", retSend); + RDEBUG("returnvalue", returnvalue); + int error = request->lastError(); + RDEBUG("error", error); + ret = returnvalue; + + delete request; } + RDEBUG("ret", ret); return ret; } diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationcontentwidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationcontentwidget.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,69 @@ +/* +* Copyright (c) 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" +* 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: SecUi notification content widget. +* +*/ + +#ifndef SECUINOTIFICATIONCONTENTWIDGET_H +#define SECUINOTIFICATIONCONTENTWIDGET_H + +#include // HbWidget +#include // HbWidget + +#include +#include +#include +class HbLabel; +class HbCheckBox; +class HbListWidget; + + +class SecUiNotificationContentWidget : public HbWidget +{ + Q_OBJECT + +public: + SecUiNotificationContentWidget(QGraphicsItem *parent=0, Qt::WindowFlags flags=0); + virtual ~SecUiNotificationContentWidget(); + + void constructFromParameters(const QVariantMap ¶meters); + +signals: + void memorySelectionChanged(const QString &text); + void codeTopChanged(const QString &text); + void codeTopContentChanged(); + void codeBottomChanged(const QString &text); + void but1Changed(); + void but2Changed(); + void but3Changed(); + +private: + Q_DISABLE_COPY(SecUiNotificationContentWidget) + +private: // data +public: + HbLineEdit *codeTop; + HbLineEdit *codeBottom; + HbCheckBox *checkbox; + HbLabel *DialogText; + HbListWidget *listWidget; + int queryType; + int lMinLength; + int lMaxLength; + int queryDual; + int lEmergencySupported; + int isEmergency; +}; + +#endif // SECUINOTIFICATIONCONTENTWIDGET_H diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdebug.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 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" +* 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: SecUi notification plugin dialog. +* +*/ + +#ifndef SECUINOTIFICATIONDEBUG_H +#define SECUINOTIFICATIONDEBUG_H + +#include +#ifdef _DEBUG +#define RDEBUG( x, y ) RDebug::Printf( "%s %s (%u) %s=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, x, y ); +#define RDEBUGQT( x, y ) qDebug() << __FILE__ << " " << __PRETTY_FUNCTION__ << " (" << __LINE__ << ") " << x << "=" << y ; +#else +#define RDEBUG( x, y ) +#define RDEBUGQT( x, y ) +#endif + +#endif // SECUINOTIFICATIONDEBUG_H diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdialog.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 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" +* 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: SecUi notification plugin dialog. +* +*/ + +#ifndef SECUINOTIFICATIONDIALOG_H +#define SECUINOTIFICATIONDIALOG_H + + +#include // HbDialog +#include // HbDeviceDialogInterface +#include // HbWidget +#include // HbWidget +#include +#include +#include + +#include + +class HbTranslator; + +QTM_BEGIN_NAMESPACE + class QValueSpacePublisher; + class QValueSpaceSubscriber; +QTM_END_NAMESPACE +QTM_USE_NAMESPACE + +/** + * SW Install notification widget class. + */ +class SecUiNotificationDialog : public HbDialog, public HbDeviceDialogInterface +{ + Q_OBJECT + +public: // constructor and destructor + SecUiNotificationDialog(const QVariantMap ¶meters); + virtual ~SecUiNotificationDialog(); + +public: // from HbDeviceDialogInterface + bool setDeviceDialogParameters(const QVariantMap ¶meters); + int deviceDialogError() const; + void closeDeviceDialog(bool byClient); + HbDialog *deviceDialogWidget() const; + +signals: + void deviceDialogClosed(); + void deviceDialogData(const QVariantMap &data); + +protected: // from HbPopup (via HbDialog) + void hideEvent(QHideEvent *event); + void showEvent(QShowEvent *event); + +private: // new functions + bool constructDialog(const QVariantMap ¶meters); + void sendResult(int accepted); + +private slots: + void handleAccepted(); + void handleCancelled(); + void handleMemorySelectionChanged(const QString &text); + void handleCodeTopChanged(const QString &text); + void handleCodeBottomChanged(const QString &text); + void handleCodeTopContentChanged(); + void saveFocusWidget(QWidget*,QWidget*); + void handlebut1Changed(); + void handlebut2Changed(); + void handlebut3Changed(); + +public slots: + void subscriberKSecurityUIsDismissDialogChanged(); +private: + Q_DISABLE_COPY(SecUiNotificationDialog) + + HbTranslator *mCommonTranslator; + HbTranslator *mSecUiNotificationTranslator; + int mMyId; + int mLastError; + bool mShowEventReceived; + QVariantMap mResultMap; + HbLineEdit *codeTop; + HbLineEdit *codeBottom; + HbCheckBox *checkBox; + HbListWidget *listWidget; + HbAction *okAction; + HbAction *cancelAction; + HbAction *okVKBAction; + HbLabel *titleWidget; + int queryType; + int lMinLength; + int lMaxLength; + int queryDual; + int lEmergencySupported; + int isEmergency; + QValueSpaceSubscriber *subscriberKSecurityUIsDismissDialog; +}; + +#endif // SECUINOTIFICATIONDIALOG_H diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdialogplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdialogplugin.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 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" +* 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: SecUi notification plugin class. +* +*/ + +#ifndef SECUINOTIFICATIONDIALOGPLUGIN_H +#define SECUINOTIFICATIONDIALOGPLUGIN_H + +#include // HbDeviceDialogPlugin + + +/** + * Software install notification plugin. + * Implements the HbDeviceDialogPlugin to show SW install confirmatoin dialogs. + */ +class SecUiNotificationDialogPlugin : public HbDeviceDialogPlugin +{ + Q_OBJECT + +public: + SecUiNotificationDialogPlugin(); + ~SecUiNotificationDialogPlugin(); + +public: // from HbDeviceDialogPlugin + bool accessAllowed(const QString &deviceDialogType, const QVariantMap ¶meters, + const QVariantMap &securityInfo) const; + HbDeviceDialogInterface *createDeviceDialog(const QString &deviceDialogType, + const QVariantMap ¶meters); + bool deviceDialogInfo(const QString &deviceDialogType, const QVariantMap ¶meters, + DeviceDialogInfo *info) const; + QStringList deviceDialogTypes() const; + PluginFlags pluginFlags() const; + int error() const; + +private: + Q_DISABLE_COPY(SecUiNotificationDialogPlugin) + + int mError; +}; + +#endif // SECUINOTIFICATIONDIALOGPLUGIN_H diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdialogpluginkeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdialogpluginkeys.h Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 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" +* 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: SecUi notification keys. +* +*/ + +#ifndef SECUINOTIFICATIONPLUGINKEYS_H +#define SECUINOTIFICATIONPLUGINKEYS_H + +#include + +// Device dialog type +#define SECUINOTIFICATIONDIALOG "com.nokia.secuinotificationdialog/1.0" + +// Keys for the parameters passed to notification framework plugin +const QString KDialogTitle = "title"; +const QString KApplicationName = "application"; +const QString KQueryType = "type"; +const QString KQueryMinLength = "MinLength"; +const QString KQueryMaxLength = "MaxLength"; +const QString KApplicationIcon = "icon"; +const QString KSupplier = "supplier"; +const QString KMemorySelection = "memory"; +const QString KCertificates = "certificates"; +const QString KDrmDetails = "drmDetails"; +const QString KCodeTop = "codeTop"; +const QString KCodeBottom = "codeBottom"; // not really needed because is never sent back +const QString KEmergency = "emergency"; +const QString KInvalidNewLockCode = "invalidNewLockCode"; +const QString KDefaultCode = "DefaultCode"; + +const QString KChecboxType = "ChecboxDialog"; +const QString KMultiChecboxType = "MultiChecboxDialog"; +// Keys for the return values passed back to calling application +const QString KResultAccepted = "accepted"; // int +const QString KSelectedMemoryIndex = "memory"; // int +const QString KCodeTopIndex = "codeTop"; // int +const QString KCodeBottomIndex = "codeBottom"; // int // not really needed because is never sent back + +// Error values +const int KNoError = 0; + +#endif // SECUINOTIFICATIONPLUGINKEYS_H diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/secuinotifications/secuinotificationdialogplugin/resources/cert.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/resources/cert.svg Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/secuinotifications/secuinotificationdialogplugin/resources/drm.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/resources/drm.svg Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/secuinotifications/secuinotificationdialogplugin/resources/qgn_indi_midp_trusted.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/resources/qgn_indi_midp_trusted.svg Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/secuinotifications/secuinotificationdialogplugin/resources/qgn_menu_am_midlet.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/resources/qgn_menu_am_midlet.svg Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/secuinotifications/secuinotificationdialogplugin/resources/qgn_menu_am_sis.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/resources/qgn_menu_am_sis.svg Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/secuinotifications/secuinotificationdialogplugin/resources/qgn_menu_am_widget.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/resources/qgn_menu_am_widget.svg Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/secuinotifications/secuinotificationdialogplugin/resources/qgn_prop_drm_rights_valid.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/resources/qgn_prop_drm_rights_valid.svg Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/secuinotifications/secuinotificationdialogplugin/rom/secuinotificationdialogplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/rom/secuinotificationdialogplugin.iby Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 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" +* 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: ROM image files for SecUi notification dialog plugin. +* +*/ + +#ifndef __SECUINOTIFICATIONDIALOGPLUGIN_IBY__ +#define __SECUINOTIFICATIONDIALOGPLUGIN_IBY__ + +REM DLL +file=ABI_DIR\UREL\secuinotificationdialogplugin.dll SHARED_LIB_DIR\secuinotificationdialogplugin.dll UNPAGED +data=\epoc32\data\z\pluginstub\secuinotificationdialogplugin.qtplugin \resource\plugins\devicedialogs\secuinotificationdialogplugin.qtplugin +data=\epoc32\data\z\resource\qt\crml\secuinotificationdialogplugin.qcrml \resource\qt\crml\secuinotificationdialogplugin.qcrml + +/* This is for testing purposes +file=ABI_DIR\UREL\SecUiTest.exe SHARED_LIB_DIR\SecUiTest.exe +data=\epoc32\data\z\resource\apps\SecUiTest.rsc \resource\apps\SecUiTest.rsc +data=\epoc32\data\z\private\10003a3f\import\apps\SecUiTest_reg.rsc \private\10003a3f\import\apps\SecUiTest_reg.rsc +*/ +#endif // __SECUINOTIFICATIONDIALOGPLUGIN_IBY__ diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/secuinotifications/secuinotificationdialogplugin/rom/secuinotificationdialogplugin_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/rom/secuinotificationdialogplugin_resources.iby Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 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: +* +*/ + +#ifndef __SECUINOTIFICATIONDIALOGPLUGIN_RESOURCES_IBY__ +#define __SECUINOTIFICATIONDIALOGPLUGIN_RESOURCES_IBY__ + +#include +#include + +data=DATAZ_\QT_TRANSLATIONS_DIR\secui.qm QT_TRANSLATIONS_DIR\secui.qm + +#endif // __SECUINOTIFICATIONDIALOGPLUGIN_RESOURCES_IBY__ diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/secuinotifications/secuinotificationdialogplugin/secui.ts --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/secui.ts Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,102 @@ + + + + + nString + + Autolock must be active + en #Autolock must be active + + + PIN2 code: + en #PIN2 code: + + + Insert SIM + en #Insert SIM + + + Gsm Invalid Parameter + en #Gsm Invalid Parameter + + + New UPIN code: + en #New UPIN code: + + + New PIN code: + en #New PIN code: + + + PIN2 rejected + en #PIN2 rejected + + + %Ln attempts remaining + + en #MISSING + en #MISSING + + + + Operation not supported + en #Operation not supported + + + Security Blocked + en #Security Blocked + + + Operation not Allowed + en #Operation not Allowed + + + Emergency calls only + en #Emergency calls only + + + UPIN code: + en #UPIN code: + + + Wrong PIN code + en #Wrong PIN code + + + Retype PIN code: + en #Retype PIN code: + + + If failed call customer care to get PUK code + en #If failed call customer care to get PUK code + + + Code chaged + en #Code chaged + + + Access Denied + en #Access Denied + + + PUK code: + en #PUK code: + + + PIN code: + en #PIN code: + + + UPIN not Allowed + en #UPIN not Allowed + + + Last attempt + en #Last attempt + + + Retype UPIN code: + en #Retype UPIN code: + + + \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/secuinotifications/secuinotificationdialogplugin/secuinotificationdialogplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/secuinotificationdialogplugin.pro Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,70 @@ +# +# Copyright (c) 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" +# 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: SecUi notification dialog plugin project. +# + +TEMPLATE = lib +TARGET = secuinotificationdialogplugin +CONFIG += plugin +TRANSLATIONS = secui.ts + +CONFIG += hb +CONFIG += mobility +MOBILITY = publishsubscribe + +# directories +INCLUDEPATH += . +DEPENDPATH += . +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE +INCLUDEPATH += ../../../../inc + +HEADERS += inc/secuinotificationdialogplugin.h \ + inc/secuinotificationdialog.h \ + inc/secuinotificationcontentwidget.h + +SOURCES += src/secuinotificationdialogplugin.cpp \ + src/secuinotificationdialog.cpp \ + src/secuinotificationcontentwidget.cpp + +RESOURCES += secuinotificationdialogplugin.qrc + +symbian: { + TARGET.EPOCALLOWDLLDATA = 1 + # NetworkControl NetworkServices needed for emergency calls + TARGET.CAPABILITY = CAP_GENERAL_DLL NetworkControl NetworkServices + TARGET.UID3 = 0x2102432C # TODO: allocate UID + + pluginstub.sources = secuinotificationdialogplugin.dll + pluginstub.path = /resource/plugins/devicedialogs + DEPLOYMENT += pluginstub + crml.sources = secuinotificationdialogplugin.qcrml + crml.path = c:/resource/qt/crml + DEPLOYMENT += crml +} +BLD_INF_RULES.prj_exports += \ + "$${LITERAL_HASH}include " \ + "qmakepluginstubs/secuinotificationdialogplugin.qtplugin /epoc32/data/z/pluginstub/secuinotificationdialogplugin.qtplugin"\ + "rom/secuinotificationdialogplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(secuinotificationdialogplugin.iby)"\ + "rom/secuinotificationdialogplugin_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(secuinotificationdialogplugin_resources.iby)" + +LIBS += -lxqservice +LIBS += -lphoneclient + +tests { + test.depends = sub-src + test.commands += cd tsrc && $(MAKE) test + autotest.depends = sub-src + autotest.commands += cd tsrc && $(MAKE) autotest + QMAKE_EXTRA_TARGETS += test autotest +} diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/secuinotifications/secuinotificationdialogplugin/secuinotificationdialogplugin.qcrml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/secuinotificationdialogplugin.qcrml Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,10 @@ + + + + + + + + + + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/secuinotifications/secuinotificationdialogplugin/secuinotificationdialogplugin.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/secuinotificationdialogplugin.qrc Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,6 @@ + + + resources/cert.svg + resources/drm.svg + + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationcontentwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationcontentwidget.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,367 @@ +/* +* Copyright (c) 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" +* 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: SecUi notification content widget. +* +*/ + +#include "secuinotificationdebug.h" +#include "secuinotificationcontentwidget.h" +#include "secuinotificationdialogpluginkeys.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include // needed for a checkbox dialog +#include // needed for multicheckbox dialog +#include +#include +#include + +#define ESecUiCancelSupported 0x1000000 +#define ESecUiCancelNotSupported 0x0000000 + +#define ESecUiEmergencySupported 0x2000000 +#define ESecUiEmergencyNotSupported 0x0000000 + +#define ESecUiAlphaSupported 0x4000000 +#define ESecUiAlphaNotSupported 0x0000000 + +#define ESecUiSecretSupported 0x8000000 +#define ESecUiSecretNotSupported 0x0000000 + +#define ESecUiMaskFlags 0xFF000000 +#define ESecUiMaskType 0x00FFFFFF + +#define ESecUiTypeDeviceLock 0x00100000 +#define ESecUiTypeKeyguard 0x00200000 +#define ESecUiTypeClock 0x00300000 +#define ESecUiTypeScreensaver 0x00400000 + +#define ESecUiTypeMaskLock 0x00F00000 + + +// ---------------------------------------------------------------------------- +// SecUiNotificationContentWidget::SecUiNotificationContentWidget() +// ---------------------------------------------------------------------------- +// +SecUiNotificationContentWidget::SecUiNotificationContentWidget( + QGraphicsItem *parent, Qt::WindowFlags flags) : HbWidget(parent, flags) +{ + RDEBUG("0", 0); +} + +// ---------------------------------------------------------------------------- +// SecUiNotificationContentWidget::~SecUiNotificationContentWidget() +// ---------------------------------------------------------------------------- +// +SecUiNotificationContentWidget::~SecUiNotificationContentWidget() +{ +} + +// ---------------------------------------------------------------------------- +// SecUiNotificationContentWidget::constructFromParameters() +// ---------------------------------------------------------------------------- +// +void SecUiNotificationContentWidget::constructFromParameters(const QVariantMap ¶meters) +{ + RDEBUG("0", 0); + RDEBUGQT("parameters", parameters); + QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(Qt::Vertical); + + lMinLength = 4; // might be replaced later + lMaxLength = 8; // might be replaced later + queryDual=0; + isEmergency=0; + codeTop=0; + + // KApplicationSize + if (parameters.contains(KQueryType)) { + RDEBUG("0", 0); + queryType = parameters.value(KQueryType).toUInt(); + RDEBUG("queryType", queryType); + if( (queryType & ESecUiTypeMaskLock) ) + { + RDEBUG("KQueryType=ESecUiTypeMaskLock", queryType); + // showing "Lock" icon. All other params are irrelevant. codeTop is not even created + + HbLabel *iconLabel = new HbLabel("Locked"); + HbIcon *icon = new HbIcon("qtg_large_device_lock"); + // iconLabel->setAspectRatioMode(Qt::IgnoreAspectRatio); + // iconLabel->setGeometry(QRectF(QPointF(10,10),QSizeF(300,300))); + iconLabel->setIcon(*icon); + if( (queryType & ESecUiTypeMaskLock)==ESecUiTypeDeviceLock ) + { // really big icon for the devicelock + iconLabel->setPreferredHeight(500); + iconLabel->setPreferredWidth(500); + } + else if( (queryType & ESecUiTypeMaskLock)==ESecUiTypeKeyguard ) + { // smaller icon for the keyguard + iconLabel->setPreferredHeight(100); + iconLabel->setPreferredWidth(100); + } + + // icon->setWidth(300); + // icon->setHeight(350); + // icon->setGeometry(QRectF(QPointF(10,10),QSizeF(500,300))); + // icon->setSize(QSizeF(300,300)); + + mainLayout->addItem(iconLabel); + mainLayout->setAlignment(iconLabel, Qt::AlignCenter ); + // mainLayout->setGeometry(QRectF(QPointF(10,10),QSizeF(300,300))); + + /* + QToolButton* mLabelIcon = new QToolButton; + mLabelIcon->setIcon(QIcon(":/AutolockSrv_hbicon/qtg_large_device_lock.svg")); + mLabelIcon->setIconSize(QSize(300,300)); + HbLabel *iconLabel = new HbLabel("Locked"); + iconLabel->setIcon(*mLabelIcon); + mainLayout->addItem(iconLabel); + */ + + // mainLayout->setContentsMargins(10,10,300,500); // this makes the dialog really big + setLayout(mainLayout); // same as at the end + return; + } + // not ESecUiTypeMaskLock + lEmergencySupported = ESecUiEmergencyNotSupported; + if((queryType & ESecUiEmergencySupported)==ESecUiEmergencySupported) + { + lEmergencySupported = ESecUiEmergencySupported; + } + RDEBUG("lEmergencySupported", lEmergencySupported); + } + + if (parameters.contains(KQueryMinLength)) { + RDEBUG("KQueryMinLength", 0); + lMinLength = parameters.value(KQueryMinLength).toUInt(); + RDEBUG("lMinLength", lMinLength); + } + if (parameters.contains(KQueryMaxLength)) { + RDEBUG("KQueryMaxLength", 0); + lMaxLength = parameters.value(KQueryMaxLength).toUInt(); + RDEBUG("lMaxLength", lMaxLength); + } + + if (parameters.contains(KEmergency)) { + RDEBUG("KEmergency", 0); + QString emergencyText = parameters.value(KEmergency).toString(); + RDEBUGQT("emergencyText", emergencyText); + if(!emergencyText.compare("emergencyYes")) + { + RDEBUG("emergencyYes", 1); + isEmergency = 1; + } + if(!emergencyText.compare("emergencyNo")) + { + RDEBUG("emergencyNo", 0); + isEmergency = 0; + } + } + + + // KCodeTop + if (parameters.contains(KCodeTop)) { + RDEBUG("KCodeTop", 0); + codeTop = new HbLineEdit(""); // no default value + RDEBUG("queryType", queryType); + codeTop->setInputMethodHints(Qt::ImhDigitsOnly); // default + if (queryType & ESecUiAlphaSupported) + { + RDEBUG("ESecUiAlphaSupported", ESecUiAlphaSupported); + codeTop->setInputMethodHints(Qt::ImhNone); + } + if (queryType & ESecUiSecretSupported) + { + RDEBUG("ESecUiSecretSupported", ESecUiSecretSupported); + codeTop->setEchoMode(HbLineEdit::PasswordEchoOnEdit); + } + RDEBUG("lMaxLength", lMaxLength); + if(lMaxLength>2) + codeTop->setMaxLength(lMaxLength); + + if (parameters.contains(KDefaultCode)) { + RDEBUG("KDefaultCode", 0); + QString defaultCode = parameters.value(KDefaultCode).toString(); + RDEBUGQT("defaultCode", defaultCode); + codeTop->setText(defaultCode); + } + RDEBUG("1", 1); + + connect(codeTop, SIGNAL(textChanged(const QString &)), this, SIGNAL(codeTopChanged(const QString &))); + connect(codeTop, SIGNAL(contentsChanged()), this, SIGNAL(codeTopContentChanged())); + + if (parameters.contains(KDefaultCode)) { // this is done in this step so that the OK becomes valid (if rules are fulfilled) + RDEBUG("KDefaultCode", 0); + QString defaultCode = parameters.value(KDefaultCode).toString(); + RDEBUGQT("defaultCode", defaultCode); + codeTop->setText(defaultCode); + } + RDEBUG("2", 2); + + if (parameters.contains(KDialogTitle)) { + QString titleText = parameters.value(KDialogTitle).toString(); + QString titleAttempts = ""; + if(titleText.indexOf('|')>0) + { // if separator, take only first part + titleText = titleText.left(titleText.indexOf('|')); + } + if(titleText.indexOf('$')>0) + { // if separator, take only first part + // it comes translated alredy, from the client + titleAttempts = titleText.right(titleText.length()-titleText.indexOf('$')-1); + RDEBUGQT("titleAttempts", titleAttempts); + int nAttempts = titleAttempts.toInt(); + RDEBUG("nAttempts", nAttempts); + titleText = titleText.left(titleText.indexOf('$')); // this comes translated already + if(nAttempts==1) // last attempt + { + // This must be in a new line, to avoid problems with left-to-right writing + titleAttempts = hbTrId("txt_pin_code_dpophead_last_attempt"); + } + else if(nAttempts>0) + { + titleAttempts = hbTrId("attempts") + "=" + QString::number(nAttempts); + // TODO this requires %L1 localization using txt_pin_code_dpopinfo_ln_attempts_remaining + } + else if(nAttempts==0) + { + titleAttempts = ""; // something special for the last attempt ? + } + else + { + titleAttempts = ""; + } + } + HbLabel *titleTop = new HbLabel(titleText); + mainLayout->addItem(titleTop); + if (titleAttempts.length()>0 ) + { + HbLabel *titleTopAttemps = new HbLabel(titleAttempts); + mainLayout->addItem(titleTopAttemps); + } + // in the dialog, it was setHeadingWidget(title); + } + RDEBUG("3", 3); + mainLayout->addItem(codeTop); + // double-query + if (parameters.contains(KCodeBottom)) + { + queryDual=1; + QString titleText = parameters.value(KDialogTitle).toString(); + if(titleText.indexOf('|')>0) + { // if no separator, don't create label + QString titleBottomStr = titleText.right(titleText.length()-titleText.indexOf('|')-1); + // no need to translate + HbLabel *titleBottom = new HbLabel(titleBottomStr); + mainLayout->addItem(titleBottom); + } + + codeBottom = new HbLineEdit(""); // no default value + if(lMaxLength>2) + codeBottom->setMaxLength(lMaxLength); + codeBottom->setInputMethodHints(Qt::ImhDigitsOnly); // default + if (queryType & ESecUiAlphaSupported) + { + RDEBUG("setInputMethodHints", 0); + codeBottom->setInputMethodHints(Qt::ImhNone); + } + if (queryType & ESecUiSecretSupported) + { + RDEBUG("ESecUiSecretSupported", 0); + codeBottom->setEchoMode(HbLineEdit::PasswordEchoOnEdit); // this will also remove predictive, which is what we want + } + RDEBUG("connecting", 0); + connect(codeBottom, SIGNAL(textChanged(const QString &)), this, SIGNAL(codeBottomChanged(const QString &))); + connect(codeBottom, SIGNAL(contentsChanged(const QString &)), this, SIGNAL(codeBottomChanged(const QString &))); + mainLayout->addItem(codeBottom); + } + + QGraphicsLinearLayout *mainLayoutButtons = new QGraphicsLinearLayout(Qt::Horizontal); + HbPushButton *but1 = new HbPushButton("1234"); + HbPushButton *but2 = new HbPushButton("+1"); + HbPushButton *but3 = new HbPushButton("+5"); + connect(but1, SIGNAL(clicked()), this, SIGNAL(but1Changed())); + connect(but2, SIGNAL(clicked()), this, SIGNAL(but2Changed())); + connect(but3, SIGNAL(clicked()), this, SIGNAL(but3Changed())); + #if defined(_DEBUG) + mainLayoutButtons->addItem(but1); + mainLayoutButtons->addItem(but2); + mainLayoutButtons->addItem(but3); + #endif + + mainLayout->addItem(mainLayoutButtons); + + // remove setFocus from PIN query because Orbit can't handle it + // codeTop->setFocus(); // this should open the VKB + + } + + if (parameters.contains(KChecboxType)) { + RDEBUG("KChecboxType", 0); + if (parameters.contains(KDialogTitle)) { + //TODO position of the label is not centered + QString tmpText=parameters.value(KDialogTitle).toString(); + if (tmpText.endsWith("\n")) tmpText=tmpText.left(tmpText.length()-1); + DialogText= new HbLabel(tmpText); + DialogText->setTextWrapping(Hb::TextWordWrap); + DialogText->setAlignment(Qt::AlignVCenter); + mainLayout->addItem(DialogText); + } + + checkbox = new HbCheckBox("Caption"); + if (parameters.contains(KDefaultCode)) { + RDEBUG("KDefaultCode", 0); + QStringList list1 = parameters.value(KDefaultCode).toString().split("|"); + if (!list1.isEmpty() && list1.count()==2) { + if (!list1[0].isNull() && !list1[0].isEmpty()) checkbox->setText(list1[0]); + if (!list1[1].isNull() && !list1[1].isEmpty()) checkbox->setChecked(list1[1].toInt()); + } + // TODO this needs localization + } + mainLayout->addItem(checkbox); + } + + if (parameters.contains(KMultiChecboxType) && parameters.contains(KDefaultCode)) + { + RDEBUG("KMultiChecboxType", 0); + QStringList list1 = parameters.value(KDefaultCode).toString().split("1\t"); + if (!list1.isEmpty()) { + listWidget = new HbListWidget(); + for (int i = 0; (i < list1.count()); i++) + if (!list1[i].isEmpty() && !list1[i].isNull()) { + HbListWidgetItem* modelItem = new HbListWidgetItem(); + modelItem->setData(QVariant(list1[i]), Qt::DisplayRole); + // TODO this needs localization + listWidget->addItem(modelItem); + } + listWidget->setCurrentRow(0); + listWidget->setSelectionMode(HbAbstractItemView::MultiSelection); + //listWidget->setClampingStyle(HbScrollArea::BounceBackClamping); + listWidget->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAsNeeded); + listWidget->setMaximumHeight(150); + mainLayout->addItem(listWidget); + // delete listWidget; + } + } + + setLayout(mainLayout); + } + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialog.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,877 @@ +/* +* Copyright (c) 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" +* 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: SecUi notification plugin class. +* +*/ + +#include "secuinotificationdebug.h" +#include "secuinotificationdialog.h" +#include "secuinotificationdialogpluginkeys.h" +#include "secuinotificationcontentwidget.h" +// #include // HbPopupBase::NoTimeout +#include +#include +#include +#include +#include +#include +#include // for TARM error codes while validating new lock code +#include +#include +#include +#include + +QTM_USE_NAMESPACE + +const QString KTranslationsPath = "/resource/qt/translations/"; +const QString KSecUiNotificationTranslationsFile = "secui"; +const QString KCommonTranslationsFile = "common"; + +#include +#include +#define ESecUiBasicTypeText 0x0000000 +#define ESecUiBasicTypeCheck 0x0010000 +#define ESecUiBasicTypeCheckMulti 0x0020000 +#define ESecUiBasicTypeMask 0x00F0000 + +#define ESecUiCancelSupported 0x1000000 +#define ESecUiCancelNotSupported 0x0000000 + +#define ESecUiEmergencySupported 0x2000000 +#define ESecUiEmergencyNotSupported 0x0000000 + +#define ESecUiAlphaSupported 0x4000000 +#define ESecUiAlphaNotSupported 0x0000000 + +#define ESecUiSecretSupported 0x8000000 +#define ESecUiSecretNotSupported 0x0000000 + +#define ESecUiMaskFlags 0xFF000000 +#define ESecUiMaskType 0x00FFFFFF + +#define ESecUiTypeDeviceLock 0x00100000 +#define ESecUiTypeKeyguard 0x00200000 +#define ESecUiTypeClock 0x00300000 +#define ESecUiTypeScreensaver 0x00400000 + +#define ESecUiTypeMaskLock 0x00F00000 + +const TUid KPSUidSecurityUIs = { 0x100059b5 }; +const TUint32 KSecurityUIsDismissDialog = 0x00000309; + +enum TSecurityUIsDismissDialogValues + { + ESecurityUIsDismissDialogUninitialized = 0, + ESecurityUIsDismissDialogOn, + ESecurityUIsDismissDialogProcessing, + ESecurityUIsDismissDialogDone, + ESecurityUIsDismissDialogLastValue + }; + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialog::SecUiNotificationDialog() +// ---------------------------------------------------------------------------- +// +SecUiNotificationDialog::SecUiNotificationDialog( + const QVariantMap ¶meters) : HbDialog(), mCommonTranslator(0), mSecUiNotificationTranslator(0), mLastError(KNoError) +{ + RDEBUG("0", 0); + TTime myTime; + myTime.HomeTime(); + mMyId = I64LOW( myTime.Int64() ); + mCommonTranslator = new HbTranslator(KTranslationsPath, KCommonTranslationsFile); + mSecUiNotificationTranslator = new HbTranslator(KTranslationsPath, KSecUiNotificationTranslationsFile); + constructDialog(parameters); +} + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialog::~SecUiNotificationDialog() +// ---------------------------------------------------------------------------- +// +SecUiNotificationDialog::~SecUiNotificationDialog() +{ + RDEBUG("0", 0); + delete mSecUiNotificationTranslator; + delete mCommonTranslator; + RDEBUG("0", 0); + // TODO what about subscriberKSecurityUIsDismissDialog + // and codeTop + RDEBUG("1", 1); +} + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialog::setDeviceDialogParameters() +// ---------------------------------------------------------------------------- +// +bool SecUiNotificationDialog::setDeviceDialogParameters(const QVariantMap ¶meters) +{ + RDEBUG("0", 0); + return constructDialog(parameters); +} + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialog::deviceDialogError() +// ---------------------------------------------------------------------------- +// +int SecUiNotificationDialog::deviceDialogError() const +{ + RDEBUG("mLastError", mLastError); + RDEBUG("mMyId", mMyId); + return mLastError; +} + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialog::closeDeviceDialog +// ---------------------------------------------------------------------------- +// +void SecUiNotificationDialog::closeDeviceDialog(bool byClient) +{ + Q_UNUSED(byClient); + RDEBUG("mMyId", mMyId); + RDEBUG("calling close()", 0); + close(); + RDEBUG("mShowEventReceived", mShowEventReceived); + + // If show event has been received, close is signalled from hide event. + // If not, hide event does not come and close is signalled from here. + if (!mShowEventReceived) { + RDEBUG("emitting deviceDialogClosed", 0); + emit deviceDialogClosed(); + if(1==0 && subscriberKSecurityUIsDismissDialog) + { + RDEBUG("disconnect subscriberKSecurityUIsDismissDialog", 0); + disconnect(subscriberKSecurityUIsDismissDialog, SIGNAL(contentsChanged()), this, SLOT(subscriberKSecurityUIsDismissDialogChanged())); + RDEBUG("disconnected subscriberKSecurityUIsDismissDialog", 1); + if(1==1) + { + RDEBUG("deleting subscriberKSecurityUIsDismissDialog", 0); + delete subscriberKSecurityUIsDismissDialog; + subscriberKSecurityUIsDismissDialog = NULL; + RDEBUG("deleted subscriberKSecurityUIsDismissDialog", 1); + } + } + } + RDEBUG("0", 0); +} + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialog::deviceDialogWidget +// ---------------------------------------------------------------------------- +// +HbDialog *SecUiNotificationDialog::deviceDialogWidget() const +{ + return const_cast(this); +} + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialog::hideEvent +// ---------------------------------------------------------------------------- +// +void SecUiNotificationDialog::hideEvent(QHideEvent *event) +{ + RDEBUG("0", 0); + HbDialog::hideEvent(event); + RDEBUG("mMyId", mMyId); + RDEBUG("calling close()", 0); + close(); + RDEBUG("emitting deviceDialogClosed", 0); + emit deviceDialogClosed(); + RDEBUG("deviceDialogClosed", 1); + if(1==0 && subscriberKSecurityUIsDismissDialog) + { + RDEBUG("disconnect subscriberKSecurityUIsDismissDialog", 0); + disconnect(subscriberKSecurityUIsDismissDialog, SIGNAL(contentsChanged()), this, SLOT(subscriberKSecurityUIsDismissDialogChanged())); + RDEBUG("disconnected subscriberKSecurityUIsDismissDialog", 1); + if(1==1) + { + RDEBUG("deleting subscriberKSecurityUIsDismissDialog", 0); + delete subscriberKSecurityUIsDismissDialog; + subscriberKSecurityUIsDismissDialog = NULL; + RDEBUG("deleted subscriberKSecurityUIsDismissDialog", 1); + } + } + // old method was emit deviceDialogClosed(); + RDEBUG("0", 0); +} + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialog::showEvent +// ---------------------------------------------------------------------------- +// +void SecUiNotificationDialog::showEvent(QShowEvent *event) +{ + RDEBUG("0", 0); + RDEBUG("mMyId", mMyId); + HbDialog::showEvent(event); + + if(!(queryType & ESecUiTypeMaskLock)) + { // not for the "lock icon" + RDEBUG("check default.1", 0); + if(codeTop!=NULL) + { + RDEBUG("check default.2", 0); + if(codeTop->text().length()>0) // there's a default value. Verify it and (might) enable OK + { + RDEBUG("check default.3", 0); + handleCodeTopChanged(codeTop->text()); + } + RDEBUG("setFocus", 0); + // remove setFocus from PIN query because Orbit can't handle it + // codeTop->setFocus(); // this should open the VKB . Doesn't seem to work when it's done on the widget, so it's done here. + } // codeTop!=NULL + + const TUint32 KSecurityUIsTestCode = 0x00000307; + TInt value = 0; + TInt err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsTestCode, value ); + RDEBUG("KSecurityUIsTestCode err", err); + RDEBUG("faking value", value); + RDEBUG("mShowEventReceived", mShowEventReceived); + if(value>0 && value<1000000 && mShowEventReceived==true) // show happens 2 times. Dialog can be closed only the second. + { + QString myString = ""; + myString += QString("%1").arg(value); + RDEBUGQT("myString", myString); + codeTop->setText( myString ); + TInt err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsTestCode, 0 ); // clear after using it + RDEBUGQT("calling handleAccepted myString", myString); + emit handleAccepted(); + // handleAccepted already emit closeDeviceDialog(false); // false means "not by client", although it's not really used + } + } + mShowEventReceived = true; + RDEBUG("1", 1); +} + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialog::constructDialog() +// ---------------------------------------------------------------------------- +// +bool SecUiNotificationDialog::constructDialog(const QVariantMap ¶meters) + { + RDEBUG("0", 0); + RDEBUG("mMyId", mMyId); + setTimeout(HbPopup::NoTimeout); + setDismissPolicy(HbPopup::NoDismiss); + setModal(true); + mShowEventReceived = false; + subscriberKSecurityUIsDismissDialog = NULL; + titleWidget = NULL; + RDEBUG("subscriberKSecurityUIsDismissDialog NULL", 0); + + subscriberKSecurityUIsDismissDialog = new QValueSpaceSubscriber("/KPSUidSecurityUIs/KSecurityUIsDismissDialog", this); + if(subscriberKSecurityUIsDismissDialog) + { + RDEBUG("subscriberKSecurityUIsDismissDialog created", 1); + } + else + { + RDEBUG("subscriberKSecurityUIsDismissDialog not created", 0); + } + connect(subscriberKSecurityUIsDismissDialog, SIGNAL(contentsChanged()), this, SLOT(subscriberKSecurityUIsDismissDialogChanged())); + RDEBUG("subscriberKSecurityUIsDismissDialog", 1); + + // Title + // this is also done later in the widget + // For now, it only says "Security" + if (parameters.contains(KDialogTitle)) { + QString titleText = parameters.value(KDialogTitle).toString(); + QString titleAttempts = ""; + if(titleText.indexOf('|')>0) + { // if separator, take only first part + titleText = titleText.left(titleText.indexOf('|')); + } + if(titleText.indexOf('$')>0) + { // if separator, take only first part + titleAttempts = titleText.right(titleText.length()-titleText.indexOf('$')-1); + RDEBUGQT("titleAttempts", titleAttempts); + int nAttempts = titleAttempts.toInt(); + RDEBUG("nAttempts", nAttempts); + titleText = titleText.left(titleText.indexOf('$')); + if(nAttempts>0) + titleText = titleText + " attempts=" + QString::number(nAttempts); + } + titleText = hbTrId("Security Query"); // this is the header, for any potential later error which needs to be displayed + // This is created only if needed (i.e. errors for NewLockCode) + // titleWidget = new HbLabel(titleText); + // setHeadingWidget(titleWidget); + } + + if (parameters.contains(KEmergency)) { + RDEBUG("KEmergency", 1); + QString emergencyText = parameters.value(KEmergency).toString(); + RDEBUGQT("emergencyText", emergencyText); + if(!emergencyText.compare("emergencyYes")) + { + RDEBUG("emergencyYes", 1); + isEmergency = 1; + okAction->setEnabled(true); + okAction->setText(hbTrId("Call")); + return true; + } + if(!emergencyText.compare("emergencyNo")) + { + RDEBUG("emergencyNo", 1); + isEmergency = 0; + okAction->setEnabled(false); // 112 -> 1122 (=password) . This is handled by < lMinLength + okAction->setText(hbTrId("Ok")); + return true; + } + } + // after TARM validation. + if (parameters.contains(KInvalidNewLockCode)) { + RDEBUG("KInvalidNewLockCode", 0); + QString invalidText = parameters.value(KInvalidNewLockCode).toString(); + RDEBUGQT("invalidText", invalidText); + QString newTitleText = "Lock Code"; // TODO take from the original one + + QString invalidStr = invalidText.right(invalidText.length()-invalidText.indexOf('$')-1); + int invalidNumber = invalidStr.toInt(); + RDEBUG("invalidNumber", invalidNumber); + if(invalidNumber<0) // that is, -1 + { + RDEBUG("invalidNumber<0", invalidNumber ); + // nothing to do + } + if(invalidNumber==EDeviceLockAutolockperiod) + { + RDEBUG("EDeviceLockAutolockperiod", invalidNumber ); + newTitleText+=hbTrId("EDeviceLockAutolockperiod"); + } + if(invalidNumber==EDeviceLockMaxAutolockPeriod) + { + RDEBUG("EDeviceLockAutolockperiod", invalidNumber ); + newTitleText+=hbTrId("EDeviceLockMaxAutolockPeriod"); + } + if(invalidNumber==EDeviceLockMinlength) + { + RDEBUG("EDeviceLockMinlength", invalidNumber ); + newTitleText+=hbTrId("EDeviceLockMinlength"); + } + if(invalidNumber==EDeviceLockMaxlength) + { + RDEBUG("EDeviceLockMaxlength", invalidNumber ); + newTitleText+=hbTrId("EDeviceLockMaxlength"); + } + if(invalidNumber==EDeviceLockRequireUpperAndLower) + { + RDEBUG("EDeviceLockRequireUpperAndLower", invalidNumber ); + newTitleText+=hbTrId("EDeviceLockRequireUpperAndLower"); + } + if(invalidNumber==EDeviceLockRequireCharsAndNumbers) + { + RDEBUG("EDeviceLockMaxlength", invalidNumber ); + newTitleText+=hbTrId("EDeviceLockMaxlength"); + } + if(invalidNumber==EDeviceLockAllowedMaxRepeatedChars) + { + RDEBUG("EDeviceLockAllowedMaxRepeatedChars", invalidNumber ); + newTitleText+=hbTrId("EDeviceLockAllowedMaxRepeatedChars"); + } + if(invalidNumber==EDeviceLockHistoryBuffer) + { + RDEBUG("EDeviceLockHistoryBuffer", invalidNumber ); + newTitleText+=hbTrId("EDeviceLockHistoryBuffer"); + } + if(invalidNumber==EDeviceLockPasscodeExpiration) + { + RDEBUG("EDeviceLockPasscodeExpiration", invalidNumber ); + newTitleText+=hbTrId("EDeviceLockPasscodeExpiration"); + } + if(invalidNumber==EDeviceLockMinChangeTolerance) + { + RDEBUG("EDeviceLockMinChangeTolerance", invalidNumber ); + newTitleText+=hbTrId("EDeviceLockMinChangeTolerance"); + } + if(invalidNumber==EDeviceLockMinChangeInterval) + { + RDEBUG("EDeviceLockMinChangeInterval", invalidNumber ); + newTitleText+=hbTrId("EDeviceLockMinChangeInterval"); + } + if(invalidNumber==EDeviceLockDisallowSpecificStrings) + { + RDEBUG("EDeviceLockDisallowSpecificStrings", invalidNumber ); + newTitleText+=hbTrId("EDeviceLockDisallowSpecificStrings"); + } + if(invalidNumber==EDeviceLockAllowedMaxAtempts) + { + RDEBUG("EDeviceLockAllowedMaxAtempts", invalidNumber ); + newTitleText+=hbTrId("EDeviceLockAllowedMaxAtempts"); + } + if(invalidNumber==EDeviceLockConsecutiveNumbers) + { + RDEBUG("EDeviceLockConsecutiveNumbers", invalidNumber ); + newTitleText+=hbTrId("EDeviceLockConsecutiveNumbers"); + } + if(invalidNumber==EDeviceLockMinSpecialCharacters) + { + RDEBUG("EDeviceLockMinSpecialCharacters", invalidNumber ); + newTitleText+=hbTrId("EDeviceLockMinSpecialCharacters"); + } + if(invalidNumber==EDeviceLockSingleCharRepeatNotAllowed) + { + RDEBUG("EDeviceLockSingleCharRepeatNotAllowed", invalidNumber ); + newTitleText+=hbTrId("EDeviceLockSingleCharRepeatNotAllowed"); + } + if(invalidNumber==EDevicelockConsecutiveCharsNotAllowed) + { + RDEBUG("EDevicelockConsecutiveCharsNotAllowed", invalidNumber ); + newTitleText+=hbTrId("EDevicelockConsecutiveCharsNotAllowed"); + } + if(invalidNumber>=EDevicelockTotalPolicies) + { + RDEBUG("EDevicelockTotalPolicies", invalidNumber ); + newTitleText+=hbTrId("EDevicelockTotalPolicies"); + } + if( !titleWidget ) + { + RDEBUG("creating titleWidget", 0 ); + titleWidget = new HbLabel(hbTrId("New lock code")); // it will be changed later + setHeadingWidget(titleWidget); + } + RDEBUG("setPlainText", 0 ); + titleWidget->setPlainText(newTitleText); + + if(invalidNumber<0) // everything is ok + { + okAction->setEnabled(true); // this might fail in the scenario: check this : invalid -> valid. This allows verif ? + okAction->setText(hbTrId("Ok")); + codeBottom->setEnabled(true); + } + else + { + okAction->setEnabled(false); + codeBottom->setEnabled(false); + codeBottom->setText(""); + okAction->setText(hbTrId("Ok")); + } + // need to return because all objects are already created + return true; + } + + // Content + SecUiNotificationContentWidget *content = new SecUiNotificationContentWidget(); + content->constructFromParameters(parameters); + setContentWidget(content); + + queryType = content->queryType; + queryDual = content->queryDual; + isEmergency = content->isEmergency; + codeTop=NULL; + codeTop = content->codeTop; + checkBox = content->checkbox; + listWidget = content->listWidget; + codeBottom = content->codeBottom; + lMinLength = content->lMinLength; + lMaxLength = content->lMaxLength; + lEmergencySupported = content->lEmergencySupported; + + connect(content, SIGNAL(codeTopChanged(const QString &)), this, SLOT(handleCodeTopChanged(const QString &))); + connect(content, SIGNAL(codeBottomChanged(const QString &)), this, SLOT(handleCodeBottomChanged(const QString &))); + connect(content, SIGNAL(codeTopContentChanged()), this, SLOT(handleCodeTopContentChanged())); + connect(content, SIGNAL(but1Changed()), this, SLOT(handlebut1Changed())); + connect(content, SIGNAL(but2Changed()), this, SLOT(handlebut2Changed())); + connect(content, SIGNAL(but3Changed()), this, SLOT(handlebut3Changed())); + RDEBUG("queryType", queryType); + // Buttons + if( (queryType & ESecUiTypeMaskLock)) + { + // no need to create OK or Cancel + return true; + } + + okAction = new HbAction(hbTrId("Ok")); + RDEBUG("created HbAction okAction", 1); + okAction->setEnabled(false); // initially the OK is disabled because codeTop is empty + if((queryType & ESecUiBasicTypeMask) ==ESecUiBasicTypeCheck) { + okAction->setEnabled(true); + setHeadingWidget(0); // had to remove this no multiline + } + else if ((queryType & ESecUiBasicTypeMask) ==ESecUiBasicTypeCheckMulti){ + okAction->setEnabled(true); + } + + // setAction(okAction, QDialogButtonBox::AcceptRole); // it's supposed to use this, when deprecated + // setPrimaryAction(okAction); + addAction(okAction); + disconnect(okAction, SIGNAL(triggered()), this, SLOT(close())); // the close will be done in handleAccepted + connect(okAction, SIGNAL(triggered()), this, SLOT(handleAccepted())); + + cancelAction = new HbAction(hbTrId("Cancel")); // qtTrId("txt_common_button_cancel") + addAction(cancelAction); + disconnect(cancelAction, SIGNAL(triggered()), this, SLOT(close())); // the close will be done in handleCancelled + connect(cancelAction, SIGNAL(triggered()), this, SLOT(handleCancelled())); + // setAction(cancelAction, QDialogButtonBox::RejectRole); // it's supposed to use this, when deprecated + // setSecondaryAction(cancelAction); + + // this should had been set by Autolock, but just to be sure + TInt ret = RProperty::Define(KPSUidSecurityUIs, KSecurityUIsDismissDialog, + RProperty::EInt, TSecurityPolicy(TSecurityPolicy::EAlwaysPass), + TSecurityPolicy(TSecurityPolicy::EAlwaysPass)); + RDEBUG("defined KSecurityUIsDismissDialog", ret); + TInt aDismissDialog = -1; + ret = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsDismissDialog, aDismissDialog ); + RDEBUG("ret", ret); + RDEBUG("aDismissDialog", aDismissDialog); + if(aDismissDialog==ESecurityUIsDismissDialogOn || aDismissDialog==ESecurityUIsDismissDialogProcessing) + { + RDebug::Printf( "potential error: %s %s (%u) aDismissDialog=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aDismissDialog ); + } + + RDEBUG("check cancel", 0); + if ((queryType & ESecUiCancelSupported)==ESecUiCancelSupported) + { + // nothing to do. Cancel is enabled by default + } + else + { + RDEBUG("disable Cancel", 1); + cancelAction->setEnabled(false); + cancelAction->setText(""); + cancelAction->setVisible(false); + } + + return true; +} + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialog::sendResult() +// ---------------------------------------------------------------------------- +// +void SecUiNotificationDialog::sendResult(int accepted) +{ + RDEBUG("0", 0); + RDEBUG("mMyId", mMyId); + QVariant acceptedValue(accepted); + RDEBUG("0", 0); + mResultMap.insert(KResultAccepted, acceptedValue); + RDEBUG("0", 0); + RDEBUGQT("mResultMap", mResultMap); + RDEBUG("queryType", queryType); + if(!(queryType & ESecUiTypeMaskLock)) + { // the lock-icon should not reply + RDEBUG("emit deviceDialogData", 0); + emit deviceDialogData(mResultMap); + } + RDEBUG("1", 1); +} + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialog::handleAccepted() +// ---------------------------------------------------------------------------- +// +void SecUiNotificationDialog::handleAccepted() +{ + RDEBUG("0", 0); + // okAction + RDEBUG("mMyId", mMyId); + QString codeTopText=""; + + if( (queryType & ESecUiTypeMaskLock)) + { + codeTopText = "Unlock-Request"; + } + else if( (queryType & ESecUiBasicTypeMask)==ESecUiBasicTypeCheck) + { + codeTopText=(checkBox->isChecked() ? "1":"0"); + mResultMap.insert(KCodeTopIndex, codeTopText); + } + else if( (queryType & ESecUiBasicTypeMask)==ESecUiBasicTypeCheckMulti) + { + QItemSelectionModel *selectionModel = listWidget->selectionModel(); + QModelIndexList selectedItems = selectionModel->selectedIndexes(); + QModelIndex index; + codeTopText=""; + foreach(index, selectedItems) { + codeTopText+=QString::number(index.row()); + // could also use if(index.row()!=selectedItems.count()-1) codeTopText+= "|"; + codeTopText+= "|"; + } + mResultMap.insert(KCodeTopIndex, codeTopText); + } + else + codeTopText = codeTop->text(); + // no need to check last time for codeBottom + RDEBUGQT("codeTopText", codeTopText); + sendResult(KErrNone); + RDEBUG("calling close()", 0); + close(); // this is needed because Cancel doesn't automatically closes the dialog + RDEBUG("emitting deviceDialogClosed", 0); + emit deviceDialogClosed(); +} + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialog::handleCancelled() +// ---------------------------------------------------------------------------- +// +void SecUiNotificationDialog::handleCancelled() +{ + RDEBUG("0", 0); + RDEBUG("mMyId", mMyId); + sendResult(KErrCancel); + RDEBUG("callingclose()", 0); + close(); // this is needed because Cancel doesn't automatically closes the dialog + RDEBUG("emitting deviceDialogClosed", 0); + emit deviceDialogClosed(); +} + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialog::handleMemorySelectionChanged() +// ---------------------------------------------------------------------------- +// +void SecUiNotificationDialog::handleMemorySelectionChanged(const QString &text) + { + RDEBUG("0", 0); + RDEBUG("mMyId", mMyId); + RDEBUGQT("text", text); + QVariant memorySelection(text); + mResultMap.insert(KSelectedMemoryIndex, memorySelection); + } + +void SecUiNotificationDialog::handleCodeTopContentChanged() + { + RDEBUG("0", 0); + RDEBUG("mMyId", mMyId); + RDEBUGQT("codeTop->text()", codeTop->text()); + handleCodeTopChanged(codeTop->text()); + } + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialog::handleCodeTopChanged() +// ---------------------------------------------------------------------------- +// +void SecUiNotificationDialog::handleCodeTopChanged(const QString &text) + { + RDEBUG("0", 0); + RDEBUGQT("text", text); + if(queryDual) + { + codeBottom->setText(""); // any change resets the verification. + if( (queryType & ESecUiMaskType) == 0x000004 ) // new codeLock + { // ChangeSecCodeParamsL change RMobilePhone::ESecurityCodePhonePassword + QVariant codeTopVar(text); + mResultMap.insert(KCodeTopIndex, codeTopVar); + sendResult(KErrCompletion); // send the current password back to the client for further TARM validation. This is done on any key-press, not in the OK + } + } + else if(text.length() < lMinLength ) + { + RDEBUGQT("too short text", text); + okAction->setEnabled(false); + RDEBUG("lEmergencySupported", lEmergencySupported); + if( lEmergencySupported && text.length() > 2 ) // emergency numbers need at least 3 digits + { // check whether it's a emergency number + QVariant codeTopVar(text); + mResultMap.insert(KCodeTopIndex, codeTopVar); + sendResult(KErrAbort); // send the current password back to the client. Perhaps it's an emergency number and decides to Ok->Call + } + } + else if (text.length() >= lMinLength) + { + // might use a flag to avoid re-setting. But this complicates things if there's another initial verification + RDEBUGQT("long enough text", text); + okAction->setText(hbTrId("Ok")); + if(queryDual==0) // only if Bottom is not used + okAction->setEnabled(true); + } + QVariant codeTopVar(text); + mResultMap.insert(KCodeTopIndex, codeTopVar); + } +// ---------------------------------------------------------------------------- +// SecUiNotificationDialog::handleCodeBottomChanged() +// ---------------------------------------------------------------------------- +// +void SecUiNotificationDialog::handleCodeBottomChanged(const QString &text) + { + RDEBUG("0", 0); + RDEBUGQT("text", text); + RDEBUGQT("codeTop->text()", codeTop->text()); + if(text.length() < lMinLength ) + { + RDEBUGQT("too short text", text); + okAction->setEnabled(false); + } + else + { + // might use a flag to avoid re-setting. But it just complicates things. + RDEBUGQT("long enough text", text); + if(codeTop->text()==text) + { + // unless both codes match, don't allow OK. Note that the first field doesn't allow exit until the validations (i.e. NewLockCode) as succesfull + RDEBUGQT("codes match", text); + okAction->setEnabled(true); + } + else + { + RDEBUGQT("codes don't match", text); + okAction->setEnabled(false); + } + } + // verification is not sent + } +// ---------------------------------------------------------------------------- +// SecUiNotificationDialog::handlebut1Changed() +// ---------------------------------------------------------------------------- +// +void SecUiNotificationDialog::handlebut1Changed() + { + RDEBUG("0", 0); + codeTop->setText("1234"); + } +// ---------------------------------------------------------------------------- +// SecUiNotificationDialog::handlebut2Changed() +// ---------------------------------------------------------------------------- +// +void SecUiNotificationDialog::handlebut2Changed() + { + RDEBUG("0", 0); + QString codeTopText = codeTop->text(); + RDEBUGQT("codeTopText", codeTopText); + codeTopText = codeTopText + "1" ; + RDEBUGQT("codeTopText+1", codeTopText); + codeTop->setText(codeTopText); + + RDEBUG("editorInterface", 0); + HbEditorInterface editorInterface(codeTop); + RDEBUG("actions", 0); + QList vkbList = editorInterface.actions(); + RDEBUG("count", 0); + int count = vkbList.count(); + RDEBUG("got count", count); + for (int i = 0; i < count; i++) + { + RDEBUG("i", i); + HbAction *action = static_cast(vkbList[i]); + RDEBUG("action", 0); + } + + RDEBUG("okVKBAction", 0); + okVKBAction = new HbAction(tr("Ok")); + RDEBUG("addAction", 0); + editorInterface.addAction(okVKBAction); + RDEBUG("addAction", 1); + connect(okVKBAction, SIGNAL(triggered()), this, SLOT(handleAccepted())); + RDEBUG("connect", 1); + + QList vkbList2 = editorInterface.actions(); + RDEBUG("count", 0); + int count2 = vkbList2.count(); + RDEBUG("got count2", count2); + for (int i = 0; i < count2; i++) + { + RDEBUG("i", i); + HbAction *action2 = static_cast(vkbList2[i]); + RDEBUG("action2", 0); + } + + } +// ---------------------------------------------------------------------------- +// SecUiNotificationDialog::handlebut3Changed() +// ---------------------------------------------------------------------------- +// +void SecUiNotificationDialog::handlebut3Changed() + { + RDEBUG("0", 0); + QString codeTopText = codeTop->text(); + RDEBUG("codeTopText", 0); + RDEBUGQT("codeTopText", codeTopText); + codeTopText = codeTopText + "5" ; + RDEBUGQT("codeTopText+5", codeTopText); + codeTop->setEchoMode(HbLineEdit::PasswordEchoOnEdit); + RDEBUGQT("codeTopText", codeTopText); + codeTop->setText(codeTopText); + RDEBUG("setFocus", 0); + codeTop->setFocus(); + RDEBUG("1", 1); + } + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialog::saveFocusWidget(QWidget*,QWidget*) +// ---------------------------------------------------------------------------- +// +void SecUiNotificationDialog::saveFocusWidget(QWidget*,QWidget*) +{ + RDEBUG("0", 0); +} + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialog::subscriberKSecurityUIsDismissDialogChanged() +// A way for Autolock to dismiss any possible PIN dialog +// This doesn't dismiss the lockIcon because P&S is not connected +// Note: if this changes itself, then it becomes recursive +// ---------------------------------------------------------------------------- +// +void SecUiNotificationDialog::subscriberKSecurityUIsDismissDialogChanged() + { + + RDEBUG("0", 0); + RDEBUG("mMyId", mMyId); + TInt aDismissDialog = ESecurityUIsDismissDialogUninitialized; + TInt err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsDismissDialog, aDismissDialog ); + RDEBUG("err", err); + RDEBUG("aDismissDialog", aDismissDialog); + if( aDismissDialog == ESecurityUIsDismissDialogOn ) + { + if(subscriberKSecurityUIsDismissDialog) + { + RDEBUG("subscriberKSecurityUIsDismissDialog", 1); + } + else + { + RDEBUG("! subscriberKSecurityUIsDismissDialog", 0); + } + + if(this) + { + RDEBUG("this", 1); + } + else + { + RDEBUG("! this", 0); + } + + + RDEBUG("disconnect subscriberKSecurityUIsDismissDialog", 0); + disconnect(subscriberKSecurityUIsDismissDialog, SIGNAL(contentsChanged()), this, SLOT(subscriberKSecurityUIsDismissDialogChanged())); + // this doesn't really disconnect, because somehow the events are still queued. This is a QtMobility error + RDEBUG("disconnected subscriberKSecurityUIsDismissDialog", 1); + + RDEBUG("not set KSecurityUIsDismissDialog", ESecurityUIsDismissDialogProcessing); + // can't set it because it does recursion + // err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsDismissDialog, ESecurityUIsDismissDialogProcessing ); + RDEBUG("err", err); + // only if Cancel is allowed + if ((queryType & ESecUiCancelSupported)==ESecUiCancelSupported) + { + RDEBUG("sendResult(KErrCancel)", KErrCancel); // another option is KErrDied + sendResult(KErrCancel); // similar to emit handleCancelled(); + RDEBUG("calling close()", 0); + err = close(); + RDEBUG("err", err); + RDEBUG("emitting deviceDialogClosed", 0); + emit deviceDialogClosed(); + // RDEBUG("emit closeDeviceDialog", 0); + // this is old method emit closeDeviceDialog(false); // false means "not by client", although it's not really used + RDEBUG("all emited", 0); + } + RDEBUG("not set KSecurityUIsDismissDialog", ESecurityUIsDismissDialogDone); + // can't set it because it does recursion + // err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsDismissDialog, ESecurityUIsDismissDialogDone ); // clear after using it + RDEBUG("err", err); + + RDEBUG("reconnect subscriberKSecurityUIsDismissDialog", 0); + connect(subscriberKSecurityUIsDismissDialog, SIGNAL(contentsChanged()), this, SLOT(subscriberKSecurityUIsDismissDialogChanged())); + RDEBUG("reconnected subscriberKSecurityUIsDismissDialog", 1); + } + RDEBUG("1", 1); + } diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialogplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialogplugin.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,180 @@ +/* +* Copyright (c) 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" +* 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: SecUi notification plugin. +* +*/ + +#include "secuinotificationdebug.h" +#include "secuinotificationdialogplugin.h" +#include "secuinotificationdialog.h" +#include "secuinotificationdialogpluginkeys.h" + +#include + +// This plugin implements one device dialog type +static const struct { + const char *mTypeString; +} dialogInfos[] = { + {SECUINOTIFICATIONDIALOG} +}; + + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialogPlugin::SecUiNotificationDialogPlugin() +// ---------------------------------------------------------------------------- +// +SecUiNotificationDialogPlugin::SecUiNotificationDialogPlugin() : mError(KNoError) +{ +} + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialogPlugin::~SecUiNotificationDialogPlugin() +// ---------------------------------------------------------------------------- +// +SecUiNotificationDialogPlugin::~SecUiNotificationDialogPlugin() +{ +} + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialogPlugin::accessAllowed() +// ---------------------------------------------------------------------------- +// +bool SecUiNotificationDialogPlugin::accessAllowed(const QString &deviceDialogType, + const QVariantMap ¶meters, const QVariantMap &securityInfo) const +{ + RDEBUG("0", 0); + Q_UNUSED(deviceDialogType) + Q_UNUSED(parameters) + Q_UNUSED(securityInfo) + + // All clients are allowed to use. + // should access be limited to certain clients or capabilities ? Not for now. + return true; +} + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialogPlugin::createDeviceDialog() +// ---------------------------------------------------------------------------- +// +HbDeviceDialogInterface *SecUiNotificationDialogPlugin::createDeviceDialog( + const QString &deviceDialogType, const QVariantMap ¶meters) +{ + // Create device dialog widget + RDEBUG("0", 0); + Q_UNUSED(deviceDialogType) + + SecUiNotificationDialog *deviceDialog = new SecUiNotificationDialog(parameters); + mError = deviceDialog->deviceDialogError(); + if (mError != KNoError) { + delete deviceDialog; + deviceDialog = 0; + } + + RDEBUG("1", 1); + return deviceDialog; +} + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialogPlugin::deviceDialogInfo() +// ---------------------------------------------------------------------------- +// +bool SecUiNotificationDialogPlugin::deviceDialogInfo( const QString &deviceDialogType, + const QVariantMap ¶meters, DeviceDialogInfo *info) const +{ + // For some unknown reason, this function doesn't print the signature + RDEBUG("0", 0); + #ifdef _DEBUG + RDebug::Printf( "SecUiNotificationDialogPlugin::deviceDialogInfo=%x", 0 ); + #endif + + Q_UNUSED(deviceDialogType); + + info->group = SecurityGroup; + info->flags = NoDeviceDialogFlags; + info->priority = DefaultPriority; + + // The unlock-query must have higher priority, to get over Telephony. + if (parameters.contains(KQueryType)) { + #ifdef _DEBUG + RDebug::Printf( "SecUiNotificationDialogPlugin::deviceDialogInfo KQueryType=%x", 1 ); + #endif + int iqueryType = parameters.value(KQueryType).toUInt(); + RDEBUG("iqueryType", iqueryType); + #ifdef _DEBUG + RDebug::Printf( "SecUiNotificationDialogPlugin::deviceDialogInfo iqueryType=%x", iqueryType ); + #endif + if( (iqueryType & 0xFFFF) == RMobilePhone::ESecurityCodePhonePassword ) + { + RDEBUG("CriticalGroup", CriticalGroup); + #ifdef _DEBUG + RDebug::Printf( "SecUiNotificationDialogPlugin::deviceDialogInfo CriticalGroup=%x", CriticalGroup ); + #endif + info->group = CriticalGroup; + } + // The unlock-query must have lower priority, to get over change PIN code request. + else if( iqueryType == 0xB000000 ) + { + #ifdef _DEBUG + RDebug::Printf( "SecUiNotificationDialogPlugin::deviceDialogInfo GenericDeviceDialogGroup=%x", GenericDeviceDialogGroup ); + #endif + info->group = GenericDeviceDialogGroup; + } + } + // Return device dialog flags + + RDEBUG("1", 1); + return true; +} + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialogPlugin::deviceDialogTypes() +// ---------------------------------------------------------------------------- +// +QStringList SecUiNotificationDialogPlugin::deviceDialogTypes() const +{ + RDEBUG("0", 0); + // Return device dialog types this plugin implements + + QStringList types; + const int numTypes = sizeof(dialogInfos) / sizeof(dialogInfos[0]); + for(int i = 0; i < numTypes; ++i) { + types.append(dialogInfos[i].mTypeString); + } + + return types; +} + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialogPlugin::pluginFlags() +// ---------------------------------------------------------------------------- +// +HbDeviceDialogPlugin::PluginFlags SecUiNotificationDialogPlugin::pluginFlags() const +{ + RDEBUG("0", 0); + // Return plugin flags + return NoPluginFlags; +} + +// ---------------------------------------------------------------------------- +// SecUiNotificationDialogPlugin::error() +// ---------------------------------------------------------------------------- +// +int SecUiNotificationDialogPlugin::error() const +{ + RDEBUG("mError", mError); + // Return last error + return mError; +} + +Q_EXPORT_PLUGIN2(secuinotificationdialogplugin,SecUiNotificationDialogPlugin) diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/secuinotifications/secuinotifications.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotifications.pro Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,21 @@ +# +# Copyright (c) 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" +# 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: SecUi notification dialog plugin project. +# + +TEMPLATE = subdirs + +SYMBIAN_PLATFORMS = WINSCW ARMV5 + +SUBDIRS += secuinotificationdialogplugin/secuinotificationdialogplugin.pro diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/securitydialogs.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/securitydialogs.pro Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,24 @@ +# +# Copyright (c) 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" +# 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: SecUi notification dialog plugin project. +# + +TEMPLATE = subdirs + +SUBDIRS += secuinotifications/secuinotifications.pro +SUBDIRS += lockclient/group/lockclient.pro +SUBDIRS += Autolock/indicatorplugin/indicatorautolockplugin.pro +SUBDIRS += Autolock/autolockuseractivityservice.pro +SUBDIRS += Autolock/Autolock.pro + diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/data/SimLockUI.rss --- a/securitydialogs/simlockui/data/SimLockUI.rss Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,277 +0,0 @@ -/* -* ============================================================================ -* Name : SimLockUI.rss -* Part of : SimLock UI Application / Resource Definitions -* Description : Resource definitions for SimLock UI -* Version : -* -* 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" -* 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: Build info file for Ado domain appinstall -* ============================================================================ -*/ - -// Resource Name Identifier -NAME SLUI - -// Include Files -#include -#include -#include -#include -#include - -#include "simlockui.hrh" -#include - -// Resource Identifiers -RESOURCE RSS_SIGNATURE { } -RESOURCE TBUF r_default_document_name { buf = "Document"; } - -// Constants -#define ESimLockUiQueryFlags (EGeneralQueryFlags) - -// ========================== RESOURCE DEFINITIONS =========================== - -// --------------------------------------------------------------------------- -// EIK_APP_INFO -// Define default menu and CBA key. -// --------------------------------------------------------------------------- -// -RESOURCE EIK_APP_INFO - { - cba = R_AVKON_SOFTKEYS_EMPTY; - menubar= R_AVKON_MENUPANE_EMPTY; - } - -// --------------------------------------------------------------------------- -// Text resources -// -// --------------------------------------------------------------------------- -// - -// Background text captions -RESOURCE TBUF r_simlock_ui_background_text_main {buf = qtn_sim_title_sim_unlock;} -RESOURCE TBUF r_simlock_ui_background_text_unlock_complete {buf = qtn_sim_title_unlock_complete;} -RESOURCE TBUF r_simlock_ui_codes_not_match {buf = qtn_sim_title_code_no_match;} -RESOURCE TBUF r_simlock_ui_background_text_unlock_incorrect {buf = qtn_sim_title_code_wrong;} -RESOURCE TBUF r_simlock_ui_background_text_unlock_failed {buf = qtn_sim_title_unlock_fail;} - -// Information notes -RESOURCE TBUF r_sim_unlock_message_sim_unlocked {buf = qtn_sim_info_prev_unlock;} -RESOURCE TBUF r_sim_unlock_message_cannot_unlock {buf = qtn_sim_info_perm_lock;} -RESOURCE TBUF r_sim_unlock_message_end_call {buf = qtn_sim_info_end_call;} -RESOURCE TBUF r_sim_phone_unlocked {buf = qtn_sim_info_phone_unlocked;} - -// Text for SIM popup text -RESOURCE TBUF r_sim_info_welcome_note_text{buf=qtn_sim_popup_intro_info;} - - -// --------------------------------------------------------------------------- -// r_sim_info_welcome_note -// Intro note displayed when Sim Lock UI Application starts -// --------------------------------------------------------------------------- -// - RESOURCE DIALOG r_sim_info_welcome_note - { - flags=ESimLockUiQueryFlags; - buttons=R_AVKON_SOFTKEYS_YES_NO__YES; - items= - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - headinglayout = R_AVKON_LIST_HEADING_PANE_POPUPS; - label = qtn_sim_title_sim_unlock; - }; - }, - DLG_LINE - { - type = EAknCtMessageQuery; - id = EAknMessageQueryContentId; - - control = AVKON_MESSAGE_QUERY - { - }; - } - }; - } - -// --------------------------------------------------------------------------- -// r_sim_unlock_final -// Indicates the final unlock attempt has been performed -// --------------------------------------------------------------------------- -// -RESOURCE DIALOG r_sim_unlock_final - { - flags=ESimLockUiQueryFlags; - buttons=R_AVKON_SOFTKEYS_OK_EMPTY; - items= - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - headinglayout = R_AVKON_LIST_HEADING_PANE_POPUPS; - label = qtn_sim_title_unlock_fail; - }; - }, - DLG_LINE - { - type=EAknCtMessageQuery; - id=EAknMessageQueryContentId; - control= AVKON_MESSAGE_QUERY - { - message = qtn_sim_info_code_wrong_final; - }; - } - }; - } - -// --------------------------------------------------------------------------- -// r_sim_info_codes_not_match -// Dialog that indicates two Sim lock codes do not match -// --------------------------------------------------------------------------- -// -RESOURCE DIALOG r_sim_info_codes_not_match - { - flags=ESimLockUiQueryFlags; - buttons=R_AVKON_SOFTKEYS_OK_CANCEL__OK; - items= - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - headinglayout = R_AVKON_LIST_HEADING_PANE_POPUPS; - label = qtn_sim_title_code_no_match; - }; - }, - - DLG_LINE - { - type=EAknCtMessageQuery; - id=EAknMessageQueryContentId; - control= AVKON_MESSAGE_QUERY - { - message = qtn_sim_info_code_no_match; - }; - } - }; - } - -// --------------------------------------------------------------------------- -// r_sim_info_code_incorrect -// Dialog that indicates an incorrect code was entered -// --------------------------------------------------------------------------- -// -RESOURCE DIALOG r_sim_info_code_incorrect - { - flags=ESimLockUiQueryFlags; - buttons=R_AVKON_SOFTKEYS_OK_CANCEL__OK; - items= - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - headinglayout = R_AVKON_LIST_HEADING_PANE_POPUPS; - label = qtn_sim_title_code_wrong; - }; - }, - - DLG_LINE - { - type=EAknCtMessageQuery; - id=EAknMessageQueryContentId; - control= AVKON_MESSAGE_QUERY - { - message = qtn_sim_urn_code_wrong; - }; - } - }; - } - -// --------------------------------------------------------------------------- -// r_sim_info_enter_password -// Password entry dialog -// --------------------------------------------------------------------------- -// -RESOURCE DIALOG r_sim_info_enter_password - - { - flags=ESimLockUiQueryFlags; - buttons=R_AVKON_SOFTKEYS_OK_CANCEL__OK; - items= - { - DLG_LINE - { - type=EAknCtQuery; - id=EGeneralQuery; - control= AVKON_DATA_QUERY - { - layout = EPhoneLayout; - label = qtn_sim_query_enter_code; - control = EDWIN - { - lines = 1; - width = SEC_ATT_PASSWORD_MAX_BUFFER; - default_input_mode = EAknEditorNumericInputMode; - allowed_input_modes = EAknEditorNumericInputMode; - }; - }; - } - }; - } - -// --------------------------------------------------------------------------- -// r_sim_info_test_password_reenter -// Password re-entry dialog -// --------------------------------------------------------------------------- -// -RESOURCE DIALOG r_sim_info_reenter_password - - { - flags=ESimLockUiQueryFlags; - buttons=R_AVKON_SOFTKEYS_OK_CANCEL__OK; - items= - { - - DLG_LINE - { - type=EAknCtQuery; - id=EGeneralQuery; - control= AVKON_DATA_QUERY - { - layout = EPhoneLayout; - label = qtn_sim_query_reenter_code; - control = EDWIN - { - lines = 1; - width = SEC_ATT_PASSWORD_MAX_BUFFER; - default_input_mode = EAknEditorNumericInputMode; - allowed_input_modes = EAknEditorNumericInputMode; - }; - }; - } - }; - } diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/data/SimLockUI_reg.rss --- a/securitydialogs/simlockui/data/SimLockUI_reg.rss Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* ============================================================================ -* Name : SimLockUI_reg.rss -* Part of : SimLock UI -* Description : SimLock UI App Registration file file -* Version : -* -* 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" -* 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: Build info file for Ado domain appinstall -* ============================================================================ -*/ - -//SimLockUI application's registration resource file - -#include -#include - -#include "simlockui.hrh" - -UID2 KUidAppRegistrationResourceFile -UID3 SIMLOCK_UI_UID3 - -RESOURCE APP_REGISTRATION_INFO - { - app_file="SimLockUI"; - - // Application is not in the menu - hidden = KAppIsHidden; - // Uncomment and comment previous line to un-hide - //hidden = KAppNotHidden; - //localisable_resource_file="\\resource\\apps\\SimLockUI"; - embeddability = KAppNotEmbeddable; - newfile = KAppDoesNotSupportNewFile; - } diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/group/SimLockUI.mmp --- a/securitydialogs/simlockui/group/SimLockUI.mmp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* -* ============================================================================ -* Name : simlockui.mmp -* Part of : SimLock UI -* Description : SimLock UI mmp file -* Version : -* -* 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" -* 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: Build info file for Ado domain appinstall -* ============================================================================ -*/ - -#include "../inc/simlockui.hrh" -#include -#include -CAPABILITY CAP_APPLICATION - -TARGETPATH /sys/bin -TARGET simlockui.exe -TARGETTYPE exe - -UID 0x00000000 SIMLOCK_UI_UID3 -VENDORID VID_DEFAULT - -LANGUAGE_IDS - -SOURCEPATH ../src -SOURCE simlockui.cpp -SOURCE simlockuiapplication.cpp -SOURCE simlockuibackgroundcontrol.cpp -SOURCE simlockuiappui.cpp -SOURCE simlockuidocument.cpp -SOURCE simlockdatahandlingdelegate.cpp -SOURCE simlocktelephonyproxy.cpp - -USERINCLUDE ../inc -SYSTEMINCLUDE /epoc32/include/internal - -APP_LAYER_SYSTEMINCLUDE -LIBRARY euser.lib -LIBRARY apparc.lib -LIBRARY cone.lib -LIBRARY eikcore.lib -LIBRARY avkon.lib -LIBRARY gdi.lib -LIBRARY etel.lib -LIBRARY etelmm.lib -LIBRARY customapi.lib -LIBRARY commonengine.lib -LIBRARY aknskins.lib -LIBRARY aknskinsrv.lib -LIBRARY aknswallpaperutils.lib -LIBRARY aknlayout2.lib -LIBRARY aknlayout2scalable.lib -LIBRARY cdlengine.lib -LIBRARY ws32.lib -LIBRARY etel3rdparty.lib -LIBRARY eikcoctl.lib - -SOURCEPATH ../data - -// Main resource file -START RESOURCE simlockui.rss -HEADER -TARGETPATH /resource/apps -LANGUAGE_IDS -END - -// Resource registration file -START RESOURCE simlockui_reg.rss -TARGETPATH /private/10003a3f/apps -END - - -// End of file. - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/group/bld.inf --- a/securitydialogs/simlockui/group/bld.inf Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* -* ============================================================================ -* Name : bld.inf -* Part of : SimLockUI Build Information -* Description : Build information file for project simlockui -* Version : -* 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" -* 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: Build info file for Ado domain appinstall -* -* ============================================================================ -*/ - - -#include - -PRJ_MMPFILES - -// Project File -simlockui.mmp - -// Icon File - -PRJ_EXPORTS -// Export IBY files -../rom/simlockui.iby CORE_MW_LAYER_IBY_EXPORT_PATH( simlockui.iby) -../rom/simlockui_resources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(simlockui_resources.iby) - -../inc/simlockui.loc MW_LAYER_LOC_EXPORT_PATH(simlockui.loc) - -// For EE texts -../rom/simlockui_resources.iby CORE_APP_LAYER_IBY_EXPORT_PATH(simlockui_resources.iby) - -../inc/simlockuikeys.h /epoc32/include/oem/simlockuikeys.h \ No newline at end of file diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/inc/SimLockDataHandlingDelegate.h --- a/securitydialogs/simlockui/inc/SimLockDataHandlingDelegate.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,165 +0,0 @@ -/* -* ============================================================================ -* Name : SimLockDataHandlingDelegate.h -* Part of : Sim Lock UI Application -* Description : Handles reading and writing of Sim Lock data including - unlocking the Sim Lock. -* Version : -* -* 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" -* 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: Build info file for Ado domain appinstall -* ============================================================================ -*/ - -#ifndef SIMLOCKDATAHANDLINGDELEGATE_H -#define SIMLOCKDATAHANDLINGDELEGATE_H - -// System Includes -#include - -// Forward Declarations -class RMmCustomAPI; -struct TSimPathStr; -struct TSimLockHeadStr; -class CActiveSchedulerWait; -class TIsiReceiveC; -class CPeriodic; - -/** - * CSimLockDataHandlingDelegate - * - * Delegate class to handle communication with lower layers of S60 and Symbian, - * and also the native( ISA ) layer. - * - * @lib euser.lib - * @lib iscapi.lib - * @lib isimessage.lib - * @lib etel.lib - * @lib etelmm.lib - * @lib customapi.lib - */ -class CSimLockDataHandlingDelegate : public CActive - { -public: // Public Constructor / Destructor - - /** - * Two-phased constructor - * - */ - static CSimLockDataHandlingDelegate* NewL( RMmCustomAPI& aCustomAPI ); - - /** - * Destructor - * - */ - virtual ~CSimLockDataHandlingDelegate(); - -public: // Public API - - /** - * Open the Sim Lock( type 1 ) given a passcode. - * - * @param aPassword TDesC of the password to open lock - * @return Indicates the result of the Sim Lock open attempt - */ - TInt OpenSimLock( const TDesC& aPassword ); - - /** - * Determine if the Sim Lock is open. - * - * @return Indicates if Sim Lock is open - */ - TBool IsSimLockOpen() const; - - -private: // Private Constructors - - /** - * C++ constructor. - * - * @param aCustomAPI ETel custom API object - */ - CSimLockDataHandlingDelegate( RMmCustomAPI& aCustomAPI ); - - /** - * Symbian OS default constructor. - */ - void ConstructL(); - - -private: // From CActive - - /** - * Active object run method - * @see CActive - */ - virtual void RunL(); - - /** - * Active object cancel method - * @see CActive - */ - virtual void DoCancel(); - -private: // Local Member API - - /** - * CPeriodic Callback function for elapsed timer - * - * @param aUnused requred for interface - * @return required but unused - */ - static TInt TimerElapsed(TAny* aUnused); - - /** - * Pause execution and allow active scheduler to run until the current outstanding - * request complets - * - */ - void CompleteRequestWithTimeout(); - -private: // Member Data - /** - * Indicates if the Sim Lock is open per the last read from the Sim Lock - * server. - */ - TBool iLockIsOpen; - - /** - * Handle to ETel MultiMode Custom API server - */ - RMmCustomAPI& iCustomAPI; - - /** - * Help with asynchronous requests - */ - CActiveSchedulerWait* iSchedulerWait; - - /** - * Indicates that Sim Lock data has been read - */ - TBool iDataHasBeenRead; - - /** - * Timeout handling timer - * owns - */ - CPeriodic* iTimer; - - }; - -#endif //SIMLOCKDATAHANDLINGDELEGATE_H - -// End of File - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/inc/SimLockISAServerDefinitions.h --- a/securitydialogs/simlockui/inc/SimLockISAServerDefinitions.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,173 +0,0 @@ -/* -* ============================================================================ -* Name : SimLockISAServerDefinitions.h -* Part of : Sim Lock UI Application -* Description : Definitions for Sim Lock ISA Server -* Version : -* -* 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" -* 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: Build info file for Ado domain appinstall -* ============================================================================ -*/ - -#ifndef SimLockISAServerDefinitions_H -#define SimLockISAServerDefinitions_H - -// INCLUDES -#include - -// ============================================= -// Convert to little endian -// ============================================= - -// Macro to convert big endian to native type -// EPOC ARM is little endian -#define BE2INT16( x ) ( ( ( ( x ) & 0xFF00 ) >> 8 ) |( ( ( x ) & 0x00FF ) << 8 ) ) - - -// ============================================= -// From Simlock_lock.h in cellmo: ISA server -// ============================================= - -// MACROS - -#define SIMLOCK_PROFILE_SIZE 8 -#define SIMLOCK_CONFIG_SIZE 8 - -/* Block status */ -typedef TUint8 SL_BLOCK_STATUS; -#define SL_BLOCK_NOT_DISCARD 0x00 -#define SL_BLOCK_DISCARD 0x01 -#define SL_BLOCK_PERMANENT 0x02 -#define SL_BLOCK_MANDATORY 0x03 - -/* Requirement status */ -typedef TUint8 SL_LOCKTYPE; -#define SL_LOCKTYPE_AUTO 0x01 -#define SL_LOCKTYPE_CLOSED 0x02 -#define SL_LOCKTYPE_OPEN 0x03 - - -/* Criteria */ -typedef TUint8 SL_OPERATOR; -#define SL_OP_BYTEWISE_DISTINCT_EQ 0x01 -#define SL_OP_BYTEWISE_DISTINCT_GTE 0x02 -#define SL_OP_BYTEWISE_DISTINCT_LTE 0x03 -#define SL_OP_BYTEWISE_DISTINCT_NEQ 0x04 -#define SL_OP_NIBBLEWISE_DISTINCT_EQ 0x05 -#define SL_OP_NIBBLEWISE_DISTINCT_GTE 0x06 -#define SL_OP_NIBBLEWISE_DISTINCT_LTE 0x07 -#define SL_OP_NIBBLEWISE_DISTINCT_NEQ 0x08 -#define SL_OP_BITWISE_DISTINCT_NEQ 0x09 -#define SL_OP_BYTEWISE_UNIFIED_GTE 0x0A -#define SL_OP_BYTEWISE_UNIFIED_LTE 0x0B -#define SL_OP_BYTEWISE_UNIFIED_NEQ 0x0C -#define SL_OP_NIBBLEWISE_UNIFIED_GTE 0x0D -#define SL_OP_NIBBLEWISE_UNIFIED_LTE 0x0E -#define SL_OP_NIBBLEWISE_UNIFIED_NEQ 0x0F -#define SL_OP_BITWISE_DISTINCT_EQ 0x10 -#define CRITERIA_MAXIMUM 0x10 - - -/* No mask( all data counts ) */ -#define SIMLOCK_MASK_NOT_DEF 0x0000 - -// DATA TYPES - -// Sim Lock data structures -struct TSimLockConfigStr - { - TUint8 Byte[SIMLOCK_CONFIG_SIZE]; - }; - -struct TSimLockProfileStr - { - TUint8 Byte[SIMLOCK_PROFILE_SIZE]; - }; - -/* An aboslute path on SIM card */ -struct TSimPathStr - { - TUint8 ah; - TUint8 al; - TUint8 bh; - TUint8 bl; - TUint8 ch; - TUint8 cl; - TUint8 dh; - TUint8 dl; - }; /* sizeof( SIM_PATH_STR ) = 8 */ - -#define SIM_PATH_SIZE sizeof( TSimPathStr ) - -/* A match requirement */ -struct TSimLockMRStr - { - TUint32 ReadSpec; - TSimPathStr FileId; - TUint16 Mask; - TUint16 Offset; - TUint8 DataSize; - TUint8 UnitLength; - SL_OPERATOR Criterion; - SL_LOCKTYPE LockType; - }; /* sizeof( SL_MR_STR ) = 20 */ - -#define SL_MR_STR_SIZE sizeof( TSimLockMRStr ) - -/* A match block */ -struct TSimLockMBStr - { - TUint16 Offset; - TUint8 AccessClass; - SL_BLOCK_STATUS mbStatus; - TUint8 mrCount; - TUint8 Reserved1; - TUint8 Reserved2; - TUint8 Reserved3; - }; /* sizeof( SL_MB_STR ) = 8 */ - -#define SL_MB_STR_SIZE sizeof( TSimLockMBStr ) - -/* Sim Lock header */ -struct TSimLockHeadStr - { - // Use BB5 Head Str - TSimLockProfileStr Profile; // !!!! 8 TUint8s - TSimLockConfigStr ConfigData; // !!!! 8 TUint8s - - TUint16 Offset; - TUint8 mbCount; - TUint8 UnlockCount; - TUint8 Reserved1; - TUint8 Reserved2; - - TUint8 Reserved3; - TUint8 Reserved4; - }; /* sizeof( SL_HEAD_STR ) = 8 or 24 */ - -#define SL_HEAD_STR_SIZE ( ( TInt )sizeof( TSimLockHeadStr ) ) - -// CONSTANTS - -extern TInt KSimLockUnlockAttemptsAvailable; - -// FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - - -#endif // SimLockISAServerDefinitions_H - -// End of File diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/inc/SimLockTelephonyProxy.h --- a/securitydialogs/simlockui/inc/SimLockTelephonyProxy.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,142 +0,0 @@ -/* -* ============================================================================ -* Name : SimLockTelephonyProxy.h -* Part of : Sim Lock UI Telephony Proxy -* Description : Wrap asynchronous calls to Core Telephony -* Version : -* -* 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" -* 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: Build info file for Ado domain appinstall -* ============================================================================ -*/ - -#ifndef SIMLOCK_TELEPHONY_PROXY_H -#define SIMLOCK_TELEPHONY_PROXY_H - -// System Includes -#include -#include // CTelephony members - -// Forward Declarations -class CPeriodic; - -/** - * CSimLockTelephonyProxy - * - * Act as proxy for asynchronous calls to CTelephony - * - * @lib euser.lib - * @lib etel3rdparty.lib - */ -class CSimLockTelephonyProxy : public CActive - { -public: // Public Constructor/Destructor - - /** - * NewL - * Construct a CSimLockTelephonyProxy - * using two phase construction, and return a pointer to the created object - * @return a pointer to the created instance of CSimLockTelephonyProxy - */ - static CSimLockTelephonyProxy* NewL(); - - /** - * Destructor - */ - ~CSimLockTelephonyProxy(); - -public: // Public API - - /** - * Find out if a call is in progress. - * - * @return Whether or not a call is in progress - */ - TBool IsCallInProgress(); - -private: // From CActive - - /** - * Active object run method - */ - virtual void RunL(); - - /** - * Active object cancel method - */ - virtual void DoCancel(); - - private: // Private Constructors - - /** - * C++ constructor. - * - */ - CSimLockTelephonyProxy(); - - /** - * Symbian OS default constructor. - */ - void ConstructL(); - -private: // Private Member Functions - - /** - * CPeriodic Callback function for elapsed timer - * - * @param aClientObject pointer to CSimLockTelephonyProxy client object - * @return required but unused - */ - static TInt TimerElapsed(TAny* aClientObject); - - /** - * Complete an asynchronous request synchronously with a hardcoded timeout - */ - void CompleteRequestWithTimeout(); - -private: // Member Data - - /** - * Telephony indicators( used to detect ongoing voice call ) - */ - CTelephony::TIndicatorV1 iIndicators; - - /** - * Telephony indicator package as received from CTelephony - */ - CTelephony::TIndicatorV1Pckg iIndicatorPackage; - - /** - * ETel 3rd Party API( used to detect ongoing voice call ) - * owns - */ - CTelephony* iTelephony; - - /** - * Active scheduler wait API - * owns - */ - CActiveSchedulerWait* iSchedulerWait; - - /** - * Request timeout timer - * owns - */ - CPeriodic* iTimer; - - }; - -#endif // SIMLOCK_TELEPHONY_PROXY_H - -// End of file. diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/inc/SimLockUI.hrh --- a/securitydialogs/simlockui/inc/SimLockUI.hrh Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* ============================================================================ -* Name : SimLockUI.hrh -* Part of : Sim Lock UI Application -* Description : Resource compatible header file -* Version : -* -* 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" -* 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: Build info file for Ado domain appinstall -* ============================================================================ -*/ - -#ifndef __simlockui_HRH__ -#define __simlockui_HRH__ - -#define SIMLOCK_UI_UID3 0x2000B0FA -#define SEC_ATT_PASSWORD_MAX_BUFFER 32 - -#endif // __simLockui_HRH__ - -// End of file. diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/inc/SimLockUI.loc --- a/securitydialogs/simlockui/inc/SimLockUI.loc Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,142 +0,0 @@ -/* -* ============================================================================ -* Name : SimLockUI.loc -* Part of : Sim Lock UI Application / Resource Definitions -* Description : Resource definitions for Sim Lock UI -* Version : -* -* 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" -* 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: Build info file for Ado domain appinstall -* ============================================================================ -*/ - -// LOCALISATION STRINGS - -// NEW - -//d: SIM Unlock Process -//l: heading_pane_t1 -//r: 3.2 -// -#define qtn_sim_title_sim_unlock "SIM Unlock Process" - -//d: Intro message query giving high level description of the SIM Unlock process -//l: popup_info_list_pane_t1 -//r: 3.2 -// -#define qtn_sim_popup_intro_info "You have inserted an invalid SIM. Would you like to SIM unlock your phone? You have a limited number of unsuccessful attempts after which your phone will be permanently locked." - -//d: Header during unlock code query showing attempt number, where: 1 <= %0N <= 3; %1N = 3 -//l: main_pane_empty_t1/opt2 -//r: 3.2 -// -#define qtn_sim_title_unlock_attempt_no "Unlock Attempt %0N of %1N" - -//d: Unlock code query prompt -//l: popup_query_data_window_t3/opt2 -//r: 3.2 -// -#define qtn_sim_query_enter_code "Enter the unlock code" - -//d: Unlock code reentry query prompt -//l: popup_query_data_window_t3/opt2 -//r: 3.2 -// -#define qtn_sim_query_reenter_code "Reenter the unlock code" - -//d: Header indicating successful SIM unlock -//l: main_pane_empty_t1/opt2 -//r: 3.2 -// -#define qtn_sim_title_unlock_complete "Unlock Process Complete" - -//d: Info indicating successful SIM unlock. Forewarns that device will reboot. -//l: popup_note_window/opt2 -//r: 3.2 -// -#define qtn_sim_info_phone_unlocked "Your phone is unlocked. The phone will now restart." - -//d: Header indicating non-matching codes were entered. -//l: heading_pane_t1 -//r: 3.2 -// -#define qtn_sim_title_code_no_match "Codes not matched" - -//d: Info indicating that two entered unlock codes were not the same. -//l: popup_info_list_pane_t1 -//r: 3.2 -// -#define qtn_sim_info_code_no_match "The unlock codes entered do not match each other. The same unlock code must be entered twice. Try again?" - -//d: Header indicating that an incorrect SIM unlock code was entered. -//l: heading_pane_t1 -//r: 3.2 -// -#define qtn_sim_title_code_wrong "Incorrect Code Entered" - -//d: Info note indicating that the SIM unlock process failed. -//l: popup_info_list_pane_t1 -//r: 3.2 -// -#define qtn_sim_urn_code_wrong "The incorrect unlock code was entered. The phone was not unlocked. Try again?" - -//d: Header indicating that the SIM unlock process failed. -//l: heading_pane_t1 -//r: 3.2 -// -#define qtn_sim_title_unlock_fail "Unlock Process Failed" - -//d: Info note that the SIM unlock process failed. Three attempts remain. -//l: popup_info_list_pane_t1 -//r: 3.2 -// -#define qtn_sim_info_code_wrong_three "The incorrect unlock code was entered. Only three (3) unlock attempts remain before the phone is permanently locked." - -//d: Info note that the SIM unlock process failed. Two attempts remain. -//l: popup_info_list_pane_t1 -//r: 3.2 -// -#define qtn_sim_info_code_wrong_two "The incorrect unlock code was entered. Only two (2) unlock attempts remain before the phone is permanently locked." - -//d: Info note that the SIM unlock process failed. One attempt remains. -//l: popup_info_list_pane_t1 -//r: 3.2 -// -#define qtn_sim_info_code_wrong_one "The incorrect unlock code was entered. Only one (1) unlock attempt remains before the phone is permanently locked." - -//d: Info note that the SIM unlock process failed. No attempts remain. -//l: popup_info_list_pane_t1 -//r: 3.2 -// - -#define qtn_sim_info_code_wrong_final "The incorrect unlock code was entered on the final attempt. The phone is permanently locked and cannot be unlocked." - -//d: Info note that the SIM has previously been unlocked. -//l: popup_note_window/opt2 -//r: 3.2 -// -#define qtn_sim_info_prev_unlock "The SIM card is already unlocked." - -//d: Info note that the phone has previously been permanently locked. -//l: popup_note_window/opt2 -//r: 3.2 -// -#define qtn_sim_info_perm_lock "Phone is permanently locked and cannot be unlocked." - -//d: Note to end an ongoing call before entering SIM unlock code (as the phone will reboot upon successful unlock.) -//l: popup_note_window/opt2 -//r: 3.2 -// -#define qtn_sim_info_end_call "End call before entering unlock code." - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/inc/SimLockUI.pan --- a/securitydialogs/simlockui/inc/SimLockUI.pan Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ - /* -* ============================================================================ -* Name : SimLockUI.pan -* Version : -* -* 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" -* 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: Build info file for Ado domain appinstall -* ============================================================================ -*/ - -#ifndef __SIMLOCKUI_PAN__ -#define __SIMLOCKUI_PAN__ - -/** SimLockUI application panic codes */ -enum TSimLockUIPanics - { - ESimLockUIBasicUi = 1, - ESimLockUIUnableToReadSimLock - // add further panics here - }; - -inline void Panic(TSimLockUIPanics aReason) - { - _LIT(applicationName,"SimLockUI"); //lint !e1534 static variable OK - User::Panic(applicationName, aReason); - } - -#endif // __SIMLOCKUI_PAN__ diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/inc/SimLockUIApplication.h --- a/securitydialogs/simlockui/inc/SimLockUIApplication.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* -* ============================================================================ -* Name : SimLockUIApplication.h -* Part of : Sim Lock UI Application -* Description : SimLock UI Application header -* Version : -* -* 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" -* 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: Build info file for Ado domain appinstall -* ============================================================================ -*/ - -#ifndef __SIMLOCKUI_APPLICATION_H__ -#define __SIMLOCKUI_APPLICATION_H__ - -#include // CAknApplication - -/** - * CSimLockUIApplication - * Sim Lock UI Application class. - * - * An instance of CSimLockUIApplication is the application part of the AVKON - * application framework for the SimLockUI example application - * - * @lib avkon.lib - * @lib eikcore.lib - * @lib eiksrv.lib - */ -class CSimLockUIApplication : public CAknApplication - { -public: // from CAknApplication - - /** - * From CAknApplication - * Utility function to return the application's UID. - * - * @return Application's UID (KUidPDApplicationApp). - */ - TUid AppDllUid() const; - -protected: // from CAknApplication - - /** - * CreateDocumentL - * - * Create a CApaDocument object and return a pointer to it - * @return a pointer to the created document - */ - CApaDocument* CreateDocumentL(); - }; - -#endif // __SIMLOCKUI_APPLICATION_H__ - -// end of file. diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/inc/SimLockUIAppui.h --- a/securitydialogs/simlockui/inc/SimLockUIAppui.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,231 +0,0 @@ -/* -* ============================================================================ -* Name : SimLockUIAppUI.h -* Part of : Sim Lock UI Application -* Description : SimLock UI Application UI Header -* Version : -* -* 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" -* 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: Build info file for Ado domain appinstall -* ============================================================================ -*/ - -#ifndef __SIMLOCKUI_APPUI_H__ -#define __SIMLOCKUI_APPUI_H__ - -// System includes -#include -#include // CAknNoteDialog::TTone -#include // RProperty. - - -// FORWARD DECLARATIONS -class RProperty; -// User includes -#include "simlockuibackgroundcontrol.h" // CSimLockUIBackgroundControl::TBackgroundText - -// Forward reference -class CSimLockUIBackgroundControl; -class CSimLockDataHandlingDelegate; -class CAknInformationNote; -class CSimLockTelephonyProxy; - -//const TUid KSimLockProperty={0x2000B0FC}; -/** - * CSimLockUIAppUi - * - * An instance of class CSimLockUIAppUi is the UserInterface part of the AVKON - * application framework for the SimLockUI example application - * - * @lib avkon.lib - * @lib eikcore.lib - * @lib eiksrv.lib - */ -class CSimLockUIAppUi : public CAknAppUi - { -public: // Constructor/Destructor - - /** - * CSimLockUIAppUi - * Perform the first phase of two phase construction. - * This needs to be public due to the way the framework constructs the AppUi - * - * @param aSimLockDelegate Sim Lock UI Delegate (ownership not transferred) - */ - CSimLockUIAppUi( CSimLockDataHandlingDelegate& aSimLockDelegate ); - - /** - * ConstructL - * Perform the second phase construction of a CSimLockUIAppUi object - * this needs to be public due to the way the framework constructs the AppUi - */ - void ConstructL(); - - /** - * ~CSimLockUIAppUi - * Destroy the object and release all memory objects - */ - virtual ~CSimLockUIAppUi(); - -private: // Private Data Type(s) - - /** - * Indicate which background text to use - */ - enum TBackgroundText - { - EBackgroundTextEmpty, - EBackgroundTextMain, - EBackgroundTextUnlockComplete, - EBackgroundTextUnlockFailed, - EBackgroundTextUnlockIncorrect - }; - -private: // from CAknAppUi - /** - * @see CAknAppUi::HandleCommandL - */ - virtual void HandleCommandL( TInt aCommand ); - - /** - * @see CAknAppUi::HandleForegroundEventL - */ - virtual void HandleForegroundEventL( TBool aForeground ); - -private: // Private Function Declarations - - /** - * ProcessSimUnlockDialogsL - * Process the series of dialogs that control the Sim Unlock process - * - * @return Indicates whether or not application flow should continue - */ - TBool ProcessSimUnlockDialogsL(); - - /** - * CreateBackgroundControlL - * Create the background control for SimLock UI. Background contains the default - * background image for the current skin and text indicating to the user the - * current stage in the unlock process. - * - */ - void CreateBackgroundControlL(); - - /** - * CheckLockStateL - * Check the state of the lock and display a dialog if it is either - * unlocked or there are no lock attempts remaining. - * - * @return Indicates whether or not application flow should continue - */ - TBool CheckLockStateL() const; - - /** - * DisplayIntroductionDialogL - * Display introduction dialog - * - * @return Indicates whether or not application flow should continue - */ - TBool DisplayIntroductionDialogL(); - - /** - * PromptForPasswordL - * Handle scenario where unlock attempt failed. Prompt user about whether or - * not to continue - * - * @param aPassword Descriptor to receive password - * @return Indicates whether or not application flow should continue - */ - TBool PromptForPasswordL( TDes& aPassword ); - - /** - * CompletePromptForPasswordL - * Ask for second password and check for call in progress - * - * @param aPassword original password entered - * @param aNewPassword Descriptor where 2nd password is to be inserted - * @return Indicates whether or not application flow should continue - */ - TBool CompletePromptForPasswordL( const TDesC& aPassword, TDes& aNewPassword ); - - /** - * AttemptToUnlockSimL - * Ask for second password and check for call in progress - * - * @param aPassword the Sim Lock password - * @return Indicates whether or not application flow should continue - */ - TBool AttemptToUnlockSimL( const TDesC& aPassword ); - - /** - * HandleUnlockFailedL - * Handle scenario where unlock attempt failed. Prompt user about whether or - * not to continue - * - * @return Indicates whether or not application flow should continue - */ - TBool HandleUnlockFailedL(); - - /** - /** - * ShowInformationNoteL - * Show an information note - * - * @param aResourceId indicates what resource is displayed - * @return Indicates whether or not application flow should continue - */ - TInt ShowInformationNoteL( TInt aResourceId ) const; - - /** - * SetBackgroundText - * Change text in background control - * - * @param aText indicates type of text - */ - void SetBackgroundTextL( TBackgroundText aText ); - -private: // Private Member Data - - /** - * Control that contains SimLock UI background - * owns - */ - CSimLockUIBackgroundControl* iBackgroundControl; - - /** - * Pointer to "delegate" class that is responsible for non-UI functions related - * to the phone and SimLock. - */ - CSimLockDataHandlingDelegate& iSimLockDelegate; - - /** - * For foreground event handling, indicate first time run - */ - TBool iFirstRun; - - /** - * Proxy used to talk to CTelephony in a synchronous fashion - * owns - */ - CSimLockTelephonyProxy* iTelephonyProxy; - - //RProperty for publish key - RProperty iProperty; - - }; - - -#endif // __SIMLOCKUI_APPUI_H__ - -// End of file. diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/inc/SimLockUIBackgroundControl.h --- a/securitydialogs/simlockui/inc/SimLockUIBackgroundControl.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ -/* -* ============================================================================ -* Name : SimLockUIBackgroundControl.h -* Part of : Sim Lock UI Application -* Description : SimLock UI Background Control Header -* Version : -* -* 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" -* 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: Build info file for Ado domain appinstall -* ============================================================================ -*/ - -#ifndef __SIMLOCKUI_BACKGROUNDCONTROL_H__ -#define __SIMLOCKUI_BACKGROUNDCONTROL_H__ - -// System includes -#include -#include // CCoeControl - -// Forward declarations -class CAknsBasicBackgroundControlContext; -class CGraphicsContext; - -/** - * CSimLockUIBackgroundControl - * - * A CCoeControl object that represents the application background. - * - * @lib cone.lib - * @lib aknskins.lib - * @lib aknskinsrv.lib - * @lib aknswallpaperutils.lib - */ -class CSimLockUIBackgroundControl : public CCoeControl - { -public: // Public Constructors - - /** - * NewL - * Create a CSimLockUIBackgroundControl object, which will draw itself to aRect - * - * @return a pointer to the created instance of CSimLockUIBackgroundControl - */ - static CSimLockUIBackgroundControl* NewL(); - - /** - * NewLC - * Create a CSimLockUIBackgroundControl object, which will draw itself to aRect - * - * @return a pointer to the created instance of CSimLockUIBackgroundControl - */ - static CSimLockUIBackgroundControl* NewLC(); - - - /** - * ~CSimLockUIBackgroundControl - * Destroy the object and release all memory objects - */ - virtual ~CSimLockUIBackgroundControl(); - -public: // Public API - - /** - * SetBackgroundText - * Set the background text - * - * @param aText new background text( ownership passed ) - */ - void SetBackgroundText( HBufC* aText ); - -private: // Private Consructors - - /** - * ConstructL - * Perform the second phase construction of a CSimLockUIBackgroundControl object - */ - void ConstructL(); - -private: // From CCoeControl - - /** - * SizeChanged - * Indicate that the control has been resized - */ - virtual void SizeChanged(); - - /** - * HandleResourceChange - */ - void HandleResourceChange( TInt aType ); - - /** - * Draw - * Draw this CSimLockUIBackgroundControl to the screen - * - * @param aRect the rectangle of this view that needs updating - */ - virtual void Draw( const TRect& aRect ) const; - - /** - * MopSupplyObject - * Retrieves an object of the same type as that encapsulated in aId. - * - * @param aId type of object to retrieve - */ - virtual TTypeUid::Ptr MopSupplyObject( TTypeUid aId ); - -private: // Private Member API - - /** - * DisplayText - * Called by Draw() to display the appropriate background text - * - * @param aGc graphics context which draws the text - */ - void DisplayText( CGraphicsContext& aGc ) const; - -private: // Member data - - /** - * Control which represents the background image - * owns - */ - CAknsBasicBackgroundControlContext* iBackgroundSkinContext; - - /** - * Text to display on background pane - * owns - */ - HBufC* iDisplayText; - }; - - -#endif // __SIMLOCKUI_BACKGROUNDCONTROL_H__ - -// End of file. - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/inc/SimLockUIDocument.h --- a/securitydialogs/simlockui/inc/SimLockUIDocument.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +0,0 @@ -/* -* ============================================================================ -* Name : SimLockUIDocument.h -* Part of : Sim Lock UI Application -* Description : Create session to ETel and owns SimLock UI Delegate -* Version : -* -* 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" -* 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: Build info file for Ado domain appinstall -* ============================================================================ -*/ - -#ifndef __SIMLOCKUI_DOCUMENT_H__ -#define __SIMLOCKUI_DOCUMENT_H__ - -// INCLUDES -#include -#include // RMmCustomAPI, RTelServer, RMobilePhone - -// CONSTANTS - -// MACROS - -// DATA TYPES - -// FUNCTION PROTOTYPES - -// FORWARD DECLARATIONS - -class CSimLockUIAppUi; -class CEikApplication; -class CSimLockDataHandlingDelegate; - - -/** - * CSimLockUIDocument - * An instance of class CSimLockUIDocument is the Document part of the AVKON - * application framework for the SimLockUI example application - * - * @lib avkon.lib - * @lib eikcore.lib - * @lib eiksrv.lib - */ -class CSimLockUIDocument : public CAknDocument - { -public: // Public Constructors/Destructor - - /** - * NewL - * Construct a CSimLockUIDocument for the AVKON application aApp - * using two phase construction, and return a pointer to the created object - * @param aApp application creating this document - * @return a pointer to the created instance of CSimLockUIDocument - */ - static CSimLockUIDocument* NewL( CEikApplication& aApp ); - - /** - * NewLC - * Construct a CSimLockUIDocument for the AVKON application aApp - * using two phase construction, and return a pointer to the created object, - * leaving an instance on the Cleanup Stack. - * - * @param aApp application creating this document - * @return a pointer to the created instance of CSimLockUIDocument - */ - static CSimLockUIDocument* NewLC( CEikApplication& aApp ); - - /** - * ~CSimLockUIDocument - * Destroy the object and release all memory objects - */ - virtual ~CSimLockUIDocument(); - -public: // from CAknDocument - - /** - * CreateAppUiL - * Create a CSimLockUIAppUi object and return a pointer to it - * - * @return a pointer to the created instance of the AppUi created - */ - virtual CEikAppUi* CreateAppUiL(); - -private: // Private Constructors - - /** - * ConstructL - * Perform the second phase construction of a CSimLockUIDocument object - */ - void ConstructL(); - - /** - * CSimLockUIDocument - * Perform the first phase of two phase construction - * - * @param aApp application creating this document - */ - CSimLockUIDocument( CEikApplication& aApp ); - - -private: // Member Data - - /** - * Handle to ETel Server - */ - RTelServer iServer; - - /** - * Handle to ETel Mobile Phone Object - */ - RMobilePhone iPhone; - - /** - * Handle to ETel Custom API Object - */ - RMmCustomAPI iCustomPhone; - - /** - * Handle to Sim Lock Delegate - * owns - */ - CSimLockDataHandlingDelegate* iSimLockDelegate; - }; - - -#endif // __SIMLOCKUI_DOCUMENT_H__ - -// end of file. - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/inc/SimLockUiKeys.h --- a/securitydialogs/simlockui/inc/SimLockUiKeys.h Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* -* ============================================================================ -* Name : SimLockUIKeys.h -* Part of : Sim Lock UI Application -* Description : SimLock P&S keys -* Version : -* -* 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" -* 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: Build info file for Ado domain appinstall -* ============================================================================ -*/ - -#ifndef __SIMLOCKUI_KEYS_H__ -#define __SIMLOCKUI_KEYS_H__ - -// System includes -#include -#include // CAknNoteDialog::TTone -#include // RProperty. - - -// FORWARD DECLARATIONS -class RProperty; -const TUid KSimLockProperty={0x10003b21}; - - -enum TSimLockPropertyKeys { ESimLockProperty, ESimLockActiveStatus }; - -/** - *0: Default value - *1: Indicates that "function" is done -*/ -enum TSimLockActiveStatus - { - KSimLockStatusUnknown = 0, - KSimLockStatusDone - }; - -#endif // __SIMLOCKUI_KEYS_H__ - -// End of file. diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/rom/simlockui.iby --- a/securitydialogs/simlockui/rom/simlockui.iby Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* -* ============================================================================ -* Name : simlockui.iby -* Part of : SimLock UI -* Description : SimLock UI iby file -* Version : -* -* 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" -* 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: Build info file for Ado domain appinstall -* ============================================================================ -*/ - - - -#ifndef _SIMLOCKUI_IBY_ -#define _SIMLOCKUI_IBY_ - -#include -#ifdef FF_SIMLOCK_UI -// Definitions for applications with a UI -S60_APP_EXE( SimLockUI ) -S60_APP_AIF_RSC( SimLockUI ) - -#endif // FF_SIMLOCK_UI - -#endif // _SIMLOCKUI_IBY_ diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/rom/simlockui_resources.iby --- a/securitydialogs/simlockui/rom/simlockui_resources.iby Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* ============================================================================ -* Name : simlockui_resources.iby -* Part of : SimLock UI -* Description : SimLock UI resources iby file -* Version : -* -* 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" -* 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: Build info file for Ado domain appinstall -* ============================================================================ -*/ - -#ifndef _SIMLOCKUI_RESOURCES_IBY_ -#define _SIMLOCKUI_RESOURCES_IBY_ - -#include -#ifdef FF_SIMLOCK_UI -S60_APP_RESOURCE( SimLockUI ) -#endif // FF_SIMLOCK_UI - -#endif // _SIMLOCKUI_RESOURCES_IBY_ diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/src/SimLockDataHandlingDelegate.cpp --- a/securitydialogs/simlockui/src/SimLockDataHandlingDelegate.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,175 +0,0 @@ -/* -* ============================================================================ -* Name : SimLockDataHandlingDelegate.cpp -* Part of : Sim Lock UI Application -* Description : Implementation of Sim Lock UI Application -* Version : -* -* 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" -* 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: Build info file for Ado domain appinstall -* ============================================================================ -*/ - -// System Include Files -#include // RMmCustomAPI, RMobilePhone - -// User Include Files -#include "simlockdatahandlingdelegate.h" -#include "simlockui.pan" -#include "simlockisaserverdefinitions.h" - - -TInt KSimLockTimeoutDelay = 5000000; // 5 seconds - -// =========================================================================== -// PUBLIC CONSTRUCTORS -// =========================================================================== - -// --------------------------------------------------------------------------- -// CSimLockDataHandlingDelegate::NewL -// --------------------------------------------------------------------------- -CSimLockDataHandlingDelegate* CSimLockDataHandlingDelegate::NewL( RMmCustomAPI& aCustomAPI ) - { - CSimLockDataHandlingDelegate* self = new ( ELeave ) CSimLockDataHandlingDelegate( aCustomAPI ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// CSimLockDataHandlingDelegate::~CSimLockDataHandlingDelegate -// --------------------------------------------------------------------------- -CSimLockDataHandlingDelegate::~CSimLockDataHandlingDelegate() - { - Cancel(); - delete iTimer; - delete iSchedulerWait; - } - -// =========================================================================== -// PUBLIC MEMBER FUNCTIONS -// =========================================================================== - -// --------------------------------------------------------------------------- -// CSimLockDataHandlingDelegate::OpenSimLock -// --------------------------------------------------------------------------- -TInt CSimLockDataHandlingDelegate::OpenSimLock( const TDesC& aPassword ) - { - // Use ETel custom API to deactive SimLock - return iCustomAPI.DeActivateSimLock( aPassword, RMmCustomAPI::EOperator ); - } - -// --------------------------------------------------------------------------- -// CSimLockDataHandlingDelegate::IsSimLockOpen -// --------------------------------------------------------------------------- -TBool CSimLockDataHandlingDelegate::IsSimLockOpen() const - { - - ASSERT( iDataHasBeenRead ); - - return iLockIsOpen; - } - - -// =========================================================================== -// PRIVATE CONSTRUCTORS -// =========================================================================== - -// --------------------------------------------------------------------------- -// CSimLockDataHandlingDelegate::CSimLockDataHandlingDelegate -// --------------------------------------------------------------------------- -CSimLockDataHandlingDelegate::CSimLockDataHandlingDelegate( RMmCustomAPI& aCustomAPI ) -: CActive( EPriorityStandard ), - iCustomAPI( aCustomAPI ) - { //lint !e1403 iIndicators initialized in CBase ctor - } - -// --------------------------------------------------------------------------- -// CSimLockDataHandlingDelegate::ConstructL -// --------------------------------------------------------------------------- -void CSimLockDataHandlingDelegate::ConstructL() - { - CActiveScheduler::Add(this); - iSchedulerWait = new ( ELeave ) CActiveSchedulerWait; - iTimer = CPeriodic::NewL(EPriorityHigh); - } - -// =========================================================================== -// PRIVATE MEMBER FUNCTIONS -// =========================================================================== - -// --------------------------------------------------------------------------- -// CSimLockDataHandlingDelegate::RunL -// --------------------------------------------------------------------------- -void CSimLockDataHandlingDelegate::RunL() - { - - // Stop the current run sequence - iSchedulerWait->AsyncStop(); - } - -// --------------------------------------------------------------------------- -// CSimLockDataHandlingDelegate::DoCancel -// --------------------------------------------------------------------------- -void CSimLockDataHandlingDelegate::DoCancel() - { - - // Cancel timer - iTimer->Cancel(); - - // Stop the current run sequence so we can continue execution in a - // synchronous fashion - iSchedulerWait->AsyncStop(); - } - -// --------------------------------------------------------------------------- -// CSimLockTelephonyProxy::TimerElapsed -// --------------------------------------------------------------------------- -TInt CSimLockDataHandlingDelegate::TimerElapsed(TAny* /*aUnused*/) - { - // Some request did not complete while reading Sim Lock data. - // This is not expected, so Panic. - Panic( ESimLockUIUnableToReadSimLock ); - - return 0; - } - -// --------------------------------------------------------------------------- -// CSimLockDataHandlingDelegate::CompleteRequestWithTimeout -// --------------------------------------------------------------------------- -void CSimLockDataHandlingDelegate::CompleteRequestWithTimeout() - { - - ASSERT( ! iTimer->IsActive() ); - - if ( ! iTimer->IsActive() ) - { - iTimer->Cancel(); - } - - // Start timer with KSimLockProxyTimeout to protect against requests that - // do not complete for some reason. - iTimer->Start(KSimLockTimeoutDelay,0,TCallBack(&TimerElapsed)); - - SetActive(); - - // Wait for request to complete. Response time is expected to be negligible. - iSchedulerWait->Start(); - iTimer->Cancel(); - } - - -// end of file. - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/src/SimLockTelephonyProxy.cpp --- a/securitydialogs/simlockui/src/SimLockTelephonyProxy.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +0,0 @@ -/* -* ============================================================================ -* Name : SimLockTelephonyProxy.cpp -* Part of : Sim Lock UI Telephony Proxy -* Description : Wrap asynchronous calls to Core Telephony -* Version : -* -* 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" -* 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: Build info file for Ado domain appinstall -* ============================================================================ -*/ - -// System Includes -#include // CTelephony - -// User Includes -#include "simlocktelephonyproxy.h" -#include "simlockui.pan" - - -TInt KSimLockProxyTimeout = 5000000; // 5 seconds - -// --------------------------------------------------------------------------- -// CSimLockDataHandlingDelegate::NewL -// --------------------------------------------------------------------------- -CSimLockTelephonyProxy* CSimLockTelephonyProxy::NewL() - { - CSimLockTelephonyProxy* self = new ( ELeave ) CSimLockTelephonyProxy(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// CSimLockTelephonyProxy::CSimLockTelephonyProxy -// --------------------------------------------------------------------------- -CSimLockTelephonyProxy::~CSimLockTelephonyProxy() - { - Cancel(); - delete iTelephony; - delete iSchedulerWait; - delete iTimer; - } - -// --------------------------------------------------------------------------- -// CSimLockTelephonyProxy::IsCallInProgress -// --------------------------------------------------------------------------- -TBool CSimLockTelephonyProxy::IsCallInProgress() - { - iTelephony->GetIndicator( iStatus, iIndicatorPackage ); - CompleteRequestWithTimeout(); - - if ( iStatus != KErrNone ) - { - // If there is an error obtaining status, assume no call in progress - } - else if ( iIndicators.iIndicator & CTelephony::KIndCallInProgress ) - { - return ETrue; - } - - return EFalse; - } - -// --------------------------------------------------------------------------- -// CSimLockTelephonyProxy::RunL -// --------------------------------------------------------------------------- -void CSimLockTelephonyProxy::RunL() - { - // Stop the current run sequence so we can continue execution in a - // synchronous fashion - iSchedulerWait->AsyncStop(); - } - -// --------------------------------------------------------------------------- -// CSimLockTelephonyProxy::DoCancel -// --------------------------------------------------------------------------- -void CSimLockTelephonyProxy::DoCancel() - { - // Cancel outstanding request - iTelephony->CancelAsync( CTelephony::EGetIndicatorCancel ); - iSchedulerWait->AsyncStop(); - } - -// --------------------------------------------------------------------------- -// CSimLockTelephonyProxy::CSimLockTelephonyProxy -// --------------------------------------------------------------------------- -CSimLockTelephonyProxy::CSimLockTelephonyProxy() - : CActive( EPriorityStandard ), - iIndicatorPackage( iIndicators ) - { - } - -// --------------------------------------------------------------------------- -// CSimLockTelephonyProxy::ConstructL -// --------------------------------------------------------------------------- -void CSimLockTelephonyProxy::ConstructL() - { - CActiveScheduler::Add( this ); - iSchedulerWait = new ( ELeave ) CActiveSchedulerWait; - iTelephony = CTelephony::NewL(); - iTimer = CPeriodic::NewL(EPriorityHigh); - } - -// --------------------------------------------------------------------------- -// CSimLockTelephonyProxy::TimerElapsed -// --------------------------------------------------------------------------- -TInt CSimLockTelephonyProxy::TimerElapsed(TAny* aClientObject) - { - CSimLockTelephonyProxy* clientObject = static_cast(aClientObject); - - // Timeout timer has elapsed. An asynchronous request timed out. - ASSERT(0); - - // Cancel original request - clientObject->Cancel(); - return 0; - } - -// --------------------------------------------------------------------------- -// CSimLockTelephonyProxy::CompleteRequestWithTimeout -// --------------------------------------------------------------------------- -void CSimLockTelephonyProxy::CompleteRequestWithTimeout() - { - - if ( iTimer->IsActive() ) - { - ASSERT(0); - iTimer->Cancel(); - } - - // Start timer with KSimLockProxyTimeout to protect against requests that - // do not complete for some reason. - iTimer->Start(KSimLockProxyTimeout,0,TCallBack(&TimerElapsed, this)); - - SetActive(); - - // Wait for request to complete. Response time is expected to be negligible. - iSchedulerWait->Start(); - - iTimer->Cancel(); - } - -// end of file - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/src/SimLockUI.cpp --- a/securitydialogs/simlockui/src/SimLockUI.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* ============================================================================ -* Name : simlockui.cpp -* Part of : Sim Lock UI Application -* Description : Sim Lock UI App framework code -* Version : -* -* 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" -* 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: Build info file for Ado domain appinstall -* ============================================================================ -*/ - -// System Includes -#include - -// User Includes -#include "simlockuiapplication.h" - -// --------------------------------------------------------------------------- -// NewApplication -// --------------------------------------------------------------------------- -CApaApplication* NewApplication() - { - // Create an application, and return a pointer to it - return new CSimLockUIApplication; - } - -// --------------------------------------------------------------------------- -// E32Main -// --------------------------------------------------------------------------- -TInt E32Main() - { - return EikStart::RunApplication( NewApplication ); - } - -// End of file - - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/src/SimLockUIApplication.cpp --- a/securitydialogs/simlockui/src/SimLockUIApplication.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* -* ============================================================================ -* Name :simlockuiapplication.cpp -* Part of : Sim Lock UI Application -* Description : Implementation of Sim Lock UI Application UI Methods -* Version : -* -* 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" -* 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: Build info file for Ado domain appinstall -* ============================================================================ -*/ - -// User include files -#include "simlockuidocument.h" -#include "simlockuiapplication.h" -#include "simlockui.hrh" - -// UID for the application, this should correspond to the uid defined in the mmp file -static const TUid KUidSimLockUIApp = {SIMLOCK_UI_UID3}; - -// --------------------------------------------------------------------------- -// CSimLockUIApplication::CreateDocumentL -// --------------------------------------------------------------------------- -CApaDocument* CSimLockUIApplication::CreateDocumentL() - { - // Create an SimLockUI document, and return a pointer to it - CApaDocument* document = CSimLockUIDocument::NewL( *this ); - return document; - } - -// --------------------------------------------------------------------------- -// CSimLockUIApplication::AppDllUid -// --------------------------------------------------------------------------- -TUid CSimLockUIApplication::AppDllUid() const - { - // Return the UID for the SimLockUI application - return KUidSimLockUIApp; - } - -// End of file - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/src/SimLockUIAppui.cpp --- a/securitydialogs/simlockui/src/SimLockUIAppui.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,411 +0,0 @@ -/* - * ============================================================================ - * Name : SimLockUIAppUi.cpp - * Part of : Sim Lock UI Application - * Description : Implementation of Sim Lock UI Application UI Methods - * Version : - * -* 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" -* 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: Build info file for Ado domain appinstall -* ============================================================================ -*/ - -// Platform Includes -#include -#include // CAknNoteDialog -#include // StringLoader -#include // KErrGsm0707OperationNotAllowed -#include // CEikStatusPane -#include // CAknMessageQueryDialog -#include -#include //Rproperty -#include // TSimLockPassword - -// Local Includes -#include "simlockisaserverdefinitions.h" -#include "simlockui.pan" -#include "simlockuiappui.h" -#include "simlockuibackgroundcontrol.h" -#include "simlockui.hrh" -#include "simlockdatahandlingdelegate.h" -#include "simlocktelephonyproxy.h" -#include "simlockuikeys.h" - -// Resource Includes -#include - -// --------------------------------------------------------------------------- -// CSimLockUIAppUi::CSimLockUIAppUi -// --------------------------------------------------------------------------- -CSimLockUIAppUi::CSimLockUIAppUi( - CSimLockDataHandlingDelegate& aSimLockDelegate) : - iSimLockDelegate(aSimLockDelegate), iFirstRun(ETrue) - { - // no implementation required - } - -// --------------------------------------------------------------------------- -// CSimLockUIAppUi::ConstructL -// --------------------------------------------------------------------------- -void CSimLockUIAppUi::ConstructL() - { - BaseConstructL(EAknEnableSkin | EAknEnableMSK); - - // Used to get status of phone call - iTelephonyProxy = CSimLockTelephonyProxy::NewL(); - //Define RProperty to Publish Keys for SimLockUi - TInt ret = RProperty::Define(KSimLockProperty, ESimLockActiveStatus, - RProperty::EInt); - } - -// --------------------------------------------------------------------------- -// CSimLockUIAppUi::~CSimLockUIAppUi -// --------------------------------------------------------------------------- -CSimLockUIAppUi::~CSimLockUIAppUi() - { - - delete iTelephonyProxy; - - if (iBackgroundControl) - { - RemoveFromStack(iBackgroundControl); - delete iBackgroundControl; - } - //Sets SimLock Ui P&S keys to show that SimLock Ui is exiting - RProperty::Set(KSimLockProperty, ESimLockActiveStatus, KSimLockStatusDone); - - } - -// --------------------------------------------------------------------------- -// CSimLockUIAppUi::HandleCommandL -// --------------------------------------------------------------------------- -void CSimLockUIAppUi::HandleCommandL(TInt aCommand) - { - switch (aCommand) - { - case EEikCmdExit: - case EAknSoftkeyExit: - Exit(); - break; - - default: - Panic(ESimLockUIBasicUi); - break; - } - } - -// --------------------------------------------------------------------------- -// CSimLockUIAppUi::HandleForegroundEventL -// --------------------------------------------------------------------------- -void CSimLockUIAppUi::HandleForegroundEventL(TBool aForeground) - { - CAknAppUi::HandleForegroundEventL(aForeground); - - // When the app switches to the foreground for the first time, display - // series of dialogs. - if (aForeground && iFirstRun) - { - iFirstRun = EFalse; - ProcessSimUnlockDialogsL(); - PrepareToExit(); - Exit(); - } - } - -// --------------------------------------------------------------------------- -// CSimLockUIAppUi::ProcessSimUnlockDialogsL -// --------------------------------------------------------------------------- -TBool CSimLockUIAppUi::ProcessSimUnlockDialogsL() - { - TBool keepLooping = ETrue; - - RMmCustomAPI::TSimLockPassword password; - - - // Loop until flag is set - do - { - // Create background if not already there - if (!iBackgroundControl) - { - CreateBackgroundControlL(); - } - // Display Introduction Dialog/Prompt - if (!DisplayIntroductionDialogL()) - { - return EFalse; - } - // Prompt for password and attempt to unlock Sim - if (!PromptForPasswordL(password)) - { - // skip next iteration - continue; - } - // Set only if no dialogs are ever dismissed - keepLooping = AttemptToUnlockSimL(password); - - // Continue to loop while indicated to start over and dialog - // has not been dismissed - } - while (keepLooping); - - return keepLooping; - } - -// --------------------------------------------------------------------------- -// CSimLockUIAppUi::CreateBackgroundControlL -// --------------------------------------------------------------------------- -void CSimLockUIAppUi::CreateBackgroundControlL() - { - iBackgroundControl = CSimLockUIBackgroundControl::NewL(); - AddToStackL(iBackgroundControl); - } - -// --------------------------------------------------------------------------- -// CSimLockUIAppUi::DisplayIntroductionDialogL -// --------------------------------------------------------------------------- -TBool CSimLockUIAppUi::DisplayIntroductionDialogL() - { - SetBackgroundTextL(EBackgroundTextEmpty); - - HBufC* displayText = StringLoader::LoadLC(R_SIM_INFO_WELCOME_NOTE_TEXT); - CAknMessageQueryDialog* query = new (ELeave) CAknMessageQueryDialog( - CAknMessageQueryDialog::ENoTone); - CleanupStack::PushL(query); - query->SetMessageTextL(*displayText); - TInt executeResult = query->ExecuteLD(R_SIM_INFO_WELCOME_NOTE); - CleanupStack::Pop(query); - CleanupStack::PopAndDestroy(displayText); - return executeResult; - - } - -// --------------------------------------------------------------------------- -// CSimLockUIAppUi::PromptForPasswordL -// --------------------------------------------------------------------------- -TBool CSimLockUIAppUi::PromptForPasswordL(TDes& aPassword) - { - RMmCustomAPI::TSimLockPassword newPassword; - - // Prompt for password twice. Loop until passwords match. - do - { - aPassword.Zero(); - - // Ask for password - CAknTextQueryDialog* dialog = CAknTextQueryDialog::NewL(aPassword); - if (!dialog->ExecuteLD(R_SIM_INFO_ENTER_PASSWORD)) - { - return EFalse; - } - - // Ask to re-enter password and verify there is no call in progress - if (!CompletePromptForPasswordL(aPassword, newPassword)) - { - return EFalse; - } - } - while (newPassword.Compare(aPassword)); - - return ETrue; - } - -// --------------------------------------------------------------------------- -// CSimLockUIAppUi::CompletePromptForPasswordL -// --------------------------------------------------------------------------- -TBool CSimLockUIAppUi::CompletePromptForPasswordL(const TDesC& aPassword, - TDes& aNewPassword) - { - TBool callInProgress = EFalse; - - aNewPassword.Zero(); - - do // Loop until no call in progress - { - // Display dialog to ask to re-enter password - CAknTextQueryDialog* dialog = CAknTextQueryDialog::NewL(aNewPassword); - if (!dialog->ExecuteLD(R_SIM_INFO_REENTER_PASSWORD)) - { - return EFalse; - } - - // Check to see if passwords match - if (aNewPassword.Compare(aPassword)) - { - // Create message query dialog to indicate that codes do not match - CAknMessageQueryDialog* query = - new (ELeave) CAknMessageQueryDialog( - CAknMessageQueryDialog::ENoTone); - return query->ExecuteLD(R_SIM_INFO_CODES_NOT_MATCH); - } - - // If there is a call in progress, show note and return to "re-enter password" prompt - if (!iTelephonyProxy->IsCallInProgress()) - { - return ETrue; - } - - // Do not allow Sim unlocking, return to password prompt - ShowInformationNoteL(R_SIM_UNLOCK_MESSAGE_END_CALL); - callInProgress = ETrue; - } - while (callInProgress); - - return ETrue; - } - -// --------------------------------------------------------------------------- -// CSimLockUIAppUi::AttemptToUnlockSimL -// --------------------------------------------------------------------------- -TBool CSimLockUIAppUi::AttemptToUnlockSimL(const TDesC& aPassword) - { - -const TDesC& password = aPassword; - -#ifdef __WINS__ - // In WINS (Emulator) builds, call to OpenSimLock will just time out - TInt unlockResult = KErrGsm0707IncorrectPassword; -#else - // Attempt to unlock SIM - TInt unlockResult = iSimLockDelegate.OpenSimLock( password ); -#endif - - CAknMessageQueryDialog* query = new (ELeave) CAknMessageQueryDialog( - CAknMessageQueryDialog::ENoTone); - - switch (unlockResult) - { - case KErrAlreadyExists: - // Should not happen! This indicates that the phone was already unlocked, - // which it shouldn't be if we got this far. - ASSERT( 0 ); - - // Fall Through - - case KErrNone: - SetBackgroundTextL(EBackgroundTextUnlockComplete); - ShowInformationNoteL(R_SIM_PHONE_UNLOCKED); - return EFalse; - - default: - // Oops, we missed one. - ASSERT( 0 ); - case KErrGsm0707OperationNotAllowed: - case KErrLocked: - // Permanently locked - SetBackgroundTextL(EBackgroundTextEmpty); - query->ExecuteLD(R_SIM_UNLOCK_FINAL); - return EFalse; - case KErrTimedOut: - case KErrGeneral: - case KErrArgument: - case KErrGsm0707IncorrectPassword: - // Not permanently locked - return HandleUnlockFailedL(); - - - }//switch - } -// --------------------------------------------------------------------------- -// CSimLockUIAppUi::HandleUnlockFailedL -// --------------------------------------------------------------------------- -TBool CSimLockUIAppUi::HandleUnlockFailedL() - { - RMmCustomAPI::TSimLockPassword password; - - // Otherwise, prompt user to try again - SetBackgroundTextL(EBackgroundTextEmpty); - - // Show "Code Incorrect" and prompt user to continue or not - CAknMessageQueryDialog* query = new (ELeave) CAknMessageQueryDialog( - CAknMessageQueryDialog::ENoTone); - if (query->ExecuteLD(R_SIM_INFO_CODE_INCORRECT)) - { - if ( PromptForPasswordL(password) ) - { - return AttemptToUnlockSimL(password); - } - else - { - // Set flag indicating to keep looping - return ETrue; - } - } - else - { - // display intro popup - return ETrue; - } - } - -// --------------------------------------------------------------------------- -// CSimLockUIAppUi::ShowInformationNoteL -// --------------------------------------------------------------------------- -TInt CSimLockUIAppUi::ShowInformationNoteL(TInt aResourceId) const - { - TInt executeResult; - - // Show note with the provided resource id - HBufC* displayText = StringLoader::LoadLC(aResourceId); - - CAknInformationNote* dialog = new (ELeave) CAknInformationNote(ETrue); - executeResult = dialog->ExecuteLD(*displayText); - CleanupStack::PopAndDestroy(displayText); - return executeResult; - } - -// --------------------------------------------------------------------------- -// CSimLockUIAppUi::SetBackgroundTextL -// --------------------------------------------------------------------------- -void CSimLockUIAppUi::SetBackgroundTextL(TBackgroundText aText) - { - HBufC* displayText = NULL; - - // Load resource and set text in background control based on provided info - switch (aText) - { - case EBackgroundTextEmpty: - displayText = KNullDesC().AllocL(); - break; - - case EBackgroundTextMain: - displayText = StringLoader::LoadL( - R_SIMLOCK_UI_BACKGROUND_TEXT_MAIN); - break; - - case EBackgroundTextUnlockComplete: - displayText = StringLoader::LoadL( - R_SIMLOCK_UI_BACKGROUND_TEXT_UNLOCK_COMPLETE); - break; - - case EBackgroundTextUnlockFailed: - displayText = StringLoader::LoadL( - R_SIMLOCK_UI_BACKGROUND_TEXT_UNLOCK_FAILED); - break; - - case EBackgroundTextUnlockIncorrect: - displayText = StringLoader::LoadL( - R_SIMLOCK_UI_BACKGROUND_TEXT_UNLOCK_INCORRECT); - break; - - default: - ASSERT( 0 ); - break; - } - - // Transfer ownership to iBackgroundControl - iBackgroundControl->SetBackgroundText(displayText); - } - -// End of file. diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/src/SimLockUIBackgroundControl.cpp --- a/securitydialogs/simlockui/src/SimLockUIBackgroundControl.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,191 +0,0 @@ -/* -* ============================================================================ -* Name : SimLockUIBackgroundControl.cpp -* Part of : Sim Lock UI Application -* Description : Implementation of Sim Lock UI Background -* Version : -* -* 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" -* 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: Build info file for Ado domain appinstall -* ============================================================================ -*/ - - -// System Includes -#include -#include // AknsDrawUtils -#include // MAknsSkinInstance -#include // MAknsControlContext -#include // CAknsBasicBackgroundControlContext -#include // AknLayoutScalable_Avkon -#include // AknsUtils - -// User Includes -#include "simlockuibackgroundcontrol.h" -#include "simlockisaserverdefinitions.h" -#include - -static const TInt KSkinLayoutOption = 2; - -// --------------------------------------------------------------------------- -// CSimLockUIBackgroundControl::NewL -// --------------------------------------------------------------------------- -CSimLockUIBackgroundControl* CSimLockUIBackgroundControl::NewL() - { - CSimLockUIBackgroundControl* self = CSimLockUIBackgroundControl::NewLC(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// CSimLockUIBackgroundControl::NewLC -// --------------------------------------------------------------------------- -CSimLockUIBackgroundControl* CSimLockUIBackgroundControl::NewLC() - { - CSimLockUIBackgroundControl* self = new ( ELeave ) CSimLockUIBackgroundControl; - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// CSimLockUIBackgroundControl::~CSimLockUIBackgroundControl -// --------------------------------------------------------------------------- -CSimLockUIBackgroundControl::~CSimLockUIBackgroundControl() - { - delete iBackgroundSkinContext; - delete iDisplayText; - } - -// --------------------------------------------------------------------------- -// CSimLockUIBackgroundControl::SetBackgroundText -// --------------------------------------------------------------------------- -void CSimLockUIBackgroundControl::SetBackgroundText( HBufC* aText ) - { - delete iDisplayText; - - iDisplayText = aText; - - DrawDeferred(); - } - -// --------------------------------------------------------------------------- -// CSimLockUIBackgroundControl::ConstructL -// --------------------------------------------------------------------------- -void CSimLockUIBackgroundControl::ConstructL() - { - // Create a window for this application view - CreateWindowL(); - SetExtentToWholeScreen(); - - iBackgroundSkinContext = CAknsBasicBackgroundControlContext::NewL( - KAknsIIDQsnBgAreaMain, Rect(), EFalse ); - - // Activate the window, which makes it ready to be drawn - ActivateL(); - } - -// --------------------------------------------------------------------------- -// CSimLockUIBackgroundControl::SizeChanged -// --------------------------------------------------------------------------- -void CSimLockUIBackgroundControl::SizeChanged() - { - // Background skin. - if ( iBackgroundSkinContext ) - iBackgroundSkinContext->SetRect( Rect() ); - } - -// --------------------------------------------------------------------------- -// CSimLockUIBackgroundControl::HandleResourceChange() -// --------------------------------------------------------------------------- -// -void CSimLockUIBackgroundControl::HandleResourceChange( TInt aType ) - { - CCoeControl::HandleResourceChange( aType ); - - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - SetExtentToWholeScreen(); - } - } - - -// --------------------------------------------------------------------------- -// CSimLockUIBackgroundControl::Draw -// --------------------------------------------------------------------------- -void CSimLockUIBackgroundControl::Draw( const TRect& /*aRect*/ ) const - { - // Draw background skin - CWindowGc& graphicsContext = SystemGc(); - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - MAknsControlContext* controlContext = AknsDrawUtils::ControlContext( this ); - AknsDrawUtils::Background( skin, controlContext, this, graphicsContext, Rect() ); - - // Draw background text - DisplayText( graphicsContext ); - } - -// --------------------------------------------------------------------------- -// CSimLockUIBackgroundControl::MopSupplyObject -// --------------------------------------------------------------------------- -TTypeUid::Ptr CSimLockUIBackgroundControl::MopSupplyObject( TTypeUid aId ) - { - if ( aId.iUid == MAknsControlContext::ETypeId ) - { - // Return the background skin object - return MAknsControlContext::SupplyMopObject( aId, iBackgroundSkinContext ); - } - - return CCoeControl::MopSupplyObject( aId ); - } - -// --------------------------------------------------------------------------- -// CSimLockUIBackgroundControl::DisplayText -// --------------------------------------------------------------------------- -void CSimLockUIBackgroundControl::DisplayText( CGraphicsContext& aGc ) const - { - if ( iDisplayText ) - { - // Set up text and layout - TAknLayoutText line; - TAknTextLineLayout layout = AknLayoutScalable_Avkon::main_pane_empty_t1( KSkinLayoutOption ).LayoutLine(); - - line.LayoutText( Rect(), layout ); - - // Get color from skin instance. - TRgb color( line.Color() ); - - if ( AknsUtils::AvkonSkinEnabled() ) - { - TRgb skinColor; - - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - - TInt err = AknsUtils::GetCachedColor( skin, - skinColor, - KAknsIIDQsnTextColors, - EAknsCIQsnTextColorsCG6 ); - if ( err == KErrNone ) - { - color = skinColor; - } - } - - // Actually display the text - line.DrawText( aGc, *iDisplayText, ETrue, color ); - } - } - -// End of file. - diff -r 63339781d179 -r 09b1ac925e3f securitydialogs/simlockui/src/SimLockUIDocument.cpp --- a/securitydialogs/simlockui/src/SimLockUIDocument.cpp Thu Aug 19 10:45:23 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +0,0 @@ -/* -* ============================================================================ -* Name : SimLockUIDocument.cpp -* Part of : Sim Lock UI Application -* Description : Implementation of Sim Lock UI Application -* Version : -* -* 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" -* 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: Build info file for Ado domain appinstall -* -* ============================================================================ -*/ - -// System Include Files -#include // RMmCustomAPI, RMobilePhone -#include // KMmTsyModuleName - -// User Include Files -#include "simlockdatahandlingdelegate.h" -#include "simlockisaserverdefinitions.h" -#include "simlockuiappui.h" -#include "simlockuidocument.h" - -// Local Constants -const TInt KTriesToConnectServer( 2 ); -const TInt KTimeBeforeRetryingServerConnection( 50000 ); -static const TInt KPhoneInfoIndex( 0 ); - - -// --------------------------------------------------------------------------- -// CSimLockUIDocument::NewL -// --------------------------------------------------------------------------- -CSimLockUIDocument* CSimLockUIDocument::NewL( CEikApplication& aApp ) - { - CSimLockUIDocument* self = NewLC( aApp ); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------------------------- -// CSimLockUIDocument::NewLC -// --------------------------------------------------------------------------- -CSimLockUIDocument* CSimLockUIDocument::NewLC( CEikApplication& aApp ) - { - CSimLockUIDocument* self = new ( ELeave ) CSimLockUIDocument( aApp ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// --------------------------------------------------------------------------- -// CSimLockUIDocument::~CSimLockUIDocument -// --------------------------------------------------------------------------- -CSimLockUIDocument::~CSimLockUIDocument() - { - // Close phone - if ( iPhone.SubSessionHandle() ) - { - iPhone.Close(); - } - - // Close custom phone - if ( iCustomPhone.SubSessionHandle() ) - { - iCustomPhone.Close(); - } - - // Close ETel connection - if ( iServer.Handle() ) - { - iServer.UnloadPhoneModule( KMmTsyModuleName ); - iServer.Close(); - } - - // Delete simlock delegate - delete iSimLockDelegate; - } - -// --------------------------------------------------------------------------- -// CSimLockUIDocument::CreateAppUiL -// --------------------------------------------------------------------------- -CEikAppUi* CSimLockUIDocument::CreateAppUiL() - { - // Create the application user interface, and return a pointer to it, - // the framework takes ownership of this object - CEikAppUi* appUi = new(ELeave)CSimLockUIAppUi( *iSimLockDelegate ); - return appUi; - } - -// --------------------------------------------------------------------------- -// CSimLockUIDocument::ConstructL -// --------------------------------------------------------------------------- -void CSimLockUIDocument::ConstructL() - { - RTelServer::TPhoneInfo phoneInfo; - - TInt error( KErrGeneral ); - - // Connect to ETel server - // All server connections are tried to be made KTriesToConnectServer times because occasional - // fails on connections are possible, at least on some servers. - for ( TInt thisTry=0; thisTry - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 63339781d179 -r 09b1ac925e3f sysdef_1_5_1.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sysdef_1_5_1.dtd Tue Aug 31 16:04:40 2010 +0300 @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 63339781d179 -r 09b1ac925e3f wim/Scard/src/ScardReaderRegistry.cpp --- a/wim/Scard/src/ScardReaderRegistry.cpp Thu Aug 19 10:45:23 2010 +0300 +++ b/wim/Scard/src/ScardReaderRegistry.cpp Tue Aug 31 16:04:40 2010 +0300 @@ -298,7 +298,7 @@ TLauncherStruct launcher; launcher.iGroupID = KGroupID; //This is always 1 launcher.iReaderID = KReaderID; //This is always 1 - launcher.iSession.Connect(); + User::LeaveIfError( launcher.iSession.Connect() ); User::LeaveIfError( launcher.iLibrary.Load( KSwimReaderDLL ) ); diff -r 63339781d179 -r 09b1ac925e3f wim/WimSoft/armv5/udeb/wimi.lib Binary file wim/WimSoft/armv5/udeb/wimi.lib has changed diff -r 63339781d179 -r 09b1ac925e3f wim/WimSoft/armv5/urel/wimi.lib Binary file wim/WimSoft/armv5/urel/wimi.lib has changed diff -r 63339781d179 -r 09b1ac925e3f wim/WimSoft/winscw/udeb/WIMI.LIB Binary file wim/WimSoft/winscw/udeb/WIMI.LIB has changed diff -r 63339781d179 -r 09b1ac925e3f wim/WimSoft/winscw/urel/WIMI.LIB Binary file wim/WimSoft/winscw/urel/WIMI.LIB has changed