Revision: 201009 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 15 Mar 2010 12:43:15 +0200
branchRCL_3
changeset 12 9e9792ae22e3
parent 11 06f47423ecee
child 13 86979fe66c4c
Revision: 201009 Kit: 201010
fotaapplication/fotaserver/FotaEngine/SRC/fotaengstream.cpp
fotaapplication/fotaserver/FotaServer/data/fotaserver.rss
fotaapplication/fotaserver/FotaServer/loc/fotaserver.loc
fotaapplication/fotaserver/FotaServer/src/FotaServer.cpp
fotaapplication/fotaserver/FotaStorage/src/fotaDiskStorage.cpp
remotemgmt_plat/data_synchronization_notification_api/inc/DataSyncInternalPSKeys.h
syncmlfw/dm/callbackServer/src/nsmldmcallbackserver.cpp
syncmlfw/dm/dmutils/src/nsmldmtreedtd.cpp
syncmlfw/dm/syncagent/src/nsmldmagent.cpp
syncmlfw/ds/hostserver/dshostserverbase/bld/nsmldshostserver.mmp
syncmlfw/ds/hostserver/dshostserverbase/inc/Nsmldshostsession.h
syncmlfw/ds/hostserver/dshostserverbase/inc/Nsmldshostsessioncancel.h
syncmlfw/ds/hostserver/dshostserverbase/inc/Nsmldshostsessioncanceleventhandler.h
syncmlfw/ds/hostserver/dshostserverbase/src/Nsmldsasynccallback.cpp
syncmlfw/ds/hostserver/dshostserverbase/src/Nsmldshostsession.cpp
syncmlfw/ds/hostserver/dshostserverbase/src/Nsmldshostsessioncancel.cpp
syncmlfw/ds/syncagent/src/nsmldscontent.cpp
syncmlfw/syncmlnotifier/src/SyncMLTimedInputTextQuery.cpp
terminalsecurity/SCP/SCPServer/inc/SCPLockNotificationEventHandler.h
terminalsecurity/SCP/SCPServer/inc/SCPLockSettingEventHandler.h
terminalsecurity/SCP/SCPServer/src/SCPLockNotificationEventHandler.cpp
terminalsecurity/SCP/SCPServer/src/SCPLockSettingEventHandler.cpp
terminalsecurity/SCP/SCPServer/src/SCPSession.cpp
--- a/fotaapplication/fotaserver/FotaEngine/SRC/fotaengstream.cpp	Fri Mar 12 15:46:48 2010 +0200
+++ b/fotaapplication/fotaserver/FotaEngine/SRC/fotaengstream.cpp	Mon Mar 15 12:43:15 2010 +0200
@@ -99,6 +99,9 @@
     // Define write area
     TUint8* p1 = iMyWriteStream->iFotaEngineSession->iChunk.Base();
     TUint8* p2;
+    p2 = p1 + chunksize;
+    
+    /* // dead code
     if ( limitedwritearea == -1 ) 
         {
         p2 = p1 + chunksize;
@@ -107,6 +110,7 @@
         {
         p2 = p1 + limitedwritearea;
         }
+        */
     SetBuf  (a,p1 , p2 );
   	FLOG(_L("TDP2StreamBuf::ResetL() <<" ));
     }
--- a/fotaapplication/fotaserver/FotaServer/data/fotaserver.rss	Fri Mar 12 15:46:48 2010 +0200
+++ b/fotaapplication/fotaserver/FotaServer/data/fotaserver.rss	Mon Mar 15 12:43:15 2010 +0200
@@ -143,9 +143,9 @@
 RESOURCE TBUF r_apps_fota_restarting		{ buf = qtn_fota_restarting_phone;}
 RESOURCE TBUF r_qtn_dm_title_settings_dialog				{ buf=qtn_apps_dm_title; }
 RESOURCE TBUF r_fota_radio_dialog_1hour_remainder		{ buf=qtn_fota_reminder_1_hour;}
-RESOURCE TBUF r_fota_radio_dialog_4hours_remainder	{ buf=qtn_fota_reminder_4_hours; }
+//RESOURCE TBUF r_fota_radio_dialog_4hours_remainder	{ buf=qtn_fota_reminder_4_hours; }
 RESOURCE TBUF r_fota_radio_dialog_1day_remainder		{ buf=qtn_fota_reminder_1_day; }
-RESOURCE TBUF r_fota_radio_dialog_3days_remainder		{ buf=qtn_fota_reminder_3_days; }
+//RESOURCE TBUF r_fota_radio_dialog_3days_remainder		{ buf=qtn_fota_reminder_3_days; }
 RESOURCE TBUF r_fota_radio_dialog_no_remainder			{ buf=qtn_fota_no_reminder;}
 RESOURCE TBUF r_qtn_fota_reminder_1_minute          { buf=qtn_fota_reminder_1_minute; }    
 RESOURCE TBUF r_qtn_fota_reminder_minutes           { buf=qtn_fota_reminder_minutes ; }
--- a/fotaapplication/fotaserver/FotaServer/loc/fotaserver.loc	Fri Mar 12 15:46:48 2010 +0200
+++ b/fotaapplication/fotaserver/FotaServer/loc/fotaserver.loc	Mon Mar 15 12:43:15 2010 +0200
@@ -55,24 +55,12 @@
 //r:3.2
 #define qtn_fota_reminder_1_hour   	"1 hour"
 
-//d:radio button item to display 4 hour
-//l:list_set_graphic_pane_t1
-//w:
-//r:3.2
-#define qtn_fota_reminder_4_hours 	"4 hours"
-
 //d:radio button item to display 1 day
 //l:list_set_graphic_pane_t1
 //w:
 //r:3.2
 #define qtn_fota_reminder_1_day  	"1 day"
 
