convergedcallengine/spsettings/backuphelper/src/spsbackuphelpermonitor.cpp
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
    42 CSpsBackupHelperMonitor::~CSpsBackupHelperMonitor()
    42 CSpsBackupHelperMonitor::~CSpsBackupHelperMonitor()
    43     {
    43     {
    44     Cancel();
    44     Cancel();
    45     iProperty.Close();
    45     iProperty.Close();
    46     delete iPerformer;
    46     delete iPerformer;
    47     delete iABClient;
       
    48     }
    47     }
    49 
    48 
    50 // ---------------------------------------------------------------------------
    49 // ---------------------------------------------------------------------------
    51 // 
    50 // 
    52 // ---------------------------------------------------------------------------
    51 // ---------------------------------------------------------------------------
    72     TInt backupStateValue = 0;
    71     TInt backupStateValue = 0;
    73     iProperty.Attach( KUidSystemCategory, conn::KUidBackupRestoreKey );
    72     iProperty.Attach( KUidSystemCategory, conn::KUidBackupRestoreKey );
    74 
    73 
    75     // Check current state to see if we were started for backup purposes
    74     // Check current state to see if we were started for backup purposes
    76     iProperty.Get(backupStateValue);
    75     iProperty.Get(backupStateValue);
    77     
       
    78     if (!NoBackupRestore(backupStateValue))
       
    79         {
       
    80         iABClient = CActiveBackupClient::NewL();
       
    81             
       
    82         // Confirm that this data owner is ready for backup/restore operations
       
    83         iABClient->ConfirmReadyForBURL(KErrNone);
       
    84         }
       
    85     
    76     
    86     // Subscribe to the P&S flag to catch transitions
    77     // Subscribe to the P&S flag to catch transitions
    87     Subscribe();
    78     Subscribe();
    88     
    79     
    89     // Construct performer
    80     // Construct performer
   150 //
   141 //
   151 TBool CSpsBackupHelperMonitor::NoBackupRestore( TInt aBackupStateValue )
   142 TBool CSpsBackupHelperMonitor::NoBackupRestore( TInt aBackupStateValue )
   152     {
   143     {
   153     // Not set or no backup or restore ongoing
   144     // Not set or no backup or restore ongoing
   154     TBool ret = 
   145     TBool ret = 
   155         ( ( aBackupStateValue & KBURPartTypeMask ) == conn::EBURUnset ||
   146         ( ( aBackupStateValue == conn::EBURUnset ) ||
   156         ( aBackupStateValue & KBURPartTypeMask ) == conn::EBURNormal );
   147         ( aBackupStateValue == conn::EBURNormal ) );
   157     
   148     
   158     return ret;
   149     return ret;
   159     }
   150     }
   160 
   151 
   161 // ---------------------------------------------------------------------------
   152 // ---------------------------------------------------------------------------
   181     TInt backupStateValue = 0;  // To store the P&S value
   172     TInt backupStateValue = 0;  // To store the P&S value
   182 
   173 
   183     // re-subscribe to the flag to monitor future changes
   174     // re-subscribe to the flag to monitor future changes
   184     Subscribe();
   175     Subscribe();
   185 
   176 
   186     CheckStatusL();
   177     iProperty.Get(backupStateValue);
   187 
   178 
       
   179     // Process the mode change accordingly
       
   180     ProcessBackupStateL(backupStateValue);
   188     XSPSLOGSTRING( "CSpsBackupHelperMonitor::RunL OUT" );
   181     XSPSLOGSTRING( "CSpsBackupHelperMonitor::RunL OUT" );
   189     }
   182     }
   190 
   183 
   191 // ---------------------------------------------------------------------------
   184 // ---------------------------------------------------------------------------
   192 // 
   185 // 
   205 void CSpsBackupHelperMonitor::DoCancel()
   198 void CSpsBackupHelperMonitor::DoCancel()
   206     {
   199     {
   207     iProperty.Cancel();
   200     iProperty.Cancel();
   208     }
   201     }
   209 
   202 
   210 void CSpsBackupHelperMonitor::CheckStatusL()
       
   211     {
       
   212     TInt backupInfo =0;
       
   213     iProperty.Get(backupInfo);
       
   214     
       
   215     // Process the mode change accordingly
       
   216     ProcessBackupStateL(backupInfo);
       
   217 
       
   218     if (NoBackupRestore(backupInfo))
       
   219         {
       
   220         delete iABClient;
       
   221         iABClient = NULL;
       
   222         }
       
   223     else 
       
   224         {
       
   225         if (iABClient == NULL)
       
   226             {
       
   227             iABClient = CActiveBackupClient::NewL();
       
   228             }
       
   229         
       
   230         TDriveList driveList;
       
   231         TBURPartType partType;
       
   232         TBackupIncType incType;
       
   233         TInt err;
       
   234         TRAP(err, iABClient->BURModeInfoL(driveList, partType, incType));
       
   235         if (err != KErrNone)
       
   236             {
       
   237             XSPSLOGSTRING("BURModeInfoL error");
       
   238             }
       
   239         
       
   240         TBool amIaffected = ETrue;
       
   241         
       
   242         if (partType == EBURRestorePartial || partType == EBURBackupPartial)
       
   243             {
       
   244             TRAP(err, amIaffected = iABClient->DoesPartialBURAffectMeL());
       
   245             if (err != KErrNone)
       
   246                 {
       
   247                 User::After(5000000);
       
   248                 TRAP(err, amIaffected = iABClient->DoesPartialBURAffectMeL());
       
   249                 }
       
   250             }
       
   251         
       
   252         if (amIaffected)
       
   253             {
       
   254             // Confirm that this data owner is ready for backup/restore operations
       
   255             iABClient->ConfirmReadyForBURL(KErrNone);
       
   256             }
       
   257         }
       
   258     }
       
   259 
       
   260 
       
   261 // End of file
   203 // End of file
   262 
   204