Revision: 201025
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 06 Jul 2010 15:15:05 +0300
changeset 38 e0432375ea67
parent 37 7bad16cccaca
child 40 604cd42065d1
child 45 5d3e34b7618a
Revision: 201025 Kit: 2010127
cpsecplugins/cpadvancedsecplugin/group/advancedsecplugin.pro
cpsecplugins/cpplugincommon.pri
cpsecplugins/devicelockplugin/devicelockplugin.pro
cpsecplugins/devicelockplugin/rom/devicelockplugin.iby
cpsecplugins/devicelockplugin/rom/devicelockplugin_resources.iby
cpsecplugins/devicelockplugin/rom/devicelockplugin_rom.pri
cpsecplugins/simpincodeplugin/inc/cppincodepluginview.h
cpsecplugins/simpincodeplugin/rom/pincodeplugin.iby
cpsecplugins/simpincodeplugin/src/cppincodepluginview.cpp
pkiutilities/CTSecurityDialogs/Group/CTSecDialogImpl.mmp
pkiutilities/CTSecurityDialogs/NotifInc/CTSecurityDialogsAO.h
pkiutilities/CTSecurityDialogs/NotifSrc/CTSecurityDialogsAO.cpp
pkiutilities/CertSaver/inc/CertSaverModel.h
pkiutilities/CertSaver/src/CertSaverModel.cpp
pkiutilities/CertSaver/src/certparser.cpp
pkiutilities/StubSIS/swipolicy.ini
pkiutilities/StubSIS/tlsproviderpolicy.ini
pkiutilities/group/bld.inf
pkiutilities/rom/StubSIS.iby
pkiutilities/untrustedcertificatedialog/src/untrustedcertificatewidget.cpp
secsrv_plat/security_code_ui_api/inc/SecUiSecurityHandler.h
securitydialogs/Autolock/Autolock.pro
securitydialogs/Autolock/autolockuseractivityservice/bwins/autolockuseractivityserviceu.def
securitydialogs/Autolock/autolockuseractivityservice/eabi/autolockuseractivityserviceu.def
securitydialogs/Autolock/conf/Autolock.confml
securitydialogs/Autolock/conf/CI_Autolock.confml
securitydialogs/Autolock/src/Autolock.cpp
securitydialogs/Autolock/src/Autolock.h
securitydialogs/Autolock/src/main.cpp
securitydialogs/SecUi/Src/SecQueryUi.cpp
securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp
securitydialogs/SecUi/Src/SecUiSecuritySettings.cpp
securitydialogs/lockclient/group/bld.inf
securitydialogs/lockclient/group/bwins/lockclientu.def
securitydialogs/lockclient/group/eabi/lockclientu.def
securitydialogs/lockclient/group/lockclient.pro
securitydialogs/lockclient/rom/lockclient.iby
securitydialogs/lockclient/src/lockaccessextension.cpp
securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdebug.h
securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdialog.h
securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationcontentwidget.cpp
securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialog.cpp
securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialogplugin.cpp
--- a/cpsecplugins/cpadvancedsecplugin/group/advancedsecplugin.pro	Wed Jun 23 19:10:54 2010 +0300
+++ b/cpsecplugins/cpadvancedsecplugin/group/advancedsecplugin.pro	Tue Jul 06 15:15:05 2010 +0300
@@ -40,6 +40,7 @@
 	LIBS += -lcryptography
 	LIBS += -lDevTokenClient
 	LIBS += -lcrypto
+	LIBS += -lefsrv
 
 	PLUGIN_STUB_PATH = /resource/qt/plugins/controlpanel
 		
--- a/cpsecplugins/cpplugincommon.pri	Wed Jun 23 19:10:54 2010 +0300
+++ b/cpsecplugins/cpplugincommon.pri	Tue Jul 06 15:15:05 2010 +0300
@@ -16,7 +16,7 @@
 include (common.pri)
 
 
-LIBS += -lcpframework -lcpcategorymodel
+LIBS += -lcpframework
 
 symbian: plugin { # copy qtstub and manifest
 	
--- a/cpsecplugins/devicelockplugin/devicelockplugin.pro	Wed Jun 23 19:10:54 2010 +0300
+++ b/cpsecplugins/devicelockplugin/devicelockplugin.pro	Tue Jul 06 15:15:05 2010 +0300
@@ -31,7 +31,7 @@
 		 -lcentralrepository \
 		 -lRLockSettings \
 		 -lflogger
-// TRANSLATIONS += devicelocking.ts
+TRANSLATIONS += devicelocking.ts
 include ( ../cpplugincommon.pri )
 include ( devicelockplugin.pri )
 include ( rom/devicelockplugin_rom.pri )
--- a/cpsecplugins/devicelockplugin/rom/devicelockplugin.iby	Wed Jun 23 19:10:54 2010 +0300
+++ b/cpsecplugins/devicelockplugin/rom/devicelockplugin.iby	Tue Jul 06 15:15:05 2010 +0300
@@ -18,11 +18,7 @@
 #ifndef __DEVICELOCKPLUGIN_IBY__
 #define __DEVICELOCKPLUGIN_IBY__
 
-#include <bldvariant.hrh>
-#include <data_caging_paths_for_iby.hrh>
-
 file=ABI_DIR\BUILD_DIR\devicelockplugin.dll    SHARED_LIB_DIR\devicelockplugin.dll
-
 data=\epoc32\data\c\resource\qt\plugins\controlpanel\devicelockplugin.qtplugin resource\qt\plugins\controlpanel\devicelockplugin.qtplugin
 
 #endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cpsecplugins/devicelockplugin/rom/devicelockplugin_resources.iby	Tue Jul 06 15:15:05 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef __DEVICELOCKPLUGIN_RESOURCES_IBY__
+#define __DEVICELOCKPLUGIN_RESOURCES_IBY__
+
+#include <bldvariant.hrh>
+#include <data_caging_paths_for_iby.hrh>
+
+// devicelockplugin is old.
+// data=DATAZ_\QT_TRANSLATIONS_DIR\devicelockplugin.qm QT_TRANSLATIONS_DIR\devicelockplugin.qm 
+data=DATAZ_\QT_TRANSLATIONS_DIR\devicelocking.qm QT_TRANSLATIONS_DIR\devicelocking.qm 
+
+#endif	// __DEVICELOCKPLUGIN_RESOURCES_IBY__
--- a/cpsecplugins/devicelockplugin/rom/devicelockplugin_rom.pri	Wed Jun 23 19:10:54 2010 +0300
+++ b/cpsecplugins/devicelockplugin/rom/devicelockplugin_rom.pri	Tue Jul 06 15:15:05 2010 +0300
@@ -17,5 +17,6 @@
 symbian {
 	BLD_INF_RULES.prj_exports += \
 		"$${LITERAL_HASH}include<platform_paths.hrh>" \
-		"rom/devicelockplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(devicelockplugin.iby)"
+		"rom/devicelockplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(devicelockplugin.iby)" \
+		"rom/devicelockplugin_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(devicelockplugin_resources.iby)"
 }
\ No newline at end of file
--- a/cpsecplugins/simpincodeplugin/inc/cppincodepluginview.h	Wed Jun 23 19:10:54 2010 +0300
+++ b/cpsecplugins/simpincodeplugin/inc/cppincodepluginview.h	Tue Jul 06 15:15:05 2010 +0300
@@ -24,6 +24,7 @@
 // Forward declarations
 class SecCodeSettings;
 class HbDataFormModelItem;
+class HbDataFormModel;
 
 // Class declaration
 class CpPinCodePluginView : public CpBaseSettingView
@@ -37,10 +38,11 @@
 private slots:
     void changePinCode();
     void changePin2Code();
-    void changePinCodeRequest();
+    void toggleChange(QModelIndex startIn, QModelIndex endIn);
     
 private:
     SecCodeSettings *mSecCodeSettings;
+    HbDataFormModel *mFormModel;
     HbDataFormModelItem *mPinCodeRequestItem;
 };
 
--- a/cpsecplugins/simpincodeplugin/rom/pincodeplugin.iby	Wed Jun 23 19:10:54 2010 +0300
+++ b/cpsecplugins/simpincodeplugin/rom/pincodeplugin.iby	Tue Jul 06 15:15:05 2010 +0300
@@ -21,9 +21,9 @@
 #include <bldvariant.hrh>
 #include <data_caging_paths_for_iby.hrh>
 
-// 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
+// pincodeplugin.iby should export cppincodeplugin.dll because controlpanelui.iby does NOT exports cppincodeplugin.dll
+file=ABI_DIR\BUILD_DIR\cppincodeplugin.dll    SHARED_LIB_DIR\cppincodeplugin.dll
 
-data=/epoc32/data/c/resource/qt/plugins/controlpanel/pincodeplugin.qtplugin resource/qt/plugins/controlpanel/pincodeplugin.qtplugin
+data=/epoc32/data/c/resource/qt/plugins/controlpanel/cppincodeplugin.qtplugin resource/qt/plugins/controlpanel/cppincodeplugin.qtplugin
 
 #endif
--- a/cpsecplugins/simpincodeplugin/src/cppincodepluginview.cpp	Wed Jun 23 19:10:54 2010 +0300
+++ b/cpsecplugins/simpincodeplugin/src/cppincodepluginview.cpp	Tue Jul 06 15:15:05 2010 +0300
@@ -50,7 +50,7 @@
         form->setItemPrototypes(protoTypeList);     
         form->setHeading(tr("PIN code"));
 
-        HbDataFormModel *formModel = new HbDataFormModel();
+        mFormModel = new HbDataFormModel(this);        
         mPinCodeRequestItem = new HbDataFormModelItem(
             HbDataFormModelItem::ToggleValueItem, tr("PIN code requests"));
 
@@ -63,9 +63,9 @@
             mPinCodeRequestItem->setContentWidgetData("additionalText", tr("Off"));
         }
 				RDEBUG("form->addConnection", 1);
-        form->addConnection(mPinCodeRequestItem, SIGNAL(clicked()), this,
-        		SLOT(changePinCodeRequest()));
-        formModel->appendDataFormItem(mPinCodeRequestItem);
+        connect(mFormModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), 
+                  this, SLOT(toggleChange(QModelIndex, QModelIndex)));
+        mFormModel->appendDataFormItem(mPinCodeRequestItem);
 
         HbDataFormModelItem *pinCodeItem = new HbDataFormModelItem(
             static_cast<HbDataFormModelItem::DataItemType>
@@ -75,7 +75,7 @@
         pinCodeItem->setContentWidgetData("readOnly", true);
         form->addConnection(pinCodeItem, SIGNAL(clicked()), this,
         		SLOT(changePinCode()));
-        formModel->appendDataFormItem(pinCodeItem);
+        mFormModel->appendDataFormItem(pinCodeItem);
 
         HbDataFormModelItem *pin2CodeItem = new HbDataFormModelItem(
             static_cast<HbDataFormModelItem::DataItemType>
@@ -85,9 +85,9 @@
         pin2CodeItem->setContentWidgetData("readOnly", true);
         form->addConnection(pin2CodeItem, SIGNAL(clicked()), this,
         		SLOT(changePin2Code()));
-        formModel->appendDataFormItem(pin2CodeItem);
+        mFormModel->appendDataFormItem(pin2CodeItem);
 				RDEBUG("form->setModel", 1);
-        form->setModel(formModel);
+        form->setModel(mFormModel);
     }
 }
 
@@ -100,6 +100,46 @@
 }
 
 /*!
+   response for click pin code request
+*/
+void CpPinCodePluginView::toggleChange(QModelIndex startIn, 
+        QModelIndex /*endIn*/)
+{
+		RDEBUG("0", 0);
+    HbDataFormModelItem *item = mFormModel->itemFromIndex(startIn);
+    if(item->type() == HbDataFormModelItem::ToggleValueItem) {
+        if (mSecCodeSettings->changePinCodeRequest()) {
+        		RDEBUG("got changePinCodeRequest", 1);
+						disconnect(mFormModel, 
+                    SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, 
+                    SLOT(toggleChange(QModelIndex, QModelIndex)));
+        		RDEBUG("disconnected", 1);
+            QString text = mPinCodeRequestItem->contentWidgetData(
+                    "text").toString();
+            if (0 == text.compare("On")) {
+                mPinCodeRequestItem->setContentWidgetData("text", 
+                    tr("Off"));
+                mPinCodeRequestItem->setContentWidgetData("additionalText", 
+                    tr("Off"));
+            } else {
+                mPinCodeRequestItem->setContentWidgetData("text", 
+                    tr("On"));
+                mPinCodeRequestItem->setContentWidgetData("additionalText", 
+                    tr("On"));
+            }
+         		RDEBUG("reconnect", 1);
+						connect(mFormModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), 
+                    this, SLOT(toggleChange(QModelIndex, QModelIndex)));
+        }
+      else
+      	{
+      	RDEBUG("value was not changed", 0);
+      	}
+    }
+   	RDEBUG("0", 0);
+}
+
+/*!
    response for click pin code
 */
 void CpPinCodePluginView::changePinCode()
@@ -116,27 +156,3 @@
 		RDEBUG("0", 0);
     mSecCodeSettings->changePin2Code();
 }
-
-/*!
-   response for click pin code request
-*/
-void CpPinCodePluginView::changePinCodeRequest()
-{
-		RDEBUG("0", 0);
-    if (mSecCodeSettings->changePinCodeRequest()) {
-        QString text = mPinCodeRequestItem->contentWidgetData("text").toString();
-        if (0 == text.compare("On")) {
-        		RDEBUG("On->Off", 0);
-            mPinCodeRequestItem->setContentWidgetData("text", 
-                    tr("Off"));
-            mPinCodeRequestItem->setContentWidgetData("additionalText", 
-                    tr("Off"));
-        } else {
-        		RDEBUG("Off->On", 0);
-            mPinCodeRequestItem->setContentWidgetData("text", 
-                    tr("On"));
-            mPinCodeRequestItem->setContentWidgetData("additionalText", 
-                    tr("On"));
-        }
-    }
-}
--- a/pkiutilities/CTSecurityDialogs/Group/CTSecDialogImpl.mmp	Wed Jun 23 19:10:54 2010 +0300
+++ b/pkiutilities/CTSecurityDialogs/Group/CTSecDialogImpl.mmp	Tue Jul 06 15:15:05 2010 +0300
@@ -47,10 +47,13 @@
 SYSTEMINCLUDE ../../DeviceToken/Inc
 SYSTEMINCLUDE ../../../inc              // securityservices/inc directory
 MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/mw/hb/hbcore 
+SYSTEMINCLUDE   /epoc32/include/mw/hb/hbwidgets
 
 
 USERINCLUDE ../NotifInc
 USERINCLUDE ../ClientInc
+USERINCLUDE ../../../securitydialogs/SecUi/Inc
 
 SOURCEPATH  ../NotifSrc
 
@@ -89,6 +92,8 @@
 LIBRARY   X500.lib
 LIBRARY   DevTokenClient.lib
 LIBRARY   HbCore.lib                // CHbDeviceDialog
+LIBRARY   HbWidgets.lib
+LIBRARY   secui.lib
 
 DEBUGLIBRARY     flogger.lib
 
--- a/pkiutilities/CTSecurityDialogs/NotifInc/CTSecurityDialogsAO.h	Wed Jun 23 19:10:54 2010 +0300
+++ b/pkiutilities/CTSecurityDialogs/NotifInc/CTSecurityDialogsAO.h	Tue Jul 06 15:15:05 2010 +0300
@@ -170,6 +170,8 @@
 
         void ShowCSRDialogL();
 
+        void ShowInformationNoteL( TInt aResourceID ) const;
+
         /**
         * Saves digital signature receipt
         */
--- a/pkiutilities/CTSecurityDialogs/NotifSrc/CTSecurityDialogsAO.cpp	Wed Jun 23 19:10:54 2010 +0300
+++ b/pkiutilities/CTSecurityDialogs/NotifSrc/CTSecurityDialogsAO.cpp	Tue Jul 06 15:15:05 2010 +0300
@@ -46,6 +46,11 @@
 #include <TrustedSitesStore.h>
 #include <mctwritablecertstore.h>
 
+#include "SecQueryUi.h"                   // needed for password dialog
+
+#include <hbdevicemessageboxsymbian.h>    // needed for Note dialogs    
+#include <hbdevicenotificationdialogsymbian.h>
+
 // LOCAL CONSTANTS AND MACROS
 const TInt KCertArrayGranularity = 3;
 const TInt KMaxLengthTextDetailsBody = 5000;
@@ -562,6 +567,7 @@
     if ( iRetry ) // Is this new try?
       {
         // Previous attempt was failed
+        // incorrect pin code
         DoHandleMessageL( EErrorPinCodeIncorrect, KNullDesC, KNullDesC, 0, 0 );
       }
     // Ask the PIN code or PUK code