-//d:radio button item to display 3 days
-//l:list_set_graphic_pane_t1
-//w:
-//r:3.2
-#define qtn_fota_reminder_3_days 	"3 days"
-
 //d:radio button item to display no remainder
 //l:list_set_graphic_pane_t1
 //w:
--- a/fotaapplication/fotaserver/FotaServer/src/FotaServer.cpp	Fri Mar 12 15:46:48 2010 +0200
+++ b/fotaapplication/fotaserver/FotaServer/src/FotaServer.cpp	Mon Mar 15 12:43:15 2010 +0200
@@ -766,7 +766,9 @@
         StoragePluginL()->DeleteUpdatePackageL ( iDownloader->iDLState.iPkgId );
         
     // Download not to be restarted, delete
-    if ( iDownloader->iRestartCounter<=0 )
+    if ( iDownloader ) 
+    {
+    	if ( iDownloader->iRestartCounter<=0 )
         {
         // Set downloader's ending state to DB
         iDatabase->OpenDBL();
@@ -814,6 +816,7 @@
         	err = RProperty::Set(TUid::Uid(KOmaDMAppUid), KFotaDMRefresh, EFalse );
         FLOG(_L("RProperty KFotaDMRefresh EFalse, err = %d"), err);
         }
+      }
     // Download to be restarted
     else
         {
--- a/fotaapplication/fotaserver/FotaStorage/src/fotaDiskStorage.cpp	Fri Mar 12 15:46:48 2010 +0200
+++ b/fotaapplication/fotaserver/FotaStorage/src/fotaDiskStorage.cpp	Mon Mar 15 12:43:15 2010 +0200
@@ -159,9 +159,12 @@
 					isavailable = CFotaStorage::EFitsToFileSystem;
         	}
         }
+        TInt fitstodummy = isavailable==CFotaStorage::EFitsToReservation?1:0 ;
+        TInt fitstoFS = isavailable==CFotaStorage::EFitsToFileSystem?1:0 ;
+        TInt DoesntFitToFS = 	isavailable==CFotaStorage::EDoesntFitToFileSystem?1:0 ; 
+        	
     FLOG(_L("CFotaDiskStorage::IsPackageStoreSizeAvailableL %d<%d (sz vs dummy) => fitstodummy:%d fitstoFS:%d DoesntFitToFS:%d")
-        ,aSize,dummySize,isavailable==CFotaStorage::EFitsToReservation?1:0,isavailable==CFotaStorage::EFitsToFileSystem?1:0,isavailable==CFotaStorage::EDoesntFitToFileSystem?1:0
-       );
+        ,aSize,dummySize,fitstodummy,fitstoFS,DoesntFitToFS );
 
     return isavailable;
     }
--- a/remotemgmt_plat/data_synchronization_notification_api/inc/DataSyncInternalPSKeys.h	Fri Mar 12 15:46:48 2010 +0200
+++ b/remotemgmt_plat/data_synchronization_notification_api/inc/DataSyncInternalPSKeys.h	Mon Mar 15 12:43:15 2010 +0200
@@ -19,6 +19,15 @@
 
 #ifndef SYNCML_DATASYNC_INTERNAL_PS_KEYS_H
 #define SYNCML_DATASYNC_INTERNAL_PS_KEYS_H
+/**
+*Device manager key UID
+*/
+const TUid KPSUidNSmlDSSyncApp = {0x101F6DE4};
+
+/**
+*PubSub key used for handling Sync Cancel operation.
+*/
+const TUint32  KDsJobCancel = 0x00000001; 
 
 /**
 * SyncML Data Synchronization Internal P&S Keys UID
--- a/syncmlfw/dm/callbackServer/src/nsmldmcallbackserver.cpp	Fri Mar 12 15:46:48 2010 +0200
+++ b/syncmlfw/dm/callbackServer/src/nsmldmcallbackserver.cpp	Mon Mar 15 12:43:15 2010 +0200
@@ -175,7 +175,10 @@
             ) 
 		{
 		_LIT_SECURITY_POLICY_S0 ( mySidPolicy, KNSmlSOSServerSecureID );
-    	mySidPolicy().CheckPolicy ( aMessage );
+    	if(!mySidPolicy().CheckPolicy ( aMessage ))
+    	{
+				User::Leave(KErrAccessDenied);
+			}
 		}
 
 	return CNSmlDmCallbackSession::NewL( (CNSmlDmCallbackServer&)*this ); 
--- a/syncmlfw/dm/dmutils/src/nsmldmtreedtd.cpp	Fri Mar 12 15:46:48 2010 +0200
+++ b/syncmlfw/dm/dmutils/src/nsmldmtreedtd.cpp	Mon Mar 15 12:43:15 2010 +0200
@@ -46,7 +46,7 @@
 // ---------------------------------------------------------------------------
 void CNSmlDmPcdata::FreeContent()
 	{
-    delete iContent;
+    User::Free(iContent);
     iContent = 0;
 	}
 
--- a/syncmlfw/dm/syncagent/src/nsmldmagent.cpp	Fri Mar 12 15:46:48 2010 +0200
+++ b/syncmlfw/dm/syncagent/src/nsmldmagent.cpp	Mon Mar 15 12:43:15 2010 +0200
@@ -1843,6 +1843,7 @@
             iItem->iMetaMark = ((*aItemList)[i].iMetaMark)->AllocL();
             iItem->iData = ((*aItemList)[i].iData)->AllocL();
             iDataItem->AppendL(*iItem);
+            delete iItem;
             }
         }   
 
--- a/syncmlfw/ds/hostserver/dshostserverbase/bld/nsmldshostserver.mmp	Fri Mar 12 15:46:48 2010 +0200
+++ b/syncmlfw/ds/hostserver/dshostserverbase/bld/nsmldshostserver.mmp	Mon Mar 15 12:43:15 2010 +0200
@@ -52,6 +52,7 @@
 SOURCE		Nsmldsasyncrequesthandler.cpp
 SOURCE		Nsmldsasynccallback.cpp
 SOURCE		NsmldschangedItemsFetcher.cpp
+SOURCE		nsmldshostsessioncancel.cpp
 
 LIBRARY     euser.lib ecom.lib efsrv.lib edbms.lib estor.lib bafl.lib smlstoreformat.lib
 LIBRARY		nsmldebug.lib smldataprovider.lib nsmldshostclient.lib NSmlAdapterLog.lib
--- a/syncmlfw/ds/hostserver/dshostserverbase/inc/Nsmldshostsession.h	Fri Mar 12 15:46:48 2010 +0200
+++ b/syncmlfw/ds/hostserver/dshostserverbase/inc/Nsmldshostsession.h	Mon Mar 15 12:43:15 2010 +0200
@@ -32,7 +32,8 @@
 #include "nsmldsitemmodificationset.h"
 #include "Nsmldsasyncrequesthandler.h"
 #include "Nsmldsdataproviderarray.h"
-
+#include "Nsmldshostsessioncanceleventhandler.h"
+#include "Nsmldshostsessioncancel.h"
 // ------------------------------------------------------------------------------------------------
 // Class forwards
 // ------------------------------------------------------------------------------------------------
@@ -48,7 +49,8 @@
 //
 // @lib nsmldshostserver.lib
 // ------------------------------------------------------------------------------------------------
-class CNSmlDSHostSession : public CSession2
+class CNSmlDSHostSession : public CSession2,
+                           public MNSmlDsHostSessionCancelEventHandler
 	{
 private:	//DATA TYPES and INNER CLASSES
 	typedef CNSmlDSAsyncCallBack::TCallBackOperation TCallBackOperation;
@@ -252,7 +254,11 @@
 public:	//Functions from base classes.
 
 	void ServiceL( const RMessage2 &aMessage );
-	
+    /**
+    * Called when user canceled the operation
+    * @none.
+    */
+	void HandleCancelEventL();
 private:	// New methods
 	
     /**
@@ -689,12 +695,22 @@
 	*/
     void StreamBufferToChunkL( TMemPtr& aMemPtr, TStreamBuffers* aSb );
     
