Revision: 201003
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 19 Feb 2010 22:41:42 +0200
changeset 8 0a8136f75056
parent 4 75a71fdb4c92
child 32 d76a9889c20f
Revision: 201003 Kit: 201007
customization/group/bld.inf
omadm/omadmappui/data/NSmlDMSync.rss
omadm/omadmappui/group/NSmlDMSync.mmp
omadm/omadmappui/inc/NSmlDMSyncAppEngine.h
omadm/omadmappui/inc/NSmlDMSyncHandler.h
omadm/omadmappui/inc/NSmlDMSyncUtil.h
omadm/omadmappui/inc/NSmlDMdef.h
omadm/omadmappui/loc/NSmlDMSyncFota.loc
omadm/omadmappui/src/NSmlDMDlgProfileView.cpp
omadm/omadmappui/src/NSmlDMFotaView.cpp
omadm/omadmappui/src/NSmlDMSyncAppEngine.cpp
omadm/omadmappui/src/NSmlDMSyncAppUi_fota.cpp
omadm/omadmappui/src/NSmlDMSyncDocument.cpp
omadm/omadmappui/src/NSmlDMSyncHandler.cpp
omadm/omadmappui/src/NSmlDMSyncUtil.cpp
--- a/customization/group/bld.inf	Tue Feb 02 00:03:17 2010 +0200
+++ b/customization/group/bld.inf	Fri Feb 19 22:41:42 2010 +0200
@@ -34,7 +34,7 @@
 //#include "../UISettingsSrv/Server/group/bld.inf"
 #include "../UISettingsSrv/bld/bld.inf"
 
-#include "../isadapter/bld/bld.inf"
+//#include "../isadapter/bld/bld.inf"
 #include "../supadapter/bld/bld.inf"
 #include "../WallpaperAdapter/bld/bld.inf"
 #include "../OperatorLogoAdapter/bld/bld.inf"
--- a/omadm/omadmappui/data/NSmlDMSync.rss	Tue Feb 02 00:03:17 2010 +0200
+++ b/omadm/omadmappui/data/NSmlDMSync.rss	Fri Feb 19 22:41:42 2010 +0200
@@ -876,7 +876,7 @@
 //
 //----------------------------------------------------  
 //
-RESOURCE LISTBOX r_setting_app_listbox 
+RESOURCE LISTBOX r_setting_app_radiolistbox 
   {
   flags = 0x0001 ;
   }
@@ -893,7 +893,7 @@
   number = EAknSettingPageNoOrdinalDisplayed;
   softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
   type =  EAknSetListBox;
-  editor_resource_id =  r_setting_app_listbox;
+  editor_resource_id =  r_setting_app_radiolistbox;
   }
 
 //----------------------------------------------------
@@ -1127,7 +1127,6 @@
 RESOURCE TBUF r_qtn_fota_profile_always_ask             { buf = qtn_fota_setting_value_always_ask; }
 RESOURCE TBUF r_qtn_fota_list_query_select_server_profile { buf = qtn_fota_list_query_select_server; }
 
-RESOURCE TBUF r_qtn_fota_connection_needed              { buf = qtn_fota_conf_query_connection_is_needed; }
 
 // Strings on tabs
 RESOURCE TBUF r_qtn_dm_tab_phone_updates                { buf = qtn_dm_tab_phone_updates; }
--- a/omadm/omadmappui/group/NSmlDMSync.mmp	Tue Feb 02 00:03:17 2010 +0200
+++ b/omadm/omadmappui/group/NSmlDMSync.mmp	Fri Feb 19 22:41:42 2010 +0200
@@ -118,16 +118,16 @@
 LIBRARY     nsmltransport.lib
 LIBRARY     nsmlhistorylog.lib
 LIBRARY     syncservice.lib
-LIBRARY     centralrepository.lib
+LIBRARY     centralrepository.lib 
+LIBRARY     cmmanager.lib 
 
 #ifdef __SYNCML_DM_FOTA
 LIBRARY     fotaengine.lib
 #endif
 
-LIBRARY	policyengine.lib
-LIBRARY			  sysversioninfo.lib
+LIBRARY			policyengine.lib
 
-LIBRARY			  sisregistryclient.lib
+LIBRARY			sisregistryclient.lib ecom.lib
 
 DEBUGLIBRARY    flogger.lib
 
--- a/omadm/omadmappui/inc/NSmlDMSyncAppEngine.h	Tue Feb 02 00:03:17 2010 +0200
+++ b/omadm/omadmappui/inc/NSmlDMSyncAppEngine.h	Fri Feb 19 22:41:42 2010 +0200
@@ -141,7 +141,8 @@
                            const TInt aProfileId,
                            const TInt aJobId,
                            const TInt aConnectionBearer,
