Revision: 201031 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 19 Aug 2010 09:42:30 +0300
branchRCL_3
changeset 23 c4687ff85147
parent 22 9360ca28b668
child 24 6757f1e2efd2
Revision: 201031 Kit: 201033
applicationmanagement/conf/application_management.confml
applicationmanagement/omascomoadapter/inc/omascomoadapter.h
applicationmanagement/omascomoadapter/src/omascomoadapter.cpp
applicationmanagement/server/src/ApplicationManagementServer.cpp
customization/UISettingsSrv/server/Src/UISettingsSrvUi.cpp
customization/UISettingsSrv/server/aif/UISettingsSrv_reg.rss
omadm/group/bld.inf
omadm/lawmo/group/bld.inf
omadm/lawmo/inc/fdebug.h
omadm/lawmo/lawmoplugins/calllogsplugin/data/calllogsplugin.rss
omadm/lawmo/lawmoplugins/calllogsplugin/group/bld.inf
omadm/lawmo/lawmoplugins/calllogsplugin/group/calllogsplugin.mmp
omadm/lawmo/lawmoplugins/calllogsplugin/inc/calllogsplugin.h
omadm/lawmo/lawmoplugins/calllogsplugin/inc/lawmocalllogsasyncwipe.h
omadm/lawmo/lawmoplugins/calllogsplugin/src/calllogsplugin.cpp
omadm/lawmo/lawmoplugins/calllogsplugin/src/calllogspluginproxy.cpp
omadm/lawmo/lawmoplugins/calllogsplugin/src/lawmocalllogsasyncwipe.cpp
omadm/lawmo/lawmoplugins/contactsplugin/data/contactsplugin.rss
omadm/lawmo/lawmoplugins/contactsplugin/group/bld.inf
omadm/lawmo/lawmoplugins/contactsplugin/group/contactsplugin.mmp
omadm/lawmo/lawmoplugins/contactsplugin/inc/contactsplugin.h
omadm/lawmo/lawmoplugins/contactsplugin/inc/lawmocontactsasyncwipe.h
omadm/lawmo/lawmoplugins/contactsplugin/src/contactsplugin.cpp
omadm/lawmo/lawmoplugins/contactsplugin/src/contactspluginproxy.cpp
omadm/lawmo/lawmoplugins/contactsplugin/src/lawmocontactsasyncwipe.cpp
omadm/lawmo/lawmoplugins/group/bld.inf
omadm/lawmo/lawmoplugins/mediaplugin/data/mediaplugin.rss
omadm/lawmo/lawmoplugins/mediaplugin/group/bld.inf
omadm/lawmo/lawmoplugins/mediaplugin/group/mediaplugin.mmp
omadm/lawmo/lawmoplugins/mediaplugin/inc/lawmodebug.h
omadm/lawmo/lawmoplugins/mediaplugin/inc/mediaplugin.h
omadm/lawmo/lawmoplugins/mediaplugin/src/mediaplugin.cpp
omadm/lawmo/lawmoplugins/mediaplugin/src/mediapluginproxy.cpp
omadm/lawmo/lawmoplugins/messagingplugin/data/messagingplugin.rss
omadm/lawmo/lawmoplugins/messagingplugin/group/bld.inf
omadm/lawmo/lawmoplugins/messagingplugin/group/messagingplugin.mmp
omadm/lawmo/lawmoplugins/messagingplugin/inc/lawmomessagingasyncwipe.h
omadm/lawmo/lawmoplugins/messagingplugin/inc/messagingplugin.h
omadm/lawmo/lawmoplugins/messagingplugin/src/lawmomessagingasyncwipe.cpp
omadm/lawmo/lawmoplugins/messagingplugin/src/messagingplugin.cpp
omadm/lawmo/lawmoplugins/messagingplugin/src/messagingpluginproxy.cpp
omadm/lawmo/rom/lawmo.iby
omadm/omadmappui/data/NSmlDMSync.rss
omadm/omadmappui/data/NSmlDMSync_reg.rss
omadm/omadmappui/src/NSmlDMDlgProfileView.cpp
omadm/omadmappui/src/NSmlDMFotaContainer.cpp
omadm/omadmappui/src/NSmlDMFotaSettingsDialog.cpp
omadm/omadmappui/src/NSmlDMFotaView.cpp
omadm/omadmappui/src/NSmlDMItemData.cpp
omadm/omadmappui/src/NSmlDMProfilesContainer.cpp
omadm/omadmappui/src/NSmlDMProfilesView.cpp
omadm/omadmappui/src/NSmlDMProgress.cpp
omadm/omadmappui/src/NSmlDMSyncAppUi_fota.cpp
omadm/omadmappui/src/NSmlDMSyncDialog.cpp
omadm/omadmappui/src/NSmlDMSyncDocument.cpp
omadm/omadmappui/src/NSmlDMSyncHandler.cpp
omadm/omadmextensions/adapters/bld/bld.inf
omadm/omadmextensions/adapters/lawmodmadapter/conf/lawmoadapter.confml
omadm/omadmextensions/adapters/lawmodmadapter/conf/lawmoadapter_2002EA22.crml
omadm/omadmextensions/adapters/lawmodmadapter/data/lawmodmadapter.rss
omadm/omadmextensions/adapters/lawmodmadapter/group/bld.inf
omadm/omadmextensions/adapters/lawmodmadapter/group/lawmodmadapter.mmp
omadm/omadmextensions/adapters/lawmodmadapter/inc/TPtrC8I.h
omadm/omadmextensions/adapters/lawmodmadapter/inc/lawmodebug.h
omadm/omadmextensions/adapters/lawmodmadapter/inc/lawmodmadapter.h
omadm/omadmextensions/adapters/lawmodmadapter/inc/nsmldmuri.h
omadm/omadmextensions/adapters/lawmodmadapter/src/lawmodmadapter.cpp
omadm/omadmextensions/adapters/lawmodmadapter/src/lawmodmadaptermain.cpp
omadm/omadmextensions/adapters/lawmodmadapter/src/nsmldmuri.cpp
omadm/omadmextensions/adapters/syncmldm12/src/NSmlDmSettingsAdapter12.cpp
pnpmobileservices/pnpms/OnlineSupport/aif/OnlineSupport_reg.rss
pnpmobileservices/pnpms/OnlineSupport/src/CCMAppUi.cpp
pnpmobileservices/pnpms/PnP/PnpProvisioningAppAif/PnpProvisioning_reg.rss
pnpmobileservices/pnpms/PnP/PnpProvisioningAppSrc/PnpProvisioningAppUi.cpp
pnpmobileservices/pnpms/PnP/PnpProvisioningAppSrc/PnpProvisioningDocument.cpp
pnpmobileservices/pnpms/PnP/PnpProvisioningAppSrc/PnpProvisioningSaver.cpp
pnpmobileservices/pnpms/PnP/PnpProvisioningAppSrc/PnpServiceActivation.cpp
pnpmobileservices/pnpms/ServiceHelpPlugin/src/ServiceHelpPlugin.cpp
pnpmobileservices/pnpms/install/compile_localization_resources.bat
Binary file applicationmanagement/conf/application_management.confml has changed
--- a/applicationmanagement/omascomoadapter/inc/omascomoadapter.h	Thu Jul 15 18:24:21 2010 +0300
+++ b/applicationmanagement/omascomoadapter/inc/omascomoadapter.h	Thu Aug 19 09:42:30 2010 +0300
@@ -181,6 +181,11 @@
     _LIT8( KNSmlDMSCOMOMetaType,"org.openmobilealliance.dm.softwarecomponent.OperationComplete" );
     _LIT8( KNSmlDMSCOMOMetaFormat, "text/plain" );
     
+    //OMA SCOMO Specific
+    _LIT8(KDownloadState, "./SCOMO/Download/");
+    _LIT8(KDeliveredState, "./SCOMO/Inventory/Delivered/");
+    _LIT8(KDeployedState, "./SCOMO/Inventory/Deployed/");
+    
     _LIT8(KDataStart, "<![CDATA[");
             _LIT8(KDataEnd, "]]>");
             _LIT8(KResultCodeStart, "<ResultCode>");
@@ -812,6 +817,9 @@
 	void SetAdapterValue(TInt aAdapterValue);
 	TBool RecognizeMimeType(const TDesC8& aMimeType);
 
+	void SetSCOMOTargetURIL(const TDesC8& aURI, const TDesC8& aMapping,const TError& aErrorStatus);
+	HBufC8* GetIdentifierIdL(const TUint32 aluid);
+
 private:
 
 #ifdef __TARM_SYMBIAN_CONVERGENCY
--- a/applicationmanagement/omascomoadapter/src/omascomoadapter.cpp	Thu Jul 15 18:24:21 2010 +0300
+++ b/applicationmanagement/omascomoadapter/src/omascomoadapter.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -922,8 +922,11 @@
             TBuf8<6> dataresult;
             dataresult.Num(finalresult);
             
-            TPtrC8 mapping(NSmlDmURI::LastURISeg(targetURIGet) );
+            RDEBUG8_2("CSCOMOAdapter::GetIdentifierIdL is targetURIGet '%S'", &targetURIGet);
             
+            //TPtrC8 mapping(NSmlDmURI::LastURISeg(targetURIGet) );
+            
+            HBufC8* identifier=GetIdentifierIdL(internalid );
             
             TInt retryupdate = iAMdb->GetRetryCountForLuidL(internalid);
             
@@ -962,7 +965,7 @@
             ptr.Append(dataresult);
             ptr.Append(KResultCodeEnd);
             ptr.Append(KIdentifierStart);
-            ptr.Append(mapping);
+            ptr.Append(*identifier);
             ptr.Append(KIdentifierEnd);
             //ptr.Append(KDataEnd);
 
@@ -992,18 +995,29 @@
             
             TRAP_IGNORE(privateAPI.AddDMGenericAlertRequestL(              
                     *genericalerts[i]->iCorrelator,iItemArray ));
-                    
-                    
+                 
+            
+            //cleanup all the allocated heap cells
+            if(data)        
             delete data;
             
+            if(metamark)
             delete metamark;
             
+            if(metaformat)
             delete metaformat;
             
+            if(metatype)
             delete metatype;
             
+            if(targeturi)
             delete targeturi;
+
+            if(item)
             delete item;
+            
+            if(identifier)
+            delete identifier;
                     
             iItemArray.Reset();			
 			iItemArray.Close();
@@ -1741,12 +1755,13 @@
         iManagement.StateChangeComplete(aLuidi);
 
         DeactivateIfInactive(aLuidi, aTargetState);
-        aRet = EOk;
+        aRet = EExecSuccess;
         }
     else
         {
         RDEBUG_2( "CSCOMOAdapter::InstallL(): INSTALL FAILED '%d'" , err);
-        MAPERROR( err, aRet, _L8("Install %d") );
+        //MAPERROR( err, aRet, _L8("Install %d") );
+	  aRet = EExecInstallFailed;
         }
     }
 
@@ -1840,7 +1855,7 @@
         const TDesC8& aArgument, const TDesC8& /*aType*/, TInt aStatusRef)
     {
 
-#ifdef __TARM_SYMBIAN_CONVERGENCY	//Done by Dipak
+#ifdef __TARM_SYMBIAN_CONVERGENCY	
     TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash(aURI);
 #else
     //nothing
@@ -1856,7 +1871,7 @@
         RDEBUG("CSCOMOAdapter::ExecuteCommandL(): WARNING no valid luid provided" );
         }
 
-#ifdef __TARM_SYMBIAN_CONVERGENCY	//Done by Dipak
+#ifdef __TARM_SYMBIAN_CONVERGENCY
     TInt cnt( NSmlDmURI::NumOfURISegs( uriPtrc ) );
 #else
     TInt cnt(NSmlDmURI::NumOfURISegs(aURI) );
@@ -1946,6 +1961,7 @@
                             ret = EExecUndefError;
                             }
                     }
+			SetSCOMOTargetURIL(*iUriDel, mapping, ret);
 
                 }
             else
@@ -2056,6 +2072,7 @@
                         ret = EExecRemoveFailed;
                         RDEBUG( "CSCOMOAdapter::ExecuteCommandL(): case 6 remove Not found node" );
                         }
+                    SetSCOMOTargetURIL(*iUriDel, mapping, ret);
                     }
                         else
                             if (mapping == KAMActivateNodeName)
@@ -2084,6 +2101,8 @@
                                     ret = EExecActivateFailed;
                                     RDEBUG( "CSCOMOAdapter::ExecuteCommandL(): case 6 Activate Not found node" );
                                     }
+
+                                SetSCOMOTargetURIL(*iUriDel, mapping, ret);
                                 }
                             else
                                 if (mapping == KAMDeActivateNodeName)
@@ -2115,6 +2134,9 @@
                                         ret = EExecDeactivateFailed;
                                         RDEBUG( "CSCOMOAdapter::ExecuteCommandL(): case 6 DeActivate Not found node" );
                                         }
+
+                                    SetSCOMOTargetURIL(*iUriDel, mapping, ret);
+						
                                     }
                                 else
                                     {
@@ -2136,6 +2158,111 @@
     SetStatusL(aStatusRef, ret) ;
     }
 
+
+void CSCOMOAdapter::SetSCOMOTargetURIL(const TDesC8& aURI,
+        const TDesC8& aMapping,const TError& aErrorStatus)
+    {
+
+    RDEBUG( "CSCOMOAdapter:: SetSCOMOTargetURI" );
+
+    TInt cnt(NSmlDmURI::NumOfURISegs(aURI));
+    _LIT8( KNSmlNull, "null" );
+
+    CRepository* cenrep = NULL;
+    TInt errr(KErrNone);
+
+    TRAP(errr, cenrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys ));
+
+    if (errr == KErrNone)
+        {
+
+        switch (cnt)
+            {
+            case 3:
+                {
+
+                RDEBUG( "CSCOMOAdapter:: SetSCOMOTargetURI case 3" );
+
+                TInt ASyncSupported = -1;
+
+                CRepository *repository = CRepository::NewLC(
+                        KCRUidPrivateApplicationManagementKeys);
+                repository->Get(KAsyncEnabled, ASyncSupported);
+                CleanupStack::PopAndDestroy();
+
+                //means accepted for processing set <Target><LOCURI> to NULL.
+                if (ASyncSupported)
+                    {
+                    RDEBUG( "CSCOMOAdapter:: ASyncSupported" );
+
+                    TInt err1 = cenrep->Set(KNSmlDMSCOMOTargetRef, KNSmlNull);
+
+                    RDEBUG_2( "CSCOMOAdapter:: ASyncSupported %d", err1 );
+
+                    }
+
+                }
+                break;
+
+            case 4:
+                {
+
+                RDEBUG( "CSCOMOAdapter:: SetSCOMOTargetURI case 4" );
+
+                if (aMapping == KAMRemoveNodeName)
+                    {
+
+                    if (aErrorStatus == EExecSuccess)
+                        {
+                        cenrep->Set(KNSmlDMSCOMOTargetRef, KNSmlNull);
+                        }
+                    }
+
+                if (aMapping == KAMActivateNodeName || aMapping
+                        == KAMDeActivateNodeName)
+                    {
+
+                    RDEBUG( "CSCOMOAdapter:: SetSCOMOTargetURI case KAMActivateNodeName or KAMDeActivateNodeName " );
+
+                    if (aErrorStatus == EExecSuccess)
+                        {
+                        RDEBUG( "CSCOMOAdapter:: EExecSuccess " );
+                        _LIT8( KAMInitial, "./" );
+                        _LIT8( KAMSeparator8, "/" );
+                        _LIT8( KAMStateValueNodeName, "State" );
+                        TBuf8<256> targetStateURI;
+                        targetStateURI.Append(KAMInitial);
+                        targetStateURI.Append(aURI);
+
+                        targetStateURI.Append(KAMSeparator8);
+                        targetStateURI.Append(KAMStateValueNodeName);
+
+                        cenrep->Set(KNSmlDMSCOMOTargetRef, targetStateURI);
+                        RDEBUG( "CSCOMOAdapter:: EExecSuccess End" );
+                        }
+                    else
+                        {
+                        cenrep->Set(KNSmlDMSCOMOTargetRef, KNSmlNull);
+                        }
+
+                    }
+
+                }
+
+                break;
+            }
+
+        }
+
+    if (cenrep)
+        {
+        delete cenrep;
+        cenrep = NULL;
+        }
+
+    }
+
+
 void CSCOMOAdapter::ASyncReportL(TUint32 aLuid, const TDesC8& aArgument,
         const TDownloadTarget aTarget,const TDesC8& aURI)
     {
@@ -4462,5 +4589,37 @@
         }
     return isSupportedMimeType;
     }
+
+HBufC8* CSCOMOAdapter::GetIdentifierIdL(const TUint32 aluid)
+    {
+    RDEBUG( "CSCOMOAdapter::GetIdentifierIdL: const TUint32 aluid, const TDesC8& aTargetUri" );
+    
+    _LIT8(KNull, "null");
+    TDeploymentComponent comp;
+    HBufC8 *id = NULL;
+    TInt err(SessionL().DeploymentComponent(aluid, comp) );
+    RDEBUG( "CSCOMOAdapter::GetIdentifierIdL: Step 1" );
+    
+    if(err == KErrNone)
+        {
+            RDEBUG( "CSCOMOAdapter::GetIdentifierIdL: Step 1.1" );
+            if(comp.iState == EDCSDelivered || comp.iState ==EDCSDownload)    
+                {
+                RDEBUG( "CSCOMOAdapter::GetIdentifierIdL: iState EDCSActive,EDCSInactive" );  
+                id = (comp.iPkgID).AllocL();
+                }
+            else if(comp.iState==EDCSActive || comp.iState ==EDCSInactive)
+                {
+                RDEBUG( "CSCOMOAdapter::GetIdentifierIdL: iState EDCSDelivered,EDCSDownload" ); 
+                id = (comp.iId).AllocL();
+                }
+            else
+                {
+                id = KNull().AllocL();
+                }
+        }
+    RDEBUG( "CSCOMOAdapter::GetIdentifierIdL: Step 1 end" );
+    return id;
+    }
 // End of File
 
--- a/applicationmanagement/server/src/ApplicationManagementServer.cpp	Thu Jul 15 18:24:21 2010 +0300
+++ b/applicationmanagement/server/src/ApplicationManagementServer.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -421,7 +421,7 @@
         // Is session count is not modified whenever there is error then at the end of download complete decrement
         //  the session count.
         
-        if(status != KStatusSuccess && iSessionCount != 0 )
+        if(iSessionCount != 0 )
             {
             iSessionCount--; 
             }
@@ -2825,7 +2825,7 @@
     CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
     Server().Storage()->DeactivateL(compo);
     
-    SetSCOMOTargetURI(compo.UserId());
+   
     }
 
 // -------------------------------------------------------------------------------------------------------------------
@@ -2843,7 +2843,7 @@
     CDeploymentComponent &compo = Server().Storage()->ComponentL(id);
     Server().Storage()->ActivateL(compo);
     
-    SetSCOMOTargetURI(compo.UserId());
+    
     }
 
 // -------------------------------------------------------------------------------------------------------------------
@@ -2863,35 +2863,7 @@
     aMessage.Write( 1, compo.UserId() );
     }
 
-void CApplicationManagementSession::SetSCOMOTargetURI(const TDesC8& aURI) const
-    {
-    _LIT8( KAMSeparator8, "/" );
-    _LIT8( KAMStateValueNodeName, "State" );
-    TBuf8<256> targetStateURI(KDeployedState);
-    
-    targetStateURI.Append(aURI);
-    
-    targetStateURI.Append(KAMSeparator8);
-    targetStateURI.Append(KAMStateValueNodeName);
-            
-    CRepository* cenrep = NULL;
-    TInt errr(KErrNone);
-
-    TRAP(errr, cenrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys ));
-
-    if(errr == KErrNone)
-    {
-    errr = cenrep->Set(KNSmlDMSCOMOTargetRef, targetStateURI);
-    }
-    
-    if(cenrep)
-        {
-        delete cenrep;
-        cenrep = NULL;
-        }
-    
-   
-    }
+
 
 // -------------------------------------------------------------------------------------------------------------------
 // CApplicationManagementSession::GetTemporaryInstFileL()