+    /**
+    * Called when DeleteAll request is finished
+    * @param aDSAO. pointer to asynchronous request handler
+    * @param aOperation. callback operation.
+    */
+    TInt DeleteAllFinishedL( CNSmlDSAsyncCallBack* aDSAO, TCallBackOperation aOperation );
+       
 private:	//Data
 
 	TMemPtr iMemPtr;
 	CNSmlDSHostServer& iServer;
     RNSmlDSDataProviderArray iDataProviders;
     RStringPool iStringPool;
+    CNSmlHostSessionCancel* iCancelEventHandler;
+    CNSmlDSAsyncCallBack* iDsoDeleteAll;
+
 	};
 	
 #include "Nsmldshostsession.inl"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/syncmlfw/ds/hostserver/dshostserverbase/inc/Nsmldshostsessioncancel.h	Mon Mar 15 12:43:15 2010 +0200
@@ -0,0 +1,69 @@
+/*
+* ==============================================================================
+*  Name        : nsmldshostsessioncancel.h
+*  Part of     : Nokia SyncML / Host Server
+*  Interface   : None
+*  Description : 
+*  Version     : $Revision: 54 $ $Modtime: 2.11.05 8:53 $
+*
+*  Copyright © 2002-2005 Nokia. All rights reserved.
+*  This material, including documentation and any related 
+*  computer programs, is protected by copyright controlled by 
+*  Nokia Corporation. All rights are reserved. Copying, 
+*  including reproducing, storing, adapting or translating, any 
+*  or all of this material requires the prior written consent of 
+*  Nokia Corporation. This material also contains confidential 
+*  information which may not be disclosed to others without the 
+*  prior written consent of Nokia Corporation.
+* ==============================================================================
+*/
+
+#ifndef __NSMLDSHOSTSESSIONCANCEL_H__
+#define __NSMLDSHOSTSESSIONCANCEL_H__
+
+
+// --------------------------------------------------------------------------
+// Includes
+// --------------------------------------------------------------------------
+#include <e32base.h>
+#include <s32mem.h> 
+#include <badesca.h>
+#include <e32property.h>
+
+
+// ------------------------------------------------------------------------------------------------
+// Class forwards
+// ------------------------------------------------------------------------------------------------
+class MNSmlDsHostSessionCancelEventHandler;
+
+/**
+* An active class to handle user initiated cancel.
+*  This class informs session to cancel the outgoing session.
+*
+*  @since 
+*/
+class CNSmlHostSessionCancel : public CActive
+	{
+public:
+    static CNSmlHostSessionCancel* NewL( MNSmlDsHostSessionCancelEventHandler* aHandler );
+    //Destructure
+	~CNSmlHostSessionCancel();
+	//Subscribe for the property "Cancel Operation".
+    void Subscribe();
+
+private:    
+    //Contructure
+    CNSmlHostSessionCancel( MNSmlDsHostSessionCancelEventHandler* aHandler );
+    //Second phase construction.
+    void ConstructL();
+    //From CActive class
+    void RunL();
+    void DoCancel();
+
+private:
+    MNSmlDsHostSessionCancelEventHandler* iHandler;
+    RProperty iProperty;
+	};
+
+
+#endif // __NSMLDSHOSTSESSIONCANCEL_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/syncmlfw/ds/hostserver/dshostserverbase/inc/Nsmldshostsessioncanceleventhandler.h	Mon Mar 15 12:43:15 2010 +0200
@@ -0,0 +1,48 @@
+/*
+* ==============================================================================
+*  Name        : Nsmldshostsessioncanceleventhandler.h
+*  Part of     : Nokia SyncML / Host Server
+*  Description : Header file for MNSmlDsHostSessionCancelEventHandler
+*  Version     : 
+*
+*  Copyright © 2002-2005 Nokia Corporation.
+*  This material, including documentation and any related 
+*  computer programs, is protected by copyright controlled by 
+*  Nokia Corporation. All rights are reserved. Copying, 
+*  including reproducing, storing, adapting or translating, any 
+*  or all of this material requires the prior written consent of 
+*  Nokia Corporation. This material also contains confidential 
+*  information which may not be disclosed to others without the 
+*  prior written consent of Nokia Corporation.
+* ==============================================================================
+*/
+
+#ifndef NSMLDSHOSTSESSIONCANCELEVENTHANDLER_H
+#define NSMLDSHOSTSESSIONCANCELEVENTHANDLER_H
+
+#include <e32std.h>
+#
+// CLASS DECLARATION
+
+
+/**
+* Interface class to handle database events
+* 
+*/
+class MNSmlDsHostSessionCancelEventHandler
+	{
+
+	public:
+		/**
+        * CNSmlHostSessionCancel calls this to inform that host session that user has
+        * canceled the opeartion.
+        * @return None. 
+        */
+		virtual void HandleCancelEventL() = 0;
+	};
+	
+
+
+#endif // NSMLDSHOSTSESSIONCANCELEVENTHANDLER_H
+
+// End of File
--- a/syncmlfw/ds/hostserver/dshostserverbase/src/Nsmldsasynccallback.cpp	Fri Mar 12 15:46:48 2010 +0200
+++ b/syncmlfw/ds/hostserver/dshostserverbase/src/Nsmldsasynccallback.cpp	Mon Mar 15 12:43:15 2010 +0200
@@ -88,6 +88,7 @@
     if ( iReqFinishedFunc != NULL )
     	{
     	( *iSession.*iReqFinishedFunc )( this, ECanceled );
+    	iMessage.Complete( KErrCancel);
     	}
     }
 