-                           const TBool aUseFotaProgressNote );
+                           const TBool aUseFotaProgressNote,
+                           const TBool aSilent);
         
         /**
         * Check if duplicate server id is found
--- a/omadm/omadmappui/inc/NSmlDMSyncHandler.h	Tue Feb 02 00:03:17 2010 +0200
+++ b/omadm/omadmappui/inc/NSmlDMSyncHandler.h	Fri Feb 19 22:41:42 2010 +0200
@@ -225,7 +225,8 @@
 		                   const TInt aProfileId,
 		                   const TInt aJobId,
 		                   const TInt aConnectionBearer,
-                           const TBool aUseFotaProgressNote );
+                           const TBool aUseFotaProgressNote,
+                           const TBool aSilent);
 		
         /**
         * Shows the progress dialog.
@@ -284,7 +285,12 @@
 		CNSmlDMSyncState* State();
 
     public:
-
+		
+        /**
+        * Starts synchronization.
+        * @return None
+        */
+		void StartSynchronizeL();
 		/**
         * Utility function.
         * @return ETrue if sync is currently running, EFalse otherwise.
@@ -383,6 +389,12 @@
         
         // Identifies Fota progress note launched or not
         TBool iFotaProgressLaunched;
+        // Set true for silent session 
+        TBool iSilent; 
+        
+    public:
+        // Periodic timer active object to start synchronization
+        CPeriodic* iPeriodic;
 	};
 
 #endif  // NSMLDMSYNCHANDLER_H
--- a/omadm/omadmappui/inc/NSmlDMSyncUtil.h	Tue Feb 02 00:03:17 2010 +0200
+++ b/omadm/omadmappui/inc/NSmlDMSyncUtil.h	Fri Feb 19 22:41:42 2010 +0200
@@ -21,6 +21,8 @@
 
 // INCLUDES
 #include <e32base.h>
+#include <DMNativeNotifier.h>
+
 
 // CLASS DECLARATION
 
@@ -148,7 +150,19 @@
         * @return Boolean
         */        
 		static TBool SettingEnforcementState();
+		
+        /**
+        * Shows dialog using DMNotifier interface
+        * @param aOperation
+        * @return Integer
+        */ 
+		static TInt ShowNativeDialogL(TInt aOperation);
 