@@ -569,11 +575,13 @@
         {
         HBufC* header = StringLoader::LoadLC(
             R_QTN_CM_HEADING_PHONE_KEYSTORE, CEikonEnv::Static() );
-        iPIN.iMinLength = KMaxKeystorePwLength;
-        DoHandleMessageL( EEnterKeyStorePw, KNullDesC, *header,
-            iPIN.iMinLength, iPIN.iMaxLength );
-        iMultiLineDlgType = EEnterNewKeyStorePw;
-        CleanupStack::PopAndDestroy( header );
+		iPIN.iMinLength = KMaxKeystorePwLength;
+        DoHandleMessageL( EEnterKeyStorePw, KNullDesC, *header,    
+            iPIN.iMinLength, iPIN.iMaxLength );                    
+        iMultiLineDlgType = EEnterNewKeyStorePw;                   
+        CleanupStack::PopAndDestroy( header );                     
+        RunL();
+        
         }
     else if ( iPIN.iPINLabel == KKeyStoreImportKeyLabel )
         {
@@ -590,7 +598,7 @@
     else if ( iPIN.iPINLabel == KKeyStoreCreatePwLabel )
         {
         iPIN.iMinLength = KMaxKeystorePwLength;
-        DoHandleMessageL( EInfoPwCreating, KNullDesC, KNullDesC, 0, 0 );
+        ShowInformationNoteL(R_QTN_CM_CREATING_KEYSTORE);
         DoHandleMultilinePinQueryL( EEnterNewKeyStorePw );
         iNextStep = EVerifyPINs;
         }
@@ -624,12 +632,36 @@
     TDialogType dlgType = ( TDialogType )aDlgType;
     if ( EEnterNewKeyStorePw == dlgType )
         {
-        dlgText1 = iNotifier->LoadResourceStringLC( dlgType, KNullDesC );
+/*
+        dlgText1 = iNotifier->LoadResourceStringLC( dlgType, KNullDesC );          
         dlgText2 = iNotifier->LoadResourceStringLC( EVerifyKeyStorePw, KNullDesC );
-        dlg = CCTPinPinQueryDialog::NewL( *dlgText1, *dlgText2, iPINValue2,
-            iPINValueVerify, iPIN.iMinLength, iPIN.iMaxLength, iRetValue );
-        dlg->RunDlgLD( iStatus, R_WIM_PWPW_QUERY_DIALOG );
-        CleanupStack::PopAndDestroy( 2, dlgText1 ); // dlgText1, dlgText2
+        dlg = CCTPinPinQueryDialog::NewL( *dlgText1, *dlgText2, iPINValue2,        
+            iPINValueVerify, iPIN.iMinLength, iPIN.iMaxLength, iRetValue );        
+        dlg->RunDlgLD( iStatus, R_WIM_PWPW_QUERY_DIALOG );                         
+        CleanupStack::PopAndDestroy( 2, dlgText1 ); // dlgText1, dlgText2          
+*/
+        dlgText1 =  StringLoader::LoadLC( R_QTN_SN_NEW_PHONE_KEYSTORE );                     
+        dlgText2 = StringLoader::LoadLC( R_QTN_WIM_VERIFY_PIN );                             
+        HBufC* message = HBufC::NewLC( KMaxLengthTextCertLabelVisible );                     
+        message->Des().Append(dlgText1->Des());                                              
+        message->Des().Append(_L("|"));                                                      
+        message->Des().Append(dlgText2->Des());      
+        CSecQueryUi* SecQueryUi = CSecQueryUi::NewL();                                  
+        TInt queryAccepted = SecQueryUi->SecQueryDialog(message->Des(), iPINValueVerify,
+                                                    iPIN.iMinLength,iPIN.iMaxLength,    
+                                                    ESecUiAlphaSupported |              
+                                                    ESecUiCancelSupported |             
+                                                    ESecUiSecretSupported |             
+                                                    ESecUiEmergencyNotSupported);
+        iRetValue=(queryAccepted==KErrNone); 
+        if(iRetValue)                                                                        
+            iPINValue2.Copy(iPINValueVerify); // dialog already does not OK with different pin codes
+        delete SecQueryUi;                                                                   
+        SecQueryUi=NULL;                                                                     
+        CleanupStack::PopAndDestroy( message );                                              
+        CleanupStack::PopAndDestroy( dlgText2 );                                             
+        CleanupStack::PopAndDestroy( dlgText1 );      
+        RunL(); // had to call it this way       
         }
     else if ( EExportKeyPw == dlgType )
         {
@@ -758,16 +790,35 @@
                     }
                 }
                iPinQueryDialogDeleted = EFalse;
-                CCTPinQueryDialog::RunDlgLD( iStatus,
-                                        *dlgText,
-                                        *pinValue,
-                                        aMinLength,
-                                        aMaxLength,
-                                        iRetValue,
-                                        resource,
-                                        iPinQueryDialog,
-                                        iPinQueryDialogDeleted );
+               if(aDlgType!=EEnterKeyStorePw) {
+                    CCTPinQueryDialog::RunDlgLD( iStatus,
+                                            *dlgText,
+                                            *pinValue,
+                                            aMinLength,
+                                            aMaxLength,
+                                            iRetValue,
+                                            resource,
+                                            iPinQueryDialog,
+                                            iPinQueryDialogDeleted );
+			    break;											
+               }
+               else
+               {
+                iPIN.iMinLength = KMaxKeystorePwLength;                                   
+                CSecQueryUi* SecQueryUi = CSecQueryUi::NewL();                            
+                HBufC* header =StringLoader::LoadLC( R_QTN_SN_ENTER_PHONE_KEYSTORE);      
+                TInt queryAccepted = SecQueryUi->SecQueryDialog(header->Des(), *pinValue,
+                                                        aMinLength,aMaxLength,           
+                                                        ESecUiAlphaSupported |           
+                                                        ESecUiCancelSupported |          
+                                                        ESecUiSecretSupported |          
+                                                        ESecUiEmergencyNotSupported);    
+                delete SecQueryUi;                                                       
+                SecQueryUi=NULL;                                                          
+                iRetValue=(queryAccepted==KErrNone);                                      
+                CleanupStack::PopAndDestroy( header );        
                 break;
+               }
             }
     default:
             {
@@ -775,12 +826,12 @@
             }
 
       }
-
-  if ( dlg )
-      {
-      dlg->ExecuteLD( *dlgText );
-      dlg = NULL;
-      }
+  if ( dlg && aDlgType!=EEnterKeyStorePw)                                                                    
+      {                                                                         
+                                                                                
+      dlg->ExecuteLD( *dlgText );                                               
+      dlg = NULL;                                                               
+      }                                                                         
 
     CleanupStack::PopAndDestroy( dlgText ); // dlgText
     }
@@ -2485,3 +2536,14 @@
         }
     }
 
+void CCTSecurityDialogsAO::ShowInformationNoteL( TInt aResourceID ) const
+    {
+    HBufC* buffer = CEikonEnv::Static()->AllocReadResourceLC( aResourceID );
+    CHbDeviceMessageBoxSymbian* iMessageBox = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EInformation);
+    CleanupStack::PushL(iMessageBox);                                                                                    
+    iMessageBox->SetTextL(buffer->Des());                                                                                
+    iMessageBox->SetTimeout(6000);                                                                                      
+    iMessageBox->ExecL();                                                                                                
+    CleanupStack::PopAndDestroy(iMessageBox);                                                                            
+    CleanupStack::PopAndDestroy( buffer );      
+    }
--- a/pkiutilities/CertSaver/inc/CertSaverModel.h	Wed Jun 23 19:10:54 2010 +0300
+++ b/pkiutilities/CertSaver/inc/CertSaverModel.h	Tue Jul 06 15:15:05 2010 +0300
@@ -77,12 +77,6 @@
         void SavePKCS12L();
 
 
-        /**
-        * Shows a error note with given text.
-        * @param aResourceID Id of the resource text to be shown.
-        */
-        void ShowErrorNoteL( TInt aResourceID ) const;
-
     private:  // New functions
 
         /**
@@ -198,11 +192,6 @@
         */
         void AddNewlinesToMessage( TDes& aMessage ) const;
 
-        /**
-        * Shows a confirmation note with given text.
-        * @param aResourceID Id of the resource text to be shown.
-        */
-        void ShowConfirmationNoteL( TInt aResourceID ) const;
 
         /**
         * Shows a information note with given text.
--- a/pkiutilities/CertSaver/src/CertSaverModel.cpp	Wed Jun 23 19:10:54 2010 +0300
+++ b/pkiutilities/CertSaver/src/CertSaverModel.cpp	Tue Jul 06 15:15:05 2010 +0300
@@ -210,7 +210,7 @@
         case KErrKeySize:
         case KErrArgument:
             {
-            ShowErrorNoteL( R_CERTSAVER_KEY_TYPE_NOT_SUPPORTED );
+            ShowInformationNoteL( R_CERTSAVER_KEY_TYPE_NOT_SUPPORTED );
             User::Leave( KErrCancel );
             break;
             }
@@ -221,21 +221,21 @@
             }
         case KErrKeyUsage:
             {
-            ShowErrorNoteL( R_CERTSAVER_PRIVATE_KEY_CORRUPTED );
+            ShowInformationNoteL( R_CERTSAVER_PRIVATE_KEY_CORRUPTED );
             User::Leave( KErrCancel );
             break;
             }
         case KErrCancel:
         case KErrPermissionDenied:
             {
-            ShowErrorNoteL( R_CERTSAVER_PKCS12_DISCARDED );
+            ShowInformationNoteL( R_CERTSAVER_PKCS12_DISCARDED );
             User::Leave( KErrCancel );
             break;
             }
         case KErrCorrupt:
         case KErrEof:
             {
-            ShowErrorNoteL( R_CERTSAVER_KEYSTORE_CORRUPTED );
+            ShowInformationNoteL( R_CERTSAVER_KEYSTORE_CORRUPTED );
             User::Leave( KErrCancel );
             break;
             }
@@ -287,7 +287,7 @@
         case KErrCorrupt:
         case KErrEof:
             {
-            ShowErrorNoteL( R_CERTSAVER_KEYSTORE_CORRUPTED );
+            ShowInformationNoteL( R_CERTSAVER_KEYSTORE_CORRUPTED );
             User::Leave( KErrCancel );
             }
         default:
@@ -507,9 +507,7 @@
 
     if (SysUtil::FFSSpaceBelowCriticalLevelL( &iFs, aDataToSave.Size() ))
         {
-        HBufC* p = StringLoader::LoadLC( R_CERTSAVER_MEMORY );
-        CHbDeviceMessageBoxSymbian::WarningL(p->Des()); 
-        CleanupStack::PopAndDestroy( p );
+        ShowInformationNoteL(R_CERTSAVER_MEMORY);
         User::Leave( KErrExitApp );
         }
     }
@@ -533,7 +531,7 @@
         CHbDeviceMessageBoxSymbian::QuestionL(msgPtr, KNullDesC, KNullDesC);
     TBool doSave= (selection == CHbDeviceMessageBoxSymbian::EAcceptButton);
     CleanupStack::PopAndDestroy(message);
-
+/*
     if ( doSave && iCertOwnerType == ECACertificate )
         {
         // warn user about security risk
@@ -543,7 +541,7 @@
         CleanupStack::PopAndDestroy(stringHolder);
 	    doSave=(selection == CHbDeviceMessageBoxSymbian::EAcceptButton);
         }
-
+*/
     if ( doSave )
         {
         //Check that there still is enough space to store the certificate.
@@ -552,7 +550,7 @@
         }
     else
         {
-        ShowConfirmationNoteL( R_CERTSAVER_CERT_DISCARDED );
+        ShowInformationNoteL(R_CERTSAVER_CERT_DISCARDED);
         User::Leave( KErrCancel );
         }
   }
@@ -571,7 +569,7 @@
         TRAPD( status, iUnifiedCertStore = CUnifiedCertStore::NewL( iFs, ETrue ) );
         if ( status != KErrNone )
             {
-            ShowErrorNoteL( R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED );
+            ShowInformationNoteL( R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED );
             User::Leave( KErrExitApp );
             }
         // initialize unified cert store
@@ -707,7 +705,7 @@
         if ( certstoreIndex < 0 )
             {
             // Couldn't find certificate storage
-            ShowErrorNoteL( R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED );
+            ShowInformationNoteL( R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED );
             User::Leave( KErrExitApp );
             }
 
@@ -746,7 +744,7 @@
         {
         // If there is none WritableCertStore,
         // then at least cacerts.dat is corrupted.
-        ShowErrorNoteL( R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED );
+        ShowInformationNoteL( R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED );
         User::Leave( KErrExitApp );
         }
 
@@ -825,7 +823,7 @@
       if ( queryAccepted!=KErrNone )
             {
             // cancel
-            ShowConfirmationNoteL( R_CERTSAVER_CERT_DISCARDED );
+            ShowInformationNoteL(R_CERTSAVER_CERT_DISCARDED);
             return KErrCancel;
             }
         // Create filter to confirm that label doesn't already exist.
@@ -873,27 +871,27 @@
         {
         case KErrNone:
             {
-            ShowConfirmationNoteL( R_CERTSAVER_ERROR_SAVEOK );
+            ShowInformationNoteL(R_CERTSAVER_ERROR_SAVEOK);
             break;
             }
         case KErrNotSupported:
             {
-            ShowErrorNoteL( R_CERTSAVER_ERROR_UNSUPPORTED_CERT );
+            ShowInformationNoteL(R_CERTSAVER_ERROR_UNSUPPORTED_CERT);
             break;
             }
         case KErrBadName:
             {
-            ShowErrorNoteL( R_CERTSAVER_ERROR_LABEL_ALREADY_EXISTS );
+            ShowInformationNoteL(R_CERTSAVER_ERROR_LABEL_ALREADY_EXISTS);
             break;
             }
         case KErrAlreadyExists:
             {
-            ShowErrorNoteL( R_CERTSAVER_ERROR_ALREADY_EXISTS );
+            ShowInformationNoteL(R_CERTSAVER_ERROR_ALREADY_EXISTS);
             break;
             }
         case KErrArgument:
             {
-            ShowErrorNoteL( R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED );
+            ShowInformationNoteL(R_CERTSAVER_ERROR_CACERTS_DB_CORRUPTED);
             break;
             }
         default:
@@ -1191,17 +1189,17 @@
 
     if ( !CertificateSupported() ) 
         {
-        ShowErrorNoteL( R_CERTSAVER_ERROR_UNSUPPORTED_CERT   ); 
+        ShowInformationNoteL(R_CERTSAVER_ERROR_UNSUPPORTED_CERT);
         return EFalse;
         }
     if ( CertNotValidAnymore() )
         {
-        ShowErrorNoteL(R_CERTSAVER_ERROR_CERT_NOT_VALID);
+        ShowInformationNoteL(R_CERTSAVER_ERROR_CERT_NOT_VALID);
         return ETrue;
         }
     else if ( CertNotValidYet() )
         {
-        ShowErrorNoteL( R_CERTSAVER_ERROR_CERT_NOT_VALID_YET );
+        ShowInformationNoteL(R_CERTSAVER_ERROR_CERT_NOT_VALID_YET);
         }
     return ETrue;
     }
@@ -1249,34 +1247,13 @@
     {
 
     HBufC* buffer = iAppUi->CoeEnv()->AllocReadResourceLC( aResourceID );
-    CHbDeviceMessageBoxSymbian::InformationL(buffer->Des()); 
-    CleanupStack::PopAndDestroy( buffer );
-    }
-// ----------------------------------------------------------
-// CCertSaverModel::ShowConfirmationNoteL() const
-// Creates and shows a confirmation note.
-// ----------------------------------------------------------
-//
-void CCertSaverModel::ShowConfirmationNoteL( TInt aResourceID ) const
-    {
-
-    HBufC* buffer = iAppUi->CoeEnv()->AllocReadResourceLC( aResourceID );
-    CHbDeviceMessageBoxSymbian::WarningL(buffer->Des()); 
-    CleanupStack::PopAndDestroy( buffer );
-    }
-
-// ----------------------------------------------------------
-// CCertSaverModel::ShowErrorNoteL() const
-// Creates and shows an error note.
-// ----------------------------------------------------------
-//
-void CCertSaverModel::ShowErrorNoteL( TInt aResourceID ) const
-    {
-
-    HBufC* buffer = iAppUi->CoeEnv()->AllocReadResourceLC( aResourceID );
-    //TODO: can be changed when hb supports ErrorL
-    CHbDeviceMessageBoxSymbian::WarningL(buffer->Des()); 
-    CleanupStack::PopAndDestroy( buffer );
+    CHbDeviceMessageBoxSymbian* iMessageBox = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EInformation);
+    CleanupStack::PushL(iMessageBox);                                                                                    
+    iMessageBox->SetTextL(buffer->Des());                                                                                
+    iMessageBox->SetTimeout(6000);                                                                                      
+    iMessageBox->ExecL();                                                                                                
+    CleanupStack::PopAndDestroy(iMessageBox);                                                                            
+    CleanupStack::PopAndDestroy( buffer );      
     }
 
 // ----------------------------------------------------------
@@ -1407,7 +1384,7 @@
         }
     else
         {
-        ShowConfirmationNoteL( R_CERTSAVER_CERT_DISCARDED );
+        ShowInformationNoteL(R_CERTSAVER_CERT_DISCARDED);
         ret = KErrCancel;
         }
 
@@ -1448,7 +1425,7 @@
         }
     else
         {
-        ShowConfirmationNoteL( R_CERTSAVER_CERT_DISCARDED );
+        ShowInformationNoteL(R_CERTSAVER_CERT_DISCARDED);
         ret = KErrCancel;
         }
     CleanupStack::PopAndDestroy( prompt );
@@ -1579,8 +1556,10 @@
         }
     TInt status = KErrNone;
     // save private keys
-    TRAP( status, SavePrivateKeyL() );
-
+   if(CheckeBoxData.Compare(_L("1"))==0)
+   {
+       TRAP( status, SavePrivateKeyL() );
+   }
     // save user certificates if private key was saved.
     if ( ( iSavedKeysCount > 0 || iKeyAlreadyExists ) && iParser.UserCertificates().Count() > 0 )
         {
@@ -1613,24 +1592,28 @@
                 }
             }
         }