@@ -3746,47 +3718,6 @@
         const RMessage2& aMessage) const
     {
     RDEBUG( "CApplicationManagementSession: StateChangeComponentIdsCountL" );
-               RPointerArray<TPreInstalledAppParams> preInstalledAppParams;
-                CAMPreInstallApp* preInstallApp = CAMPreInstallApp::NewL();
-                preInstallApp->GetPreInstalledAppsL(preInstalledAppParams);
-                TInt count = 0;
-                for (count = 0; count< preInstalledAppParams.Count(); count++)
-                    {
-                    RDEBUG8_2("CApplicationManagementSession::DownloadL: Installed App Name is: %S",&(preInstalledAppParams[count]->iPreInstalledAppame));
-                    RDEBUG8_2("CApplicationManagementSession::DownloadL: Installed App Vendor is: %S",&(preInstalledAppParams[count]->iPreInstalledAppVendorName));
-                    RDEBUG_2("CApplicationManagementSession::DownloadL: Installed App UID is : '0x%X'",preInstalledAppParams[count]->iPreInstalledAppUid);
-
-                    TBool found = EFalse;
-                    const RComponentIdArray &arrt = Server().Storage()->GetComponentIds();
-                    TInt countval(arrt.Count() );
-                    for (TInt i( 0); i < countval; i++)
-                        {
-                        CDeploymentComponent &compo = Server().Storage()->ComponentL(arrt[i]);
-                        if (compo.Uid()== preInstalledAppParams[count]->iPreInstalledAppUid)
-                            {
-                            RDEBUG( "CApplicationManagementSession: ActiveComponentsL found= TRUE" );
-                            found = ETrue;
-                            }
-                        }
-                    if (!found)
-                        {
-                        RDEBUG( "CApplicationManagementSession: Adding Pre-installed app" );
-                        TDCUserId preInstalledAppName;
-                        preInstalledAppName.Copy(preInstalledAppParams[count]->iPreInstalledAppame);
-                        CDeploymentComponent *preInstallCompo= NULL;
-                        RDEBUG8_2("CApplicationManagementSession: Installed App Name is: %S",&preInstalledAppName);
-                        preInstallCompo = Server().Storage()->NewComponentL(EDCSActive, preInstalledAppName);
-                        preInstallCompo->SetUid(preInstalledAppParams[count]->iPreInstalledAppUid);
-                        preInstallCompo->SetNameL(preInstalledAppName);
-                        preInstallCompo->SetVersionL(preInstalledAppParams[count]->iVersion);
-                        preInstallCompo->SetMimeTypeL(preInstalledAppParams[count]->iMimeType);
-				preInstallCompo->SetAppRemovableStatus(ETrue);
-
-                        Server().Storage()->UpdateL( *preInstallCompo );
-                        Server().Storage()->CheckForDuplicateNodesInDeployedL(*preInstallCompo);
-                        }
-                    }
-                delete preInstallApp;
     RComponentIdArray arr;
     Server().Storage()->GetStateChangeComponentIdsL(arr);
     TPckgBuf<TInt> buflen(arr.Count() );
--- a/customization/UISettingsSrv/server/Src/UISettingsSrvUi.cpp	Thu Jul 15 18:24:21 2010 +0300
+++ b/customization/UISettingsSrv/server/Src/UISettingsSrvUi.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -60,7 +60,7 @@
 #include    "UISettingsSrvAppView.h"
 #include    "UISettingsSrvDocument.h"
 
-#include    <UISettingsSrv.rsg>
+#include    <uisettingssrv.rsg>
 #include    "UISettingsSrv.hrh"
 
 #include    "UISettingsSrv.h"
--- a/customization/UISettingsSrv/server/aif/UISettingsSrv_reg.rss	Thu Jul 15 18:24:21 2010 +0300
+++ b/customization/UISettingsSrv/server/aif/UISettingsSrv_reg.rss	Thu Aug 19 09:42:30 2010 +0300
@@ -17,7 +17,7 @@
 
 
 #include <appinfo.rh>
-#include <UISettingsSrv.rsg>
+#include <uisettingssrv.rsg>
 #include <data_caging_paths_strings.hrh>
 
 UID2 KUidAppRegistrationResourceFile
--- a/omadm/group/bld.inf	Thu Jul 15 18:24:21 2010 +0300
+++ b/omadm/group/bld.inf	Thu Aug 19 09:42:30 2010 +0300
@@ -19,3 +19,4 @@
 #include "../omadmappui/group/bld.inf"
 #include "../omadmextensions/group/bld.inf"
 #include "../dcmo/group/bld.inf"
+#include "../lawmo/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/group/bld.inf	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This file provides building information for LAWMO plugins.
+*
+*/
+#include <platform_paths.hrh>
+
+PRJ_EXPORTS
+../rom/lawmo.iby			CORE_APP_LAYER_IBY_EXPORT_PATH(lawmo.iby)
+
+PRJ_MMPFILES
+#include "../lawmoplugins/group/bld.inf"
+
+//PRJ_TESTMMPFILES
+//#include "../tsrc/group/bld.inf"
+
+PRJ_MMPFILES
+//../tsrc/group/testlawmoplugins.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/inc/fdebug.h	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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:  wipe plugins debug file for LAWMO component
+*
+*/
+
+//#define _DEBUG
+
+#ifndef _LAWMO_DEBUG_H_
+#define _LAWMO_DEBUG_H_
+
+        #include <e32std.h>
+        #include <f32file.h>
+        #include <flogger.h>
+        #include <e32svr.h>
+
+        _LIT( KLogFile, "pluginslogs.log" );
+        _LIT( KLogDirFullName, "c:\\logs\\" );
+        _LIT( KLogDir, "lawmo" );
+ 
+#ifdef _DEBUG
+        inline void FWrite (TRefByValue<const TDesC> aFmt,...)
+            {
+            VA_LIST list;
+            VA_START( list, aFmt );
+            RFileLogger::WriteFormat( KLogDir,KLogFile,EFileLoggingModeAppend ,TPtrC(aFmt) ,list );
+            }
+
+            #ifndef __GNUC__          
+                #define FLOG            FWrite
+                #define FLOG8(x,y)            RFileLogger::WriteFormat( KLogDir,KLogFile,EFileLoggingModeAppend ,_L8(x) ,y );
+            #else   // __GNUC__       
+                #define FLOG(arg...)    FWrite(arg);
+                #define FLOG8(arg...)    RFileLogger::WriteFormat( KLogDir,KLogFile,EFileLoggingModeAppend ,_L8(aFmt) ,list );
+            #endif // __GNUC__        
+
+#else
+     #define FLOG            
+     #define FLOG8(x,y)  
+#endif /* __LAWMO_PLUGINS_ */
+#endif /*_LAWMO_DEBUG_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/calllogsplugin/data/calllogsplugin.rss	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* 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:  Resource file for calllogsplugin of LAWMO Interface Implementation.
+*
+*/
+
+#include "registryinfo.rh"
+
+// Declares info for two implementations
+RESOURCE REGISTRY_INFO theInfo
+	{
+	// UID for the DLL
+	dll_uid = 0x2002EACA;
+	// Declare array of interface info
+	interfaces = 
+		{
+		INTERFACE_INFO
+			{
+			// UID of interface that is implemented
+			interface_uid = 0x2002EA1F;
+			implementations = 
+				{
+				// Info for LAWMO Calllogs Plugin
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0x2002EACB;
+					version_no = 1;
+					display_name = "CallLogs";
+					default_data = "text/wml";
+					opaque_data = "CallLogs";
+					}
+				};
+			}
+		};
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/calllogsplugin/group/bld.inf	Thu Aug 19 09:42:30 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:  This file provides building information for Wiping Messagingplugin.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_EXPORTS
+//../Rom/lawmocalllogsplugin.iby										CORE_APP_LAYER_IBY_EXPORT_PATH(lawmocalllogsplugin.iby)
+
+PRJ_MMPFILES
+calllogsplugin.mmp
+
+
+// End Of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/calllogsplugin/group/calllogsplugin.mmp	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Call-logs plug-in for LAWMO.
+*
+*/
+#ifndef __CALLLOGSPLUGIN_M_
+#define __CALLLOGSPLUGIN_M_
+#include <platform_paths.hrh>
+ 
+TARGET lawmocalllogsplugin.dll
+TARGETTYPE PLUGIN
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID 0x10009D8D 0x2002EACA
+VENDORID VID_DEFAULT
+CAPABILITY  CAP_ECOM_PLUGIN
+
+USERINCLUDE 			../inc 
+USERINCLUDE 			../../../inc 
+APP_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE 		/epoc32/include/ecom
+
+SOURCEPATH				../src
+SOURCE		calllogsplugin.cpp
+SOURCE		lawmocalllogsasyncwipe.cpp calllogspluginproxy.cpp
+SOURCEPATH				../data
+start resource calllogsplugin.rss
+TARGET lawmocalllogsplugin.rsc
+LANGUAGE_IDS
+end
+
+LIBRARY 		euser.lib ecom.lib efsrv.lib
+
+LIBRARY		logcli.lib 	// CallLogs client.
+
+LIBRARY		ws32.lib // Closing Apps
+LIBRARY		apgrfx.lib // TApaTaskList
+
+//DEBUGLIBRARY flogger.lib
+LIBRARY flogger.lib
+
+#endif //__CALLLOGSPLUGIN_M_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/calllogsplugin/inc/calllogsplugin.h	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Callogs plug-in for LAWMO
+*
+*/
+
+#ifndef _CALLLOGSPLUGIN__
+#define _CALLLOGSPLUGIN__
+
+#include <e32base.h>	// For CActive, link against: euser.lib
+#include <e32std.h>		// For RTimer, link against: euser.lib
+
+#include <f32file.h>
+#include <flogger.h>
+#include <lawmointerface.h>
+#include <lawmocallbackinterface.h>
+#include "lawmocalllogsasyncwipe.h"
+
+class CLAWMOCallLogsPlugin: public CLAWMOPluginInterface
+    {
+public:
+    // Standardised safe construction which leaves nothing the cleanup stack.
+    static CLAWMOCallLogsPlugin* NewL(MLawmoPluginWipeObserver* aObserver);
+    // Destructor   
+    ~CLAWMOCallLogsPlugin();
+    
+    /*
+    * Description: Calls Aynchronous object for wiping call-logs.
+    */
+    void WipeL ();    
+private:
+    // Construction
+    CLAWMOCallLogsPlugin();
+
+    /**
+     * second phase constructor
+     */
+    void ConstructL(MLawmoPluginWipeObserver* aObserver); 
+private:
+    CActiveWipeObject *iAsyncOp;
+    };
+
+#endif // _CALLLOGSPLUGIN__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/calllogsplugin/inc/lawmocalllogsasyncwipe.h	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,99 @@
+/*
+* 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:  Active object for wiping CallLogs, called by lawmocalllogsplugin.
+*
+*/
+
+#ifndef LAWMOCALLLOGSAYNCWIPE_H 
+#define LAWMOCALLLOGSAYNCWIPE_H
+
+#include <e32base.h>
+#include <f32file.h>
+#include <lawmocallbackinterface.h>
+#include <logcli.h>
+#include <w32std.h>
+#include "fdebug.h"
+
+
+// Time Max constant
+_LIT( KMaxTime, "99991130:235959.999999");
+// Call Logs App UId
+#define KCallLogsAppUid   0x101F4CD5
+
+class CActiveWipeObject : public CActive
+{
+public:
+     static CActiveWipeObject* NewL(MLawmoPluginWipeObserver* aObserver);
+
+     ~CActiveWipeObject();
+     /*
+      * Name: WipeAsyncL
+      * Input args: None
+      * Output args: None
+      * Description: Wipes the call-logs - including master logs.
+      */
+     void WipeAsyncL();
+     
+private: // Derived from CActive
+     // Handle completion
+     void RunL();
+
+     // How to cancel me
+     void DoCancel();
+
+     // Override to handle leaves from RunL(). Default implementation causes
+     // the active scheduler to panic.
+     TInt RunError(TInt aError);
+     
+private: //Private functions for this class
+
+     /**
+      * second phase constructor
+      */
+     void ConstructL();
+     
+     // Construction
+     CActiveWipeObject(MLawmoPluginWipeObserver* aObserver);
+     
+     // Wait Till Call-Logs Application EndTask();
+     TBool WaitTillLogsAppKilled();
+     
+     // Clears the logs
+     void ClearLogsL();
+
+private: //Private member variables
+	
+		// State of the active object
+	   TInt iState; 
+	   
+     // Observer member for the callback. Not owned
+     MLawmoPluginWipeObserver* iObserver;
+     
+     // Call-log client member
+     CLogClient* ilogClient;
+     
+     // RFs for Call-logs     
+     RFs ifs;
+     
+     // Timer
+     RTimer iTimer;
+     
+     //The windows server session
+     RWsSession iWsSession;
+     
+     //Tells whether timer is started or not
+     TBool iTimerStarted;
+} ;
+
+#endif //LAWMOCALLLOGSAYNCWIPE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/calllogsplugin/src/calllogsplugin.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* 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: Call logs plug-in for LAWMO
+*
+*/
+
+#include <e32base.h>
+#include "lawmocalllogsasyncwipe.h"
+#include "calllogsplugin.h"
+#include "fdebug.h"
+
+// Construction and destruction functions
+
+// ----------------------------------------------------------------------------------------
+// CLAWMOCallLogsPlugin::NewL
+// ----------------------------------------------------------------------------------------
+CLAWMOCallLogsPlugin* CLAWMOCallLogsPlugin::NewL(MLawmoPluginWipeObserver* aObserver)
+	{
+        FLOG(_L( "CLAWMOCallLogsPlugin::NewL(MLawmoPluginWipeObserver* aObserver) >>"));
+        CLAWMOCallLogsPlugin* self = new(ELeave) CLAWMOCallLogsPlugin();  
+		CleanupStack::PushL(self);
+		self->ConstructL(aObserver); 
+		CleanupStack::Pop();
+        FLOG(_L( "CLAWMOCallLogsPlugin::NewL(MLawmoPluginWipeObserver* aObserver) <<"));
+		return self;
+	}
+
+// ----------------------------------------------------------------------------------------
+// CLAWMOCallLogsPlugin::~CLAWMOCallLogsPlugin
+// ----------------------------------------------------------------------------------------
+CLAWMOCallLogsPlugin::~CLAWMOCallLogsPlugin()
+	{
+        FLOG(_L( "CLAWMOCallLogsPlugin::~CLAWMOCallLogsPlugin() >>"));
+        if(iAsyncOp)
+        	delete iAsyncOp;
+        FLOG(_L( "CLAWMOCallLogsPlugin::~CLAWMOCallLogsPlugin() <<"));
+	}
+
+// ----------------------------------------------------------------------------------------
+// CLAWMOCallLogsPlugin::CLAWMOCallLogsPlugin
+// ----------------------------------------------------------------------------------------
+CLAWMOCallLogsPlugin::CLAWMOCallLogsPlugin() 
+	{
+        FLOG(_L( "CLAWMOCallLogsPlugin  >>"));
+        // See ConstructL() for initialisation completion.
+        FLOG(_L( "CLAWMOCallLogsPlugin <<"));
+	}
+
+// ----------------------------------------------------------------------------------------
+// CLAWMOCallLogsPlugin::ConstructL
+// ----------------------------------------------------------------------------------------
+void CLAWMOCallLogsPlugin::ConstructL(MLawmoPluginWipeObserver* aObserver)
+    {
+        FLOG(_L( "CLAWMOCallLogsPlugin ConstructL >>"));
+        iAsyncOp = CActiveWipeObject::NewL(aObserver);
+        FLOG(_L( "CLAWMOCallLogsPlugin ConstructL <<"));	
+    }
+
+// Implementation of CLAWMOPluginInterface
+
+// ----------------------------------------------------------------------------------------
+// CLAWMOCallLogsPlugin::WipeL
+// Wipes the Contacts.
+// ----------------------------------------------------------------------------------------
+
+void CLAWMOCallLogsPlugin::WipeL ()
+    {
+        FLOG(_L(" void CLAWMOCallLogsPlugin::WipeL (TInt aCategory) >>"));
+        //FLOG(_L("Calling async wipe"))
+        iAsyncOp->WipeAsyncL();    
+        FLOG(_L(" void CLAWMOCallLogsPlugin::WipeL (TInt aCategory) <<"));
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/calllogsplugin/src/calllogspluginproxy.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* 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:  CallLogs plug-in for LAWMO
+*
+*/
+
+#include <e32std.h>
+#include <implementationproxy.h>
+
+#include "calllogsplugin.h"
+
+
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy ImplementationTable[] = 
+    {
+        IMPLEMENTATION_PROXY_ENTRY(0x2002EACB,  CLAWMOCallLogsPlugin::NewL),
+    };
+
+// Exported proxy for instantiation method resolution
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+    {
+    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+
+    return ImplementationTable;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/calllogsplugin/src/lawmocalllogsasyncwipe.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,236 @@
+/*
+* 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: Active Object for wiping Call-logs, called by lawmocalllogsplugin.
+*
+*/
+#include <logcli.h>
+#include <f32file.h>
+#include <logwrap.h>
+#include <logview.h>
+#include <e32base.h>
+#include <logwraplimits.h>
+#include <logwrapconst.h>
+#include "lawmocalllogsasyncwipe.h"
+#include "fdebug.h"
+
+// Application Closing
+#include <apgtask.h>
+#include <w32std.h>
+#include <APGTASK.H>
+
+// ----------------------------------------------------------------------------- 
+// CActiveWipeObject::CActiveWipeObject
+// Description: CActiveWipeObject constructer . Initializes datamember of MLawmoPluginWipeObserver 
+// ----------------------------------------------------------------------------- 
+//
+CActiveWipeObject::CActiveWipeObject(MLawmoPluginWipeObserver* aObserver) :
+    CActive(EPriorityStandard), iObserver(aObserver), ilogClient(NULL), iTimerStarted (EFalse)
+    {
+    FLOG(
+            _L( " CAllLogs: CActiveWipeObject::CActiveWipeObject(MLawmoPluginWipeObserver* aObserver) >> "));
+    // See ConstructL() for initialisation completion.
+    FLOG(
+            _L( " CAllLogs: CActiveWipeObject::CActiveWipeObject(MLawmoPluginWipeObserver* aObserver) << "));
+    }
+
+// ----------------------------------------------------------------------------- 
+// CActiveWipeObject::NewL
+// Description: CActiveWipeObject constructer 
+// ----------------------------------------------------------------------------- 
+//
+CActiveWipeObject* CActiveWipeObject::NewL(
+        MLawmoPluginWipeObserver* aObserver)
+    {
+    FLOG(_L( " CAllLogs: CActiveWipeObject::NewL >> "));
+    CActiveWipeObject* self = new (ELeave) CActiveWipeObject(aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    FLOG(_L( " CAllLogs: CActiveWipeObject::NewL << "));
+    return self;
+    }
+
+// ----------------------------------------------------------------------------------------
+// CActiveWipeObject::ConstructL
+// ----------------------------------------------------------------------------------------
+void CActiveWipeObject::ConstructL()
+    {
+    FLOG(_L( " CAllLogs: CActiveWipeObject::ConstructL >> "));
+    iTimer.CreateLocal();
+    User::LeaveIfError(iWsSession.Connect());
+    CActiveScheduler::Add(this); // Add to scheduler    
+    FLOG(_L( " CAllLogs: CActiveWipeObject::ConstructL << "));
+    }
+
+//
+//----------------------------------------------------------------------------- 
+// CActiveWipeObject:: CActiveWipeObject
+// Description: CActiveWipeObject Destructer
+// ----------------------------------------------------------------------------- 
+// 
+CActiveWipeObject::~CActiveWipeObject()
+    {
+    FLOG(_L( " CAllLogs: CActiveWipeObject::~CActiveWipeObject() >> "));
+    Cancel();
+    if (ilogClient)
+    	{
+        delete ilogClient;
+      }
+      
+    if (ifs.Handle())
+      	{
+      		ifs.Close();
+      	}
+
+    iTimer.Close();
+    
+    iWsSession.Close();
+        
+    FLOG(_L( " CAllLogs: CActiveWipeObject::~CActiveWipeObject() << "));
+    }
+
+//
+//----------------------------------------------------------------------------- 
+// CActiveWipeObject::WipeAsyncL
+// Description: Wipes the logs 
+// ---------------------------------------------------------------------------- 
+//
+
+void CActiveWipeObject::WipeAsyncL()
+    {
+    FLOG(_L(" CAllLogs: void CActiveWipeObject::WipeAsyncL () >>"));
+    if (!WaitTillLogsAppKilled()) //Application is closed already
+        {
+        ClearLogsL();
+        }
+
+    FLOG(_L(" CAllLogs: void CActiveWipeObject::WipeAsyncL () <<"));
+    }
+
+//
+//----------------------------------------------------------------------------- 
+// CActiveWipeObject::RunError
+// Description: This returns error 
+//----------------------------------------------------------------------------- 
+//
+
+TInt CActiveWipeObject::RunError(TInt aError)
+    {
+    FLOG(_L(" CAllLogs: TInt CActiveWipeObject::RunError(TInt aError) >>"));
+    FLOG(_L(" CAllLogs: RunError error %d"), aError);
+    iObserver->HandleWipeCompleted(aError);
+    FLOG(_L(" CAllLogs: TInt CActiveWipeObject::RunError(TInt aError) <<"));
+    return KErrNone;
+    }
+
+//
+//----------------------------------------------------------------------------- 
+// CActiveWipeObject::DoCancel
+// Description: This calls CActive's Cancel 
+//----------------------------------------------------------------------------- 
+//
+void CActiveWipeObject::DoCancel()
+    {
+    FLOG(_L(" CAllLogs: void CActiveWipeObject::DoCancel() >>"));
+    if (iTimerStarted)
+    	{
+    		iTimer.Cancel();
+    	}
+    else
+    	{
+    	ilogClient->Cancel();
+      }
+    FLOG(_L(" CAllLogs: void CActiveWipeObject::DoCancel() <<"));
+    }
+
+TBool CActiveWipeObject::WaitTillLogsAppKilled()
+    {
+    FLOG(_L(" WaitTillLogsAppKilled() >>"));
+
+    TBool ret(EFalse);
+    TBool flag(ETrue);
+
+    TApaTaskList list(iWsSession);
+    TUid uid =
+        {
+        KCallLogsAppUid
+        };
+
+    while (flag)
+        {
+        TApaTask task(list.FindApp(uid));
+        if (task.Exists())
+            {
+            FLOG(_L("Killing one instance..."));
+            task.EndTask();
+            User::After(500000);
+            ret = ETrue;
+            }
+        else
+            {
+            flag = EFalse;
+            }
+        }
+    if (ret)
+        {
+        FLOG(_L(" WaitTillPhonebookKilled: iTimer.After(iStatus,1000); "));
+        iTimerStarted = ETrue; // If time is started, this is true
+        iTimer.After(iStatus, 2000); // 0.002 sec
+        SetActive();
+        }
+
+    FLOG(_L(" WaitTillLogsAppKilled(), ret = %d <<"), ret);
+    return ret;
+    }
+
+
+//
+//----------------------------------------------------------------------------- 
+// CActiveWipeObject::RunL 
+// Description: Clears the logs
+//----------------------------------------------------------------------------- 
+//
+void CActiveWipeObject::ClearLogsL()
+    {
+    FLOG(_L("void CActiveWipeObject::ClearLogs() >> "));
+    TTime time(KMaxTime);
+    User::LeaveIfError(ifs.Connect());
+    ilogClient = CLogClient::NewL(ifs);
+    FLOG(_L("iStatus.Int() = %d "), iStatus.Int());
+    ilogClient->ClearLog(time, iStatus);
+    SetActive();
+
+    FLOG(_L("void CActiveWipeObject::ClearLogs() << "));
+    }
+
+//
+//----------------------------------------------------------------------------- 
+// CActiveWipeObject::RunL 
+// Description: Called when either timer expires of logs are cleared
+//----------------------------------------------------------------------------- 
+//
+void CActiveWipeObject::RunL()
+    {
+    FLOG(_L(" CAllLogs: void CActiveWipeObject::RunL() >>"));
+    FLOG(_L("void CActiveWipeObject::RunL(): iStatus= %d "), iStatus.Int());
+
+    if (iTimerStarted)
+        {
+        iTimerStarted = EFalse;
+        ClearLogsL();
+        }
+    else
+        iObserver->HandleWipeCompleted(iStatus.Int());
+    FLOG(_L(" CAllLogs: void CActiveWipeObject::RunL() <<"));
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/contactsplugin/data/contactsplugin.rss	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* 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: Resource file for contactsplugin of LAWMO Interface Implementation.
+*
+*/
+
+#include "registryinfo.rh"
+
+// Declares info for two implementations
+RESOURCE REGISTRY_INFO theInfo
+	{
+	// UID for the DLL
+	dll_uid = 0x2002EA24;
+	// Declare array of interface info
+	interfaces = 
+		{
+		INTERFACE_INFO
+			{
+			// UID of interface that is implemented
+			interface_uid = 0x2002EA1F;
+			implementations = 
+				{
+				// Info for LAWMO Contacts Plugin
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0x2002EA25;
+					version_no = 1;
+					display_name = "Contacts";
+					default_data = "text/wml";
+					opaque_data = "Contacts";
+					}
+				};
+			}
+		};
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/contactsplugin/group/bld.inf	Thu Aug 19 09:42:30 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: This file provides building information for Wiping Contactsplugin.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_EXPORTS
+//../Rom/lawmocontactsplugin.iby									CORE_APP_LAYER_IBY_EXPORT_PATH(lawmocontactsplugin.iby)
+
+PRJ_MMPFILES
+contactsplugin.mmp
+
+
+// End Of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/contactsplugin/group/contactsplugin.mmp	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Contacts plug-in mmp for LAWMO.
+*
+*/ 
+#include <platform_paths.hrh>
+
+TARGET lawmocontactsplugin.dll
+TARGETTYPE PLUGIN
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID 0x10009D8D 0x2002EA24
+VENDORID VID_DEFAULT
+CAPABILITY  CAP_ECOM_PLUGIN
+
+SOURCEPATH				../src
+SOURCE					contactsplugin.cpp
+SOURCE					contactspluginproxy.cpp
+SOURCE 					lawmocontactsasyncwipe.cpp
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE 		/epoc32/include/ecom
+
+USERINCLUDE 			../inc 
+USERINCLUDE 			../../../inc 
+
+SOURCEPATH				../data
+start resource contactsplugin.rss
+TARGET lawmocontactsplugin.rsc
+LANGUAGE_IDS
+end
+
+LIBRARY 	  euser.lib 
+LIBRARY			ecom.lib 
+LIBRARY			efsrv.lib
+
+// PbkEng.lib
+LIBRARY   PbkView.lib 
+LIBRARY		pbkeng.lib
+LIBRARY		cntmodel.lib 
+
+LIBRARY		ws32.lib // Closing Apps
+LIBRARY		apgrfx.lib // TApaTaskList
+
+LIBRARY   vpbkeng.lib
+LIBRARY   vpbksimstoreservice.lib
+LIBRARY		etel.lib	
+LIBRARY		etelmm.lib
+//DEBUGLIBRARY flogger.lib
+LIBRARY flogger.lib
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/contactsplugin/inc/contactsplugin.h	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Contacts plug-in for LAWMO
+*
+*/
+
+#ifndef _CONTACTPLUGIN__
+#define _CONTACTPLUGIN__
+
+//#include "lawmoplugininterface.h"
+#include <lawmointerface.h>
+#include <lawmocallbackinterface.h>
+#include "lawmocontactsasyncwipe.h"
+
+// An implementation of the CLAWMOPluginInterface definition
+class CLAWMOContactsPlugin : public CLAWMOPluginInterface
+	{
+public:
+	// Standardised safe construction which leaves nothing the cleanup stack.
+	static CLAWMOContactsPlugin* NewL(MLawmoPluginWipeObserver* aObserver);
+	// Destructor	
+	~CLAWMOContactsPlugin();
+	
+	/**
+	 * Wipe the contacts
+	 * @param None
+	 * @return None
+	 */
+	void WipeL ();
+	
+private:
+	// Construction
+	CLAWMOContactsPlugin();
+	
+	/**
+	 * second phase constructor
+	 */
+	void ConstructL(MLawmoPluginWipeObserver* aObserver);
+
+private:	
+    CActiveWipeObject *asyncOp;
+	};  
+
+#endif // _CONTACTPLUGIN__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/contactsplugin/inc/lawmocontactsasyncwipe.h	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* 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:  Active Object for wiping Contacts, will be called by lawmocontactsplugin.
+*
+*/
+
+#ifndef ACTIVEWIPEOBJECT_H 
+#define ACTIVEWIPEOBJECT_H
+
+#include <e32base.h>
+#include <f32file.h>
+#include <lawmocallbackinterface.h>
+
+#include <CPbkContactEngine.h>
+#include <CPbkSingleEntryFetchDlg.h>
+#include <rpbkviewresourcefile.h>
+#include <cntdb.h>
+#include "fdebug.h"
+ 
+#include <w32std.h>
+
+
+class CActiveWipeObject : public CActive
+{
+public:
+     static CActiveWipeObject* NewL(MLawmoPluginWipeObserver* aObserver);
+
+     ~CActiveWipeObject();
+     void WipeAsyncL();
+private: //Derived from CActive
+     // Handle completion
+     void RunL();
+
+     // How to cancel me
+     void DoCancel();
+
+     // Override to handle leaves from RunL(). Default implementation causes
+     // the active scheduler to panic.
+     TInt RunError(TInt aError);
+
+private: //All private functions of this class     
+     // Deletes the Phone book contacts
+     void DeletePhoneContactsL();
+     // Deletes all the SIM contacts
+     void DeleteSIMContactsL();
+     // Wait Till PhoneBook Application EndTask();
+     TBool WaitTillPhoneBookKilled();     
+     
+     /**
+      * second phase constructor
+      */
+     void ConstructL();
+     
+     // Construction
+     CActiveWipeObject(MLawmoPluginWipeObserver* aObserver);
+    
+private: //All private members of this class
+	    	
+     MLawmoPluginWipeObserver* iObserver; //Not owned
+     CContactDatabase* iContactsDb;
+     const CContactIdArray* iContacts;
+     RTimer iTimer;
+     RWsSession iWsSession;
+} ;
+
+#endif //ACTIVEWIPEOBJECT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/contactsplugin/src/contactsplugin.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* 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: Contacts plug-in for LAWMO.
+*
+*/ 
+
+#include <f32file.h>
+#include <data_caging_path_literals.hrh>
+#include <centralrepository.h>
+#include "contactsplugin.h"
+#include "fdebug.h"
+#include "lawmocontactsasyncwipe.h"
+// Construction and destruction functions
+
+// ----------------------------------------------------------------------------------------
+// CLAWMOContactsPlugin::NewL
+// ----------------------------------------------------------------------------------------
+CLAWMOContactsPlugin* CLAWMOContactsPlugin::NewL(MLawmoPluginWipeObserver* aObserver)
+	{
+        FLOG(_L(" CLAWMOContactsPlugin* CLAWMOContactsPlugin::NewL(MLawmoPluginWipeObserver* aObserver) >>"));
+ 
+        CLAWMOContactsPlugin* self=new(ELeave) CLAWMOContactsPlugin();  
+		CleanupStack::PushL(self);
+		self->ConstructL(aObserver); 
+		CleanupStack::Pop();
+	    FLOG(_L(" CLAWMOContactsPlugin* CLAWMOContactsPlugin::NewL(MLawmoPluginWipeObserver* aObserver) <<"));	 
+		return self;
+	}
+
+// ----------------------------------------------------------------------------------------
+// CLAWMOContactsPlugin::~CLAWMOContactsPlugin
+// ----------------------------------------------------------------------------------------
+CLAWMOContactsPlugin::~CLAWMOContactsPlugin()
+	{
+        FLOG(_L(" CLAWMOContactsPlugin::~CLAWMOContactsPlugin() >>"));
+        if(asyncOp)
+        {
+            FLOG(_L("  delete asyncOp; "));
+            delete asyncOp;
+        }
+        FLOG(_L(" CLAWMOContactsPlugin::~CLAWMOContactsPlugin() <<"));
+	}
+
+// ----------------------------------------------------------------------------------------
+// CLAWMOContactsPlugin::CLAWMOContactsPlugin
+// ----------------------------------------------------------------------------------------
+CLAWMOContactsPlugin::CLAWMOContactsPlugin() 
+	{
+        FLOG(_L(" CLAWMOContactsPlugin::CLAWMOContactsPlugin() >>"));
+        // See ConstructL() for initialisation completion.
+        FLOG(_L(" CLAWMOContactsPlugin::CLAWMOContactsPlugin() <<"));
+	}
+
+// ----------------------------------------------------------------------------------------
+// CLAWMOContactsPlugin::ConstructL
+// ----------------------------------------------------------------------------------------
+void CLAWMOContactsPlugin::ConstructL(MLawmoPluginWipeObserver* aObserver)
+{	
+    FLOG(_L(" void CLAWMOContactsPlugin::ConstructL(MLawmoPluginWipeObserver* aObserver) >>"));
+    FLOG(_L("  asyncOp = CActiveWipeObject::NewL(aObserver);"));
+    asyncOp = CActiveWipeObject::NewL(aObserver);
+    FLOG(_L(" void CLAWMOContactsPlugin::ConstructL(MLawmoPluginWipeObserver* aObserver) <<"));
+}
+
+// Implementation of CLAWMOPluginInterface
+
+// ----------------------------------------------------------------------------------------
+// CLAWMOContactsPlugin::WipeL
+// Wipes the Contacts.
+// ----------------------------------------------------------------------------------------
+
+void CLAWMOContactsPlugin::WipeL ()
+{
+    FLOG(_L(" void CLAWMOContactsPlugin::WipeL () >>"));
+
+    FLOG(_L("  asyncOp->WipeAsyncL();   "));
+    asyncOp->WipeAsyncL();    
+    /*
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete(status, KErrNone);
+    */
+    FLOG(_L(" void CLAWMOContactsPlugin::WipeL () <<"));
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/contactsplugin/src/contactspluginproxy.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Contacts proxy plug-in for LAWMO.
+*
+*/ 
+
+#include <e32std.h>
+#include <implementationproxy.h>
+
+#include "contactsplugin.h"
+
+
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy ImplementationTable[] = 
+	{
+		IMPLEMENTATION_PROXY_ENTRY(0x2002EA25,	CLAWMOContactsPlugin::NewL),
+	};
+
+// Exported proxy for instantiation method resolution
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+	{
+	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+
+	return ImplementationTable;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/contactsplugin/src/lawmocontactsasyncwipe.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,249 @@
+/*
+* 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:  Active Object Source for wiping contacts, used by lawmocontactsplugin.
+*
+*/
+
+#include <f32file.h>
+#include <CPbkContactEngine.h>
+#include <CPbkSingleEntryFetchDlg.h>
+#include <rpbkviewresourcefile.h>
+#include <cntdb.h>
+#include <etelmm.h>
+
+// PhoneBook2 uid 
+ #include <Pbk2UID.h>
+
+// Application Closing
+#include <apgtask.h>
+#include <w32std.h>
+#include <APGTASK.H>
+
+#include "fdebug.h"
+#include "lawmocontactsasyncwipe.h"
+
+// ----------------------------------------------------------------------------- 
+// CActiveWipeObject::CActiveWipeObject
+// Description: CActiveWipeObject constructer . Initializes datamember of MLawmoPluginWipeObserver 
+// ----------------------------------------------------------------------------- 
+//
+CActiveWipeObject::CActiveWipeObject(MLawmoPluginWipeObserver* aObserver) : CActive( EPriorityStandard ) , 
+        iObserver(aObserver), iContactsDb (NULL), iContacts (NULL)
+{
+    FLOG(_L( " Contacts: CActiveWipeObject::CActiveWipeObject(MLawmoPluginWipeObserver* aObserver) >> "));
+    // See ConstructL() for initialisation completion.
+    FLOG(_L( " Contacts: CActiveWipeObject::CActiveWipeObject(MLawmoPluginWipeObserver* aObserver) << "));
+}
+
+// ----------------------------------------------------------------------------- 
+// CActiveWipeObject::NewL
+// Description: CActiveWipeObject constructer 
+// ----------------------------------------------------------------------------- 
+//
+CActiveWipeObject* CActiveWipeObject::NewL(MLawmoPluginWipeObserver* aObserver)
+{
+    FLOG(_L( " Contacts: CActiveWipeObject::NewL(MLawmoPluginWipeObserver* aObserver) >> "));
+    CActiveWipeObject* self=new(ELeave) CActiveWipeObject(aObserver);  
+    CleanupStack::PushL(self);
+    self->ConstructL(); 
+    CleanupStack::Pop();
+    FLOG(_L( " Contacts: CActiveWipeObject::NewL(MLawmoPluginWipeObserver* aObserver) << "));
+    return self;
+}
+
+// ----------------------------------------------------------------------------------------
+// CActiveWipeObject::ConstructL
+// ----------------------------------------------------------------------------------------
+void CActiveWipeObject::ConstructL()
+{   
+    FLOG(_L( " Contacts: CActiveWipeObject::ConstructL >> "));
+    iTimer.CreateLocal();
+    User::LeaveIfError( iWsSession.Connect() );
+    CActiveScheduler::Add(this); // Add to scheduler
+    FLOG(_L( " Contacts: CActiveWipeObject::ConstructL << "));
+}
+
+//
+//----------------------------------------------------------------------------- 
+// CActiveWipeObject:: CActiveWipeObject
+// Description: CActiveWipeObject Destructer
+// ----------------------------------------------------------------------------- 
+// 
+CActiveWipeObject::~CActiveWipeObject()
+{
+    FLOG(_L( " Contacts: CActiveWipeObject::~CActiveWipeObject() >> "));
+    Cancel();
+
+    if(iContactsDb)
+    {
+        FLOG(_L("  delete iContactsDb;"));
+        delete iContactsDb;
+    }
+        
+    iTimer.Close();
+    
+    iWsSession.Close();
+
+    FLOG(_L( " Contacts: CActiveWipeObject::~CActiveWipeObject() << "));
+}
+
+//
+//----------------------------------------------------------------------------- 
+// CActiveWipeObject::WipeAsyncL
+// Description: Wipes the Contacts 
+// ---------------------------------------------------------------------------- 
+//
+
+void CActiveWipeObject::WipeAsyncL ()
+{    
+    FLOG(_L(" Contacts: void CActiveWipeObject::WipeAsyncL () >>"));
+
+    if ( !WaitTillPhoneBookKilled()) //Application is closed already
+        {
+        TRequestStatus* status = &iStatus;
+        FLOG(_L("  SetActive()"));
+        SetActive();
+		User::RequestComplete(status,KErrNone);
+        }
+      
+    FLOG(_L(" Contacts: void CActiveWipeObject::WipeAsyncL () <<"));
+}
+
+//
+//----------------------------------------------------------------------------- 
+// CActiveWipeObject::RunError
+// Description: This returns error 
+//----------------------------------------------------------------------------- 
+//
+
+TInt CActiveWipeObject::RunError(TInt aError)
+{
+    FLOG(_L(" Contacts: TInt CActiveWipeObject::RunError(TInt aError) >>"));
+    FLOG(_L("  iObserver->HandleWipeCompleted(aError);"));
+    iObserver->HandleWipeCompleted(aError);
+    FLOG(_L(" Contacts: TInt CActiveWipeObject::RunError(TInt aError) <<"));
+    return KErrNone;
+}
+
+//
+//----------------------------------------------------------------------------- 
+// CActiveWipeObject::DoCancel
+// Description: This calls CActive's Cancel 
+//----------------------------------------------------------------------------- 
+//
+void CActiveWipeObject::DoCancel()
+{
+    FLOG(_L(" Contacts: void CActiveWipeObject::DoCancel() >>"));
+    iTimer.Cancel();
+    FLOG(_L(" Contacts: void CActiveWipeObject::DoCancel() <<"));
+}
+
+void CActiveWipeObject::DeletePhoneContactsL()
+{
+    FLOG(_L(" Contacts: void CActiveWipeObject::DeletePhoneContactsL() >>"));
+
+    iContactsDb = CContactDatabase::OpenL();
+    iContactsDb->SetDbViewContactType( KUidContactCard );
+    iContacts= iContactsDb->SortedItemsL();
+    FLOG(_L("Count = %d "), iContacts->Count());
+    iContactsDb->DeleteContactsL(*iContacts);
+    FLOG(_L(" Contacts: void CActiveWipeObject::DeletePhoneContactsL() <<"));
+}
+
+void CActiveWipeObject::DeleteSIMContactsL()
+{
+    FLOG(_L("void CActiveWipeObject::DeleteSIMContactsL() >> "));
+    RTelServer telServer;
+    RMobilePhone phone;
+    RTelServer::TPhoneInfo info;
+    User::LeaveIfError(telServer.Connect());
+    CleanupClosePushL(telServer);
+    
+    User::LeaveIfError(telServer.GetPhoneInfo(0,info));
+    User::LeaveIfError(phone.Open(telServer,info.iName) );
+    CleanupClosePushL(phone);
+    
+    RMobilePhoneBookStore simPhBk;
+    User::LeaveIfError(simPhBk.Open(phone, KETelIccAdnPhoneBook)) ;
+    CleanupClosePushL(simPhBk); 
+
+    TRequestStatus aStatus;
+    FLOG(_L("  Contacts: phonebookstore open success"));
+    simPhBk.DeleteAll(aStatus);
+    FLOG(_L("  Contacts: issued delete"));
+    User::WaitForRequest(aStatus);
+    FLOG(_L("  Contacts: waiting done"));
+
+ 		User::LeaveIfError(aStatus.Int());
+    CleanupStack::PopAndDestroy(&simPhBk);
+    CleanupStack::PopAndDestroy(&phone);
+    CleanupStack::PopAndDestroy(&telServer);
+      
+    FLOG(_L("void CActiveWipeObject::DeleteSIMContactsL() << "));
+}
+
+TBool CActiveWipeObject::WaitTillPhoneBookKilled()
+    {
+    FLOG(_L(" void CTTPAPITestAppUi::WaitTillPhonebookKilled() >>"));
+    TBool ret(EFalse);
+    TBool flag(ETrue);
+
+    TApaTaskList list(iWsSession);
+    TUid uid =
+        {
+        KPbk2UID3
+        };
+
+    while (flag)
+        {
+        TApaTask task(list.FindApp(uid));
+        if (task.Exists())
+            {
+            FLOG(_L("Killing one instance..."));
+            task.EndTask();
+            User::After(500000);
+            ret = ETrue;
+            }
+        else
+            {
+            flag = EFalse;
+            }
+        }
+    if (ret)
+        {
+        FLOG(_L(" WaitTillPhonebookKilled: iTimer.After(iStatus,1000); "));
+        iTimer.After(iStatus, 2000); // 0.002 sec
+        SetActive();
+        }
+    
+     FLOG(_L(" void CTTPAPITestAppUi::WaitTillPhonebookKilled(), ret = %d <<"), ret);
+     return ret;
+    }
+
+//
+//----------------------------------------------------------------------------- 
+// CActiveWipeObject::RunL 
+// Description: CActive::RunL implementation which will either stop the
+// Scheduler or increment the count
+//----------------------------------------------------------------------------- 
+//
+void CActiveWipeObject::RunL()
+    {
+    FLOG(_L(" Contacts: void CActiveWipeObject::RunL() >>"));
+
+    DeletePhoneContactsL();
+    DeleteSIMContactsL();
+    iObserver->HandleWipeCompleted(KErrNone);
+    FLOG(_L(" Contacts: void CActiveWipeObject::RunL() <<"));
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/group/bld.inf	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This file provides building information for LAWMO plug-ins for wipeing data.
+*
+*/
+
+
+PRJ_PLATFORMS
+
+PRJ_MMPFILES
+#include "../messagingplugin/group/bld.inf"
+#include "../contactsplugin/group/bld.inf"
+#include "../calllogsplugin/group/bld.inf"
+#include "../mediaplugin/group/bld.inf"
+//../lawmoplugins/mediaplugin/group/mediaplugin.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/mediaplugin/data/mediaplugin.rss	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* 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 the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource file for mediaplugin of LAWMO Interface Implementation.
+*
+*/
+
+#include <registryinfo.rh>
+
+// Declares info for two implementations
+RESOURCE REGISTRY_INFO theInfo
+	{
+	// UID for the DLL
+	dll_uid = 0x2002EA28;
+	// Declare array of interface info
+	interfaces = 
+		{
+		INTERFACE_INFO
+			{
+			// UID of interface that is implemented
+			interface_uid = 0x2002EA1F;
+			implementations = 
+				{
+				// Info for LAWMO Contacts Plugin
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0x2002EA29;
+					version_no = 1;
+					display_name = "Media";
+					default_data = "text/wml";
+					opaque_data = "Media";
+					}
+				};
+			}
+		};
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/mediaplugin/group/bld.inf	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* 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 the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This file provides building information for Wiping Contactsplugin.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mediaplugin.mmp
+
+
+// End Of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/mediaplugin/group/mediaplugin.mmp	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* 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 the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Contacts plug-in for LAWMO
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET lawmomediaplugin.dll
+TARGETTYPE PLUGIN
+
+UID 0x10009D8D 0x2002EA28
+VENDORID VID_DEFAULT
+CAPABILITY  CAP_ECOM_PLUGIN
+
+SOURCEPATH				../src
+SOURCE					mediaplugin.cpp
+SOURCE					mediapluginproxy.cpp
+
+USERINCLUDE 			../inc 
+
+APP_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE 		/epoc32/include/ecom
+SYSTEMINCLUDE     /epoc32/include
+
+SOURCEPATH				../data
+
+start resource mediaplugin.rss
+TARGET lawmomediaplugin.rsc
+LANGUAGE_IDS
+end
+
+LIBRARY 			euser.lib ecom.lib efsrv.lib bafl.lib  etul.lib
+LIBRARY       		centralrepository.lib
+LIBRARY 			commonengine.lib               // Series 60 common components library
+LIBRARY				cntmodel.lib flogger.lib
+LIBRARY			 	MetaDataUtility.lib
+LIBRARY			  	mdeclient.lib apmime.lib
+
+MW_LAYER_SYSTEMINCLUDE
+//
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/mediaplugin/inc/lawmodebug.h	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2000 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of terminalsecurity components
+*
+*/
+
+
+#ifndef _LAW_IMG_HEADER_
+#define _LAW_IMG_HEADER_
+
+#include <f32file.h>
+#include <flogger.h>
+// CONSTANTS
+_LIT( KLawLogFolderName, "lawmo" );
+_LIT( KLawLogFileName, "img.log" );
+// MACROS
+#ifdef _DEBUG
+#define _LAW_IMG_DEBUG
+#endif
+
+#ifdef _LAW_IMG_DEBUG
+		#define RDEBUG(X)					RFileLogger::Write( KLawLogFolderName, KLawLogFileName, EFileLoggingModeAppend, _L(X) )
+		#define RDEBUG_2(X,Y)			RFileLogger::WriteFormat( KLawLogFolderName, KLawLogFileName, EFileLoggingModeAppend, _L(X),Y )	
+		#define RDEBUG_3(X,Y,Z)	  RFileLogger::WriteFormat( KLawLogFolderName, KLawLogFileName, EFileLoggingModeAppend, _L(X),Y,Z )	
+#else
+
+	#if defined (_DEBUG)
+		#define RDEBUG(X)								RDebug::Print(_L(X))
+		#define RDEBUG_2(X,Y)						RDebug::Print(_L(X),Y)
+		#define RDEBUG_3(X,Y,Z)					RDebug::Print(_L(X),Y,Z)
+	#else
+		#define RDEBUG(X)								
+		#define RDEBUG_2(X,Y)						
+		#define RDEBUG_3(X,Y,Z)	
+	#endif // _DEBUG
+	
+#endif // _LAW_IMG_DEBUG
+
+#endif // _LAW_IMG_HEADER_
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/mediaplugin/inc/mediaplugin.h	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* 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 the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media plug-in for LAWMO
+*
+*/
+
+#ifndef _MEDIAPLUGIN__
+#define _MEDIAPLUGIN__
+
+#include <e32base.h>	// For CActive, link against: euser.lib
+#include <e32std.h>		// For RTimer, link against: euser.lib
+#include <mdesession.h>
+#include <mdequery.h>
+#include <mdeobjectdef.h>
+#include <mdeobjectquery.h>
+#include <mdeconstants.h>
+#include <mdeitem.h>
+#include <f32file.h>
+#include <flogger.h>
+#include <lawmointerface.h>
+#include <lawmocallbackinterface.h>
+
+// An implementation of the CLAWMOPluginInterface definition
+class CLAWMOMediaPlugin : public CLAWMOPluginInterface,
+						  public MMdESessionObserver,
+						  public MMdEQueryObserver
+	{
+public:
+	// Standardised safe construction which leaves nothing the cleanup stack.
+    static CLAWMOMediaPlugin* NewL(MLawmoPluginWipeObserver* aObserver);
+	// Destructor	
+	~CLAWMOMediaPlugin();
+	
+	void WipeL ();
+	// Initiate and start a MdsQuery
+	void StartMdsQueryL();
+public: // from MMdESessionObserver
+    
+    void HandleSessionOpened( CMdESession& aSession, TInt aError );
+    void HandleSessionError( CMdESession& aSession, TInt aError );
+		
+public: // from MMdEQueryObserver
+    void HandleQueryNewResults(CMdEQuery& aQuery,
+                                   TInt aFirstNewItemIndex,
+                                   TInt aNewItemCount);
+                                   
+    void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError);
+
+private:
+    enum TMdsQueryState
+        {
+        EUninitialized, // Uninitialized
+        EInitialized, // Initalized
+        EImage,
+        EVideo,
+        ESession,
+        EError
+        // Error condition
+        };
+		
+private:
+	// Construction
+	CLAWMOMediaPlugin();
+	/**
+	 * second phase constructor
+	 */
+	void ConstructL(MLawmoPluginWipeObserver* aObserver);
+
+private:
+	TInt iState; // State of the active object
+	CMdESession* iMdeSession; // session to MdE, created before trying to do the query
+	CMdEObjectQuery* iQuery;
+	RFs iRfs;
+	MLawmoPluginWipeObserver* iObserver;
+	};  
+
+#endif // _MEDIAPLUGIN__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/mediaplugin/src/mediaplugin.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,224 @@
+/*
+* 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 the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media plug-in for LAWMO
+*
+*/
+
+#include <f32file.h>
+#include <data_caging_path_literals.hrh>
+#include <centralrepository.h>
+#include "mediaplugin.h"
+#include "lawmodebug.h"
+
+// ----------------------------------------------------------------------------------------
+// CLAWMOMediaPlugin::NewL
+// ----------------------------------------------------------------------------------------
+CLAWMOMediaPlugin* CLAWMOMediaPlugin::NewL(MLawmoPluginWipeObserver* aObserver)
+	{
+        RDEBUG( "CLAWMOMediaPlugin NewL");
+        CLAWMOMediaPlugin* self=new(ELeave) CLAWMOMediaPlugin();  
+		CleanupStack::PushL(self);
+		self->ConstructL(aObserver); 
+		if(self)
+        RDEBUG( "CLAWMOMediaPlugin NewL self obj created");
+	    CleanupStack::Pop();
+		return self;
+	}
+
+// ----------------------------------------------------------------------------------------
+// CLAWMOMediaPlugin::~CLAWMOMediaPlugin
+// ----------------------------------------------------------------------------------------
+CLAWMOMediaPlugin::~CLAWMOMediaPlugin()
+	{
+    RDEBUG( "CLAWMOMediaPlugin destructor");
+    if(iQuery)
+    	{
+    	delete iQuery;
+    	RDEBUG( "iQuery deleted");
+      }
+    if(iMdeSession)
+    	{
+    	delete iMdeSession;
+    	RDEBUG( "iMdeSession deleted");
+      }
+    iRfs.Close();
+	}
+
+// ----------------------------------------------------------------------------------------
+// CLAWMOMediaPlugin::CLAWMOMediaPlugin
+// ----------------------------------------------------------------------------------------
+CLAWMOMediaPlugin::CLAWMOMediaPlugin()
+	{
+	// See ConstructL() for initialisation completion.
+	}
+
+// ----------------------------------------------------------------------------------------
+// CLAWMOMediaPlugin::ConstructL
+// ----------------------------------------------------------------------------------------
+void CLAWMOMediaPlugin::ConstructL(MLawmoPluginWipeObserver* aObserver)
+{	
+    RDEBUG( "CLAWMOMediaPlugin ConstructL");
+    iState = EUninitialized;
+	iObserver = aObserver;
+    User::LeaveIfError(iRfs.Connect());
+    RDEBUG( "CLAWMOMediaPlugin ConstructL done");
+}
+
+// Implementation of CLAWMOPluginInterface
+
+// ----------------------------------------------------------------------------------------
+// CLAWMOMediaPlugin::WipeL
+// Wipes the Media.
+// ----------------------------------------------------------------------------------------
+
+void CLAWMOMediaPlugin::WipeL ()
+{
+    RDEBUG( "CLAWMOMediaPlugin WipeL()");
+    iMdeSession = CMdESession::NewL( *this ); //MMdESessionObserver
+    RDEBUG( "CLAWMOMediaPlugin WipeL() iMdeSession");
+    iState = EInitialized;  
+}
+	
+void CLAWMOMediaPlugin::HandleSessionOpened( CMdESession& /*aSession*/, TInt aError )
+    {
+	RDEBUG( "HandleSessionOpened start");
+	iState = ESession;
+	if(aError == KErrNone)
+	    {
+		TRAPD(err,StartMdsQueryL());
+		if(err!=KErrNone)
+		    iObserver->HandleWipeCompleted(KErrGeneral);
+	    }
+	else
+	    iObserver->HandleWipeCompleted(aError);
+    RDEBUG( "HandleSessionOpened done");	
+	}
+
+// ----------------------------------------------------------------------------
+// CMdsQueryHandler::HandleSessionError
+// From MMdESessionObserver
+// ----------------------------------------------------------------------------
+//
+void CLAWMOMediaPlugin::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
+    {
+    RDEBUG( "CLAWMOMediaPlugin HandleSessionError()");
+	iState = EError;
+	iObserver->HandleWipeCompleted(aError);
+    }
+	
+void CLAWMOMediaPlugin::StartMdsQueryL()
+    {
+    RDEBUG( "CLAWMOMediaPlugin StartMdsQuery() start");
+    if(iState == ESession)
+        {
+        iState = ESession;
+        TInt counT = iMdeSession->NamespaceDefCount();
+        RDEBUG_2("NamespaceDefCount  %d", counT);
+
+        CMdENamespaceDef& defaultNamespaceDef = iMdeSession->GetDefaultNamespaceDefL();
+        RDEBUG( "HandleSessionOpened StartMdsQuery() defaultNamespaceDef");
+        CMdEObjectDef& imageObjDef = defaultNamespaceDef.GetObjectDefL(MdeConstants::Image::KImageObject);
+        RDEBUG( "RunL() imageObjDef");
+
+        //CMdEPropertyDef& itemProperty = imageObjDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty );
+        CMdEPropertyDef& titleProperty = imageObjDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty );
+
+        RDEBUG( "RunL() titleProperty");
+        iQuery = iMdeSession->NewObjectQueryL( iMdeSession->GetDefaultNamespaceDefL(),
+                                    imageObjDef,
+                                    this );
+        iQuery->AddPropertyFilterL(&titleProperty);
+        
+        RDEBUG( "RunL() NewObjQuery");                                 
+        //_LIT(KJpegMime, "image/jpeg");
+        //CMdELogicCondition& rootCondition = iQuery->Conditions();
+        //rootCondition.AddPropertyConditionL(itemProperty, ETextPropertyConditionCompareEquals,KJpegMime);
+        //RDEBUG( "RunL()LogicCondition");
+        iState = EImage;
+        iQuery->FindL(); // starts the object query
+        RDEBUG( "RunL() FindL");    
+        }
+    else if(iState == EVideo)
+        {
+        CMdENamespaceDef& defaultNamespaceDef = iMdeSession->GetDefaultNamespaceDefL();
+        RDEBUG( "StartMdsQuery StartVideoL() defaultNamespaceDef");
+        CMdEObjectDef& vidObjDef = defaultNamespaceDef.GetObjectDefL(MdeConstants::Video::KVideoObject);
+        RDEBUG( "StartMdsQuery StartVideoL() imageObjDef");
+        
+        iQuery = iMdeSession->NewObjectQueryL( iMdeSession->GetDefaultNamespaceDefL(),
+                                            vidObjDef,
+                                            this );
+        RDEBUG( "StartMdsQuery StartVideoL() NewObjQuery");                                 
+        CMdEPropertyDef& titleProperty = vidObjDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty );
+        iQuery->AddPropertyFilterL(&titleProperty);
+        RDEBUG( "StartMdsQuery StartVideoL() BeforeFindL");
+        iQuery->FindL(); // starts the object query
+        RDEBUG( "StartMdsQuery StartVideoL() FindL");
+        }
+    RDEBUG( "CLAWMOMediaPlugin StartMdsQuery() done");
+    }
+
+void CLAWMOMediaPlugin::HandleQueryCompleted( CMdEQuery& aQuery, TInt aError )
+  {
+    // query is completed
+    RDEBUG( "CLAWMOMediaPlugin HandleQueryCompleted, Begin");
+    RDEBUG_2("CLAWMOMediaPlugin error %d", aError);
+    RDEBUG_2("aQuery.Count %d", aQuery.Count());
+    TBool comp = iQuery->IsComplete();
+    RDEBUG_2("Query complete ? %d",comp);
+    
+    CMdEObjectQuery& query = (CMdEObjectQuery &) aQuery;
+    if( aQuery.Count() > 0 && aError == KErrNone )
+    {
+    // some items were found!
+    RDEBUG( "CLAWMOMediaPlugin HandleQueryCompleted, objects found");
+    for(TInt i=0;i<aQuery.Count();i++)
+        {
+        TBuf<255> uri;
+        CMdEObject* obj = (CMdEObject*)query.TakeOwnershipOfResult(i);
+        RDEBUG( "CLAWMOMediaPlugin HandleQueryCompleted, own one obj");
+        uri.Copy(obj->Uri());
+        RDEBUG_2("HandleQueryCompleted URI %s", uri.PtrZ());
+        if(iRfs.IsValidName(uri))
+            {
+            RDEBUG( "CLAWMOMediaPlugin HandleQueryCompleted file exists");
+            iRfs.Delete ( uri );
+            }
+        delete obj;
+        }
+    }
+	// After deletion, decide if its video/image and do accordingly
+    if(iState == EVideo)
+        {
+        iObserver->HandleWipeCompleted(aError);
+        }
+    else if(iState == EImage)
+        {
+        iState = EVideo;
+        RDEBUG( "CLAWMOMediaPlugin HandleQueryCompleted() ****reqcomplete");
+        TRAPD(err,StartMdsQueryL());
+        if(err!=KErrNone)
+            iObserver->HandleWipeCompleted(KErrGeneral);
+        }
+    RDEBUG( "CLAWMOMediaPlugin HandleQueryCompleted, out of loop");
+  }
+
+void CLAWMOMediaPlugin::HandleQueryNewResults(CMdEQuery& aQuery,
+						   TInt aFirstNewItemIndex,
+						   TInt aNewItemCount)
+   {
+    RDEBUG( "CLAWMOMediaPlugin HandleQueryNewResults");    
+   }
+
+//
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/mediaplugin/src/mediapluginproxy.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Media plug-in for LAWMO
+*
+*/
+
+#include <e32std.h>
+#include <implementationproxy.h>
+
+#include "mediaplugin.h"
+
+
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy ImplementationTable[] = 
+	{
+		IMPLEMENTATION_PROXY_ENTRY(0x2002EA29,	CLAWMOMediaPlugin::NewL),
+	};
+
+// Exported proxy for instantiation method resolution
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+	{
+	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+
+	return ImplementationTable;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/messagingplugin/data/messagingplugin.rss	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* 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:  Resource file for messagingplugin of LAWMO Interface Implementation.
+*
+*/
+
+#include "registryinfo.rh"
+
+// Declares info for two implementations
+RESOURCE REGISTRY_INFO theInfo
+	{
+	// UID for the DLL
+	dll_uid = 0x2002EA26;
+	// Declare array of interface info
+	interfaces = 
+		{
+		INTERFACE_INFO
+			{
+			// UID of interface that is implemented
+			interface_uid = 0x2002EA1F;
+			implementations = 
+				{
+				// Info for LAWMO Messaging Plugin
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0x2002EA27;
+					version_no = 1;
+					display_name = "Messaging";
+					default_data = "text/wml";
+					opaque_data = "Messaging";
+					}
+				};
+			}
+		};
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/messagingplugin/group/bld.inf	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* 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:  This file provides building information for Wiping Messagingplugin.
+*
+*/
+#include <platform_paths.hrh>
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+messagingplugin.mmp
+
+// End Of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/messagingplugin/group/messagingplugin.mmp	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* 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:  Messaging plug-in for LAWMO
+*
+*/
+
+#include <platform_paths.hrh>
+ 
+TARGET lawmomessagingplugin.dll
+TARGETTYPE PLUGIN
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID 0x10009D8D 0x2002EA26
+VENDORID VID_DEFAULT
+CAPABILITY  CAP_ECOM_PLUGIN
+
+APP_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE 		/epoc32/include/ecom
+SYSTEMINCLUDE     /epoc32/include
+
+USERINCLUDE 			../inc 
+USERINCLUDE 			../../../inc 
+
+SOURCEPATH				../src
+SOURCE					messagingplugin.cpp
+SOURCE 					lawmomessagingasyncwipe.cpp
+SOURCE 					messagingpluginproxy.cpp
+
+SOURCEPATH				../data
+start resource messagingplugin.rss
+TARGET lawmomessagingplugin.rsc
+LANGUAGE_IDS
+end
+
+LIBRARY 			euser.lib ecom.lib efsrv.lib 
+LIBRARY       centralrepository.lib
+LIBRARY       platformenv.lib
+
+LIBRARY		ws32.lib // Closing Apps
+LIBRARY		apgrfx.lib // TApaTaskList
+
+LIBRARY msgs.lib cntmodel.lib gsmu.lib smcm.lib 
+//DEBUGLIBRARY flogger.lib
+LIBRARY flogger.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/messagingplugin/inc/lawmomessagingasyncwipe.h	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* 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:  Active object for the wiping messages, called by lawmomessagingplugin.
+*
+*/
+#ifndef ACTIVEWIPEOBJECT_H 
+#define ACTIVEWIPEOBJECT_H
+
+#include <e32base.h>
+#include <f32file.h>
+#include <msvstd.h>
+#include <msvapi.h>
+#include <msvids.h>
+#include <lawmocallbackinterface.h>
+#include "fdebug.h"
+ 
+// Application Closing
+#include <apgtask.h>
+#include <w32std.h>
+#include <APGTASK.H>
+
+#define KMessagingAppUid 0x100058C5  // Messgaing App Uid
+
+class CDummyObserver : public CBase, public MMsvSessionObserver
+{
+public:
+        void HandleSessionEventL(TMsvSessionEvent aEvent, TAny*, TAny*, TAny*){}
+};
+
+class CActiveWipeObject : public CActive
+{
+public:
+     static CActiveWipeObject* NewL(MLawmoPluginWipeObserver* aObserver);
+
+     ~CActiveWipeObject();
+     void WipeAsyncL();
+       
+private:
+     // Over-riding the Base class functions.
+     void DoCancel();
+     TInt RunError(TInt aError);
+     void RunL();
+     
+private:
+     /**
+      * second phase constructor
+      */
+     void ConstructL();
+     
+     // Construction
+     CActiveWipeObject(MLawmoPluginWipeObserver* aObserver);
+     void DoJobL(CMsvEntry* aContext);
+     void InitializeL();
+     void Close();
+     void  WipeAllL();
+     TBool WaitTillMessageAppKilled();
+    
+     MLawmoPluginWipeObserver* iObserver;
+     RTimer iTimer; // Provides async timing service
+     RWsSession iWs;
+     CDummyObserver* iDummyObserver;
+     CMsvSession* iSession;
+} ;
+
+#endif //ACTIVEWIPEOBJECT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/messagingplugin/inc/messagingplugin.h	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* 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: Messaging plug-in for LAWMO.
+*
+*/
+
+#ifndef _MESSAGINGPLUGIN__
+#define _MESSAGINGPLUGIN__
+
+
+#include <f32file.h>
+#include <lawmointerface.h>
+#include <lawmocallbackinterface.h>
+#include "fdebug.h"
+#include "lawmomessagingasyncwipe.h"
+
+// An implementation of the CLAWMOPluginInterface definition
+class CLAWMOMessagingplugin : public CLAWMOPluginInterface
+{
+public:
+	// Standardised safe construction which leaves nothing the cleanup stack.
+	static CLAWMOMessagingplugin* NewL(MLawmoPluginWipeObserver* aObserver);
+	// Destructor	
+	~CLAWMOMessagingplugin();
+	
+	/**
+	 * Wipe the Messages
+	 * @param ENUM for which category of Messages to wipe
+	 * @return None
+	 */
+	void WipeL ();
+	
+private:
+	// Construction
+	CLAWMOMessagingplugin();
+	
+	/**
+	 * second phase constructor
+	 */
+	void ConstructL(MLawmoPluginWipeObserver* aObserver);
+    
+private:
+	 CActiveWipeObject* iAsyncOp;
+};  
+
+#endif // _MESSAGINGPLUGIN__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/messagingplugin/src/lawmomessagingasyncwipe.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,285 @@
+/*
+* 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: Active object for wiping messages, called by lawmomessagingplugin.
+*
+*/
+
+#include <msvids.h>
+#include <f32file.h>
+#include <e32base.h>
+#include "lawmomessagingasyncwipe.h"
+#include "fdebug.h"
+
+// ----------------------------------------------------------------------------- 
+// CActiveWipeObject::CActiveWipeObject
+// Description: CActiveWipeObject constructer . Initializes datamember of MLawmoPluginWipeObserver 
+// ----------------------------------------------------------------------------- 
+//
+CActiveWipeObject::CActiveWipeObject(MLawmoPluginWipeObserver* aObserver) :
+    CActive(EPriorityStandard), iObserver(aObserver), iSession(NULL)
+    {
+    FLOG(
+            _L(" Messaging: CActiveWipeObject::CActiveWipeObject(MLawmoPluginWipeObserver* aObserver) >>"));
+    // See ConstructL() for initialisation completion.
+    FLOG(
+            _L(" Messaging: CActiveWipeObject::CActiveWipeObject(MLawmoPluginWipeObserver* aObserver) <<"));
+    }
+
+// ----------------------------------------------------------------------------- 
+// CActiveWipeObject::NewL
+// Description: CActiveWipeObject constructer 
+// ----------------------------------------------------------------------------- 
+//
+CActiveWipeObject* CActiveWipeObject::NewL(MLawmoPluginWipeObserver* aObserver)
+    {
+    FLOG(_L(" Messaging: CActiveWipeObject* CActiveWipeObject::NewL(MLawmoPluginWipeObserver* aObserver) >>"));
+    CActiveWipeObject* self=new(ELeave) CActiveWipeObject(aObserver);  
+    CleanupStack::PushL(self);
+    self->ConstructL(); 
+    CleanupStack::Pop();
+    FLOG(_L(" Messaging: CActiveWipeObject* CActiveWipeObject::NewL(MLawmoPluginWipeObserver* aObserver) <<"));
+    return self;
+    }
+
+// ----------------------------------------------------------------------------------------
+// CActiveWipeObject::ConstructL
+// ----------------------------------------------------------------------------------------
+void CActiveWipeObject::ConstructL()
+    {
+    FLOG(_L(" Messaging: CActiveWipeObject::ConstructL() >>"));
+
+    iTimer.CreateLocal();
+    User::LeaveIfError(iWs.Connect());
+    CActiveScheduler::Add(this); // Add to scheduler
+    iDummyObserver = new CDummyObserver();
+    FLOG(_L(" Messaging: CActiveWipeObject::ConstructL() <<"));
+    }
+
+void CActiveWipeObject::Close()
+    {
+    FLOG(_L(" Messaging: void CActiveWipeObject::Close() >>"));
+    if (iSession)
+        {
+        FLOG(_L("  delete iSession;"));
+        delete iSession;
+        iSession = NULL;
+        }
+    FLOG(_L(" Messaging: void CActiveWipeObject::Close() <<"));
+    }
+
+//
+//----------------------------------------------------------------------------- 
+// CActiveWipeObject:: CActiveWipeObject
+// Description: CActiveWipeObject Destructer
+// ----------------------------------------------------------------------------- 
+// 
+CActiveWipeObject::~CActiveWipeObject()
+    {
+    FLOG(_L(" Messaging: CActiveWipeObject::~CActiveWipeObject() >>"));
+    Close();
+    if (iDummyObserver)
+        delete iDummyObserver;
+    iWs.Close();
+    iTimer.Close();
+    FLOG(_L(" Messaging: CActiveWipeObject::~CActiveWipeObject() <<"));
+    }
+
+//
+// Description: Deletes message entries one by one. If used by message application, force deletes.
+//
+void CActiveWipeObject::DoJobL(CMsvEntry* aContext)
+    {
+    FLOG(_L(" Messaging: void CLAWMOMessagingplugin::doJobL() >>"));
+
+    TMsvId entryID;
+    CMsvEntrySelection* entries;
+
+    entries = aContext->ChildrenL();
+    CleanupStack::PushL(entries);
+
+    TInt msgCount= entries->Count();
+    FLOG(_L("  msgCount= %d "), msgCount );
+    
+    for (TInt i=msgCount-1; i>=0; i--)
+    { 
+         entryID = entries->At(i);
+         CMsvEntry* entry = iSession->GetEntryL(entryID);
+         CleanupStack::PushL(entry);
+         TRAPD(err, entry->DeleteL(entryID));                                                                            
+         CleanupStack::PopAndDestroy(entry);
+         if(err)
+         {
+             FLOG(_L("  Deleteing entry failed with err= %d "), err);
+             // Force removal of the entry. If no any other way only.  
+             iSession->RemoveEntry(entryID);             
+         }
+    }                
+
+    CleanupStack::PopAndDestroy(entries);
+    FLOG(_L(" Messaging: void CLAWMOMessagingplugin::doJobL() <<"));
+    }
+
+void CActiveWipeObject::InitializeL()
+    {
+    FLOG(_L(" Messaging: void CActiveWipeObject::InitializeL() >>"));
+    iSession = CMsvSession::OpenSyncL(*iDummyObserver);
+    FLOG(_L(" Messaging: void CActiveWipeObject::InitializeL() <<"));
+    }
+
+//
+//----------------------------------------------------------------------------- 
+// CActiveWipeObject::WipeAsyncL
+// Description: Wipes the logs 
+// ---------------------------------------------------------------------------- 
+//
+
+void CActiveWipeObject::WipeAsyncL()
+    {
+    FLOG(_L(" Messaging: void CActiveWipeObject::WipeAsyncL () >>"));
+        
+    if ( !WaitTillMessageAppKilled()) //Application is closed already
+        {
+        TRequestStatus* status = &iStatus;
+        FLOG(_L("  SetActive()"));
+        SetActive();
+        User::RequestComplete(status, KErrNone);
+        }
+    FLOG(_L(" Messaging: void CActiveWipeObject::WipeAsyncL () <<"));
+    }
+
+//
+// Description: Wipes Inbox, Sent Items, Drafts, Outbox messages.
+//
+//
+void CActiveWipeObject::WipeAllL()
+    {
+    FLOG(_L(" Messaging: void  CActiveWipeObject::wipeAll() >>"));
+
+    CMsvEntry* context = NULL;
+    TMsvSelectionOrdering sort;
+
+    sort.SetShowInvisibleEntries(ETrue); // we want to handle also the invisible entries
+    context = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, sort); // Reading Messages from Inbox Folder
+    DoJobL(context);
+    delete context;
+
+    context = CMsvEntry::NewL(*iSession, KMsvGlobalOutBoxIndexEntryId, sort); // Reading Messages from Outbox Folderif(KErrNone)
+    DoJobL(context);
+    delete context;
+
+    context = CMsvEntry::NewL(*iSession, KMsvSentEntryId, sort); // Reading Messages from Sent Folder
+    DoJobL(context);
+    delete context;
+
+    context = CMsvEntry::NewL(*iSession, KMsvDraftEntryId, sort); // Reading Messages from Draft Folder
+    DoJobL(context);
+    delete context;
+    FLOG(_L(" Messaging: void  CActiveWipeObject::wipeAll() <<"));
+    }
+
+//
+//----------------------------------------------------------------------------- 
+// CActiveWipeObject::RunError
+// Description: This returns error 
+//----------------------------------------------------------------------------- 
+//
+
+TInt CActiveWipeObject::RunError(TInt aError)
+    {
+    FLOG(_L(" Messaging: TInt CActiveWipeObject::RunError(TInt aError) >>"));
+
+    FLOG(_L(" Messaging: RunError error %d"), aError);
+    iObserver->HandleWipeCompleted(aError);
+
+    FLOG(_L(" Messaging: TInt CActiveWipeObject::RunError(TInt aError) <<"));
+    return KErrNone;
+    }
+
+//
+//----------------------------------------------------------------------------- 
+// CActiveWipeObject::DoCancel
+// Description: This calls CActive's Cancel 
+//----------------------------------------------------------------------------- 
+//
+void CActiveWipeObject::DoCancel()
+    {
+    FLOG(_L(" Messaging: void CActiveWipeObject::DoCancel() >>"));
+    iTimer.Cancel();
+    FLOG(_L(" Messaging: void CActiveWipeObject::DoCancel() <<"));
+    }
+
+//
+//-----------------------------------------------------------------------------
+// CActiveWipeObject::WaitTillMessageAppKilled
+// Description: This function checks for the Messaging applicaiton being run. If running then kill it.
+//-----------------------------------------------------------------------------
+
+TBool CActiveWipeObject::WaitTillMessageAppKilled()
+    {
+    FLOG(_L(" void CTTPAPITestAppUi::WaitTillMessageAppKilled() >>"));
+    TBool ret(EFalse);
+    TBool flag(ETrue);
+
+    TApaTaskList list(iWs);
+    TUid uid =
+        {
+        KMessagingAppUid
+        };
+
+    while (flag)
+        {
+        TApaTask task( list.FindApp( uid ) );
+        if (task.Exists())
+            {
+            FLOG(_L("Killing one instance..."));
+            task.EndTask();
+            User::After(500000);
+            ret = ETrue;
+            }
+        else
+            {
+            flag = EFalse;
+            }
+        }
+    
+    if (ret)
+        {
+        FLOG(_L(" WaitTillMessageAppKilled: iTimer.After(iStatus,2000); "));  
+        iTimer.After(iStatus,2000); // 0.002 sec
+        SetActive();
+        }
+    
+     FLOG(_L(" void CTTPAPITestAppUi::WaitTillMessageAppKilled(), ret = %d <<"), ret);
+     return ret;
+    }
+
+
+
+//
+//----------------------------------------------------------------------------- 
+// CActiveWipeObject::RunL 
+// Description: CActive::RunL implementation which will either stop the
+// Scheduler or increment the count
+//----------------------------------------------------------------------------- 
+//
+void CActiveWipeObject::RunL()
+    {
+    FLOG(_L(" Messaging: void CActiveWipeObject::RunL() >>"));
+    
+    FLOG(_L("void CActiveWipeObject::RunL(): iStatus= %d "), iStatus.Int());
+    InitializeL();    
+    WipeAllL();
+    iObserver->HandleWipeCompleted(KErrNone);
+    FLOG(_L(" Messaging: void CActiveWipeObject::RunL() <<"));
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/messagingplugin/src/messagingplugin.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,93 @@
+/*
+* 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:  Messaging plug-in for LAWMO.
+*
+*/
+
+#include <f32file.h>
+#include <data_caging_path_literals.hrh>
+#include <centralrepository.h>
+
+#include "messagingplugin.h"
+#include "fdebug.h"
+#include "lawmomessagingasyncwipe.h"
+
+// Construction and destruction functions
+
+// ----------------------------------------------------------------------------------------
+// CLAWMOMessagingplugin::NewL
+// ----------------------------------------------------------------------------------------
+CLAWMOMessagingplugin* CLAWMOMessagingplugin::NewL(MLawmoPluginWipeObserver* aObserver)
+	{
+        FLOG(_L(" CLAWMOMessagingplugin* CLAWMOMessagingplugin::NewL(MLawmoPluginWipeObserver* aObserver) >>"));
+        CLAWMOMessagingplugin* self=new(ELeave) CLAWMOMessagingplugin();  
+		CleanupStack::PushL(self);
+		self->ConstructL(aObserver); 
+		CleanupStack::Pop();
+        FLOG(_L(" CLAWMOMessagingplugin* CLAWMOMessagingplugin::NewL(MLawmoPluginWipeObserver* aObserver) <<"));
+		return self;
+	}
+
+// ----------------------------------------------------------------------------------------
+// CLAWMOMessagingplugin::~CLAWMOMessagingplugin
+// ----------------------------------------------------------------------------------------
+CLAWMOMessagingplugin::~CLAWMOMessagingplugin()
+	{
+        FLOG(_L(" CLAWMOMessagingplugin::~CLAWMOMessagingplugin() >>"));
+        if(iAsyncOp)
+        {
+            FLOG(_L(" delete iAsyncOp; "));
+            delete iAsyncOp;
+        }
+        FLOG(_L(" CLAWMOMessagingplugin::~CLAWMOMessagingplugin() <<"));
+	}
+
+// ----------------------------------------------------------------------------------------
+// CLAWMOMessagingplugin::CLAWMOMessagingplugin
+// ----------------------------------------------------------------------------------------
+CLAWMOMessagingplugin::CLAWMOMessagingplugin() 
+	{
+        FLOG(_L(" CLAWMOMessagingplugin::CLAWMOMessagingplugin() >>"));
+	// See ConstructL() for initialisation completion.
+        FLOG(_L(" CLAWMOMessagingplugin::CLAWMOMessagingplugin() <<"));
+	}
+
+// ----------------------------------------------------------------------------------------
+// CLAWMOMessagingplugin::ConstructL
+// ----------------------------------------------------------------------------------------
+void CLAWMOMessagingplugin::ConstructL(MLawmoPluginWipeObserver* aObserver)
+{	
+    FLOG(_L(" void CLAWMOMessagingplugin::ConstructL(MLawmoPluginWipeObserver* aObserver) >>"));
+    FLOG(_L("  iAsyncOp = CActiveWipeObject::NewL(aObserver);"));
+	iAsyncOp = CActiveWipeObject::NewL(aObserver);
+	
+    FLOG(_L(" void CLAWMOMessagingplugin::ConstructL(MLawmoPluginWipeObserver* aObserver) <<"));
+}
+
+
+// Implementation of CLAWMOPluginInterface
+
+// ----------------------------------------------------------------------------------------
+// CLAWMOMessagingplugin::WipeL
+// Wipes the Contacts.
+// ----------------------------------------------------------------------------------------
+
+void CLAWMOMessagingplugin::WipeL ()
+{
+    FLOG(_L(" void CLAWMOMessagingplugin::WipeL (TInt aCategory) >>"));
+    FLOG(_L("  iAsyncOp->WipeAsyncL();"));
+    iAsyncOp->WipeAsyncL();
+    
+    FLOG(_L(" void CLAWMOMessagingplugin::WipeL (TInt aCategory) <<"));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/lawmoplugins/messagingplugin/src/messagingpluginproxy.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Messaging plug-in's Messagingproxy for LAWMO
+*
+*/
+
+#include <e32std.h>
+#include <implementationproxy.h>
+
+#include "messagingplugin.h"
+
+
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy ImplementationTable[] = 
+	{
+		IMPLEMENTATION_PROXY_ENTRY(0x2002EA27,	CLAWMOMessagingplugin::NewL),
+	};
+
+// Exported proxy for instantiation method resolution
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+	{
+	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+
+	return ImplementationTable;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/lawmo/rom/lawmo.iby	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,31 @@
+/*
+* 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:   Image description file for lawmo plugins
+*
+*/
+
+#ifndef _LAWMO_IBY_
+#define _LAWMO_IBY_
+
+#include <data_caging_paths_for_iby.hrh>
+
+#ifdef	FF_OMA_LAWMO
+ECOM_PLUGIN(lawmomessagingplugin.dll, lawmomessagingplugin.rsc)
+ECOM_PLUGIN(lawmocontactsplugin.dll, lawmocontactsplugin.rsc)
+ECOM_PLUGIN(lawmocalllogsplugin.dll, lawmocalllogsplugin.rsc)
+ECOM_PLUGIN(lawmomediaplugin.dll, lawmomediaplugin.rsc )
+ECOM_PLUGIN(lawmodmadapter.dll ,lawmodmadapter.rsc)
+#endif
+
+#endif // _LAWMO_IBY_
--- a/omadm/omadmappui/data/NSmlDMSync.rss	Thu Jul 15 18:24:21 2010 +0300
+++ b/omadm/omadmappui/data/NSmlDMSync.rss	Thu Aug 19 09:42:30 2010 +0300
@@ -570,16 +570,16 @@
 
 //----------------------------------------------------
 //   
-//    r_settings_menu_bar
+//    r_settings_fotamenu
 //    Menubar and Menupane of the Settings view
 //
 //----------------------------------------------------
 //
-RESOURCE MENU_BAR r_settings_menu_bar
+RESOURCE MENU_BAR r_settings_fotamenu
     {
     titles = 
         { 
-        MENU_TITLE { menu_pane = r_settings_menu; txt = ""; }
+        MENU_TITLE { menu_pane = r_settings_defaultserver; txt = ""; }
         };
     }
 
@@ -612,6 +612,29 @@
             }        
         };
     }
+//----------------------------------------------------
+//   
+//    r_settings_defaultmenu
+//    Settings view menu
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_settings_defaultserver
+    {
+    items =
+        {
+        MENU_ITEM 
+            {
+            command = EAknCmdHelp;
+            txt = qtn_options_help; 
+            },
+        MENU_ITEM 
+            { 
+            command = ENSmlSettExit; 
+            txt = qtn_options_exit;
+            }        
+        };
+    }
 
 //----------------------------------------------------
 // r_nsml_setting_dialog
--- a/omadm/omadmappui/data/NSmlDMSync_reg.rss	Thu Jul 15 18:24:21 2010 +0300
+++ b/omadm/omadmappui/data/NSmlDMSync_reg.rss	Thu Aug 19 09:42:30 2010 +0300
@@ -18,7 +18,7 @@
 
 
 #include <appinfo.rh>
-#include <NSmlDMSync.rsg>
+#include <nsmldmsync.rsg>
 #include <SyncService.rh>
 #include <SyncServiceConst.h>
 #include <data_caging_paths_strings.hrh>
--- a/omadm/omadmappui/src/NSmlDMDlgProfileView.cpp	Thu Jul 15 18:24:21 2010 +0300
+++ b/omadm/omadmappui/src/NSmlDMDlgProfileView.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -37,9 +37,9 @@
 #include "NSmlDMSyncDebug.h"
 #include "NSmlDMItemData.h"
 #include "nsmldmsyncinternalpskeys.h"
-#include <NSmlDMSync.rsg>
+#include <nsmldmsync.rsg>
 #include <cmmanager.rsg>
-#include <ConnectionUiUtilities.rsg>
+#include <connectionuiutilities.rsg>
 #include <bautils.h> 
 
 #include <hlplch.h>
--- a/omadm/omadmappui/src/NSmlDMFotaContainer.cpp	Thu Jul 15 18:24:21 2010 +0300
+++ b/omadm/omadmappui/src/NSmlDMFotaContainer.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -35,7 +35,7 @@
 #include "NSmlDMdef.h"
 #include <centralrepository.h>
 //multi rofs
-#include <NSmlDMSync.rsg>
+#include <nsmldmsync.rsg>
 #include <e32property.h>
 #include <swi/sisregistrypackage.h>
 #include <swi/sisregistryentry.h>
--- a/omadm/omadmappui/src/NSmlDMFotaSettingsDialog.cpp	Thu Jul 15 18:24:21 2010 +0300
+++ b/omadm/omadmappui/src/NSmlDMFotaSettingsDialog.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -28,7 +28,7 @@
 #include "NSmlDMFotaSettingsDialog.h"
 #include "NSmlDMFotaModel.h"
 #include "NSmlDMSyncUi.hrh"
-#include <NSmlDMSync.rsg>
+#include <nsmldmsync.rsg>
 #include <featmgr.h>
 #include "nsmldmsyncinternalpskeys.h" 
 
@@ -375,7 +375,7 @@
 //
 void CNSmlDMFotaSettingsDialog::ConstructL()
     {
-    CAknDialog::ConstructL( R_SETTINGS_PROFILEMENU );
+    CAknDialog::ConstructL( R_SETTINGS_FOTAMENU );
 
     iDocument = (CNSmlDMSyncDocument*) iAvkonAppUi->Document();
     
--- a/omadm/omadmappui/src/NSmlDMFotaView.cpp	Thu Jul 15 18:24:21 2010 +0300
+++ b/omadm/omadmappui/src/NSmlDMFotaView.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -42,7 +42,7 @@
 #include "NSmlDMdef.h"
 
 #include "NSmlDMSyncUi.hrh"
-#include <NSmlDMSync.rsg>
+#include <nsmldmsync.rsg>
 #include <nsmldmsync.mbg>
 #include "NSmlDMSyncDebug.h"
 
--- a/omadm/omadmappui/src/NSmlDMItemData.cpp	Thu Jul 15 18:24:21 2010 +0300
+++ b/omadm/omadmappui/src/NSmlDMItemData.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -20,7 +20,7 @@
 // INCLUDES
 #include "NSmlDMItemData.h"
 #include "NSmlDMSyncDebug.h"
-#include <NSmlDMSync.rsg>
+#include <nsmldmsync.rsg>
 #include "NSmlDMSyncUtil.h"
 
 #include <AknUtils.h>
--- a/omadm/omadmappui/src/NSmlDMProfilesContainer.cpp	Thu Jul 15 18:24:21 2010 +0300
+++ b/omadm/omadmappui/src/NSmlDMProfilesContainer.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -34,7 +34,7 @@
 #include "NSmlDMSyncUi.hrh"
 #include "NSmlDMdef.h"
 #include "NSmlDMSyncDebug.h"
-#include <NSmlDMSync.rsg>
+#include <nsmldmsync.rsg>
 #include <nsmldmsync.mbg>
 #include <data_caging_path_literals.hrh>
 
--- a/omadm/omadmappui/src/NSmlDMProfilesView.cpp	Thu Jul 15 18:24:21 2010 +0300
+++ b/omadm/omadmappui/src/NSmlDMProfilesView.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -20,7 +20,7 @@
 #include "NSmlDMSyncAppUi.h"
 #include "NSmlDMProfilesView.h"
 #include "NSmlDMProfilesContainer.h"
-#include <NSmlDMSync.rsg>
+#include <nsmldmsync.rsg>
 #include <featmgr.h>
 #include "NSmlDMSyncDebug.h"
 
--- a/omadm/omadmappui/src/NSmlDMProgress.cpp	Thu Jul 15 18:24:21 2010 +0300
+++ b/omadm/omadmappui/src/NSmlDMProgress.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -21,7 +21,7 @@
 #include "NSmlDMProgress.h"
 #include "NSmlDMSyncUtil.h"
 #include "NSmlDMSyncDebug.h"
-#include <NSmlDMSync.rsg>
+#include <nsmldmsync.rsg>
 #include <StringLoader.h>
 #include <eikprogi.h>
 #include <notecontrol.h>
--- a/omadm/omadmappui/src/NSmlDMSyncAppUi_fota.cpp	Thu Jul 15 18:24:21 2010 +0300
+++ b/omadm/omadmappui/src/NSmlDMSyncAppUi_fota.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -25,7 +25,7 @@
 #include <centralrepository.h>
 #include <barsread.h>
 #include <e32property.h>
-#include <NSmlDMSync.rsg>
+#include <nsmldmsync.rsg>
 #include "nsmldmsyncinternalpskeys.h"
 #include "NSmlDMSyncAppUi.h"
 #include "NSmlDMSyncApp.h"
--- a/omadm/omadmappui/src/NSmlDMSyncDialog.cpp	Thu Jul 15 18:24:21 2010 +0300
+++ b/omadm/omadmappui/src/NSmlDMSyncDialog.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -20,7 +20,7 @@
 
 #include "NSmlDMSyncDialog.h"
 #include "NSmlDMSyncUtil.h"
-#include <NSmlDMSync.rsg>
+#include <nsmldmsync.rsg>
 #include "NSmlDMSyncProfile.h"
 #include "NSmlDMSyncDebug.h"
 
--- a/omadm/omadmappui/src/NSmlDMSyncDocument.cpp	Thu Jul 15 18:24:21 2010 +0300
+++ b/omadm/omadmappui/src/NSmlDMSyncDocument.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -33,7 +33,7 @@
 #include "NSmlDMSyncProfileList.h"
 #include "NSmlDMSyncProfile.h"
 #include "NSmlDMSyncDebug.h"
-#include <NSmlDMSync.rsg>
+#include <nsmldmsync.rsg>
 #include <SyncService.h>
 #include <SyncServiceParams.h>
 #include <coreapplicationuisdomainpskeys.h>
--- a/omadm/omadmappui/src/NSmlDMSyncHandler.cpp	Thu Jul 15 18:24:21 2010 +0300
+++ b/omadm/omadmappui/src/NSmlDMSyncHandler.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -18,7 +18,7 @@
 
 
 // INCLUDES
-#include <NSmlDMSync.rsg>
+#include <nsmldmsync.rsg>
 #include <aknnotewrappers.h>
 #include <AknWaitDialog.h>
 #include <textresolver.h>   // for CTextResolver
--- a/omadm/omadmextensions/adapters/bld/bld.inf	Thu Jul 15 18:24:21 2010 +0300
+++ b/omadm/omadmextensions/adapters/bld/bld.inf	Thu Aug 19 09:42:30 2010 +0300
@@ -55,3 +55,4 @@
 #endif
 
 #include "../dcmodmadapter/group/bld.inf"
+#include "../lawmodmadapter/group/bld.inf"
Binary file omadm/omadmextensions/adapters/lawmodmadapter/conf/lawmoadapter.confml has changed
Binary file omadm/omadmextensions/adapters/lawmodmadapter/conf/lawmoadapter_2002EA22.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/omadmextensions/adapters/lawmodmadapter/data/lawmodmadapter.rss	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource file for LAWMO DM Adapter.
+*
+*/
+
+// INCLUDES
+#include <registryinfo.rh>
+#include <nsmldmconstants.h>
+
+// CONSTANTS  
+
+// MACROS  
+
+// RESOURCE DEFINITIONS 
+
+//-----------------------------------------------------------------------------
+//   
+//    theInfo
+//    -
+//
+//-----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theRegistryInfo
+    {
+    dll_uid = 0x2002EA22; // The DLL's 3rd UID.
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KNSmlDMInterfaceUid; // DM interface UID
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x2002EA23;
+                    version_no = 1;
+                    display_name = "LAWMO DM Adapter";
+                    default_data = "";
+                    opaque_data = "";
+                    }
+                };
+            }
+        };
+    }
+
+// End Of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/omadmextensions/adapters/lawmodmadapter/group/bld.inf	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* 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:  This file provides building information for DCMO DM Adapter.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_EXPORTS
+
+../conf/lawmoadapter.confml                  MW_LAYER_CONFML(lawmoadapter.confml)
+../conf/lawmoadapter_2002EA22.crml	     MW_LAYER_CRML(lawmoadapter_2002EA22.crml)
+PRJ_MMPFILES
+lawmodmadapter.mmp
+
+// End Of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/omadmextensions/adapters/lawmodmadapter/group/lawmodmadapter.mmp	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  LAWMO DM Adapter
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          lawmodmadapter.dll
+TARGETTYPE      PLUGIN
+CAPABILITY      CAP_ECOM_PLUGIN
+
+UID             0x10009D8D 0x2002EA22
+VENDORID        VID_DEFAULT
+LANG            SC
+
+SOURCEPATH      ../src
+SOURCE          lawmodmadapter.cpp
+SOURCE          lawmodmadaptermain.cpp
+SOURCE		nsmldmuri.cpp
+APP_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE     ../inc
+
+SYSTEMINCLUDE 	/epoc32/include/ecom
+
+
+START RESOURCE  ../data/lawmodmadapter.rss
+TARGET          lawmodmadapter.rsc
+LANGUAGE_IDS
+END
+
+LIBRARY         euser.lib
+LIBRARY         ecom.lib
+LIBRARY         centralrepository.lib
+LIBRARY         dmutil.lib
+STATICLIBRARY   dmutils.lib
+LIBRARY         charconv.lib
+LIBRARY		nsmldebug.lib
+LIBRARY		lawmoclient.lib
+LIBRARY         flogger.lib
+LIBRARY		syncmlclientapi.lib
+LIBRARY		nsmlprivateapi.lib
+LIBRARY 	TerminalControl.lib
+//SMPSAFE
+// End Of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/omadmextensions/adapters/lawmodmadapter/inc/TPtrC8I.h	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* 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: Implementation of terminalsecurity components
+*
+*/
+#ifndef _TPTRC8I_H_INCLUDED_
+#define _TPTRC8I_H_INCLUDED_
+
+class TPtrC8I : public TPtrC8
+	{
+	public:
+
+	inline TPtrC8I( const TDesC8 &aDes ): TPtrC8( aDes )
+		{
+		}
+
+	inline TBool operator==( const TDesC8 &aDes )
+		{
+		HBufC8* copyThis  = this->Alloc();
+		TPtr8 ptrThis     = copyThis->Des();
+
+		HBufC8* copyParam = aDes.Alloc();
+		TPtr8 ptrParam    = copyParam->Des();
+
+		ptrThis.LowerCase();
+		ptrThis.TrimAll();
+		ptrParam.LowerCase();
+		ptrParam.TrimAll();
+		TBool ret = ptrParam == ptrThis;
+		delete copyParam;
+		delete copyThis;
+
+		return ret;
+		}
+	};
+
+class TPtrC16I : public TPtrC16
+	{
+	public:
+
+	inline TPtrC16I( const TDesC16 &aDes ): TPtrC16( aDes )
+		{
+		}
+
+	inline TBool operator==( const TDesC16 &aDes )
+		{
+		HBufC16* copyThis  = this->Alloc();
+		TPtr16   ptrThis   = copyThis->Des();
+
+		HBufC16* copyParam = aDes.Alloc();
+		TPtr16   ptrParam  = copyParam->Des();
+
+		ptrThis.LowerCase();
+		ptrThis.TrimAll();
+		ptrParam.LowerCase();
+		ptrParam.TrimAll();
+		TBool ret = ptrParam == ptrThis;
+		delete copyParam;
+		delete copyThis;
+
+		return ret;
+		}
+	};
+
+#endif //_TPTRC8I_H_INCLUDED_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/omadmextensions/adapters/lawmodmadapter/inc/lawmodebug.h	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2000 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of terminalsecurity components
+*
+*/
+
+
+#ifndef _LAW_HEADER_
+#define _LAW_HEADER_
+
+#include <f32file.h>
+#include <flogger.h>
+// CONSTANTS
+_LIT( KLawLogFolderName, "law" );
+_LIT( KLawLogFileName, "law.log" );
+// MACROS
+#ifdef _DEBUG
+#define _LAW_DEBUG
+#endif
+
+#ifdef _LAW_DEBUG
+		#define RDEBUG(X)					RFileLogger::Write( KLawLogFolderName, KLawLogFileName, EFileLoggingModeAppend, _L(X) )
+		#define RDEBUG_2(X,Y)			RFileLogger::WriteFormat( KLawLogFolderName, KLawLogFileName, EFileLoggingModeAppend, _L(X),Y )	
+		#define RDEBUG_3(X,Y,Z)	  RFileLogger::WriteFormat( KLawLogFolderName, KLawLogFileName, EFileLoggingModeAppend, _L(X),Y,Z )	
+#else
+
+	#if defined (_DEBUG)
+		#define RDEBUG(X)								RDebug::Print(_L(X))
+		#define RDEBUG_2(X,Y)						RDebug::Print(_L(X),Y)
+		#define RDEBUG_3(X,Y,Z)					RDebug::Print(_L(X),Y,Z)
+	#else
+		#define RDEBUG(X)								
+		#define RDEBUG_2(X,Y)						
+		#define RDEBUG_3(X,Y,Z)	
+	#endif // _DEBUG
+	
+#endif // _LAW_DEBUG
+
+#endif // _LAW_HEADER_
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/omadmextensions/adapters/lawmodmadapter/inc/lawmodmadapter.h	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,562 @@
+/*
+* 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:  LAWMO DM Adapter
+*
+*/
+
+#ifndef __LAWMODMADAPTER_H
+#define __LAWMOMADAPTER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <smldmadapter.h>
+#include <centralrepository.h>
+#include "lawmoclient.h"
+#include <dcmoconst.h>
+
+const TInt KMaxBufferLength = 256;
+
+_LIT8( KMimeType, "text/plain" );
+_LIT8( KNSmlLAWMOAdapterTitle,      "LAWMO DM Adapter" );
+_LIT8( KNSmlTrue,					"true" );
+_LIT8( KNSmlFalse,					"false" );
+_LIT8( KLAWMODMAdapterVersion, "1.0" ); // Adapter version
+
+//DDF accepted DM-fieldnames
+_LIT8( KNSmlDdfState,				"State" );
+_LIT8( KNSmlDdfAvailWipeList,		"AvailableWipeList" );
+_LIT8( KNSmlDdfListItemName,		"ListItemName" );
+_LIT8( KNSmlDdfToBeWiped,           "ToBeWiped" );
+_LIT8( KNSmlDdfOperations,			"Operations" );
+_LIT8( KNSmlDdfFullyLock,		    "FullyLock" );
+_LIT8( KNSmlDdfPartLock,			"PartiallyLock" );
+_LIT8( KNSmlDdfUnlock,	            "UnLock" );
+_LIT8( KNSmlDdfFactoryReset,		"FactoryReset" );
+_LIT8( KNSmlDdfWipe,			    "Wipe" );
+_LIT8( KNSmlDdfEnable,				"Enable" );
+_LIT8( KNSmlDdfDisable,				"Disable" );
+_LIT8( KNSmlDdfOpExt,				"Ext" ); 
+_LIT8( KNSmlDdfOpExtWipeAll,	    "WipeAll" );
+_LIT8( KNSmlDdfLawMoConfig,         "LAWMOConfig" );
+
+//DDF DM-field descriptions
+_LIT8( KNSmlDdfStateDescription,             "State of LAWMO" );
+_LIT8( KNSmlDdfAWLDescription,               "Available WipeList node" );
+_LIT8( KNSmlDdfDynNodeDescription,           "Dynamic node" );
+_LIT8( KNSmlDdfListDescription,              "Name of List Item" );
+_LIT8( KNSmlDdfToWipeDescription,            "Item to be wiped or not" );
+_LIT8( KNSmlDdfOperationsDescription,        "Operations node" );
+_LIT8( KNSmlDdfFullLockDescription,          "Fully lock operation" );
+_LIT8( KNSmlDdfPartLockDescription,          "Partially lock operation" );
+_LIT8( KNSmlDdfUnlockDescription,            "Unlock operation" );
+_LIT8( KNSmlDdfFactResetDescription,         "Factory Reset operation" );
+_LIT8( KNSmlDdfWipeDescription,              "Wipe operation" );
+_LIT8( KNSmlDdfExtDescription ,              "Extra Operations " );
+_LIT8( KNSmlDdfOpExtDescription,             "Wipe All Operation" );
+_LIT8( KNSmlDdfLawConfigDescription,         "Configuration node" );
+
+
+_LIT8( KLawmoMatch2,                                          "/" );
+_LIT8( KSegmLawmo,                                            "AvailableWipeList/Ext/LAWMOConfig/Operations/State");
+_LIT8( KLawmoAvWipe,                                          "AvailableWipeList" );
+_LIT8( KLawmoAvWipe2,                                         "AvailableWipeList/*" );
+_LIT8( KSegmLawmo2,                                            "Messages");
+_LIT8( KSegmLawmo3,                                            "ListItemName/ToBeWiped");
+_LIT8( KLawmoOperationsMatch,                                   "Operations");
+_LIT8( KSegmLawmoOperations,                                    "FactoryReset/FullyLock/PartiallyLock/UnLock/Wipe");
+_LIT8( KLawmoOperationsExtMatch,                                "Ext");
+
+_LIT8( KLawmoMetatype,          "urn:oma:at:lawmo:1.0:OperationComplete" );
+_LIT8( KLawmoMetaformat,        "text/plain" );
+_LIT8( KLawmoMetamark,          "warning" );
+
+// CLASS DECLARATION
+
+/**
+* Adapter class
+* Provides DM adapter interface
+*/
+class CLawmoDMAdapter : public CSmlDmAdapter
+    {
+    
+    public: // Constructors, destructor
+        /**
+        * Create instance of CLawmoDMAdapter
+        * @param aDmCallBack
+        * @return Instance of CLawmoDMAdapter
+        */    
+        static CLawmoDMAdapter* NewL( MSmlDmCallback* aDmCallback );
+
+        /**
+        * Create instance of CLawmoDMAdapter
+        * @param aDmCallBack
+        * @return Instance of CLawmoDMAdapter
+        */   
+        static CLawmoDMAdapter* NewLC( MSmlDmCallback* aDmCallback );
+
+        /**
+        * C++ Destructor
+        */
+        virtual ~CLawmoDMAdapter();
+
+    public:
+	    /**
+	    * The function returns current version of the DDF.
+	    * By asking current DDF versions from adapters DM Module can control
+	    * possible changes in the data structure and send the changed DDF
+	    * description to a management server.
+	    * This function is always called after DDFStructureL.
+        * @param aVersion DDF version of the adapter. (filled by the adapter)
+	    * @publishedPartner
+	    * @prototype
+	    */
+	    void DDFVersionL( CBufBase& aVersion );
+	
+	    /**
+	    * The function for filling the DDF structure of the adapter
+	    * This function is only called once, immediately after the adapter is created.
+	    * @param aDDFObject	Reference to root object. A DM adapter starts filling
+		         the data structure by calling AddChildObjectL to the root object and
+				 so describes the DDF of the adapter. 
+	    * @publishedPartner
+	    * @prototype
+	    */
+        void DDFStructureL( MSmlDmDDFObject& aDDF );
+	
+	    /**
+	    * The function creates new leaf objects, or replaces data in existing leaf
+	    * objects. The information about the success of the command should be
+	    * returned by calling SetStatusL function of MSmlDmCallback callback
+	    * interface. This makes it possible to buffer the commands. However, all
+	    * the status codes for buffered commands must be returned at the latest when
+	    * the adapter's CompleteOutstandingCmdsL() is called.
+	    * @param aURI			URI of the object
+	    * @param aLUID		LUID of the object (if the adapter has earlier returned a
+	 	     				LUID to the DM Module). For new objects, this is the LUID
+ 			    			inherited through the parent node.
+ 	    * @param aObject		Data of the object. 
+	    * @param aType		MIME type of the object
+	    * @param aStatusRef	Reference to correct command, i.e. this reference
+	 					must be used when calling the SetStatusL of this command
+	    * @publishedPartner
+	    * @prototype
+	    */
+	    void UpdateLeafObjectL( const TDesC8& aURI, 
+	                            const TDesC8& aLUID,
+			                    const TDesC8& aObject, 
+			 				    const TDesC8& aType,
+							    TInt aStatusRef 
+							  );
+		
+        /**
+	    * The function creates new leaf objects, or replaces data in existing leaf
+	    * objects, in the case where data is large enough to be streamed. The
+	    * information about the success of the command should be returned by calling
+	    * SetStatusL function of MSmlDmCallback callback interface. This makes it
+	    * possible to buffer the commands.  However, all the status codes for buffered
+	    * commands must be returned at the latest when the CompleteOutstandingCmdsL()
+	    * of adapter is called.
+	    * @param aURI		URI of the object
+	    * @param aLUID		LUID of the object (if the adapter has earlier returned a
+    						LUID to the DM Module). For new objects, this is the LUID
+	    					inherited through the parent node.
+	    * @param aStream	Data of the object. Adapter should create write stream
+		    				and return, when data is written to stream by DM agent,
+			    			StreamCommittedL() is called by DM engine
+	    * @param aType		MIME type of the object
+	    * @param aStatusRef	Reference to correct command, i.e. this reference
+    						must be used when calling the SetStatusL of this
+		    				command.
+	    * @publishedPartner
+	    * @prototype
+	    */
+	    void UpdateLeafObjectL( const TDesC8& aURI, 
+	                            const TDesC8& aLUID,
+								RWriteStream*& aStream, 
+								const TDesC8& aType,
+		 						TInt aStatusRef 
+		 				      );
+	    
+	    
+	    TInt InternalUpdateObjectL( const TDesC8& aURI, 
+                                    const TDesC8& /*aLUID*/,
+                                    const TDesC8& aObject, 
+                                    const TDesC8& /*aType*/,
+                                    TInt aStatusRef );
+	    /**
+	    * The function deletes an object and its child objects. The SetStatusL
+	    * should be used as described in UpdateLeafObjectL()
+	    * @param aURI		URI of the object
+	    * @param aLUID		LUID of the object (if the adapter have earlier returned
+    						LUID to the DM Module).
+	    * @param aStatusRef	Reference to correct command, i.e. this reference must
+						be used when calling the SetStatusL of this command.
+        * @publishedPartner
+	    * @prototype
+	    */
+	    void DeleteObjectL( const TDesC8& aURI, 
+	                        const TDesC8& aLUID,
+							TInt aStatusRef 
+					      );
+	
+	    /**
+	    * The function fetches data of a leaf object. The SetStatusL should be used
+	    * as described in UpdateLeafObjectL(). The data is returned by using the
+	    * SetResultsL function of MSmlCallback callback interface, and may be streamed.
+	    * @param aURI			URI of the object
+	    * @param aLUID			LUID of the object (if the adapter have earlier
+    							returned LUID to the DM Module).   
+	    * @param aType 			MIME type of the object
+	    * @param aResultsRef	Reference to correct results, i.e. this reference
+    							must be used when returning the result by calling
+	    						the SetResultsL.
+	    * @param aStatusRef		Reference to correct command, i.e. this reference
+		    					must be used when calling the SetStatusL of this
+    							command.
+	    * @publishedPartner
+	    * @prototype
+	    */
+	    void FetchLeafObjectL( const TDesC8& aURI, 
+	                           const TDesC8& aLUID,
+							   const TDesC8& aType, 
+							   TInt aResultsRef,
+							   TInt aStatusRef 
+							 );
+	    
+	    TInt InternalFetchObjectL(  const TDesC8& aURI, 
+                                    const TDesC8& aLUID, const TDesC8& aType, 
+                                    CBufFlat* aObject,
+                                    TInt aStatusRef );
+	    
+	    /**
+	    * The function fetches the size of the data of a leaf object. The size is
+	    * in bytes, and must reflect the number of bytes that will be transferred
+	    * when the framework calls FetchLeafObjectL. The SetStatusL should be used
+	    * as described in FetchLeafObjectL(). The size value is returned by using
+	    * the SetResultsL function of MSmlCallback callback interface, and must be
+	    * a decimal integer expressed as a string, eg. "1234".
+	    * Results from this call MUST NOT be streamed.
+	    * @param aURI			URI of the object
+	    * @param aLUID			LUID of the object (if the adapter have earlier
+    							returned LUID to the DM Module).   
+	    * @param aType 			MIME type of the object
+	    * @param aResultsRef	Reference to correct results, i.e. this reference
+    							must be used when returning the result by calling
+	    						the SetResultsL.
+	    * @param aStatusRef		Reference to correct command, i.e. this reference
+     							must be used when calling the SetStatusL of this
+	    						command.
+	    * @publishedPartner
+	    * @prototype
+	    */
+	    void FetchLeafObjectSizeL( const TDesC8& aURI, 
+	                               const TDesC8& aLUID,
+								   const TDesC8& aType, 
+								   TInt aResultsRef,
+								   TInt aStatusRef 
+								 );
+	    /**
+	    * The function fetches URI list. An adapter returns the list of URI segments
+	    * under the given URI be separated by slash ("/"). The URI segment names for
+	    * new objects must be given by the adapter.
+	    * The list is returned by calling the SetResultsL function of MSmlCallback
+	    * callback interface.	Results from this call MUST NOT be streamed.
+	    * @param aParentURI					URI of the parent object
+	    * @param aParentLUID				LUID of the parent object (if the
+    										adapter have earlier returned LUID to
+		    								the DM Module).   
+	    * @param aPreviousURISegmentList	URI list with mapping LUID information,
+			    							which is known by DM engine. An adapter
+				    						can use this information when verifying
+					    					if old objects still exists. An adapter
+						    				also knows what objects are new to DM
+							    			engine and can provide LUID mapping for
+								    		them. aPreviousURISegmentList parameter
+									    	(see above) helps to recognise new
+    										objects.
+	    * @param aResultsRef				Reference to correct results, i.e. this
+    										reference must be used when returning
+	    									the result by calling the SetResultsL.
+	    * @param aStatusRef					Reference to correct command, i.e. this
+		    								reference must be used when calling the
+			    							SetStatusL of this command.
+	    * @publishedPartner
+	    * @prototype
+	    */
+	    void ChildURIListL( const TDesC8& aURI, 
+	                        const TDesC8& aLUID,
+					        const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList,
+					        TInt aResultsRef, 
+					        TInt aStatusRef 
+					      );
+	
+        /**
+	    * The function adds node object. In some cases an implementation of the
+	    * function may be empty function, if the node object does not need concrete
+	    * database update. Still this function may be helpful to an adapter, i.e. in
+	    * passing mapping LUID of the node to DM Module. The SetStatusL should be
+	    * used as described in UpdateLeafObjectL()
+	    * @param aURI			URI of the object
+	    * @param aParentLUID	LUID of the parent object (if the adapter have
+     							earlier returned LUID to the DM Module).   
+	    * @param aStatusRef		Reference to correct command, i.e. this reference
+		    					must be used when calling the SetStatusL of this
+			    				command.
+	    * @publishedPartner
+	    * @prototype
+	    */
+	    void AddNodeObjectL( const TDesC8& aURI, 
+	                         const TDesC8& aParentLUID,
+		  					 TInt aStatusRef 
+		  				   );
+
+	    /**
+	    * The function implements execute command. The information about the success
+	    * of the command should be returned by calling SetStatusL function of
+	    * MSmlDmCallback callback interface. This makes it possible to buffer the
+	    * commands.
+	    * However, all the status codes for buffered commands must be returned at
+	    * the latest when the CompleteOutstandingCmdsL() of adapter is called.
+	    * @param aURI			URI of the command
+	    * @param aLUID			LUID of the object (if the adapter have earlier
+    							returned LUID to the DM Module).   
+	    * @param aArgument		Argument for the command
+	    * @param aType			MIME type of the object 
+	    * @param aStatusRef		Reference to correct command, i.e. this reference
+    							must be used when calling the SetStatusL of this
+	    						command.
+	    * @publishedPartner
+	    * @prototype
+	    */
+	    void ExecuteCommandL( const TDesC8& aURI, 
+	                          const TDesC8& aLUID,
+							  const TDesC8& aArgument, 
+							  const TDesC8& aType,
+							  TInt aStatusRef 
+							);
+
+	    /**
+	    * The function implements execute command. The information about the
+	    * success of the command should be returned by calling SetStatusL function
+	    * of MSmlDmCallback callback interface. This makes it possible to buffer the
+	    * commands.
+	    * However, all the status codes for buffered commands must be returned at
+	    * the latest when the CompleteOutstandingCmdsL() of adapter is called.
+	    * @param aURI			URI of the command
+	    * @param aLUID			LUID of the object (if the adapter have earlier
+    							returned LUID to the DM Module).   
+	    * @param aStream		Argument for the command. Adapter should create
+		    					write stream and return, when data is written to
+			    				stream by DM agent, StreamCommittedL() is called by
+				    			DM engine
+	    * @param aType			MIME type of the object 
+	    * @param aStatusRef		Reference to correct command, i.e. this reference
+    							must be used when calling the SetStatusL of this
+	    						command.
+	    * @publishedPartner
+	    * @prototype
+	    */
+	    void ExecuteCommandL( const TDesC8& aURI, 
+	                          const TDesC8& aLUID,
+							  RWriteStream*& aStream, 
+							  const TDesC8& aType,
+							  TInt aStatusRef 
+							);
+
+	    /**
+	    * The function implements copy command. The information about the success of
+	    * the command should be returned by calling SetStatusL function of
+	    * MSmlDmCallback callback interface. This makes it possible to buffer the
+	    * commands.
+	    * However, all the status codes for buffered commands must be returned at
+	    * the latest when the CompleteOutstandingCmdsL() of adapter is called.
+	    * @param aTargetURI		Target URI for the command
+	    * @param aSourceLUID	LUID of the target object (if one exists, and if the adapter
+    							has	earlier returned a LUID to the DM Module).   
+	    * @param aSourceURI		Source URI for the command
+	    * @param aSourceLUID	LUID of the source object (if the adapter has
+    							earlier returned a LUID to the DM Module).   
+	    * @param aType			MIME type of the objects
+	    * @param aStatusRef		Reference to correct command, i.e. this reference
+    							must be used when calling the SetStatusL of this
+	    						command.
+	    * @publishedPartner
+	    * @prototype
+	    */
+	    void CopyCommandL( const TDesC8& aTargetURI, 
+	                       const TDesC8& aTargetLUID,
+						   const TDesC8& aSourceURI, 
+						   const TDesC8& aSourceLUID,
+						   const TDesC8& aType, 
+						   TInt aStatusRef 
+						 );
+
+	    /**
+	    * The function indicates start of Atomic command.
+	    * @publishedPartner
+	    * @prototype
+	    */
+	    void StartAtomicL();
+	
+	    /**
+	    * The function indicates successful end of Atomic command. The adapter
+	    * should commit all changes issued between StartAtomicL() and
+	    * CommitAtomicL()
+	    * @publishedPartner
+	    * @prototype
+	    */
+	    void CommitAtomicL();
+	
+	    /**
+	    * The function indicates unsuccessful end of Atomic command. The adapter
+	    * should rollback all changes issued between StartAtomicL() and
+	    * RollbackAtomicL(). If rollback fails for a command, adapter should use
+	    * SetStatusL() to indicate it.
+	    * @publishedPartner
+	    * @prototype
+	    */
+	    void RollbackAtomicL();
+	
+	    /**
+        * Returns ETrue if adapter supports streaming otherwise EFalse.
+	    * @param aItemSize size limit for stream usage
+        * @return TBool ETrue for streaming support
+	    * @publishedPartner
+	    * @prototype
+        */
+	    TBool StreamingSupport( TInt& aItemSize );
+	
+	    /**
+        * Called when stream returned from UpdateLeafObjectL or ExecuteCommandL has
+	    * been written to and committed. Not called when fetching item.
+	    * @publishedPartner
+	    * @prototype
+        */	
+	    void StreamCommittedL();
+	
+	    /**
+	    * The function tells the adapter that all the commands of the message that
+	    * can be passed to the adapter have now been passed.  This indicates that
+	    * the adapter must supply status codes and results to any buffered commands.
+	    * This must be done at latest by the time this function returns.
+	    * This function is used at the end of SyncML messages, and during processing
+	    * of Atomic.   In the case of Atomic processing, the function will be
+	    * followed by a call to CommitAtomicL or RollbackAtomicL.
+	    * @publishedPartner
+	    * @prototype
+	    */
+	    void CompleteOutstandingCmdsL();
+
+    private: // New methods
+    	
+    	/**
+	    * The function fills the adapter node with the details
+	    * @publishedPartner
+	    * @prototype
+	    */
+        void FillNodeInfoL( MSmlDmDDFObject& aDDFObject, 
+                                            TSmlDmAccessTypes& aAccessTypes, 
+                                            MSmlDmDDFObject::TScope aScope,
+                                            MSmlDmDDFObject::TDFFormat aFormat, 
+                                            MSmlDmDDFObject::TOccurence aOccurence,
+                                            const TDesC8& aDescription,
+                                            const TDesC8& aMIMEType );
+        
+        /**
+	    * This function constructs the DDFnode with the details 
+	    * @publishedPartner
+	    * @prototype
+	    */ 
+        void FillLAWMODDFL(MSmlDmDDFObject& aDDF);   
+        
+        // Fills the DDFnode details with the dynamic node info
+        
+        void FillDynamicNodeL(MSmlDmDDFObject& aDDF); 
+        
+        /**
+    	* Maps a system wide error code to a TError.
+    	* @param aError A system wide error code.
+    	* @return A TError value depending on aError.
+    	*/
+    	CSmlDmAdapter::TError MapErrorToStatus( TInt aError ) const;    
+    	
+    	// Issues a lock request using tarm 3rd party api
+    	TLawMoStatus LockDeviceL();
+    	
+    	// Issues a Unlock request using tarm 3rd party api
+    	TLawMoStatus UnLockDeviceL();
+    	
+    	// Gets the current Lawmo state store in the cenrep
+    	TLawMoStatus GetStateL(TInt& aState);
+                         	
+    private: // Constructor
+        /**
+        * Symbian 2nd phase constructor
+        */
+        void ConstructL();
+
+        /**
+        * C++ Constructor
+        */    
+        CLawmoDMAdapter( TAny* aEcomArguments );
+        
+        // Sends the Generic alert for wipe command
+        void SendGenericAlertL();
+        
+        // Updates the current server id to the store
+        void SetCurrentServerIdL();
+        
+        // Checks if the current profile doing the operation
+        // is a factory profile
+        TBool IsFactoryProfileL();
+        
+    private: // Data
+        
+        enum TNodeIdentifier
+            {
+            ENodeLawMo = 0,
+            ENodeState,
+            ENodeAvWipeList,
+            ENodeDynamic,
+            ENodeItemName,
+            ENodeToBeWiped,
+            ENodeOperations,
+            ENodePartLock,
+            ENodeUnlock,
+            ENodeWipe,
+            ENodeExt,
+            ENodeWipeAll,
+            ENodeNotUsedAndAlwaysLast
+            };
+        
+        enum TLawmoState
+            {
+            EFullLocked = 10,
+            EPartialLocked = 20,
+            EUnlocked = 30
+            };
+        
+        RLawmoClient ilawmoSession;
+        TBool iConnected;
+        TBuf8<KMaxBufferLength> iRootNode;        
+
+    private:        
+        // Gets the current node based on the URI
+        TNodeIdentifier GetNodeIdentifier(const TDesC8& aURI);
+        
+    };
+
+#endif // __DCMODMADAPTER_H
+
+// End Of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/omadmextensions/adapters/lawmodmadapter/inc/nsmldmuri.h	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  DM tree etc.
+*
+*/
+
+
+
+#ifndef __NSMLDMURI_H
+#define __NSMLDMURI_H
+
+#include <e32std.h>
+#include <e32base.h>
+
+#define KNSmlDMUriSeparator '/'
+_LIT8(KNSmlDmRootUri, ".");
+_LIT8(KNSmlDmUriDotSlash, "./");
+//_LIT8( KNSmlDmQuestionMark, "?" );
+//#define KNSmlDMMappingSeparator '&'
+//#define KNSmlDMAclSeparator '+'
+//#define KNSmlDMAclUriSeparator 0xa
+//#define KNSmlDMAclCommandSeparator '&'
+
+// Choose one depending on library type
+#define STATIC_DMUTILS_LIB 1
+//#define DYNAMIC_DMUTILS_LIB 1
+
+#ifdef STATIC_DMUTILS_LIB
+#define NSMLDMURI_IMPORT_C
+#define NSMLDMURI_EXPORT_C
+#else
+#define NSMLDMURI_IMPORT_C IMPORT_C
+#define NSMLDMURI_EXPORT_C EXPORT_C
+#endif
+
+// ===========================================================================
+// NSmlDmURI
+// ===========================================================================
+class NSmlDmURI
+	{
+	public:
+	//static TPtrC8 ParentURI(const TDesC8& aURI);
+	//static TPtrC8 LastURISeg(const TDesC8& aURI);
+	static TPtrC8 RemoveDotSlash(const TDesC8& aURI);
+	//static TPtrC8 RemoveProp(const TDesC8& aURI);
+	static TPtrC8 RemoveFirstSeg(const TDesC8& aURI);
+	static TPtrC8 URISeg(const TDesC8& aURI,TInt aLocation,TInt aSegCount=1);
+	static TInt NumOfURISegs(const TDesC8& aURI);
+	};
+
+#endif // __NSMLDMURI_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/omadmextensions/adapters/lawmodmadapter/src/lawmodmadapter.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,1340 @@
+/*
+* 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:  DCMO DM Adapter implementation
+*
+*/
+
+// INCLUDE
+#include <implementationproxy.h>
+#include <smldmadapter.h>
+#include <centralrepository.h>
+#include <e32base.h>
+#include <ecom.h>
+#include <utf.h>
+#include <LawmoAdapterCRKeys.h>
+#include <DevManInternalCRKeys.h>
+#include <SyncMLClientDM.h>  // syncmlclientapi.lib
+#include <NSmlPrivateAPI.h> // Generic alert
+#include <nsmlconstants.h>
+#include <TerminalControl3rdPartyAPI.h>
+#include <coreapplicationuisdomainpskeys.h>
+#include <LAWMOInterface.h>
+//User Include
+#include "lawmodmadapter.h"
+#include "nsmldebug.h"
+#include "nsmldmuri.h"
+#include "TPtrC8I.h"
+#include "lawmodebug.h"
+// CONSTANTS
+
+#define MAXBUFLEN 255
+
+// ============================= MEMBER FUNCTIONS =============================
+
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::NewL
+// Symbian 1st phase contructor
+// (static, may leave)
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+CLawmoDMAdapter* CLawmoDMAdapter::NewL( MSmlDmCallback* aCallback )
+    {
+    RDEBUG( "CLawmoDMAdapter NewL: begin"  );
+    CLawmoDMAdapter* self = NewLC( aCallback );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::NewLC
+// Symbian 1st phase contructor. Push object to cleanup-stack
+// (static, may leave)
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+CLawmoDMAdapter* CLawmoDMAdapter::NewLC( MSmlDmCallback* aCallback )
+    {
+    	RDEBUG( "CLawmoDMAdapter NewLC : begin"  );
+    	CLawmoDMAdapter* self = new ( ELeave ) CLawmoDMAdapter( aCallback );
+    	CleanupStack::PushL( self );
+    	self->ConstructL();
+    	RDEBUG( "CLawmoDMAdapter NewLC : end"  );
+    	return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::CLawmoDMAdapter()
+// C++ Constructor
+// Status : Draft
+// ----------------------------------------------------------------------------
+CLawmoDMAdapter::CLawmoDMAdapter( TAny* aEcomArguments )
+    : CSmlDmAdapter::CSmlDmAdapter( aEcomArguments )
+    {
+    	RDEBUG( "CLawmoDMAdapter default constructor"  );
+    }
+
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::ConstructL
+// 2nd phase contructor
+// (may leave)
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+void CLawmoDMAdapter::ConstructL()
+    {
+    	RDEBUG( "CLawmoDMAdapter::ConstructL"  );
+        User::LeaveIfError( ilawmoSession.Connect() );
+        RDEBUG( "CLawmoDMAdapter::session connected"  );
+        iRootNode.Zero();
+        TBuf<MAXBUFLEN> temp; 
+        CRepository *repository=CRepository::NewLC ( KCRUidLawmoAdapter );
+        repository->Get(KLawmoRootNode,temp);
+        iRootNode.Copy(temp);
+        CleanupStack::PopAndDestroy();
+    }
+
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::~CLawmoDMAdapter()
+// C++ Destructor
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+CLawmoDMAdapter::~CLawmoDMAdapter()
+    {
+    	RDEBUG( "CLawmoDMAdapter Destructor"  );
+    	ilawmoSession.Close();
+    }
+
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::DDFVersionL
+// Return DM plug-in version
+// (may leave)
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+void CLawmoDMAdapter::DDFVersionL( CBufBase& aDDFVersion )
+    {
+    // Insert version information
+    RDEBUG( "CLawmoDMAdapter::DDFVersionL" );
+    aDDFVersion.InsertL( 0, KLAWMODMAdapterVersion );
+    }
+
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::DDFStructureL
+// Return DM plug-in structure
+// (may leave)
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+void CLawmoDMAdapter::DDFStructureL( MSmlDmDDFObject& aDDF )
+    {
+    // Declare accesses
+    RDEBUG( "CLawmoDMAdapter::DDFStructureL begin" );
+    TSmlDmAccessTypes accessTypes;
+    accessTypes.SetGet();    
+    
+    // Create root node 
+    MSmlDmDDFObject& root = aDDF.AddChildObjectL( iRootNode );
+    FillNodeInfoL( root,
+                   accessTypes,
+                   MSmlDmDDFObject::EPermanent,
+                   MSmlDmDDFObject::ENode,
+                   MSmlDmDDFObject::EOne,
+                   KNullDesC8(),
+                   KMimeType );
+                   
+   	root.SetDFTitleL( KNSmlLAWMOAdapterTitle );
+                   
+   	FillLAWMODDFL(root);
+   	RDEBUG( "CLawmoDMAdapter::DDFStructureL end" );
+
+    }
+
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::StreamingSupport
+// Return streaming support status, set supported item size
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+TBool CLawmoDMAdapter::StreamingSupport( TInt& /* aItemSize */ )
+    {
+    // Not supported
+    RDEBUG( "CLawmoDMAdapter::StreamingSupport"  );
+    return EFalse;
+    }
+    
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::StreamCommittedL
+// Commit stream buffer
+// (may leave)
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+void CLawmoDMAdapter::StreamCommittedL()
+    {        
+    RDEBUG("CLawmoDMAdapter::StreamCommitted"  );
+    // Intentionally left empty 
+    }
+
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::CompleteOutstandingCmdsL
+// Complete outstanding commands
+// (may leave)
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+void CLawmoDMAdapter::CompleteOutstandingCmdsL()
+    {
+    RDEBUG( "CLawmoDMAdapter::CompleteOutstandingCmdsL"  );
+    }
+
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::FillNodeInfoL
+// Fill node info
+// (may leave)
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+void CLawmoDMAdapter::FillNodeInfoL( MSmlDmDDFObject& aDDFObject, 
+                                     TSmlDmAccessTypes& aAccessTypes, 
+                                     MSmlDmDDFObject::TScope aScope,
+                                     MSmlDmDDFObject::TDFFormat aFormat, 
+                                     MSmlDmDDFObject::TOccurence aOccurence,
+                                     const TDesC8& aDescription,
+                                     const TDesC8& aMIMEType )
+    {
+    RDEBUG( "CLawmoDMAdapter::FillNodeInfoL - begin"  );
+    aDDFObject.SetAccessTypesL( aAccessTypes );
+    aDDFObject.SetScopeL( aScope );
+    aDDFObject.SetOccurenceL( aOccurence );
+    aDDFObject.SetDFFormatL( aFormat );
+    aDDFObject.SetDescriptionL( aDescription );
+    if ( aFormat != MSmlDmDDFObject::ENode )
+        {
+        aDDFObject.AddDFTypeMimeTypeL( aMIMEType );
+        }
+    RDEBUG( "CLawmoDMAdapter::FillNodeInfoL - end"  );    
+    }
+
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::CopyCommandL
+// Copy object
+// (may leave)
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+void CLawmoDMAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, 
+                                    const TDesC8& /*aTargetLUID*/,
+                                    const TDesC8& /*aSourceURI*/, 
+                                    const TDesC8& /*aSourceLUID*/,
+                                    const TDesC8& /*aType*/, 
+                                    TInt aStatusRef )
+    {
+    // Not supported
+    RDEBUG( "CLawmoDMAdapter::CopyCommandL"  );
+    Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+    }
+
+// ----------------------------------------------------------------------------
+// DeleteObjectL
+// Delete object
+// (may leave)
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+void CLawmoDMAdapter::DeleteObjectL( const TDesC8& /* aURI */, 
+                                     const TDesC8& /* aLUID */,
+                                     TInt aStatusRef )
+
+    {
+    // Not supported
+    RDEBUG( "CLawmoDMAdapter::DeleteObjectL"  );
+    Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+    }
+    
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::FetchLeafObjectL
+// Fetch leaf
+// (may leave)
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+void CLawmoDMAdapter::FetchLeafObjectL( const TDesC8& aURI, 
+                                        const TDesC8& aLUID,
+								        const TDesC8& aType, 
+								        TInt aResultsRef,
+								        TInt aStatusRef )
+    {
+    RDEBUG("CLawmoDMAdapter::FetchLeafObjectL() Begin");
+    
+    TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI );
+    CBufFlat *lObject = CBufFlat::NewL( MAXBUFLEN );
+    CleanupStack::PushL( lObject );
+    lObject->Reset();
+    
+    TInt err = InternalFetchObjectL( uriPtrc, aLUID, aType, lObject, aStatusRef );
+    
+    if((err == ELawMoSuccess)||(err == ELawMoOk))
+    Callback().SetResultsL( aResultsRef, *lObject, aType );
+    
+    CSmlDmAdapter::TError status =  MapErrorToStatus( err );
+
+    Callback().SetStatusL( aStatusRef, status );
+    CleanupStack::PopAndDestroy( lObject );
+    RDEBUG("CLawmoDMAdapter::FetchLeafObjectL() End");
+    }
+
+// ----------------------------------------------------------------------------
+//InternalFetchObjectL
+// ----------------------------------------------------------------------------
+
+TInt CLawmoDMAdapter::InternalFetchObjectL( const TDesC8& aURI, 
+                                              const TDesC8& /*aLUID*/,
+                                              const TDesC8& /*aType*/, 
+                                              CBufFlat* aObject,
+                                              TInt aStatusRef )
+    {    
+    RDEBUG("CLawmoDMAdapter::InternalFetchObjectL() Begin");
+    CLawmoDMAdapter::TNodeIdentifier identifier = GetNodeIdentifier(aURI);
+    TInt numOfSegs = NSmlDmURI::NumOfURISegs( aURI ) ;
+    TInt err (ELawMoInvalid);
+
+    switch(identifier)
+       {
+       
+       case CLawmoDMAdapter::ENodeState:
+            {
+            RDEBUG("CLawmoDMAdapter::InternalFetchObjectL ENodeState");
+            TInt state;
+            err = GetStateL(state);
+            TBuf8<MAXBUFLEN> tmp;
+            tmp.Num(state);
+            aObject->InsertL(aObject->Size(),tmp);
+            }
+       break;
+        
+       case CLawmoDMAdapter::ENodeItemName:
+           {
+           RDEBUG("CLawmoDMAdapter::InternalFetchObjectL ENodeItemName");
+           TBuf<MAXBUFLEN> val;
+           TBuf<MAXBUFLEN> property;
+           TPtrC8 seg = NSmlDmURI::URISeg(aURI, numOfSegs-2);
+		   property.Copy(seg);
+           err = ilawmoSession.GetListItemName(property, val);
+           TBuf8<MAXBUFLEN> tmp;
+           tmp.Copy(val);
+           aObject->InsertL(aObject->Size(),tmp);
+           }
+       break;
+       
+       case CLawmoDMAdapter::ENodeToBeWiped:
+           {
+           RDEBUG("CLawmoDMAdapter::InternalFetchObjectL ENodeToBeWiped");
+           TBool val;
+           TBuf<MAXBUFLEN> property;
+           TPtrC8 seg = NSmlDmURI::URISeg(aURI, numOfSegs-2);
+		   property.Copy(seg);
+           err = ilawmoSession.GetToBeWipedValue(property, val);
+           TBuf8<MAXBUFLEN> tmp;           
+           if(val)
+               tmp.Copy(KNSmlTrue);
+           else
+               tmp.Copy(KNSmlFalse);
+           aObject->InsertL(aObject->Size(),tmp);
+           }
+       break;
+       
+       case CLawmoDMAdapter::ENodeWipe:
+           {
+           RDEBUG("CLawmoDMAdapter::InternalFetchObjectL ENodeWipe");
+           err = ELawMoSuccess;
+           TBuf8<MAXBUFLEN> tmp;
+           tmp.Zero();
+           RDEBUG("CLawmoDMAdapter::InternalFetchObjectL Null value return");
+           aObject->InsertL(aObject->Size(),tmp);
+           }
+           break;
+       default:
+           err = ELawMoUnknown;
+       break;
+       
+       }
+     RDEBUG("CLawmoDMAdapter::InternalFetchObjectL() End");
+     return err;     
+    }
+    
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::FetchLeafObjectSizeL
+// Calculate leaf object size
+// (may leave)
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+void CLawmoDMAdapter::FetchLeafObjectSizeL( const TDesC8& /* aURI */, 
+                                            const TDesC8& /* aLUID */,
+									        const TDesC8& /* aType */, 
+									        TInt /* aResultsRef */,
+									        TInt aStatusRef )
+    {
+    RDEBUG( "CLawmoDMAdapter::FetchLeafObjectSizeL"  );
+    MSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
+    // Respond
+    Callback().SetStatusL( aStatusRef, retValue );
+    }    
+
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::ChildURIListL
+// Create child URI list
+// (may leave)
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+void CLawmoDMAdapter::ChildURIListL( const TDesC8& aURI, 
+                                     const TDesC8& /* aLUID */,
+					                 const CArrayFix<TSmlDmMappingInfo>& /* aPreviousURISegmentList */,
+            					     TInt aResultsRef, 
+            					     TInt aStatusRef )
+    {
+    RDEBUG( "CLawmoDMAdapter::ChildURIListL - begin"  );
+    MSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
+    CBufBase *currentURISegmentList = CBufFlat::NewL( MAXBUFLEN );
+	CleanupStack::PushL( currentURISegmentList );
+	// Bcoz root node is configurable, remove the node for this operation.
+    TPtrC8 uriPtrc = NSmlDmURI::RemoveFirstSeg(aURI);
+    
+    if( uriPtrc == KNullDesC8)
+    {	
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmLawmo );
+        Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EOk );
+        Callback().SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 );
+        CleanupStack::PopAndDestroy(  ); // currentURISegmentList
+        RDEBUG( "CLawmoDMAdapter::ChildURIListL(): end" );
+        return;
+    }
+    else if( ( aURI.Match( KLawmoAvWipe ) != KErrNotFound ) &&
+            (aURI.Match( KLawmoAvWipe2 ) == KErrNotFound ))
+        {
+          currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmLawmo2 );
+        }
+    else if( ( aURI.Match( KLawmoAvWipe2 ) != KErrNotFound ))
+        {
+          currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmLawmo3 );
+        }
+    // Operations    
+    else if(( aURI.Match( KLawmoOperationsMatch ) != KErrNotFound ))
+        {
+          currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmLawmoOperations );
+        } 
+    // Ext    
+    else if(( aURI.Match(KLawmoOperationsExtMatch) != KErrNotFound))
+        {
+          currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDdfOpExtWipeAll );
+        }        
+    else
+        {
+        retValue = CSmlDmAdapter::ENotFound;
+        }
+
+    Callback().SetStatusL( aStatusRef, retValue );
+    CleanupStack::PopAndDestroy(); // currentURISegmentList
+    RDEBUG( "CLawmoDMAdapter::ChildURIListL - end"  );
+    }    
+
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::AddNodeObjectL
+// Add node
+// (may leave)
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+void CLawmoDMAdapter::AddNodeObjectL( const TDesC8& /* aURI */,
+                                     const TDesC8& /* aParentLUID */,
+								     TInt aStatusRef )
+    {
+    // Not supported
+    RDEBUG( "CLawmoDMAdapter::AddNodeObjectL - begin"  );
+    Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+    RDEBUG( "CLawmoDMAdapter::AddNodeObjectL - end"  );
+    }    
+
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::ExecuteCommandL
+// Execute command
+// (may leave)
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+void CLawmoDMAdapter::ExecuteCommandL( const TDesC8&  aURI , 
+                                      const TDesC8& /* aLUID */,
+							          const TDesC8&  aArgument, 
+							          const TDesC8& /* aType */,
+								      TInt aStatusRef )
+    {
+    RDEBUG("CLawmoDMAdapter::ExecuteCommandL() Begin");
+    CSmlDmAdapter::TError status;
+    if(IsFactoryProfileL())
+        {
+        RDEBUG("CLawmoDMAdapter::ExecuteCommandL() its factory prof");
+        SetCurrentServerIdL();
+        TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI );
+        CLawmoDMAdapter::TNodeIdentifier identifier = GetNodeIdentifier(uriPtrc);
+        TLawMoStatus err(ELawMoSuccess);
+        RDEBUG_2("ExecuteCommandL executing %d", identifier);
+        switch(identifier)
+            {
+            case ENodePartLock:
+            err = LockDeviceL();
+            break;
+    
+            case ENodeUnlock:
+            err = UnLockDeviceL();
+            break;
+            
+            case ENodeWipe:
+            {
+            //Write correlator id into the cenrep            
+            /********* disable this comment after correlator is added
+            CRepository* crep = NULL;
+            crep = CRepository::NewLC( KCRUidLawmoAdapter );
+            RDEBUG("CLawmoDMAdapter::SetCurrentServerId() cenrep1");
+            TInt reterr = crep->Set( KLawmoCorrelator, aArgument );
+            CleanupStack::PopAndDestroy(crep);*/            
+            err = ilawmoSession.DeviceWipe();
+            }
+            break;
+            
+            case ENodeWipeAll:
+            err = ilawmoSession.DeviceWipeAll();
+            break;  
+            
+            default:
+            err = ELawMoUnknown;
+            break;           
+            }        
+        if((identifier == ENodeWipe)||(identifier == ENodeWipeAll))
+            {
+            CRepository* crep = NULL;
+            TInt reterr(KErrNone);
+            TBuf<MAXBUFLEN> argument;
+            TBuf<MAXBUFLEN> opURI;
+            argument.Copy(aArgument);
+            opURI.Copy(aURI);
+            crep = CRepository::NewLC( KCRUidLawmoAdapter );
+            if(argument.Length()!=0)
+            reterr = crep->Set( KLawmoCorrelator, argument );
+            RDEBUG_2("CLawmoDMAdapter write correlator %d", reterr);
+            reterr = crep->Set( KLawmoSourceURI, opURI);
+            RDEBUG_2("CLawmoDMAdapter write sourceURI %d", reterr);
+            CleanupStack::PopAndDestroy(crep);
+            }        
+        else
+            {        
+            CRepository* crep = NULL;
+            _LIT8(KNsmlNull,"null");
+            crep = CRepository::NewLC( KCRUidDeviceManagementInternalKeys );
+            RDEBUG("CLawmoDMAdapter::ExecuteCommandL Sourceref Crep");
+            TInt reterr = crep->Set( KNSmlDMSCOMOTargetRef, KNsmlNull ); 
+            RDEBUG_2("CLawmoDMAdapter::cenrep set for SourceRef, %d",reterr);
+            CleanupStack::PopAndDestroy();
+            }
+        status = MapErrorToStatus( err );       //map lawmo/syncml error codes     
+        }
+    else
+        {
+        RDEBUG("CLawmoDMAdapter::ExecuteCommandL() NOT factory prof");
+        status = CSmlDmAdapter::ENotAllowed; //405
+        }
+    Callback().SetStatusL( aStatusRef, status );
+    RDEBUG( "CLawmoDMAdapter::ExecuteCommandL - end"  );
+    }    
+
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::ExecuteCommandL
+// Execute command, streaming enabled
+// (may leave)
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+void CLawmoDMAdapter::ExecuteCommandL( const TDesC8& /* aURI */, 
+                                      const TDesC8& /* aLUID */,
+								      RWriteStream*& /* aStream */,
+								      const TDesC8& /* aType */,
+								      TInt aStatusRef )
+    {
+    // Not supported
+    RDEBUG( "CLawmoDMAdapter::ExecuteCommandL Streaming"  );
+    Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+    }    
+    
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::UpdateLeafObjectL
+// Update leaf object
+// (may leave)
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+void CLawmoDMAdapter::UpdateLeafObjectL( const TDesC8&  aURI,
+                                        const TDesC8&   aLUID,
+                                        const TDesC8&   aObject,
+                                        const TDesC8&   aType,
+                                        TInt aStatusRef )
+    {
+    RDEBUG( "CLawmoDMAdapter::UpdateLeafObjectL - begin"  );
+    CSmlDmAdapter::TError status;
+    if(IsFactoryProfileL())
+       {
+        RDEBUG("CLawmoDMAdapter::UpdateLeafObjectL() is factory prof");
+        TPtrC8 uriPtrc = NSmlDmURI::RemoveDotSlash( aURI );
+        TInt err = InternalUpdateObjectL( uriPtrc, aLUID, aObject, aType, aStatusRef );        
+        status = MapErrorToStatus( err );
+       }
+    else
+        {
+        RDEBUG("CLawmoDMAdapter::UpdateLeafObjectL() NOT factory prof");
+        status = CSmlDmAdapter::ENotAllowed;//405
+        }
+    
+    Callback().SetStatusL( aStatusRef, status );    
+    RDEBUG( "CLawmoDMAdapter::UpdateLeafObjectL - end"  );
+    }
+
+	// ----------------------------------------------------------------------------
+//InternalFetchObjectL
+// ----------------------------------------------------------------------------
+
+TInt CLawmoDMAdapter::InternalUpdateObjectL( const TDesC8& aURI, 
+                                              const TDesC8& /*aLUID*/,
+                                              const TDesC8& aObject, 
+                                              const TDesC8& /*aType*/,
+                                              TInt aStatusRef )
+    { 		
+      RDEBUG( "CLawmoDMAdapter::InternalUpdateObjectL - begin"  );
+      CLawmoDMAdapter::TNodeIdentifier identifier = GetNodeIdentifier(aURI);
+      TInt numOfSegs = NSmlDmURI::NumOfURISegs( aURI ) ;
+      TInt err (ELawMoInvalid);
+      RDEBUG_2("UpdateCommand updating %d", identifier);      
+      switch(identifier)
+         {         
+         case CLawmoDMAdapter::ENodeToBeWiped:
+           {
+           TInt value;
+           HBufC8 *object = HBufC8::NewLC( aObject.Length() );
+           TPtr8 objPtr = object->Des();
+           objPtr.Format( aObject );
+           objPtr.LowerCase();
+           if(objPtr.Compare(KNSmlTrue) == 0)
+           value = 1;
+           else if(objPtr.Compare(KNSmlFalse) == 0)
+           value = 0;
+           else
+               {
+                TLex8 lex( aObject );                
+                RDEBUG( "CLawmoDMAdapter::InternalUpdateObjectL lexing"  );
+                User::LeaveIfError( lex.Val( value ) );                
+               }
+           CleanupStack::PopAndDestroy(); // object
+
+           if(value<0||value>1)
+               {
+               RDEBUG_2("value to set %d", value);
+               return ELawMoInvalid;
+               }
+           
+           RDEBUG_2("value to set %d", value);
+           TPtrC8 seg = NSmlDmURI::URISeg(aURI, numOfSegs-2);
+		   TBuf<MAXBUFLEN> property;
+		   property.Copy(seg);
+		   RDEBUG_2("category %s", property.PtrZ());
+           err = ilawmoSession.SetToBeWipedValue(property, value);
+           }
+           break;
+           
+         default:
+             err = ELawMoUnknown;
+             break;
+         
+         }
+    RDEBUG( "CLawmoDMAdapter::InternalUpdateObjectL - End"  );
+	return err;
+	}
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::UpdateLeafObjectL
+// Update leaf object, streaming enabled
+// (may leave)
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+void CLawmoDMAdapter::UpdateLeafObjectL( const TDesC8& /* aURI */, 
+                                         const TDesC8& /* aLUID */,
+									     RWriteStream*& /* aStream */, 
+									     const TDesC8& /* aType */,
+		 							     TInt aStatusRef )
+    {
+    
+    // Not supported
+    RDEBUG( "CLawmoDMAdapter::UpdateLeafObjectL - Streaming"  );
+    Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );//500
+    }
+    
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::StartAtomicL
+// Start atomic
+// (may leave)
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+void CLawmoDMAdapter::StartAtomicL()
+    {
+    }
+    
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::CommitAtomicL
+// Commit atomic commands
+// (may leave)
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+void CLawmoDMAdapter::CommitAtomicL()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::RollbackAtomicL
+// Lose all modifications after 'StartAtomicL' command
+// (may leave)
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+void CLawmoDMAdapter::RollbackAtomicL()
+    {
+    }    
+
+// ---------------------------------------------------------------------------
+// CNSmlDmFotaAdapter::MapStatusToError()
+// Returns a status code corresponding to the system error code given 
+// as parameter.
+// ---------------------------------------------------------------------------
+//
+CSmlDmAdapter::TError CLawmoDMAdapter::MapErrorToStatus( TInt aError ) const
+ {
+    RDEBUG( "CLawmoDMAdapter::MapErrorToStatus - Begin"  );
+    CSmlDmAdapter::TError err;
+    
+    switch( aError )
+        {
+        case ELawMoSuccess:
+            err = CSmlDmAdapter::EExecSuccess; //1200
+            break;
+        case ELawMoOk:
+            err = CSmlDmAdapter::EOk; //200
+            break;
+        case ELawMoFail:
+            err = CSmlDmAdapter::EExecClientError; //1400
+            break;    
+        case ELawMoUserCancelled:
+            err = CSmlDmAdapter::EExecUserCancelled; //1401
+            break;
+        case ELawMoFullyLockFailed:
+            err = CSmlDmAdapter::EExecDownloadFailed; //1402
+            break;
+        case ELawMoPartialLockFailed:
+            err = CSmlDmAdapter::EExecAltDwnldAuthFail; //1403
+            break; 
+        case ELawMoUnlockFailed:
+            err = CSmlDmAdapter::EExecDownFailOOM; //1404
+            break;            
+        case ELawMoWipeFailed:
+            err = CSmlDmAdapter::EExecInstallFailed; //1405
+            break;    
+        case ELawMoWipeNotPerformed:
+            err = CSmlDmAdapter::EExecInstallOOM; //1406
+            break; 
+        case ELawMoWipeSuccess:
+            err = CSmlDmAdapter::EExecDownFailOOM; //1201 ??????
+            break;            
+        case ELawMoAccepted:
+            err = CSmlDmAdapter::EAcceptedForProcessing; //202
+            break;
+        case ELawMoUnknown:
+            err = CSmlDmAdapter::ENotFound; //404
+            break;
+        case ELawMoInvalid:
+            err = CSmlDmAdapter::EError; //500
+            break;
+        default :
+        		err = CSmlDmAdapter::EExecClientError;//1400        
+        }
+    
+    return err;
+ }
+      
+// ========================= OTHER EXPORTED FUNCTIONS =========================
+
+void CleanupEComArray(TAny* aArray)
+	{
+	(static_cast<RImplInfoPtrArray*> (aArray))->ResetAndDestroy();
+	(static_cast<RImplInfoPtrArray*> (aArray))->Close();
+	}
+
+// ----------------------------------------------------------------------------
+// CLawmoDMAdapter::FillLAWMODDFL
+// This function constructs the DDFnode with the details
+// ----------------------------------------------------------------------------
+//	
+void CLawmoDMAdapter::FillLAWMODDFL(MSmlDmDDFObject& aDDF)
+{
+	RDEBUG("CLawmoDMAdapter::FillDCMPDDFL(): begin");
+		
+	TSmlDmAccessTypes accessTypesG;
+    accessTypesG.SetGet();
+    
+    MSmlDmDDFObject& nStateDDF = aDDF.AddChildObjectL( KNSmlDdfState );			// State
+    FillNodeInfoL( nStateDDF, accessTypesG,  
+                        MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::EInt, MSmlDmDDFObject::EOne,
+                        KNSmlDdfStateDescription, KMimeType );
+
+    FillDynamicNodeL(aDDF);
+        
+    MSmlDmDDFObject& nOperationsDDF = aDDF.AddChildObjectL( KNSmlDdfOperations );
+    FillNodeInfoL( nOperationsDDF, accessTypesG,  
+                        MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, MSmlDmDDFObject::EOne,
+                        KNSmlDdfOperationsDescription, KMimeType ); 
+    
+    TSmlDmAccessTypes accessTypesE;   
+    accessTypesE.SetExec();
+        
+    MSmlDmDDFObject& nPartLockDDF = nOperationsDDF.AddChildObjectL( KNSmlDdfPartLock );     // Partial Lock
+    FillNodeInfoL( nPartLockDDF, accessTypesE,  
+                        MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENull, MSmlDmDDFObject::EOne,
+                        KNSmlDdfPartLockDescription, KMimeType );
+    
+    MSmlDmDDFObject& nUnlockDDF = nOperationsDDF.AddChildObjectL( KNSmlDdfUnlock );     // Unlock
+    FillNodeInfoL( nUnlockDDF, accessTypesE,  
+                        MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENull, MSmlDmDDFObject::EOne,
+                        KNSmlDdfUnlockDescription, KMimeType );
+
+    TSmlDmAccessTypes accessTypesEG;   
+    accessTypesEG.SetExec();
+    accessTypesEG.SetGet();
+    
+    MSmlDmDDFObject& nWipeDDF = nOperationsDDF.AddChildObjectL( KNSmlDdfWipe );     // Wipe
+    FillNodeInfoL( nWipeDDF, accessTypesEG,  
+                        MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENull, MSmlDmDDFObject::EOne,
+                        KNSmlDdfWipeDescription, KMimeType ); 
+    
+    MSmlDmDDFObject& nExtDDF = aDDF.AddChildObjectL( KNSmlDdfOpExt );       // Ext
+    FillNodeInfoL( nExtDDF, accessTypesG,  
+                        MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, MSmlDmDDFObject::EOne,
+                        KNSmlDdfExtDescription, KMimeType );
+    
+    MSmlDmDDFObject& nOpExtDDF = nExtDDF.AddChildObjectL( KNSmlDdfOpExtWipeAll );      // WipeAll
+    FillNodeInfoL( nOpExtDDF, accessTypesE, 
+                        MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENull, MSmlDmDDFObject::EOne, 
+                        KNSmlDdfOpExtDescription, KMimeType ); 
+    //Check for any generic alerts and send
+    RDEBUG("CLawmoDMAdapter::FillDCMPDDFL(): send generic alert");
+    SendGenericAlertL();
+	RDEBUG("CLawmoDMAdapter::FillDCMPDDFL(): end");
+}    
+
+void CLawmoDMAdapter::FillDynamicNodeL(MSmlDmDDFObject& aDDF)
+    {
+    RDEBUG("CDCMOServer::FillDynamicNode(): start");
+    RImplInfoPtrArray infoArray;
+    // Note that a special cleanup function is required to reset and destroy
+    // all items in the array, and then close it.
+    TCleanupItem cleanup(CleanupEComArray, &infoArray);
+    CleanupStack::PushL(cleanup);
+    REComSession::ListImplementationsL(KLAWMOPluginInterfaceUid, infoArray);
+    RDEBUG("CDCMOServer::GetPluginUids(): listImpl");
+    
+    TSmlDmAccessTypes accessTypesG;
+    accessTypesG.SetGet();    
+    
+    TSmlDmAccessTypes accessTypesSR;
+    accessTypesSR.SetGet();
+    accessTypesSR.SetReplace();
+    
+    MSmlDmDDFObject& nAwlDDF = aDDF.AddChildObjectL( KNSmlDdfAvailWipeList );                   // AWL
+    FillNodeInfoL( nAwlDDF, accessTypesG,  
+                        MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, MSmlDmDDFObject::EOne,
+                        KNSmlDdfAWLDescription, KMimeType ); 
+    
+    // Loop through each info for each implementation
+    for (TInt i=0; i< infoArray.Count(); i++)
+        {
+        RDEBUG("CDCMOServer::FillDynamicNode(): for loop");
+        MSmlDmDDFObject& nDynamicNodeDDF = nAwlDDF.AddChildObjectL(infoArray[i]->OpaqueData());
+        FillNodeInfoL( nDynamicNodeDDF, accessTypesG,  
+                            MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, MSmlDmDDFObject::EOne,
+                            KNSmlDdfDynNodeDescription, KMimeType ); 
+        RDEBUG("CDCMOServer::FillDynamicNode(): fill dyn node");
+        
+        MSmlDmDDFObject& nListItemDDF = nDynamicNodeDDF.AddChildObjectL( KNSmlDdfListItemName );     // ListItemName
+        FillNodeInfoL( nListItemDDF, accessTypesG, 
+                            MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::EChr, MSmlDmDDFObject::EOne, 
+                            KNSmlDdfListDescription, KMimeType );
+   
+        
+        MSmlDmDDFObject& nToWipeDDF = nDynamicNodeDDF.AddChildObjectL( KNSmlDdfToBeWiped );     // ToBeWiped
+        FillNodeInfoL( nToWipeDDF, accessTypesSR, 
+                            MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::EBool, MSmlDmDDFObject::EOne, 
+                            KNSmlDdfToWipeDescription, KMimeType );
+        RDEBUG("CDCMOServer::FillDynamicNode(): loop done");
+        }
+    CleanupStack::PopAndDestroy(); //cleanup
+    }
+
+TBool CLawmoDMAdapter::IsFactoryProfileL()
+    {
+    RDEBUG("CLawmoDMAdapter::IsFactoryProfile() begin");
+    TBool retval(EFalse);
+    RSyncMLSession ses;
+    ses.OpenL() ;
+    CleanupClosePushL(ses);
+    TSmlJobId jid;
+    TSmlUsageType jtype;
+    ses.CurrentJobL(jid, jtype);
+    RSyncMLDevManJob job;
+    job.OpenL(ses, jid);
+    CleanupClosePushL(job) ;
+    
+    TSmlProfileId pid(job.Profile() ); 
+    TInt fpid(-1);//factory profile id
+    RDEBUG("CLawmoDMAdapter::IsFactoryProfile() before cenrep");
+    
+    CRepository* crep = NULL;
+    crep = CRepository::NewLC( KCRUidDeviceManagementInternalKeys );
+    RDEBUG("CLawmoDMAdapter::IsFactoryProfile() CRep1");
+    TInt reterr = crep->Get( KMaxFactoryDMProfileId, fpid ); 
+    RDEBUG("CLawmoDMAdapter::IsFactoryProfile() CRep2");
+    fpid =fpid + KMaxDataSyncID; //fpid in cenrep needs to be updated
+    RDEBUG_2("factprofidStored %d", fpid);
+    
+    if( pid <= fpid )
+        {
+        RDEBUG("CLawmoDMAdapter::IsFactoryProfile() pid is factory");
+        retval = ETrue;
+        }
+    else
+        {
+        RDEBUG("CLawmoDMAdapter::IsFactoryProfile() pid not factory");
+        }
+    CleanupStack::PopAndDestroy(crep);  
+    CleanupStack::PopAndDestroy( &job) ;
+    CleanupStack::PopAndDestroy( &ses) ;
+    
+    RDEBUG("CLawmoDMAdapter::IsFactoryProfile() end");    
+    return retval;
+    }
+
+void CLawmoDMAdapter::SetCurrentServerIdL()
+    {
+    RDEBUG("CLawmoDMAdapter::SetCurrentServerId() begin");
+    TBuf<MAXBUFLEN> tsrvrid;
+    TBuf<MAXBUFLEN> tsrvrname;
+    RSyncMLSession ses;
+    ses.OpenL() ;
+    CleanupClosePushL(ses);
+    
+    TSmlJobId jid;
+    TSmlUsageType jtype;
+    ses.CurrentJobL(jid, jtype);
+    
+    RSyncMLDevManJob job;
+    job.OpenL(ses, jid);
+    CleanupClosePushL(job) ;
+    TSmlProfileId pid(job.Profile() ); 
+    
+    RDEBUG("CLawmoDMAdapter::SetCurrentServerId() syncprofile");
+    RSyncMLDevManProfile syncProfile;
+    syncProfile.OpenL(ses, pid);    
+    CleanupClosePushL(syncProfile);    
+    tsrvrid.Copy(syncProfile.ServerId());
+    tsrvrname.Copy(syncProfile.DisplayName());
+    TInt tempPid = (TInt) syncProfile.Identifier();
+    
+    RDEBUG_2("CLawmoDMAdapter::SetCurrentServerId() ProfileId 1 %d",tempPid);
+    RDEBUG_2("CLawmoDMAdapter::SetCurrentServerId() ProfileId 2 %d",(TInt) pid);
+    RDEBUG_2("CLawmoDMAdapter::SetCurrentServerId() Srvrid %s",tsrvrid.PtrZ());  
+    RDEBUG_2("CLawmoDMAdapter::SetCurrentServerId() srvrname %s",tsrvrname.PtrZ());
+    
+    CRepository* crep = NULL;
+    crep = CRepository::NewLC( KCRUidDeviceManagementInternalKeys );
+    TInt reterr = crep->Set( KLAWMOfactoryDmProfileID, (TInt)pid ); 
+    RDEBUG_2("CLawmoDMAdapter::setProfile() %d",reterr);
+    reterr = crep->Set( KLAWMOfactoryDmServerID, tsrvrid ); 
+    RDEBUG_2("CLawmoDMAdapter::SetCurrentServerId() %d",reterr);
+    reterr = crep->Set(KLAWMOfactoryDmServerName,tsrvrname);
+    RDEBUG_2("CLawmoDMAdapter::servername() %d",reterr);
+    
+    CleanupStack::PopAndDestroy( &syncProfile);
+    CleanupStack::PopAndDestroy( &job) ;
+    CleanupStack::PopAndDestroy( &ses) ;
+    CleanupStack::PopAndDestroy() ;//cenrep
+    
+    RDEBUG("CLawmoDMAdapter::SetCurrentServerId() end");
+    }
+
+CLawmoDMAdapter::TNodeIdentifier CLawmoDMAdapter::GetNodeIdentifier(const TDesC8& aURI)
+    {
+    RDEBUG("CLawmoDMAdapter::GetNodeIdentifier() begin");
+
+    TInt    numOfSegs = NSmlDmURI::NumOfURISegs( aURI ) ;
+    TPtrC8I seg1 = NSmlDmURI::URISeg(aURI, 0);
+
+    if (seg1 == iRootNode)
+        {
+        if(numOfSegs == 1) return CLawmoDMAdapter::ENodeLawMo;
+
+        TPtrC8I seg2 = NSmlDmURI::URISeg(aURI, 1);
+
+        if (seg2 == KNSmlDdfState)
+            {
+                return CLawmoDMAdapter::ENodeState;
+            }            
+        else if (seg2 == KNSmlDdfAvailWipeList)
+            {               
+                if (numOfSegs == 2)
+                {
+                    return CLawmoDMAdapter::ENodeAvWipeList;
+                }
+                else if (numOfSegs == 3) 
+                {            
+                    // We are not using dynamic node name to do any decision making
+                    return CLawmoDMAdapter::ENodeDynamic;
+                }
+                else if (numOfSegs == 4) 
+                {
+                    TPtrC8I seg4 = NSmlDmURI::URISeg(aURI, 3);
+                    
+                    if (seg4 == KNSmlDdfListItemName)
+                        {
+                        return CLawmoDMAdapter::ENodeItemName;
+                        }
+                    else if (seg4 == KNSmlDdfToBeWiped)
+                        {
+                        return CLawmoDMAdapter::ENodeToBeWiped;
+                        }
+                    else
+                        {
+                        return CLawmoDMAdapter::ENodeNotUsedAndAlwaysLast;
+                        }
+                }
+                else
+                {
+                return CLawmoDMAdapter::ENodeNotUsedAndAlwaysLast;
+                }
+            }            
+        else if (seg2 == KNSmlDdfOperations)                    
+            {
+                if(numOfSegs == 2)
+                    {
+                     return CLawmoDMAdapter::ENodeOperations;
+                    }
+                else if(numOfSegs == 3)
+                    {
+                    TPtrC8I seg3 = NSmlDmURI::URISeg(aURI, 2);
+                
+                    if(seg3 == KNSmlDdfPartLock)
+                        {
+                        return CLawmoDMAdapter::ENodePartLock;
+                        }  
+                    else if(seg3 == KNSmlDdfUnlock)
+                        {
+                        return CLawmoDMAdapter::ENodeUnlock;
+                        } 
+                    else if(seg3 == KNSmlDdfWipe)
+                        {
+                        return CLawmoDMAdapter::ENodeWipe;
+                        } 
+                    }
+                else
+                    { 
+                    return CLawmoDMAdapter::ENodeNotUsedAndAlwaysLast;
+                    }
+            }
+        else if (seg2 == KNSmlDdfOpExt)
+            {
+                if(numOfSegs == 2)
+                {
+                    return CLawmoDMAdapter::ENodeExt;
+                }
+                else if(numOfSegs == 3)
+                {
+                TPtrC8I seg3 = NSmlDmURI::URISeg(aURI, 2);
+
+                if(seg3 == KNSmlDdfOpExtWipeAll)
+                    {
+                    return CLawmoDMAdapter::ENodeWipeAll;
+                    } 
+                else
+                    {
+                    return CLawmoDMAdapter::ENodeNotUsedAndAlwaysLast;
+                    }
+                }
+                else
+                {
+                return CLawmoDMAdapter::ENodeNotUsedAndAlwaysLast;
+                }
+            }
+        }
+    RDEBUG("CLawmoDMAdapter::GetNodeIdentifier() End");
+    return CLawmoDMAdapter::ENodeNotUsedAndAlwaysLast;
+    }
+
+void CLawmoDMAdapter::SendGenericAlertL()
+{
+    RDEBUG("CLawmoDMAdapter::SendGenericAlert(): begin");    
+    // check if wipe generic alert needs to be sent ?
+    TInt wipeStatus;
+    CRepository *repository=CRepository::NewLC ( KCRUidLawmoAdapter );
+    repository->Get(KLawmoWipeStatus,wipeStatus);
+    RDEBUG("CDCMOServer::SendGenericAlert(): chkin wipestatus");
+    if(wipeStatus!=-1)
+        {
+        //Wipe Alert needs tobe sent
+        RNSmlPrivateAPI privateAPI;
+        privateAPI.OpenL();
+        RDEBUG("CLawmoDMAdapter::SendGenericAlert(): OpenL");
+        CleanupClosePushL(privateAPI);
+        RArray<CNSmlDMAlertItem> iItemArray;
+        CNSmlDMAlertItem* item = new (ELeave) CNSmlDMAlertItem ;
+        RDEBUG("CLawmoDMAdapter::SendGenericAlert(): alertItem");
+        TBuf<MAXBUFLEN> targetURI;
+        targetURI.Append(KNullDesC);
+        TBuf<MAXBUFLEN> correlator;
+        correlator.Append(KNullDesC);
+        TBuf<MAXBUFLEN> sourceURI;
+        sourceURI.Append(KNullDesC);
+        RDEBUG("CLawmoDMAdapter::SendGenericAlert(): bfore cenrep");
+        // Construct generic alert message
+        TInt reterr = repository->Get(KLawmoCorrelator,correlator );
+        reterr = repository->Get(KLawmoSourceURI,sourceURI);
+        RDEBUG("CLawmoDMAdapter::SendGenericAlert(): after cenrep");
+        
+        HBufC8 *descorrelator = HBufC8::NewL(MAXBUFLEN);
+        (descorrelator->Des()).Copy(correlator);
+        
+        HBufC8 *aSourceuri = HBufC8::NewL(MAXBUFLEN);
+        (aSourceuri->Des()).Copy(sourceURI);   
+        item->iSource = aSourceuri;    
+        
+        HBufC8 *aTargeturi = HBufC8::NewL(MAXBUFLEN);   
+        (aTargeturi->Des()).Copy(targetURI);    
+        item->iTarget = aTargeturi; 
+        if(item->iTarget->Des().Compare(KNullDesC8)==0)
+            RDEBUG("CLawmoDMAdapter::SendGenericAlert() targeturi is NULL");
+        RDEBUG("CLawmoDMAdapter::SendGenericAlert(): targeturidone");
+        
+        HBufC8 *aMetatype = HBufC8::NewL(MAXBUFLEN); 
+        (aMetatype->Des()).Copy(KLawmoMetatype);               
+        item->iMetaType = aMetatype;     
+        
+        HBufC8 *aMetaformat = HBufC8::NewL(MAXBUFLEN); 
+        (aMetaformat->Des()).Copy(KLawmoMetaformat);         
+        item->iMetaFormat = aMetaformat;
+        
+        HBufC8 *aMetamark = HBufC8::NewL(MAXBUFLEN); 
+        (aMetamark->Des()).Copy(KLawmoMetamark);               
+        item->iMetaMark = aMetamark;
+        
+        //appending result code
+        HBufC8 *data = HBufC8::NewL(MAXBUFLEN);
+        (data->Des()).Num(wipeStatus);
+        item->iData = data;
+        
+        repository->Set(KLawmoWipeStatus,-1);//reset the wipestatus
+        
+        TInt genericStatus(KErrNone);
+        RDEBUG("CLawmoDMAdapter::SendGenericAlert(): Appending data");
+        iItemArray.AppendL(*item);
+        RDEBUG("CLawmoDMAdapter::SendGenericAlert(): Issuing request");
+        TRAP_IGNORE(genericStatus=privateAPI.AddDMGenericAlertRequestL(*descorrelator, iItemArray ));
+        RDEBUG_2("CLawmoDMAdapter::SendGenericAlert(): Api call done %d", genericStatus);
+        delete data;    
+        delete aMetamark;    
+        delete aMetaformat;    
+        delete aMetatype;  
+		delete aTargeturi;
+        delete aSourceuri;
+        delete item;
+        delete descorrelator;		
+        iItemArray.Reset();         
+        iItemArray.Close();
+        CleanupStack::PopAndDestroy( &privateAPI);
+        }
+    
+    CleanupStack::PopAndDestroy();
+    RDEBUG("CLawmoDMAdapter::SendGenericAlert(): end");    
+}
+
+TLawMoStatus CLawmoDMAdapter::LockDeviceL()
+    {
+    RDEBUG("CLawmoDMAdapter::LockDevice(): begin");
+    TInt lockValue(0);
+    TInt currentLawmoState(0);
+    TLawMoStatus lawmostatus(ELawMoSuccess);
+    RDEBUG("CLawmoDMAdapter::LockDevice(): 1");
+    CRepository* crep = NULL;
+    crep = CRepository::NewLC( KCRUidDeviceManagementInternalKeys );
+    RDEBUG("CLawmoDMAdapter::LockDevice(): 2");
+
+    User::LeaveIfError(RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus,lockValue));
+    RDEBUG("CLawmoDMAdapter::LockDevice(): 3");  
+    
+    // If Locked already by Tarm/autolock, set LawmoState.
+    if(lockValue>EAutolockOff)
+        {
+        RDEBUG("CLawmoDMAdapter::LockDevice(): 3.0");
+        TInt err = crep->Set( KLAWMOPhoneLock, EPartialLocked );
+        CleanupStack::PopAndDestroy(crep);  
+        if(err==KErrNone)   return lawmostatus;
+        else 
+        return ELawMoPartialLockFailed;
+        }
+
+    TInt reterr = crep->Get( KLAWMOPhoneLock, currentLawmoState );     
+    if(reterr!= KErrNone)
+        lawmostatus = ELawMoPartialLockFailed;
+    RDEBUG("CLawmoDMAdapter::LockDevice(): 3.1");
+    
+    if(currentLawmoState==EUnlocked)
+        {
+        RTerminalControl tc;
+        RTerminalControl3rdPartySession ts;
+        
+        User::LeaveIfError( tc.Connect() );
+        CleanupClosePushL( tc );
+
+        User::LeaveIfError( ts.Open( tc ) );
+        CleanupClosePushL( ts );
+        RDEBUG("CLawmoDMAdapter::LockDevice(): 3.5");
+        TBuf8<8> data;
+        data.Copy(_L8("1"));
+        TInt status = ts.SetDeviceLockParameter(RTerminalControl3rdPartySession::ELock, data);        
+        RDEBUG_2("CLawmoDMAdapter::LockDevice() %d", status );        
+        if (status == KErrNone)    
+            {
+            reterr = crep->Set( KLAWMOPhoneLock, EPartialLocked );
+            if (reterr!= KErrNone)
+                lawmostatus = ELawMoPartialLockFailed;
+            }
+        else if (status == KErrCancel)
+            lawmostatus = ELawMoUserCancelled;
+        else
+            lawmostatus = ELawMoPartialLockFailed;
+        
+        ts.Close();
+        tc.Close();
+        RDEBUG("CLawmoDMAdapter::LockDevice(): set val to 20");       
+        CleanupStack::PopAndDestroy( &ts );
+        CleanupStack::PopAndDestroy( &tc );
+        RDEBUG("CLawmoDMAdapter::LockDevice(): 5");
+        }
+    
+    CleanupStack::PopAndDestroy(crep);  
+    RDEBUG("CLawmoDMAdapter::LockDevice(): End");
+    return lawmostatus;
+    }
+
+TLawMoStatus CLawmoDMAdapter::UnLockDeviceL()
+    {
+    RDEBUG("CDCMOServer::UnLockDevice(): begin");
+    CRepository* crep = NULL;
+    TInt currentLawmoState =0;
+    TLawMoStatus lawmostat(ELawMoSuccess);    
+    TBool currentLockState(EFalse);
+    TInt lockValue(0);
+    User::LeaveIfError(RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus,lockValue));
+    RDEBUG("CDCMOServer::unLockDevice(): 0");
+
+    if(lockValue>EAutolockOff)
+        currentLockState = ETrue;
+    
+    RDEBUG("CDCMOServer::UnLockDevice(): 1");
+    crep = CRepository::NewLC( KCRUidDeviceManagementInternalKeys );
+    RDEBUG("CDCMOServer::UnLockDevice(): 2");
+    TInt reterr = crep->Get( KLAWMOPhoneLock, currentLawmoState ); 
+    RDEBUG("CDCMOServer::UnLockDevice(): 2.1");
+    
+    if(reterr!= KErrNone)
+        lawmostat = ELawMoUnlockFailed;
+    
+    if((currentLawmoState != EUnlocked) ||(currentLockState))
+        {
+        RTerminalControl tc;
+        RTerminalControl3rdPartySession ts;
+        RDEBUG("CDCMOServer::UnLockDevice(): 3");
+        User::LeaveIfError( tc.Connect() );
+        CleanupClosePushL( tc );  
+        User::LeaveIfError( ts.Open( tc ) );
+        CleanupClosePushL( ts );
+        RDEBUG("CDCMOServer::UnLockDevice(): 4");
+        TBuf8<8> data;
+        data.Copy(_L8("0"));
+        TInt status = ts.SetDeviceLockParameter(RTerminalControl3rdPartySession::ELock, data);       
+        RDEBUG_2("CDCMOServer::UnLockDevice() %d", status );
+        if (status == KErrNone)    
+            {
+            reterr = crep->Set( KLAWMOPhoneLock, EUnlocked );
+            if (reterr!= KErrNone)
+                lawmostat = ELawMoPartialLockFailed;
+            }
+        else if (status == KErrCancel)
+            lawmostat = ELawMoUserCancelled;
+        else
+            lawmostat = ELawMoUnlockFailed;
+        
+        ts.Close();
+        tc.Close();
+        RDEBUG("CDCMOServer::UnLockDevice(): set to 30");
+        CleanupStack::PopAndDestroy( &ts );
+        CleanupStack::PopAndDestroy( &tc );
+        }
+    
+    if(!currentLockState)
+        {
+        reterr = crep->Set( KLAWMOPhoneLock, EUnlocked );
+        if(reterr!=KErrNone)   
+            lawmostat = ELawMoUnlockFailed;
+        }
+
+    CleanupStack::PopAndDestroy(crep); 
+    RDEBUG("CDCMOServer::UnLockDevice(): End");
+    return lawmostat;    
+    }
+
+TLawMoStatus CLawmoDMAdapter::GetStateL(TInt& aState)
+{
+    RDEBUG("CDCMOServer::GetState(): begin");
+    TLawMoStatus lawmostat(ELawMoOk);
+    CRepository* crep = NULL;
+    crep = CRepository::NewLC( KCRUidDeviceManagementInternalKeys );
+    RDEBUG("CDCMOServer::GetState(): created cenrep");
+    TInt reterr = crep->Get( KLAWMOPhoneLock, aState );
+    RDEBUG("CDCMOServer::GetState(): get on cenrep");
+    if(reterr!= KErrNone)
+    {
+            RDEBUG("CDCMOServer::GetLocalCategoryL(): centrep Get error");
+            lawmostat = ELawMoInvalid;
+    }
+    RDEBUG("CDCMOServer::GetState(): writing the int val");
+    CleanupStack::PopAndDestroy(crep); 
+    RDEBUG("CDCMOServer::GetState(): End");
+    return lawmostat;
+}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/omadmextensions/adapters/lawmodmadapter/src/lawmodmadaptermain.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* 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:  DCMO DM Adapter implementation
+*
+*/
+
+// INCLUDE
+#include <implementationproxy.h>
+#include "lawmodmadapter.h"
+
+// ----------------------------------------------------------------------------
+// ImplementationTable
+// Ecom plug-in implementation table
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] = 
+    {
+	IMPLEMENTATION_PROXY_ENTRY( 0x2002EA23, CLawmoDMAdapter::NewL )
+    };
+
+// ----------------------------------------------------------------------------
+// ImplementationGroupProxy
+// Instance of implementation proxy
+// (exported)
+// Status : Draft
+// ----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+    {
+    aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+
+    return ImplementationTable;
+    }
+
+// End Of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omadm/omadmextensions/adapters/lawmodmadapter/src/nsmldmuri.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -0,0 +1,210 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  DM tree etc.
+*
+*/
+
+
+
+#include "nsmldmuri.h"
+
+// ------------------------------------------------------------------------------------------------
+//  NSmlDmURI
+// ------------------------------------------------------------------------------------------------
+
+
+/* ------------------------------------------------------------------------------------------------
+// TPtrC8 NSmlDmURI::ParentURI(const TDesC8& aURI)
+// returns parent uri, i.e. removes last uri segment
+// ------------------------------------------------------------------------------------------------
+ TPtrC8 NSmlDmURI::ParentURI(const TDesC8& aURI)
+	{
+	TBool onlyOneSeg = ETrue;
+	TInt i;
+	for(i=aURI.Length()-1;i>=0;i--)
+		{
+		if(aURI[i]==KNSmlDMUriSeparator)
+			{
+			onlyOneSeg = EFalse;
+			break;
+			}
+		}
+	if(onlyOneSeg)
+		{
+		return KNSmlDmRootUri();
+		}
+	else
+		{
+		return aURI.Left(i);
+		}
+	}
+
+// ------------------------------------------------------------------------------------------------
+// TPtrC8 NSmlDmURI::LastURISeg(const TDesC8& aURI)
+// Returns only the last uri segemnt
+// ------------------------------------------------------------------------------------------------
+ TPtrC8 NSmlDmURI::LastURISeg(const TDesC8& aURI)
+	{
+	TInt i;
+	for(i=aURI.Length()-1;i>=0;i--)
+		{
+		if(aURI[i]==KNSmlDMUriSeparator)
+			{
+			break;
+			}
+		}
+	if(i==0)
+		{
+		return aURI;
+		}
+	else
+		{
+		return aURI.Mid(i+1);
+		}
+	}
+*/
+// ------------------------------------------------------------------------------------------------
+// TPtrC8 NSmlDmURI::RemoveDotSlash(const TDesC8& aURI)
+// return uri without dot and slash in start
+// ------------------------------------------------------------------------------------------------
+ TPtrC8 NSmlDmURI::RemoveDotSlash(const TDesC8& aURI)
+	{
+
+	TInt offset = 0;
+	TInt endSlash = 0;
+
+	if(aURI.Find(KNSmlDmUriDotSlash)==0)
+		{
+		offset = 2;
+		}
+	else
+		{
+		return aURI;
+		}
+
+	if(aURI.Length()>2&&aURI[aURI.Length()-1]==KNSmlDMUriSeparator)
+		{
+		endSlash = 1;
+		}
+
+	return aURI.Mid(offset,aURI.Length()-endSlash-offset);
+	}
+
+/* ------------------------------------------------------------------------------------------------
+// TPtrC8 NSmlDmURI::RemoveProp(const TDesC8& aURI)
+// removes property from the uri
+// ------------------------------------------------------------------------------------------------
+ TPtrC8 NSmlDmURI::RemoveProp(const TDesC8& aURI)
+	{
+	TInt offset = aURI.Find(KNSmlDmQuestionMark);
+	if(offset!=KErrNotFound)
+		{
+		return aURI.Left(offset); 
+		}
+	return aURI;
+	}
+*/
+// ------------------------------------------------------------------------------------------------
+// TPtrC8 NSmlDmURI::RemoveLastSeg(const TDesC8& aURI)
+// Removes last uri segment
+// ------------------------------------------------------------------------------------------------
+ TPtrC8 NSmlDmURI::RemoveFirstSeg(const TDesC8& aURI)
+	{
+    TPtrC8 temp = RemoveDotSlash(aURI);
+	TInt i;
+	for(i=0;i<temp.Length();i++)
+		{
+		if(temp[i]==KNSmlDMUriSeparator)
+			{
+			break;
+			}
+		}
+	if(i>=temp.Length()-1)
+		{
+		return KNullDesC8();
+		}
+	else
+        {
+        return temp.Right(i);
+        }
+	}
+
+// ------------------------------------------------------------------------------------------------
+// TPtrC8 NSmlDmURI::URISeg(const TDesC8& aURI,TInt aLocation,TInt aSegCount=1)
+// Returns the aLocation:th URI segment
+// ------------------------------------------------------------------------------------------------
+ TPtrC8 NSmlDmURI::URISeg(const TDesC8& aURI,TInt aLocation,TInt aSegCount/*=1*/)
+	{
+    TInt i, start;
+    if(aLocation < 0)
+        {
+            return aURI.Mid(0, 0);
+        }
+    if(aLocation > 0)
+        {
+        for (start=0, i=0; (start<aURI.Length()) && (i<aLocation); start++)
+            {
+            if(aURI[start]=='/')
+                {
+                i++;
+                }
+            if(i==aLocation)
+                {
+                break;
+                }
+            }
+        }
+    else
+        {
+            start=-1;
+        }
+    // empty segment
+    if(start+1 >= aURI.Length())
+        {
+        return aURI.Mid(0, 0);
+        }        
+    // start points to beginning of segment
+    for (i=start+1; i<aURI.Length(); i++)
+        {
+        if(aURI[i]=='/')
+            {
+            aSegCount--;
+            if(aSegCount == 0)
+                {
+                break;
+                }
+            }
+        }
+    // i points to end of segment   
+    return aURI.Mid(start+1, i-start-1);
+	}
+
+
+// ------------------------------------------------------------------------------------------------
+// TInt NSmlDmURI::NumOfURISegs(const TDesC8& aURI)
+// Returns the num of uri segs
+// ------------------------------------------------------------------------------------------------
+ TInt NSmlDmURI::NumOfURISegs(const TDesC8& aURI)
+	{
+	TInt numOfURISegs = 1;
+	for(TInt i=0;i<aURI.Length();i++)
+		{
+		if(aURI[i]==KNSmlDMUriSeparator)
+			{
+			numOfURISegs++;
+			}
+		}
+	return numOfURISegs;
+	}
+
--- a/omadm/omadmextensions/adapters/syncmldm12/src/NSmlDmSettingsAdapter12.cpp	Thu Jul 15 18:24:21 2010 +0300
+++ b/omadm/omadmextensions/adapters/syncmldm12/src/NSmlDmSettingsAdapter12.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -2044,7 +2044,7 @@
 		{
 			TInt pid = i + KMaxDataSyncID;
 			TInt index = profileList.Find(pid );
-			if( index >= i  )
+			if( index >= 0  )
 			{	    		
 	        	TInt rValue(KErrNone);
 	        	RSyncMLDevManProfile profile;
--- a/pnpmobileservices/pnpms/OnlineSupport/aif/OnlineSupport_reg.rss	Thu Jul 15 18:24:21 2010 +0300
+++ b/pnpmobileservices/pnpms/OnlineSupport/aif/OnlineSupport_reg.rss	Thu Aug 19 09:42:30 2010 +0300
@@ -17,7 +17,7 @@
 
 
 #include <appinfo.rh>
-#include <OnlineSupport.rsg>
+#include <onlinesupport.rsg>
 #include <data_caging_paths_strings.hrh>
 
 UID2 KUidAppRegistrationResourceFile
--- a/pnpmobileservices/pnpms/OnlineSupport/src/CCMAppUi.cpp	Thu Jul 15 18:24:21 2010 +0300
+++ b/pnpmobileservices/pnpms/OnlineSupport/src/CCMAppUi.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -29,7 +29,7 @@
 #include <textresolver.h>
 #include <sysutil.h>
 #include <httpfiltercommonstringsext.h>
-#include <OnlineSupport.rsg>            // has to be system include.
+#include <onlinesupport.rsg>            // has to be system include.
 #include <centralrepository.h>          // link against centralrepository.lib
 #include <browseruisdkcrkeys.h>         // for KCRUidBrowser
 #include <CoreApplicationUIsSDKCRKeys.h>// for KCRUidCoreApplicationUIs
--- a/pnpmobileservices/pnpms/PnP/PnpProvisioningAppAif/PnpProvisioning_reg.rss	Thu Jul 15 18:24:21 2010 +0300
+++ b/pnpmobileservices/pnpms/PnP/PnpProvisioningAppAif/PnpProvisioning_reg.rss	Thu Aug 19 09:42:30 2010 +0300
@@ -17,7 +17,7 @@
 
 
 #include <appinfo.rh>
-#include <PnpProvisioning.rsg>
+#include <pnpprovisioning.rsg>
 #include <data_caging_paths_strings.hrh>
 
 UID2 KUidAppRegistrationResourceFile
--- a/pnpmobileservices/pnpms/PnP/PnpProvisioningAppSrc/PnpProvisioningAppUi.cpp	Thu Jul 15 18:24:21 2010 +0300
+++ b/pnpmobileservices/pnpms/PnP/PnpProvisioningAppSrc/PnpProvisioningAppUi.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -23,7 +23,7 @@
 #include <textresolver.h>
 #include <rconnmon.h>
 #include <ApUtils.h>
-#include <PnpProvisioning.rsg>
+#include <pnpprovisioning.rsg>
 #include <browseruisdkcrkeys.h>         // for KCRUidBrowser
 #include <AknGlobalNote.h>              // for CAknGlobalNote
 #include <AknGlobalConfirmationQuery.h> // for CAknGlobalConfirmationQuery
--- a/pnpmobileservices/pnpms/PnP/PnpProvisioningAppSrc/PnpProvisioningDocument.cpp	Thu Jul 15 18:24:21 2010 +0300
+++ b/pnpmobileservices/pnpms/PnP/PnpProvisioningAppSrc/PnpProvisioningDocument.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -23,7 +23,7 @@
 #include <AknQueryDialog.h>
 #include <aknnotewrappers.h>
 #include <StringLoader.h>
-#include <PnpProvisioning.rsg>
+#include <pnpprovisioning.rsg>
 #include <apgcli.h>
 #include <e32uid.h>
 #include <CWPEngine.h>      // Using WAP provisioning engine
--- a/pnpmobileservices/pnpms/PnP/PnpProvisioningAppSrc/PnpProvisioningSaver.cpp	Thu Jul 15 18:24:21 2010 +0300
+++ b/pnpmobileservices/pnpms/PnP/PnpProvisioningAppSrc/PnpProvisioningSaver.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -21,7 +21,7 @@
 // INCLUDE FILES
 #include <AknQueryDialog.h>
 #include <eikprogi.h>
-#include <PnpProvisioning.rsg>
+#include <pnpprovisioning.rsg>
 #include <commdb.h>
 #include <CWPEngine.h>
 #include <CWPAdapter.h>
--- a/pnpmobileservices/pnpms/PnP/PnpProvisioningAppSrc/PnpServiceActivation.cpp	Thu Jul 15 18:24:21 2010 +0300
+++ b/pnpmobileservices/pnpms/PnP/PnpProvisioningAppSrc/PnpServiceActivation.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -25,7 +25,7 @@
 #include <apgtask.h>
 #include <w32std.h>
 #include <StringLoader.h>
-#include <PnpProvisioning.rsg>
+#include <pnpprovisioning.rsg>
 #include <AknGlobalNote.h>
 #include <centralrepository.h>
 
--- a/pnpmobileservices/pnpms/ServiceHelpPlugin/src/ServiceHelpPlugin.cpp	Thu Jul 15 18:24:21 2010 +0300
+++ b/pnpmobileservices/pnpms/ServiceHelpPlugin/src/ServiceHelpPlugin.cpp	Thu Aug 19 09:42:30 2010 +0300
@@ -21,7 +21,7 @@
 
 #include    <gsparentplugin.h>
 #include    <gscommon.hrh>
-#include    <PnpProvisioning.rsg>
+#include    <pnpprovisioning.rsg>
 #include    <ServiceHelpPlugin.mbg>
 #include    <gsprivatepluginproviderids.h>
 #include    <gsfwviewuids.h>
--- a/pnpmobileservices/pnpms/install/compile_localization_resources.bat	Thu Jul 15 18:24:21 2010 +0300
+++ b/pnpmobileservices/pnpms/install/compile_localization_resources.bat	Thu Aug 19 09:42:30 2010 +0300
@@ -118,5 +118,5 @@
 perl -S epocrc.pl -u -m045,046,047 -DLANGUAGE_160 -DSIS_RESOURCE_COMPILATION -I%EROOT%\include -I..\OnlineSupport\inc -I..\OnlineSupport\inc\LocalizedFiles "..\OnlineSupport\inc\LocalizedFiles\OnlineSupport.rss" -o%RESOURCE_PATH%onlinesupport.r160
 perl -S epocrc.pl -u -m045,046,047 -DLANGUAGE_161 -DSIS_RESOURCE_COMPILATION -I%EROOT%\include -I..\OnlineSupport\inc -I..\OnlineSupport\inc\LocalizedFiles "..\OnlineSupport\inc\LocalizedFiles\OnlineSupport.rss" -o%RESOURCE_PATH%onlinesupport.r161
 
-rem -hOnlineSupport.rsg 
+rem -honlinesupport.rsg