convergedcallengine/spsettings/backuphelper/src/spsbackuphelpermonitor.cpp
branchRCL_3
changeset 19 7d48bed6ce0c
parent 0 ff3b6d0fd310
child 20 987c9837762f
--- a/convergedcallengine/spsettings/backuphelper/src/spsbackuphelpermonitor.cpp	Thu Aug 19 10:28:14 2010 +0300
+++ b/convergedcallengine/spsettings/backuphelper/src/spsbackuphelpermonitor.cpp	Tue Aug 31 15:45:17 2010 +0300
@@ -44,6 +44,7 @@
     Cancel();
     iProperty.Close();
     delete iPerformer;
+    delete iABClient;
     }
 
 // ---------------------------------------------------------------------------
@@ -74,6 +75,14 @@
     // Check current state to see if we were started for backup purposes
     iProperty.Get(backupStateValue);
     
+    if (!NoBackupRestore(backupStateValue))
+        {
+        iABClient = CActiveBackupClient::NewL();
+            
+        // Confirm that this data owner is ready for backup/restore operations
+        iABClient->ConfirmReadyForBURL(KErrNone);
+        }
+    
     // Subscribe to the P&S flag to catch transitions
     Subscribe();
     
@@ -143,8 +152,8 @@
     {
     // Not set or no backup or restore ongoing
     TBool ret = 
-        ( ( aBackupStateValue == conn::EBURUnset ) ||
-        ( aBackupStateValue == conn::EBURNormal ) );
+        ( ( aBackupStateValue & KBURPartTypeMask ) == conn::EBURUnset ||
+        ( aBackupStateValue & KBURPartTypeMask ) == conn::EBURNormal );
     
     return ret;
     }
@@ -174,10 +183,8 @@
     // re-subscribe to the flag to monitor future changes
     Subscribe();
 
-    iProperty.Get(backupStateValue);
+    CheckStatusL();
 
-    // Process the mode change accordingly
-    ProcessBackupStateL(backupStateValue);
     XSPSLOGSTRING( "CSpsBackupHelperMonitor::RunL OUT" );
     }
 
@@ -200,5 +207,56 @@
     iProperty.Cancel();
     }
 
+void CSpsBackupHelperMonitor::CheckStatusL()
+    {
+    TInt backupInfo =0;
+    iProperty.Get(backupInfo);
+    
+    // Process the mode change accordingly
+    ProcessBackupStateL(backupInfo);
+
+    if (NoBackupRestore(backupInfo))
+        {
+        delete iABClient;
+        iABClient = NULL;
+        }
+    else 
+        {
+        if (iABClient == NULL)
+            {
+            iABClient = CActiveBackupClient::NewL();
+            }
+        
+        TDriveList driveList;
+        TBURPartType partType;
+        TBackupIncType incType;
+        TInt err;
+        TRAP(err, iABClient->BURModeInfoL(driveList, partType, incType));
+        if (err != KErrNone)
+            {
+            XSPSLOGSTRING("BURModeInfoL error");
+            }
+        
+        TBool amIaffected = ETrue;
+        
+        if (partType == EBURRestorePartial || partType == EBURBackupPartial)
+            {
+            TRAP(err, amIaffected = iABClient->DoesPartialBURAffectMeL());
+            if (err != KErrNone)
+                {
+                User::After(5000000);
+                TRAP(err, amIaffected = iABClient->DoesPartialBURAffectMeL());
+                }
+            }
+        
+        if (amIaffected)
+            {
+            // Confirm that this data owner is ready for backup/restore operations
+            iABClient->ConfirmReadyForBURL(KErrNone);
+            }
+        }
+    }
+
+
 // End of file