+/*
     if ( iSavedCACertsCount != 0 || iSavedKeysCount != 0
         || iSavedUserCertsCount != 0 )
         {
-        HBufC* p = StringLoader::LoadLC( R_CERTSAVER_HEADER_SAVED );
-        message = HBufC::NewLC( KMaxLengthTextMeassageBody );
-        message->Des().Append(p->Des());   
-        TPtr msgPtr2 = message->Des();
-        ConstructPKCS12QueryMsgL(
+// show how many have been saved
+        HBufC* p = StringLoader::LoadLC( R_CERTSAVER_HEADER_SAVED );             
+        message = HBufC::NewLC( KMaxLengthTextMeassageBody );                    
+        message->Des().Append(p->Des());                                         
+        TPtr msgPtr2 = message->Des();                                           
+        ConstructPKCS12QueryMsgL(                                                
             msgPtr2, iSavedKeysCount, iSavedUserCertsCount, iSavedCACertsCount );
-        CHbDeviceMessageBoxSymbian::InformationL(message->Des()); 
-        CleanupStack::PopAndDestroy( message );
-        CleanupStack::PopAndDestroy( p );       
+        CHbDeviceMessageBoxSymbian::InformationL(message->Des());                
+        CleanupStack::PopAndDestroy( message );                                  
+        CleanupStack::PopAndDestroy( p );                                        
         }
     else
         {
+        // the contents could not be saved is dropped
         ShowInformationNoteL( R_QTN_CM_PKCS12_SAVING_FAILED );
         CleanupStack::PopAndDestroy( message );
         }
+*/
     }
 
 // ----------------------------------------------------------
--- a/pkiutilities/CertSaver/src/certparser.cpp	Wed Jun 23 19:10:54 2010 +0300
+++ b/pkiutilities/CertSaver/src/certparser.cpp	Tue Jul 06 15:15:05 2010 +0300
@@ -167,20 +167,12 @@
 
     TBool done = EFalse;
     TBuf<KPwMaxLength> password;
-    HBufC* buffer = NULL;
-
-    if ( !iEikEnv )
-        {
-        iEikEnv = CEikonEnv::Static();
-        }
 
     while ( !done )
         {
         if ( !GetPasswordL( password, aFileName ) )
             {
-            buffer = iEikEnv->AllocReadResourceLC( R_CERTSAVER_PKCS12_DISCARDED );
-            CHbDeviceMessageBoxSymbian::InformationL(buffer->Des()); 
-            CleanupStack::PopAndDestroy( buffer );
+            ShowErrorNoteL(R_CERTSAVER_PKCS12_DISCARDED);
             User::Leave( KErrExitApp );
             }
         TRAPD( err, iPKCS12->ParseL( aPKCS12, password ) );
@@ -385,8 +377,13 @@
         iEikEnv = CEikonEnv::Static();
         }
     HBufC* buffer = iEikEnv->AllocReadResourceLC( aResourceID );
-    CHbDeviceMessageBoxSymbian::WarningL(buffer->Des()); 
-    CleanupStack::PopAndDestroy( buffer );
+    CHbDeviceMessageBoxSymbian* iMessageBox = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EWarning);
+    CleanupStack::PushL(iMessageBox);                                                                                    
+    iMessageBox->SetTextL(buffer->Des());                                                                                
+    iMessageBox->SetTimeout(6000);                                                                                      
+    iMessageBox->ExecL();                                                                                                
+    CleanupStack::PopAndDestroy(iMessageBox);                                                                            
+    CleanupStack::PopAndDestroy( buffer );                                                                               
     }
 
 //  End of File
--- a/pkiutilities/StubSIS/swipolicy.ini	Wed Jun 23 19:10:54 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-AllowUnsigned = false
-MandatePolicies = false
-MandateCodeSigningExtension = false
-Oid = 1.2.3.4.5.6
-Oid = 2.3.4.5.6.7
-DRMEnabled = true
-DRMIntent = 3
-OcspMandatory = false
-OcspEnabled = true
-AllowGrantUserCapabilities = true
-AllowOrphanedOverwrite = true
-UserCapabilities = NetworkServices LocalServices ReadUserData WriteUserData UserEnvironment Location 
-AllowPackagePropagate = true
-SISCompatibleIfNoTargetDevices = false
-RunWaitTimeoutSeconds = 600
-AllowRunOnInstallUninstall = false
-DeletePreinstalledFilesOnUninstall = true
-AlternativeCodeSigningOID = 1.3.6.1.4.1.94.1.49.1.2.2.1 1.3.6.1.4.1.94.1.49.1.2.2.5
-RemoveOnlyWithLastDependent = true
-PhoneTsyName = phonetsy
--- a/pkiutilities/StubSIS/tlsproviderpolicy.ini	Wed Jun 23 19:10:54 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-ClientAuthDlgEnabled = true
-
--- a/pkiutilities/group/bld.inf	Wed Jun 23 19:10:54 2010 +0300
+++ b/pkiutilities/group/bld.inf	Tue Jul 06 15:15:05 2010 +0300
@@ -27,14 +27,6 @@
 ../StubSIS/CenRepStub.sis   /epoc32/data/z/system/install/CenRepStub.sis
 
 
-//SWI and TLSProvider config files
-../StubSIS/swipolicy.ini    /epoc32/release/winscw/udeb/z/system/data/swipolicy.ini
-../StubSIS/swipolicy.ini    /epoc32/release/winscw/urel/z/system/data/swipolicy.ini
-../StubSIS/swipolicy.ini    /epoc32/data/z/system/data/swipolicy.ini
-                            
-../StubSIS/tlsproviderpolicy.ini  /epoc32/release/winscw/urel/z/resource/tlsproviderpolicy.ini
-../StubSIS/tlsproviderpolicy.ini  /epoc32/release/winscw/udeb/z/resource/tlsproviderpolicy.ini
-
 // export iby files
 ../rom/x509certnameparser.iby   CORE_MW_LAYER_IBY_EXPORT_PATH( x509certnameparser.iby )
 ../rom/pkcs12.iby               CORE_MW_LAYER_IBY_EXPORT_PATH( pkcs12.iby )
--- a/pkiutilities/rom/StubSIS.iby	Wed Jun 23 19:10:54 2010 +0300
+++ b/pkiutilities/rom/StubSIS.iby	Tue Jul 06 15:15:05 2010 +0300
@@ -25,6 +25,4 @@
 
 data=ZSYSTEM\install\CenRepStub.sis    System\Install\CenRepStub.sis
 
-//data = EPOCROOT##epoc32\release\winscw\urel\z\system\data\swipolicy.ini  System\data\swipolicy.ini
-
 #endif
--- a/pkiutilities/untrustedcertificatedialog/src/untrustedcertificatewidget.cpp	Wed Jun 23 19:10:54 2010 +0300
+++ b/pkiutilities/untrustedcertificatedialog/src/untrustedcertificatewidget.cpp	Tue Jul 06 15:15:05 2010 +0300
@@ -24,6 +24,7 @@
 #include <hbgroupbox.h>
 #include <hbtextedit.h>
 #include <QGraphicsLinearLayout>
+#include <QDebug>
 
 const int KUnknownError = -5;           // KErrNotSupported
 
@@ -84,7 +85,8 @@
 
     Q_ASSERT(mCertificateDetailsText == 0);
     mCertificateDetailsText = new HbTextEdit;
-    QString certificateDetails = mCertificateInfo->certificateDetails(mServerName);
+    qDebug() << "fixing Certificatedialog.length() to 63";
+    QString certificateDetails = mCertificateInfo->certificateDetails(mServerName).left(63);
     mCertificateDetailsText->setPlainText(certificateDetails);
     mCertificateDetailsText->setReadOnly(true);
 
--- a/secsrv_plat/security_code_ui_api/inc/SecUiSecurityHandler.h	Wed Jun 23 19:10:54 2010 +0300
+++ b/secsrv_plat/security_code_ui_api/inc/SecUiSecurityHandler.h	Tue Jul 06 15:15:05 2010 +0300
@@ -112,7 +112,15 @@
         */
         void RemoveSplashScreenL() const;
         
+        /**
+        *  ShowGenericErrorNoteL
+        */
         void ShowGenericErrorNoteL(TInt aStatus);