--- a/syncmlfw/ds/hostserver/dshostserverbase/src/Nsmldshostsession.cpp	Fri Mar 12 15:46:48 2010 +0200
+++ b/syncmlfw/ds/hostserver/dshostserverbase/src/Nsmldshostsession.cpp	Mon Mar 15 12:43:15 2010 +0200
@@ -30,6 +30,8 @@
 #include "NSmlAdapterLog.h"
 #include "nsmldshostconstants.h"
 #include "Nsmldshostserver.h"
+#include "nsmldshostsessioncanceleventhandler.h"
+#include "Nsmldshostsessioncancel.h"
 #include "Nsmldshostsession.h"
 #include "nsmldsdpinformation.h"
 #include "Nsmldsdataproviderarray.h"
@@ -174,6 +176,16 @@
     iMemPtr.iChunk.Close();
     iDataProviders.ResetAndDestroy();
     iStringPool.Close();
+    if(iDsoDeleteAll)
+      {
+      delete iDsoDeleteAll;
+      iDsoDeleteAll = NULL;
+      }   
+    if(iCancelEventHandler)
+        {
+        delete iCancelEventHandler;
+        iCancelEventHandler = NULL;
+        }
     REComSession::FinalClose();
     iServer.DecSessionCount();
 	_DBG_FILE( "CNSmlDSHostSession::~CNSmlDSHostSession(): end" );
@@ -410,6 +422,8 @@
 	{
 	_DBG_FILE( "CNSmlDSHostSession::ConstructL(): begin" );
     iStringPool.OpenL();
+	iDsoDeleteAll = NULL;
+	iCancelEventHandler = NULL;
 	_DBG_FILE( "CNSmlDSHostSession::ConstructL(): end" );
 	}
 	
@@ -1486,11 +1500,14 @@
 // ------------------------------------------------------------------------------------------------	
 void CNSmlDSHostSession::DeleteAllItemsL( const RMessage2& aMessage )
 	{
+    //Create cancel event handler
+    iCancelEventHandler = CNSmlHostSessionCancel::NewL(this);
     TNSmlDSDataStoreElement* dsi = DataStoreItemL( aMessage );
-    CNSmlDSAsyncCallBack* dsao = new ( ELeave ) CNSmlDSAsyncCallBack( this, dsi, aMessage );
+    CNSmlDSAsyncCallBack* dsao = new ( ELeave ) CNSmlDSAsyncCallBack( this, dsi, aMessage, DeleteAllFinishedL );
     CleanupStack::PushL( dsao );
-    dsao->CallDSAsyncLC().DeleteAllItemsL( dsao->iStatus );
+    dsao->CallDSAsyncLC().DeleteAllItemsL( dsao->iStatus );   
     CleanupStack::Pop(2); //CallDSAsyncLC(), dsao
+    iDsoDeleteAll = dsao;
 	}
 
 // ------------------------------------------------------------------------------------------------
@@ -1891,4 +1908,46 @@
 	CleanupStack::PopAndDestroy(); //wStream
 	}
 