+    public:
+		
+		//Holds the instance of implementation 
+		static CDMNativeNotifier* iDMNotifier;
+		
     private:
     
         /**
--- a/omadm/omadmappui/inc/NSmlDMdef.h	Tue Feb 02 00:03:17 2010 +0200
+++ b/omadm/omadmappui/inc/NSmlDMdef.h	Fri Feb 19 22:41:42 2010 +0200
@@ -143,10 +143,10 @@
 	};
 
 enum TNSmlAccessPointSelection
-	{
-	ENsmlAlwaysAsk,
+	{	
 	ENsmlDefaultConnection,
-	ENsmlIap
+	ENsmlIap,
+	ENsmlAlwaysAsk
 	};	
 
 //Constants used when update happen NSC/DM 
--- a/omadm/omadmappui/loc/NSmlDMSyncFota.loc	Tue Feb 02 00:03:17 2010 +0200
+++ b/omadm/omadmappui/loc/NSmlDMSyncFota.loc	Fri Feb 19 22:41:42 2010 +0200
@@ -116,15 +116,6 @@
 //
 #define qtn_fota_list_query_select_server_profile   "Select server profile"
 
-//d:Confirmation note used when the user initiates the firmware
-//d:update check. Confirms that the user wants to initiate connection
-//d:to the server.
-//l:popup_note_window
-//w:
-//r:3.1
-//
-#define qtn_fota_conf_query_connection_is_needed    "You are about to connect to the Internet. Normal data call costs may apply. Connect?"
-
 //d:Wait note shown during the user initiated checking of updates.
 //d:Is shown during the communication with the device management
 //d:server and possibly, but not necessarily, during the downloading
--- a/omadm/omadmappui/src/NSmlDMDlgProfileView.cpp	Tue Feb 02 00:03:17 2010 +0200
+++ b/omadm/omadmappui/src/NSmlDMDlgProfileView.cpp	Fri Feb 19 22:41:42 2010 +0200
@@ -21,13 +21,13 @@
 #include <aknpasswordsettingpage.h>
 #include <aknnotewrappers.h>
 #include <aknnavi.h>
-#include <ApUtils.h>
-#include <ApSettingsHandlerUI.h>
 #include <StringLoader.h>
 #include <featmgr.h>
 #include <ConnectionUiUtilities.h>
 #include <aknradiobuttonsettingpage.h>
-
+#include <cmapplicationsettingsui.h>
+#include <cmmanager.h>
+#include <cmconnectionmethod.h>
 #include "NSmlDMSyncApp.h"
 #include "NSmlDMSyncDocument.h"
 #include "NSmlDMSyncAppUi.h"
@@ -935,12 +935,8 @@
 	{
 	FLOG( "[OMADM] CNSmlDMDlgProfileView::EditSettingItemAccessPointL:" );
 	
-	TInt curSelection(ENsmlAlwaysAsk);
-    if( aItem.iNumberData == KErrNotFound   ) //Always ask
-       {       
-       curSelection = ENsmlAlwaysAsk;
-       }
-    else if(aItem.iNumberData == KErrGeneral) //default conenction
+	TInt curSelection(ENsmlDefaultConnection);
+   if(aItem.iNumberData == KErrGeneral || aItem.iNumberData == KErrNotFound ) //default conenction
         {
         curSelection = ENsmlDefaultConnection;
         }
@@ -955,12 +951,9 @@
 									R_CMMANAGERUI_SETT_USER_DEFINED);
     HBufC* title = StringLoader::LoadLC(
 									R_CMMANAGERUI_SETT_DESTINATION);
-    HBufC* alwaysask = StringLoader::LoadLC(
-									R_ALWAYS_ASK_ALWAYS_ASK);
     
-    CDesCArrayFlat* stringData = new (ELeave) CDesCArrayFlat( 3 );
+    CDesCArrayFlat* stringData = new (ELeave) CDesCArrayFlat( 2 );
     CleanupStack::PushL( stringData );
-    stringData->AppendL(alwaysask->Des());
     stringData->AppendL(destName->Des());
     stringData->AppendL(userdef->Des());
 
@@ -977,79 +970,53 @@
 	TUint32 currentAccesspoint(0);
 	if ( !ret )
 		{		
-		CleanupStack::PopAndDestroy(5);
+		CleanupStack::PopAndDestroy(4);
 		return EFalse; // user canceled "Always ask" dialog
 		}
-		
-    if ( curSelection == ENsmlAlwaysAsk  )
-    	{    	
-    	aItem.SetValue( alwaysask->Des() );
-		aItem.iNumberData = KErrNotFound;    					
-		CleanupStack::PopAndDestroy(5);
-		return ETrue;  // user selected "Always ask" option 
-    	}
-    else if(curSelection == ENsmlDefaultConnection )
+	if(curSelection == ENsmlDefaultConnection || curSelection == ENsmlAlwaysAsk )
         {        
         aItem.SetValue( destName->Des() );
         aItem.iNumberData = KErrGeneral;
-        CleanupStack::PopAndDestroy(5);        
+        CleanupStack::PopAndDestroy(4);        
         return ETrue;  // user selected "default connection" option 
         }
 	else
-	    {
-	    CCommsDatabase* commDb = CCommsDatabase::NewL( EDatabaseTypeIAP );
-	    CleanupStack::PushL( commDb );
-	    CApUtils* aputils = CApUtils::NewLC(*commDb);
-	    currentAccesspoint =  aItem.iNumberData ;
-        CleanupStack::PopAndDestroy( aputils );
-	    CleanupStack::PopAndDestroy( commDb );
-	    
+	    {	   
+	    currentAccesspoint =  aItem.iNumberData ;	    
 	    FTRACE( RDebug::Print( 
 	     _L("[OMADM] CNSmlDMDlgProfileView::EditSettingItemAccessPointL: current ap (%d)"),
 	                                                currentAccesspoint ) );
 	    }
-	
-	
-	TInt apBearerFlags;
-	if ( FeatureManager::FeatureSupported( KFeatureIdAppCsdSupport ) )
-		{
-		apBearerFlags = EApBearerTypeCSD | 
-		                EApBearerTypeGPRS | 
-		                EApBearerTypeHSCSD | 
-		                EApBearerTypeWLAN;
-		}
-	else
-		{
-		apBearerFlags = EApBearerTypeGPRS | EApBearerTypeWLAN;
-		}
-
-	CApSettingsHandler* handler = CApSettingsHandler::NewLC( 
-            ETrue,
-			EApSettingsSelListIsPopUp,
-			EApSettingsSelMenuSelectNormal,
-			KEApIspTypeAll,
-			apBearerFlags,
-			KEApSortNameAscending );
-
-    TInt retVal = KErrNone;
-    TUint32 selectedIap(0);
-	TRAP_IGNORE( retVal = handler->RunSettingsL( currentAccesspoint,
-	                                             selectedIap ) );
-	CleanupStack::PopAndDestroy(handler);
-	CleanupStack::PopAndDestroy(5);
-
-    if ( retVal & KApUiEventSelected )
-		{
-		SetAccessPointInfoL( selectedIap );
-		}
-	else if ( retVal == KApUiEventExitRequested )
-		{
-		DoExitFromMenuL();
-		}
-	else
-		{		
-		//Keep previous selection
-		}
+	 TCmSettingSelection userSelection;
+	 userSelection.iId = currentAccesspoint;
+	 userSelection.iResult = CMManager::EConnectionMethod;
+	        CCmApplicationSettingsUi* settings = CCmApplicationSettingsUi::NewL();
+	        CleanupStack::PushL(settings);
+	        TUint listedItems = CMManager::EShowConnectionMethods; 
+	        TBearerFilterArray filter;
+	        TBool selected = settings->RunApplicationSettingsL(userSelection,
+	                                                           listedItems,
+	                                                           filter);
+	        CleanupStack::PopAndDestroy(settings);
+	        if (selected) {
+	                   switch (userSelection.iResult)
+	                       {	                      
+	                       case CMManager::EConnectionMethod:
+	                           {
+	                           
+	                           SetAccessPointInfoL( userSelection.iId );
+	                           break;
+	                           }
+							default:
+								break;
+	                          }	                   	                   
+	                   }
+	        else
+	            {
+	        // Check end key handling etc?
+	        //Keep previous selection
+	            }
+	CleanupStack::PopAndDestroy(4);
 	return ETrue;
 	}
 
@@ -1060,59 +1027,25 @@
 void CNSmlDMDlgProfileView::SetAccessPointInfoL( TUint aId )
 	{
 	FLOG( "[OMADM] CNSmlDMDlgProfileView::SetAccessPointInfoL:");
-	
-	CCommsDatabase* commDb = CCommsDatabase::NewL( EDatabaseTypeIAP );
-	CleanupStack::PushL( commDb );
-
-	TInt apBearerFilter;
-
-	if ( FeatureManager::FeatureSupported( KFeatureIdAppCsdSupport ) )
-		{
-		apBearerFilter = EApBearerTypeCSD | 
-		                 EApBearerTypeGPRS | 
-		                 EApBearerTypeHSCSD | 
-		                 EApBearerTypeWLAN;
-		}
-	else
-		{
-		apBearerFilter = EApBearerTypeGPRS | EApBearerTypeWLAN;
-		}
-	CApSelect* apSelect = CApSelect::NewLC( *commDb,
-	                                        KEApIspTypeAll,
-	                                        apBearerFilter,
-	                                        KEApSortUidAscending );
-
 	TBool retValue( EFalse );
-
-	if ( apSelect->MoveToFirst() )
+	RCmManager cmManager;    
+	        cmManager.OpenLC();
+	        RCmConnectionMethod conn;
+	        TRAPD(err, conn = cmManager.ConnectionMethodL( aId ));
+	        if(err == KErrNone)//connection method exists
+	            retValue = ETrue;
+	       
+	if (retValue )
 		{
-		if ( aId == apSelect->Uid() )
-			{
-			retValue = ETrue;		
-			}
-		while ( ( ! retValue ) && ( apSelect->MoveNext() ) )
-			{
-			if ( aId == apSelect->Uid() )
-				{
-				retValue = ETrue;
-				}
-			}
+	    CleanupClosePushL( conn ); 
+		HBufC* name = conn.GetStringAttributeL( CMManager::ECmName );
+		Item( ENSmlAccessPoint )->SetValue( *name );
+		delete name;
+		CleanupStack::PopAndDestroy( 1 ); // conn
+		Item( ENSmlAccessPoint )->iNumberData = aId;
+		Item( ENSmlAccessPoint )->iWapAPInUse = EFalse; 
 		}
-
-	if ( retValue )
-		{
-		CApUtils* aputils = CApUtils::NewLC(*commDb);
-		TRAP_IGNORE( aId = aputils->IapIdFromWapIdL( aId ) );
-
-		FTRACE(RDebug::Print(_L("accesspoint after IapIdFromWapIdL (%d)"), aId));
-		
-		Item( ENSmlAccessPoint )->SetValue( apSelect->Name() );
-		Item( ENSmlAccessPoint )->iNumberData = aId;
-		Item( ENSmlAccessPoint )->iWapAPInUse = EFalse;
-		
-		CleanupStack::PopAndDestroy( aputils );
-		}
-	else
+	else//connection method doesn't exist
 		{		
 		HBufC* emptyText = 
 		    iEikonEnv->AllocReadResourceLC(R_CMMANAGERUI_SETT_DEFAULT_CONNECTION);
@@ -1121,9 +1054,7 @@
 		Item( ENSmlAccessPoint )->iWapAPInUse = EFalse;
 		CleanupStack::PopAndDestroy(emptyText);
 		}
-	
-	CleanupStack::PopAndDestroy( apSelect );
-	CleanupStack::PopAndDestroy( commDb );
+	CleanupStack::PopAndDestroy( 1 ); //cmManager	
 	}
 
 // -----------------------------------------------------------------------------
@@ -1131,110 +1062,53 @@
 // -----------------------------------------------------------------------------
 //
 void CNSmlDMDlgProfileView::GetAccessPointInfoL( TInt aId )
-	{
-	FTRACE( RDebug::Print( 
-	 _L("[OMADM] CNSmlDMDlgProfileView::GetAccessPointInfoL: aId (%d)"), aId));
-    
-    TInt err = KErrNone;
-	
-	CCommsDatabase* commDb = CCommsDatabase::NewL( EDatabaseTypeIAP );
-	CleanupStack::PushL( commDb );
-	CApUtils* aputils = CApUtils::NewLC( *commDb );
-	
-	TBool apExists = EFalse;
-	TRAP( err, apExists = aputils->IAPExistsL( aId ) );
-	if (  aId == KErrNotFound )
-		{
-		HBufC* emptyText = 
-		            iEikonEnv->AllocReadResourceLC( R_ALWAYS_ASK_ALWAYS_ASK );		
-        Item( ENSmlAccessPoint )->SetValue( emptyText->Des() );
-		Item( ENSmlAccessPoint )->iNumberData = KErrNotFound;
-		Item( ENSmlAccessPoint )->iWapAPInUse = EFalse;		
-		CleanupStack::PopAndDestroy( emptyText );
-		CleanupStack::PopAndDestroy( aputils );
-		CleanupStack::PopAndDestroy( commDb );
-		return;
-		}
-	else if(!apExists || aId == KErrGeneral) 
-	    {
-	    HBufC* emptyText = 
-	    iEikonEnv->AllocReadResourceLC(R_CMMANAGERUI_SETT_DEFAULT_CONNECTION);
-	    Item( ENSmlAccessPoint )->SetValue( emptyText->Des() );
-	    Item( ENSmlAccessPoint )->iNumberData = KErrGeneral;
-	    Item( ENSmlAccessPoint )->iWapAPInUse = EFalse;
-	    CleanupStack::PopAndDestroy( emptyText );
-	    CleanupStack::PopAndDestroy( aputils );
-	    CleanupStack::PopAndDestroy( commDb );
-	    return;
-	    }
-	else
-	    {}
-    // convert internet ap to Wap ap
-	TRAP( err, aId = aputils->WapIdFromIapIdL( aId ) );
-    CleanupStack::PopAndDestroy( aputils );
-    
-	if ( err != KErrNone )
-		{
-		CleanupStack::PopAndDestroy( commDb );
-		return;
-		}
-	
-    TInt apBearerFilter;
+    {
+    FTRACE( RDebug::Print( 
+            _L("[OMADM] CNSmlDMDlgProfileView::GetAccessPointInfoL: aId (%d)"), aId));
 
-	if ( FeatureManager::FeatureSupported( KFeatureIdAppCsdSupport ) )
-		{
-		apBearerFilter = EApBearerTypeCSD | 
-		                 EApBearerTypeGPRS | 
-		                 EApBearerTypeHSCSD | 
-		                 EApBearerTypeWLAN;
-		}
-	else
-		{
-		apBearerFilter = EApBearerTypeGPRS | EApBearerTypeWLAN;
+    TInt err = KErrNotFound;
+    TBool apExists = EFalse;
+    RCmManager cmManager;    
+    cmManager.OpenLC();
+    RCmConnectionMethod conn;
+    TRAP(err, conn = cmManager.ConnectionMethodL( aId ));
+    if(err == KErrNone)//connection method exists
+        {
+    CleanupClosePushL( conn );
+    apExists = ETrue;
+        }
+    if(!apExists || aId == KErrGeneral || aId == KErrNotFound ) 
+        {
+    HBufC* emptyText = 
+            iEikonEnv->AllocReadResourceLC(R_CMMANAGERUI_SETT_DEFAULT_CONNECTION);
+    Item( ENSmlAccessPoint )->SetValue( emptyText->Des() );
+    Item( ENSmlAccessPoint )->iNumberData = KErrGeneral;
+    Item( ENSmlAccessPoint )->iWapAPInUse = EFalse;
+    CleanupStack::PopAndDestroy( emptyText );
+    if(err == KErrNone)//connection method exists
+        {
+    CleanupStack::PopAndDestroy( 2 );//conn, cmManager	 
+        }
+    else
+        CleanupStack::PopAndDestroy( 1 );//cmManager
+    return;
+        }
+    else
+        {   
+        HBufC* name = conn.GetStringAttributeL( CMManager::ECmName );
+        Item( ENSmlAccessPoint )->SetValue( *name );
+        delete name;
+        Item( ENSmlAccessPoint )->iNumberData = aId;
+        Item( ENSmlAccessPoint )->iWapAPInUse = ETrue;        
 		}
-	CApSelect* selector = CApSelect::NewLC(
-	                             *commDb,
-	                             KEApIspTypeAll,
-		                         apBearerFilter,
-		                         KEApSortUidAscending);
-	
-	TBool found = EFalse;
-	
-	// find access point with id aId
-	if (selector->MoveToFirst())
-		{
-		if (aId == (TInt)selector->Uid())
-			{
-			found = ETrue;		
-			}
-		while (!found && selector->MoveNext())
-			{
-			if (aId == (TInt)selector->Uid())
-				{
-				found = ETrue;
-				}
-			}
-		}
+    if(err == KErrNone)//connection method exists
+        {
+        CleanupStack::PopAndDestroy( 2 );//conn, cmManager
+        }
+    else
+        CleanupStack::PopAndDestroy( 1 );
 
-	if (found) 
-		{
-		Item( ENSmlAccessPoint )->SetValue( selector->Name() );
-		Item( ENSmlAccessPoint )->iNumberData = aId;
-		Item( ENSmlAccessPoint )->iWapAPInUse = ETrue;
-		}
-	else
-		{		
-		HBufC* emptyText = 
-		   iEikonEnv->AllocReadResourceLC(R_CMMANAGERUI_SETT_DEFAULT_CONNECTION);
-        Item( ENSmlAccessPoint )->SetValue( emptyText->Des() );
-		Item( ENSmlAccessPoint )->iNumberData = KErrNotFound;
-		CleanupStack::PopAndDestroy(emptyText);
-		}
-		
-    CleanupStack::PopAndDestroy(selector);
-    CleanupStack::PopAndDestroy(commDb);
-
-	}
+    }
 
 // -----------------------------------------------------------------------------
 // CNSmlDMDlgProfileView::EditSettingItemListYesNoL
--- a/omadm/omadmappui/src/NSmlDMFotaView.cpp	Tue Feb 02 00:03:17 2010 +0200
+++ b/omadm/omadmappui/src/NSmlDMFotaView.cpp	Fri Feb 19 22:41:42 2010 +0200
@@ -131,8 +131,11 @@
             }*/
 
         case ENSmlMenuCmdFotaCheck:
-            {
-            InitiateFotaCheckL();
+            {            
+            if(TUtil::ShowNativeDialogL(EPrivacyPolicy) == KErrNone)
+                {
+                InitiateFotaCheckL();
+                }
             break;
             }
         case ENSmlMenuCmdFotaInstall:
@@ -207,9 +210,7 @@
     {
     FLOG( "[OMADM]\t CNSmlDMFotaView::InitiateFotaCheck()" );
     TInt profileId( KErrNotFound );
-    TBool isValidId( EFalse );
-    HBufC* stringHolder = NULL;
-
+    TBool isValidId( EFalse );    
     profileId = iFotaModel->DefaultFotaProfileIdL();
 
     if ( profileId >= KErrNone )
@@ -223,40 +224,11 @@
     	if( profileId == KErrNotFound )    
     	  return;
         }
-    TInt query(EFalse);
-    CRepository* cRepository=NULL;
-	TRAPD ( error, cRepository = CRepository::NewL ( KCRUidNSmlNotifierDomainKeys ) );
-	if ( error == KErrNone )
-	{
-		CleanupStack::PushL( cRepository );
-		TInt dmChargingNote(1);
-		cRepository->Get ( KNSmlDMChargingNote, dmChargingNote );
-		if(dmChargingNote==1)
-		{      
-    	CAknQueryDialog* dlg = CAknQueryDialog::NewL();
-    	CleanupStack::PushL( dlg );
-    	stringHolder = StringLoader::LoadLC( R_QTN_FOTA_CONNECTION_NEEDED );
-    	dlg->SetPromptL( stringHolder->Des() );
-    
-    CleanupStack::PopAndDestroy( stringHolder );
-    stringHolder = NULL;
-    
-    	CleanupStack::Pop( dlg );
-    
-    	query = dlg->ExecuteLD( R_SML_CONFIRMATION_QUERY );
-  		}
-  		else
-  			query = ETrue;
-  		CleanupStack::PopAndDestroy( cRepository );//cRepository
-  	}
-    if(query)
-    {
         __ASSERT_ALWAYS( iFotaModel, TUtil::Panic( KErrGeneral ) );
         
         iFotaModel->EnableFwUpdRequestL( profileId );
         ( ( CNSmlDMSyncAppUi* ) AppUi() )->StartSyncL( profileId, ETrue );
     	iFotaDLObserver->StartL(ETrue);
-        }
     
     FLOG( "[OMADM]\t CNSmlDMFotaView::InitiateFotaCheck() completed" );
     }