+        /**
+        *  CancelOpenQuery
+        */
+			TInt CancelOpenQuery(TInt aStatus);
+
 	private: // DATA
 		/*****************************************************
 		*	Series 60 Customer / ETel
--- a/securitydialogs/Autolock/Autolock.pro	Wed Jun 23 19:10:54 2010 +0300
+++ b/securitydialogs/Autolock/Autolock.pro	Tue Jul 06 15:15:05 2010 +0300
@@ -34,6 +34,7 @@
 LIBS+=-lxqservice -lxqserviceutil -lflogger
 LIBS += -L../../../../../bin/release -lautolockuseractivityservice
 LIBS += -lsecui -letelmm -letel -lcustomapi -lcentralrepository
+LIBS += -lcone -lws32 -lkeylockpolicyapi
 
 SERVICE.FILE = service_conf.xml
 SERVICE.OPTIONS = embeddable
@@ -53,6 +54,8 @@
 				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 += "./rom/Autolock.iby            CORE_APP_LAYER_IBY_EXPORT_PATH(Autolock.iby)"
+BLD_INF_RULES.prj_exports += "./conf/Autolock.confml        MW_LAYER_CONFML(Autolock.confml)"
+BLD_INF_RULES.prj_exports += "./conf/CI_Autolock.confml     MW_LAYER_CONFML(CI_Autolock.confml)"
+BLD_INF_RULES.prj_exports += "./rom/AutolockSrv.iby         CORE_APP_LAYER_IBY_EXPORT_PATH(AutolockSrv.iby)"
 BLD_INF_RULES.prj_exports += "./PubSub/SecurityUIsPrivatePSKeys.h |../../inc/securityuisprivatepskeys.h"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/securitydialogs/Autolock/autolockuseractivityservice/bwins/autolockuseractivityserviceu.def	Tue Jul 06 15:15:05 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
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/securitydialogs/Autolock/autolockuseractivityservice/eabi/autolockuseractivityserviceu.def	Tue Jul 06 15:15:05 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
+
Binary file securitydialogs/Autolock/conf/Autolock.confml has changed
Binary file securitydialogs/Autolock/conf/CI_Autolock.confml has changed
--- a/securitydialogs/Autolock/src/Autolock.cpp	Wed Jun 23 19:10:54 2010 +0300
+++ b/securitydialogs/Autolock/src/Autolock.cpp	Tue Jul 06 15:15:05 2010 +0300
@@ -66,7 +66,7 @@
 #include <secuisecurityhandler.h>
 #include <etelmm.h>
 #include <rmmcustomapi.h>
-
+#include <keylockpolicyapi.h>
 #include <qvaluespacesubscriber.h>
 
 #include <hwrmlightdomaincrkeys.h>
@@ -119,7 +119,7 @@
     
     // This is important: we set the status through a property
     TInt autolockState;
-    RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolockState);
+    ret = RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolockState);
     RDEBUG("Get KCoreAppUIsAutolockStatus", ret);
     RDEBUG("autolockState", autolockState);
     if(autolockState==EAutolockStatusUninitialized)
@@ -280,17 +280,16 @@
 
     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);
+    // if I want to release, I should do:   mKeyCaptureHandle = env->RootWin().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
+    iDeviceDialogCreated = EDeviceDialogUninitialized;
+    RDEBUG("new iDeviceDialogCreated", iDeviceDialogCreated);
+    iDeviceDialog = NULL;
+    // for now, always starts unlocked. This is correct because if locked, the unlock-query (from starter) is on top
     // TryChangeStatus(iLockStatus);
     TryChangeStatus( ELockNotActive);
     lower();
@@ -372,8 +371,7 @@
     TInt thisTry(0);
     RTelServer iTelServer;
 
-    err = RProperty::Set(KPSUidSecurityUIs,
-            KSecurityUIsLights, ESecurityUIsLightsQueryOnRequest);
+    err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsLights, ESecurityUIsLightsQueryOnRequest);
 		RDEBUG("KSecurityUIsLights err", err);
 
     RMmCustomAPI iCustomPhone;
@@ -501,7 +499,6 @@
          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;
@@ -598,7 +595,7 @@
 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)
+    // 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 check for Starter)
     TInt secUiOriginatedQuery(ESecurityUIsSecUIOriginatedUninitialized);
     TInt err = RProperty::Get(KPSUidSecurityUIs,
             KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery);
@@ -615,7 +612,7 @@
             switch (iLockStatus)
                 {
                 case ELockNotActive:
-                    if (1 == 0) // !CKeyLockPolicyApi::KeyguardAllowed() )
+                    if ( !CKeyLockPolicyApi::KeyguardAllowed() )
                         return KErrPermissionDenied;
                     else
                         return KErrNone;
@@ -771,7 +768,9 @@
             err = RProperty::Set(KPSUidCoreApplicationUIs,
                     KCoreAppUIsAutolockStatus, EAutolockOff);
             RDEBUG("err", err);
-            // lights are required ?
+            err = RProperty::Set(KPSUidSecurityUIs,
+                        KSecurityUIsLights, ESecurityUIsLightsLockOnRequest);	// lights are required
+         		RDEBUG("KSecurityUIsLights err", err);
 
             // cRresult = repositoryDevicelock->Set(KSettingsAutolockStatus, 0);	// the settings remains. Only ISA changes, as well as the P&S
             cRresult = repositoryKeyguard->Set(KSysApKeyguardActive, 0);
@@ -860,9 +859,9 @@
 
 		// this will cancel any previous dialog, i.e. PIN query, or any previous code-request.
 		// not sure about the screensaver, but nevertheless will be cancelled when the status is changed.
-    TInt err = RProperty::Set(KPSUidSecurityUIs,
-            KSecurityUIsDismissDialog,
-            ESecurityUIsDismissDialogOn);
+		TInt err = KErrNone;
+		RDEBUG("Not setting KSecurityUIsDismissDialog ESecurityUIsDismissDialogOn", ESecurityUIsDismissDialogOn);
+    //// err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsDismissDialog, ESecurityUIsDismissDialogOn);
 		RDEBUG("err", err);
     switch (ret)
         {
@@ -876,6 +875,7 @@
                 updateIndicator(EKeyguardActive);
                 publishStatus(EKeyguardActive);
                 showNoteIfRequested(EKeyguardActive);
+                setLockDialog(aReason, 1);
                 }
             }
             break;
@@ -889,6 +889,7 @@
                 updateIndicator(ELockNotActive);
                 publishStatus(ELockNotActive);
                 showNoteIfRequested(ELockNotActive);
+                setLockDialog(aReason, 0);
                 }
             }
             break;
@@ -926,8 +927,13 @@
             if (errorInProcess == KErrNone)
                 {
                	setLockDialog(aReason, 0); // hide temporarilly because HbDeviceMessageBox doesn't get in top of the Lock-icon. Thus, dismiss it.
+               	// do I need to enable touch? it seems to work without it
+               	// in any case, lights are needed
+               	err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsLights, ESecurityUIsLightsQueryOnRequest);
                 RDEBUG("calling HbDeviceMessageBox::question", 0);
-                bool value = HbDeviceMessageBox::question("Disable Lock?");	// this doesn't block other events, so after return everything might be messed up.
+                bool value = true;
+                // not sure whether this question is really needed. The UI doesn't say anything, so I remove it for now.
+                // HbDeviceMessageBox::question("Disable Lock?");	// this doesn't block other events, so after return everything might be messed up.
                 RDEBUG("value", value);
                 if (!value)
                     errorInProcess = KErrCancel;
@@ -943,12 +949,13 @@
                 {
                 setLabelIcon( ELockNotActive);
                 updateIndicator(ELockNotActive);
+                setLockDialog(aReason, 0);
                 publishStatus(ELockNotActive);
                 }
             if (errorInProcess != KErrNone)
                 { // re-lock. For example, if password is wrong
                	if( iLockStatus >=EDevicelockActive)	// this skips the case "unlocking although it wasn't locked"
-                	setLockDialog(aReason, 1);
+                	setLockDialog(ELockAppEnableDevicelock, 1);
                 }
             // this never shows a note
             }
@@ -960,9 +967,9 @@
             if (errorInProcess == KErrNone)
                 {
                 // no need to dismiss screensaver, because it's not active
-                // TODO what about any PIN-query, i.e. from settings ? In this case, the query will show after the PIN query is finished. somehow this is good because PIN is more important
+                // what about any PIN-query, i.e. from settings ? In this case, the query will show after the PIN query is finished. somehow this is good because PIN is more important
                 bool value = HbDeviceMessageBox::question("Enable Keyguard?");	// this doesn't block other events, so after return everything might be messed up.
-                // TODO what about a nice icon?
+                // what about a nice icon?
                 RDEBUG("value", value);
                 if (!value)
                     errorInProcess = KErrCancel;
@@ -1026,22 +1033,41 @@
 		
     if (status == 0) // hide
         {
+        // aReason is not important here, but let's check nevertheless
+        if (aReason != ELockAppDisableKeyguard && aReason != ELockAppDisableDevicelock )
+        	{
+        	RDEBUG("!!!!****!!!!! error. status=0 but aReason", aReason);
+        	}
         // secUiOriginatedQuery should be ESecurityUIsSystemLockOriginated . If not, this is not correctly setting it
-        if (iDeviceDialogCreated > 0)
+        if (iDeviceDialogCreated >= EDeviceDialogCreated)
             {
-            iDeviceDialogCreated = 0;
-            iDeviceDialog->cancel();
+            iDeviceDialogCreated = EDeviceDialogDestroyed;
+            RDEBUG("new iDeviceDialogCreated", iDeviceDialogCreated);
+            disconnect( iDeviceDialog, SIGNAL(dataReceived(QVariantMap)), this, SLOT(handleMessageFromScreensaver(QVariantMap)) );
+            RDEBUG("signal disconnected", err);
+            err = iDeviceDialog->cancel();
+            RDEBUG("cancel (bool: 1= wellCancelled) err", err);
             err = iDeviceDialog->error();
             RDEBUG("err", err);
+            RDEBUG("calling iDeviceDialog->waitForClosed()", 0);
+            err = iDeviceDialog->waitForClosed();
+            RDEBUG("cancel (bool: 1= well waitForClosed) err", err);
+            err = iDeviceDialog->error();
+            RDEBUG("err", err);
+
             TInt err = RProperty::Set(KPSUidSecurityUIs,
                     KSecurityUIsSecUIOriginatedQuery,
                     ESecurityUIsSecUIOriginatedUninitialized);
-            RDEBUG("err", err);
+            RDEBUG("reset KSecurityUIsSecUIOriginatedQuery. err", err);
             // Cancel power key and application key capturing
             groupWin.CancelCaptureKey( mPowerKeyCaptureHandle );
             groupWin.CancelCaptureKey( mApplicationKeyCaptureHandle );
             groupWin.CancelCaptureLongKey( mApplicationLongKeyCaptureHandle );
             RDEBUG("done CancelCaptureKey", 1);
+            RDEBUG("deleting iDeviceDialog", 0);
+            delete iDeviceDialog;
+            RDEBUG("deleted iDeviceDialog", 1);
+            iDeviceDialog = NULL;
             }
         }
     else if (status == 1) // show
@@ -1052,9 +1078,9 @@
 #define ESecUiTypeDeviceLock		0x00100000
 #define ESecUiTypeKeyguard			0x00200000
 
-        if (aReason == EKeyguardActive)
+        if (aReason == ELockAppEnableKeyguard)
             params.insert("type", ESecUiTypeKeyguard);
-        else if (aReason >= EDevicelockActive)
+        else if (aReason == ELockAppEnableDevicelock)
             params.insert("type", ESecUiTypeDeviceLock);
         else
             {
@@ -1062,13 +1088,19 @@
             }
         // no need for title. Icon should be explicit enough
         // params.insert("title", "Locked");
-        if (iDeviceDialogCreated <= 0)
+        if (iDeviceDialogCreated < EDeviceDialogCreated)
             {
+            if(iDeviceDialog != NULL)
+            	{
+            	RDEBUG("!!!!!!*********!!!!!!!! error: iDeviceDialog != NULL", 0);
+            	}
             RDEBUG("creating iDeviceDialog", 0);
             iDeviceDialog = new HbDeviceDialog(HbDeviceDialog::NoFlags, this);
+            // in theory this is needed only for screensaver, not for LockIcon. But it doesn't harm
             connect( iDeviceDialog, SIGNAL(dataReceived(QVariantMap)), 
                      SLOT(handleMessageFromScreensaver(QVariantMap)) );
-            iDeviceDialogCreated = 1;
+            iDeviceDialogCreated = EDeviceDialogCreated;
+            RDEBUG("new iDeviceDialogCreated", iDeviceDialogCreated);
             }
         else
             {
@@ -1076,7 +1108,8 @@
             // confirm that dialog is present
             err = iDeviceDialog->error();
             RDEBUG("err", err);
-            iDeviceDialogCreated = 2;
+            iDeviceDialogCreated = EDeviceDialogRaised;
+            RDEBUG("new iDeviceDialogCreated", iDeviceDialogCreated);
             }
         const QString KScreensaverDeviceDialog("com.nokia.screensaver.snsrdevicedialogplugin/1.0");
         RDEBUG("pre show", aReason);
@@ -1086,15 +1119,18 @@
         RDEBUG("iDeviceDialog->error", err);
         if(!err)
         	{
-        	switchScreensaverToActiveMode();	// TODO not sure if this is needed
+        	iDeviceDialogCreated = EDeviceDialogScreenSaver;
+        	RDEBUG("new iDeviceDialogCreated", iDeviceDialogCreated);
+        	switchScreensaverToActiveMode();	// this is needed in case the dialog was existing.
         	}
-        else	// some err
+        else	// some err. Usually 3 (not existing)
         	{
         		// screensaver has failed. Probably because it's not installed. Then, try the standard lock-icon
-        	err = iDeviceDialog->error();
-        	RDEBUG("err", err);
+        	iDeviceDialogCreated = EDeviceDialogLockIcon;
+        	RDEBUG("new iDeviceDialogCreated", iDeviceDialogCreated);
         	const QString KSecQueryUiDeviceDialog("com.nokia.secuinotificationdialog/1.0");
         	err = iDeviceDialog->show(KSecQueryUiDeviceDialog, params); // and continue processing
+        	RDEBUG("post show. err", err);
         	}
       	err = iDeviceDialog->error();
       	RDEBUG("err", err);
@@ -1102,9 +1138,9 @@
         // 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 ?
+                ESecurityUIsSecUIOriginatedUninitialized);	// this could also be ESecurityUIsSystemLockOriginated
         RDEBUG("err", err);
-        // Capture power and application keys while screen saver is open
+        // Capture power and application keys while screen saver is open. Also works for LockIcon
         mPowerKeyCaptureHandle = groupWin.CaptureKey( EKeyDevice2, 0, 0 );
         mApplicationKeyCaptureHandle = groupWin.CaptureKey( EKeyApplication0, 0, 0 );
         mApplicationLongKeyCaptureHandle = groupWin.CaptureLongKey( 
@@ -1119,19 +1155,20 @@
         }
     return KErrNone;
     }
+
 void Autolock::setLabelIcon(int aReason)
     {
     RDEBUG("aReason", aReason);
 
     if (aReason == ELockNotActive)
         {
-        setLockDialog(aReason, 0); // TODO isn't this done already at TryChangeStatus ???
+        // setLockDialog(aReason, 0); // This is done already at TryChangeStatus
         lower();
         hide();
         }
     else if (aReason == EKeyguardActive)
         {
-        setLockDialog(aReason, 1);
+        // setLockDialog(aReason, 1); // This is done already at TryChangeStatus
         // this shows the Autolock Application. not needed
         }
     else if (aReason == EDevicelockActive)
@@ -1187,7 +1224,7 @@
         }
     else
     		{
-        // switch-off the lights. The scenario is: keyguard->screensaver->CriticalNote->lightsOn . Therefore we need lightsOff
+        // restart screensaver. The scenario is: keyguard->screensaver->CriticalNote->lightsOn . Therefore we need lightsOff
         // this is done when keyguard can't be enabled because it's already enabled
         // Note that this happens only once, so it's fine to show the screensaver in full light.
         if(ret==KErrAlreadyExists)
@@ -1221,9 +1258,22 @@
     RDEBUG("0", 0);
     if ( iDeviceDialog )
         {
-        RDEBUG("got iDeviceDialog", 1);
+        RDEBUG("got iDeviceDialog. iDeviceDialogCreated", iDeviceDialogCreated);
         QVariantMap params;
+        // this is for LockIcon. Doesn't harm screensaver
+        // need to send again so that the existing dialog still knows what is its type
+        if (iLockStatus == EKeyguardActive)
+        	params.insert("type", ESecUiTypeKeyguard);
+        else if (iLockStatus >= EDevicelockActive)
+            params.insert("type", ESecUiTypeDeviceLock);
+
+        // this is for screensaver. Doesn't harm LockIcon
         params.insert( KSnsrViewTypeKey, KSnsrViewTypeValueActive );
+        
+        // when screesanver triggers, set the lights. DeviceDialogs does it only on creation, not on update.
+		    TInt err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsLights, ESecurityUIsLightsQueryOnRequest);
+				RDEBUG("KSecurityUIsLights err", err);
+
         iDeviceDialog->update(params);
         
         // (re)start timer to switch to the power save mode
@@ -1241,8 +1291,16 @@
     RDEBUG("0", 0);
     if ( iDeviceDialog )
         {
-        RDEBUG("got iDeviceDialog", 1);
+        RDEBUG("got iDeviceDialog. iDeviceDialogCreated", iDeviceDialogCreated);
         QVariantMap params;
+        // this is for LockIcon. Doesn't harm screensaver
+        // need to send again so that the existing dialog still knows what is its type
+        if (iLockStatus == EKeyguardActive)
+        	params.insert("type", ESecUiTypeKeyguard);
+        else if (iLockStatus >= EDevicelockActive)
+            params.insert("type", ESecUiTypeDeviceLock);
+
+        // this is for screensaver. Doesn't harm LockIcon
         params.insert( KSnsrViewTypeKey, KSnsrViewTypeValueStandby );
         iDeviceDialog->update(params);
         
@@ -1268,21 +1326,28 @@
     }
 
 // some key is pressed
+// TODO perhaps need a way to stop switch-key while asking unlock-code?
+// Not clear what to do here. dismiss query? 
 bool Autolock::event(QEvent *ev)
     {
     if (ev)
         {
         int isSwitchKey = 0;
-        // on device, this doesn't seem to get the EKeyDeviceF key: only 1ffffff
 				if (ev->type() == QEvent::KeyPress)
             {
             QKeyEvent *keyEvent = static_cast<QKeyEvent *> (ev);
             RDEBUG("KeyPress", keyEvent->key());
             RDEBUG("KeyPress nativeScanCode", keyEvent->nativeScanCode());
             RDEBUG("EStdKeyDeviceF", EStdKeyDeviceF);
-            RDEBUG("EStdKeyDeviceF", EKeyInsert);
+            RDEBUG("EKeyDeviceF", EKeyDeviceF);
             RDEBUG("keyEvent->isAutoRepeat()", keyEvent->isAutoRepeat());
-            if( !keyEvent->isAutoRepeat() )
+            if ( keyEvent->nativeScanCode() == EStdKeyApplication0 || keyEvent->nativeScanCode() == EStdKeyDevice2 )
+              {
+              // switch to active screensaver if application key or power key pressed while screensaver active
+              // This key can be repeated, so that the screensaver remains as long as key is pushed
+              switchScreensaverToActiveMode();
+              }
+            else if( !keyEvent->isAutoRepeat() )
             	{
 	            if (keyEvent->key() == EKeyInsert )
 	                {
@@ -1301,11 +1366,11 @@
 	                RDEBUG("got EStdKeyDeviceF", EStdKeyDeviceF);
 	                isSwitchKey = 1;
 	                }
-              else if ( keyEvent->nativeScanCode() == EStdKeyApplication0 || keyEvent->nativeScanCode() == EStdKeyDevice2 )
-                {
-                // switch to active screensaver if application key or power key pressed while screensaver active
-                switchScreensaverToActiveMode();
-                }
+	            else if (keyEvent->nativeScanCode() == EKeyBell)	// this might be sent by others, i.e. PCFW
+	                {
+	                RDEBUG("got EKeyBell", EKeyBell);
+	                isSwitchKey = 1;
+	                }
               else if (keyEvent->key() == 0x1ffffff)
                 {
                 RDEBUG("0x1ffffff", 0x1ffffff);	// some unknown key is received. Nothing to do
@@ -1342,15 +1407,18 @@
     if (iLockStatus == ELockNotActive)
         {
         iShowKeyguardNote = 1; // note on enable keyguard
+        callerHasECapabilityWriteDeviceData = 1;
         ret = TryChangeStatus(ELockAppEnableKeyguard); // this should not ask confirmation
         }
     else if (iLockStatus == EKeyguardActive)
         {
         iShowKeyguardNote = 1; // note on disable keyguard
+        callerHasECapabilityWriteDeviceData = 1;
         ret = TryChangeStatus(ELockAppDisableKeyguard);
         }
     else if (iLockStatus == EDevicelockActive)
         {
+        callerHasECapabilityWriteDeviceData = 1;
         ret = TryChangeStatus(ELockAppDisableDevicelock);
         }
     else
@@ -1447,6 +1515,10 @@
 void Autolock::subscriberKSecurityUIsDismissDialogChanged()
     {
     RDEBUG("0", 0);
+    TInt aDismissDialog = ESecurityUIsDismissDialogUninitialized;
+    TInt err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsDismissDialog, aDismissDialog );
+    RDEBUG("err", err);
+    RDEBUG("aDismissDialog", aDismissDialog);
 		}
 // ----------AutolockService---------------
 
--- a/securitydialogs/Autolock/src/Autolock.h	Wed Jun 23 19:10:54 2010 +0300
+++ b/securitydialogs/Autolock/src/Autolock.h	Tue Jul 06 15:15:05 2010 +0300
@@ -64,6 +64,17 @@
 	EDevicelockTimer
 	};
 
+enum TDeviceDialogCreated
+	{
+	EDeviceDialogUninitialized = -1,
+	EDeviceDialogDestroyed = 0,
+	EDeviceDialogCreated = 1,
+	EDeviceDialogRaised = 2,
+	EDeviceDialogScreenSaver = 0x10,
+	EDeviceDialogLockIcon= 0x11,
+	EDeviceDialogLastValue
+	};
+
 class QTimer;
 
 class AutolockService;
--- a/securitydialogs/Autolock/src/main.cpp	Wed Jun 23 19:10:54 2010 +0300
+++ b/securitydialogs/Autolock/src/main.cpp	Tue Jul 06 15:15:05 2010 +0300
@@ -24,6 +24,7 @@
 
 #include <QApplication>
 #include "Autolock.h"
+#include "../PubSub/securityuisprivatepskeys.h"
 
 #include <hbapplication.h>
 #include <hbmainwindow.h>
@@ -33,16 +34,33 @@
     // qInstallMsgHandler(XQSERVICEMESSAGEHANDLER);
     // XQSERVICE_DEBUG_PRINT(" ================== xxxx Autolock::main");
     qDebug() << "================== xxxx QApplication Autolock::main";
+    
+    
+    // Need to check whether process is already running. This happens if it's started from Stater, and 
+    // before fully initialized, it's started by API through QtHighway
+    TSecurityPolicy readPolicy(ECapabilityReadDeviceData);
+    TSecurityPolicy writePolicy(ECapabilityWriteDeviceData);
+    int ret = RProperty::Define(KPSUidSecurityUIs,
+            KSecurityUIsLockInitiatorUID, RProperty::EInt, readPolicy,
+            writePolicy);
+		qDebug() << "KSecurityUIsLockInitiatorUID ret=" << ret;
+		int err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsLockInitiatorUID, 0);
+
+    // it takes about 3 seconds to start it, on device
     QApplication a( argc, argv );
     Autolock *cl = new Autolock();
-    // qDebug() << " ================== xxxx cl->show";
+    // qDebug() << " Autolock::main cl->show";
     // cl->show();
-    // qDebug() << " ================== xxxx cl->hide";
+    // qDebug() << " Autolock::main cl->hide";
     cl->hide();
-    // qDebug() << " ================== xxxx cl->lower";
+    // qDebug() << " Autolock::main cl->lower";
     cl->lower();
+    qDebug() << " Autolock::main cl->lower";
+    err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsLockInitiatorUID, 1);
     int rv = a.exec();
+    qDebug() << " Autolock::main cl->exec";
     delete cl;
+    qDebug() << " Autolock::main cl->delete";
     return rv;
 }
 
--- a/securitydialogs/SecUi/Src/SecQueryUi.cpp	Wed Jun 23 19:10:54 2010 +0300
+++ b/securitydialogs/SecUi/Src/SecQueryUi.cpp	Tue Jul 06 15:15:05 2010 +0300
@@ -99,8 +99,16 @@
     TInt err = RProperty::Get(KPSUidSecurityUIs,
             KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery);
     RDEBUG("secUiOriginatedQuery", secUiOriginatedQuery);
-    if (secUiOriginatedQuery != ESecurityUIsSecUIOriginatedUninitialized)
+    if (secUiOriginatedQuery == ESecurityUIsSecUIOriginatedUninitialized )	// &&  )
         {
+        // set only if not set
+        err = RProperty::Set(KPSUidSecurityUIs,
+                KSecurityUIsSecUIOriginatedQuery,
+                ESecurityUIsETelAPIOriginated);
+        RDEBUG("setting secUiOriginatedQuery", ESecurityUIsETelAPIOriginated);
+      	}
+		else if ( secUiOriginatedQuery != ESecurityUIsSecUIOriginated )
+				{
         RDEBUG("!!!! warning: secUiOriginatedQuery", secUiOriginatedQuery);
         // The query is already shown. This is valid for ESecurityUIsSecUIOriginated, and maybe for ESecurityUIsETelAPIOriginated
         // For ESecurityUIsSystemLockOriginated it means that the "lock" dialog is already present.
@@ -109,17 +117,12 @@
         err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsDismissDialog, aDismissDialog);
         // it might happen that the dialog is already dismissing. Well, it won't harm to try again.
         RDEBUG("aDismissDialog", aDismissDialog);
+        RDEBUG("err", err);
+        RDEBUG("set KSecurityUIsDismissDialog", ESecurityUIsDismissDialogOn);
         err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsDismissDialog, ESecurityUIsDismissDialogOn);
+        RDEBUG("err", err);
         }
-    else
-        {
-        // set only if not set
-        err = RProperty::Set(KPSUidSecurityUIs,
-                KSecurityUIsSecUIOriginatedQuery,
-                ESecurityUIsETelAPIOriginated);
-        RDEBUG("setting secUiOriginatedQuery", ESecurityUIsETelAPIOriginated);
-        }
-		RDEBUG("calling ClearParamsAndSetNoteTypeL aMode=", aMode);
+		RDEBUG("calling ClearParamsAndSetNoteTypeL aMode", aMode);
     ClearParamsAndSetNoteTypeL(aMode);
     AddParamL(_L("KSecQueryUiApplicationName"), aCaption);
 
@@ -129,20 +132,18 @@
     AddParamL(_L("MinLength"), aMinLength);
     AddParamL(_L("MaxLength"), aMaxLength);
 
-// ESecUiBasicTypeMultiCheck
-
     switch (aMode & ESecUiBasicTypeMask) {
-    case ESecUiBasicTypeCheck:
+    	case ESecUiBasicTypeCheck:
                              _LIT(KChecboxDialog, "ChecboxDialog");
                              _LIT(KChecbox, "ChecboxDialog");
                              AddParamL(KChecboxDialog,KChecbox);
                              break;
-    case ESecUiBasicTypeMultiCheck:
+    	case ESecUiBasicTypeMultiCheck:
                             _LIT(KMultiChecboxDialog, "MultiChecboxDialog");
                             _LIT(KMultiChecbox, "MultiChecboxDialog");
                             AddParamL(KMultiChecboxDialog,KMultiChecbox);
                             break;
-    default:
+    	default:
                             _LIT(KCodeTop, "codeTop");
                             _LIT(KCodeTopValue, "codeTop");
                             AddParamL(KCodeTop, KCodeTopValue);
--- a/securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp	Wed Jun 23 19:10:54 2010 +0300
+++ b/securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp	Tue Jul 06 15:15:05 2010 +0300
@@ -93,9 +93,12 @@
         *iDestroyedPtr = ETrue;
         iDestroyedPtr = NULL;
         }
-    CancelSecCodeQuery();
+    RDEBUG("calling CancelOpenQuery", 0);
+    TInt err = CancelOpenQuery(-1);
+    RDEBUG("err", err);
     iCustomPhone.Close();
     FeatureManager::UnInitializeLib();
+   	RDEBUG("1", 1);
     }
 //
 // ----------------------------------------------------------
@@ -230,7 +233,6 @@
         }
     /* end check for default code */
 
