filemanager/src/fmbkupenginewrapper/private/symbian/fmbkupengine_p.cpp
changeset 49 81668a704644
parent 33 328cf6fbe40c
equal deleted inserted replaced
47:12b82dc0e8db 49:81668a704644
    92             }
    92             }
    93         }
    93         }
    94     return ret;
    94     return ret;
    95     }
    95     }
    96 
    96 
    97 bool FmBkupEnginePrivate::startBackup(QList<FmBkupDrivesAndOperation* > drivesAndOperationList,
    97 /*
       
    98  * wrap up startBackupL as a unleave function
       
    99  */
       
   100 bool FmBkupEnginePrivate::startBackup( QList<FmBkupDrivesAndOperation* > drivesAndOperationList,
       
   101     QList<FmBkupBackupCategory*> backupCategoryList,
       
   102     QString drive, quint32 content)
       
   103 {
       
   104     TBool ret( EFalse );
       
   105     TRAP_IGNORE( ret = startBackupL( drivesAndOperationList, backupCategoryList, drive, content ) );
       
   106     return ret;
       
   107 }
       
   108 
       
   109 bool FmBkupEnginePrivate::startBackupL(QList<FmBkupDrivesAndOperation* > drivesAndOperationList,
    98 	    QList<FmBkupBackupCategory*> backupCategoryList,
   110 	    QList<FmBkupBackupCategory*> backupCategoryList,
    99 	    QString drive, quint32 content)
   111 	    QString drive, quint32 content)
   100 {
   112 {
   101     FM_LOG( "FmBkupEnginePrivate::startBackup_with drive: " + drive +
   113     FM_LOG( "FmBkupEnginePrivate::startBackup_with drive: " + drive +
   102             "_number:" + QString::number(DriverNameToNumber( drive )));
   114             "_number:" + QString::number(DriverNameToNumber( drive )));
   135 
   147 
   136 	
   148 	
   137 	for( QList<FmBkupBackupCategory* >::iterator it = backupCategoryList.begin();
   149 	for( QList<FmBkupBackupCategory* >::iterator it = backupCategoryList.begin();
   138 		    it != backupCategoryList.end(); ++it ) {
   150 		    it != backupCategoryList.end(); ++it ) {
   139         FmBkupBackupCategory* fmbkupCategory = *it;
   151         FmBkupBackupCategory* fmbkupCategory = *it;
   140         CBkupCategory* category = CBkupCategory::NewL();
   152         CBkupCategory* category = CBkupCategory::NewLC();        
   141         
       
   142         category->setCategory( fmbkupCategory->category() );
   153         category->setCategory( fmbkupCategory->category() );
   143         
   154         
   144         HBufC *archiveName = HBufC::NewL( fmbkupCategory->archive_name().length() );
   155         HBufC *archiveName = HBufC::NewL( fmbkupCategory->archive_name().length() );
   145         *archiveName = fmbkupCategory->archive_name().utf16();
   156         *archiveName = fmbkupCategory->archive_name().utf16();
   146         category->setArchive_name( *archiveName );
   157         category->setArchive_name( *archiveName );
   162             category->addExclude_uids( value );	
   173             category->addExclude_uids( value );	
   163         }
   174         }
   164         
   175         
   165         
   176         
   166         iBkupCategoryList->AppendL( category );
   177         iBkupCategoryList->AppendL( category );
       
   178         CleanupStack::Pop();//category
   167         }
   179         }
   168 	
   180 	
   169 	TUint32 bkupContent( FmgrToBkupMask( content ) );
   181 	TUint32 bkupContent( FmgrToBkupMask( content ) );
   170 	//TUint32 bkupContent = 63;
   182 	//TUint32 bkupContent = 63;
   171 	
   183 	
   440     default: 
   452     default: 
   441         return FmErrUnKnown;
   453         return FmErrUnKnown;
   442     }    
   454     }    
   443 }
   455 }
   444 
   456 
   445 
   457 /*
   446 
   458  * wrap up leave function deleteBackupL.
   447 
   459  */
   448 
       
   449 int FmBkupEnginePrivate::deleteBackup( QList<FmBkupDrivesAndOperation* > drivesAndOperationList )
   460 int FmBkupEnginePrivate::deleteBackup( QList<FmBkupDrivesAndOperation* > drivesAndOperationList )
   450 {
   461 {
       
   462     TInt err( KErrNone );
       
   463     TRAP_IGNORE( err = deleteBackupL( drivesAndOperationList) );
       
   464     return err;
       
   465 }
       
   466 
       
   467 int FmBkupEnginePrivate::deleteBackupL( QList<FmBkupDrivesAndOperation* > drivesAndOperationList )
       
   468 {
   451     iError = FmErrNone;
   469     iError = FmErrNone;
   452 
   470 
   453     QList< FmRestoreInfo > selection;
   471     QList< FmRestoreInfo > selection;
   454     FmRestoreSettings& rstSettings( *( q->RestoreSettingsL() ) );
   472     FmRestoreSettings& rstSettings( *( q->RestoreSettings() ) );
   455     rstSettings.GetSelectionL( selection );
   473     rstSettings.GetSelection( selection );
   456 
   474 
   457     iBkupCategoryList->ResetAndDestroy();
   475     iBkupCategoryList->ResetAndDestroy();
   458     for( QList<FmBkupDrivesAndOperation* >::iterator it = drivesAndOperationList.begin();
   476     for( QList<FmBkupDrivesAndOperation* >::iterator it = drivesAndOperationList.begin();
   459         it != drivesAndOperationList.end(); ++it )
   477         it != drivesAndOperationList.end(); ++it )
   460         {
   478         {
   524     CleanupStack::PopAndDestroy( params );
   542     CleanupStack::PopAndDestroy( params );
   525     
   543     
   526     return iError;
   544     return iError;
   527 }
   545 }
   528 
   546 
   529 
   547 /*
   530 bool FmBkupEnginePrivate::StartRestoreL( QList<FmBkupDrivesAndOperation* > drivesAndOperationList )
   548  * wrap up startRestoreL as a unleave function
       
   549  */
       
   550 bool FmBkupEnginePrivate::startRestore( QList<FmBkupDrivesAndOperation* > drivesAndOperationList )
       
   551 {
       
   552     TBool ret( EFalse );
       
   553     TRAP_IGNORE( ret = startRestoreL( drivesAndOperationList ) );
       
   554     return ret;
       
   555 }
       
   556 
       
   557 bool FmBkupEnginePrivate::startRestoreL( QList<FmBkupDrivesAndOperation* > drivesAndOperationList )
   531     {
   558     {
   532     TBool diskFull( SysUtil::DiskSpaceBelowCriticalLevelL(
   559     TBool diskFull( SysUtil::DiskSpaceBelowCriticalLevelL(
   533         &iFs, 0, KFmgrSystemDrive ) );
   560         &iFs, 0, KFmgrSystemDrive ) );
   534     if ( diskFull )
   561     if ( diskFull )
   535         {
   562         {
   577         AllowedDriveAttMatchMask() );
   604         AllowedDriveAttMatchMask() );
   578 
   605 
   579     // Get user set restore selection
   606     // Get user set restore selection
   580     QList< FmRestoreInfo > selection;
   607     QList< FmRestoreInfo > selection;
   581 //    CleanupClosePushL( selection );
   608 //    CleanupClosePushL( selection );
   582     FmRestoreSettings& rstSettings( *( q->RestoreSettingsL() ) );
   609     FmRestoreSettings& rstSettings( *( q->RestoreSettings() ) );
   583     rstSettings.GetSelectionL( selection );
   610     rstSettings.GetSelection( selection );
   584 
   611 
   585     // Remove non user selected archives
   612     // Remove non user selected archives
   586     TInt i( 0 );
   613     TInt i( 0 );
   587     while ( i < archives.Count() )
   614     while ( i < archives.Count() )
   588         {
   615         {
   630 
   657 
   631     CMMCScBkupOpParamsRestoreFull* params =
   658     CMMCScBkupOpParamsRestoreFull* params =
   632         CMMCScBkupOpParamsRestoreFull::NewL( driveReader, EBUCatAllInOne );
   659         CMMCScBkupOpParamsRestoreFull::NewL( driveReader, EBUCatAllInOne );
   633     CleanupStack::PopAndDestroy(); // driveReader
   660     CleanupStack::PopAndDestroy(); // driveReader
   634 
   661 
   635     FmBackupSettings& bkupSettings( *( q->BackupSettingsL() ) );
   662     FmBackupSettings& bkupSettings( *( q->BackupSettings() ) );
   636     // Get list of all archives
   663     // Get list of all archives
   637     RPointerArray< CMMCScBkupArchiveInfo > archives;
   664     RPointerArray< CMMCScBkupArchiveInfo > archives;
   638     TCleanupItem cleanupItem( ResetAndDestroyArchives, &archives );
   665     TCleanupItem cleanupItem( ResetAndDestroyArchives, &archives );
   639     CleanupStack::PushL( cleanupItem );
   666     CleanupStack::PushL( cleanupItem );
   640     iBkupEngine->ListArchivesL(
   667     iBkupEngine->ListArchivesL(