# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1276255720 -10800 # Node ID aad866c3751972944ce4003a2e821785443ae7aa # Parent 6b63ca65093a34435043cf5d4c3530ace7436e7f Revision: 201021 Kit: 2010123 diff -r 6b63ca65093a -r aad866c37519 cpsecplugins/cpadvancedsecplugin/src/cpcertdetailview.cpp --- a/cpsecplugins/cpadvancedsecplugin/src/cpcertdetailview.cpp Thu May 27 13:44:17 2010 +0300 +++ b/cpsecplugins/cpadvancedsecplugin/src/cpcertdetailview.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -14,7 +14,7 @@ * Description: * */ -#include +#include #include #include #include @@ -35,9 +35,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include #include diff -r 6b63ca65093a -r aad866c37519 cpsecplugins/cpadvancedsecplugin/src/cpcertview.cpp --- a/cpsecplugins/cpadvancedsecplugin/src/cpcertview.cpp Thu May 27 13:44:17 2010 +0300 +++ b/cpsecplugins/cpadvancedsecplugin/src/cpcertview.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include diff -r 6b63ca65093a -r aad866c37519 cpsecplugins/cpadvancedsecplugin/src/cpmoduleview.cpp --- a/cpsecplugins/cpadvancedsecplugin/src/cpmoduleview.cpp Thu May 27 13:44:17 2010 +0300 +++ b/cpsecplugins/cpadvancedsecplugin/src/cpmoduleview.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include diff -r 6b63ca65093a -r aad866c37519 cpsecplugins/cpadvancedsecplugin/src/cpsecmoduleinfoview.cpp --- a/cpsecplugins/cpadvancedsecplugin/src/cpsecmoduleinfoview.cpp Thu May 27 13:44:17 2010 +0300 +++ b/cpsecplugins/cpadvancedsecplugin/src/cpsecmoduleinfoview.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -26,9 +26,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include #include @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include diff -r 6b63ca65093a -r aad866c37519 cpsecplugins/cpadvancedsecplugin/src/cpsecmodview.cpp --- a/cpsecplugins/cpadvancedsecplugin/src/cpsecmodview.cpp Thu May 27 13:44:17 2010 +0300 +++ b/cpsecplugins/cpadvancedsecplugin/src/cpsecmodview.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include diff -r 6b63ca65093a -r aad866c37519 cpsecplugins/cpadvancedsecplugin/src/cpsecurityview.cpp --- a/cpsecplugins/cpadvancedsecplugin/src/cpsecurityview.cpp Thu May 27 13:44:17 2010 +0300 +++ b/cpsecplugins/cpadvancedsecplugin/src/cpsecurityview.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -28,9 +28,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include #include diff -r 6b63ca65093a -r aad866c37519 cpsecplugins/devicelockplugin/src/cpdevicelockpluginview.cpp --- a/cpsecplugins/devicelockplugin/src/cpdevicelockpluginview.cpp Thu May 27 13:44:17 2010 +0300 +++ b/cpsecplugins/devicelockplugin/src/cpdevicelockpluginview.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -24,7 +24,7 @@ #include "cpremotelockdataformviewitem.h" #include #include -#include +#include #include #include #include diff -r 6b63ca65093a -r aad866c37519 cpsecplugins/simpincodeplugin/rom/pincodeplugin.iby --- a/cpsecplugins/simpincodeplugin/rom/pincodeplugin.iby Thu May 27 13:44:17 2010 +0300 +++ b/cpsecplugins/simpincodeplugin/rom/pincodeplugin.iby Fri Jun 11 14:28:40 2010 +0300 @@ -21,7 +21,8 @@ #include #include -file=ABI_DIR\BUILD_DIR\pincodeplugin.dll SHARED_LIB_DIR\pincodeplugin.dll +// pincodeplugin.iby should not export pincodeplugin.dll because controlpanelui.iby already exports cppincodeplugin.dll +// file=ABI_DIR\BUILD_DIR\pincodeplugin.dll SHARED_LIB_DIR\pincodeplugin.dll data=/epoc32/data/c/resource/qt/plugins/controlpanel/pincodeplugin.qtplugin resource/qt/plugins/controlpanel/pincodeplugin.qtplugin diff -r 6b63ca65093a -r aad866c37519 layers.sysdef.xml --- a/layers.sysdef.xml Thu May 27 13:44:17 2010 +0300 +++ b/layers.sysdef.xml Fri Jun 11 14:28:40 2010 +0300 @@ -21,7 +21,7 @@ - + diff -r 6b63ca65093a -r aad866c37519 pkiutilities/CTSecurityDialogs/Group/CTSecDialogImpl.mmp --- a/pkiutilities/CTSecurityDialogs/Group/CTSecDialogImpl.mmp Thu May 27 13:44:17 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/Group/CTSecDialogImpl.mmp Fri Jun 11 14:28:40 2010 +0300 @@ -34,6 +34,14 @@ 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 diff -r 6b63ca65093a -r aad866c37519 pkiutilities/CTSecurityDialogs/Group/bld.inf --- a/pkiutilities/CTSecurityDialogs/Group/bld.inf Thu May 27 13:44:17 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/Group/bld.inf Fri Jun 11 14:28:40 2010 +0300 @@ -23,6 +23,7 @@ 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 diff -r 6b63ca65093a -r aad866c37519 pkiutilities/CTSecurityDialogs/NotifSrc/CTInvalidCertNote.cpp --- a/pkiutilities/CTSecurityDialogs/NotifSrc/CTInvalidCertNote.cpp Thu May 27 13:44:17 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/NotifSrc/CTInvalidCertNote.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -16,7 +16,7 @@ */ - +#include #include "CTInvalidCertNote.h" #include "CTCertificateQuery.h" // CCTCertificateQuery #include // CEikServAppUi diff -r 6b63ca65093a -r aad866c37519 pkiutilities/CTSecurityDialogs/NotifSrc/CTNoTrustQuery.cpp --- a/pkiutilities/CTSecurityDialogs/NotifSrc/CTNoTrustQuery.cpp Thu May 27 13:44:17 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/NotifSrc/CTNoTrustQuery.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -19,6 +19,7 @@ // INCLUDE FILES +#include #include "CTNoTrustQuery.h" #include "CTSecurityDialogsAO.h" #include "CTCertificateQuery.h" diff -r 6b63ca65093a -r aad866c37519 pkiutilities/CTSecurityDialogs/NotifSrc/CTPinPinQueryDialog.cpp --- a/pkiutilities/CTSecurityDialogs/NotifSrc/CTPinPinQueryDialog.cpp Thu May 27 13:44:17 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/NotifSrc/CTPinPinQueryDialog.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -17,6 +17,7 @@ // INCLUDE FILES +#include #include "CTPinPinQueryDialog.h" #include #include diff -r 6b63ca65093a -r aad866c37519 pkiutilities/CTSecurityDialogs/NotifSrc/CTQueryDialog.cpp --- a/pkiutilities/CTSecurityDialogs/NotifSrc/CTQueryDialog.cpp Thu May 27 13:44:17 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/NotifSrc/CTQueryDialog.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -19,6 +19,7 @@ // INCLUDE FILES +#include #include "CTQueryDialog.h" #include "CTSecurityDialogsLogger.h" #include diff -r 6b63ca65093a -r aad866c37519 pkiutilities/CTSecurityDialogs/NotifSrc/CTSelectcertificatedialog.cpp --- a/pkiutilities/CTSecurityDialogs/NotifSrc/CTSelectcertificatedialog.cpp Thu May 27 13:44:17 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/NotifSrc/CTSelectcertificatedialog.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -18,6 +18,7 @@ // INCLUDE FILES +#include #include "CTSelectCertificateDialog.h" #include "CTSecurityDialogDefs.h" #include diff -r 6b63ca65093a -r aad866c37519 pkiutilities/CTSecurityDialogs/NotifSrc/CTSigntextdialog.cpp --- a/pkiutilities/CTSecurityDialogs/NotifSrc/CTSigntextdialog.cpp Thu May 27 13:44:17 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/NotifSrc/CTSigntextdialog.cpp Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 pkiutilities/CTSecurityDialogs/NotifSrc/CTpinquerydialog.cpp --- a/pkiutilities/CTSecurityDialogs/NotifSrc/CTpinquerydialog.cpp Thu May 27 13:44:17 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/NotifSrc/CTpinquerydialog.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -18,6 +18,7 @@ // INCLUDE FILES +#include #include "CTPinQueryDialog.h" #include "CTSecurityDialogsLogger.h" #include diff -r 6b63ca65093a -r aad866c37519 pkiutilities/CTSecurityDialogs/ecomsrc/CTSecDlgWrapper.cpp --- a/pkiutilities/CTSecurityDialogs/ecomsrc/CTSecDlgWrapper.cpp Thu May 27 13:44:17 2010 +0300 +++ b/pkiutilities/CTSecurityDialogs/ecomsrc/CTSecDlgWrapper.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -18,6 +18,7 @@ // INCLUDE FILES #include +#include #include // link against aknnotifierwrapper.lib #include #include "CTSecurityDialogDefs.h" diff -r 6b63ca65093a -r aad866c37519 pkiutilities/group/bld.inf --- a/pkiutilities/group/bld.inf Thu May 27 13:44:17 2010 +0300 +++ b/pkiutilities/group/bld.inf Fri Jun 11 14:28:40 2010 +0300 @@ -40,6 +40,7 @@ ../rom/pkcs12.iby CORE_MW_LAYER_IBY_EXPORT_PATH( pkcs12.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/DevToken.iby CORE_MW_LAYER_IBY_EXPORT_PATH( DevToken.iby ) diff -r 6b63ca65093a -r aad866c37519 pkiutilities/ocsp/group/securitysrv_ocsp.mrp --- a/pkiutilities/ocsp/group/securitysrv_ocsp.mrp Thu May 27 13:44:17 2010 +0300 +++ b/pkiutilities/ocsp/group/securitysrv_ocsp.mrp Fri Jun 11 14:28:40 2010 +0300 @@ -1,19 +1,3 @@ -# -# 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: -# - component securitysrv_ocsp source \sf\mw\securitysrv\pkiutilities\ocsp binary \sf\mw\securitysrv\pkiutilities\ocsp\group all diff -r 6b63ca65093a -r aad866c37519 pkiutilities/pkiutilities.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/pkiutilities.pro Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 pkiutilities/untrustedcertificatedialog/inc/untrustedcertificatedefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/inc/untrustedcertificatedefinitions.h Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 pkiutilities/untrustedcertificatedialog/inc/untrustedcertificatedialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/inc/untrustedcertificatedialog.h Fri Jun 11 14:28: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: 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); + +private slots: // new slots + void handleAccepted(); + void handleRejected(); + +private: // new functions + Q_DISABLE_COPY(UntrustedCertificateDialog) + +private: // data + int mLastError; + bool mShowEventReceived; + UntrustedCertificateWidget *mContent; + QVariantMap mResultMap; +}; + +#endif // UNTRUSTEDCERTIFICATEDIALOG_H + diff -r 6b63ca65093a -r aad866c37519 pkiutilities/untrustedcertificatedialog/inc/untrustedcertificateinfo_symbian.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/inc/untrustedcertificateinfo_symbian.h Fri Jun 11 14:28: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: 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 CX509Certificate& aCert); + ~UntrustedCertificateInfoSymbian(); + +public: // from UntrustedCertificateInfoBase + bool commonNameMatches(const QString &siteName) const; + bool isPermanentAcceptAllowed() const; + QString certificateDetails() const; + +private: // new functions + void ConstructL(const CX509Certificate& aCert); + bool CommonNameMatchesL(const QString &siteName) const; + +private: // data + CX509Certificate* iCert; +}; + +#endif // UNTRUSTEDCERTIFICATEINFOSYMBIAN_H diff -r 6b63ca65093a -r aad866c37519 pkiutilities/untrustedcertificatedialog/inc/untrustedcertificateinfobase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/inc/untrustedcertificateinfobase.h Fri Jun 11 14:28:40 2010 +0300 @@ -0,0 +1,95 @@ +/* +* 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 QString formattedFingerprint() const; + virtual const QByteArray serialNumber() const; + virtual const QString formattedSerialNumber() 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 bool isDateValid() const; + +public: // new abstract functions + virtual bool commonNameMatches(const QString &siteName) const = 0; + virtual bool isPermanentAcceptAllowed() const = 0; + virtual QString certificateDetails() 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 6b63ca65093a -r aad866c37519 pkiutilities/untrustedcertificatedialog/inc/untrustedcertificateplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/inc/untrustedcertificateplugin.h Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 pkiutilities/untrustedcertificatedialog/inc/untrustedcertificatewidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/inc/untrustedcertificatewidget.h Fri Jun 11 14:28:40 2010 +0300 @@ -0,0 +1,74 @@ +/* +* 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 isPermanentAcceptChecked() 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 6b63ca65093a -r aad866c37519 pkiutilities/untrustedcertificatedialog/rom/untrustedcertdialog.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/rom/untrustedcertdialog.iby Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 pkiutilities/untrustedcertificatedialog/rom/untrustedcertdialog_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/rom/untrustedcertdialog_resources.iby Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 pkiutilities/untrustedcertificatedialog/src/untrustedcertificatedialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/src/untrustedcertificatedialog.cpp Fri Jun 11 14:28: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: 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 + +const int KNoError = 0; // KErrNone +const int KParameterError = -6; // KErrArgument + + +// ---------------------------------------------------------------------------- +// UntrustedCertificateDialog::UntrustedCertificateDialog() +// ---------------------------------------------------------------------------- +// +UntrustedCertificateDialog::UntrustedCertificateDialog(const QVariantMap ¶meters) : HbDialog(), + mLastError(KNoError), mShowEventReceived(false), mContent(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); + 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) +{ + HbDialog::hideEvent(event); + emit deviceDialogClosed(); +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateDialog::showEvent() +// ---------------------------------------------------------------------------- +// +void UntrustedCertificateDialog::showEvent(QShowEvent *event) +{ + 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) +{ + 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()) { + HbAction *okAction = new HbAction(qtTrId("txt_common_button_ok"), this); + connect(okAction, SIGNAL(triggered()), this, SLOT(handleAccepted())); + addAction(okAction); + + HbAction *cancelAction = new HbAction(qtTrId("txt_common_button_cancel"), this); + connect(cancelAction, SIGNAL(triggered()), this, SLOT(handleRejected())); + addAction(cancelAction); + } else { + HbAction *closeAction = new HbAction(qtTrId("txt_common_button_close"), this); + connect(closeAction, SIGNAL(triggered()), this, SLOT(handleRejected())); + addAction(closeAction); + } + + return true; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateDialog::updateFromParameters() +// ---------------------------------------------------------------------------- +// +bool UntrustedCertificateDialog::updateFromParameters(const QVariantMap ¶meters) +{ + if (!isParametersValid(parameters)) { + return false; + } + + Q_ASSERT(mContent != 0); + mContent->updateFromParameters(parameters); + return true; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateDialog::sendResult() +// ---------------------------------------------------------------------------- +// +void UntrustedCertificateDialog::sendResult(int result) +{ + QVariant resultValue(result); + mResultMap.insert(KUntrustedCertificateDialogResult, resultValue); + emit deviceDialogData(mResultMap); +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateDialog::handleAccepted() +// ---------------------------------------------------------------------------- +// +void UntrustedCertificateDialog::handleAccepted() +{ + if (mContent->isPermanentAcceptChecked()) { + sendResult(KDialogAcceptedPermanently); + } else { + sendResult(KDialogAccepted); + } +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateDialog::handleRejected() +// ---------------------------------------------------------------------------- +// +void UntrustedCertificateDialog::handleRejected() +{ + sendResult(KDialogRejected); +} + diff -r 6b63ca65093a -r aad866c37519 pkiutilities/untrustedcertificatedialog/src/untrustedcertificateinfo_symbian.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/src/untrustedcertificateinfo_symbian.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -0,0 +1,213 @@ +/* +* 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 + + +// ======== 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() +// ---------------------------------------------------------------------------- +// +QDateTime convertDateTime(const TTime& aTime) +{ + const TDateTime &symbianDateTime = aTime.DateTime(); + + QDateTime dateTime; + QDate date(symbianDateTime.Year(), symbianDateTime.Month()+1, symbianDateTime.Day()+1); + QTime time(symbianDateTime.Hour(), symbianDateTime.Minute(), symbianDateTime.Second()); + dateTime.setDate(date); + dateTime.setTime(time); + + return dateTime; +} + + +// ======== MEMBER FUNCTIONS ======== + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoSymbian::UntrustedCertificateInfoSymbian() +// ---------------------------------------------------------------------------- +// +UntrustedCertificateInfoSymbian::UntrustedCertificateInfoSymbian( + const CX509Certificate& aCert) : UntrustedCertificateInfoBase(), iCert(0) +{ + QT_TRAP_THROWING(ConstructL(aCert)); +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoSymbian::~UntrustedCertificateInfoSymbian() +// ---------------------------------------------------------------------------- +// +UntrustedCertificateInfoSymbian::~UntrustedCertificateInfoSymbian() +{ + delete iCert; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoSymbian::commonNameMatches() +// ---------------------------------------------------------------------------- +// +bool UntrustedCertificateInfoSymbian::commonNameMatches(const QString &siteName) const +{ + bool matches = false; + QT_TRAP_THROWING(matches = CommonNameMatchesL(siteName)); + return matches; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoSymbian::isPermanentAcceptAllowed() +// ---------------------------------------------------------------------------- +// +bool UntrustedCertificateInfoSymbian::isPermanentAcceptAllowed() const +{ + return isDateValid(); +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoSymbian::certificateDetails() +// ---------------------------------------------------------------------------- +// +QString UntrustedCertificateInfoSymbian::certificateDetails() const +{ + QString details; + QTextStream stream(&details); + // TODO: localised UI strings needed + stream << tr("Issuer:\n%1\n").arg(issuerName()); + stream << endl; + stream << tr("Subject:\n%1\n").arg(subjectName()); + stream << endl; + stream << tr("Valid from:\n%1\n").arg(validFrom().toString()); + stream << endl; + stream << tr("Valid until:\n%1\n").arg(validTo().toString()); + stream << endl; + stream << tr("Certificate format:\n%1\n").arg(format()); + stream << endl; + stream << tr("Algorithm:\n%1\n").arg(combinedAlgorithmName()); + stream << endl; + stream << tr("Serial number:\n%1\n").arg(formattedSerialNumber()); + stream << endl; + stream << tr("Fingerprint (SHA1):\n%1\n").arg(formattedFingerprint()); + // TODO: MD5 fingerprint missing + return details; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoSymbian::ConstructL() +// ---------------------------------------------------------------------------- +// +void UntrustedCertificateInfoSymbian::ConstructL(const CX509Certificate& aCert) +{ + ASSERT( iCert == 0 ); + iCert = CX509Certificate::NewL( aCert ); + + HBufC16* subjectBuf = iCert->SubjectL(); + mSubjectName = QString::fromUtf16(subjectBuf->Ptr(), subjectBuf->Length()); + delete subjectBuf; + + HBufC16* issuerBuf = iCert->IssuerL(); + mIssuerName = QString::fromUtf16(issuerBuf->Ptr(), issuerBuf->Length()); + delete issuerBuf; + + TPtrC8 fingerprint = iCert->Fingerprint(); + mFingerprint = QByteArray::fromRawData( + reinterpret_cast(fingerprint.Ptr()), fingerprint.Length()); + + TPtrC8 serialNumber = iCert->SerialNumber(); + mSerialNumber = QByteArray::fromRawData( + reinterpret_cast(serialNumber.Ptr()), serialNumber.Length()); + + const CValidityPeriod& validityPeriod = iCert->ValidityPeriod(); + mValidFrom = convertDateTime(validityPeriod.Start()); + mValidTo = convertDateTime(validityPeriod.Finish()); + + mFormat = X509Certificate; + + const CSigningAlgorithmIdentifier& alg = iCert->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 = iCert->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; +} + diff -r 6b63ca65093a -r aad866c37519 pkiutilities/untrustedcertificatedialog/src/untrustedcertificateinfobase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/src/untrustedcertificateinfobase.cpp Fri Jun 11 14:28: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::formattedFingerprint() +// ---------------------------------------------------------------------------- +// +const QString UntrustedCertificateInfoBase::formattedFingerprint() const +{ + QString formatted; + QByteArray fp = fingerprint(); + + QString number; + int blockIndex = 0; + int count = fp.count(); + for (int index = 0; index < count; ++index) { + if (blockIndex == KCharsPerBlock) { + formatted.append(KBlockSeparator); + blockIndex = 0; + } + number.sprintf(KHexNumberFormatTwoDigitsWithLeadingZeroes, + static_cast(fp.at(index))); + formatted.append(number); + ++blockIndex; + } + + return formatted; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoBase::serialNumber() +// ---------------------------------------------------------------------------- +// +const QByteArray UntrustedCertificateInfoBase::serialNumber() const +{ + return mSerialNumber; +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateInfoBase::formattedSerialNumber() +// ---------------------------------------------------------------------------- +// +const QString UntrustedCertificateInfoBase::formattedSerialNumber() const +{ + QString formatted; + QByteArray sn = serialNumber(); + + QString number; + int count = sn.count(); + for (int index = 0; index < count; ++index) { + number.sprintf(KHexNumberFormatSimple, + static_cast(sn.at(index))); + formatted.append(number); + } + + return formatted; +} + +// ---------------------------------------------------------------------------- +// 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("X509"); + 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::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 6b63ca65093a -r aad866c37519 pkiutilities/untrustedcertificatedialog/src/untrustedcertificateplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/src/untrustedcertificateplugin.cpp Fri Jun 11 14:28: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 = DeviceNotificationDialogGroup; // TODO: SecurityGroup ? + 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 6b63ca65093a -r aad866c37519 pkiutilities/untrustedcertificatedialog/src/untrustedcertificatewidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/src/untrustedcertificatewidget.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -0,0 +1,147 @@ +/* +* 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 +#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 (mIsSavingServerNamePossible && mCertificateInfo->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; + QTextStream stream(&certificateDetails); + // TODO: localized UI string needed + stream << tr("Service:\n%1\n").arg(mServerName); + stream << endl; + stream << mCertificateInfo->certificateDetails(); + mCertificateDetailsText->setPlainText(certificateDetails); + mCertificateDetailsText->setReadOnly(true); + + mCertificateDetailsGroupBox->setContentWidget(mCertificateDetailsText); + mMainLayout->addItem(mCertificateDetailsGroupBox); + + setLayout(mMainLayout); + } + +// ---------------------------------------------------------------------------- +// UntrustedCertificateWidget::updateFromParameters() +// ---------------------------------------------------------------------------- +// +void UntrustedCertificateWidget::updateFromParameters( + const QVariantMap ¶meters) +{ + processParameters(parameters); +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateWidget::isPermanentAcceptChecked() +// ---------------------------------------------------------------------------- +// +bool UntrustedCertificateWidget::isPermanentAcceptChecked() const +{ + if (mAcceptPermanently) { + return (mAcceptPermanently->checkState() == Qt::Checked); + } + return false; +} + +// ---------------------------------------------------------------------------- +// 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 6b63ca65093a -r aad866c37519 pkiutilities/untrustedcertificatedialog/src/untrustedcertificatewidget_symbian.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/src/untrustedcertificatewidget_symbian.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -0,0 +1,114 @@ +/* +* 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 // CX509Certificate + + +// ======== LOCAL FUNCTIONS ======== + +// ---------------------------------------------------------------------------- +// DoProcessEncodedCertificateL() +// ---------------------------------------------------------------------------- +// +UntrustedCertificateInfoBase* DoProcessEncodedCertificateL( const QByteArray &encodedCert ) +{ + TPtrC8 ptr8( reinterpret_cast(encodedCert.constData()), encodedCert.length()); + CX509Certificate* cert = CX509Certificate::NewLC( ptr8 ); + + UntrustedCertificateInfoSymbian *info = 0; + info = new UntrustedCertificateInfoSymbian(*cert); + CleanupStack::PopAndDestroy( cert ); + + return info; +} + + +// ======== MEMBER FUNCTIONS ======== + +// ---------------------------------------------------------------------------- +// UntrustedCertificateWidget::isInvalidCertificate() +// ---------------------------------------------------------------------------- +// +bool UntrustedCertificateWidget::isCertificateValid() +{ + return (mValidationError != ESignatureInvalid && mValidationError != ECertificateRevoked); +} + +// ---------------------------------------------------------------------------- +// UntrustedCertificateWidget::processEncodedCertificate() +// ---------------------------------------------------------------------------- +// +void UntrustedCertificateWidget::processEncodedCertificate(const QByteArray &encodedCert) +{ + UntrustedCertificateInfoBase *info = 0; + QT_TRAP_THROWING(info = DoProcessEncodedCertificateL(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 6b63ca65093a -r aad866c37519 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 Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 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 Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/dialoglauncher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/dialoglauncher.cpp Fri Jun 11 14:28: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 RootDir = "c:/"; + + +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(RootDir); + 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.name.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(RootDir); + 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 6b63ca65093a -r aad866c37519 pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/dialoglauncher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/dialoglauncher.h Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/dialoglauncher.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/dialoglauncher.pro Fri Jun 11 14:28: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: 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 +} + diff -r 6b63ca65093a -r aad866c37519 pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/dialoglaunchermain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/tsrc/dialoglauncher/dialoglaunchermain.cpp Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 pkiutilities/untrustedcertificatedialog/untrustedcertificateplugin.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkiutilities/untrustedcertificatedialog/untrustedcertificateplugin.pro Fri Jun 11 14:28: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 + + 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 6b63ca65093a -r aad866c37519 secsrv_plat/security_code_ui_api/inc/SecUi.h --- a/secsrv_plat/security_code_ui_api/inc/SecUi.h Thu May 27 13:44:17 2010 +0300 +++ b/secsrv_plat/security_code_ui_api/inc/SecUi.h Fri Jun 11 14:28:40 2010 +0300 @@ -21,6 +21,12 @@ #ifndef __SECUI_H #define __SECUI_H +#if defined(__SECUI_H) +#define RDEBUG( x, y ) RDebug::Printf( "%s %s (%u) %s=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, x, y ); +#else +#define RDEBUG( x, y ) +#endif + class TSecUi { public: @@ -36,12 +42,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 +75,7 @@ private: TInt iResourceFileOffset; TInt iClientCount; + TInt iDialogOpened; }; #endif diff -r 6b63ca65093a -r aad866c37519 secsrv_plat/security_code_ui_api/inc/SecUiCodeQueryDialog.h --- a/secsrv_plat/security_code_ui_api/inc/SecUiCodeQueryDialog.h Thu May 27 13:44:17 2010 +0300 +++ b/secsrv_plat/security_code_ui_api/inc/SecUiCodeQueryDialog.h Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/Autolock.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/Autolock.loc Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/Autolock.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/Autolock.pro Fri Jun 11 14:28:40 2010 +0300 @@ -0,0 +1,58 @@ +# +# 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 + +XQSERVICE_ROOT=../.. +include(../../xqservicebase.pri) +include(src/Autolock.pri) + +LIBS+=-lxqservice -lxqserviceutil -lflogger +LIBS += -L../../../../../bin/release -lautolockuseractivityservice +LIBS += -lsecui -letelmm -letel -lcustomapi -lcentralrepository + +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 += "./rom/AutolockSrv.iby CORE_APP_LAYER_IBY_EXPORT_PATH(AutolockSrv.iby)" +BLD_INF_RULES.prj_exports += "./PubSub/SecurityUIsPrivatePSKeys.h |../../inc/securityuisprivatepskeys.h" diff -r 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/Autolock.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/Autolock.qrc Fri Jun 11 14:28:40 2010 +0300 @@ -0,0 +1,6 @@ + + + iconnotifier.svg + qtg_large_device_lock.svg + + diff -r 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/Autolock.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/Autolock.rss Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/Autolock_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/Autolock_reg.rss Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/Autolock_reg.rss.back --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/Autolock_reg.rss.back Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/Autolock_template.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/Autolock_template.pkg Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/CenRep/AutolockPrivateCRKeys.h --- a/securitydialogs/Autolock/CenRep/AutolockPrivateCRKeys.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/Keyguard_enabled.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/Keyguard_enabled.svg Fri Jun 11 14:28:40 2010 +0300 @@ -0,0 +1,1949 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/aif/Autolockaif.rss --- a/securitydialogs/Autolock/aif/Autolockaif.rss Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/autolock.qcrml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolock.qcrml Fri Jun 11 14:28:40 2010 +0300 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff -r 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/autolockuseractivityservice.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice.pro Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/autolockuseractivityservice/autolockuseractivityservice.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/autolockuseractivityservice.pri Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/autolockuseractivityservice/autolockuseractivityservice.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/autolockuseractivityservice.pro Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/autolockuseractivityservice/autolockuseractivityservice_s60.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/autolockuseractivityservice_s60.pri Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/autolockuseractivityservice/autolockuseractivityservice_stub.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/autolockuseractivityservice_stub.pri Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/autolockuseractivityservice/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/bld.inf Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/autolockuseractivityservice/common.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/common.pri Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/autolockuseractivityservice/inc/autolockuseractivityservice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/inc/autolockuseractivityservice.h Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 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 Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/autolockuseractivityservice/inc/autolockuseractivityserviceinterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/inc/autolockuseractivityserviceinterface.h Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 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 Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 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 Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/autolockuseractivityservice/src/autolockuseractivityservice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/autolockuseractivityservice/src/autolockuseractivityservice.cpp Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 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 Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 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 Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/bld.inf Fri Jun 11 14:28:40 2010 +0300 @@ -0,0 +1,58 @@ +// ============================================================================ +// * Makefile for building: Autolock +// * Generated by qmake (2.01a) (Qt 4.6.3) on: 2010-05-24T09:03:29 +// * This file is generated by qmake and should not be modified by the +// * user. +// * Project: Autolock.pro +// * Template: app +// ============================================================================ + +#define BLD_INF_AUTOLOCK_04D5822F + + +prj_platforms + +WINSCW GCCE ARMV5 ARMV6 + + +prj_mmpfiles + +Autolock_0x100059B5.mmp + +prj_extensions + +START EXTENSION qt/qmake_extra_pre_targetdep.export +OPTION PREDEP_TARGET E:/sf/mw/securitysrv/securitydialogs/Autolock/moc_Autolock.cpp +OPTION DEPS E:/sf/mw/securitysrv/securitydialogs/SecUi/Inc/SecQueryUi.h E:/sf/mw/securitysrv/securitydialogs/Autolock/src/Autolock.h +OPTION COMMAND /epoc32/tools/moc -DSYMBIAN -DUNICODE -DQT_KEYPAD_NAVIGATION -DQT_SOFTKEYS_ENABLED -DQT_USE_MATH_H_FLOATS -DHB_GESTURE_FW -DHB_EFFECTS -DHB_TEXT_MEASUREMENT_UTILITY -DQT_SVG_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I"E:/epoc32/include/mw/QtCore" -I"E:/epoc32/include/mw/QtNetwork" -I"E:/epoc32/include/mw/QtGui" -I"E:/epoc32/include/mw/QtSvg" -I"E:/epoc32/include/mw" -I"E:/epoc32/include/mw/QtPublishSubscribe" -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" -I"E:/sf/mw/securitysrv/securitydialogs/Autolock/inc" -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/platform/loc" -I"E:/epoc32/include/platform/mw/loc" -I"E:/epoc32/include/platform/loc/sc" -I"E:/epoc32/include/platform/mw/loc/sc" -I"E:/epoc32/include/mw/hb/hbcore" -I"E:/epoc32/include/mw/hb/hbwidgets" -I"E:/epoc32/include/mw/hb/hbutils" -I"E:/epoc32/include/stdapis/stlportv5" -I"E:/epoc32/include/app" -I"E:/epoc32/include/platform/app" -I"E:/epoc32/include/platform/app/loc" -I"E:/epoc32/include/platform/app/loc/sc" -I"E:/sf/mw/securitysrv/securitydialogs/Autolock/src" -DSYMBIAN e:/sf/mw/securitysrv/securitydialogs/Autolock/src/Autolock.h -o e:/sf/mw/securitysrv/securitydialogs/Autolock/moc_Autolock.cpp +END +START EXTENSION qt/qmake_extra_pre_targetdep.export +OPTION PREDEP_TARGET E:/sf/mw/securitysrv/securitydialogs/Autolock/qrc_Autolock.cpp +OPTION DEPS E:/sf/mw/securitysrv/securitydialogs/Autolock/Autolock.qrc +OPTION COMMAND /epoc32/tools/rcc -name Autolock e:/sf/mw/securitysrv/securitydialogs/Autolock/Autolock.qrc -o e:/sf/mw/securitysrv/securitydialogs/Autolock/qrc_Autolock.cpp +END + +#if defined(WINSCW) +START EXTENSION qt/qmake_emulator_deployment +OPTION DEPLOY_SOURCE e:/sf/mw/securitysrv/securitydialogs/Autolock/autolock.qcrml +OPTION DEPLOY_TARGET E:/epoc32/winscw/c/resource/qt/crml/autolock.qcrml +END +#endif +START EXTENSION qt/qmake_emulator_deployment +OPTION DEPLOY_SOURCE e:/sf/mw/securitysrv/securitydialogs/Autolock/autolock.qcrml +OPTION DEPLOY_TARGET E:/epoc32/data/z/resource/qt/crml/autolock.qcrml +END + +START EXTENSION qt/qmake_store_build +END + + +START EXTENSION qt/qtextensions_pre_targetdep.export +OPTION PREDEP_TARGET Autolock_reg.rss +OPTION COMMAND xqsreg.exe Autolock 0x100059B5 service_conf.xml Autolock_reg.rss embeddable hidden +END + + +prj_exports + +./rom/Autolock.iby CORE_APP_LAYER_IBY_EXPORT_PATH(Autolock.iby) diff -r 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/bwins/autolockuseractivityserviceu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/bwins/autolockuseractivityserviceu.def Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/conf/autolock.confml Binary file securitydialogs/Autolock/conf/autolock.confml has changed diff -r 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/conf/autolock_102824AE.crml Binary file securitydialogs/Autolock/conf/autolock_102824AE.crml has changed diff -r 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/conf/lock.confml Binary file securitydialogs/Autolock/conf/lock.confml has changed diff -r 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/conf/lock_10283322.crml Binary file securitydialogs/Autolock/conf/lock_10283322.crml has changed diff -r 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/data/Autolock.rss --- a/securitydialogs/Autolock/data/Autolock.rss Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/data/Autolock_reg.rss --- a/securitydialogs/Autolock/data/Autolock_reg.rss Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/eabi/autolockuseractivityserviceu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/eabi/autolockuseractivityserviceu.def Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/group/Autolock.mmp --- a/securitydialogs/Autolock/group/Autolock.mmp Thu May 27 13:44:17 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 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 secui.lib - - -SMPSAFE diff -r 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/group/Autolock_Icons_dc.mk --- a/securitydialogs/Autolock/group/Autolock_Icons_dc.mk Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/group/bld.inf --- a/securitydialogs/Autolock/group/bld.inf Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/iconnotifier.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/iconnotifier.svg Fri Jun 11 14:28:40 2010 +0300 @@ -0,0 +1,260 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff -r 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/inc/AutoKeyguardCenRepI.h --- a/securitydialogs/Autolock/inc/AutoKeyguardCenRepI.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/inc/AutoKeyguardObserver.h --- a/securitydialogs/Autolock/inc/AutoKeyguardObserver.h Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +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 CAutoKeyguardObserver : public CBase - { - public: - /** - * Creates instance of the CAutoKeyguardObserver class. - * - * @return Returns the instance just created. - */ - static CAutoKeyguardObserver* NewL(); - /** - * 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(); - 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; - }; -#endif -// END OF FILE diff -r 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/inc/AutoLockCenRepI.h --- a/securitydialogs/Autolock/inc/AutoLockCenRepI.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/inc/AutoLockLockObserverPS.h --- a/securitydialogs/Autolock/inc/AutoLockLockObserverPS.h Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +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; - RTelServer iServer; // EMKK-7N3G7R - CWait* wait; // EMKK-7N3G7R - }; - -#endif -// End of file diff -r 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/inc/AutoLockModelPS.h --- a/securitydialogs/Autolock/inc/AutoLockModelPS.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/inc/AutoLockValueObserverPS.h --- a/securitydialogs/Autolock/inc/AutoLockValueObserverPS.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/inc/AutolockApp.h --- a/securitydialogs/Autolock/inc/AutolockApp.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/inc/AutolockAppUiPS.h --- a/securitydialogs/Autolock/inc/AutolockAppUiPS.h Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,268 +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" - -// 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 MAutolockGripStatusObserver, - public MAutolockFpsStatusObserver - { - public: // // Constructors and destructor - - /** - * Symbian OS default constructor. - */ - void ConstructL(); - - /** - * Destructor. - */ - ~CAutolockAppUi(); - - /** - * From MAutolockGripStatusObserver - */ - TBool DeviceLockQueryStatus(); - - TBool DeviceLockStatus(); - - /** - * 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; - }; - - inline CAutoLockModel* CAutolockAppUi::Model() const - {return iModel;} - -#endif - -// End of File diff -r 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/inc/AutolockContainer.h --- a/securitydialogs/Autolock/inc/AutolockContainer.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/inc/AutolockDocument.h --- a/securitydialogs/Autolock/inc/AutolockDocument.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/inc/AutolockFpsStatusObserver.h --- a/securitydialogs/Autolock/inc/AutolockFpsStatusObserver.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/inc/AutolockGripStatusObserver.h --- a/securitydialogs/Autolock/inc/AutolockGripStatusObserver.h Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +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 - -//CONSTANTS -const TInt KCancelKeyCode( 165 ); - -class MAutolockGripStatusObserver - { - public: - /** - * Implement this method to be notified when grip status - * changes. - */ - IMPORT_C virtual TInt DeviceLockQueryStatus() = 0; - IMPORT_C virtual TInt DeviceLockStatus() = 0; - }; - -class CAutolockGripStatusObserver : public CActive - { - public: - IMPORT_C static CAutolockGripStatusObserver* NewL( MAutolockGripStatusObserver* aObserver, RWsSession& aSession ); - - void RunL(); - void DoCancel(); - ~CAutolockGripStatusObserver(); - - private: - void ConstructL( MAutolockGripStatusObserver* aObserver ); - CAutolockGripStatusObserver( RWsSession& aSession ); - void GripStatusChangedL( TInt aGripStatus ); - - private: - MAutolockGripStatusObserver* iObserver; - RProperty iGripStatus; - RWsSession& iSession; - }; - - -#endif diff -r 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/inc/AutolockView.h --- a/securitydialogs/Autolock/inc/AutolockView.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/inc/AutolockWait.h --- a/securitydialogs/Autolock/inc/AutolockWait.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/inc/autolock.hrh --- a/securitydialogs/Autolock/inc/autolock.hrh Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/indicatorplugin/qmakepluginstubs/indicatorautolockplugin.qtplugin --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/indicatorplugin/qmakepluginstubs/indicatorautolockplugin.qtplugin Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/indicatorplugin/rom/indicatorautolockplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/indicatorplugin/rom/indicatorautolockplugin.iby Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/loc/autolock.loc --- a/securitydialogs/Autolock/loc/autolock.loc Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 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 Fri Jun 11 14:28:40 2010 +0300 @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 6b63ca65093a -r aad866c37519 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 Fri Jun 11 14:28:40 2010 +0300 @@ -0,0 +1,1949 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/resources/iconnotifier.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/resources/iconnotifier.svg Fri Jun 11 14:28:40 2010 +0300 @@ -0,0 +1,260 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff -r 6b63ca65093a -r aad866c37519 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 Fri Jun 11 14:28:40 2010 +0300 @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/rom/Autolock.iby --- a/securitydialogs/Autolock/rom/Autolock.iby Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/Autolock/rom/Autolock.iby Fri Jun 11 14:28: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_RESOURCE(Autolock) -#endif +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 + +// 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=ZPRIVATE\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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/rom/AutolockResources.iby --- a/securitydialogs/Autolock/rom/AutolockResources.iby Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/rom/AutolockSrv.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/rom/AutolockSrv.iby Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/service_conf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/service_conf.xml Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/service_conf_new.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/service_conf_new.xml Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 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 Fri Jun 11 14:28:40 2010 +0300 @@ -0,0 +1,7 @@ + + + Autolock + + Dial interface + + \ No newline at end of file diff -r 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/src/AutoKeyGuardCenRepI.cpp --- a/securitydialogs/Autolock/src/AutoKeyGuardCenRepI.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/src/AutoKeyguardObserver.cpp --- a/securitydialogs/Autolock/src/AutoKeyguardObserver.cpp Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,441 +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" - -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() - { - #ifdef RD_AUTO_KEYGUARD - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::NewL() BEGIN")); - #endif - CAutoKeyguardObserver* self = new (ELeave) CAutoKeyguardObserver(); - 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() - { - } - -// -// ---------------------------------------------------------- -// 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; - //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; - /* This is not used any more because screensavers are removed now - RProperty::Get(KPSUidScreenSaver, KScreenSaverOn, value); - screenSaverOn = (value == KSsOn); - */ - screenSaverOn = ETrue; - - /* This is not used any more because screensavers are removed now - value = 0; - RProperty::Get(KPSUidScreenSaver, KScreenSaverActivatedFromIdle, value); - screenSaverStertedFromIdle = (value == KSsStartedFromIdle); - */ - screenSaverStertedFromIdle = ETrue; - - //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 - if (startupOver) - { - // 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/src/AutoLockCenRepI.cpp --- a/securitydialogs/Autolock/src/AutoLockCenRepI.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/src/AutoLockLockObserver.cpp --- a/securitydialogs/Autolock/src/AutoLockLockObserver.cpp Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,145 +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 // EMKK-7N3G7R -#include // EMKK-7N3G7R -#include // EMKK-7N3G7R -#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(); -#ifdef FF_STARTUP_OMA_DM_SUPPORT // New booting order Start EMKK-7N3G7R - delete wait; - if (iServer.Handle()) - { - iServer.UnloadPhoneModule(KMmTsyModuleName); - iServer.Close(); - } -#endif // End EMKK-7N3G7R - } -// -// ---------------------------------------------------------- -// 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/src/AutoLockModel.cpp --- a/securitydialogs/Autolock/src/AutoLockModel.cpp Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,445 +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 == EAutolockStatusUninitialized ) - { - RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockStatusUninitialized); - } - else - { - RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOff); - } - - #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; -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; - 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(); - // 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 - 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/src/AutoLockValueObserver.cpp --- a/securitydialogs/Autolock/src/AutoLockValueObserver.cpp Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +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" - - -// ================= 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(); - return KErrNone; - } -// -// ---------------------------------------------------------- -// CValueObserver::Stop() -// Stops listening KUidCurrentCall event -// ---------------------------------------------------------- -// -void CValueObserver::Stop() - { - Cancel(); - } -// -// ---------------------------------------------------------- -// CLockObserver::CLockObserver() -// C++ constructor -// ---------------------------------------------------------- -// -CValueObserver::CValueObserver(CAutolockAppUi* aAppUi) : CActive(0), iAppUi(aAppUi) - { - } -// -// ---------------------------------------------------------- -// CLockObserver::ConstructL() -// Symbian OS default constructor -// ---------------------------------------------------------- -// -void CValueObserver::ConstructL() - { - // Add this active object to the scheduler. - CActiveScheduler::Add(this); - } -// -// ---------------------------------------------------------- -// CValueObserver::RunL() -// -// ---------------------------------------------------------- -// -void CValueObserver::RunL() - { - TInt callState; - iProperty.Get( callState ); - if (callState == EPSCTsyCallStateNone && !iAppUi->IsForeground()) - { - // app back to foreground - iAppUi->BringAppToForegroundL(); - } - else - { - Start(); - } - - } -// -// ---------------------------------------------------------- -// CValueObserver::DoCancel() -// Cancels event listening -// ---------------------------------------------------------- -// -void CValueObserver::DoCancel() - { - iProperty.Cancel(); - } - -// End of file diff -r 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/src/AutoLockView.cpp --- a/securitydialogs/Autolock/src/AutoLockView.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/src/Autolock.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/src/Autolock.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -0,0 +1,1451 @@ +/* +* 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QTM_USE_NAMESPACE + +#include +#include + +#include + +#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 "../PubSub/securityuisprivatepskeys.h" +#include +#include + +#include + +const TInt KPhoneIndex(0); +const TInt KTriesToConnectServer(2); +const TInt KTimeBeforeRetryingServerConnection(50000); + +#define ESecUiTypeLock 0x00100000 + +_LIT( KMmTsyModuleName, "PhoneTsy"); + +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; + 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, readPolicy, + 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; + + 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())); + + // 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())); + + + // 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); + // TODO if I want to release, I should do: mKeyCaptureHandle = env->RootWin().CaptureKey(EKeyBackspace, 0, 0); + groupWin.CaptureKey(EKeyBackspace, 0, 0); + groupWin.CaptureKey(EKeyDeviceF, 0, 0); + groupWin.CaptureKey(EKeyBell, 0, 0); + groupWin.CaptureKey(EKeyTab, 0, 0); + groupWin.CaptureKey(EKeyInsert, 0, 0); + RDEBUG("got mKeyCaptureHandle", 1); + + iSecQueryUiCreated = -1; + iDeviceDialogCreated = -1; + // TODO for now, always starts unlocked + // TryChangeStatus(iLockStatus); + TryChangeStatus( ELockNotActive); + lower(); + hide(); + // not needed: new AutolockService(this); + } + +Autolock::~Autolock() + { + RDEBUG("0", 0); + delete mService; + } + +void Autolock::adjustInactivityTimers(int aReason) + { + RDEBUG("aReason", aReason); + TInt keyguardTime = 0; + TInt lockTime = 0; + CRepository* repository = NULL; + TInt cRresult = 0; + + 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); + 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); + QT_TRAP_THROWING( validCode = handler->AskSecCodeInAutoLockL() ); // this returns true/false + // 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 ); + */ + } + // TODO this doesn't wait on WINS , so how do I get the Acceptation? + 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 for activated on top of a PIN query, in particular at boot-up (TODO 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 (1 == 0) // !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 (secUiOriginatedQuery + != ESecurityUIsSecUIOriginatedUninitialized + && secUiOriginatedQuery + != ESecurityUIsSystemLockOriginated) + { + // PIN on top and trying to display unlock-code. This is valid + } + 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: + return KErrPermissionDenied; + } + } + break; + default: + { + RDEBUG("default iLockStatus", iLockStatus); + return KErrPermissionDenied; + } + // break; + } // switch + return KErrPermissionDenied; + } + +int Autolock::publishStatus(int aReason) + { + RDEBUG("aReason", aReason); + TInt 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; + 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); + // lights are required ? + + // 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); + + if (aReason == ELockNotActive) + { + if (iShowKeyguardNote == 1) + { + HbDeviceMessageBox::information("Keyguard deactivated"); + } + } + else if (aReason == EKeyguardActive) + { + if (iShowKeyguardNote == 1) + { + HbDeviceMessageBox::information("Keyguard activated"); + } + } + 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); + + TInt err = RProperty::Set(KPSUidSecurityUIs, + KSecurityUIsDismissDialog, + ESecurityUIsDismissDialogOn); + RDEBUG("err", err); + switch (ret) + { + case ELockAppEnableKeyguard: // 1 + { + errorInProcess = CheckIfLegal(ret); + DebugError(errorInProcess); + if (errorInProcess == KErrNone) + { + setLabelIcon( EKeyguardActive); + updateIndicator(EKeyguardActive); + publishStatus(EKeyguardActive); + showNoteIfRequested(EKeyguardActive); + } + } + break; + case ELockAppDisableKeyguard: // 2 + { + errorInProcess = CheckIfLegal(ret); + DebugError(errorInProcess); + if (errorInProcess == KErrNone) + { + setLabelIcon( ELockNotActive); + updateIndicator(ELockNotActive); + publishStatus(ELockNotActive); + showNoteIfRequested(ELockNotActive); + } + } + 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. + RDEBUG("calling HbDeviceMessageBox::question", 0); + bool value = 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); + publishStatus(ELockNotActive); + } + if (errorInProcess != KErrNone) + { // re-lock. For example, if password is wrong + if( iLockStatus >=EDevicelockActive) // this skips the case "unlocking although it wan't locked" + setLockDialog(aReason, 1); + } + // this never shows a note + } + break; + case ELockAppOfferKeyguard: // 5 + { + errorInProcess = CheckIfLegal(ret); + DebugError(errorInProcess); + if (errorInProcess == KErrNone) + { + bool value = HbDeviceMessageBox::question("Enable Keyguard?"); // this doesn't block other events, so after return everything might be messed up. + // TODO 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); + + if (status == 0) // hide + { + // secUiOriginatedQuery should be ESecurityUIsSystemLockOriginated . If not, this is not correctly setting it + if (iDeviceDialogCreated > 0) + { + iDeviceDialogCreated = 0; + iDeviceDialog->cancel(); + err = iDeviceDialog->error(); + RDEBUG("err", err); + TInt err = RProperty::Set(KPSUidSecurityUIs, + KSecurityUIsSecUIOriginatedQuery, + ESecurityUIsSecUIOriginatedUninitialized); + RDEBUG("err", err); + } + } + else if (status == 1) // show + { + // 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 == EKeyguardActive) + params.insert("type", ESecUiTypeKeyguard); + else if (aReason >= EDevicelockActive) + 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 <= 0) + { + RDEBUG("creating iDeviceDialog", 0); + iDeviceDialog = new HbDeviceDialog(HbDeviceDialog::NoFlags, this); + iDeviceDialogCreated = 1; + } + else + { + RDEBUG("raising iDeviceDialog", 0); + // confirm that dialog is present + err = iDeviceDialog->error(); + RDEBUG("err", err); + iDeviceDialogCreated = 2; + } + const QString KSecQueryUiDeviceDialog("com.nokia.secuinotificationdialog/1.0"); + RDEBUG("pre show", aReason); + 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); // TODO this should be ESecurityUIsSystemLockOriginated ? + RDEBUG("err", err); + + } + else + { + RDEBUG("unknown status", status); + return KErrNotSupported; + } + return KErrNone; + } +void Autolock::setLabelIcon(int aReason) + { + RDEBUG("aReason", aReason); + + if (aReason == ELockNotActive) + { + setLockDialog(aReason, 0); // TODO isn't this done already at TryChangeStatus ??? + lower(); + hide(); + } + else if (aReason == EKeyguardActive) + { + setLockDialog(aReason, 1); + // 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 + { + ret = TryChangeStatus(ELockAppEnableKeyguard); + } + 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; + DebugStatus( iLockStatus); + if (iLockStatus == ELockNotActive || iLockStatus == EKeyguardActive) // not possible if it's locked + { + ret = TryChangeStatus(ELockAppEnableDevicelock); + } + RDEBUG("ret", ret); + + } + +// some key is pressed +bool Autolock::event(QEvent *ev) + { + if (ev) + { + int isSwitchKey = 0; + // on device, this doesn't seem to get the EKeyDeviceF key: only 1ffffff + if (ev->type() == QEvent::KeyPress) + { + QKeyEvent *keyEvent = static_cast (ev); + RDEBUG("KeyPress", keyEvent->key()); + RDEBUG("KeyPress nativeScanCode", keyEvent->nativeScanCode()); + RDEBUG("EStdKeyDeviceF", EStdKeyDeviceF); + RDEBUG("keyEvent->isAutoRepeat()", keyEvent->isAutoRepeat()); + if( !keyEvent->isAutoRepeat() ) + { + if ((keyEvent->key() & 0xFF) == (EKeyInsert & 0xFF)) + { + RDEBUG("EKeyInsert", EKeyInsert); + // only reacts on release, not on press + isSwitchKey = 1; + } + if ((keyEvent->key() & 0xFF) == (EKeyDeviceF & 0xFF)) + { + RDEBUG("EKeyDeviceF", EKeyDeviceF); + } + if (keyEvent->key() == 0x1ffffff) + { + RDEBUG("0x1ffffff", 0x1ffffff); // som unknown key is received. Nothing to do + } + if (keyEvent->nativeScanCode() == EStdKeyDeviceF) + { + RDEBUG("got EStdKeyDeviceF", EStdKeyDeviceF); + isSwitchKey = 1; + } + } + 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) + { + int ret = KErrNone; + DebugStatus( iLockStatus); + if (iLockStatus == ELockNotActive) + { + iShowKeyguardNote = 1; // note on enable keyguard + ret = TryChangeStatus(ELockAppEnableKeyguard); // this should not ask confirmation + } + else if (iLockStatus == EKeyguardActive) + { + iShowKeyguardNote = 1; // note on disable keyguard + ret = TryChangeStatus(ELockAppDisableKeyguard); + } + else if (iLockStatus == EDevicelockActive) + { + ret = TryChangeStatus(ELockAppDisableDevicelock); + } + else + { + RDEBUG("unknown iLockStatus", iLockStatus); + } + RDEBUG("ret", ret); + } // isSwitchKey + } // ev + // Process if not done before. For example, redraw or quit + return QWidget::event(ev); + } + +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; + 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 = 1; // note on disable keyguard + ret = TryChangeStatus(ELockAppDisableKeyguard); + } + else if (iLockStatus == EDevicelockActive) + { + ret = TryChangeStatus(ELockAppDisableDevicelock); + } + } + else if( aGripStatus == EPSHWRMGripClosed ) + { + if (iLockStatus == ELockNotActive) + { + iShowKeyguardNote = 1; // note on enable keyguard + ret = TryChangeStatus(ELockAppEnableKeyguard); + } + } + } + +// ----------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); + 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/src/Autolock.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/src/Autolock.h Fri Jun 11 14:28:40 2010 +0300 @@ -0,0 +1,215 @@ +/* +* 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 + +#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 + }; + + +class AutolockService; + +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(); + +private slots: + void activeKeyguard(); + void notActiveKeyguard(); + void activeDevicelock(); + void notActiveDevicelock(); + +private: + AutolockService* mService; + // int mKeyCode; + // int mKeyCaptureHandle; + QValueSpaceSubscriber *subscriberKSettingsAutolockStatus; + QValueSpaceSubscriber *subscriberKSettingsAutoLockTime; + QValueSpaceSubscriber *subscriberKSettingsAutomaticKeyguardTime; + QValueSpaceSubscriber *subscriberKDisplayLightsTimeout; + QValueSpaceSubscriber *subscriberKProEngActiveProfile; + QValueSpaceSubscriber *subscriberKAknKeyguardStatus; + QValueSpaceSubscriber *subscriberKCoreAppUIsAutolockStatus; + QValueSpaceSubscriber *subscriberKHWRMGripStatus; + + AutolockUserActivityService* serviceKeyguard; + AutolockUserActivityService* serviceDevicelock; + + int iLockStatus; + int iLockStatusPrev; + CSecQueryUi *iSecQueryUi; + int iSecQueryUiCreated; + HbDeviceDialog *iDeviceDialog; + int iDeviceDialogCreated; +}; + +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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/src/Autolock.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/src/Autolock.pri Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/src/AutolockApp.cpp --- a/securitydialogs/Autolock/src/AutolockApp.cpp Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +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 -#include -#include -#include -#include - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CAutolockApp::AppDllUid() -// Returns application UID -// --------------------------------------------------------- -// -TUid CAutolockApp::AppDllUid() const - { - return KUidAutolock; - } - -// --------------------------------------------------------- -// CAutolockApp::CreateDocumentL() -// Creates CAutolockDocument object -// --------------------------------------------------------- -// -CApaDocument* CAutolockApp::CreateDocumentL() - { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - return CAutolockDocument::NewL( *this ); - } - -// ================= OTHER EXPORTED FUNCTIONS ============== -// - -LOCAL_C CApaApplication* NewApplication() - { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - - TInt use_old_autolock=1; - if(use_old_autolock) - { - // start autolocksrv instead of autolock . This is a backup solution to use in case that not all SysAp and Avkon changes are implemented - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x1 ); - CCoeEnv *env = CCoeEnv::Static(); - TApaTaskList taskList( env->WsSession() ); - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - const TUid KAutolockSrvAppUid = { 0xE0022E73 }; - TApaTask task( taskList.FindApp( KAutolockSrvAppUid ) ); - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - if ( !task.Exists() ) - { - RDebug::Printf( "%s %s (%u) no KAutolockSrvAppUid found. Creating=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - RApaLsSession ls; - User::LeaveIfError(ls.Connect()); - CleanupClosePushL(ls); - - CApaCommandLine* commandLine = CApaCommandLine::NewLC(); - commandLine->SetExecutableNameL( _L("autolocksrv.exe" ) ); - commandLine->SetCommandL( EApaCommandRun ); - - // Try to launch the application. - User::LeaveIfError(ls.StartApp(*commandLine)); - RDebug::Printf( "%s %s (%u) autolocksrv.exe created=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x7 ); - - CleanupStack::PopAndDestroy(2); // commandLine, ls - } - } - RDebug::Printf( "%s %s (%u) exiting=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x1 ); - return new CAutolockApp; - } - -GLDEF_C TInt E32Main() - { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - - return EikStart::RunApplication(NewApplication); - } - -// End of File - diff -r 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/src/AutolockAppUi.cpp --- a/securitydialogs/Autolock/src/AutolockAppUi.cpp Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1060 +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 - -// LOCAL CONSTANTS AND MACROS -#define KSysApUid TUid::Uid(0x100058F3) - -const TInt KTriesToConnectServer( 2 ); -const TInt KTimeBeforeRetryingServerConnection( 50000 ); -const TInt PhoneIndex( 0 ); - -// ================= MEMBER FUNCTIONS ======================= -// -// ---------------------------------------------------------- -// CAutolockAppUi::ConstructL() -// ?implementation_description -// ---------------------------------------------------------- -// -void CAutolockAppUi::ConstructL() - { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL")); - #endif - - RDebug::Printf( "%s %s (%u) EAutolockOff=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EAutolockOff ); - RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOff); - - BaseConstructL( EAknEnableSkin | EAknEnableMSK ); - - } -// ---------------------------------------------------- -// CAutolockAppUi::~CAutolockAppUi() -// Destructor -// Frees reserved resources -// ---------------------------------------------------- -// -CAutolockAppUi::~CAutolockAppUi() - { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - #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(); - } - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - delete iModel; - delete iPhoneObserver; - delete iIncallBubble; -RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - #ifdef RD_AUTO_KEYGUARD - delete iKeyguardObserver; -#endif - - delete iEcsDetector; - delete iEcsNote; // Ecs change - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - delete iWait; - FeatureManager::UnInitializeLib(); - delete iGripStatusObserver; - delete iFpsStatusObserver; - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::~CAutolockAppUi() END")); - #endif -RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - } -// ---------------------------------------------------- -// 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(); - } - 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 - TApaTask self(iCoeEnv->WsSession()); - self.SetWgId(iCoeEnv->RootWin().Identifier()); - self.BringToForeground(); - } - else - { - // unlock voice key while there is active call - UnLockSideKey(); - } - } - - CAknAppUi::HandleForegroundEventL(aForeground); - - } - - -// ---------------------------------------------------- -// 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 ) - { - // 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; - 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) - { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - } -// ---------------------------------------------------- -// CAutolockAppUi::HandleKeyEventL( -// const TKeyEvent& aKeyEvent,TEventCode /*aType*/) -// ---------------------------------------------------- -// -TKeyResponse CAutolockAppUi::HandleKeyEventL( - const TKeyEvent& aKeyEvent,TEventCode aType) - { - if ( aKeyEvent.iCode == EKeyBell) - { - 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); - } - } - -// ---------------------------------------------------- -// 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) -// ---------------------------------------------------- -// -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: - { - RDebug::Printf( "%s %s (%u) ESecUiCmdUnlock is not longer handled by Autolock=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ESecUiCmdUnlock ); - - 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 (callState != EPSCTsyCallStateNone ) - { - iModel->SetLockedL(EFalse); - iModel->ResetInactivityTimeout(); - UnLockKeys(); - 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")); - #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()); - #define KPhoneAppUid TUid::Uid(0x100058B3) - - 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(); - } - } - - 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) - { - 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(); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) searching for popupclock.exe =%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x0 ); - #endif - TApaTaskList taskList( CCoeEnv::Static()->WsSession() ); - const TUid KBigClockUid = { 0x2000FDC3 }; - TApaTask task( taskList.FindApp( KBigClockUid ) ); - if ( task.Exists() ) - { - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) popupclock.exe is running. Not capturing EStdKeyApplication0=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EStdKeyApplication0 ); - #endif - } - else - { - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) popupclock.exe not running. Not capturing EStdKeyApplication0=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EStdKeyApplication0 ); - #endif - iAppKey = groupWin.CaptureKeyUpAndDowns(EStdKeyApplication0, 0, 0); // Capture app key - } - } - 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(EKeySide,0,0); - iSideKey2 = groupWin.CaptureKeyUpAndDowns(EStdKeyDevice6, 0, 0); - } - } - -// ------------------------------------------------------------------------------------------------------------- -// 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(); - - 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 - iIncallBubble->SetIncallBubbleAllowedInIdleL( ETrue ); - } - break; - case EEventWindowGroupListChanged: - HandleWindowGroupListChange(); - break; - case EEventPointer: - case EEventDragDrop: - { - TInt callState = 0; - RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); - if ( 1==1 || callState == EPSCTsyCallStateNone || callState == EPSCTsyCallStateUninitialized ) - { - TPointerEvent *pointer = aEvent.Pointer(); - CAknView* view = View(KAutoLockViewId); - if(view) - { - STATIC_CAST(CAutolockView*, view)->ScreenDeviceChanged(); - TRect aCallRect; - STATIC_CAST(CAutolockView*, view)->HandleCall(1, aCallRect); - if(aCallButtonRect.iBr.iX==0) - aCallButtonRect = TRect (aCallRect); - } - if(pointer->iType==TPointerEvent::EButton1Up) - { - TPoint iPosition = pointer->iPosition; - if(aCallButtonRect.iBr.iXWsSession() ); - TApaTask phonetask = tasklist.FindApp( KPhoneAppUid1 ); - if ( phonetask.Exists() ) - { - TRawEvent event; - event.Set(TRawEvent::EKeyDown, EStdKeyNo); - iEikonEnv->WsSession().SimulateRawEvent(event); - User::After(1000); - event.Set(TRawEvent::EKeyUp, EStdKeyNo); - iEikonEnv->WsSession().SimulateRawEvent(event); - } - } - } - } - } - 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) - SendMessageToSysAp( EEikSecurityQueryLights ); - break; - default: - 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); - } - -TBool CAutolockAppUi::DeviceLockQueryStatus() - { - return iDeviceLockQueryStatus; - } - -TBool CAutolockAppUi::DeviceLockStatus() - { - return iLocked; - } - -TBool CAutolockAppUi::DeviceFpsLock(TInt iStatus) - { - if(iStatus) - HandleCommandL(ESecUiCmdUnlock); - else - iModel->SetLockedL(ETimerLocked); - return ETrue; - } -void CAutolockAppUi::HandleWindowGroupListChange() - { - 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 aCallRect; - STATIC_CAST(CAutolockView*, view)->HandleCall(10, aCallRect); - if(aCallButtonRect.iBr.iX==0) - aCallButtonRect = TRect (aCallRect); - } - // 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 - } - } - -} -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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/src/AutolockContainer.cpp --- a/securitydialogs/Autolock/src/AutolockContainer.cpp Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,355 +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 // 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 - 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 callState = 0; - RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); - if ( callState == EPSCTsyCallStateNone || callState == EPSCTsyCallStateUninitialized ) - { - } - else - { - 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 - { - aCallRect_x=Rect().Width()/2 - iBitmapCall->SizeInPixels().iWidth/2; - aCallRect_y=Rect().Height() * 0.75; - 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); - aCallRect_y+=100; // coordinates are realtive to TRect, not to Screen - } - } - 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/src/AutolockDocument.cpp --- a/securitydialogs/Autolock/src/AutolockDocument.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/src/AutolockFpsStatusObserver.cpp --- a/securitydialogs/Autolock/src/AutolockFpsStatusObserver.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/src/AutolockGripStatusObserver.cpp --- a/securitydialogs/Autolock/src/AutolockGripStatusObserver.cpp Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,139 +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" - - -EXPORT_C CAutolockGripStatusObserver* CAutolockGripStatusObserver::NewL( MAutolockGripStatusObserver* aObserver, RWsSession& aSession ) - { - CAutolockGripStatusObserver* self = new (ELeave) CAutolockGripStatusObserver( aSession ); - CleanupStack::PushL( self ); - self->ConstructL( aObserver ); - CleanupStack::Pop( self ); - return self; - } - -void CAutolockGripStatusObserver::ConstructL( MAutolockGripStatusObserver* 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 - if( !iObserver->DeviceLockQueryStatus() && iObserver->DeviceLockStatus() ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockGripStatusObserver::::GripStatusChangedL => send command")); - #endif - //Grip opened - TApaTaskList tasklist( iSession ); - 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 ); - } - - } - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockGripStatusObserver::::GripStatusChangedL => Grip closed")); - #endif - //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 - TRawEvent rawEvent; - rawEvent.Set( TRawEvent::EKeyDown, KCancelKeyCode ); - iSession.SimulateRawEvent( rawEvent ); - } - } - } - -// End of File diff -r 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/src/AutolockWait.cpp --- a/securitydialogs/Autolock/src/AutolockWait.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/src/lockapp.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/src/lockapp.hrh Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/Autolock/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/src/main.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -0,0 +1,48 @@ +/* +* 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 +#include + +int main(int argc, char **argv) +{ + // qInstallMsgHandler(XQSERVICEMESSAGEHANDLER); + // XQSERVICE_DEBUG_PRINT(" ================== xxxx Autolock::main"); + qDebug() << "================== xxxx QApplication Autolock::main"; + QApplication a( argc, argv ); + Autolock *cl = new Autolock(); + // qDebug() << " ================== xxxx cl->show"; + // cl->show(); + // qDebug() << " ================== xxxx cl->hide"; + cl->hide(); + // qDebug() << " ================== xxxx cl->lower"; + cl->lower(); + int rv = a.exec(); + delete cl; + return rv; +} + diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/AutolockSrv.loc --- a/securitydialogs/AutolockSrv/AutolockSrv.loc Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -// ============================================================================ -// * 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 "AutolockSrv" -#define STRING_r_caption "AutolockSrv" -#else -#define STRING_r_short_caption "AutolockSrv" -#define STRING_r_caption "AutolockSrv" -#endif diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/AutolockSrv.pro --- a/securitydialogs/AutolockSrv/AutolockSrv.pro Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -# -# 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=AutolockSrv - -CONFIG += service - -CONFIG += Hb - -CONFIG += mobility -MOBILITY = publishsubscribe - -symbian:TARGET.UID3 = 0xE0022E73 - -XQSERVICE_ROOT=../.. -include(../../xqservicebase.pri) -include(src/AutolockSrv.pri) - -symbian: TARGET.CAPABILITY = CAP_APPLICATION - -LIBS+=-lxqservice -lxqserviceutil -lflogger -LIBS += -L../../../../../bin/release -lautolockuseractivityservice - -LIBS+=-lsecui -letelmm -letel -lcustomapi -lcentralrepository - -SERVICE.FILE = service_conf.xml -SERVICE.OPTIONS = embeddable -SERVICE.OPTIONS += hidden - -libFiles.sources = AutolockSrv.exe -libFiles.path = "!:\sys\bin" -DEPLOYMENT += libFiles - -RESOURCES += AutolockSrv.qrc - -RSS_RULES += \ - "datatype_list = " \ - " {" \ - " DATATYPE" \ - " {" \ - " priority = EDataTypePriorityNormal;" \ - " type = \"text/plain\";" \ - " }" \ - " };" \ - -symbian:crml.sources = autolocksrv.qcrml -symbian:crml.path = c:/resource/qt/crml -symbian:DEPLOYMENT += crml - -symbian:BLD_INF_RULES.prj_exports += "./rom/AutolockSrv.iby CORE_APP_LAYER_IBY_EXPORT_PATH(AutolockSrv.iby)" diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/AutolockSrv.qrc --- a/securitydialogs/AutolockSrv/AutolockSrv.qrc Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - iconnotifier.svg - qtg_large_device_lock.svg - - diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/Keyguard_enabled.svg --- a/securitydialogs/AutolockSrv/Keyguard_enabled.svg Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1949 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/autolocksrv.qcrml --- a/securitydialogs/AutolockSrv/autolocksrv.qcrml Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/autolockuseractivityservice.pro --- a/securitydialogs/AutolockSrv/autolockuseractivityservice.pro Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +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: autolockuseractivityservice.pro -# - -TEMPLATE = subdirs - -SUBDIRS += autolockuseractivityservice/autolockuseractivityservice.pro diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/autolockuseractivityservice/autolockuseractivityservice.pri --- a/securitydialogs/AutolockSrv/autolockuseractivityservice/autolockuseractivityservice.pri Thu May 27 13:44:17 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: autolockuseractivityservice.pri -# - -HEADERS += ./inc/*.h - -SOURCES += ./src/*.cpp - -INCLUDEPATH += . \ - inc - -DEPENDPATH += . \ - inc \ - src diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/autolockuseractivityservice/autolockuseractivityservice.pro --- a/securitydialogs/AutolockSrv/autolockuseractivityservice/autolockuseractivityservice.pro Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +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: 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 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/autolockuseractivityservice/autolockuseractivityservice_s60.pri --- a/securitydialogs/AutolockSrv/autolockuseractivityservice/autolockuseractivityservice_s60.pri Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +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: autolockuseractivityservice_s60.pri -# - -HEADERS += ./s60/inc/*.h - -SOURCES += ./s60/src/*.cpp - -INCLUDEPATH += ./s60/inc - -DEPENDPATH += ./s60/inc \ - ./s60/src diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/autolockuseractivityservice/autolockuseractivityservice_stub.pri --- a/securitydialogs/AutolockSrv/autolockuseractivityservice/autolockuseractivityservice_stub.pri Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +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: autolockuseractivityservice_stub.pri -# - -HEADERS += ./stub/inc/*.h - -SOURCES += ./stub/src/*.cpp - -INCLUDEPATH += ./stub/inc - -DEPENDPATH += ./stub/inc \ - ./stub/src diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/autolockuseractivityservice/common.pri --- a/securitydialogs/AutolockSrv/autolockuseractivityservice/common.pri Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +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: 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 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/autolockuseractivityservice/inc/autolockuseractivityservice.h --- a/securitydialogs/AutolockSrv/autolockuseractivityservice/inc/autolockuseractivityservice.h Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +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: 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 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/autolockuseractivityservice/inc/autolockuseractivityservice_global.h --- a/securitydialogs/AutolockSrv/autolockuseractivityservice/inc/autolockuseractivityservice_global.h Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +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: 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 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/autolockuseractivityservice/inc/autolockuseractivityserviceinterface.h --- a/securitydialogs/AutolockSrv/autolockuseractivityservice/inc/autolockuseractivityserviceinterface.h Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +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: 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 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/autolockuseractivityservice/s60/inc/autolockuseractivityservice_p.h --- a/securitydialogs/AutolockSrv/autolockuseractivityservice/s60/inc/autolockuseractivityservice_p.h Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +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: 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 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/autolockuseractivityservice/s60/src/autolockuseractivityservice_p.cpp --- a/securitydialogs/AutolockSrv/autolockuseractivityservice/s60/src/autolockuseractivityservice_p.cpp Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,143 +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: 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 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/autolockuseractivityservice/src/autolockuseractivityservice.cpp --- a/securitydialogs/AutolockSrv/autolockuseractivityservice/src/autolockuseractivityservice.cpp Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +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: 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 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/autolockuseractivityservice/stub/inc/autolockuseractivityservice_p.h --- a/securitydialogs/AutolockSrv/autolockuseractivityservice/stub/inc/autolockuseractivityservice_p.h Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +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: 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 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/autolockuseractivityservice/stub/src/autolockuseractivityservice_p.cpp --- a/securitydialogs/AutolockSrv/autolockuseractivityservice/stub/src/autolockuseractivityservice_p.cpp Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +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: 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 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/bwins/autolockuseractivityserviceu.def --- a/securitydialogs/AutolockSrv/bwins/autolockuseractivityserviceu.def Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -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 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/eabi/autolockuseractivityserviceu.def --- a/securitydialogs/AutolockSrv/eabi/autolockuseractivityserviceu.def Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -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 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/iconnotifier.svg --- a/securitydialogs/AutolockSrv/iconnotifier.svg Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,260 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/indicatorplugin/qmakepluginstubs/indicatortestplugin.qtplugin --- a/securitydialogs/AutolockSrv/indicatorplugin/qmakepluginstubs/indicatortestplugin.qtplugin Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -This file is a Qt plugin stub file. The real Qt plugin is located in /sys/bin. Created:2010-03-19T16:43:28 diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/qtg_large_device_lock.svg --- a/securitydialogs/AutolockSrv/qtg_large_device_lock.svg Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/resources/Keyguard_enabled_test.svg --- a/securitydialogs/AutolockSrv/resources/Keyguard_enabled_test.svg Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1949 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/resources/iconnotifier.svg --- a/securitydialogs/AutolockSrv/resources/iconnotifier.svg Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,260 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/resources/qtg_large_device_lock.svg --- a/securitydialogs/AutolockSrv/resources/qtg_large_device_lock.svg Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/rom/AutolockSrv.iby --- a/securitydialogs/AutolockSrv/rom/AutolockSrv.iby Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +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 __AUTOLOCKSRV_IBY__ -#define __AUTOLOCKSRV_IBY__ - -#include - -S60_APP_EXE(AutolockSrv) -S60_APP_BITMAP(AutolockSrv) -S60_APP_AIF_RSC(AutolockSrv) -S60_APP_RESOURCE(AutolockSrv) - -file=ABI_DIR\BUILD_DIR\autolockuseractivityservice.dll SHARED_LIB_DIR\autolockuseractivityservice.dll -file=ABI_DIR\BUILD_DIR\IndicatorAutolockPlugin.dll SHARED_LIB_DIR\IndicatorAutolockPlugin.dll - -// this needs to be also in apps because this is where QtHighway searches for it. -data=ZPRIVATE\10003a3f\import\apps\AutolockSrv_reg.rsc private\10003a3f\apps\AutolockSrv_reg.rsc - -#endif // __AUTOLOCKSRV_IBY__ diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/service_conf.xml --- a/securitydialogs/AutolockSrv/service_conf.xml Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ - - - com.nokia.services.AutolockSrv - No path really - AutolockSrv - - AutolockSrv - 2.0 - Interface to AutolockSrv - - \ No newline at end of file diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/service_conf_new.xml --- a/securitydialogs/AutolockSrv/service_conf_new.xml Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ - - - com.nokia.services.AutolockSrv - No path - AutolockSrv service - - AutolockSrv - 2.0 - Interface to AutolockSrv - Dial now - - \ No newline at end of file diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/service_conf_old_format.xml --- a/securitydialogs/AutolockSrv/service_conf_old_format.xml Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ - - - AutolockSrv - - Dial interface - - \ No newline at end of file diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/src/AutolockSrv.cpp --- a/securitydialogs/AutolockSrv/src/AutolockSrv.cpp Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1547 +0,0 @@ -/* -* 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QTM_USE_NAMESPACE - -#include -#include - -#include - -#include - -#include - -#include - -#include "AutolockSrv.h" -#include - -#include "autolockuseractivityservice.h" - -#include // CenRep keys -#include -#include - -#include - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include "../../../inc/securityuisprivatepskeys.h" -#include -#include - -#include - -const TInt KPhoneIndex(0); -const TInt KTriesToConnectServer(2); -const TInt KTimeBeforeRetryingServerConnection(50000); - -#define ESecUiTypeLock 0x00100000 - -_LIT( KMmTsyModuleName, "PhoneTsy"); - -AutolockSrv::AutolockSrv(QWidget *parent, Qt::WFlags f) : - QWidget(parent, f), mService(NULL) - { - RDEBUG("start autolocksrv", 0); - mService = new AutolockSrvService(this); - - /* Adjust the palette */ -#if defined(Q_WS_S60) - 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 - - QPushButton *unlockButton = new QPushButton(tr("Unlock")); - QPushButton *unguardButton = new QPushButton(tr("Unguard")); - QPushButton *lockButton = new QPushButton(tr("Lock")); - QPushButton *quitButton = new QPushButton(tr("Quit")); - QPushButton *test1Button = new QPushButton(tr("Autolock 10 seconds")); - QPushButton *test2Button = new QPushButton(tr("Autolock never")); - QPushButton *test3Button = new QPushButton(tr("SecUiTest")); - connect(quitButton, SIGNAL(clicked()), this, SLOT(quit())); - connect(lockButton, SIGNAL(clicked()), this, SLOT(lockAction())); - connect(unlockButton, SIGNAL(clicked()), this, SLOT(unlockAction())); - connect(unguardButton, SIGNAL(clicked()), this, SLOT(unguardAction())); - connect(test1Button, SIGNAL(clicked()), this, SLOT(test1Action())); - connect(test2Button, SIGNAL(clicked()), this, SLOT(test2Action())); - connect(test3Button, SIGNAL(clicked()), this, SLOT(test3Action())); - RDEBUG("connect", 1); - - /* there's no use for this */ - /* - bool isService = XQServiceUtil::isService(); - - QString t = "SERVICEAPP:\n"; - t = t + (isService ? " LAUNCHED AS SERVICE\n" : " LAUNCHED NORMALLY\n"); - t = t + (XQServiceUtil::isEmbedded() ? " EMBEDDED\n" : " NOT EMBEDDED\n"); - - QStringList args = QApplication::arguments(); - foreach (QString arg, args) - { - t += "cmdline arg=" + arg + "\n"; - } - - QLabel *title = new QLabel(t); - */ - - mLabel = new QLabel(""); - mNumberEdit = new QLineEdit(""); - - QVBoxLayout *vl = new QVBoxLayout; - RDEBUG("QVBoxLayout", 1); - - vl->setMargin(0); - vl->setSpacing(0); - RDEBUG("setSpacing", 1); - - vl->addWidget(lockButton); - vl->addWidget(unlockButton); - vl->addWidget(unguardButton); - vl->addWidget(quitButton); - vl->addWidget(test1Button); - vl->addWidget(test2Button); - vl->addWidget(test3Button); - RDEBUG("added test3Button", 1); - - mLabelIcon = new QToolButton; - mLabelIcon->setIcon(QIcon( - ":/AutolockSrv_hbicon/qtg_large_device_lock.svg")); - mLabelIcon->setIconSize(QSize(300, 300)); - - vl->addWidget(mLabelIcon); - RDEBUG("added mLabelIcon", 1); - - /* vl->addItem(title); - vl->addWidget(mLabel); - vl->addWidget(mNumberEdit); - */ - setLayout(vl); - -#if defined(Q_WS_X11) || defined(Q_WS_WIN) - setFixedSize(QSize(360,640)); // nHD -#elif defined(Q_WS_S60) - // showMaximized(); - showFullScreen(); -#endif - mLabelIcon_visible = 1; - serviceKeyguard = new AutolockUserActivityService(); - serviceDevicelock = new AutolockUserActivityService(); - - TInt lockValue = 0; - TInt lightsTimeout = 0; - CRepository* repository = NULL; - TInt cRresult = 0; - - 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())); - - // subscribe to environment changes - subscriberKHWRMGripStatus = new QValueSpaceSubscriber( - "/KPSUidHWRM/KHWRMGripStatus", this); - connect(subscriberKHWRMGripStatus, SIGNAL(contentsChanged()), this, - SLOT(subscriberKHWRMGripStatusChanged())); - - subscriberKAknKeyguardStatus = new QValueSpaceSubscriber( - "/KPSUidAvkonDomain/KAknKeyguardStatus", this); - connect(subscriberKAknKeyguardStatus, SIGNAL(contentsChanged()), this, - SLOT(subscriberKAknKeyguardStatusChanged())); - - subscriberKCoreAppUIsAutolockStatus = new QValueSpaceSubscriber( - "/KPSUidCoreApplicationUIs/KCoreAppUIsAutolockStatus", this); - connect(subscriberKCoreAppUIsAutolockStatus, SIGNAL(contentsChanged()), this, - SLOT(subscriberKCoreAppUIsAutolockStatusChanged())); - - ///////////// - 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); - //User::LeaveIfError( RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, - // EAutolockOff)); - RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, - EAutolockOff); - RDEBUG("defined KCoreAppUIsAutolockStatus", ret); - - ret = RProperty::Define(KPSUidAvkonDomain, KAknKeyguardStatus, - RProperty::EInt, TSecurityPolicy(TSecurityPolicy::EAlwaysPass), - KWritePolicy); - RDEBUG("defined KAknKeyguardStatus", ret); - - ret = RProperty::Define(KPSUidSecurityUIs, - KSecurityUIsLockInitiatorUID, RProperty::EInt, readPolicy, - 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); - - // 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); - // TODO if I want to release, I should do: mKeyCaptureHandle = env->RootWin().CaptureKey(EKeyBackspace, 0, 0); - groupWin.CaptureKey(EKeyBackspace, 0, 0); - groupWin.CaptureKey(EKeyDeviceF, 0, 0); - groupWin.CaptureKey(EKeyBell, 0, 0); - groupWin.CaptureKey(EKeyTab, 0, 0); - groupWin.CaptureKey(EKeyInsert, 0, 0); - RDEBUG("got mKeyCaptureHandle", 1); - - iSecQueryUiCreated = -1; - iDeviceDialogCreated = -1; - // TODO for now, always starts unlocked - // TryChangeStatus(iLockStatus); - TryChangeStatus( ELockNotActive); - lower(); - hide(); - // not needed: new AutolockSrvService(this); - } - -AutolockSrv::~AutolockSrv() - { - RDEBUG("0", 0); - delete mService; - } - -void AutolockSrv::adjustInactivityTimers(int aReason) - { - RDEBUG("aReason", aReason); - TInt keyguardTime = 0; - TInt lockTime = 0; - CRepository* repository = NULL; - TInt cRresult = 0; - - QT_TRAP_THROWING( repository = CRepository::NewL(KCRUidSecuritySettings) ); - cRresult = repository->Get(KSettingsAutoLockTime, lockTime); // in minutes, handled internally as seconds - lockTime *= 60; - RDEBUG("KSettingsAutoLockTime", KSettingsAutoLockTime); - RDEBUG("cRresult", cRresult); - RDEBUG("lockTime", lockTime); - 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 - } - - 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); - } - delete repository; - } -void AutolockSrv::quit() - { - RDEBUG("0", 0); - qApp->quit(); - } - -// from the button -void AutolockSrv::unlockAction() - { - RDEBUG("0", 0); - TInt err = TryChangeStatus( ELockAppDisableDevicelock); - RDEBUG("err", err); - } - -void AutolockSrv::unguardAction() - { - RDEBUG("0", 0); - TInt err = TryChangeStatus( ELockAppDisableKeyguard); - RDEBUG("err", err); - } - -void AutolockSrv::test1Action() - { - RDEBUG("Set(KSettingsAutoLockTime, 2)", 2); - - CRepository* repositorySet = NULL; - QT_TRAP_THROWING( repositorySet = CRepository::NewL(KCRUidSecuritySettings) ); - repositorySet->Set(KSettingsAutoLockTime, 2); // in minutes - delete repositorySet; - } - -void AutolockSrv::test2Action() - { - RDEBUG("Set(KSettingsAutoLockTime, 0)", 0); - - CRepository* repositorySet = NULL; - QT_TRAP_THROWING( repositorySet = CRepository::NewL(KCRUidSecuritySettings) ); - repositorySet->Set(KSettingsAutoLockTime, 0); // minutes - delete repositorySet; - } -void AutolockSrv::test3Action() - { - RDEBUG("SecUiTest", 0); - RDEBUG("This should start SecUiTest, but it's not done yet", 0); - } - -int AutolockSrv::AskValidSecCode(int aReason) - { - RDEBUG("aReason", aReason); - RMobilePhone iPhone; // NULL in emulator - -#ifdef __WINS__1 - return KErrNone; -#endif - - - TInt err(KErrGeneral); - 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); - QT_TRAP_THROWING( validCode = handler->AskSecCodeInAutoLockL() ); // this returns true/false - // 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 ); - */ - } - // TODO this doesn't wait on WINS , so how do I get the Acceptation? - 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 AutolockSrv::lockAction() - { - RDEBUG("0", 0); - TryChangeStatus( ELockAppOfferDevicelock); - } - -void AutolockSrv::handleAnswerDelivered() - { - RDEBUG("0", 0); - // quit(); - - } - -void AutolockSrv::endCall() - { - RDEBUG("This should never be called", 0); - //QVBoxLayout *vl = qobject_cast(layout()) ; - //vl->removeWidget(mEndCallButton); - - //XQServiceUtil::toBackground(true); - } - -void AutolockSrv::setLabelNumber(QString label, QString number) - { - RDEBUG("0", 0); - mLabel->setText("mLabel=" + label); - mNumberEdit->setText("mNumberEdit=" + number); - } - -void AutolockSrv::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 AutolockSrv::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 AutolockSrv::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 AutolockSrv::CheckIfLegal(int aReason) - { - RDEBUG("aReason", aReason); - // check whether a dialog is already displayed. This is to prevent timeout-lock and timeout-keyguard for activated on top of a PIN query, in particular at boot-up (TODO 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 (1 == 0) // !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 (secUiOriginatedQuery - != ESecurityUIsSecUIOriginatedUninitialized - && secUiOriginatedQuery - != ESecurityUIsSystemLockOriginated) - { - // PIN on top and trying to display unlock-code. This is valid - } - 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: - return KErrPermissionDenied; - } - } - break; - default: - { - RDEBUG("default iLockStatus", iLockStatus); - return KErrPermissionDenied; - } - // break; - } // switch - return KErrPermissionDenied; - } - -int AutolockSrv::publishStatus(int aReason) - { - RDEBUG("aReason", aReason); - TInt 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; - 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); - // lights are required ? - - // 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 AutolockSrv::showNoteIfRequested(int aReason) - { - RDEBUG("aReason", aReason); - - if (aReason == ELockNotActive) - { - if (iShowKeyguardNote == 1) - { - HbDeviceMessageBox::information("Keyguard deactivated"); - } - } - else if (aReason == EKeyguardActive) - { - if (iShowKeyguardNote == 1) - { - HbDeviceMessageBox::information("Keyguard activated"); - } - } - else if (aReason >= EDevicelockActive) // this doesn't happen, but we are prepared nevertheless - { - if (iShowKeyguardNote == 1) - { - HbDeviceMessageBox::information("Devicelock activated"); - } - } - return KErrNone; - } -/***********************/ -int AutolockSrv::TryChangeStatus(int aReason) - { - RDEBUG("aReason", aReason); - int ret = aReason; - int errorInProcess = KErrNone; - DebugRequest(ret); - - TInt err = RProperty::Set(KPSUidSecurityUIs, - KSecurityUIsDismissDialog, - ESecurityUIsDismissDialogOn); - RDEBUG("err", err); - switch (ret) - { - case ELockAppEnableKeyguard: // 1 - { - errorInProcess = CheckIfLegal(ret); - DebugError(errorInProcess); - if (errorInProcess == KErrNone) - { - setLabelIcon( EKeyguardActive); - updateIndicator(EKeyguardActive); - publishStatus(EKeyguardActive); - showNoteIfRequested(EKeyguardActive); - } - } - break; - case ELockAppDisableKeyguard: // 2 - { - errorInProcess = CheckIfLegal(ret); - DebugError(errorInProcess); - if (errorInProcess == KErrNone) - { - setLabelIcon( ELockNotActive); - updateIndicator(ELockNotActive); - publishStatus(ELockNotActive); - showNoteIfRequested(ELockNotActive); - } - } - 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); - break; // so that "disable while disabled" doesn't mess up - } - if (errorInProcess == KErrNone) - { - RDEBUG(" calling HbDeviceMessageBox::question", 0); - bool value = 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); - publishStatus(ELockNotActive); - } - if (errorInProcess != KErrNone) - { // re-lock. For example, if password is wrong - if( iLockStatus >=EDevicelockActive) // this skips the case when unlocking, although it wan't locked. - setLockDialog(aReason, 1); - } - // this never shows a note - } - break; - case ELockAppOfferKeyguard: // 5 - { - errorInProcess = CheckIfLegal(ret); - DebugError(errorInProcess); - if (errorInProcess == KErrNone) - { - bool value = HbDeviceMessageBox::question("Enable Keyguard?"); // this doesn't block other events, so after return everything might be messed up. - // TODO 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); - 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: - { - 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 AutolockSrv::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); - - if (status == 0) // hide - { - // secUiOriginatedQuery should be ESecurityUIsSystemLockOriginated . If not, this is not correctly setting it - if (iDeviceDialogCreated > 0) - { - iDeviceDialogCreated = 0; - iDeviceDialog->cancel(); - err = iDeviceDialog->error(); - RDEBUG("err", err); - TInt err = RProperty::Set(KPSUidSecurityUIs, - KSecurityUIsSecUIOriginatedQuery, - ESecurityUIsSecUIOriginatedUninitialized); - RDEBUG("err", err); - } - } - else if (status == 1) // show - { - // 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 == EKeyguardActive) - params.insert("type", ESecUiTypeKeyguard); - else if (aReason >= EDevicelockActive) - 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 <= 0) - { - RDEBUG("creating iDeviceDialog", 0); - iDeviceDialog = new HbDeviceDialog(HbDeviceDialog::NoFlags, this); - iDeviceDialogCreated = 1; - } - else - { - RDEBUG("raising iDeviceDialog", 0); - // confirm that dialog is present - err = iDeviceDialog->error(); - RDEBUG("err", err); - iDeviceDialogCreated = 2; - } - const QString KSecQueryUiDeviceDialog("com.nokia.secuinotificationdialog/1.0"); - RDEBUG("pre show", aReason); - 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); - RDEBUG("err", err); - - } - else - { - RDEBUG("unknown status", status); - return KErrNotSupported; - } - return KErrNone; - } -void AutolockSrv::setLabelIcon(int aReason) - { - RDEBUG("aReason", aReason); - - if (aReason == ELockNotActive) - { - mLabelIcon->setVisible(false); - setLockDialog(aReason, 0); // TODO isn't this done already at TryChangeStatus ??? - lower(); - hide(); - } - else if (aReason == EKeyguardActive) - { - mLabelIcon->setVisible(true); - setLockDialog(aReason, 1); - raise(); // not repaint(), not show() , not setVisible(true), not showFullScreen() , not ??? - show(); - } - else if (aReason == EDevicelockActive) - { - mLabelIcon->setVisible(true); - raise(); - show(); - } - else - { - RDEBUG("error: aReason", aReason); - } - } - -int AutolockSrv::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.autolocksrv.autolocksrv_8/1.0"); // maybe it's already deactivated. Not a problem - else if (aReason == EKeyguardActive) - success = indicator.activate( - "com.nokia.hb.indicator.autolocksrv.autolocksrv_8/1.0"); - else if (aReason == EDevicelockActive) - success = indicator.activate( - "com.nokia.hb.indicator.autolocksrv.autolocksrv_8/1.0"); // same. We have just 1 indicator - else - success = 0; - RDEBUG("success", success); - return success; - } - -void AutolockSrv::activeKeyguard() - { - // activity while keyguarded. Nothing to do - RDEBUG("0", 0); - } - -void AutolockSrv::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 - { - ret = TryChangeStatus(ELockAppEnableKeyguard); - } - RDEBUG("ret", ret); - } -/* Some activity detected while the deviceLock is enabled */ -void AutolockSrv::activeDevicelock() - { - // nothing to do - RDEBUG("0", 0); - } - -void AutolockSrv::notActiveDevicelock() - { - // inactivity. Devicelock should be activated - RDEBUG("0", 0); - int ret = KErrNone; - DebugStatus( iLockStatus); - if (iLockStatus == ELockNotActive || iLockStatus == EKeyguardActive) // not possible if it's locked - { - ret = TryChangeStatus(ELockAppEnableDevicelock); - } - RDEBUG("ret", ret); - - } - -// some key is pressed -bool AutolockSrv::event(QEvent *ev) - { - if (ev) - { - int isSwitchKey = 0; - // on device, this doesn't seem to get the EKeyDeviceF key: only 1ffffff - if (ev->type() == QEvent::KeyPress) - { - QKeyEvent *keyEvent = static_cast (ev); - RDEBUG("KeyPress", keyEvent->key()); - if ((keyEvent->key() & 0xFF) == (EKeyInsert & 0xFF)) - { - RDEBUG("EKeyInsert", EKeyInsert); - // only reacts on release, not on press - isSwitchKey = 1; - } - if ((keyEvent->key() & 0xFF) == (EKeyTab & 0xFF)) - { - RDEBUG("EKeyTab", EKeyTab); - } - if ((keyEvent->key() & 0xFF) == (EKeyDeviceF & 0xFF)) - { - RDEBUG("EKeyDeviceF", EKeyDeviceF); - } - if (keyEvent->key() == 0x1ffffff) - { - RDEBUG("0x1ffffff", 0x1ffffff); - isSwitchKey = 1; - } - } - else if (ev->type() == QEvent::KeyRelease) - { - QKeyEvent *keyEvent = static_cast (ev); - RDEBUG("KeyRelease", keyEvent->key()); - if (keyEvent->key() == 0x1ffffff) - { - RDEBUG("released EKeyDeviceF-1ffffff", 1); - // isSwitchKey=1; this should happen is pressed was not processed (hint: if it is/was in background) - } - } - RDEBUG("isSwitchKey", isSwitchKey); - if (isSwitchKey) - { - int ret = KErrNone; - DebugStatus( iLockStatus); - if (iLockStatus == ELockNotActive) - { - iShowKeyguardNote = 1; // note on enable keyguard - ret = TryChangeStatus(ELockAppEnableKeyguard); // this should not ask confirmation - } - else if (iLockStatus == EKeyguardActive) - { - iShowKeyguardNote = 1; // note on disable keyguard - ret = TryChangeStatus(ELockAppDisableKeyguard); - } - else if (iLockStatus == EDevicelockActive) - { - ret = TryChangeStatus(ELockAppDisableDevicelock); - } - else - { - RDEBUG("unknown iLockStatus", iLockStatus); - } - RDEBUG("ret", ret); - } // isSwitchKey - } // ev - // Process if not done before. For example, redraw or quit - return QWidget::event(ev); - } - -bool AutolockSrv::eventFilter(QObject *o, QEvent *ev) - { - // this never happens - RDEBUG("0", 0); - return QWidget::eventFilter(o, ev); - - } -// some setting changed -void AutolockSrv::subscriberKSettingsAutolockStatusChanged() - { - RDEBUG("0", 0); - QVariant v = subscriberKSettingsAutolockStatus->value( - "/KCRUidSecuritySettings/KSettingsAutolockStatus"); - adjustInactivityTimers( KSettingsAutolockStatus); - } -void AutolockSrv::subscriberKSettingsAutoLockTimeChanged() - { - RDEBUG("0", 0); - QVariant v = subscriberKSettingsAutoLockTime->value( - "/KCRUidSecuritySettings/KSettingsAutoLockTime"); - adjustInactivityTimers( KSettingsAutoLockTime); - } -void AutolockSrv::subscriberKSettingsAutomaticKeyguardTimeChanged() - { - RDEBUG("0", 0); - QVariant v = subscriberKSettingsAutomaticKeyguardTime->value( - "/KCRUidSecuritySettings/KSettingsAutomaticKeyguardTime"); - adjustInactivityTimers( KSettingsAutoLockTime); - } -void AutolockSrv::subscriberKDisplayLightsTimeoutChanged() - { - RDEBUG("0", 0); - QVariant v = subscriberKDisplayLightsTimeout->value( - "/KCRUidLightSettings/KDisplayLightsTimeout"); - // nothing to do - } -void AutolockSrv::subscriberKProEngActiveProfileChanged() - { - RDEBUG("0", 0); - QVariant v = subscriberKProEngActiveProfile->value( - "/KCRUidProfileEngine/KProEngActiveProfile"); - // nothing to do - } -// some environment changed -void AutolockSrv::subscriberKAknKeyguardStatusChanged() - { - RDEBUG("Error only AutolockSrv should be able to change it", 0); - } -void AutolockSrv::subscriberKCoreAppUIsAutolockStatusChanged() - { - RDEBUG("Error only AutolockSrv should be able to change it", 0); - } -void AutolockSrv::subscriberKHWRMGripStatusChanged() - { - TInt 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 = 1; // note on disable keyguard - ret = TryChangeStatus(ELockAppDisableKeyguard); - } - else if (iLockStatus == EDevicelockActive) - { - ret = TryChangeStatus(ELockAppDisableDevicelock); - } - } - else if( aGripStatus == EPSHWRMGripClosed ) - { - if (iLockStatus == ELockNotActive) - { - iShowKeyguardNote = 1; // note on enable keyguard - ret = TryChangeStatus(ELockAppEnableKeyguard); - } - } - } - -// ----------AutolockSrvService--------------- - -AutolockSrvService::AutolockSrvService(AutolockSrv* parent) : - XQServiceProvider(QLatin1String( - "com.nokia.services.AutolockSrv.AutolockSrv"), parent), - mAutolockSrv(parent), mAsyncReqId(-1), mAsyncAnswer(false) - { - RDEBUG("0", 0); - publishAll(); - connect(this, SIGNAL(returnValueDelivered()), parent, SLOT( - handleAnswerDelivered())); - } - -AutolockSrvService::~AutolockSrvService() - { - RDEBUG("0", 0); - } - -void AutolockSrvService::complete(QString number) - { - RDEBUG("0", 0); - if (mAsyncReqId == -1) - return; - completeRequest(mAsyncReqId, number.toInt()); - } - -// got API request from lockaccessextension -int AutolockSrvService::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(); - - mAutolockSrv->callerHasECapabilityWriteDeviceData = 0; - if (caps.contains(ECapabilityWriteDeviceData)) - { - RDEBUG("callerHasECapabilityWriteDeviceData", - ECapabilityWriteDeviceData); - mAutolockSrv->callerHasECapabilityWriteDeviceData = 1; - } - - QString label = "AutolockSrv::service:\n"; - label += QString("number=%1\n").arg(number); - - mNumber = number; - mAutolockSrv->setLabelNumber(label, number); - int ret = 0; - ret = number.toInt(); - - mAutolockSrv->mParam1 = aParam1.toInt(); - mAutolockSrv->iShowKeyguardNote = aParam1.toInt(); - mAutolockSrv->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 = mAutolockSrv->TryChangeStatus(ret); - RDEBUG("ret", ret); - return ret; - } - -void AutolockSrvService::handleClientDisconnect() - { - RDEBUG("0", 0); - // Just quit service application if client ends - mAsyncAnswer = false; - RDEBUG("0", 0); - // mAutolockSrv->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 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/src/AutolockSrv.h --- a/securitydialogs/AutolockSrv/src/AutolockSrv.h Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,229 +0,0 @@ -/* -* 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 AUTOLOCKSRV_H -#define AUTOLOCKSRV_H - -#define RDEBUG( x, y ) RDebug::Printf( "%s %s (%u) %s=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, x, y ); -// #define RDEBUG( x, y ) - -#include -#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 - }; - - -class QLineEdit; -class QPushButton; -class AutolockSrvService; -class QLabel; -class HbLabel; -class XQSharableFile; - -class AutolockSrv : public QWidget -{ - Q_OBJECT - -public: - AutolockSrv( QWidget *parent = 0, Qt::WFlags f = 0 ); - ~AutolockSrv(); - - 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 endCall(); - void quit(); - void unlockAction(); - void unguardAction(); - void lockAction(); - void test1Action(); - void test2Action(); - void test3Action(); - void handleAnswerDelivered(); - void subscriberKSettingsAutolockStatusChanged(); - void subscriberKSettingsAutoLockTimeChanged(); - void subscriberKSettingsAutomaticKeyguardTimeChanged(); - void subscriberKDisplayLightsTimeoutChanged(); - void subscriberKProEngActiveProfileChanged(); - void subscriberKAknKeyguardStatusChanged(); - void subscriberKCoreAppUIsAutolockStatusChanged(); - void subscriberKHWRMGripStatusChanged(); - -private slots: - void activeKeyguard(); - void notActiveKeyguard(); - void activeDevicelock(); - void notActiveDevicelock(); - -private: - QLabel *mLabel; - QLineEdit *mNumberEdit; - QToolButton *mLabelIcon; - int mLabelIcon_visible; - //QPushButton *mEndCallButton; - AutolockSrvService* mService; - // int mKeyCode; - // int mKeyCaptureHandle; - QValueSpaceSubscriber *subscriberKSettingsAutolockStatus; - QValueSpaceSubscriber *subscriberKSettingsAutoLockTime; - QValueSpaceSubscriber *subscriberKSettingsAutomaticKeyguardTime; - QValueSpaceSubscriber *subscriberKDisplayLightsTimeout; - QValueSpaceSubscriber *subscriberKProEngActiveProfile; - QValueSpaceSubscriber *subscriberKAknKeyguardStatus; - QValueSpaceSubscriber *subscriberKCoreAppUIsAutolockStatus; - QValueSpaceSubscriber *subscriberKHWRMGripStatus; - - AutolockUserActivityService* serviceKeyguard; - AutolockUserActivityService* serviceDevicelock; - - int iLockStatus; - int iLockStatusPrev; - CSecQueryUi *iSecQueryUi; - int iSecQueryUiCreated; - HbDeviceDialog *iDeviceDialog; - int iDeviceDialogCreated; -}; - -class AutolockSrvService : public XQServiceProvider -{ - Q_OBJECT -public: - AutolockSrvService( AutolockSrv *parent = 0 ); - ~AutolockSrvService(); - - 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: - AutolockSrv* mAutolockSrv; - 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 // AUTOLOCKSRV_H diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/src/AutolockSrv.pri --- a/securitydialogs/AutolockSrv/src/AutolockSrv.pri Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -# -# 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/AutolockSrv.cpp - -HEADERS=\ - src/AutolockSrv.h - diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/src/keycapturingapplication.cpp --- a/securitydialogs/AutolockSrv/src/keycapturingapplication.cpp Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -#include -#include -#include -#include - -#include -#include - -#include "keycapturingapplication.h" - -/*! - - */ -void writeDebug(const QString &message) -{ - QFile file("c:/keycapturingapplication.log"); - if (!file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) { - qDebug() << "DialogLauncherView::writeDebug - file open failed"; - return; - } - - QTextStream out(&file); - out << message << "\n"; - - file.close(); -} - -/*! - - */ -KeyCapturingApplication::KeyCapturingApplication(int &argc, char *argv[], int keyCode) : - HbApplication(argc, argv), mKeyCode(keyCode), mKeyCaptureHandle(-1) -{ - CEikonEnv *env = CEikonEnv::Static(); - mKeyCaptureHandle = env->RootWin().CaptureKey(keyCode, 0, 0); -} - -/*! - - */ -KeyCapturingApplication::~KeyCapturingApplication() -{ - CEikonEnv *env = CEikonEnv::Static(); - env->RootWin().CancelCaptureKey(mKeyCaptureHandle); -} - -bool KeyCapturingApplication::symbianEventFilter(const QSymbianEvent *event) -{ - if (event->type() == QSymbianEvent::WindowServerEvent) { - const TWsEvent* wsEvent = event->windowServerEvent(); - if (wsEvent->Type() == EEventKey) { - writeDebug(QString("Key Event:")); - writeDebug(QString("\tkey code: %1").arg(wsEvent->Key()->iCode)); - writeDebug(QString("\tscan code: %1").arg(wsEvent->Key()->iScanCode)); - if (wsEvent->Key()->iCode == mKeyCode) - { - emit capturedKeyEvent(); - } - } - } - return HbApplication::symbianEventFilter(event); -} diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/src/keycapturingapplication.h --- a/securitydialogs/AutolockSrv/src/keycapturingapplication.h Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -#ifndef KEYCAPTURINGAPPLICATION_H -#define KEYCAPTURINGAPPLICATION_H - -#include - -class KeyCapturingApplication : public HbApplication -{ - - Q_OBJECT - -signals: - - void capturedKeyEvent(); - -public: - - KeyCapturingApplication(int &argc, char *argv[], int keyCode); - ~KeyCapturingApplication(); - virtual bool symbianEventFilter(const QSymbianEvent *event); - -private: - - int mKeyCode; - int mKeyCaptureHandle; - -}; - -#endif // KEYCAPTURINGAPPLICATION_H diff -r 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/src/lockapp.hrh --- a/securitydialogs/AutolockSrv/src/lockapp.hrh Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/AutolockSrv/src/main.cpp --- a/securitydialogs/AutolockSrv/src/main.cpp Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* -* 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 "AutolockSrv.h" - -#include -#include - -int main(int argc, char **argv) -{ - // qInstallMsgHandler(XQSERVICEMESSAGEHANDLER); - // XQSERVICE_DEBUG_PRINT(" ================== xxxx AutolockSrv::main"); - qDebug() << "================== xxxx AutolockSrv::main"; - QApplication a( argc, argv ); - AutolockSrv *cl = new AutolockSrv(); - qDebug() << " ================== xxxx cl->show"; - // cl->show(); - qDebug() << " ================== xxxx cl->hide"; - cl->hide(); - qDebug() << " ================== xxxx cl->lower"; - cl->lower(); - int rv = a.exec(); - delete cl; - return rv; -} - diff -r 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/BWinsCw/SECUI_EKA2U.def --- a/securitydialogs/SecUi/BWinsCw/SECUI_EKA2U.def Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/SecUi/BWinsCw/SECUI_EKA2U.def Fri Jun 11 14:28:40 2010 +0300 @@ -68,4 +68,5 @@ ?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 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/EABI/Secuiu.def --- a/securitydialogs/SecUi/EABI/Secuiu.def Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/SecUi/EABI/Secuiu.def Fri Jun 11 14:28:40 2010 +0300 @@ -99,4 +99,5 @@ _ZN17CSecuritySettings27ChangeAutoLockPeriodParamsLEi4TBufILi10EEiR6TDes16i @ 98 NONAME _ZTI11CSecQueryUi @ 99 NONAME _ZTV11CSecQueryUi @ 100 NONAME + _ZN17CSecuritySettings17AskSecCodeParamsLER4TBufILi10EEiR6TDes16i @ 101 NONAME diff -r 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/GSSimSecPlugin/Data/10207438.rss --- a/securitydialogs/SecUi/GSSimSecPlugin/Data/10207438.rss Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/GSSimSecPlugin/Data/GSSimSecPluginRsc.rss --- a/securitydialogs/SecUi/GSSimSecPlugin/Data/GSSimSecPluginRsc.rss Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/GSSimSecPlugin/GSSimSecPlugin.mmp --- a/securitydialogs/SecUi/GSSimSecPlugin/GSSimSecPlugin.mmp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/GSSimSecPlugin/Inc/GSPubSubsListener.h --- a/securitydialogs/SecUi/GSSimSecPlugin/Inc/GSPubSubsListener.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/GSSimSecPlugin/Inc/GSSimSecPlugin.h --- a/securitydialogs/SecUi/GSSimSecPlugin/Inc/GSSimSecPlugin.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/GSSimSecPlugin/Inc/GSSimSecPlugin.hrh --- a/securitydialogs/SecUi/GSSimSecPlugin/Inc/GSSimSecPlugin.hrh Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/GSSimSecPlugin/Inc/GSSimSecPlugin.rh --- a/securitydialogs/SecUi/GSSimSecPlugin/Inc/GSSimSecPlugin.rh Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/GSSimSecPlugin/Inc/GSSimSecPluginContainer.h --- a/securitydialogs/SecUi/GSSimSecPlugin/Inc/GSSimSecPluginContainer.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/GSSimSecPlugin/Inc/GSSimSecPluginModel.h --- a/securitydialogs/SecUi/GSSimSecPlugin/Inc/GSSimSecPluginModel.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/GSSimSecPlugin/Inc/MGSSettingPSObserver.h --- a/securitydialogs/SecUi/GSSimSecPlugin/Inc/MGSSettingPSObserver.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/GSSimSecPlugin/Src/GSPubSubsListener.cpp --- a/securitydialogs/SecUi/GSSimSecPlugin/Src/GSPubSubsListener.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/GSSimSecPlugin/Src/GSSimSecPlugin.cpp --- a/securitydialogs/SecUi/GSSimSecPlugin/Src/GSSimSecPlugin.cpp Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,806 +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 ); - 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 ); - - if ( dlg->ExecuteLD( R_CUG_INDEX ) ) - { - // 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 ); - } - - -// --------------------------------------------------------------------------- -// 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 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/GSSimSecPlugin/Src/GSSimSecPluginContainer.cpp --- a/securitydialogs/SecUi/GSSimSecPlugin/Src/GSSimSecPluginContainer.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/GSSimSecPlugin/Src/GSSimSecPluginImplementationTable.cpp --- a/securitydialogs/SecUi/GSSimSecPlugin/Src/GSSimSecPluginImplementationTable.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/GSSimSecPlugin/Src/GSSimSecPluginModel.cpp --- a/securitydialogs/SecUi/GSSimSecPlugin/Src/GSSimSecPluginModel.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/GSSimSecPlugin/loc/gssecurity.loc --- a/securitydialogs/SecUi/GSSimSecPlugin/loc/gssecurity.loc Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/Inc/SecQueryUi.h --- a/securitydialogs/SecUi/Inc/SecQueryUi.h Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/SecUi/Inc/SecQueryUi.h Fri Jun 11 14:28:40 2010 +0300 @@ -45,6 +45,34 @@ 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). @@ -206,7 +234,7 @@ TInt iCompletionCode; TInt iReturnValue; public: - RMobilePhone::TMobilePassword iPassword; + TSecUiPassword iPassword; }; diff -r 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/Inc/SecUiAutoLockSettingPage.h --- a/securitydialogs/SecUi/Inc/SecUiAutoLockSettingPage.h Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/SecUi/Inc/SecUiAutoLockSettingPage.h Fri Jun 11 14:28:40 2010 +0300 @@ -23,7 +23,7 @@ #include #include -class CAutoLockSettingPage : public CAknRadioButtonSettingPage +class CAutoLockSettingPage : public CBase { public: /** @@ -59,7 +59,7 @@ void HandlePointerEventL(const TPointerEvent& aPointerEvent); private: // data - CEikButtonGroupContainer* iPopoutCba; + // CEikButtonGroupContainer* iPopoutCba; TInt& iAutoLockValue; TInt iMaximum; TInt iOriginalIndex; diff -r 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/Inc/SecUiWait.h --- a/securitydialogs/SecUi/Inc/SecUiWait.h Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/SecUi/Inc/SecUiWait.h Fri Jun 11 14:28:40 2010 +0300 @@ -20,12 +20,6 @@ #ifndef __SECUIWAIT_H #define __SECUIWAIT_H -#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 - // INCLUDES #include @@ -82,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 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/Src/SecQueryUi.cpp --- a/securitydialogs/SecUi/Src/SecQueryUi.cpp Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecQueryUi.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -24,7 +24,7 @@ #include #include -#include "SecUiWait.h" +#include "SecUi.h" const TUid KSWInstHelpUid = { diff -r 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/Src/SecUi.cpp --- a/securitydialogs/SecUi/Src/SecUi.cpp Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUi.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -24,9 +24,6 @@ #include "secui.h" #include -_LIT(KDirAndFile,"z:SecUi.rsc"); - - // ================= MEMBER FUNCTIONS ======================= // // ---------------------------------------------------------- @@ -38,20 +35,18 @@ { 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++; 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(); } @@ -65,17 +60,13 @@ { if (Dll::Tls()==NULL) 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 +80,6 @@ // TSecUi::TSecUi() { - } // // ---------------------------------------------------------- @@ -99,10 +89,6 @@ // TSecUi::~TSecUi() { - if (iResourceFileOffset >= 0) - { - CEikonEnv::Static()->DeleteResourceFile(iResourceFileOffset); - } } // // ---------------------------------------------------------- @@ -112,25 +98,8 @@ // void TSecUi::ConstructL() { - iResourceFileOffset = CCoeEnv::Static()->AddResourceFileL(ResourceFileName()); 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 +107,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 +125,7 @@ void TSecUi::IncreaseClientCount() { ++iClientCount; - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI): IncreaseClientCount, clients now(%d) "), iClientCount); - #endif + RDEBUG("iClientCount", iClientCount); } // ----------------------------------------------------------------------------- @@ -174,9 +136,7 @@ void TSecUi::DecreaseClientCount() { --iClientCount; - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI): DecreaseClientCount, clients now(%d) "), iClientCount); - #endif + RDEBUG("iClientCount", iClientCount); } diff -r 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/Src/SecUiAutoLockSettingPage.cpp --- a/securitydialogs/SecUi/Src/SecUiAutoLockSettingPage.cpp Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiAutoLockSettingPage.cpp Fri Jun 11 14:28: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,11 +45,6 @@ // void CAutoLockSettingPage::ConstructL() { - 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)); - FeatureManager::InitializeLibL(); } // @@ -76,8 +55,6 @@ // CAutoLockSettingPage::~CAutoLockSettingPage() { - delete iPopoutCba; - FeatureManager::UnInitializeLib(); } // @@ -88,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; - } - + } // // ---------------------------------------------------------- @@ -145,10 +75,6 @@ // void CAutoLockSettingPage::SetPeriodMaximumValue(TInt aMaximumValue) { - if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) - { - iMaximum = aMaximumValue; -} } //--------------------------------------------------------------------------------------- @@ -160,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 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/Src/SecUiCodeQueryControl.cpp --- a/securitydialogs/SecUi/Src/SecUiCodeQueryControl.cpp Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiCodeQueryControl.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -16,7 +16,7 @@ * * */ - +#include #include #include #include diff -r 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/Src/SecUiCodeQueryDialog.cpp --- a/securitydialogs/SecUi/Src/SecUiCodeQueryDialog.cpp Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiCodeQueryDialog.cpp Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/Src/SecUiManualSecuritySettings.cpp --- a/securitydialogs/SecUi/Src/SecUiManualSecuritySettings.cpp Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiManualSecuritySettings.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -18,10 +18,11 @@ #include -#include +#include "SecQueryUi.h" #include "secuimanualsecuritysettings.h" #include "secuisecuritysettings.h" #include +#include "SecUi.h" #include "SecUiWait.h" #include /***************************************************** @@ -108,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 ); } @@ -133,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 @@ -158,9 +156,7 @@ } delete iNote; delete iWait; - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::~CManualSecuritySettings() END")); - #endif + RDEBUG("0", 0); } // @@ -175,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); @@ -193,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; @@ -211,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 @@ -236,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: @@ -268,7 +253,9 @@ else { iCustomPhone.CheckSecurityCode(iWait->iStatus,RMmCustomAPI::ESecurityCodePuk2); + RDEBUG("WaitForRequestL", 0); TInt res = iWait->WaitForRequestL(); + RDEBUG("WaitForRequestL res", res); } break; case KErrGsm0707OperationNotAllowed: @@ -289,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; } @@ -307,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 @@ -327,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) { @@ -369,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; } @@ -387,20 +370,14 @@ * 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 - - if(aLockCode.Length() <= KSimLockMaxPasswordSize) + RDEBUG("length", length); + // from now on, it accepts all lenghts, because some locks are 20, others are 13 + // if(aLockCode.Length() <= KSimLockMaxPasswordSize) { if (aType.CompareF(Operator) == 0) { @@ -439,9 +416,7 @@ } } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::LockSimL() RESULT: %d"), ret); - #endif + RDEBUG("ret", ret); switch (ret) { case KErrNone: @@ -476,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; } @@ -494,17 +467,14 @@ * 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 - if(aUnlockCode.Length() <= KSimLockMaxPasswordSize) + RDEBUG("length", length); + // from now on, it accepts all lenghts, because some locks are 20, others are 13 + // if(aUnlockCode.Length() <= KSimLockMaxPasswordSize) { if (aType.CompareF(Operator) == 0) { @@ -548,9 +518,7 @@ } } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::UnLockSimL() RESULT: %d"), ret); - #endif + RDEBUG("ret", ret); switch (ret) { case KErrNone: @@ -583,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; } @@ -598,9 +564,7 @@ // void CManualSecuritySettings::ShowResultNoteL(CAknNoteDialog::TTone aTone, TInt aResourceID) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::CancelUnLockSimL()")); - #endif + RDEBUG("aResourceID", aResourceID); CSecuritySettings::ShowResultNoteL(aResourceID, aTone); } diff -r 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp --- a/securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -15,10 +15,10 @@ * * */ - +#include #include #include -#include +// #include #include #include @@ -40,14 +40,13 @@ #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 @@ -151,15 +150,11 @@ switch (aEvent) { case RMobilePhone::EPin1Required: -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::HandleEventL() Pin1Required")); -#endif + RDEBUG("RMobilePhone::EPin1Required", 0); aResult = Pin1RequiredL(); break; case RMobilePhone::EPuk1Required: -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::HandleEventL() PUK1Required")); -#endif + RDEBUG("RMobilePhone::EPuk1Required", 0); Puk1RequiredL(); break; case RMobilePhone::EPin2Required: @@ -191,6 +186,7 @@ SimLockEventL(); break; default: + RDEBUG("default", aEvent); break; } RDEBUG("aResult", aResult); @@ -207,9 +203,7 @@ * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeL()")); -#endif + 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 = @@ -265,7 +259,7 @@ SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, ESecUiSecretSupported | lAlphaSupported | lCancelSupported - | secCodeType /*aMode*/); + | secCodeType ); RDEBUG("iSecUi_password", 0); RDebug::Print(iSecUi_password); RDEBUG("delete", 0); @@ -352,14 +346,12 @@ // ---------------------------------------------------------- // CSecurityHandler::CancelSecCodeQuery() // Cancels PIN2 and security code queries -// TODO is this used? +// this is used by rfsHandler // ---------------------------------------------------------- // qtdone EXPORT_C void CSecurityHandler::CancelSecCodeQuery() { -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::CancelSecCodeQuery()")); -#endif + RDEBUG("iQueryCanceled", iQueryCanceled); if (!iQueryCanceled) { iQueryCanceled = ETrue; @@ -587,7 +579,10 @@ RDEBUG("StartUp", StartUp); RDEBUG("err", err); if (!StartUp) + { + RDebug::Printf( "%s %s (%u) Leaving because StartUp=0 and err=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, err ); User::LeaveIfError(err); + } TBool isConditionSatisfied = EFalse; TInt tarmFlag = 0; if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) @@ -597,16 +592,11 @@ if (tRet != KErrNone) { -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL():\ - Warning: failed to get TARM Admin Flag state")); -#endif + RDEBUG("Warning: failed to get TARM Admin Flag state", tRet); } else { -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL(): TARM flag: %d"), tarmFlag ); -#endif + RDEBUG("TARM flag", tarmFlag); } if ((StartUp) || (tarmFlag & KSCPFlagResyncQuery)) @@ -619,8 +609,7 @@ } // Security code at bootup: No "cancel" softkey; Emergency calls enabled. - RMobilePhone::TMobilePhoneSecurityCode secCodeTypeToAsk = - RMobilePhone::ESecurityCodePhonePassword; // for starters + RMobilePhone::TMobilePhoneSecurityCode secCodeTypeToAsk = RMobilePhone::ESecurityCodePhonePassword; RDEBUG("isConditionSatisfied", isConditionSatisfied); if (isConditionSatisfied) { @@ -646,7 +635,6 @@ TInt lType = ESecUiSecretSupported | ESecUiAlphaSupported | lCancelSupported | lEmergencySupported | secCodeTypeToAsk; RDEBUG("lType", lType); - iSecUi_password.Copy(_L("12345")); queryAccepted = iSecQueryUi->SecQueryDialog(_L("PassPhraseRequiredL"), iSecUi_password, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, lType); @@ -664,9 +652,7 @@ RDEBUG("wasCancelledOrEmergency", wasCancelledOrEmergency); if (wasCancelledOrEmergency) { -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() DIALOG ERROR")); -#endif + RDEBUG("StartUp", StartUp); if (!StartUp) { RDEBUG("AbortSecurityCode", 0); @@ -738,7 +724,9 @@ KFeatureIdSapDeviceLockEnhancements); RSCPClient scpClient; RDEBUG("scpClient.Connect", 0); - User::LeaveIfError(scpClient.Connect()); + TInt tRet = scpClient.Connect(); + RDEBUG("tRet", tRet); + User::LeaveIfError(tRet); RDEBUG("scpClient.Connect", 1); CleanupClosePushL(scpClient); TSCPSecCode newCode; @@ -776,8 +764,7 @@ // disable autolock in Domestic OS side too if autolock period is 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 ); @@ -808,23 +795,12 @@ delete remoteLockSettings; remoteLockSettings = NULL; -#else // not defined RD_REMOTELOCK - RDEBUG("iCustomPhone.DisablePhoneLock", 0); - wait = CWait::NewL(); - iCustomPhone.DisablePhoneLock(wait->iStatus, - iSecUi_password); - RDEBUG( "WaitForRequestL", 0 ); - status = wait->WaitForRequestL(); - RDEBUG( "WaitForRequestL status", status ); - delete wait; -#endif // RD_REMOTELOCK } } else // error getting repository { RDEBUG("error getting repository", 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 ); @@ -853,18 +829,6 @@ delete remoteLockSettings; remoteLockSettings = NULL; -#else // not defined RD_REMOTELOCK - // could not get the current autolock time... disable autolock in Domestic OS side. - RDEBUG("iCustomPhone.DisablePhoneLock", 0); - wait = CWait::NewL(); - iCustomPhone.DisablePhoneLock(wait->iStatus, - iSecUi_password); - RDEBUG( "WaitForRequestL", 0 ); - status = wait->WaitForRequestL(); - RDEBUG( "WaitForRequestL status", status ); - delete wait; - -#endif // RD_REMOTELOCK } } // no Startup @@ -873,9 +837,7 @@ 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; @@ -965,7 +927,6 @@ res=KErrNone; codeInfo.iRemainingEntryAttempts=3; #endif - User::LeaveIfError(res); RDEBUG("codeInfo.iRemainingEntryAttempts", @@ -1072,6 +1033,8 @@ // ---------------------------------------------------------- // 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() @@ -1080,12 +1043,10 @@ * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL()")); -#endif + RDEBUG("0", 0); TInt queryAccepted = KErrCancel; - RMobilePhone::TMobilePassword iSecUi_password; - RMobilePhone::TMobilePassword aNewPassword; + RMobilePhone::TMobilePassword puk1_password; + RMobilePhone::TMobilePassword aNewPinPassword; RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); RMobilePhone::TMobilePhoneSecurityCode blockCodeType; @@ -1096,7 +1057,7 @@ TBool StartUp(ETrue); StartUp = iStartup; - TInt res(KErrNone); + TInt res(KErrCancel); // for the first try wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); TInt thisTry = 0; @@ -1112,17 +1073,13 @@ res = wait->WaitForRequestL(); RDEBUG("WaitForRequestL res", res); } -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Get Code info result: %d"), res); -#endif + 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 - 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 @@ -1131,12 +1088,9 @@ CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); - if (attempts == KMaxNumberOfPINAttempts) attempts = -1; - // ask PUK code - /* request PIN using QT */ CSecQueryUi *iSecQueryUi; RDEBUG("CSecQueryUi", 0); iSecQueryUi = CSecQueryUi::NewL(); @@ -1148,23 +1102,69 @@ title.Append(_L("Puk1RequiredL")); title.Append(_L("#")); title.AppendNum(attempts); - queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, + TInt lSecUiCancelSupported = ESecUiCancelSupported | ESecUiEmergencyNotSupported; + if(StartUp) // TODO 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 - | ESecUiCancelSupported | ESecUiPukRequired); - RDEBUG("iSecUi_password", 0); - RDebug::Print(iSecUi_password); + | lSecUiCancelSupported | ESecUiPukRequired); + RDEBUG("puk1_password", 0); + RDebug::Print(puk1_password); delete iSecQueryUi; RDEBUG("queryAccepted", queryAccepted); if ((queryAccepted == KErrAbort) || (queryAccepted == KErrCancel)) { - CleanupStack::PopAndDestroy(wait); // TODO this is needed ??? + 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) { - // new pin code query + 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 + // TODO 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(); @@ -1173,12 +1173,12 @@ // TODO also support Emergency queryAccepted = iSecQueryUi->SecQueryDialog( - _L("Puk1-New|Puk1-Verif"), aNewPassword, - SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, + _L("PIN1-New|PIN1-Verif"), aNewPinPassword, + SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported | ESecUiPukRequired); - RDEBUG("aNewPassword", 0); - RDebug::Print(aNewPassword); + RDEBUG("aNewPinPassword", 0); + RDebug::Print(aNewPinPassword); delete iSecQueryUi; RDEBUG("queryAccepted", queryAccepted); } @@ -1189,16 +1189,16 @@ return KErrCancel; } - // send code + // send code again, now with the user pin RDEBUG("VerifySecurityCode", 0); - iPhone.VerifySecurityCode(wait->iStatus, blockCodeType, aNewPassword, - iSecUi_password); + iPhone.VerifySecurityCode(wait->iStatus, blockCodeType, aNewPinPassword, + puk1_password); RDEBUG("WaitForRequestL", 0); res = wait->WaitForRequestL(); RDEBUG("WaitForRequestL res", res); CleanupStack::PopAndDestroy(wait); - TInt returnValue = res; + returnValue = res; switch (res) { case KErrNone: @@ -1226,7 +1226,7 @@ returnValue = Puk1RequiredL(); break; } - + RDEBUG("returnValue", returnValue); return returnValue; } // @@ -1242,9 +1242,7 @@ * Series 60 ETel API *****************************************************/ -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL() BEGIN")); -#endif + RDEBUG("0", 0); TInt queryAccepted = KErrCancel; RMobilePhone::TMobilePassword iSecUi_password; RMobilePhone::TMobilePassword required_fourth; @@ -1261,7 +1259,6 @@ RDEBUG("WaitForRequestL", 0); TInt ret = wait->WaitForRequestL(); RDEBUG("WaitForRequestL ret", ret); - User::LeaveIfError(ret); RDEBUG("codeInfo.iRemainingEntryAttempts", @@ -1329,9 +1326,6 @@ CSecuritySettings::ShowErrorNoteL(status); break; } -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): END")); -#endif } // // ---------------------------------------------------------- @@ -1345,6 +1339,7 @@ * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ + RDEBUG("0", 0); TInt queryAccepted = KErrCancel; RMobilePhone::TMobilePassword iSecUi_password; RMobilePhone::TMobilePassword aNewPassword; @@ -1357,9 +1352,6 @@ CWait* wait = CWait::NewL(); CleanupStack::PushL(wait); -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Puk2RequiredL()")); -#endif // ask PUK2 TInt ret(KErrNone); @@ -1392,7 +1384,7 @@ queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PUK2_CODE_MIN_LENGTH, SEC_C_PUK2_CODE_MAX_LENGTH, ESecUiSecretNotSupported | ESecUiAlphaNotSupported - | ESecUiCancelSupported | secCodeType /*aMode*/); + | ESecUiCancelSupported | secCodeType ); RDEBUG("iSecUi_password", 0); RDebug::Print(iSecUi_password); delete iSecQueryUi; @@ -1408,8 +1400,45 @@ return; } + 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) { - // new pin code query + 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; + } + + // now the PUK2 is valid. Time to get the new PIN2 + wait = CWait::NewL(); + CleanupStack::PushL(wait); + { + // new pin2 code query CSecQueryUi * iSecQueryUi; RDEBUG("CSecQueryUi", 0); iSecQueryUi = CSecQueryUi::NewL(); @@ -1417,9 +1446,9 @@ // TODO also support Emergency queryAccepted - = iSecQueryUi->SecQueryDialog(_L("Puk2-New|Puk2-Verif"), - aNewPassword, SEC_C_PUK2_CODE_MIN_LENGTH, - SEC_C_PUK2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported + = iSecQueryUi->SecQueryDialog(_L("PIN2-New|PIN2-Verif"), + aNewPassword, SEC_C_PIN2_CODE_MIN_LENGTH, + SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported | secCodeType); RDEBUG("aNewPassword", 0); RDebug::Print(aNewPassword); @@ -1441,7 +1470,7 @@ iPhone.VerifySecurityCode(wait->iStatus, secCodeType, aNewPassword, iSecUi_password); RDEBUG("WaitForRequestL", 0); - TInt res = wait->WaitForRequestL(); + res = wait->WaitForRequestL(); RDEBUG("WaitForRequestL res", res); CleanupStack::PopAndDestroy(wait); @@ -1487,6 +1516,8 @@ TBool wcdmaSupported( FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma)); TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin)); + RDEBUG("wcdmaSupported", wcdmaSupported); + RDEBUG("upinSupported", upinSupported); if (wcdmaSupported || upinSupported) { TInt queryAccepted = KErrCancel; @@ -1570,9 +1601,7 @@ { 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; @@ -1590,13 +1619,13 @@ case KErrLocked: // code blocked; show error note and terminate. if (StartUp) - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, + CSecuritySettings::ShowResultNoteL(res, CAknNoteDialog::EErrorTone); break; case KErrGsm0707SimWrong: // sim lock active break; - default: + default: // for example, KErrArgument CSecuritySettings::ShowErrorNoteL(res); if (StartUp) { @@ -1783,16 +1812,7 @@ RDEBUG("aStatus", aStatus); RDEBUG("!!!!! this should never be called !!!!", 0); - 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); + CSecuritySettings::ShowResultNoteL(aStatus, CAknNoteDialog::EErrorTone); } // End of file diff -r 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/Src/SecUiSecuritySettings.cpp --- a/securitydialogs/SecUi/Src/SecUiSecuritySettings.cpp Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiSecuritySettings.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -30,19 +29,16 @@ #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 "SecUiRemoteLockSettingPage.h" -#endif // RD_REMOTELOCK #include #include "SecQueryUi.h" @@ -102,15 +98,13 @@ * Needs customer TSY implementation *****************************************************/ + 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 FeatureManager::InitializeLibL(); // connect to ETel server @@ -161,9 +155,7 @@ // Cancel active requests if (iWait->IsActive()) { -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CManualSecuritySettings::~CSecuritySettings() CANCEL REQ")); -#endif + RDEBUG("CancelAsyncRequest", 0); iPhone.CancelAsyncRequest(iWait->GetRequestType()); switch (iWait->GetRequestType()) @@ -320,21 +312,8 @@ RDEBUG("aRemoteLockStatus", aRemoteLockStatus); RDEBUG("aAutoLockPeriod", aAutoLockPeriod); - TInt currentItem( 0 ); - if ( aRemoteLockStatus ) { - currentItem = KRemoteLockSettingItemOn; - } - else - { - currentItem = KRemoteLockSettingItemOff; - } - RDEBUG("currentItem", currentItem); - - if ( currentItem == KRemoteLockSettingItemOn ) - { - RDEBUG("KRemoteLockSettingItemOn", KRemoteLockSettingItemOn); aRemoteLockStatus = ETrue; // If user wishes to enable remote lock @@ -342,9 +321,8 @@ // RemoteLockCodeQueryL also retValue = RemoteLockCodeQueryL( aRemoteLockCode ); } - else if ( currentItem == KRemoteLockSettingItemOff ) + else { - RDEBUG("KRemoteLockSettingItemOff", KRemoteLockSettingItemOff); aRemoteLockStatus = EFalse; retValue = KErrNone; // TODO this should calculate aAutoLockPeriod itself, and not trust the input @@ -374,14 +352,25 @@ // 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. // ---------------------------------------------------------- // no qtdone TInt CSecuritySettings::RemoteLockCodeQueryL(TDes& aRemoteLockCode) { -#ifdef RD_REMOTELOCK + 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; @@ -401,21 +390,14 @@ if (queryAccepted != KErrNone) return KErrAbort; - // TODO it should ask first for the code, and _later_ for the RemoteMsg - - // ----- 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; + // 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 - RDEBUG( "RMobilePhone::KMaxMobilePasswordSize", RMobilePhone::KMaxMobilePasswordSize ); securityCode = aRemoteLockCode; + RDEBUG( "EMobilePhoneVerifySecurityCode", EMobilePhoneVerifySecurityCode ); iWait->SetRequestType( EMobilePhoneVerifySecurityCode ); RDEBUG( "VerifySecurityCode", 0 ); iPhone.VerifySecurityCode( iWait->iStatus, secCodeType, securityCode, unblockCode ); @@ -424,32 +406,21 @@ RDEBUG( "WaitForRequestL res", res ); #ifdef __WINS__ if (res == KErrNotSupported || res == KErrTimedOut) - res = KErrNone; + res = 0xffffec50; // TODO this means KErrGsm0707IncorrectPassword = incorrect code #endif - if(res != KErrNone) + RDEBUG( "KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword ); + if(res == KErrNone) { - // The remote lock code matches the security code + // 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( "res", res ); - return res; + RDEBUG( "return KErrCancel because msg matches code", KErrCancel ); + ShowResultNoteL(R_REMOTELOCK_INVALID_CODE, CAknNoteDialog::EErrorTone); + return KErrCancel; } - // ----- 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 ); - } -RDEBUG( "retValue", retValue ); -#ifdef _DEBUG - RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Exit" ) ); -#endif // _DEBUG + RDEBUG( "retValue", retValue ); return retValue; -#else //! RD_REMOTELOCK - return KErrNotSupported; -#endif //RD_REMOTELOCK } // // ---------------------------------------------------------- @@ -463,9 +434,34 @@ 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; @@ -474,7 +470,7 @@ { lockSetting = RMobilePhone::ELockSetDisabled; } - RDEBUG("lockSetting", lockSetting); + RDEBUG("future lockSetting", lockSetting); iWait->SetRequestType( EMobilePhoneSetLockSetting ); RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); @@ -524,10 +520,7 @@ * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeSimSecurityL()")); -#endif - + RDEBUG("0", 0); RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneToICC; @@ -550,12 +543,9 @@ #endif User::LeaveIfError(status); TInt currentItem = 0; - + RDEBUG("lockInfo.iSetting", lockInfo.iSetting); if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) { -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeSimSecurityL()lockInfo: ELockSetDisabled")); -#endif currentItem = 1; // off } @@ -583,9 +573,7 @@ #endif // the error was displayed in the handler -#if defined(_DEBUG) - RDebug::Print( _L("(SECUI)CSecuritySettings::ChangeSimSecurityL(): RETURN CODE: %d"), status); -#endif + RDEBUG("status", status); switch (status) { case KErrNone: @@ -652,12 +640,10 @@ TBool wcdmaSupported( FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma)); TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin)); + RDEBUG("wcdmaSupported", wcdmaSupported); + RDEBUG("upinSupported", upinSupported); if (wcdmaSupported || upinSupported) { -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinRequestL()")); -#endif - TInt simState; TInt err(KErrGeneral); err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); @@ -692,33 +678,21 @@ User::LeaveIfError(status); TInt currentItem = 0; -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinRequestL() GetLockInfo")); -#endif - + RDEBUG("lockInfo.iSetting", lockInfo.iSetting); if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) { -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinRequestL() lockInfo: ELockSetDisabled")); -#endif currentItem = 1; // off } if (currentItem == 0) // switch the flag { -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinRequestL() currentItem: ELockSetDisabled")); -#endif lockChangeSetting = RMobilePhone::ELockSetDisabled; } else { -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinRequestL() currentItem: ELockSetEnabled")); -#endif 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, @@ -734,7 +708,7 @@ RDEBUG("WaitForRequestL status", status); // Lower the flag RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, - ESecurityUIsETelAPIOriginated); + ESecurityUIsSecUIOriginatedUninitialized); #ifdef __WINS__ if (status == KErrNotSupported || status == KErrTimedOut) status = KErrNone; @@ -794,12 +768,10 @@ TBool wcdmaSupported( FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma)); TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin)); + RDEBUG("wcdmaSupported", wcdmaSupported); + RDEBUG("upinSupported", upinSupported); 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); @@ -823,9 +795,7 @@ RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() GetLockInfo")); -#endif + RDEBUG("EMobilePhoneGetLockInfo", EMobilePhoneGetLockInfo); iWait->SetRequestType(EMobilePhoneGetLockInfo); if (activeCode == RMobilePhone::ESecurityUniversalPin) @@ -856,11 +826,10 @@ } // code request must be ON to change active code. + RDEBUG("lockInfo.iSetting", lockInfo.iSetting); 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, @@ -870,41 +839,26 @@ { 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; } iCustomPhone.GetActivePin(activeCode); TInt currentItem = 0; -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() GetLockInfo")); -#endif - + RDEBUG("activeCode", activeCode); if (activeCode == RMobilePhone::ESecurityUniversalPin) { -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() active code: UPIN")); -#endif currentItem = 1; // UPIN } - if (currentItem == 0) // switch the flag { -#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; } + RDEBUG("lockType", lockType); // Raise a flag to indicate that the code // request coming from ETEL has originated from SecUi and not from Engine. @@ -921,7 +875,7 @@ RDEBUG("WaitForRequestL status", status); // Lower the flag RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, - ESecurityUIsETelAPIOriginated); + ESecurityUIsSecUIOriginatedUninitialized); #ifdef __WINS__ if (status == KErrNotSupported || status == KErrTimedOut) status = KErrNone; @@ -1162,9 +1116,7 @@ * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::SetFdnModeL()")); -#endif + RDEBUG("0", 0); RMmCustomAPI::TSecurityCodeType secCodeType = RMmCustomAPI::ESecurityCodePin2; @@ -1230,9 +1182,7 @@ status = KErrNone; #endif -#if defined(_DEBUG) - RDebug::Print( _L("(SECUI)CSecuritySettings::SetFdnModeL(): RETURN CODE: %d"), status); -#endif + RDEBUG("status", status); switch (status) { case KErrNone: @@ -1270,9 +1220,7 @@ * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::GetFdnMode()")); -#endif + RDEBUG("0", 0); return iPhone.GetFdnStatus(aFdnMode); } @@ -1300,12 +1248,6 @@ { RDEBUG("aResourceID", aResourceID); - /* - CAknNoteDialog* noteDlg = new (ELeave) CAknNoteDialog(REINTERPRET_CAST(CEikDialog**,¬eDlg)); - noteDlg->SetTimeout(CAknNoteDialog::ELongTimeout); - noteDlg->SetTone(aTone); - noteDlg->ExecuteLD(aResourceID); - */ CHbDeviceMessageBoxSymbian* messageBox = CHbDeviceMessageBoxSymbian::NewL( CHbDeviceMessageBoxSymbian::EWarning); @@ -1441,6 +1383,10 @@ 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; default: // " " titleTr.Append(_L("Specific Error")); @@ -1476,12 +1422,10 @@ FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma)); TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin)); TBool isSupported = EFalse; + RDEBUG("wcdmaSupported", wcdmaSupported); + RDEBUG("upinSupported", upinSupported); if (wcdmaSupported || upinSupported) { -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported() BEGIN")); -#endif - RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; //get lock info @@ -1495,15 +1439,12 @@ RDEBUG("WaitForRequestL res", res); if ((res == KErrNotSupported) || (res == KErrGsmInvalidParameter)) { -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported(): NOT SUPPORTED")); -#endif + RDEBUG("0", 0); isSupported = EFalse; } else { - RDEBUG("0", 0); - + RDEBUG("1", 1); isSupported = ETrue; } } @@ -1593,14 +1534,12 @@ User::LeaveIfError(err); TBool simRemoved(simState == ESimNotPresent); + RDEBUG("simRemoved", simRemoved); if (simRemoved) { ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); return KErrAccessDenied; } -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinParamsL()")); -#endif RMobilePhone::TMobilePhoneSecurityCode secCodeType; secCodeType = RMobilePhone::ESecurityCodePin1; @@ -2214,9 +2153,6 @@ * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ -#if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeSecCodeParamsL()")); -#endif TInt res = KErrNone; TInt queryAccepted = KErrCancel; RMobilePhone::TMobilePassword newPassword; @@ -2355,7 +2291,7 @@ if (scpClient.Connect() == KErrNone) { RDEBUG("scpClient.StoreCode", 0); - /* + // this is the old method. Obsolete now // scpClient.StoreCode( newCode ); RArray aFailedPolicies; TDevicelockPolicies failedPolicy; @@ -2364,11 +2300,10 @@ RDEBUG( "retLockcode", retLockcode ); RDEBUG( "aFailedPolicies.Count()", aFailedPolicies.Count() ); for(TInt i=0; iSetRequestType(EMobilePhoneSetLockSetting); @@ -2664,7 +2585,7 @@ // Lower the flag RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, - ESecurityUIsETelAPIOriginated); + ESecurityUIsSecUIOriginatedUninitialized); switch (status) { diff -r 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/Src/SecUiSystemLock.cpp --- a/securitydialogs/SecUi/Src/SecUiSystemLock.cpp Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiSystemLock.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -22,7 +22,7 @@ #include #include "SecUiSystemLock.h" #include -#include +// #include #include #include "secuisecuritysettings.h" #include "SecUiWait.h" @@ -50,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(); @@ -64,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 @@ -143,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() @@ -152,6 +155,7 @@ * 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 @@ -160,17 +164,20 @@ CDevicelockAccessApi* iDevicelockAccess = CDevicelockAccessApi::NewL( ); RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); iDevicelockAccess->OfferDevicelock(); - // EnableDevicelock( EDevicelockManual ); + // 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); @@ -188,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 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/Src/SecUiWait.cpp --- a/securitydialogs/SecUi/Src/SecUiWait.cpp Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiWait.cpp Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/group/SecUi.mmp --- a/securitydialogs/SecUi/group/SecUi.mmp Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/SecUi/group/SecUi.mmp Fri Jun 11 14:28:40 2010 +0300 @@ -42,84 +42,26 @@ 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 - SOURCE 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 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/SecQueryUi.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 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) diff -r 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/group/bld.inf --- a/securitydialogs/SecUi/group/bld.inf Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/SecUi/group/bld.inf Fri Jun 11 14:28:40 2010 +0300 @@ -26,20 +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 -/* -Not any more. The settings are replaced by Qt-style plugins -../GSSimSecPlugin/GSSimSecPlugin.mmp -*/ diff -r 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/rom/GSSimSecPlugin.iby --- a/securitydialogs/SecUi/rom/GSSimSecPlugin.iby Thu May 27 13:44:17 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 - // Now replaced by a QT plugin - // ECOM_PLUGIN( GSSimSecPlugin.dll, 10207438.rsc ) - - #endif // RD_GS_RENOVATION - -#endif // GSSIMSECPLUGIN_IBY -// End of File diff -r 6b63ca65093a -r aad866c37519 securitydialogs/SecUi/rom/GSSimSecPluginResources.iby --- a/securitydialogs/SecUi/rom/GSSimSecPluginResources.iby Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +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 - - // Now replaced by a QT plugin - // data=DATAZ_\RESOURCE_FILES_DIR\GSSimSecPluginRsc.rsc RESOURCE_FILES_DIR\GSSimSecPluginRsc.rsc - - #endif // RD_GS_RENOVATION - -#endif // GSSIMSECPLUGINRESOURCES_IBY -// End of File diff -r 6b63ca65093a -r aad866c37519 securitydialogs/Securitynotifier/Src/SecurityNotifier.cpp --- a/securitydialogs/Securitynotifier/Src/SecurityNotifier.cpp Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/Securitynotifier/Src/SecurityNotifier.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -226,30 +226,29 @@ void CSecurityNotifier::GetParamsL(const TDesC8& aBuffer, TInt aReturnVal, const RMessagePtr2& aMessage) { #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) searching for autolocksrv.exe =%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x0 ); + 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 ) ); - TApaTask task( taskList.FindApp( _L("autolocksrv.exe" )) ); + TApaTask task( taskList.FindApp( KAutolockUid ) ); if ( !task.Exists() ) { #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) sutolocksrv.exe not running. Starting now=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x1 ); + 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("autolockarv.exe" ) ); + commandLine->SetExecutableNameL( _L("autolock.exe" ) ); commandLine->SetCommandL( EApaCommandRun ); // Try to launch the application. - User::LeaveIfError(ls.StartApp(*commandLine)); + TInt err = ls.StartApp(*commandLine); #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) autolocksrv.exe created=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x2 ); + RDebug::Printf( "%s %s (%u) autolock.exe err=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, err ); #endif CleanupStack::PopAndDestroy(2); // commandLine, ls diff -r 6b63ca65093a -r aad866c37519 securitydialogs/Securitynotifier/Src/Securitynotifierwrapper.cpp --- a/securitydialogs/Securitynotifier/Src/Securitynotifierwrapper.cpp Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/Securitynotifier/Src/Securitynotifierwrapper.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -18,7 +18,7 @@ #include - +#include #include // link against aknnotifierwrapper.lib #define KMyNotifierUid TUid::Uid(0x10005988) // uid diff -r 6b63ca65093a -r aad866c37519 securitydialogs/group/bld.inf --- a/securitydialogs/group/bld.inf Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/group/bld.inf Fri Jun 11 14:28:40 2010 +0300 @@ -24,10 +24,12 @@ 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" diff -r 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/cenrep/AutolockPrivateCRKeys.h --- a/securitydialogs/lockapp/cenrep/AutolockPrivateCRKeys.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/data/lockapp.rss --- a/securitydialogs/lockapp/data/lockapp.rss Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/data/lockapp_reg.rss --- a/securitydialogs/lockapp/data/lockapp_reg.rss Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/group/bld.inf --- a/securitydialogs/lockapp/group/bld.inf Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/lockapp/group/bld.inf Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/group/lockapp.mmp --- a/securitydialogs/lockapp/group/lockapp.mmp Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/lockapp/group/lockapp.mmp Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/group/lockapp_icons_dc.mk --- a/securitydialogs/lockapp/group/lockapp_icons_dc.mk Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockapp.hrh --- a/securitydialogs/lockapp/inc/lockapp.hrh Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockappapplication.h --- a/securitydialogs/lockapp/inc/lockappapplication.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockappappui.h --- a/securitydialogs/lockapp/inc/lockappappui.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockappbasecontrol.h --- a/securitydialogs/lockapp/inc/lockappbasecontrol.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockappcenrepobserver.h --- a/securitydialogs/lockapp/inc/lockappcenrepobserver.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockappdevicelockcontainer.h --- a/securitydialogs/lockapp/inc/lockappdevicelockcontainer.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockappdevicelockcontrol.h --- a/securitydialogs/lockapp/inc/lockappdevicelockcontrol.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockappdocument.h --- a/securitydialogs/lockapp/inc/lockappdocument.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockappecsdetector.h --- a/securitydialogs/lockapp/inc/lockappecsdetector.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockappecsnote.h --- a/securitydialogs/lockapp/inc/lockappecsnote.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockappidlecontrol.h --- a/securitydialogs/lockapp/inc/lockappidlecontrol.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockappkeycapturecontroller.h --- a/securitydialogs/lockapp/inc/lockappkeycapturecontroller.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockappkeyguardcontrol.h --- a/securitydialogs/lockapp/inc/lockappkeyguardcontrol.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockappkeypattern.h --- a/securitydialogs/lockapp/inc/lockappkeypattern.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockapplockednote.h --- a/securitydialogs/lockapp/inc/lockapplockednote.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockappobserverinterface.h --- a/securitydialogs/lockapp/inc/lockappobserverinterface.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockappobserverlist.h --- a/securitydialogs/lockapp/inc/lockappobserverlist.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockapppubsubobserver.h --- a/securitydialogs/lockapp/inc/lockapppubsubobserver.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockappserver.h --- a/securitydialogs/lockapp/inc/lockappserver.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockappsession.h --- a/securitydialogs/lockapp/inc/lockappsession.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockappsleepingnote.h --- a/securitydialogs/lockapp/inc/lockappsleepingnote.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockappstatecontrol.h --- a/securitydialogs/lockapp/inc/lockappstatecontrol.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockappstatecontrolinterface.h --- a/securitydialogs/lockapp/inc/lockappstatecontrolinterface.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockappstateobserver.h --- a/securitydialogs/lockapp/inc/lockappstateobserver.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockappstatepublisher.h --- a/securitydialogs/lockapp/inc/lockappstatepublisher.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockapptrace.h --- a/securitydialogs/lockapp/inc/lockapptrace.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockapptraceconfiguration.hrh --- a/securitydialogs/lockapp/inc/lockapptraceconfiguration.hrh Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockapputils.h --- a/securitydialogs/lockapp/inc/lockapputils.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/inc/lockappwait.h --- a/securitydialogs/lockapp/inc/lockappwait.h Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/loc/lockapp.loc --- a/securitydialogs/lockapp/loc/lockapp.loc Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/pubsub/SecurityUIsPrivatePSKeys.h --- a/securitydialogs/lockapp/pubsub/SecurityUIsPrivatePSKeys.h Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,116 +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 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 - { - ESecurityUIsQueryRequestUninitialized = 0, - ESecurityUIsQueryRequestOk, - ESecurityUIsQueryRequestCanceled - }; - -/** - * 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/rom/lockapp.iby --- a/securitydialogs/lockapp/rom/lockapp.iby Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/lockapp/rom/lockapp.iby Fri Jun 11 14:28: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,21 +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_EXE(lockapp) -S60_APP_EXE_UDEB(lockapp) -S60_APP_AIF_RSC(lockapp) - -// To enable updating -data=ZSYSTEM\install\lockapp_stub.sis system\install\lockapp_stub.sis - -#endif // __LOCKAPP_IBY__ +#endif diff -r 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/rom/lockappresources.iby --- a/securitydialogs/lockapp/rom/lockappresources.iby Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/sis/lockapp.pkg --- a/securitydialogs/lockapp/sis/lockapp.pkg Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/sis/lockapp_stub.sis Binary file securitydialogs/lockapp/sis/lockapp_stub.sis has changed diff -r 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/sis/make_stubsis.bat --- a/securitydialogs/lockapp/sis/make_stubsis.bat Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/sis/rd-key.pem --- a/securitydialogs/lockapp/sis/rd-key.pem Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/sis/rd.cer --- a/securitydialogs/lockapp/sis/rd.cer Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/src/lockappapplication.cpp --- a/securitydialogs/lockapp/src/lockappapplication.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/src/lockappappui.cpp --- a/securitydialogs/lockapp/src/lockappappui.cpp Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,212 +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( ) - { - // RDebug::Printf( "%s %s (%u) 1 value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x8 ); - - 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 - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x1 ); - TApaTaskList taskList( iCoeEnv->WsSession() ); - TApaTask task( taskList.FindApp( _L("autolocksrv.exe" )) ); - if ( !task.Exists() ) - { - RApaLsSession ls; - User::LeaveIfError(ls.Connect()); - CleanupClosePushL(ls); - - CApaCommandLine* commandLine = CApaCommandLine::NewLC(); - commandLine->SetExecutableNameL( _L("autolocksrv.exe" ) ); - commandLine->SetCommandL( EApaCommandRun ); - - // Try to launch the application. - User::LeaveIfError(ls.StartApp(*commandLine)); - RDebug::Printf( "%s %s (%u) Start: autolocksrv.exe created=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x7 ); - - CleanupStack::PopAndDestroy(2); // commandLine, ls - } - } - - INFO( "CLockAppAppUi::ConstructL started" ); - // default appui constructor has to be called - BaseConstructL( ); - if(use_old_autolock) - { - Exit(); - } - - - // 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 ); - INFO( "CLockAppAppUi::ConstructL finished" ); - } - -// --------------------------------------------------------------------------- -// 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 ) ) - { - INFO( "CLockAppAppUi::HandleMessageL(): Admin command received, unlocking" ); - iStateControl->DisableDevicelockL(); - } - else - { - INFO( "CLockAppAppUi::HandleMessageL(): Unauthorized attempt to unlock" ); - } - CleanupStack::PopAndDestroy(); // calls Close() on scpClient - } - else - { - INFO( "CLockAppAppUi::HandleMessageL(): Failed to connect to SCP, ignoring unlock-message." ); - } - } - 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 ) - { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - if ( aEvent.Type() == TRawEvent::EKeyDown ) - { - RDebug::Printf("CLockAppAppUi::HandleWsEventL() - aEvent.Key()->iCode: %d", aEvent.Key()->iCode ); - } - - // 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/src/lockappbasecontrol.cpp --- a/securitydialogs/lockapp/src/lockappbasecontrol.cpp Thu May 27 13:44:17 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()) - { - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - } - -// --------------------------------------------------------------------------- -// Second phase constructor. -// --------------------------------------------------------------------------- -void CLockAppBaseControl::ConstructL( ) - { - RDebug::Printf( "%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 ) - { - RDebug::Printf( "%s %s (%u) aCapture=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aCapture ); - RDebug::Printf( "%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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/src/lockappcenrepobserver.cpp --- a/securitydialogs/lockapp/src/lockappcenrepobserver.cpp Thu May 27 13:44:17 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 -RDebug::Printf( "%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 ) - { - RDebug::Printf( "%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 ) - { -RDebug::Printf( "%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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/src/lockappdevicelockcontainer.cpp --- a/securitydialogs/lockapp/src/lockappdevicelockcontainer.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/src/lockappdevicelockcontrol.cpp --- a/securitydialogs/lockapp/src/lockappdevicelockcontrol.cpp Thu May 27 13:44:17 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 ); - RDebug::Printf( "%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) - { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - - } - -// --------------------------------------------------------------------------- -// Destructor. -// --------------------------------------------------------------------------- -CLockAppDevicelockControl::~CLockAppDevicelockControl( ) - { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - - /***************************************************** - * S60 Customer / ETel - * S60 ETel API - *****************************************************/ - /***************************************************** - * S60 Customer / TSY - * Needs customer TSY implementation - *****************************************************/ - RDebug::Printf( "%s %s (%u) iCustomPhoneInitialized=%x -> -1 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iCustomPhoneInitialized ); - iCustomPhoneInitialized=-1; - if ( iCustomPhone.SubSessionHandle( ) ) - { - iCustomPhone.Close( ); - RDebug::Printf( "%s %s (%u) iCustomPhoneInitialized=%x -> -2 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iCustomPhoneInitialized ); - iCustomPhoneInitialized=-2; - } - - RDebug::Printf( "%s %s (%u) iPhoneInitialized=%x -> -1 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPhoneInitialized ); - iPhoneInitialized=-1; - if ( iPhone.SubSessionHandle( ) ) - { - iPhone.Close( ); - RDebug::Printf( "%s %s (%u) iPhoneInitialized=%x -> -2 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPhoneInitialized ); - iPhoneInitialized=-2; - } - - RDebug::Printf( "%s %s (%u) iTelServerInitialized=%x -> -1 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iTelServerInitialized ); - iTelServerInitialized=-1; - if ( iTelServer.Handle( ) ) - { - iTelServer.UnloadPhoneModule( KMmTsyModuleName ); - iTelServer.Close( ); - RDebug::Printf( "%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 ); - RDebug::Printf( "%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 ); - } - RDebug::Printf( "%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 ) ); - RDebug::Printf( "%s %s (%u) iTelServerInitialized=%x -> 5 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iTelServerInitialized ); - iTelServerInitialized=5; - User::LeaveIfError( iTelServer.GetPhoneInfo( KPhoneIndex, PhoneInfo ) ); - RDebug::Printf( "%s %s (%u) iTelServerInitialized=%x -> 6 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iTelServerInitialized ); - iTelServerInitialized=6; - User::LeaveIfError( iPhone.Open( iTelServer, PhoneInfo.iName ) ); - RDebug::Printf( "%s %s (%u) iPhoneInitialized=%x -> 2 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPhoneInitialized ); - iPhoneInitialized=2; - User::LeaveIfError( iCustomPhone.Open( iPhone ) ); - RDebug::Printf( "%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 ); - RDebug::Printf( "%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"); - RDebug::Printf( "%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( ) - { - RDebug::Printf( "%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) - { - RDebug::Printf( "%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 - *****************************************************/ - - - RDebug::Printf( "%s %s (%u) 111 value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - - // RDebug::Printf( "%s %s (%u) iStateControl=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iStateControl ); - - RDebug::Printf( "%s %s (%u) checking iPhoneInitialized=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - RDebug::Printf( "%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); - - RDebug::Printf( "%s %s (%u) before getLockInfoStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - TRequestStatus getLockInfoStatus; - RDebug::Printf( "%s %s (%u) after getLockInfoStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - - RDebug::Printf( "%s %s (%u) iPhoneInitialized=%x -> 5 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPhoneInitialized ); - iPhoneInitialized=5; - iPhone.GetLockInfo( getLockInfoStatus, lockType, lockInfoPkg ); - RDebug::Printf( "%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; - RDebug::Printf( "%s %s (%u) iPhoneInitialized=%x -> 8 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPhoneInitialized ); - iPhoneInitialized=8; - iPhone.SetLockSetting( setLockSettingStatus, lockType, lockChange ); - RDebug::Printf( "%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) - RDebug::Printf( "%s %s (%u) getting 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("(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) - RDebug::Printf( "%s %s (%u) getting KPSUidStartup+KStartupSecurityCodeQueryStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, tRet ); - RDebug::Printf( "%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 ) - { - RDebug::Printf( "%s %s (%u) aEnvMask=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aEnvMask ); - RDebug::Printf( "%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 ); - RDebug::Printf( "%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); - RDebug::Printf( "%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 ) ) - { - RDebug::Printf( "%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 ); - RDebug::Printf( "%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 ); - RDebug::Printf( "%s %s (%u) KAknCapServerUid=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, KAknCapServerUid ); - if( capserver.Exists() ) - { - RDebug::Printf( "%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 ); - RDebug::Printf( "%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 ) - { - RDebug::Printf( "%s %s (%u) aKeyId=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aKeyId ); - RDebug::Printf( "%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 ) - { - RDebug::Printf( "%s %s (%u) KPSUidCoreApplicationUIs=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, KPSUidCoreApplicationUIs ); - RDebug::Printf( "%s %s (%u) aKeyId=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aKeyId ); - RDebug::Printf( "%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 ) - { - RDebug::Printf( "%s %s (%u) aKeyEvent.iCode=%x aType=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aKeyEvent.iCode, aType ); - RDebug::Printf( "%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 ); - RDebug::Printf( "%s %s (%u) iPhoneInitialized=%x -> 10 ", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPhoneInitialized ); - iPhoneInitialized=10; - CSecurityHandler* handler = new (ELeave) CSecurityHandler( iPhone ); - RDebug::Printf( "%s %s (%u) got handler=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - CleanupStack::PushL( handler ); - TSecUi::InitializeLibL( ); - RDebug::Printf( "%s %s (%u) got TSecUi::InitializeLibL=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - iShowingSecCodeQuery = ETrue; - TRAPD(err, { - RDebug::Printf( "%s %s (%u) before AskSecCodeInAutoLockL=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - TBool ret = handler->AskSecCodeInAutoLockL(); - RDebug::Printf( "%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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/src/lockappdocument.cpp --- a/securitydialogs/lockapp/src/lockappdocument.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/src/lockappecsdetector.cpp --- a/securitydialogs/lockapp/src/lockappecsdetector.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/src/lockappecsnote.cpp --- a/securitydialogs/lockapp/src/lockappecsnote.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/src/lockappidlecontrol.cpp --- a/securitydialogs/lockapp/src/lockappidlecontrol.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/src/lockappkeycapturecontroller.cpp --- a/securitydialogs/lockapp/src/lockappkeycapturecontroller.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/src/lockappkeyguardcontrol.cpp --- a/securitydialogs/lockapp/src/lockappkeyguardcontrol.cpp Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,702 +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); - idle = ETrue; // don't care about idle state. Phone should autolock on any UI, not only HomeSreeen. - INFO_2("CLockAppKeyguardControl::AutoActivationAllowedL - idle: %d %d", value, idle); - value = 0; - /* This is not used any more because screensavers are removed now - RProperty::Get( KPSUidScreenSaver, KScreenSaverOn, value ); - screenSaverOn = (value > 0); - */ - screenSaverOn = ETrue; - - INFO_2("CLockAppKeyguardControl::AutoActivationAllowedL - screenSaverOn: %d %d", value, screenSaverOn); - value = 0; - /* This is not used any more because screensavers are removed now - RProperty::Get( KPSUidScreenSaver, KScreenSaverActivatedFromIdle, value ); - screenSaverStertedFromIdle = (value == KSsStartedFromIdle); - */ - screenSaverStertedFromIdle = ETrue; - - 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 ) - { - RDebug::Printf( "%s %s (%u) aKeyEvent.iCode=%x aType=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aKeyEvent.iCode, aType ); - RDebug::Printf( "%s %s (%u) iActive=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iActive ); - 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: - RDebug::Printf( "%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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/src/lockappkeypattern.cpp --- a/securitydialogs/lockapp/src/lockappkeypattern.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/src/lockapplockednote.cpp --- a/securitydialogs/lockapp/src/lockapplockednote.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/src/lockappobserverlist.cpp --- a/securitydialogs/lockapp/src/lockappobserverlist.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/src/lockapppubsubobserver.cpp --- a/securitydialogs/lockapp/src/lockapppubsubobserver.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/src/lockappserver.cpp --- a/securitydialogs/lockapp/src/lockappserver.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/src/lockappsession.cpp --- a/securitydialogs/lockapp/src/lockappsession.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/src/lockappsleepingnote.cpp --- a/securitydialogs/lockapp/src/lockappsleepingnote.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/src/lockappstatecontrol.cpp --- a/securitydialogs/lockapp/src/lockappstatecontrol.cpp Thu May 27 13:44:17 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,949 +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 - /* This is not used any more because screensavers are removed now - 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 ); - /* This is not used any more because screensavers are removed now - 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/src/lockappstatepublisher.cpp --- a/securitydialogs/lockapp/src/lockappstatepublisher.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/src/lockapputils.cpp --- a/securitydialogs/lockapp/src/lockapputils.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockapp/src/lockappwait.cpp --- a/securitydialogs/lockapp/src/lockappwait.cpp Thu May 27 13:44:17 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 6b63ca65093a -r aad866c37519 securitydialogs/lockclient/inc/lockaccessextension.h --- a/securitydialogs/lockclient/inc/lockaccessextension.h Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/lockclient/inc/lockaccessextension.h Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/lockclient/src/devicelockaccessapi.cpp --- a/securitydialogs/lockclient/src/devicelockaccessapi.cpp Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/lockclient/src/devicelockaccessapi.cpp Fri Jun 11 14:28: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 6b63ca65093a -r aad866c37519 securitydialogs/lockclient/src/keyguardaccessapi.cpp --- a/securitydialogs/lockclient/src/keyguardaccessapi.cpp Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/lockclient/src/keyguardaccessapi.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -31,8 +31,7 @@ // --------------------------------------------------------------------------- EXPORT_C CKeyguardAccessApi* CKeyguardAccessApi::NewL( ) { - qDebug() << "============= CKeyguardAccessApi::NewL"; - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG("0", 0); CKeyguardAccessApi* self = new (ELeave) CKeyguardAccessApi( ); CleanupStack::PushL( self ); @@ -46,8 +45,7 @@ // --------------------------------------------------------------------------- CKeyguardAccessApi::CKeyguardAccessApi() { - qDebug() << "============= CKeyguardAccessApi::CKeyguardAccessApi"; - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG("0", 0); } // --------------------------------------------------------------------------- @@ -68,8 +66,7 @@ // --------------------------------------------------------------------------- void CKeyguardAccessApi::ConstructL( ) { - qDebug() << "============= CKeyguardAccessApi::ConstructL"; - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG("0", 0); iLockAccessExtension = new (ELeave) RLockAccessExtension; } @@ -79,7 +76,7 @@ EXPORT_C TBool CKeyguardAccessApi::IsKeylockEnabled() { - qDebug() << "============= CKeyguardAccessApi::IsKeylockEnabled"; + RDEBUG("0", 0); TInt value; TInt err = RProperty::Get(KPSUidAvkonDomain, KAknKeyguardStatus, value); if ( err == KErrNone ) @@ -105,9 +102,7 @@ // --------------------------------------------------------------------------- EXPORT_C TBool CKeyguardAccessApi::IsKeyguardEnabled() { - qDebug() << "============= CKeyguardAccessApi::IsKeyguardEnabled"; - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - + RDEBUG("0", 0); TInt value; TInt err = RProperty::Get(KPSUidAvkonDomain, KAknKeyguardStatus, value); if ( err == KErrNone ) @@ -148,16 +143,15 @@ // --------------------------------------------------------------------------- EXPORT_C TInt CKeyguardAccessApi::DisableKeyguard( TBool aWithNote ) { - qDebug() << "============= CKeyguardAccessApi::DisableKeyguard"; + RDEBUG("aWithNote", aWithNote); if ( iLockAccessExtension ) { - qDebug() << "============= CKeyguardAccessApi::DisableKeyguard 1"; + RDEBUG("0", 1); return iLockAccessExtension->SendMessage( ELockAppDisableKeyguard, aWithNote ); } else { - qDebug() << "============= CKeyguardAccessApi::DisableKeyguard 0"; - + RDEBUG("0", 0); return KErrNotFound; } } @@ -167,6 +161,7 @@ // --------------------------------------------------------------------------- EXPORT_C TInt CKeyguardAccessApi::OfferKeyguard() { + RDEBUG("0", 0); if ( iLockAccessExtension ) { return iLockAccessExtension->SendMessage( ELockAppOfferKeyguard ); @@ -182,7 +177,7 @@ // --------------------------------------------------------------------------- EXPORT_C TInt CKeyguardAccessApi::ShowKeysLockedNote() { - qDebug() << "============= CKeyguardAccessApi::ShowKeysLockedNote"; + RDEBUG("0", 0); if ( iLockAccessExtension ) { return iLockAccessExtension->SendMessage( ELockAppShowKeysLockedNote ); diff -r 6b63ca65093a -r aad866c37519 securitydialogs/lockclient/src/lockaccessextension.cpp --- a/securitydialogs/lockclient/src/lockaccessextension.cpp Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/lockclient/src/lockaccessextension.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -15,7 +15,6 @@ * */ - #include "lockaccessextension.h" #include #include // P&S API @@ -25,14 +24,9 @@ #include #include #include -#include #include #include -// Constants -const TInt KTimesToConnectServer( 2); -const TInt KTimeoutBeforeRetrying( 50000); - // --------------------------------------------------------------------------- // Gets server version, needed for connection // --------------------------------------------------------------------------- @@ -71,8 +65,7 @@ ret = KErrNotReady; } */ - qDebug() << "============= RLockAccessExtension::TryConnect"; - qDebug() << ret; + RDEBUG("ret", ret); return ret; } @@ -83,8 +76,10 @@ { TInt ret(KErrNone); /* - this is the old methd. Now we use QtHighway + this is the old method. Now we use QtHighway // we need CCoeEnv because of window group list + const TInt KTimesToConnectServer( 2); + const TInt KTimeoutBeforeRetrying( 50000); CCoeEnv* coeEnv = CCoeEnv::Static( ); if ( coeEnv ) { @@ -104,8 +99,7 @@ ret = KErrNotSupported; } */ - qDebug() << "============= RLockAccessExtension::EnsureConnected"; - qDebug() << ret; + RDEBUG("ret", ret); return ret; } @@ -145,74 +139,80 @@ TInt RLockAccessExtension::SendMessage( TInt aMessage, TInt aParam1, TInt aParam2 ) { TInt ret = EnsureConnected( ); + RDEBUG("ret", ret); if ( ret == KErrNone ) { // assign parameters to IPC argument // TIpcArgs args( aParam1, aParam2); // this is the old methd. Now we use QtHighway // ret = SendReceive( aMessage, args ); - qDebug() << "============= RLockAccessExtension::SendMessage 123.2"; - qDebug() << aMessage; - qDebug() << aParam1; - qDebug() << aParam2; + RDEBUG("aMessage", aMessage); + RDEBUG("aParam1", aParam1); + RDEBUG("aParam2", aParam2); - if(1==0) - { // old method. Not used any more + + { // old method. Not used any more. Kept as reference + /* XQServiceRequest* mServiceRequest; - qDebug() << "============= RLockAccessExtension::SendMessage 2"; - mServiceRequest = new XQServiceRequest("com.nokia.services.AutolockSrv.AutolockSrv","service(QString,QString,QString)");// use , false to make async - qDebug() << "============= RLockAccessExtension::SendMessage 2.1"; - qDebug() << 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); - qDebug() << "============= RLockAccessExtension::SendMessage aParam1"; + RDEBUG("aParam1", 0); label = "" + QString("%1").arg(aParam1); *mServiceRequest << QString(label); - qDebug() << "============= RLockAccessExtension::SendMessage aParam2"; + RDEBUG("aParam2", 0); label = "" + QString("%1").arg(aParam2); *mServiceRequest << QString(label); - qDebug() << "============= RLockAccessExtension::SendMessage 3"; int returnvalue; + RDEBUG("send", 0); bool ret = mServiceRequest->send(returnvalue); - qDebug() << "============= RLockAccessExtension::SendMessage ret=" << ret; - qDebug() << "============= RLockAccessExtension::SendMessage returnvalue=" << returnvalue; + RDEBUG("ret", ret); + RDEBUG("returnvalue", returnvalue); + */ } - else - { - // TODO this always seems to fail because request is NULL + + 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; - request = mAppManager.create("com.nokia.services.AutolockSrv", "AutolockSrv", "service(QString,QString,QString)", false); - // also works with create("AutolockSrv", "service(QString,QString,QString)", false); + 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) - qDebug() << "============= RLockAccessExtension::SendMessage got request"; + { + RDEBUG("got request", 0); + } else { - qDebug() << "============= RLockAccessExtension::SendMessage not got request"; + RDEBUG("not got request", 0); + RDebug::Printf( "%s %s (%u) not got request=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + return KErrAbort; } - qDebug() << "============= RLockAccessExtension::SendMessage 121.3"; - QList args; - QString label ; - label = "" + QString("%1").arg(aMessage); - args << QVariant(QString(label)); - qDebug() << "============= RLockAccessExtension::SendMessage 123.4"; - label = "" + QString("%1").arg(aParam1); - args << QVariant(QString(label)); - label = "" + QString("%1").arg(aParam2); - args << QVariant(QString(label)); - qDebug() << "============= RLockAccessExtension::SendMessage 123.4"; + RDEBUG("setArguments", 0); request->setArguments(args); - qDebug() << "============= RLockAccessExtension::SendMessage 123.5"; - bool ret = request->send(); - qDebug() << "============= RLockAccessExtension::SendMessage ret=" << ret; + 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(); - qDebug() << "============= RLockAccessExtension::SendMessage error=" << error; + RDEBUG("error", error); + ret = returnvalue; delete request; - } } + RDEBUG("ret", ret); return ret; } diff -r 6b63ca65093a -r aad866c37519 securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialog.cpp --- a/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialog.cpp Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialog.cpp Fri Jun 11 14:28:40 2010 +0300 @@ -160,7 +160,7 @@ TInt err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsTestCode, value ); qDebug() << "SecUiNotificationDialog::faking KSecurityUIsTestCode err=" << err; qDebug() << "SecUiNotificationDialog::faking value=" << value; - if(value>0 && mShowEventReceived==false) // show happens 2 times. Dialog can be closed only the second. + if(value>0 && mShowEventReceived==true) // show happens 2 times. Dialog can be closed only the second. { QString myString = ""; myString += QString("%1").arg(value); @@ -230,7 +230,7 @@ return true; } } - + // after TARM validation. if (parameters.contains(KInvalidNewLockCode)) { qDebug() << "SecUiNotificationDialog::KInvalidNewLockCode"; QString invalidText = parameters.value(KInvalidNewLockCode).toString(); @@ -335,7 +335,20 @@ qDebug() << "SecUiNotificationDialog::KInvalidNewLockCode EDevicelockTotalPolicies"; title->setPlainText("EDevicelockTotalPolicies"); } - // always keep OK valid. + if(invalidNumber<0) // everything is ok + { + okAction->setEnabled(true); // TODO check this : invalid -> valid. This allows verif ? + okAction->setText("Ok"); + codeBottom->setEnabled(true); + } + else + { + okAction->setEnabled(false); + codeBottom->setEnabled(false); + codeBottom->setText(""); + okAction->setText("Ok"); + } + // need to return because all objects are already created return true; } @@ -486,11 +499,11 @@ { codeBottom->setText(""); // any change resets the verification. } - if( queryType == 0x1000004 ) + if( queryType == 0x1000004 ) // new codeLock { // ChangeSecCodeParamsL change RMobilePhone::ESecurityCodePhonePassword QVariant codeTop(text); mResultMap.insert(KCodeTopIndex, codeTop); - sendResult(KErrCompletion); // send the current password back to the client for further TARM validation + 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 } if(text.length() < lMinLength ) { @@ -613,7 +626,6 @@ ESecurityUIsDismissDialogLastValue }; - TInt ret; RDEBUG("0", 0); TInt aDismissDialog = ESecurityUIsDismissDialogUninitialized; TInt err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsDismissDialog, aDismissDialog ); diff -r 6b63ca65093a -r aad866c37519 securitydialogs/securitydialogs.pro --- a/securitydialogs/securitydialogs.pro Thu May 27 13:44:17 2010 +0300 +++ b/securitydialogs/securitydialogs.pro Fri Jun 11 14:28:40 2010 +0300 @@ -18,7 +18,7 @@ SUBDIRS += secuinotifications/secuinotifications.pro SUBDIRS += lockclient/group/lockclient.pro -SUBDIRS += AutolockSrv/indicatorplugin/indicatorautolockplugin.pro -SUBDIRS += AutolockSrv/autolockuseractivityservice.pro -SUBDIRS += AutolockSrv/AutolockSrv.pro +SUBDIRS += Autolock/indicatorplugin/indicatorautolockplugin.pro +SUBDIRS += Autolock/autolockuseractivityservice.pro +SUBDIRS += Autolock/Autolock.pro diff -r 6b63ca65093a -r aad866c37519 securitysrv.pro --- a/securitysrv.pro Thu May 27 13:44:17 2010 +0300 +++ b/securitysrv.pro Fri Jun 11 14:28:40 2010 +0300 @@ -18,3 +18,5 @@ SUBDIRS += securitydialogs/securitydialogs.pro SUBDIRS += cpsecplugins/cpsecplugins.pro +SUBDIRS += pkiutilities/pkiutilities.pro + diff -r 6b63ca65093a -r aad866c37519 securitysrv_info/securitysrv_metadata/securitysrv_metadata.mrp --- a/securitysrv_info/securitysrv_metadata/securitysrv_metadata.mrp Thu May 27 13:44:17 2010 +0300 +++ b/securitysrv_info/securitysrv_metadata/securitysrv_metadata.mrp Fri Jun 11 14:28:40 2010 +0300 @@ -1,19 +1,3 @@ -# -# 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: -# - component securitysrv_metadata source \sf\mw\securitysrv\securitysrv_info\securitysrv_metadata source \sf\mw\securitysrv\package_definition.xml