-    iQueryCanceled = EFalse;
     RMobilePhone::TMobilePassword required_fourth;
 
     TInt ret = KErrNone;
@@ -248,6 +250,7 @@
         CSecQueryUi *iSecQueryUi;
         RDEBUG("CSecQueryUi", 0);
         iSecQueryUi = CSecQueryUi::NewL();
+				iQueryCanceled = EFalse;
         lAlphaSupported = ESecUiAlphaSupported;
         lCancelSupported = ESecUiCancelSupported;
         TBuf<0x100> title;
@@ -264,6 +267,7 @@
         RDEBUG("iSecUi_password", 0);
         RDebug::Print(iSecUi_password);
         RDEBUG("delete", 0);
+        iQueryCanceled = ETrue;
         delete iSecQueryUi;
         RDEBUG("queryAccepted", queryAccepted);
         /* end request PIN using QT */
@@ -314,7 +318,7 @@
                     queryAccepted = KErrNone;
                     }
 
-                iQueryCanceled = ETrue; // TODO
+                iQueryCanceled = ETrue;
                 return ETrue;
                 }
             case KErrGsmSSPasswordAttemptsViolation:
@@ -345,6 +349,53 @@
     }
 //
 // ----------------------------------------------------------
+// Cancels all security code queries
+// aStatus = -1		from destructor
+// aStatus =  1		from API. Will kill all dialogs through signal P&S
+// ----------------------------------------------------------
+// qtdone
+TInt CSecurityHandler::CancelOpenQuery(TInt aStatus)
+    {
+		RDEBUG("aStatus", aStatus);
+		RDEBUG("iQueryCanceled", iQueryCanceled);
+		TInt res = 0;
+		
+		if(aStatus==1)	// also signal all other dialogs
+				{
+				RDEBUG("set KSecurityUIsDismissDialog to ESecurityUIsDismissDialogOn", ESecurityUIsDismissDialogOn);
+		    TInt err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsDismissDialog, ESecurityUIsDismissDialogOn );
+		    RDEBUG("err", err);
+		    res += 1;
+			  }
+
+    if (!iQueryCanceled)
+        {
+				// notify all dialogs, in particular SecUiNotificationDialog::subscriberKSecurityUIsDismissDialogChanged
+				// this will cancel only the dialog which was opened by same client.
+    		res += 0x10;
+        iQueryCanceled = ETrue;
+        if (iSecurityDlg != NULL)
+            {
+            RDEBUG("deleting iSecurityDlg", 0);
+		    		res += 0x100;
+            delete iSecurityDlg;
+            }
+        if (iNoteDlg != NULL)
+            {
+            RDEBUG("deleting iNoteDlg", 0);
+		    		res += 0x1000;
+            delete iNoteDlg;
+            }
+        iNoteDlg = NULL;
+        iSecurityDlg = NULL;
+        }
+ 		res += 0x10000;
+		RDEBUG("res", res);
+ 		return res;
+		}
+
+//
+// ----------------------------------------------------------
 // CSecurityHandler::CancelSecCodeQuery()    
 // Cancels PIN2 and security code queries
 // this is used by rfsHandler
@@ -353,24 +404,10 @@
 EXPORT_C void CSecurityHandler::CancelSecCodeQuery()
     {
 		RDEBUG("0", 0);
-		// notify all dialogs, in particular SecUiNotificationDialog::subscriberKSecurityUIsDismissDialogChanged
-    TInt err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsDismissDialog, ESecurityUIsDismissDialogOn );
-    RDEBUG("err", err);
-		RDEBUG("iQueryCanceled", iQueryCanceled);
-    if (!iQueryCanceled)
-        {
-        iQueryCanceled = ETrue;
-        if (iSecurityDlg != NULL)
-            {
-            delete iSecurityDlg;
-            }
-        if (iNoteDlg != NULL)
-            {
-            delete iNoteDlg;
-            }
-        iNoteDlg = NULL;
-        iSecurityDlg = NULL;
-        }
+
+		TInt err = CancelOpenQuery(1);
+
+		RDEBUG("err", err);
     }
 //
 // ----------------------------------------------------------
@@ -544,10 +581,37 @@
             RDEBUG("KErrAccessDenied", KErrAccessDenied);
             return AskSecCodeInAutoLockL();
             }
+        case KErrInUse:
+            {
+        		RDEBUG("KErrInUse", KErrInUse);
+        		return EFalse;
+            }
+        case KErrDied :
+            {
+        		RDEBUG("KErrDied ", KErrDied );
+        		return EFalse;
+            }
+        case KErrServerTerminated :
+            {
+        		RDEBUG("KErrServerTerminated ", KErrServerTerminated );
+        		return EFalse;
+            }
+        case KErrServerBusy :
+            {
+        		RDEBUG("KErrServerBusy ", KErrServerBusy );
+        		return EFalse;
+            }
         case KErrAbort:
+            {
+        		RDEBUG("KErrAbort", KErrAbort);
+        		return EFalse;
+            }
         case KErrCancel:
+            {
+        		RDEBUG("KErrCancel", KErrCancel);
             // user pressed "cancel"
             return EFalse;
+            }
         default:
             {
             RDEBUG("default", res);
@@ -637,6 +701,7 @@
 
     CSecQueryUi *iSecQueryUi;
     iSecQueryUi = CSecQueryUi::NewL();
+		iQueryCanceled = EFalse;
     TInt lType = ESecUiSecretSupported | ESecUiAlphaSupported
             | lCancelSupported | lEmergencySupported | secCodeTypeToAsk;
     RDEBUG("lType", lType);
@@ -646,6 +711,7 @@
     RDEBUG("iSecUi_password", 0);
     RDebug::Print(iSecUi_password);
     RDEBUG("queryAccepted", queryAccepted);
+    iQueryCanceled = ETrue;
     delete iSecQueryUi;
 
     TBool wasCancelledOrEmergency = EFalse;
@@ -906,10 +972,9 @@
 						RDEBUG("FAILED to get the SECUI query Flag err", err);
             }
         }
-    RDEBUG("StartUp", StartUp);
+    RDEBUG("err", err);
     RDEBUG("secUiOriginatedQuery", secUiOriginatedQuery);
     RDEBUG("ESecurityUIsSecUIOriginated", ESecurityUIsSecUIOriginated);
-    RDEBUG("err", err);
     if (StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated)
             || (err != KErrNone))
         {
@@ -943,9 +1008,9 @@
     CSecQueryUi *iSecQueryUi;
     RDEBUG("CSecQueryUi", 0);
     iSecQueryUi = CSecQueryUi::NewL();
+		iQueryCanceled = EFalse;
     RDEBUG("SecQueryDialog", 1);
-    // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful
-    // TODO also support Emergency
+    // ESecUiCodeEtelReqest/ESecUiNone might be useful
     lAlphaSupported = ESecUiAlphaNotSupported;
     TBuf<0x100> title;
     title.Zero();
@@ -959,9 +1024,9 @@
             SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, amode);
     RDEBUG("iSecUi_password", 0);
     RDebug::Print(iSecUi_password);
+    iQueryCanceled = ETrue;
     delete iSecQueryUi;
     RDEBUG("queryAccepted", queryAccepted);
-    // TODO handle emergency
     /* end request PIN using QT */
 
     if (queryAccepted == KErrAbort) // emergency call
@@ -1015,14 +1080,14 @@
         case KErrGsmSSPasswordAttemptsViolation:
         case KErrLocked:
             // code blocked; show error note and terminate.
-            // TODO what if not during Startup? Probably it's Ok since the SIM would had also failed at StartUp
+            // what if not during Startup? Probably it's Ok since the SIM would had also failed at StartUp
             if (StartUp)
                 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR,
                         CAknNoteDialog::EErrorTone);
             break;
         case KErrGsm0707SimWrong:
             // sim lock active
-            // TODO no error? This is strange
+            // no error? This is strange
             break;
         default:
             CSecuritySettings::ShowErrorNoteL(res);
@@ -1079,7 +1144,7 @@
         RDEBUG("WaitForRequestL res", res);
         }
 		RDEBUG("res", res);
-    //If there's still an error we're doomed. Bail out.
+    // If there's still an error we're doomed. Bail out.
     User::LeaveIfError(res);
 
     RDEBUG("StartUp", StartUp);
@@ -1087,7 +1152,7 @@
             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
+    // show the last "Code Error" note of PIN verify result here so it won't be left under the PUK1 dialog
     if (!StartUp && (attempts
             == KMaxNumberOfPUKAttempts))
         CSecuritySettings::ShowResultNoteL(R_CODE_ERROR,
@@ -1099,16 +1164,16 @@
     CSecQueryUi *iSecQueryUi;
     RDEBUG("CSecQueryUi", 0);
     iSecQueryUi = CSecQueryUi::NewL();
+		iQueryCanceled = EFalse;
     RDEBUG("SecQueryDialog", 1);
-    // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful
-    // TODO also support Emergency
+    // ESecUiCodeEtelReqest/ESecUiNone might be useful
     TBuf<0x100> title;
     title.Zero();
     title.Append(_L("Puk1RequiredL"));
     title.Append(_L("#"));
     title.AppendNum(attempts);
     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) ???
+    if(StartUp)		// how to know whether PUK comes from failing at Starter, or failing at any other PIN (i.e. changing PIN, or changing PIN-request) ???
     	lSecUiCancelSupported = ESecUiCancelNotSupported | ESecUiEmergencySupported;
     queryAccepted = iSecQueryUi->SecQueryDialog(title, puk1_password,
             SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH,
@@ -1116,6 +1181,7 @@
                     | lSecUiCancelSupported | ESecUiPukRequired);
     RDEBUG("puk1_password", 0);
     RDebug::Print(puk1_password);
+    iQueryCanceled = ETrue;
     delete iSecQueryUi;
     RDEBUG("queryAccepted", queryAccepted);
 
@@ -1152,7 +1218,7 @@
             break;
         case KErrGsm0707SimWrong:
             // sim lock active
-            // TODO no message ?
+            // no message ?
             break;
         case KErrGsmSSPasswordAttemptsViolation:
         case KErrLocked:
@@ -1173,9 +1239,8 @@
         CSecQueryUi * iSecQueryUi;
         RDEBUG("CSecQueryUi", 0);
         iSecQueryUi = CSecQueryUi::NewL();
+				iQueryCanceled = EFalse;
         RDEBUG("SecQueryDialog", 1);
-        // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful
-        // TODO also support Emergency
 
         queryAccepted = iSecQueryUi->SecQueryDialog(
                 _L("PIN1-New|PIN1-Verif"), aNewPinPassword,
@@ -1184,6 +1249,7 @@
                         | ESecUiPukRequired);
         RDEBUG("aNewPinPassword", 0);
         RDebug::Print(aNewPinPassword);
+        iQueryCanceled = ETrue;
         delete iSecQueryUi;
         RDEBUG("queryAccepted", queryAccepted);
         }
@@ -1220,7 +1286,7 @@
             break;
         case KErrGsm0707SimWrong:
             // sim lock active
-            // TODO no message ?
+            // no message ?
             break;
         case KErrGsmSSPasswordAttemptsViolation:
         case KErrLocked:
@@ -1268,16 +1334,16 @@
 
     RDEBUG("codeInfo.iRemainingEntryAttempts",
             codeInfo.iRemainingEntryAttempts);
-    if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) // TODO this might be 10 ?
+    if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts)
         codeInfo.iRemainingEntryAttempts = -1;
 
     /* request PIN using QT */
     CSecQueryUi *iSecQueryUi;
     RDEBUG("CSecQueryUi", 0);
     iSecQueryUi = CSecQueryUi::NewL();
+		iQueryCanceled = EFalse;
     RDEBUG("SecQueryDialog", 1);
-    // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful against KLastRemainingInputAttempt
-    // TODO also support Emergency
+    // ESecUiCodeEtelReqest/ESecUiNone might be useful against KLastRemainingInputAttempt
 
     TBuf<0x100> title;
     title.Zero();
@@ -1291,6 +1357,7 @@
     RDEBUG("iSecUi_password", 0);
     RDebug::Print(iSecUi_password);
     RDEBUG("queryAccepted", queryAccepted);
+    iQueryCanceled = ETrue;
     delete iSecQueryUi;
 
     // If failed or device became locked, any pending request should be cancelled.
@@ -1372,9 +1439,9 @@
     CSecQueryUi *iSecQueryUi;
     RDEBUG("CSecQueryUi", 0);
     iSecQueryUi = CSecQueryUi::NewL();
+		iQueryCanceled = EFalse;
     RDEBUG("SecQueryDialog", 1);
-    // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful
-    // TODO also support Emergency
+    // ESecUiCodeEtelReqest/ESecUiNone might be useful
 
     RDEBUG("codeInfo.iRemainingEntryAttempts",
             codeInfo.iRemainingEntryAttempts);
@@ -1392,6 +1459,7 @@
                     | ESecUiCancelSupported | secCodeType );
     RDEBUG("iSecUi_password", 0);
     RDebug::Print(iSecUi_password);
+    iQueryCanceled = ETrue;
     delete iSecQueryUi;
     RDEBUG("queryAccepted", queryAccepted);
 
@@ -1447,9 +1515,8 @@
         CSecQueryUi * iSecQueryUi;
         RDEBUG("CSecQueryUi", 0);
         iSecQueryUi = CSecQueryUi::NewL();
-        // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful
-        // TODO also support Emergency
-
+				iQueryCanceled = EFalse;
+        // ESecUiCodeEtelReqest/ESecUiNone might be useful
         queryAccepted
                 = iSecQueryUi->SecQueryDialog(_L("PIN2-New|PIN2-Verif"),
                         aNewPassword, SEC_C_PIN2_CODE_MIN_LENGTH,
@@ -1457,6 +1524,7 @@
                                 | ESecUiCancelSupported | secCodeType);
         RDEBUG("aNewPassword", 0);
         RDebug::Print(aNewPassword);
+        iQueryCanceled = ETrue;
         delete iSecQueryUi;
         RDEBUG("queryAccepted", queryAccepted);
         if (queryAccepted != KErrNone)
@@ -1469,8 +1537,7 @@
             return;
             }
         }
-    // send code
-    // TODO the current code should be verified before
+    // send code. The code was temporarilly changed before. Thus, this really done to set the new-new one
     RDEBUG("VerifySecurityCode", 0);
     iPhone.VerifySecurityCode(wait->iStatus, secCodeType, aNewPassword,
             iSecUi_password);
@@ -1563,7 +1630,8 @@
         CSecQueryUi *iSecQueryUi;
         RDEBUG("CSecQueryUi", 0);
         iSecQueryUi = CSecQueryUi::NewL();
-        // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful
+				iQueryCanceled = EFalse;
+        // ESecUiCodeEtelReqest/ESecUiNone might be useful
         // TODO also support Emergency
         if (StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated)
                 || (err != KErrNone))
@@ -1582,6 +1650,7 @@
                         | lCancelSupported | ESecUiCodeEtelReqest);
         RDEBUG("iSecUi_password", 0);
         RDebug::Print(iSecUi_password);