+// ------------------------------------------------------------------------------------------------
+// CNSmlDSHostSession::HandleCancelEventL
+// called when user canceled the operation
+// ------------------------------------------------------------------------------------------------ 
+void CNSmlDSHostSession::HandleCancelEventL()
+    {
+    if(iCancelEventHandler)
+        {
+        iDsoDeleteAll->Cancel();
+        }
+    }
+
+// ------------------------------------------------------------------------------------------------
+// CNSmlDSHostSession::DeleteAllFinishedL
+// called when DeleteAll request is finished.
+// Note! when aOperation is CNSmlDSAsyncCallBack::ECanceled or CNSmlDSAsyncCallBack::EFree, 
+// aDSAO->iDSItem might be NULL.
+// ------------------------------------------------------------------------------------------------ 
+TInt CNSmlDSHostSession::DeleteAllFinishedL( CNSmlDSAsyncCallBack* aDSAO, TCallBackOperation aOperation )
+    {
+    TInt err( aDSAO->iStatus.Int() );
+
+    switch( aOperation )
+        {
+        case CNSmlDSAsyncCallBack::EFinished:
+        case CNSmlDSAsyncCallBack::ECanceled:
+        case CNSmlDSAsyncCallBack::EFree:
+            {
+            if(iCancelEventHandler)
+                {
+                delete iCancelEventHandler;
+                iCancelEventHandler = NULL;
+                iDsoDeleteAll = NULL;
+                }
+            break;
+            }
+        default:
+            User::Leave( KErrUnknown );
+        };
+
+    return err;
+    }
 // End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/syncmlfw/ds/hostserver/dshostserverbase/src/Nsmldshostsessioncancel.cpp	Mon Mar 15 12:43:15 2010 +0200
