filemanager/src/filemanager/src/backuprestore/fmbackupview.cpp
changeset 37 15bc28c9dd51
parent 16 ada7962b4308
child 46 d58987eac7e8
equal deleted inserted replaced
16:ada7962b4308 37:15bc28c9dd51
    18 
    18 
    19 #include "fmbackupview.h"
    19 #include "fmbackupview.h"
    20 #include "fmbackupwidget.h"
    20 #include "fmbackupwidget.h"
    21 #include "fmviewmanager.h"
    21 #include "fmviewmanager.h"
    22 #include "fmoperationbase.h"
    22 #include "fmoperationbase.h"
    23 
    23 #include "fmdlgutils.h"
    24 
    24 
    25 #include <QApplication>
    25 #include <QApplication>
    26 
    26 
    27 #include <hbaction.h>
    27 #include <hbaction.h>
    28 #include <hbtoolbar.h>
    28 #include <hbtoolbar.h>
    29 #include <hbmenu.h>
    29 #include <hbmenu.h>
    30 #include <hbmainwindow.h>
    30 #include <hbmainwindow.h>
    31 #include <hbmessagebox.h>
       
    32 
       
    33 
    31 
    34 FmBackupView::FmBackupView() : FmViewBase( EBackupView )
    32 FmBackupView::FmBackupView() : FmViewBase( EBackupView )
    35 {
    33 {
    36 	setTitle( tr( "Backup" ) );
    34     setTitle( hbTrId( "Backup" ) );
    37 
    35 
    38 	initToolBar();
    36     initToolBar();
    39 	initMainWidget();
    37     initMainWidget();
    40 	initMenu();
    38     initMenu();
    41 	mOperationService = FmViewManager::viewManager()->operationService();
    39     mOperationService = FmViewManager::viewManager()->operationService();
    42 
    40 
    43 	QMetaObject::connectSlotsByName( this );
       
    44 }
    41 }
    45 
    42 
    46 FmBackupView::~FmBackupView()
    43 FmBackupView::~FmBackupView()
    47 {
    44 {
    48     removeToolBarAction();
    45     removeToolBarAction();
    51 void FmBackupView::initMenu()
    48 void FmBackupView::initMenu()
    52 {
    49 {
    53     HbAction *action = 0;
    50     HbAction *action = 0;
    54     
    51     
    55 #ifdef FM_CHANGE_ORIENT_ENABLE
    52 #ifdef FM_CHANGE_ORIENT_ENABLE
    56 	action = new HbAction( this );
    53     action = new HbAction( this );
    57     action->setObjectName( "rotateAction" );
    54     action->setObjectName( "rotateAction" );
    58     action->setText( hbTrId( "Change orientation" ) );
    55     action->setText( hbTrId( "Change orientation" ) );
    59     menu()->addAction( action );
    56     menu()->addAction( action );
       
    57     connect( action, SIGNAL(triggered()), this, SLOT( on_rotateAction_triggered() ), Qt::QueuedConnection );
    60 #endif
    58 #endif
    61 
    59 
    62 	action = new HbAction( this );
    60     action = new HbAction( this );
    63     action->setObjectName( "backupAction" );
    61     action->setObjectName( "backupAction" );
    64     action->setText( hbTrId( "Start backup" ) );
    62     action->setText( hbTrId( "Start backup" ) );
    65     menu()->addAction( action );
    63     menu()->addAction( action );
       
    64     connect( action, SIGNAL(triggered()), this, SLOT( on_backupAction_triggered() ), Qt::QueuedConnection );
    66 
    65 
    67 	action = new HbAction( this );
    66     action = new HbAction( this );
    68     action->setObjectName( "deleteBackupAction" );
    67     action->setObjectName( "deleteBackupAction" );
    69     action->setText( hbTrId( "Delete backup" ) );
    68     action->setText( hbTrId( "Delete backup" ) );
    70     menu()->addAction( action );
    69     menu()->addAction( action );
    71 
    70     connect( action, SIGNAL(triggered()), this, SLOT( on_deleteBackupAction_triggered() ), Qt::QueuedConnection );
    72 }
    71 }
    73 
    72 
    74 void FmBackupView::initMainWidget()
    73 void FmBackupView::initMainWidget()
    75 {
    74 {
    76 	mMainWidget = new FmBackupWidget( this );
    75     mMainWidget = new FmBackupWidget( this );
    77     setWidget( mMainWidget );
    76     setWidget( mMainWidget );
    78 
    77 
    79 }
    78 }
    80 
    79 
    81 void FmBackupView::initToolBar()
    80 void FmBackupView::initToolBar()
    82 {
    81 {
    83     mToolBarAction = new HbAction( this );
    82     mToolBarAction = new HbAction( this );
    84     mToolBarAction->setObjectName( "leftAction" );
    83     mToolBarAction->setObjectName( "leftAction" );
    85     mToolBarAction->setText( hbTrId("Start backup") );
    84     mToolBarAction->setText( hbTrId("Start backup") );
    86     toolBar()->addAction( mToolBarAction );
    85     toolBar()->addAction( mToolBarAction );
       
    86     connect( mToolBarAction, SIGNAL(triggered()), this, SLOT( on_leftAction_triggered() ), Qt::QueuedConnection );
    87     
    87     
    88     toolBar()->setOrientation( Qt::Horizontal );
    88     toolBar()->setOrientation( Qt::Horizontal );
    89 }
    89 }
    90 
    90 
    91 void FmBackupView::on_leftAction_triggered()
    91 void FmBackupView::on_leftAction_triggered()
    92 {
    92 {
    93     int ret = mOperationService->asyncBackup();
    93     int ret = mOperationService->asyncBackup();
       
    94     FM_LOG( "FmBackupView_asyncBackup: ret= " + QString::number(ret) );
    94     switch( ret )
    95     switch( ret )
    95     {
    96     {
    96     case FmErrNone:
    97     case FmErrNone:
    97         break;
    98         break;
    98     case FmErrWrongParam:
    99     case FmErrWrongParam:
    99         HbMessageBox::information( QString( hbTrId("Operation canceled with wrong param!") ) );
   100         FmDlgUtils::information( QString( hbTrId("Operation canceled with wrong param!") ) );
   100         break;
   101         break;
   101     case FmErrAlreadyStarted:
   102     case FmErrAlreadyStarted:
   102         HbMessageBox::information( QString( hbTrId("Operation canceled because already started!") ) );
   103         FmDlgUtils::information( QString( hbTrId("Operation canceled because already started!") ) );
   103         break;
   104         break;
   104     case FmErrPathNotFound:
   105     case FmErrPathNotFound:
   105         HbMessageBox::information( QString( hbTrId("Operation canceled because can not find target drive!") ) );
   106         FmDlgUtils::information( QString( hbTrId("Operation canceled because can not find target path or drive is not available!") ) );
   106         break;
   107         break;
   107     case FmErrAlreadyExists:
   108     case FmErrAlreadyExists:
   108         HbMessageBox::information( QString( hbTrId("backup canceled") ) );
   109         FmDlgUtils::information( QString( hbTrId("backup canceled") ) );
   109         break;
   110         break;
   110     default:
   111     default:
   111         HbMessageBox::information( QString( hbTrId("backup failed") ) );
   112         FmDlgUtils::information( QString( hbTrId("backup failed") ) );
   112         break;
   113         break;
   113     }
   114     }
   114 }
   115 }
   115 #ifdef FM_CHANGE_ORIENT_ENABLE
   116 #ifdef FM_CHANGE_ORIENT_ENABLE
   116 void FmBackupView::on_rotateAction_triggered()
   117 void FmBackupView::on_rotateAction_triggered()
   137 void FmBackupView::removeToolBarAction()
   138 void FmBackupView::removeToolBarAction()
   138 {
   139 {
   139     toolBar()->removeAction( mToolBarAction );
   140     toolBar()->removeAction( mToolBarAction );
   140 }
   141 }
   141 
   142 
       
   143 void FmBackupView::refreshBackupDate()
       
   144 {
       
   145     mMainWidget->updateBackupDate();
       
   146 }
       
   147 
       
   148 void FmBackupView::refreshModel()
       
   149 {
       
   150     mMainWidget->refreshModel();
       
   151 }