+        iQueryCanceled = ETrue;
         delete iSecQueryUi;
         RDEBUG("queryAccepted", queryAccepted);
         if (queryAccepted != KErrNone)
@@ -1693,6 +1762,7 @@
             CSecQueryUi *iSecQueryUi;
             RDEBUG("CSecQueryUi", 0);
             iSecQueryUi = CSecQueryUi::NewL();
+						iQueryCanceled = EFalse;
             // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful
             // TODO also support Emergency
 
@@ -1707,6 +1777,7 @@
                             | ESecUiCancelSupported | ESecUiPukRequired);
             RDEBUG("iSecUi_password", 0);
             RDebug::Print(iSecUi_password);
+            iQueryCanceled = ETrue;
             delete iSecQueryUi;
             RDEBUG("queryAccepted", queryAccepted);
 
@@ -1722,6 +1793,7 @@
             CSecQueryUi *iSecQueryUi;
             RDEBUG("CSecQueryUi", 0);
             iSecQueryUi = CSecQueryUi::NewL();
+						iQueryCanceled = EFalse;
             // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful
             // TODO also support Emergency
 
@@ -1732,6 +1804,7 @@
                             | ESecUiPukRequired);
             RDEBUG("aNewPassword", 0);
             RDebug::Print(aNewPassword);
+            iQueryCanceled = ETrue;
             delete iSecQueryUi;
             RDEBUG("queryAccepted", queryAccepted);
             if (queryAccepted != KErrNone)
--- a/securitydialogs/SecUi/Src/SecUiSecuritySettings.cpp	Wed Jun 23 19:10:54 2010 +0300
+++ b/securitydialogs/SecUi/Src/SecUiSecuritySettings.cpp	Tue Jul 06 15:15:05 2010 +0300
@@ -204,8 +204,8 @@
     TBuf<0x80> iCaption;
     iCaption.Copy(_L("ChangePinL"));
     TInt iShowError = 1;
-    ChangePinParamsL(iOldPassword, iNewPassword, iFlags, iCaption, iShowError);
-    RDEBUG("0", 0);
+    TInt err = ChangePinParamsL(iOldPassword, iNewPassword, iFlags, iCaption, iShowError);
+    RDEBUG("err", err);
     }
 
 //
@@ -226,9 +226,9 @@
     TBuf<0x80> iCaption;
     iCaption.Copy(_L("ChangeUPinL"));
     TInt iShowError = 1;
-    ChangeUPinParamsL(iOldPassword, iNewPassword, iFlags, iCaption,
+    TInt err = ChangeUPinParamsL(iOldPassword, iNewPassword, iFlags, iCaption,
             iShowError);
-    RDEBUG("0", 0);
+    RDEBUG("err", err);
 
     }
 
@@ -250,10 +250,9 @@
     TBuf<0x80> iCaption;
     iCaption.Copy(_L("ChangePin2L"));
     TInt iShowError = 1;
-    ChangePin2ParamsL(iOldPassword, iNewPassword, iFlags, iCaption,
+    TInt err = ChangePin2ParamsL(iOldPassword, iNewPassword, iFlags, iCaption,
             iShowError);
-    RDEBUG("0", 0);
-
+    RDEBUG("err", err);
     }
 //
 // ----------------------------------------------------------
@@ -273,9 +272,9 @@
     TBuf<0x80> iCaption;
     iCaption.Copy(_L("ChangeSecCodeL"));
     TInt iShowError = 1;
-    ChangeSecCodeParamsL(iOldPassword, iNewPassword, iFlags, iCaption,
+    TInt err = ChangeSecCodeParamsL(iOldPassword, iNewPassword, iFlags, iCaption,
             iShowError);
-    RDEBUG("0", 0);
+    RDEBUG("err", err);
     }
 //
 // ----------------------------------------------------------
@@ -357,7 +356,7 @@
 // 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
+// qtdone
 TInt CSecuritySettings::RemoteLockCodeQueryL(TDes& aRemoteLockCode)
     {
 
@@ -406,7 +405,7 @@
                 RDEBUG( "WaitForRequestL res", res );
 #ifdef __WINS__
                 if (res == KErrNotSupported || res == KErrTimedOut)
-                res = 0xffffec50;	// TODO this means KErrGsm0707IncorrectPassword = incorrect code
+                res = KErrGsm0707IncorrectPassword;	// KErrGsm0707IncorrectPassword = incorrect code
 #endif
 								RDEBUG( "KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword );
                 if(res == KErrNone)
@@ -428,7 +427,7 @@
 // Changes lock setting in domestic OS. Changing the domestic OS lock setting
 // requires user to enter the security code.
 // ----------------------------------------------------------
-// no qtdone
+// qtdone
 TInt CSecuritySettings::RemoteLockSetLockSettingL(TBool aLockSetting)
     {
     TInt retValue( KErrNone );
@@ -621,12 +620,14 @@
     TBuf<0x80> iCaption;
     iCaption.Copy(_L("ChangePinRequestL"));
     TInt iShowError = 1;
-    ChangePinRequestParamsL(
+    TInt err = ChangePinRequestParamsL(
             1/* it's imposible to know if we want to set or clear*/,
             iOldPassword, iFlags, iCaption, iShowError);
-    RDEBUG("0", 0);
-
-    return ETrue;
+    RDEBUG("err", err);
+		if(err==KErrNone)
+    	return ETrue;
+		else
+   		return EFalse;
     }
 
 //
@@ -1650,7 +1651,7 @@
         if (res != KErrNone)
             {
             ShowResultNoteL(res, CAknNoteDialog::EErrorTone);
-            return res; // TODO not sure if it's wise to exit now.
+            return res; // not sure if it's wise to exit now.
             }
 
         newPassword = _L("");
@@ -2042,7 +2043,7 @@
 
     RDEBUG("codeInfo.iRemainingEntryAttempts",
             codeInfo.iRemainingEntryAttempts);
-    if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) // TODO this might be 10
+    if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts)
         codeInfo.iRemainingEntryAttempts = -1;
 
     /* request PIN using QT */
@@ -2524,7 +2525,7 @@
     if (simRemoved)
         {
         ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone);
-        return EFalse;
+        return KErrAccessDenied;
         }
 
     RMobilePhone::TMobilePhoneLockInfoV1 lockInfo;
@@ -2603,7 +2604,7 @@
             // not allowed with this sim
             ShowResultNoteL(R_OPERATION_NOT_ALLOWED,
                     CAknNoteDialog::EErrorTone);
-            return EFalse;
+            return KErrGsm0707OperationNotAllowed;
             }
         case KErrGsm0707IncorrectPassword:
         case KErrAccessDenied:
@@ -2615,11 +2616,11 @@
         case KErrGsmSSPasswordAttemptsViolation:
         case KErrLocked:
             {
-            return ETrue;
+            return KErrLocked;
             }
         case KErrAbort:
             {
-            return EFalse;
+            return KErrAbort;
             }
         default:
             {
@@ -2627,7 +2628,7 @@
                     aCaption, aShowError);
             }
         }
-    return ETrue;
+    return KErrNone;
     }
 
 //
--- a/securitydialogs/lockclient/group/bld.inf	Wed Jun 23 19:10:54 2010 +0300
+++ b/securitydialogs/lockclient/group/bld.inf	Tue Jul 06 15:15:05 2010 +0300
@@ -20,11 +20,12 @@
 
 PRJ_EXPORTS
 
+/* this is also done in  .pro , but doesn't harm to do it here, too */
 ../rom/lockclient.iby CORE_MW_LAYER_IBY_EXPORT_PATH(lockclient.iby)
 
 PRJ_MMPFILES
 
 /*
-Not any more. This should be done in the QT way, using  lockclient.pro
+Not any more. This is done in the QT way, using  lockclient.pro
 lockclient.mmp
 */
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/securitydialogs/lockclient/group/bwins/lockclientu.def	Tue Jul 06 15:15:05 2010 +0300
@@ -0,0 +1,20 @@
+EXPORTS
+	?ShowKeysLockedNote@CKeyguardAccessApi@@QAEHXZ @ 1 NONAME ; int CKeyguardAccessApi::ShowKeysLockedNote(void)
+	?TestDestruct@CKeyguardAccessApi@@QAEHXZ @ 2 NONAME ; int CKeyguardAccessApi::TestDestruct(void)
+	?NewL@CDevicelockAccessApi@@SAPAV1@XZ @ 3 NONAME ; class CDevicelockAccessApi * CDevicelockAccessApi::NewL(void)
+	?OfferKeyguard@CKeyguardAccessApi@@QAEHXZ @ 4 NONAME ; int CKeyguardAccessApi::OfferKeyguard(void)
+	?IsKeyguardEnabled@CKeyguardAccessApi@@QAEHXZ @ 5 NONAME ; int CKeyguardAccessApi::IsKeyguardEnabled(void)
+	?EnableKeyguard@CKeyguardAccessApi@@QAEHH@Z @ 6 NONAME ; int CKeyguardAccessApi::EnableKeyguard(int)
+	?IsKeylockEnabled@CKeyguardAccessApi@@QAEHXZ @ 7 NONAME ; int CKeyguardAccessApi::IsKeylockEnabled(void)
+	?IsDevicelockEnabled@CDevicelockAccessApi@@QAEHXZ @ 8 NONAME ; int CDevicelockAccessApi::IsDevicelockEnabled(void)
+	?DisableDevicelock@CDevicelockAccessApi@@QAEHXZ @ 9 NONAME ; int CDevicelockAccessApi::DisableDevicelock(void)
+	?TestPanicClient@CKeyguardAccessApi@@QAEHXZ @ 10 NONAME ; int CKeyguardAccessApi::TestPanicClient(void)
+	?TestInternal@CKeyguardAccessApi@@QAEHXZ @ 11 NONAME ; int CKeyguardAccessApi::TestInternal(void)
+	?DisableKeyguard@CKeyguardAccessApi@@QAEHH@Z @ 12 NONAME ; int CKeyguardAccessApi::DisableKeyguard(int)
+	?EnableDevicelock@CDevicelockAccessApi@@QAEHW4TDevicelockReason@@@Z @ 13 NONAME ; int CDevicelockAccessApi::EnableDevicelock(enum TDevicelockReason)
+	?IsKeylockEnabled@CDevicelockAccessApi@@QAEHXZ @ 14 NONAME ; int CDevicelockAccessApi::IsKeylockEnabled(void)
+	??1CKeyguardAccessApi@@UAE@XZ @ 15 NONAME ; CKeyguardAccessApi::~CKeyguardAccessApi(void)
+	??1CDevicelockAccessApi@@UAE@XZ @ 16 NONAME ; CDevicelockAccessApi::~CDevicelockAccessApi(void)
+	?OfferDevicelock@CDevicelockAccessApi@@QAEHXZ @ 17 NONAME ; int CDevicelockAccessApi::OfferDevicelock(void)
+	?NewL@CKeyguardAccessApi@@SAPAV1@XZ @ 18 NONAME ; class CKeyguardAccessApi * CKeyguardAccessApi::NewL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/securitydialogs/lockclient/group/eabi/lockclientu.def	Tue Jul 06 15:15:05 2010 +0300
@@ -0,0 +1,24 @@
+EXPORTS
+	_ZN18CKeyguardAccessApi12TestDestructEv @ 1 NONAME
+	_ZN18CKeyguardAccessApi12TestInternalEv @ 2 NONAME
+	_ZN18CKeyguardAccessApi13OfferKeyguardEv @ 3 NONAME
+	_ZN18CKeyguardAccessApi14EnableKeyguardEi @ 4 NONAME
+	_ZN18CKeyguardAccessApi15DisableKeyguardEi @ 5 NONAME
+	_ZN18CKeyguardAccessApi15TestPanicClientEv @ 6 NONAME
+	_ZN18CKeyguardAccessApi16IsKeylockEnabledEv @ 7 NONAME
+	_ZN18CKeyguardAccessApi17IsKeyguardEnabledEv @ 8 NONAME
+	_ZN18CKeyguardAccessApi18ShowKeysLockedNoteEv @ 9 NONAME
+	_ZN18CKeyguardAccessApi4NewLEv @ 10 NONAME
+	_ZN18CKeyguardAccessApiD0Ev @ 11 NONAME
+	_ZN18CKeyguardAccessApiD1Ev @ 12 NONAME
+	_ZN18CKeyguardAccessApiD2Ev @ 13 NONAME
+	_ZN20CDevicelockAccessApi15OfferDevicelockEv @ 14 NONAME
+	_ZN20CDevicelockAccessApi16EnableDevicelockE17TDevicelockReason @ 15 NONAME
+	_ZN20CDevicelockAccessApi16IsKeylockEnabledEv @ 16 NONAME
+	_ZN20CDevicelockAccessApi17DisableDevicelockEv @ 17 NONAME
+	_ZN20CDevicelockAccessApi19IsDevicelockEnabledEv @ 18 NONAME
+	_ZN20CDevicelockAccessApi4NewLEv @ 19 NONAME
+	_ZN20CDevicelockAccessApiD0Ev @ 20 NONAME
+	_ZN20CDevicelockAccessApiD1Ev @ 21 NONAME
+	_ZN20CDevicelockAccessApiD2Ev @ 22 NONAME
+
--- a/securitydialogs/lockclient/group/lockclient.pro	Wed Jun 23 19:10:54 2010 +0300
+++ b/securitydialogs/lockclient/group/lockclient.pro	Tue Jul 06 15:15:05 2010 +0300
@@ -40,8 +40,12 @@
 
 LIBS += -lxqservice
 LIBS += -lxqserviceutil
+LIBS += -lapparc
+LIBS += -lapgrfx
 
 symbian*: { 
 	TARGET.EPOCALLOWDLLDATA = 1
 	MMP_RULES -= "OPTION_REPLACE ARMCC --export_all_vtbl -D__QT_NOEFFECTMACRO_DONOTUSE"
 	}
+
+BLD_INF_RULES.prj_exports += "../rom/lockclient.iby            CORE_APP_LAYER_IBY_EXPORT_PATH(lockclient.iby)"
--- a/securitydialogs/lockclient/rom/lockclient.iby	Wed Jun 23 19:10:54 2010 +0300
+++ b/securitydialogs/lockclient/rom/lockclient.iby	Tue Jul 06 15:15:05 2010 +0300
@@ -20,6 +20,6 @@
 #include <data_caging_paths_for_iby.hrh>
  
 //file=ABI_DIR\BUILD_DIR\lockclient.dll SHARED_LIB_DIR\lockclient.dll
-file=ABI_DIR\UDEB\lockclient.dll SHARED_LIB_DIR\lockclient.dll
+file=ABI_DIR\BUILD_DIR\lockclient.dll SHARED_LIB_DIR\lockclient.dll
 
 #endif // __LOCKCLIENT_IBY__
--- a/securitydialogs/lockclient/src/lockaccessextension.cpp	Wed Jun 23 19:10:54 2010 +0300
+++ b/securitydialogs/lockclient/src/lockaccessextension.cpp	Tue Jul 06 15:15:05 2010 +0300
@@ -20,6 +20,9 @@
 #include <e32property.h> // P&S API
 #include <apgtask.h> // TApaTask, TApaTaskList
 #include <coemain.h> // CCoeEnv
+#include "../../Autolock/PubSub/securityuisprivatepskeys.h"
+#include <apgcli.h>
+#include <apacmdln.h>
 
 #include <xqservicerequest.h>
 #include <xqserviceutil.h>
