localconnectivityservice/obexserviceman/utils/src/obexutilsuilayer.cpp
changeset 26 d74a43a4aa59
parent 25 c4f07256ff37
child 31 3b92f7acdc91
--- a/localconnectivityservice/obexserviceman/utils/src/obexutilsuilayer.cpp	Fri Apr 23 23:16:31 2010 +0300
+++ b/localconnectivityservice/obexserviceman/utils/src/obexutilsuilayer.cpp	Fri Apr 23 23:27:23 2010 +0300
@@ -22,7 +22,7 @@
 #include "obexutilsdebug.h"
 
 #include <SecondaryDisplay/obexutilssecondarydisplayapi.h>
-#include <obexutils.rsg>
+#include <Obexutils.rsg>
 #include <aknnotewrappers.h>
 #include <AknGlobalConfirmationQuery.h>
 #include <eikon.rsg>
@@ -53,12 +53,13 @@
 #include <apgcli.h>
 #include <apacmdln.h>
 #include <AknLaunchAppService.h>  //  Used to launch file manager in embedded mode.
+#include <e32property.h> //for checking backup status
 
-
+//Constants
+const TInt KFileManagerUID3 = 0x101F84EB; /// File Manager application UID3
 const TInt KUiNumberOfZoomStates = 2;          // second for the mask
 const TInt KSortNumMax = 2;
 
-
 // ============================ MEMBER FUNCTIONS ===============================
 
 
@@ -109,7 +110,7 @@
         inParams->AppendL(TAiwGenericParam( EGenericParamDir, TAiwVariant( aPath ) ) );
         inParams->AppendL(TAiwGenericParam( EGenericParamDir, TAiwVariant( aSortMethod ) ) );
        
-        CAknLaunchAppService* launchService = CAknLaunchAppService::NewL(TUid::Uid( 0x101F84EB ), // Use File Manager app UID directly
+        CAknLaunchAppService* launchService = CAknLaunchAppService::NewL(TUid::Uid( KFileManagerUID3 ), // Use File Manager app UID directly
                                                                          NULL, 
                                                                          inParams ); 
         CleanupStack::PopAndDestroy( inParams );
@@ -122,7 +123,7 @@
         RApaLsSession apaLsSession;
         User::LeaveIfError( apaLsSession.Connect() );
         CleanupClosePushL( apaLsSession );
-        User::LeaveIfError( apaLsSession.GetAppInfo( appInfo, TUid::Uid( 0x101F84EB ) ) ); // Use File Manager app UID directly
+        User::LeaveIfError( apaLsSession.GetAppInfo( appInfo, TUid::Uid( KFileManagerUID3 ) ) ); // Use File Manager app UID directly
         CApaCommandLine* apaCmdLine = CApaCommandLine::NewLC();
         apaCmdLine->SetExecutableNameL( appInfo.iFullName );
         apaCmdLine->SetCommandL( EApaCommandOpen );
@@ -523,6 +524,32 @@
     }
 
 // -----------------------------------------------------------------------------
+// TObexUtilsUiLayer::IsBackupRunning
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool TObexUtilsUiLayer::IsBackupRunning()
+    {
+    const TUint32 KFileManagerBkupStatus = 0x00000001;
+    
+    TInt status = EFileManagerBkupStatusUnset;
+    TBool retValue = EFalse;
+    TInt err = RProperty::Get( TUid::Uid(KFileManagerUID3), KFileManagerBkupStatus,
+                              status );
+    if ( err == KErrNone )
+        {
+        if ( status == EFileManagerBkupStatusBackup || 
+             status == EFileManagerBkupStatusRestore )
+            {
+            TSecureId fileManagerSecureId( KFileManagerUID3 );
+            //only returning ETrue if backup process is still active
+            retValue = ProcessExists( fileManagerSecureId );
+            }
+        }
+   
+    return retValue;
+    }
+
+// -----------------------------------------------------------------------------
 // TObexUtilsUiLayer::PrepareDialogExecuteL
 // -----------------------------------------------------------------------------
 //
@@ -552,4 +579,28 @@
     return coverDisplay;
     }
 
+// -----------------------------------------------------------------------------
+// TObexUtilsUiLayer::ProcessExists
+// -----------------------------------------------------------------------------
+//
+TBool TObexUtilsUiLayer::ProcessExists( const TSecureId& aSecureId )
+    {
+    _LIT( KFindPattern, "*" );
+    TFindProcess finder(KFindPattern);
+    TFullName processName;
+    while( finder.Next( processName ) == KErrNone )
+        {
+        RProcess process;
+        if ( process.Open( processName ) == KErrNone )
+            {
+            TSecureId processId( process.SecureId() );
+            process.Close();
+            if( processId == aSecureId )
+                {
+                return ETrue;
+                }
+            }
+        }
+    return EFalse;
+    }
 //  End of File