filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.cpp
changeset 16 ada7962b4308
parent 14 1957042d8c7e
child 18 edd66bde63a4
child 25 b7bfdea70ca2
child 37 15bc28c9dd51
equal deleted inserted replaced
14:1957042d8c7e 16:ada7962b4308
    38     connect( mBkupEngine, SIGNAL( notifyUpdate(int) ), this, SLOT( onNotifyUpdate(int) ), Qt::QueuedConnection );
    38     connect( mBkupEngine, SIGNAL( notifyUpdate(int) ), this, SLOT( onNotifyUpdate(int) ), Qt::QueuedConnection );
    39     connect( mBkupEngine, SIGNAL( notifyFinish(int) ), 
    39     connect( mBkupEngine, SIGNAL( notifyFinish(int) ), 
    40         this, SLOT( onNotifyFinish(int) ), Qt::QueuedConnection );
    40         this, SLOT( onNotifyFinish(int) ), Qt::QueuedConnection );
    41     connect( mBkupEngine, SIGNAL( notifyMemoryLow(int, int& ) ), 
    41     connect( mBkupEngine, SIGNAL( notifyMemoryLow(int, int& ) ), 
    42         this, SLOT( onNotifyMemoryLow(int, int&) ) );
    42         this, SLOT( onNotifyMemoryLow(int, int&) ) );
       
    43     connect( mBkupEngine, SIGNAL( notifyBackupFilesExist( bool& )), this, SLOT( onNotifyBackupFilesExist( bool& )));
       
    44     
    43 }
    45 }
    44 FmBackupRestoreHandler::~FmBackupRestoreHandler()
    46 FmBackupRestoreHandler::~FmBackupRestoreHandler()
    45 {
    47 {
    46     delete mBkupEngine;
    48     delete mBkupEngine;
    47     delete mBackupConfigLoader;
    49     delete mBackupConfigLoader;
    72     bool ret = mBkupEngine->startBackup( backupConfigLoader()->driversAndOperationList(),
    74     bool ret = mBkupEngine->startBackup( backupConfigLoader()->driversAndOperationList(),
    73         backupConfigLoader()->backupCategoryList(), 
    75         backupConfigLoader()->backupCategoryList(), 
    74         mBkupEngine->BackupSettingsL()->targetDrive(),
    76         mBkupEngine->BackupSettingsL()->targetDrive(),
    75         mBkupEngine->BackupSettingsL()->content() );
    77         mBkupEngine->BackupSettingsL()->content() );
    76 
    78 
    77     if( !ret )
    79     if( !ret ) {
    78         {
       
    79         mCurrentProcess = ProcessNone;
    80         mCurrentProcess = ProcessNone;
    80         HbMessageBox::information(tr("backup failed"));
       
    81         }
    81         }
    82     return ret;
    82     return ret;
    83 }
    83 }
    84 void FmBackupRestoreHandler::cancelBackup()
    84 void FmBackupRestoreHandler::cancelBackup()
    85 {
    85 {
    88 bool FmBackupRestoreHandler::startRestore( FmOperationRestore *operationRestore )
    88 bool FmBackupRestoreHandler::startRestore( FmOperationRestore *operationRestore )
    89 {
    89 {
    90     mCurrentProcess = ProcessRestore;
    90     mCurrentProcess = ProcessRestore;
    91     mBkupEngine->RestoreSettingsL()->SetSelection( operationRestore->selection() );
    91     mBkupEngine->RestoreSettingsL()->SetSelection( operationRestore->selection() );
    92     bool ret = mBkupEngine->startRestore( backupConfigLoader()->driversAndOperationList() );
    92     bool ret = mBkupEngine->startRestore( backupConfigLoader()->driversAndOperationList() );
    93     if( !ret )
    93     if( !ret ) {
    94         {
       
    95         mCurrentProcess = ProcessNone;
    94         mCurrentProcess = ProcessNone;
    96         HbMessageBox::information(tr("restore failed"));
       
    97         }
    95         }
    98     return ret;
    96     return ret;
    99 }
    97 }
   100 
    98 
   101 int FmBackupRestoreHandler::deleteBackup( quint64 selection )
    99 int FmBackupRestoreHandler::deleteBackup( quint64 selection )
   114         if ( !HbMessageBox::question( "memory low, continue?" ) ){
   112         if ( !HbMessageBox::question( "memory low, continue?" ) ){
   115             userError = FmErrCancel;
   113             userError = FmErrCancel;
   116         }
   114         }
   117     }
   115     }
   118 }
   116 }
       
   117 void FmBackupRestoreHandler::onNotifyBackupFilesExist( bool &isContinue )
       
   118     {
       
   119     if ( HbMessageBox::question( "some bacup files exist, continue?" ) )
       
   120         {
       
   121         isContinue = true;
       
   122         }
       
   123     else
       
   124         {
       
   125         isContinue = false;
       
   126         }
       
   127     }
   119 
   128 
   120 
   129 
   121 void FmBackupRestoreHandler::onNotifyPreparing( bool cancelable )
   130 void FmBackupRestoreHandler::onNotifyPreparing( bool cancelable )
   122 {
   131 {
   123     emit notifyPreparing(  cancelable );
   132     emit notifyPreparing(  cancelable );
   138         emit notifyCanceled();
   147         emit notifyCanceled();
   139     } else {
   148     } else {
   140         emit notifyError( err, QString("") );
   149         emit notifyError( err, QString("") );
   141     }
   150     }
   142 }
   151 }
       
   152 
       
   153 void FmBackupRestoreHandler::getBackupDriveList( QStringList &driveList )
       
   154 {
       
   155     mBkupEngine->getBackupDriveList( driveList );
       
   156 }