@@ -75,8 +78,67 @@
 TInt RLockAccessExtension::EnsureConnected( )
 	{
 	TInt ret(KErrNone);
+
+	// Now we use QtHighway, but nevertheless need to be sure that only 1 process is running
+	// This is done because Autolock.exe should start at the beginning, but it might not be ready yet.
+	// As Qthighway will start it, it's better to give time for the first one to prepare itself.
+	TInt err = KErrNone;
+	TInt numAttempts = 0;
+	TInt numberOfInstances = 0;
+	do
+		{
+		numberOfInstances=0;
+		TFullName processName;
+		TFindThread find(_L("*utolock*"));	// first letter can can be uppercase or lowercase
+		while( find.Next( processName ) == KErrNone )
+		    {
+				// Autolock[100059b5]0002::Autolock		in device
+				// autolock.exe[100059b5]0002::Main		in emulator
+				RDEBUG("found process", 1);
+        numberOfInstances++;
+		    }	// end while
+		RDEBUG("numberOfInstances", numberOfInstances);
+		if(numberOfInstances<=0)
+			{
+			RDEBUG("Autolock.exe not running already. Starting.", 0 );
+	    RApaLsSession ls;
+	    User::LeaveIfError(ls.Connect());
+	    CleanupClosePushL(ls);
+	    RDEBUG("commandLine", 0); 
+	    CApaCommandLine* commandLine = CApaCommandLine::NewLC();
+	    commandLine->SetExecutableNameL(_L("autolock.exe"));
+	    commandLine->SetCommandL(EApaCommandRun);
+	    // Try to launch the application.
+	    RDEBUG("StartApp", 0); 
+	    TInt err = ls.StartApp(*commandLine); // this migh fail
+    	CleanupStack::PopAndDestroy(2); // commandLine, ls
+
+			RDEBUG("Autolock.exe launched. Waiting a bit. err", err );
+			User::After(1000*1000);
+			RDEBUG("re-verifying Autolock.exe process.", 1 );
+			}
+		} while (numAttempts++ <3 && numberOfInstances<=0);
+		
+
+
+	TInt value = -1;
+	err = KErrNone;
+	numAttempts = 0;
+	while( value<1 && numAttempts++ <10 )	// wait max 5 seconds
+		{
+		// process was started, but still not fully running. Give a bit more time
+		err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsLockInitiatorUID, value);
+		RDEBUG("err", err);
+		RDEBUG("value", value);
+		if(value<1)
+			{
+			RDEBUG("Autolock.exe has started but it's not fully running", value);
+			User::After(5*100*1000);	// half a second
+			}
+		}
+	RDEBUG("numAttempts", numAttempts);
 	/*
-	this is the old method. Now we use QtHighway
+	this is the old method. 
 	// we need CCoeEnv because of window group list
 	const TInt KTimesToConnectServer( 2);
 	const TInt KTimeoutBeforeRetrying( 50000);
@@ -108,7 +170,8 @@
 // ---------------------------------------------------------------------------
 TInt RLockAccessExtension::SendMessage( TInt aMessage )
 	{
-	TInt ret = EnsureConnected( );
+	RDEBUG("0", 0);
+	TInt ret = KErrNone;
 	if ( ret == KErrNone )
 		{
 		// ret = SendReceive( aMessage );
@@ -122,7 +185,8 @@
 // ---------------------------------------------------------------------------
 TInt RLockAccessExtension::SendMessage( TInt aMessage, TInt aParam1 )
 	{
-	TInt ret = EnsureConnected( );
+	RDEBUG("0", 0);
+	TInt ret = KErrNone;
 	if ( ret == KErrNone )
 		{
 		// assign parameters to IPC argument
@@ -138,6 +202,7 @@
 // ---------------------------------------------------------------------------
 TInt RLockAccessExtension::SendMessage( TInt aMessage, TInt aParam1, TInt aParam2 )
 	{
+	RDEBUG("0", 0);
 	TInt ret = EnsureConnected( );
 	RDEBUG("ret", ret);
 	if ( ret == KErrNone )
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdebug.h	Tue Jul 06 15:15:05 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SecUi notification plugin dialog.
+*
+*/
+
+#ifndef SECUINOTIFICATIONDEBUG_H
+#define SECUINOTIFICATIONDEBUG_H
+
+#include <e32debug.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
+
+#endif // SECUINOTIFICATIONDEBUG_H
--- a/securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdialog.h	Wed Jun 23 19:10:54 2010 +0300
+++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdialog.h	Tue Jul 06 15:15:05 2010 +0300
@@ -18,12 +18,6 @@
 #ifndef SECUINOTIFICATIONDIALOG_H
 #define SECUINOTIFICATIONDIALOG_H
 
-#include <e32debug.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 <hbdialog.h>                   // HbDialog
 #include <hbdevicedialoginterface.h>    // HbDeviceDialogInterface
@@ -87,6 +81,7 @@
 private:
     Q_DISABLE_COPY(SecUiNotificationDialog)
 
+    int mMyId;
     int mLastError;
     bool mShowEventReceived;
     QVariantMap mResultMap;
@@ -96,7 +91,8 @@
     HbListWidget *listWidget;
     HbAction *okAction;
     HbAction *cancelAction;
-    HbLabel *title;
+    HbAction *okVKBAction;
+    HbLabel *titleWidget;
     int queryType;
     int lMinLength;
     int lMaxLength;
--- a/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationcontentwidget.cpp	Wed Jun 23 19:10:54 2010 +0300
+++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationcontentwidget.cpp	Tue Jul 06 15:15:05 2010 +0300
@@ -16,6 +16,7 @@
 *
 */
 
+#include "secuinotificationdebug.h"
 #include "secuinotificationcontentwidget.h"
 #include "secuinotificationdialogpluginkeys.h"
 #include <QGraphicsLinearLayout>
@@ -64,7 +65,7 @@
 SecUiNotificationContentWidget::SecUiNotificationContentWidget(
         QGraphicsItem *parent, Qt::WindowFlags flags) : HbWidget(parent, flags)
 {
-		qDebug() << "SecUiNotificationContentWidget::SecUiNotificationContentWidget";
+		RDEBUG("0", 0);
 }
 
 // ----------------------------------------------------------------------------
@@ -81,7 +82,7 @@
 //
 void SecUiNotificationContentWidget::constructFromParameters(const QVariantMap &parameters)
 {
-		qDebug() << "SecUiNotificationContentWidget::constructFromParameters 1";
+		RDEBUG("0", 0);
 		qDebug() << parameters;
     QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(Qt::Vertical);
 
@@ -93,14 +94,13 @@
 
     // KApplicationSize
     if (parameters.contains(KQueryType)) {
-				qDebug() << "SecUiNotificationContentWidget::KQueryType";
+				RDEBUG("0", 0);
         queryType = parameters.value(KQueryType).toUInt();
-				qDebug() << queryType;
+				RDEBUG("queryType", queryType);
 				if( (queryType & ESecUiTypeMaskLock) )
 					{
-					qDebug() << "SecUiNotificationContentWidget::KQueryType=ESecUiTypeLock";
+					RDEBUG("KQueryType=ESecUiTypeMaskLock", queryType);
 					// showing "Lock" icon. All other params are irrelevant. codeTop is not even created
-
 					
         	HbLabel *iconLabel = new HbLabel("Locked");
         	HbIcon *icon = new HbIcon("qtg_large_device_lock");
@@ -185,8 +185,6 @@
         qDebug() << lMaxLength;
         if(lMaxLength>2)
 	        codeTop->setMaxLength(lMaxLength);
-        // HbLineEdit *codeTop2 = new HbLineEdit;
-				qDebug() << "SecUiNotificationContentWidget::KCodeTop 2";
 				qDebug() << "SecUiNotificationContentWidget::KCodeTop queryType=";
 				qDebug() << queryType;
 				codeTop->setInputMethodHints(Qt::ImhDigitsOnly);	// default
@@ -223,6 +221,28 @@
 					}
 				qDebug() << "SecUiNotificationContentWidget::KCodeTop 4";
 
+		    if (parameters.contains(KDialogTitle)) {
+		        QString titleText = parameters.value(KDialogTitle).toString();
+		        QString titleAttempts = "";
+		   			if(titleText.indexOf('|')>0)
+		    				{	// if separator, take only first part
+		    				titleText = titleText.left(titleText.indexOf('|'));
+		    				}
+		   			if(titleText.indexOf('#')>0)
+		    				{	// if separator, take only first part
+		    				titleAttempts = titleText.right(titleText.length()-titleText.indexOf('#')-1);
+		    				qDebug() << "SecUiNotificationDialog::titleAttempts=" << titleAttempts;
+		    				int nAttempts = titleAttempts.toInt();
+		    				RDEBUG("nAttempts", nAttempts);
+		    				titleText = titleText.left(titleText.indexOf('#'));
+		    				if(nAttempts>0)
+		    					titleText = titleText + " attempts=" + QString::number(nAttempts);
+		    				}
+		        HbLabel *titleTop = new HbLabel(titleText);
+		        mainLayout->addItem(titleTop);
+		        // in the dialog, it was setHeadingWidget(title);
+		    }
+
     		mainLayout->addItem(codeTop);
     		// double-query
     		if (parameters.contains(KCodeBottom))
--- a/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialog.cpp	Wed Jun 23 19:10:54 2010 +0300
+++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialog.cpp	Tue Jul 06 15:15:05 2010 +0300
@@ -15,6 +15,7 @@
 *
 */
 
+#include "secuinotificationdebug.h"
 #include "secuinotificationdialog.h"
 #include "secuinotificationdialogpluginkeys.h"
 #include "secuinotificationcontentwidget.h"
@@ -27,6 +28,7 @@
 #include <SCPServerInterface.h>	// for TARM error codes while validating new lock code
 #include <QString>
 #include <QDialogButtonBox>
+#include <HbEditorInterface>
 #include <e32property.h>
 
 QTM_USE_NAMESPACE
@@ -80,6 +82,9 @@
         const QVariantMap &parameters) : HbDialog(), mLastError(KNoError)
 {
 		RDEBUG("0", 0);
+		TTime myTime;
+    myTime.HomeTime();
+		mMyId = I64LOW( myTime.Int64() );
     constructDialog(parameters);
 }
 
@@ -89,6 +94,7 @@
 //
 SecUiNotificationDialog::~SecUiNotificationDialog()
 {
+	RDEBUG("0", 0);
 }
 
 // ----------------------------------------------------------------------------
@@ -108,6 +114,7 @@
 int SecUiNotificationDialog::deviceDialogError() const
 {
 		RDEBUG("mLastError", mLastError);
+		RDEBUG("mMyId", mMyId);
     return mLastError;
 }
 
@@ -118,15 +125,31 @@
 void SecUiNotificationDialog::closeDeviceDialog(bool byClient)
 {
     Q_UNUSED(byClient);
-		RDEBUG("0", 0);
+		RDEBUG("mMyId", mMyId);
+		RDEBUG("calling close()", 0);
     close();
 		RDEBUG("mShowEventReceived", mShowEventReceived);
 
     // If show event has been received, close is signalled from hide event.
     // If not, hide event does not come and close is signalled from here.
     if (!mShowEventReceived) {
+    		RDEBUG("emitting deviceDialogClosed", 0);
         emit deviceDialogClosed();
+				if(1==0 && subscriberKSecurityUIsDismissDialog)
+					{
+						RDEBUG("disconnect subscriberKSecurityUIsDismissDialog", 0);
+						disconnect(subscriberKSecurityUIsDismissDialog, SIGNAL(contentsChanged()), this, SLOT(subscriberKSecurityUIsDismissDialogChanged()));
+						RDEBUG("disconnected subscriberKSecurityUIsDismissDialog", 1);
+						if(1==1)
+							{
+							RDEBUG("deleting subscriberKSecurityUIsDismissDialog", 0);
+							delete subscriberKSecurityUIsDismissDialog;
+							subscriberKSecurityUIsDismissDialog = NULL;
+							RDEBUG("deleted subscriberKSecurityUIsDismissDialog", 1);
+							}
+				 }
     }
+    RDEBUG("0", 0);
 }
 
 // ----------------------------------------------------------------------------
@@ -146,12 +169,27 @@
 {
 		RDEBUG("0", 0);
     HbDialog::hideEvent(event);
-		RDEBUG("close", 0);
+		RDEBUG("mMyId", mMyId);
+		RDEBUG("calling close()", 0);
 		close();
-		RDEBUG("deviceDialogClosed", 0);
+		RDEBUG("emitting deviceDialogClosed", 0);
 		emit deviceDialogClosed();
 		RDEBUG("deviceDialogClosed", 1);
+		if(1==0 && subscriberKSecurityUIsDismissDialog)
+			{
+				RDEBUG("disconnect subscriberKSecurityUIsDismissDialog", 0);
+				disconnect(subscriberKSecurityUIsDismissDialog, SIGNAL(contentsChanged()), this, SLOT(subscriberKSecurityUIsDismissDialogChanged()));
+				RDEBUG("disconnected subscriberKSecurityUIsDismissDialog", 1);
+				if(1==1)
+					{ 
+					RDEBUG("deleting subscriberKSecurityUIsDismissDialog", 0);
+					delete subscriberKSecurityUIsDismissDialog;
+					subscriberKSecurityUIsDismissDialog = NULL;
+					RDEBUG("deleted subscriberKSecurityUIsDismissDialog", 1);
+					}
+			}
     // old method was   emit deviceDialogClosed();
+   RDEBUG("0", 0);
 }
 
 // ----------------------------------------------------------------------------
@@ -161,6 +199,7 @@
 void SecUiNotificationDialog::showEvent(QShowEvent *event)
 {
 		RDEBUG("0", 0);
+		RDEBUG("mMyId", mMyId);
     HbDialog::showEvent(event);
 
 		if(!(queryType & ESecUiTypeMaskLock))
@@ -168,19 +207,23 @@
 			RDEBUG("check default.1", 0);
 			if(codeTop!=NULL)
             {
-                RDEBUG("check default.2", 0);
-                if(codeTop->text().length()>0)	// there's a default value. Verify it and (might) enable OK
+            RDEBUG("check default.2", 0);
+            if(codeTop->text().length()>0)	// there's a default value. Verify it and (might) enable OK
                 {
                 RDEBUG("check default.3", 0);
                 handleCodeTopChanged(codeTop->text());
                 }
+            RDEBUG("setFocus", 0);
+      			codeTop->setFocus();	// this should open the VKB . Doesn't seem to work when it's done on the widget, so it's done here.
+
+            }	// codeTop!=NULL
             
-            }
 			const TUint32 KSecurityUIsTestCode  = 0x00000307;
 			TInt value = 0;
 			TInt err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsTestCode, value );
 			RDEBUG("KSecurityUIsTestCode err", err);
 			RDEBUG("faking value", value);
+			RDEBUG("mShowEventReceived", mShowEventReceived);
 			if(value>0 && mShowEventReceived==true)	// show happens 2 times. Dialog can be closed only the second.
 				{
 				QString myString = "";
@@ -194,6 +237,7 @@
 				}
 			}
     mShowEventReceived = true;
+    RDEBUG("1", 1);
 }
 
 // ----------------------------------------------------------------------------
