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; |
666 return true; |
649 } |
667 } |
650 |
668 |
651 void FmBkupEnginePrivate::GetRestoreInfoArray( QList<FmBkupDrivesAndOperation* > drivesAndOperationList, |
669 void FmBkupEnginePrivate::GetRestoreInfoArray( QList<FmBkupDrivesAndOperation* > drivesAndOperationList, |
652 QList< FmRestoreInfo > &restoreInfoList, |
670 QList< FmRestoreInfo > &restoreInfoList, |
653 const TInt aDrive ) |
671 const QString& aDrive ) |
654 { |
672 { |
|
673 int targetDrive = DriverNameToNumber( aDrive ); |
655 FmBackupSettings& settings( *( q->BackupSettingsL() ) ); |
674 FmBackupSettings& settings( *( q->BackupSettingsL() ) ); |
656 |
675 |
657 restoreInfoList.clear(); |
676 restoreInfoList.clear(); |
658 |
677 |
659 /////// |
678 /////// |
682 CleanupStack::PushL( cleanupItem ); |
701 CleanupStack::PushL( cleanupItem ); |
683 iBkupEngine->ListArchivesL( |
702 iBkupEngine->ListArchivesL( |
684 archives, |
703 archives, |
685 params, |
704 params, |
686 AllowedDriveAttMatchMask(), |
705 AllowedDriveAttMatchMask(), |
687 aDrive ); |
706 targetDrive ); |
688 |
707 |
689 // Fill restore info |
708 // Fill restore info |
690 TInt count( archives.Count() ); |
709 TInt count( archives.Count() ); |
691 // restoreInfoList.ReserveL( count ); |
710 // restoreInfoList.ReserveL( count ); |
692 |
711 |
703 int h = iDateTime.Hour(); |
722 int h = iDateTime.Hour(); |
704 int m = iDateTime.Minute(); |
723 int m = iDateTime.Minute(); |
705 int s = iDateTime.Second(); |
724 int s = iDateTime.Second(); |
706 int year = iDateTime.Year(); |
725 int year = iDateTime.Year(); |
707 int month = iDateTime.Month() + 1; |
726 int month = iDateTime.Month() + 1; |
708 int day = iDateTime.Day(); |
727 int day = iDateTime.Day()+1; |
709 QTime time( h, m, s); |
728 QTime time( h, m, s); |
710 QDate date( year, month, day ); |
729 QDate date( year, month, day ); |
711 |
730 |
712 QDateTime dateTime( date, time ); |
731 QDateTime dateTime( date, time ); |
713 dateTime = dateTime.toLocalTime(); |
732 dateTime = dateTime.toLocalTime(); |
748 return KDriveAttRemovable;//KDriveAttRemovable; |
767 return KDriveAttRemovable;//KDriveAttRemovable; |
749 } |
768 } |
750 |
769 |
751 TInt FmBkupEnginePrivate::DriverNameToNumber( QString driverName ) |
770 TInt FmBkupEnginePrivate::DriverNameToNumber( QString driverName ) |
752 { |
771 { |
|
772 if( driverName.isEmpty() ) { |
|
773 return KErrNotFound; |
|
774 } |
753 TInt drive = 0; |
775 TInt drive = 0; |
754 drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA; |
776 drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA; |
755 return drive; |
777 return drive; |
756 } |
778 } |
757 QString FmBkupEnginePrivate::NumberToDriverName( TInt driver ) |
779 QString FmBkupEnginePrivate::NumberToDriverName( TInt driver ) |