--- a/omadm/omadmappui/src/NSmlDMSyncAppEngine.cpp	Tue Feb 02 00:03:17 2010 +0200
+++ b/omadm/omadmappui/src/NSmlDMSyncAppEngine.cpp	Fri Feb 19 22:41:42 2010 +0200
@@ -203,7 +203,8 @@
                                          TInt aProfileId,
                                          TInt aJobId,
                                          TInt aConnectionBearer,
-                                         const TBool aUseFotaProgressNote )
+                                         const TBool aUseFotaProgressNote,
+                                         TBool aSilent)
     {
    	FLOG( "[OMADM] CNSmlDMSyncAppEngine::SynchronizeL:" );
 
@@ -217,7 +218,8 @@
                                 aProfileId, 
                                 aJobId, 
                                 aConnectionBearer,
-                                aUseFotaProgressNote );
+                                aUseFotaProgressNote,
+                                aSilent);
     }
 
 // -----------------------------------------------------------------------------
--- a/omadm/omadmappui/src/NSmlDMSyncAppUi_fota.cpp	Tue Feb 02 00:03:17 2010 +0200
+++ b/omadm/omadmappui/src/NSmlDMSyncAppUi_fota.cpp	Fri Feb 19 22:41:42 2010 +0200
@@ -286,10 +286,13 @@
 		
 		case ENSmlMenuCmdStartSync:			// start synchronisation
 			{
-            if ( ShowConfirmationNoteL( R_QTN_SML_CONF_STARTQUERY ) )
-                {
-                StartSyncL();
-                }
+			if(TUtil::ShowNativeDialogL(EPrivacyPolicy)==KErrNone)
+			    {
+                if ( ShowConfirmationNoteL( R_QTN_SML_CONF_STARTQUERY ) )
+                    {
+                    StartSyncL();
+                    }
+			    }
 			}
 		    break;
 		