@@ -203,12 +247,30 @@
 bool SecUiNotificationDialog::constructDialog(const QVariantMap &parameters)
     {
 		RDEBUG("0", 0);
+		RDEBUG("mMyId", mMyId);
     setTimeout(HbPopup::NoTimeout);
     setDismissPolicy(HbPopup::NoDismiss);
     setModal(true);
     mShowEventReceived = false;
+    subscriberKSecurityUIsDismissDialog = NULL;
+    titleWidget = NULL;
+		RDEBUG("subscriberKSecurityUIsDismissDialog NULL", 0);
+
+    subscriberKSecurityUIsDismissDialog = new QValueSpaceSubscriber("/KPSUidSecurityUIs/KSecurityUIsDismissDialog", this);
+    if(subscriberKSecurityUIsDismissDialog)
+    	{
+    	RDEBUG("subscriberKSecurityUIsDismissDialog created", 1);
+    	}
+    else
+    	{
+    	RDEBUG("subscriberKSecurityUIsDismissDialog not created", 0);
+    	}
+    connect(subscriberKSecurityUIsDismissDialog, SIGNAL(contentsChanged()), this, SLOT(subscriberKSecurityUIsDismissDialogChanged()));
+		RDEBUG("subscriberKSecurityUIsDismissDialog", 1);
 
     // Title
+    // this is also done later in the widget
+    // For now, it only says "Security"
     if (parameters.contains(KDialogTitle)) {
         QString titleText = parameters.value(KDialogTitle).toString();
         QString titleAttempts = "";
@@ -226,8 +288,10 @@
     				if(nAttempts>0)
     					titleText = titleText + " attempts=" + QString::number(nAttempts);
     				}
-        title = new HbLabel(titleText);
-        setHeadingWidget(title);
+    		titleText = "Security Query";	// this is the header, for any potential later error which needs to be displayed
+        // This is created only if needed (i.e. errors for NewLockCode)
+        // titleWidget = new HbLabel(titleText);
+        // setHeadingWidget(titleWidget);
     }
 
 	    if (parameters.contains(KEmergency)) {
@@ -256,8 +320,8 @@
 					RDEBUG("KInvalidNewLockCode", 0);
 	        QString invalidText = parameters.value(KInvalidNewLockCode).toString();
 	        qDebug() << invalidText;
+	        QString newTitleText = "Lock Code";	// TODO take from the original one
 
-	        title->setPlainText("Lock Code");	// TODO take from the original one
 	        QString invalidStr = invalidText.right(invalidText.length()-invalidText.indexOf('#')-1);
 	        int invalidNumber = invalidStr.toInt();
 	        RDEBUG("invalidNumber", invalidNumber);
@@ -269,96 +333,105 @@
 				if(invalidNumber==EDeviceLockAutolockperiod)
 	        	{
 	        	RDEBUG("EDeviceLockAutolockperiod", invalidNumber );
-	        	title->setPlainText("EDeviceLockAutolockperiod");
+	        	newTitleText+="EDeviceLockAutolockperiod";
 	        	}
 	        if(invalidNumber==EDeviceLockMaxAutolockPeriod)
 	        	{
 	        	RDEBUG("EDeviceLockAutolockperiod", invalidNumber );
-	        	title->setPlainText("EDeviceLockMaxAutolockPeriod");
+	        	newTitleText+="EDeviceLockMaxAutolockPeriod";
 	        	}
 	        if(invalidNumber==EDeviceLockMinlength)
 	        	{
 	        	RDEBUG("EDeviceLockMinlength", invalidNumber );
-	        	title->setPlainText("EDeviceLockMinlength");
+	        	newTitleText+="EDeviceLockMinlength";
 	        	}
 	        if(invalidNumber==EDeviceLockMaxlength)
 	        	{
 	        	RDEBUG("EDeviceLockMaxlength", invalidNumber );
-	        	title->setPlainText("EDeviceLockMaxlength");
+	        	newTitleText+="EDeviceLockMaxlength";
 	        	}
 	        if(invalidNumber==EDeviceLockRequireUpperAndLower)
 	        	{
 	        	RDEBUG("EDeviceLockRequireUpperAndLower", invalidNumber );
-	        	title->setPlainText("EDeviceLockRequireUpperAndLower");
+	        	newTitleText+="EDeviceLockRequireUpperAndLower";
 	        	}
 	        if(invalidNumber==EDeviceLockRequireCharsAndNumbers)
 	        	{
 	        	RDEBUG("EDeviceLockMaxlength", invalidNumber );
-	        	title->setPlainText("EDeviceLockMaxlength");
+	        	newTitleText+="EDeviceLockMaxlength";
 	        	}
 	        if(invalidNumber==EDeviceLockAllowedMaxRepeatedChars)
 	        	{
 	        	RDEBUG("EDeviceLockAllowedMaxRepeatedChars", invalidNumber );
-	        	title->setPlainText("EDeviceLockAllowedMaxRepeatedChars");
+	        	newTitleText+="EDeviceLockAllowedMaxRepeatedChars";
 	        	}
 	        if(invalidNumber==EDeviceLockHistoryBuffer)
 	        	{
 	        	RDEBUG("EDeviceLockHistoryBuffer", invalidNumber );
-	        	title->setPlainText("EDeviceLockHistoryBuffer");
+	        	newTitleText+="EDeviceLockHistoryBuffer";
 	        	}
 	        if(invalidNumber==EDeviceLockPasscodeExpiration)
 	        	{
 	        	RDEBUG("EDeviceLockPasscodeExpiration", invalidNumber );
-	        	title->setPlainText("EDeviceLockPasscodeExpiration");
+	        	newTitleText+="EDeviceLockPasscodeExpiration";
 	        	}
 	        if(invalidNumber==EDeviceLockMinChangeTolerance)
 	        	{
 	        	RDEBUG("EDeviceLockMinChangeTolerance", invalidNumber );
-	        	title->setPlainText("EDeviceLockMinChangeTolerance");
+	        	newTitleText+="EDeviceLockMinChangeTolerance";
 	        	}
 	        if(invalidNumber==EDeviceLockMinChangeInterval)
 	        	{
 	        	RDEBUG("EDeviceLockMinChangeInterval", invalidNumber );
-	        	title->setPlainText("EDeviceLockMinChangeInterval");
+	        	newTitleText+="EDeviceLockMinChangeInterval";
 	        	}
 	        if(invalidNumber==EDeviceLockDisallowSpecificStrings)
 	        	{
 	        	RDEBUG("EDeviceLockDisallowSpecificStrings", invalidNumber );
-	        	title->setPlainText("EDeviceLockDisallowSpecificStrings");
+	        	newTitleText+="EDeviceLockDisallowSpecificStrings";
 	        	}
 	        if(invalidNumber==EDeviceLockAllowedMaxAtempts)
 	        	{
 	        	RDEBUG("EDeviceLockAllowedMaxAtempts", invalidNumber );
-	        	title->setPlainText("EDeviceLockAllowedMaxAtempts");
+	        	newTitleText+="EDeviceLockAllowedMaxAtempts";
 	        	}
 	        if(invalidNumber==EDeviceLockConsecutiveNumbers)
 	        	{
 	        	RDEBUG("EDeviceLockConsecutiveNumbers", invalidNumber );
-	        	title->setPlainText("EDeviceLockConsecutiveNumbers");
+	        	newTitleText+="EDeviceLockConsecutiveNumbers";
 	        	}
 	        if(invalidNumber==EDeviceLockMinSpecialCharacters)
 	        	{
 	        	RDEBUG("EDeviceLockMinSpecialCharacters", invalidNumber );
-	        	title->setPlainText("EDeviceLockMinSpecialCharacters");
+	        	newTitleText+="EDeviceLockMinSpecialCharacters";
 	        	}
 	        if(invalidNumber==EDeviceLockSingleCharRepeatNotAllowed)
 	        	{
 	        	RDEBUG("EDeviceLockSingleCharRepeatNotAllowed", invalidNumber );
-	        	title->setPlainText("EDeviceLockSingleCharRepeatNotAllowed");
+	        	newTitleText+="EDeviceLockSingleCharRepeatNotAllowed";
 	        	}
 	        if(invalidNumber==EDevicelockConsecutiveCharsNotAllowed)
 	        	{
 	        	RDEBUG("EDevicelockConsecutiveCharsNotAllowed", invalidNumber );
-	        	title->setPlainText("EDevicelockConsecutiveCharsNotAllowed");
+	        	newTitleText+="EDevicelockConsecutiveCharsNotAllowed";
 	        	}
 	        if(invalidNumber>=EDevicelockTotalPolicies)
 	        	{
 	        	RDEBUG("EDevicelockTotalPolicies", invalidNumber );
-	        	title->setPlainText("EDevicelockTotalPolicies");
+	        	newTitleText+="EDevicelockTotalPolicies";
 	        	}
+	        if( !titleWidget )
+	        	{
+	        	RDEBUG("creating titleWidget", 0 );
+	        	titleWidget = new HbLabel("New lock code");	// it will be changed later
+          	setHeadingWidget(titleWidget);
+          	}
+          RDEBUG("setPlainText", 0 );
+	        titleWidget->setPlainText(newTitleText);
+	        
 	        if(invalidNumber<0)	// everything is ok
 	        	{
-	        	okAction->setEnabled(true);	// TODO check this : invalid -> valid. This allows verif ?
+	        	okAction->setEnabled(true);	// this might fail in the scenario: check this : invalid -> valid. This allows verif ?
 	        	okAction->setText("Ok");
 	        	codeBottom->setEnabled(true);
 	        	}
@@ -441,11 +514,6 @@
     	{
     	RDebug::Printf( "potential error: %s %s (%u) aDismissDialog=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aDismissDialog );
     	}
-    subscriberKSecurityUIsDismissDialog = new QValueSpaceSubscriber(
-            "/KPSUidSecurityUIs/KSecurityUIsDismissDialog", this);
-    connect(subscriberKSecurityUIsDismissDialog, SIGNAL(contentsChanged()), this,
-            SLOT(subscriberKSecurityUIsDismissDialogChanged()));
-		RDEBUG("subscriberKSecurityUIsDismissDialog", 1);
 	
 		RDEBUG("check cancel", 0);
     if ((queryType & ESecUiCancelSupported)==ESecUiCancelSupported)
@@ -456,6 +524,8 @@
   		{
 				RDEBUG("disable Cancel", 1);
   			cancelAction->setEnabled(false);
+  			cancelAction->setText("");
+  			cancelAction->setVisible(false);
   		}
     
     return true;
@@ -468,13 +538,19 @@
 void SecUiNotificationDialog::sendResult(int accepted)
 {
 		RDEBUG("0", 0);
+		RDEBUG("mMyId", mMyId);
     QVariant acceptedValue(accepted);
 		RDEBUG("0", 0);
     mResultMap.insert(KResultAccepted, acceptedValue);
 		RDEBUG("0", 0);
 		qDebug() << mResultMap;
-    emit deviceDialogData(mResultMap);
-		RDEBUG("0", 0);
+		RDEBUG("queryType", queryType);
+		if(!(queryType & ESecUiTypeMaskLock))
+			{	// the lock-icon should not reply
+			RDEBUG("emit deviceDialogData", 0);
+    	emit deviceDialogData(mResultMap);
+    	}
+		RDEBUG("1", 1);
 }
 
 // ----------------------------------------------------------------------------
@@ -485,6 +561,7 @@
 {
 		RDEBUG("0", 0);
 		// okAction
+		RDEBUG("mMyId", mMyId);
 		QString codeTopText="";
 
 		if( (queryType & ESecUiTypeMaskLock))
@@ -511,11 +588,12 @@
     	}
     else
         codeTopText = codeTop->text();
-    // TODO check last time for codeBottom
+    // no need to check last time for codeBottom
    	qDebug() << "codeTopText=" << codeTopText;
     sendResult(KErrNone);
+    RDEBUG("calling close()", 0);
     close();	// this is needed because Cancel doesn't automatically closes the dialog
-		RDEBUG("close", 0);
+		RDEBUG("emitting deviceDialogClosed", 0);
 		emit deviceDialogClosed();
 }
 
@@ -526,9 +604,11 @@
 void SecUiNotificationDialog::handleCancelled()
 {
 		RDEBUG("0", 0);
+		RDEBUG("mMyId", mMyId);
     sendResult(KErrCancel);
+		RDEBUG("callingclose()", 0);
     close();	// this is needed because Cancel doesn't automatically closes the dialog
-		RDEBUG("close", 0);
+		RDEBUG("emitting deviceDialogClosed", 0);
 		emit deviceDialogClosed();
 }
 
@@ -539,16 +619,16 @@
 void SecUiNotificationDialog::handleMemorySelectionChanged(const QString &text)
     {
 		RDEBUG("0", 0);
-    	qDebug() << text;
+		RDEBUG("mMyId", mMyId);
+    qDebug() << text;
     QVariant memorySelection(text);
     mResultMap.insert(KSelectedMemoryIndex, memorySelection);
-    //TODO: do we need emit here, or would it be better to send all data at the end?
-    //emit deviceDialogData(mResultMap);
     }
 
 void SecUiNotificationDialog::handleCodeTopContentChanged()
     {
 		RDEBUG("0", 0);
+		RDEBUG("mMyId", mMyId);
     	qDebug() << codeTop->text();
     	handleCodeTopChanged(codeTop->text());
     }
@@ -585,7 +665,7 @@
     		}
     	else if (text.length() >= lMinLength)
     		{
-    		// TODO might use a flag to avoid re-setting
+    		// might use a flag to avoid re-setting. But this complicates things if there's another initial verification
     		qDebug() << "SecUiNotificationDialog::handleCodeTopChanged long enough:" << text ;
     		okAction->setText("Ok");
     		if(queryDual==0)	// only if Bottom is not used
@@ -603,7 +683,6 @@
 		RDEBUG("0", 0);
     	qDebug() << "SecUiNotificationDialog::handleCodeBottomChanged" << text ;
     	qDebug() << "SecUiNotificationDialog::handleCodeBottomChanged. codeTop=" << codeTop->text() ;
-    	// TODO compare 
     	if(text.length() < lMinLength )
     		{
     		qDebug() << "SecUiNotificationDialog::handleCodeBottomChanged too short:" << text ;
@@ -611,10 +690,11 @@
     		}
     	else
     		{
-    		// TODO might use a flag to avoid re-setting
+    		// might use a flag to avoid re-setting. But it just complicates things.
     		qDebug() << "SecUiNotificationDialog::handleCodeBottomChanged long enough:" << text ;
     		if(codeTop->text()==text)
     			{
+    			// unless both codes match, don't allow OK. Note that the first field doesn't allow exit until the validations (i.e. NewLockCode) as succesfull
     			qDebug() << "SecUiNotificationDialog::handleCodeBottomChanged codes match:" << text ;
 	    		okAction->setEnabled(true);
 	    		}
@@ -633,7 +713,7 @@
 void SecUiNotificationDialog::handlebut1Changed()
     {
 		RDEBUG("0", 0);
-    	codeTop->setText("1234");
+    codeTop->setText("1234");
     }
 // ----------------------------------------------------------------------------
 // SecUiNotificationDialog::handlebut2Changed()
@@ -649,6 +729,40 @@
     	qDebug() << "codeTopText+1";
     	qDebug() << codeTopText;
     	codeTop->setText(codeTopText);
+    	
+    	      RDEBUG("editorInterface", 0);
+      			HbEditorInterface editorInterface(codeTop);
+      			RDEBUG("actions", 0);
+      			QList<HbAction *> vkbList = editorInterface.actions();
+      			RDEBUG("count", 0);
+      			int count = vkbList.count();
+      			RDEBUG("got count", count);
+		        for (int i = 0; i < count; i++)
+		        		{
+		        		RDEBUG("i", i);
+		            HbAction *action = static_cast<HbAction *>(vkbList[i]);
+		            RDEBUG("action", 0);
+		          	}
+		          	
+		        RDEBUG("okVKBAction", 0);
+		        okVKBAction = new HbAction(tr("Ok"));
+		        RDEBUG("addAction", 0);
+		        editorInterface.addAction(okVKBAction);
+		        RDEBUG("addAction", 1);
+		        connect(okVKBAction, SIGNAL(triggered()), this, SLOT(handleAccepted()));
+		        RDEBUG("connect", 1);
+
+      			QList<HbAction *> vkbList2 = editorInterface.actions();
+      			RDEBUG("count", 0);
+      			int count2 = vkbList2.count();
+      			RDEBUG("got count2", count2);
+		        for (int i = 0; i < count2; i++)
+		        		{
+		        		RDEBUG("i", i);
+		            HbAction *action2 = static_cast<HbAction *>(vkbList2[i]);
+		            RDEBUG("action2", 0);
+		          	}
+    
     }
 // ----------------------------------------------------------------------------
 // SecUiNotificationDialog::handlebut3Changed()
@@ -679,31 +793,71 @@
 // ----------------------------------------------------------------------------
 // SecUiNotificationDialog::subscriberKSecurityUIsDismissDialogChanged()
 // A way for Autolock to dismiss any possible PIN dialog
+// This doesn't dismiss the lockIcon because P&S is not connected
+// Note: if this changes itself, then it becomes recursive
 // ----------------------------------------------------------------------------
 //
 void SecUiNotificationDialog::subscriberKSecurityUIsDismissDialogChanged()
     {
 
     RDEBUG("0", 0);
+		RDEBUG("mMyId", mMyId);
     TInt aDismissDialog = ESecurityUIsDismissDialogUninitialized;
     TInt err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsDismissDialog, aDismissDialog );
     RDEBUG("err", err);
-	RDEBUG("aDismissDialog", aDismissDialog);
+		RDEBUG("aDismissDialog", aDismissDialog);
     if( aDismissDialog == ESecurityUIsDismissDialogOn )
     	{
-		err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsDismissDialog, ESecurityUIsDismissDialogProcessing );
-		RDEBUG("err", err);
-		// TODO perhaps do this only if Cancel is allowed?
-		RDEBUG("sendResult(KErrCancel)", KErrCancel);	// another option is KErrDied
-		sendResult(KErrCancel);	// similar to     emit handleCancelled();
-		RDEBUG("close", 0);
-		close();
-		RDEBUG("emit closeDeviceDialog", 0);
-		emit deviceDialogClosed();
-		// RDEBUG("emit closeDeviceDialog", 0);
-		// this is old method    emit closeDeviceDialog(false);	// false means "not by client", although it's not really used
-		RDEBUG("all emited", 0);
-		err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsDismissDialog, ESecurityUIsDismissDialogDone );	// clear after using it
-		RDEBUG("err", err);
+    	if(subscriberKSecurityUIsDismissDialog)
+    		{
+    		RDEBUG("subscriberKSecurityUIsDismissDialog", 1);
+    		}
+    	else
+    		{
+    		RDEBUG("! subscriberKSecurityUIsDismissDialog", 0);
+    		}
+
+    	if(this)
+    		{
+    		RDEBUG("this", 1);
+    		}
+    	else
+    		{
+    		RDEBUG("! this", 0);
+    		}
+
+
+			RDEBUG("disconnect subscriberKSecurityUIsDismissDialog", 0);
+			disconnect(subscriberKSecurityUIsDismissDialog, SIGNAL(contentsChanged()), this, SLOT(subscriberKSecurityUIsDismissDialogChanged()));
+			// this doesn't really disconnect, because somehow the events are still queued. This is a QtMobility error
+			RDEBUG("disconnected subscriberKSecurityUIsDismissDialog", 1);
+			
+			RDEBUG("not set KSecurityUIsDismissDialog", ESecurityUIsDismissDialogProcessing);
+			// can't set it because it does recursion
+			// err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsDismissDialog, ESecurityUIsDismissDialogProcessing );
+			RDEBUG("err", err);
+			// only if Cancel is allowed
+			if ((queryType & ESecUiCancelSupported)==ESecUiCancelSupported)
+				{
+				RDEBUG("sendResult(KErrCancel)", KErrCancel);	// another option is KErrDied
+				sendResult(KErrCancel);	// similar to     emit handleCancelled();
+				RDEBUG("calling close()", 0);
+				err = close();
+				RDEBUG("err", err);
+				RDEBUG("emitting deviceDialogClosed", 0);
+				emit deviceDialogClosed();
+				// RDEBUG("emit closeDeviceDialog", 0);
+				// this is old method    emit closeDeviceDialog(false);	// false means "not by client", although it's not really used
+				RDEBUG("all emited", 0);
+				}
+			RDEBUG("not set KSecurityUIsDismissDialog", ESecurityUIsDismissDialogDone);
+			// can't set it because it does recursion
+			// err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsDismissDialog, ESecurityUIsDismissDialogDone );	// clear after using it
+			RDEBUG("err", err);
+
+			RDEBUG("reconnect subscriberKSecurityUIsDismissDialog", 0);
+			connect(subscriberKSecurityUIsDismissDialog, SIGNAL(contentsChanged()), this, SLOT(subscriberKSecurityUIsDismissDialogChanged()));
+			RDEBUG("reconnected subscriberKSecurityUIsDismissDialog", 1);
     	}
-	}
\ No newline at end of file
+    RDEBUG("1", 1);
+	}
--- a/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialogplugin.cpp	Wed Jun 23 19:10:54 2010 +0300
+++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialogplugin.cpp	Tue Jul 06 15:15:05 2010 +0300
@@ -15,6 +15,7 @@
 *
 */
 
+#include "secuinotificationdebug.h"
 #include "secuinotificationdialogplugin.h"
 #include "secuinotificationdialog.h"
 #include "secuinotificationdialogpluginkeys.h"
@@ -58,7 +59,7 @@
     Q_UNUSED(securityInfo)
 
     // All clients are allowed to use.
-    // TODO: should access be limited to certain clients?
+    // should access be limited to certain clients or capabilities ? Not for now.
     return true;
 }