javamanager/javabackup/midp2backup/src.s60/midp2backupplugin.cpp
changeset 76 4ad59aaee882
parent 48 e0d6e9bd3ca7
equal deleted inserted replaced
69:773449708c84 76:4ad59aaee882
   123     iDrive = aDrive;
   123     iDrive = aDrive;
   124 }
   124 }
   125 
   125 
   126 void CMidp2BackupPlugin::GetBackupDataSectionL(TPtr8& aBuffer, TBool& aFinished)
   126 void CMidp2BackupPlugin::GetBackupDataSectionL(TPtr8& aBuffer, TBool& aFinished)
   127 {
   127 {
   128     LOG(EBackup, EInfo, "CMidp2BackupPlugin::GetBackupDataSectionL");
   128     ILOG(EBackup, "+CMidp2BackupPlugin::GetBackupDataSectionL()");
   129 
   129 
   130     iBufferSpaceLeft = aBuffer.MaxLength();
   130     iBufferSpaceLeft = aBuffer.MaxLength();
   131     RDesWriteStream stream(aBuffer);
   131     RDesWriteStream stream(aBuffer);
   132     CleanupClosePushL(stream);
   132     CleanupClosePushL(stream);
   133 
   133 
   142     {
   142     {
   143         iStorageBackupUtil->BackupStorageDataL(stream, iStorageDataBackup, iBufferSpaceLeft);
   143         iStorageBackupUtil->BackupStorageDataL(stream, iStorageDataBackup, iBufferSpaceLeft);
   144         aFinished = EFalse;
   144         aFinished = EFalse;
   145     }
   145     }
   146 
   146 
   147     else
   147     if (!iStorageDataBackup)
   148     {
   148     {
   149         if (iFirstCallToGetBackupDataSection)
   149         if (iFirstCallToGetBackupDataSection)
   150         {
   150         {
   151             LOG(EBackup, EInfo, "First Call To GetBackupDataSection");
   151             LOG(EBackup, EInfo, "First Call To GetBackupDataSection");
   152             // Get the uids of midlets whose icons are to be backed up
   152             // Get the uids of midlets whose icons are to be backed up
   299 
   299 
   300         else
   300         else
   301         {
   301         {
   302             aFinished = ETrue;
   302             aFinished = ETrue;
   303             iFirstCallToGetBackupDataSection = ETrue;
   303             iFirstCallToGetBackupDataSection = ETrue;
   304             iStorageDataBackup = ETrue;
   304             // iStorageDataBackup = ETrue;
   305         }
   305         }
   306 
   306 
   307         delete fullFileName;
   307         delete fullFileName;
   308     }
   308     }
   309     CleanupStack::PopAndDestroy(&stream);
   309     CleanupStack::PopAndDestroy(&stream);
       
   310     ILOG(EBackup, "-CMidp2BackupPlugin::GetBackupDataSectionL()");
   310 }
   311 }
   311 
   312 
   312 
   313 
   313 void CMidp2BackupPlugin::InitialiseRestoreBaseDataL(TDriveNumber aDrive)
   314 void CMidp2BackupPlugin::InitialiseRestoreBaseDataL(TDriveNumber aDrive)
   314 {
   315 {
   316     iDrive = aDrive;
   317     iDrive = aDrive;
   317 }
   318 }
   318 
   319 
   319 void CMidp2BackupPlugin::RestoreBaseDataSectionL(TDesC8& aBuffer, TBool aFinished)
   320 void CMidp2BackupPlugin::RestoreBaseDataSectionL(TDesC8& aBuffer, TBool aFinished)
   320 {
   321 {
   321     LOG(EBackup, EInfo, "CMidp2BackupPlugin::RestoreBaseDataSectionL");
   322     ILOG(EBackup, "+CMidp2BackupPlugin::RestoreBaseDataSectionL()");
   322 
   323 
   323     iBufferSpaceLeft = aBuffer.Size();
   324     iBufferSpaceLeft = aBuffer.Size();
   324     RDesReadStream stream(aBuffer);
   325     RDesReadStream stream(aBuffer);
   325     CleanupClosePushL(stream);
   326     CleanupClosePushL(stream);
   326     TBool versionCheck = ETrue;
   327     TBool versionCheck = ETrue;
   347         iBufferSpaceLeft -= 8;
   348         iBufferSpaceLeft -= 8;
   348     }
   349     }
   349 
   350 
   350     if (iRestoreState == EStorage)
   351     if (iRestoreState == EStorage)
   351     {
   352     {
       
   353         ILOG1(EBackup, "Restoring Storage for drive %d", iDrive);
   352         iStorageBackupUtil -> RestoreStorageDataL(stream, iRestoreState, iBufferSpaceLeft);
   354         iStorageBackupUtil -> RestoreStorageDataL(stream, iRestoreState, iBufferSpaceLeft);
   353     }
   355     }
   354 
   356 
   355     // Only at first call
   357     // Only at first call
   356     if ((iRestoreState != EStorage && iRestoreState != EVersion) && (iRestoreState != EInstall))
   358     if ((iRestoreState != EStorage && iRestoreState != EVersion) && (iRestoreState != EInstall))
   370         ProcessBufferL(stream);
   372         ProcessBufferL(stream);
   371 
   373 
   372         if (aFinished)
   374         if (aFinished)
   373         {
   375         {
   374             // Set state to EStorage
   376             // Set state to EStorage
   375             iRestoreState = EStorage;
   377             ILOG1(EBackup, "Restore of drive %d complete, resetting statemachine for next drive", iDrive);
   376         }
   378             iRestoreState = EAppArc;
   377     }
   379         }
   378 
   380     }
   379     aFinished = ETrue;
   381 
       
   382     // aFinished = ETrue;
   380     CleanupStack::PopAndDestroy(&stream);
   383     CleanupStack::PopAndDestroy(&stream);
       
   384     ILOG(EBackup, "-CMidp2BackupPlugin::RestoreBaseDataSectionL()");
   381 }
   385 }
   382 
   386 
   383 void CMidp2BackupPlugin::InitialiseRestoreIncrementDataL(TDriveNumber /* aDrive */)
   387 void CMidp2BackupPlugin::InitialiseRestoreIncrementDataL(TDriveNumber /* aDrive */)
   384 {
   388 {
   385     JELOG2(EBackup);
   389     JELOG2(EBackup);