--- a/omadm/omadmappui/src/NSmlDMSyncDocument.cpp	Tue Feb 02 00:03:17 2010 +0200
+++ b/omadm/omadmappui/src/NSmlDMSyncDocument.cpp	Fri Feb 19 22:41:42 2010 +0200
@@ -655,7 +655,8 @@
         	                           params.iProfileId,
         	                           params.iJobId,
         	                           bearer,
-        	                           EFalse );
+        	                           EFalse,
+        	                           iSilent);
         	break;
             }
         case KSyncServCmdShowProgress:
--- a/omadm/omadmappui/src/NSmlDMSyncHandler.cpp	Tue Feb 02 00:03:17 2010 +0200
+++ b/omadm/omadmappui/src/NSmlDMSyncHandler.cpp	Fri Feb 19 22:41:42 2010 +0200
@@ -28,7 +28,7 @@
 #include <data_caging_path_literals.hrh>  // for resource and bitmap directories
 #include <SyncMLErr.h>      // sync error codes
 
-
+#include <e32property.h>
 #include <AknsUtils.h>
 #include <DevManInternalCRKeys.h>
 #include <centralrepository.h>
@@ -49,6 +49,7 @@
 _LIT( KBitmapFileName,  "z:nsmldmsync.mbm" );
 #endif
 
