96 |
96 |
97 bool FmBkupEnginePrivate::startBackup(QList<FmBkupDrivesAndOperation* > drivesAndOperationList, |
97 bool FmBkupEnginePrivate::startBackup(QList<FmBkupDrivesAndOperation* > drivesAndOperationList, |
98 QList<FmBkupBackupCategory*> backupCategoryList, |
98 QList<FmBkupBackupCategory*> backupCategoryList, |
99 QString drive, quint32 content) |
99 QString drive, quint32 content) |
100 { |
100 { |
|
101 FmLogger::log( "FmBkupEnginePrivate::startBackup_with drive: " + drive + |
|
102 "_number:" + QString::number(DriverNameToNumber( drive ))); |
101 if( drive.isEmpty() ) { |
103 if( drive.isEmpty() ) { |
102 iError = KErrPathNotFound; |
104 iError = KErrPathNotFound; |
|
105 FmLogger::log( "FmBkupEnginePrivate::startBackup_with return with KErrPathNotFound because drive is empty" ); |
|
106 return false; |
|
107 } |
|
108 QStringList backupableDriveList; |
|
109 getBackupDriveList( backupableDriveList ); |
|
110 if( !backupableDriveList.contains( drive, Qt::CaseInsensitive ) ) { |
|
111 iError = KErrPathNotFound; |
|
112 FmLogger::log( "FmBkupEnginePrivate::startBackup_with return with KErrPathNotFound because drive is not available" ); |
103 return false; |
113 return false; |
104 } |
114 } |
105 QString logString; |
115 QString logString; |
106 logString = "startBackup"; |
116 logString = "startBackup"; |
107 FmLogger::log( logString ); |
117 FmLogger::log( logString ); |
181 |
191 |
182 logString = "startBackup_StartOperationL"; |
192 logString = "startBackup_StartOperationL"; |
183 FmLogger::log( logString ); |
193 FmLogger::log( logString ); |
184 |
194 |
185 QList< FmRestoreInfo > restoreInfoList; |
195 QList< FmRestoreInfo > restoreInfoList; |
186 TInt driveNumber = DriverNameToNumber( drive ); |
196 GetRestoreInfoArray( drivesAndOperationList, restoreInfoList, drive ); |
187 GetRestoreInfoArray( drivesAndOperationList, restoreInfoList, driveNumber ); |
197 |
188 |
198 for ( TInt i( 0 ); i < restoreInfoList.count(); ++i ) |
189 for ( TInt i( 0 ); i < restoreInfoList.count(); i++ ) |
|
190 { |
199 { |
191 bool toContinue = false; |
200 bool toContinue = false; |
192 FmRestoreInfo &info = restoreInfoList[ i ]; |
201 FmRestoreInfo &info = restoreInfoList[ i ]; |
193 TUint32 existContent( FmgrToBkupMask( info.content() ) ); |
202 TUint32 existContent( FmgrToBkupMask( info.content() ) ); |
194 if ( bkupContent & existContent ) |
203 if ( bkupContent & existContent ) |
648 return true; |
664 return true; |
649 } |
665 } |
650 |
666 |
651 void FmBkupEnginePrivate::GetRestoreInfoArray( QList<FmBkupDrivesAndOperation* > drivesAndOperationList, |
667 void FmBkupEnginePrivate::GetRestoreInfoArray( QList<FmBkupDrivesAndOperation* > drivesAndOperationList, |
652 QList< FmRestoreInfo > &restoreInfoList, |
668 QList< FmRestoreInfo > &restoreInfoList, |
653 const TInt aDrive ) |
669 const QString& aDrive ) |
654 { |
670 { |
|
671 int targetDrive = DriverNameToNumber( aDrive ); |
655 FmBackupSettings& settings( *( q->BackupSettingsL() ) ); |
672 FmBackupSettings& settings( *( q->BackupSettingsL() ) ); |
656 |
673 |
657 restoreInfoList.clear(); |
674 restoreInfoList.clear(); |
658 |
675 |
659 /////// |
676 /////// |
682 CleanupStack::PushL( cleanupItem ); |
699 CleanupStack::PushL( cleanupItem ); |
683 iBkupEngine->ListArchivesL( |
700 iBkupEngine->ListArchivesL( |
684 archives, |
701 archives, |
685 params, |
702 params, |
686 AllowedDriveAttMatchMask(), |
703 AllowedDriveAttMatchMask(), |
687 aDrive ); |
704 targetDrive ); |
688 |
705 |
689 // Fill restore info |
706 // Fill restore info |
690 TInt count( archives.Count() ); |
707 TInt count( archives.Count() ); |
691 // restoreInfoList.ReserveL( count ); |
708 // restoreInfoList.ReserveL( count ); |
692 |
709 |
748 return KDriveAttRemovable;//KDriveAttRemovable; |
765 return KDriveAttRemovable;//KDriveAttRemovable; |
749 } |
766 } |
750 |
767 |
751 TInt FmBkupEnginePrivate::DriverNameToNumber( QString driverName ) |
768 TInt FmBkupEnginePrivate::DriverNameToNumber( QString driverName ) |
752 { |
769 { |
|
770 if( driverName.isEmpty() ) { |
|
771 return KErrNotFound; |
|
772 } |
753 TInt drive = 0; |
773 TInt drive = 0; |
754 drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA; |
774 drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA; |
755 return drive; |
775 return drive; |
756 } |
776 } |
757 QString FmBkupEnginePrivate::NumberToDriverName( TInt driver ) |
777 QString FmBkupEnginePrivate::NumberToDriverName( TInt driver ) |