filemanager/src/filemanager/src/backuprestore/fmbackupview.cpp
changeset 32 39cf9ced4cc4
parent 25 b7bfdea70ca2
child 47 12b82dc0e8db
equal deleted inserted replaced
27:df183af6b92f 32:39cf9ced4cc4
    29 #include <hbmenu.h>
    29 #include <hbmenu.h>
    30 #include <hbmainwindow.h>
    30 #include <hbmainwindow.h>
    31 
    31 
    32 FmBackupView::FmBackupView() : FmViewBase( EBackupView )
    32 FmBackupView::FmBackupView() : FmViewBase( EBackupView )
    33 {
    33 {
    34 	setTitle( hbTrId( "Backup" ) );
    34     setTitle( hbTrId( "Backup" ) );
    35 
    35 
    36 	initToolBar();
    36     initToolBar();
    37 	initMainWidget();
    37     initMainWidget();
    38 	initMenu();
    38     initMenu();
    39 	mOperationService = FmViewManager::viewManager()->operationService();
    39     mOperationService = FmViewManager::viewManager()->operationService();
    40 
    40 
    41 	QMetaObject::connectSlotsByName( this );
       
    42 }
    41 }
    43 
    42 
    44 FmBackupView::~FmBackupView()
    43 FmBackupView::~FmBackupView()
    45 {
    44 {
    46     removeToolBarAction();
    45     removeToolBarAction();
    49 void FmBackupView::initMenu()
    48 void FmBackupView::initMenu()
    50 {
    49 {
    51     HbAction *action = 0;
    50     HbAction *action = 0;
    52     
    51     
    53 #ifdef FM_CHANGE_ORIENT_ENABLE
    52 #ifdef FM_CHANGE_ORIENT_ENABLE
    54 	action = new HbAction( this );
    53     action = new HbAction( this );
    55     action->setObjectName( "rotateAction" );
    54     action->setObjectName( "rotateAction" );
    56     action->setText( hbTrId( "Change orientation" ) );
    55     action->setText( hbTrId( "Change orientation" ) );
    57     menu()->addAction( action );
    56     menu()->addAction( action );
       
    57     connect( action, SIGNAL(triggered()), this, SLOT( on_rotateAction_triggered() ), Qt::QueuedConnection );
    58 #endif
    58 #endif
    59 
    59 
    60 	action = new HbAction( this );
    60     action = new HbAction( this );
    61     action->setObjectName( "backupAction" );
    61     action->setObjectName( "backupAction" );
    62     action->setText( hbTrId( "Start backup" ) );
    62     action->setText( hbTrId( "Start backup" ) );
    63     menu()->addAction( action );
    63     menu()->addAction( action );
       
    64     connect( action, SIGNAL(triggered()), this, SLOT( on_backupAction_triggered() ), Qt::QueuedConnection );
    64 
    65 
    65 	action = new HbAction( this );
    66     action = new HbAction( this );
    66     action->setObjectName( "deleteBackupAction" );
    67     action->setObjectName( "deleteBackupAction" );
    67     action->setText( hbTrId( "Delete backup" ) );
    68     action->setText( hbTrId( "Delete backup" ) );
    68     menu()->addAction( action );
    69     menu()->addAction( action );
    69 
    70     connect( action, SIGNAL(triggered()), this, SLOT( on_deleteBackupAction_triggered() ), Qt::QueuedConnection );
    70 }
    71 }
    71 
    72 
    72 void FmBackupView::initMainWidget()
    73 void FmBackupView::initMainWidget()
    73 {
    74 {
    74 	mMainWidget = new FmBackupWidget( this );
    75     mMainWidget = new FmBackupWidget( this );
    75     setWidget( mMainWidget );
    76     setWidget( mMainWidget );
    76 
    77 
    77 }
    78 }
    78 
    79 
    79 void FmBackupView::initToolBar()
    80 void FmBackupView::initToolBar()
    80 {
    81 {
    81     mToolBarAction = new HbAction( this );
    82     mToolBarAction = new HbAction( this );
    82     mToolBarAction->setObjectName( "leftAction" );
    83     mToolBarAction->setObjectName( "leftAction" );
    83     mToolBarAction->setText( hbTrId("Start backup") );
    84     mToolBarAction->setText( hbTrId("Start backup") );
    84     toolBar()->addAction( mToolBarAction );
    85     toolBar()->addAction( mToolBarAction );
       
    86     connect( mToolBarAction, SIGNAL(triggered()), this, SLOT( on_leftAction_triggered() ), Qt::QueuedConnection );
    85     
    87     
    86     toolBar()->setOrientation( Qt::Horizontal );
    88     toolBar()->setOrientation( Qt::Horizontal );
    87 }
    89 }
    88 
    90 
    89 void FmBackupView::on_leftAction_triggered()
    91 void FmBackupView::on_leftAction_triggered()
    90 {
    92 {
    91     int ret = mOperationService->asyncBackup();
    93     int ret = mOperationService->asyncBackup();
    92     FmLogger::log( "FmBackupView_asyncBackup: ret= " + QString::number(ret) );
    94     FM_LOG( "FmBackupView_asyncBackup: ret= " + QString::number(ret) );
    93     switch( ret )
    95     switch( ret )
    94     {
    96     {
    95     case FmErrNone:
    97     case FmErrNone:
    96         break;
    98         break;
    97     case FmErrWrongParam:
    99     case FmErrWrongParam:
   141 void FmBackupView::refreshBackupDate()
   143 void FmBackupView::refreshBackupDate()
   142 {
   144 {
   143     mMainWidget->updateBackupDate();
   145     mMainWidget->updateBackupDate();
   144 }
   146 }
   145 
   147 
   146 void FmBackupView::refreshModel( const QString& path )
   148 void FmBackupView::refreshModel()
   147 {
   149 {
   148     if( !path.isEmpty() ) {
       
   149         // ignore non-empty refresh signal as it means change of folder/file, not drive.
       
   150         return;
       
   151     }
       
   152     mMainWidget->refreshModel();
   150     mMainWidget->refreshModel();
   153 }
   151 }