+const TInt KRequestTriggerWaitTime(1000);
 // -----------------------------------------------------------------------------
 // CNSmlDMSyncHandler::NewL
 //
@@ -163,7 +164,17 @@
 		}
     FLOG( "CNSmlDMSyncHandler::HandleDialogEventL() completed" );
     }
-
+// ----------------------------------------------------------------------------------------
+// StaticSynchronizeRequestL() called to start Synchronization
+// ----------------------------------------------------------------------------------------
+static TInt StaticSynchronizeRequestL(TAny* aPtr)
+    {
+    CNSmlDMSyncHandler* ptr = (CNSmlDMSyncHandler*) aPtr;
+    FLOG("StaticSynchronizeRequestL");   
+    TRAPD(err, ptr->StartSynchronizeL() );  
+    FLOG("StaticSynchronizeRequestL completed");
+    return err;
+    }
 // -----------------------------------------------------------------------------
 // CNSmlDMSyncHandler::SynchronizeL
 // -----------------------------------------------------------------------------
@@ -172,7 +183,8 @@
                                        const TInt aProfileId,
                                        const TInt aJobId,
                                        const TInt aConnectionBearer,
-                                       const TBool aUseFotaProgressNote )
+                                       const TBool aUseFotaProgressNote, 
+                                       const TBool aSilent)
 	{
 	FLOG( "CNSmlDMSyncHandler::SynchronizeL Server alert" );
 	
@@ -181,7 +193,7 @@
     iProfileId = aProfileId;
     iJobId = aJobId;
     iUseFotaProgressNote = aUseFotaProgressNote;
-    
+    iSilent = aSilent;
     iSyncJob.OpenL( Session(), iJobId );
     iSyncJobId = iSyncJob.Identifier();
     FTRACE( FPrint( _L(
@@ -244,7 +256,81 @@
                     KNSmlDMSyncUiInitiatedJobKey,
                     iSyncJobId );
 	}
-	
+
+
+// -----------------------------------------------------------------------------
+// CNSmlDMSyncHandler::StartSynchronizeL
+// -----------------------------------------------------------------------------
+//
+void CNSmlDMSyncHandler::StartSynchronizeL()
+    {
+    FLOG( "CNSmlDMSyncHandler::StartSynchronizeL" );
+    if(iPeriodic)
+       {
+       delete iPeriodic;
+       iPeriodic = NULL;
+       FLOG("CNSmlDMSyncHandler::iPeriodic-deleted");
+       }
+    const TUid KDisclaimerProperty = {0x101F8769};
+    const TUint32 KInteger = 0x00000001;
+    TInt propValue;
+    TInt err = KErrNone;
+    
+    if(iSilent == EFalse)   //disclaimer shown for non silent session
+        {
+        if(TUtil::ShowNativeDialogL(EPrivacyPolicy)==KErrNone)
+            {
+            TRAP( err, ShowProgressDialogL() );
+            if ( err != KErrNone )
+                {
+                Session().CancelEvent();
+                Session().CancelProgress();
+                iSyncJob.StopL();
+                iSyncJob.Close();
+                propValue = 0;
+                RProperty::Set(KDisclaimerProperty, KInteger, propValue);
+                User::Leave( err );
+                }
+            FLOG( "CNSmlDMSyncHandler::SynchronizeL Sync is running" );
+
+            // Publish key here; set to 1
+            propValue = 1;
+            RProperty::Set(KDisclaimerProperty, KInteger, propValue);
+            }
+        else
+            {
+            Session().CancelEvent();
+            Session().CancelProgress();
+            propValue = 0;
+            RProperty::Set(KDisclaimerProperty, KInteger, propValue);            
+            }
+        }
+    else    //for silent session, disclaimer not shown
+        {
+        TRAP( err, ShowProgressDialogL() );
+        if ( err != KErrNone )
+            {
+            Session().CancelEvent();
+            Session().CancelProgress();
+            iSyncJob.StopL();
+            iSyncJob.Close();
+            propValue = 0;
+            RProperty::Set(KDisclaimerProperty, KInteger, propValue);
+            User::Leave( err );
+            }
+         FLOG( "CNSmlDMSyncHandler::SynchronizeL Sync is running" );
+
+            // Publish key here; set to 1
+         propValue = 1;
+         RProperty::Set(KDisclaimerProperty, KInteger, propValue);
+        }
+     
+     iSyncDocument->MarkFwUpdChangesStartL();
+     
+     iSyncRunning = ETrue;
+     iSyncError = KErrNone;
+     FLOG( "CNSmlDMSyncHandler::StartSynchronizeL completed" );
+    }
 // -----------------------------------------------------------------------------
 // CNSmlDMSyncHandler::SynchronizeL
 // -----------------------------------------------------------------------------
@@ -282,23 +368,34 @@
 	else
 	   iNotinFotaView = 0;    //already busy because in other view
 	IsDMBusy =ETrue; 
-  r2=RProperty::Set(KUidSmlSyncApp,KDMIdle,IsDMBusy);	   
-	
-	TRAP( err, ShowProgressDialogL() );
-	if ( err != KErrNone )
+  r2=RProperty::Set(KUidSmlSyncApp,KDMIdle,IsDMBusy);	
+  
+	if(iServerAlertedSync)
 		{
-		Session().CancelEvent();
-		Session().CancelProgress();
-		iSyncJob.StopL();
-		iSyncJob.Close();
-		User::Leave( err );
+        iPeriodic = CPeriodic::NewL (EPriorityNormal) ;
+        FLOG("CNSmlDMSyncHandler::SynchronizeL: iPeriodic created)");
+        iPeriodic->Start(TTimeIntervalMicroSeconds32(KRequestTriggerWaitTime*20)
+                  , TTimeIntervalMicroSeconds32(KRequestTriggerWaitTime*2500)
+                  , TCallBack(StaticSynchronizeRequestL,this) ) ;
 		}
-	FLOG( "CNSmlDMSyncHandler::SynchronizeL Sync is running" );
+	else
+	    {//For user initiated session
+		TRAP( err, ShowProgressDialogL() );
+		if ( err != KErrNone )
+		    {
+            Session().CancelEvent();
+            Session().CancelProgress();
+            iSyncJob.StopL();
+            iSyncJob.Close();
+            User::Leave( err );
+		    }
+		FLOG( "CNSmlDMSyncHandler::SynchronizeL Sync is running" );
+	    iSyncDocument->MarkFwUpdChangesStartL();
+	    
+	    iSyncRunning = ETrue;
+	    iSyncError = KErrNone;
+		}
 
-    iSyncDocument->MarkFwUpdChangesStartL();
-	
-	iSyncRunning = ETrue;
-	iSyncError = KErrNone;
 	}
 
 // -----------------------------------------------------------------------------
--- a/omadm/omadmappui/src/NSmlDMSyncUtil.cpp	Tue Feb 02 00:03:17 2010 +0200
+++ b/omadm/omadmappui/src/NSmlDMSyncUtil.cpp	Fri Feb 19 22:41:42 2010 +0200
@@ -24,8 +24,10 @@
 #include <collate.h>
 #include <StringLoader.h>
 #include <avkon.rsg>
-
+#include <DevManInternalCRKeys.h>
+#include <centralrepository.h>
 #include <SettingEnforcementInfo.h> // VSettingEnforcementInfo
+#include <ecom/ecom.h>
 
 #include "NSmlDMdef.h"
 #include "NSmlDMSyncUtil.h"
@@ -321,7 +323,86 @@
     return ret;
     }
 