@@ -0,0 +1,117 @@
+/*
+* ==============================================================================
+*  Name        : Nsmldshostsessioncancel.cpp
+*  Part of     : Nokia SyncML / DS Loader Framework
+*  Description : Handling Session cancel for DS host server.
+*  Version     : $Revision: 41 $ $Modtime: 09.02.10 8:05 $
+*
+*  Copyright © 2005 Nokia Corporation.
+*  This material, including documentation and any related 
+*  computer programs, is protected by copyright controlled by 
+*  Nokia Corporation. All rights are reserved. Copying, 
+*  including reproducing, storing, adapting or translating, any 
+*  or all of this material requires the prior written consent of 
+*  Nokia Corporation. This material also contains confidential 
+*  information which may not be disclosed to others without the 
+*  prior written consent of Nokia Corporation.
+* ==============================================================================
+*/
+//#include <sbdefs.h>
+#include <d32dbms.h>
+#include <nsmldebug.h>
+#include <DataSyncInternalPSKeys.h>
+#include "nsmldshostsessioncanceleventhandler.h"
+#include "nsmldshostsessioncancel.h"
+// --------------------------------------------------------------------------
+// CNSmlHostSessionCancel* CNSmlHostSessionCancel::NewL( MNSmlDsHostSessionCancelEventHandler* aHandler )
+// --------------------------------------------------------------------------
+//
+CNSmlHostSessionCancel* CNSmlHostSessionCancel::NewL( MNSmlDsHostSessionCancelEventHandler* aHandler )
+	{
+	CNSmlHostSessionCancel* self = new (ELeave) CNSmlHostSessionCancel( aHandler );
+	CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+	return self;
+	}
+
+// --------------------------------------------------------------------------
+// CNSmlHostSessionCancel::CNSmlHostSessionCancel( MNSmlDsHostSessionCancelEventHandler* aHandler )
+// --------------------------------------------------------------------------
+//
+CNSmlHostSessionCancel::CNSmlHostSessionCancel( MNSmlDsHostSessionCancelEventHandler* aHandler ) :
+    CActive( EPriorityNormal ),
+    iHandler( aHandler )
+	{
+    CActiveScheduler::Add(this);
+	}
+
+// --------------------------------------------------------------------------
+// void CNSmlHostSessionCancel::Subscribe()
+// --------------------------------------------------------------------------
+//
+void CNSmlHostSessionCancel::Subscribe()
+    {
+    if ( !IsActive() )
+        {
+        iProperty.Subscribe( iStatus );    
+        SetActive();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// void CNSmlHostSessionCancel::ConstructL()
+// --------------------------------------------------------------------------
+//
+void CNSmlHostSessionCancel::ConstructL()
+    {
+    iProperty.Attach( KPSUidNSmlDSSyncApp, KDsJobCancel );
+    Subscribe();    
+    }
+
+// --------------------------------------------------------------------------
+// CNSmlHostSessionCancel::~CNSmlHostSessionCancel()
+// --------------------------------------------------------------------------
+//
+CNSmlHostSessionCancel::~CNSmlHostSessionCancel()
+	{
+    Cancel();
+    iProperty.Close();
+    }
+
+// --------------------------------------------------------------------------
+// void CNSmlHostSessionCancel::RunL()
+// --------------------------------------------------------------------------
+//
+void CNSmlHostSessionCancel::RunL()
+    {
+    _DBG_FILE("CNSmlHostSessionCancel::RunL() : Begin");
+    
+    TInt value(0);
+    iProperty.Get( value );
+    
+    if( value == KErrCancel)
+        {
+        _DBG_FILE("CNSmlHostSessionCancel::RunL() :: user has canceled the operation");
+
+        //user has canceled the opeartion inform session
+        iHandler->HandleCancelEventL();
+        }
+    else
+        {
+        Subscribe();
+        }
+
+    _DBG_FILE("CNSmlHostSessionCancel::RunL() : End");
+    }
+
+// --------------------------------------------------------------------------
+// void CNSmlHostSessionCancel::DoCancel()
+// --------------------------------------------------------------------------
+//
+void CNSmlHostSessionCancel::DoCancel()
+    {
+    iProperty.Cancel();
+    }
+
+//  End of File
--- a/syncmlfw/ds/syncagent/src/nsmldscontent.cpp	Fri Mar 12 15:46:48 2010 +0200
+++ b/syncmlfw/ds/syncagent/src/nsmldscontent.cpp	Mon Mar 15 12:43:15 2010 +0200
@@ -120,7 +120,7 @@
 //
 TBool CNSmlDSContent::ContentIndexIsSet() const
 	{
-	if ( iIndex == -1 )
+	if ( ( iIndex < 0 ) || ( iIndex >= iStores.Count() ) )
 		{
 		return EFalse;
 		}
--- a/syncmlfw/syncmlnotifier/src/SyncMLTimedInputTextQuery.cpp	Fri Mar 12 15:46:48 2010 +0200
+++ b/syncmlfw/syncmlnotifier/src/SyncMLTimedInputTextQuery.cpp	Mon Mar 15 12:43:15 2010 +0200
@@ -155,17 +155,17 @@
 //
 TBool CSyncMLTimedInputTextQuery::HandleQueryEditorStateEventL(CAknQueryControl* aQueryControl, TQueryControlEvent aEventType, TQueryValidationStatus aStatus)
 	{
- 
- 	if( EPhoneLayout == aQueryControl->QueryType() )
- 	 {
-		if (aEventType == EEmergencyCallAttempted)
+ 	if ( aQueryControl )
+  {
+ 		if( EPhoneLayout == aQueryControl->QueryType() )
+ 	 	{
+			if (aEventType == EEmergencyCallAttempted)
         	{
         	TryExitL(EEikBidCancel);
         	}
     	else
         	{
-        	if ( aQueryControl )
-         	{
+        	
          	TBuf<KSyncMLMaxDefaultResponseMsgLength> PhoneNo;
          	aQueryControl->GetText( PhoneNo );
          	TInt posplus = PhoneNo.LocateReverse('+');
@@ -177,10 +177,9 @@
            	{      
           	MakeLeftSoftkeyVisible(EFalse);
            	}
-         	}
-        
-        	}   
+         	}  
   	 }
+  }
  	else //For all other layouts 
  	 {
  	CAknQueryDialog::HandleQueryEditorStateEventL(aQueryControl,aEventType,aStatus);	
--- a/terminalsecurity/SCP/SCPServer/inc/SCPLockNotificationEventHandler.h	Fri Mar 12 15:46:48 2010 +0200
+++ b/terminalsecurity/SCP/SCPServer/inc/SCPLockNotificationEventHandler.h	Mon Mar 15 12:43:15 2010 +0200
@@ -22,6 +22,8 @@
 #include <bldvariant.hrh>
 #include "SCPLockEventHandler.h"
 
+// FORWARD DECLARATIONS
+class CSCPSession;
 // CLASS DECLARATION
 
 /**
@@ -36,18 +38,20 @@
         /**
         * Static constructor.
         */
-   	    static CSCPLockNotificationEventHandler* NewL( CSCPServer* aServer );
+   	    static CSCPLockNotificationEventHandler* NewL( CSCPServer* aServer, CSCPSession* aSession );
         
         /**
         * Static constructor, that leaves the pointer to the cleanup stack.
         */
-        static CSCPLockNotificationEventHandler* NewLC( CSCPServer* aServer );
+        static CSCPLockNotificationEventHandler* NewLC( CSCPServer* aServer, CSCPSession* aSession );
 
         /**
         * Destructor.
         */
         virtual ~CSCPLockNotificationEventHandler();
        
+		// Ack from session after queryadmincmd
+		void AckReceived();
     protected:  // Methods   
         
         // Methods from base classes
@@ -67,13 +71,16 @@
         * From CActive The active object request cancellation method.
         */
         void DoCancel();
+		
+        // send passcode to ISA
+        void VerifyPass();
 
     private: //Methods
     
         /**
         * C++ default constructor.
         */
-        CSCPLockNotificationEventHandler( CSCPServer* aServer );    
+        CSCPLockNotificationEventHandler( CSCPServer* aServer, CSCPSession* aSession );
 
         /**
         * By default Symbian 2nd phase constructor is private.
@@ -86,13 +93,18 @@
         enum TSCPLNQueryState
             {
             ESCPLNQueryStateNotification,
-            ESCPLNQueryStateVerification
+            ESCPLNQueryStateVerification,
+            ESCPLNQueryStateQueryAdmin
             };
                         
         /** The current processing state. */
         TSCPLNQueryState                        iQueryState;                 
         /** A placeholder for the event received from the TSY */
         RMobilePhone::TMobilePhoneSecurityEvent iEvent;        
+        // Ack from queryadmin
+        TBool iAckReceived;
+        /** The parent session pointer */
+        CSCPSession* iSession;
     };
 
 #endif      // SCPLOCKNOTIFICATIONEVENTHANDLER_H   
--- a/terminalsecurity/SCP/SCPServer/inc/SCPLockSettingEventHandler.h	Fri Mar 12 15:46:48 2010 +0200
+++ b/terminalsecurity/SCP/SCPServer/inc/SCPLockSettingEventHandler.h	Mon Mar 15 12:43:15 2010 +0200
@@ -63,14 +63,6 @@
         * Destructor.
         */
         virtual ~CSCPLockSettingEventHandler();
-
-       // New methods  
-       /**
-        * Informs the object that an acknowledgement was received
-        * This method will be used, if the acknowledgement comes in
-        * before the wait is started.
-        */
-        void AckReceived(); 
         
        /**
         * Starts the lock/unlock operation. Must be called for the object
@@ -125,10 +117,6 @@
          TBool iState;
          /** Should Autolock be activated/deactivated on success */
          TBool iAutolock;    
-         /** Is the AO waiting for an acknowledgement to the lock setting call*/
-         TBool iWaitingForAck;
-         /** Has the AO received an acknowledgement already*/
-         TBool iAckReceived;
          /** Has an unlock-message to Autolock been sent*/
          TBool iUnlockSent;
          /** The return status for the message*/
--- a/terminalsecurity/SCP/SCPServer/src/SCPLockNotificationEventHandler.cpp	Fri Mar 12 15:46:48 2010 +0200
+++ b/terminalsecurity/SCP/SCPServer/src/SCPLockNotificationEventHandler.cpp	Mon Mar 15 12:43:15 2010 +0200
@@ -33,6 +33,7 @@
 
 #include "SCPLockNotificationEventHandler.h"
 #include "SCPServer.h"
+#include "SCPSession.h"
 
 // ================= MEMBER FUNCTIONS =======================
 
@@ -40,10 +41,13 @@
 // might leave.
 //
 CSCPLockNotificationEventHandler::CSCPLockNotificationEventHandler(                        
-            CSCPServer* aServer
+            CSCPServer* aServer,
+            CSCPSession* aSession
             )
 	        : CSCPLockEventHandler( aServer ),
-	        iQueryState(ESCPLNQueryStateNotification) 	
+	        iQueryState(ESCPLNQueryStateNotification),
+	        iSession (aSession),
+	        iAckReceived (EFalse)
     {
     Dprint( (_L("--> CSCPLockNotificationEventHandler::\
 	      CSCPLockNotificationEventHandler()") ));
@@ -68,13 +72,14 @@
 
 // Static constructor.
 CSCPLockNotificationEventHandler* CSCPLockNotificationEventHandler::NewL(
-        CSCPServer* aServer
+        CSCPServer* aServer,
+        CSCPSession* aSession
         )
     {
 	  Dprint( (_L("--> CSCPLockNotificationEventHandler::NewL()") ));
 
 	  CSCPLockNotificationEventHandler* self = 
-	      CSCPLockNotificationEventHandler::NewLC( aServer );
+	      CSCPLockNotificationEventHandler::NewLC( aServer, aSession );
 	        
     CleanupStack::Pop( self );
 	
@@ -85,13 +90,14 @@
 
 // Static constructor, leaves object pointer to the cleanup stack.
 CSCPLockNotificationEventHandler* CSCPLockNotificationEventHandler::NewLC(
-        CSCPServer* aServer 
+        CSCPServer* aServer,
+        CSCPSession* aSession
         )
     {
     Dprint( (_L("--> CSCPLockNotificationEventHandler::NewLC()") ));
 
     CSCPLockNotificationEventHandler* self = 
-        new (ELeave) CSCPLockNotificationEventHandler( aServer );
+        new (ELeave) CSCPLockNotificationEventHandler( aServer, aSession );
 
     CleanupStack::PushL( self );
     self->ConstructL();	
@@ -149,6 +155,48 @@
     }
 
 // ---------------------------------------------------------
+// void CSCPLockNotificationEventHandler::AckReceived()
+// Sets the ackReceived member to indicate that the call has
+// already been acknowledged.
+// 
+// Status : Approved
+// ---------------------------------------------------------
+
+void CSCPLockNotificationEventHandler::AckReceived()
+    {
+    Dprint( (_L("--> CSCPLockNotificationEventHandler::AckReceived()") ));
+    iAckReceived = ETrue;    
+    }
+
+// ---------------------------------------------------------
+// void CSCPLockNotificationEventHandler::VerifyPass()
+// Verify password to the ISA
+// 
+// Status : Approved
+// ---------------------------------------------------------
+void CSCPLockNotificationEventHandler::VerifyPass()
+    {
+    Dprint( (_L("CSCPLockNotificationEventHandler::VerifyPass():\
+        EPhonePasswordRequired event received") ));
+
+    RMobilePhone::TMobilePhoneSecurityCode secCodeType = 
+        RMobilePhone::ESecurityCodePhonePassword;
+        
+    RMobilePhone::TMobilePassword password;
+    RMobilePhone::TMobilePassword required_fourth;
+    required_fourth.Zero();
+    iServer->GetCode( password );                
+
+    iPhone->VerifySecurityCode(iStatus, secCodeType, 
+        password, required_fourth);
+
+    // Start waiting for verification response
+    iQueryState = ESCPLNQueryStateVerification;
+    SetActive(); 
+    Dprint( (_L("<-- CSCPLockNotificationEventHandler::VerifyPass()") ));    
+    }
+
+// ---------------------------------------------------------
 // void CSCPLockNotificationEventHandler::RunL()
 // When the correct security event is received, the code query is
 // verified via VerifySecurityCode. This method also handles the
@@ -165,35 +213,32 @@
         {
         case ( ESCPLNQueryStateNotification ):
             {                        
-            // Event received
-            if ( iEvent == RMobilePhone::EPhonePasswordRequired )
-                {
-                Dprint( (_L("CSCPLockNotificationEventHandler::RunL():\
-                    EPhonePasswordRequired event received") ));
-      
-                RMobilePhone::TMobilePhoneSecurityCode secCodeType = 
-                    RMobilePhone::ESecurityCodePhonePassword;
-                    
-                RMobilePhone::TMobilePassword password;
-                RMobilePhone::TMobilePassword required_fourth;
-                required_fourth.Zero();
-                iServer->GetCode( password );                
-      
-                iPhone->VerifySecurityCode(iStatus, secCodeType, 
-                    password, required_fourth);
-      
-                // Start waiting for verification response
-                iQueryState = ESCPLNQueryStateVerification;
-                SetActive();                  
-                }
-            else
-                {
-                Dprint( (_L("CSCPLockNotificationEventHandler::RunL():\
-                    Invalid event received") ));
-                // Re-run registration, this event is not the one we're waiting for
-                RegisterListener();
-                }
-        
+            // Event received from Session, queryAdminCmd
+             if (iAckReceived)
+                 {
+                 VerifyPass();
+                 }
+             else if ( iEvent == RMobilePhone::EPhonePasswordRequired )
+                 {
+                 Dprint( (_L("--> CSCPLockNotificationEventHandler::EPhonePasswordRequired") ));
+                 iQueryState = ESCPLNQueryStateQueryAdmin;
+                 iSession->LockOperationPending( ESCPCommandLockPhone, &iStatus );
+                 SetActive();
+                 }
+             else
+                 {
+                 Dprint( (_L("CSCPLockNotificationEventHandler::RunL():\
+                     Invalid event received") ));
+                 // Re-run registration, this event is not the one we're waiting for
+                 RegisterListener();
+                 }
+             break;
+            }
+        // Event received from Session for LockOpPending, queryAdminCmd
+        case (ESCPLNQueryStateQueryAdmin):
+            {             
+            Dprint( (_L("--> CSCPLockNotificationEventHandler::ESCPLNQueryStateQueryAdmin") ));
+            VerifyPass();
             break;
             }
 
--- a/terminalsecurity/SCP/SCPServer/src/SCPLockSettingEventHandler.cpp	Fri Mar 12 15:46:48 2010 +0200
+++ b/terminalsecurity/SCP/SCPServer/src/SCPLockSettingEventHandler.cpp	Mon Mar 15 12:43:15 2010 +0200
@@ -59,8 +59,6 @@
     iSession( aSession ),
     iState( aState ),
     iAutolock( aAutolock ),
-    iWaitingForAck( EFalse ),
-    iAckReceived( EFalse ),
     iUnlockSent( EFalse ),
     iMessageStatus( KErrNone )
 	{
@@ -258,19 +256,6 @@
 
 
 // ---------------------------------------------------------
-// void CSCPLockSettingEventHandler::AckReceived()
-// Sets the ackReceived member to indicate that the call has
-// already been acknowledged.
-// 
-// Status : Approved
-// ---------------------------------------------------------
-
-void CSCPLockSettingEventHandler::AckReceived()
-    {
-    iAckReceived = ETrue;    
-    }
-
-// ---------------------------------------------------------
 // void CSCPLockSettingEventHandler::SetAutolockStateL( TBool aActive )
 // Activates Autolock by signalling the SA/PubSub event, or
 // deactivates it by sending it the deactivation message.
@@ -387,7 +372,7 @@
             iMessageStatus = ret;
             }
         }    
-    else if ( iWaitingForAck ) // Received an acknowledgement for the set lock setting call
+    else // Received an acknowledgement for the set lock setting call
         {
         if ( ret == KErrNone ) 
             {
@@ -402,42 +387,24 @@
             iMessageStatus = ret;
             }            
         }
-    else // SetLockSetting completed
-        {        
-        // Save the status of the lock setting call
-        iMessageStatus = ret;
-
-        Dprint( (_L("CSCPLockSettingEventHandler::RunL():\
-            SetLockSetting returned: %d"), ret ));
-      
-        if ( iAckReceived )
-            {
-            Dprint( (_L("CSCPLockSettingEventHandler::RunL(): Ack already received") ));  
-            startFinalPhase = ETrue;
-            }
-        else
-            {
-            iSession->LockOperationPending( ESCPCommandLockPhone, &iStatus );
-            iWaitingForAck = ETrue;	                
-            finalCall = EFalse;
-	        SetActive(); // Wait for the session-class to complete this call
-            }                	    
-        }
 	   
     if ( ( startFinalPhase ) && ( iAutolock ) )
         {
+        	Dprint( (_L("--> CSCPLockSettingEventHandler::RunL-startFinalPhase") ));
         // Autolock activation/deactivation was requested
         TRAPD( err, SetAutolockStateL( iState ) );
     
         if ( err != KErrNone )
             {
             // If the call failed, send the result as the message status
+            Dprint( (_L("--> CSCPLockSettingEventHandler::RunL-err!=Kerrnone") ));
             iMessageStatus = err;
             }
         else if ( !iState )
             {
             // Inform the session-class that an unlock-message has been sent
             // (the server won't respond to Autolock until the handler finishes)                    
+            Dprint( (_L("--> CSCPLockSettingEventHandler::RunL-!iState") ));                  
             iSession->LockOperationPending( ESCPCommandUnlockPhone, &iStatus );
             iUnlockSent = ETrue;	                
             finalCall = EFalse;
@@ -469,10 +436,7 @@
     {
     Dprint( (_L("--> CSCPLockSettingEventHandler::DoCancel()") ));
 
-    if ( !iWaitingForAck )
-        {
-        iPhone->CancelAsyncRequest( EMobilePhoneSetLockSetting );
-        }        
+    iPhone->CancelAsyncRequest( EMobilePhoneSetLockSetting );
 
     iLockMessage.Complete( KErrCancel );    
     iSession->LockOperationCompleted();  
--- a/terminalsecurity/SCP/SCPServer/src/SCPSession.cpp	Fri Mar 12 15:46:48 2010 +0200
+++ b/terminalsecurity/SCP/SCPServer/src/SCPSession.cpp	Mon Mar 15 12:43:15 2010 +0200
@@ -181,7 +181,7 @@
                 Dprint( (_L("CSCPSession::AcknowledgeOperation( %d ): \
                     Lock-op acknowledged"), aCommand ));
                 iLockCommandState = ESCPLockCmdStateInProgressAcknowledged;
-                iSettingHandler->AckReceived();
+                iNotificationHandler->AckReceived();
                                 
                 ret = ETrue;
                 break;
@@ -435,7 +435,7 @@
     // (because DOS lock won't be disabled)
     if ( ( aLocked ) || ( ( !IsSMSLockActiveL() ) && ( !IsAutolockActive() ) ) )
         {
-        iNotificationHandler = CSCPLockNotificationEventHandler::NewL( &iServer );
+        iNotificationHandler = CSCPLockNotificationEventHandler::NewL( &iServer, this );
         }
         
 #endif // WINS