+// ---------------------------------------------------------
+//  TUtil::iDMNotifier
+// ---------------------------------------------------------
+CDMNativeNotifier* TUtil::iDMNotifier=NULL;
 
+// ---------------------------------------------------------
+// TUtil::ShowDialogBox
+// 
+// Shows the requested dialog
+// ---------------------------------------------------------
+TInt TUtil::ShowNativeDialogL(TInt aOperation)
+    {
+    CRepository* centrep = NULL;
+    TInt disclaimerAccepted(0);
+    RImplInfoPtrArray dmImplArray;
+    CleanupClosePushL(dmImplArray);
+    
+    CDMNativeNotifier::ListImplementationsL(dmImplArray);
+    
+    TInt rval = -1;
+    switch(aOperation)
+        {
+        case EPrivacyPolicy:
+            {  
+            //Check for implementations and set cenrep if count = 0 
+            if( dmImplArray.Count() == 0 )  //No implementations found
+                { 
+                centrep = CRepository::NewLC( KCRUidDeviceManagementInternalKeys );
+                if(centrep)
+                    {
+                    centrep->Get( KDMDisclaimerAccepted , disclaimerAccepted );
+                    if(disclaimerAccepted != EDMDialogNotAccepted)
+                        { 
+                          disclaimerAccepted=1;
+                          centrep->Set( KDMDisclaimerAccepted , disclaimerAccepted ); //for Disclaimer
+                        }
+                    CleanupStack::PopAndDestroy(centrep); 
+                    dmImplArray.ResetAndDestroy();
+                    CleanupStack :: PopAndDestroy(&dmImplArray);
+                    return KErrNone ;
+                    }    
+                }
+            TUid id( dmImplArray[0]->ImplementationUid());
+            dmImplArray.ResetAndDestroy();
+            CleanupStack :: PopAndDestroy(&dmImplArray);
+           
+            centrep = CRepository::NewLC( KCRUidDeviceManagementInternalKeys );
+            if (centrep ) 
+               {          
+               centrep->Get( KDMDisclaimerAccepted , disclaimerAccepted ); //for Disclaimer
+               CleanupStack::PopAndDestroy(centrep);
+               }
+            if(disclaimerAccepted==EDMDialogAccepted)
+                {
+                return KErrNone;
+                }
+            else
+                {
+                if(iDMNotifier == NULL)
+                    {
+                    iDMNotifier = CDMNativeNotifier::NewL(id);
+                    }
+                if(disclaimerAccepted==EDMDialogActive)
+                    {
+                    rval = iDMNotifier->ShowDialogL(EPrivacyPolicy);
+                    }
+                else if(disclaimerAccepted==EDMDialogNotAccepted)
+                    {
+                    rval = iDMNotifier->ShowDialogL(EPrivacyPolicy);
+                    delete iDMNotifier;
+                    iDMNotifier=NULL;      
+                    REComSession::FinalClose();
+                    }
+                }
+            break;
+            } 
+        }
+
+    return rval;
+    }
 /*****************************************************************************
  * class TURIParser
  *****************************************************************************/