--- a/filemanager/src/filemanager/src/backuprestore/fmrestoreview.cpp Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/backuprestore/fmrestoreview.cpp Tue Aug 24 10:24:14 2010 +0800
@@ -20,6 +20,7 @@
#include "fmrestorewidget.h"
#include "fmviewmanager.h"
#include "fmoperationbase.h"
+#include "fmdlgutils.h"
#include <QApplication>
@@ -27,9 +28,6 @@
#include <hbtoolbar.h>
#include <hbmenu.h>
#include <hbmainwindow.h>
-#include <hbmessagebox.h>
-
-
FmRestoreView::FmRestoreView(): FmViewBase( ERestoreView )
{
@@ -37,11 +35,8 @@
initMainWidget();
initToolBar();
- initMenu();
- adjustActions();
+ initMenu();
mOperationService = FmViewManager::viewManager()->operationService();
-
- QMetaObject::connectSlotsByName( this );
}
FmRestoreView::~FmRestoreView()
@@ -57,12 +52,15 @@
action->setObjectName( "rotateAction" );
action->setText( hbTrId( "Change orientation" ) );
menu()->addAction( action );
+ connect( action, SIGNAL(triggered()), this, SLOT( on_rotateAction_triggered() ), Qt::QueuedConnection );
#endif
mRestoreAction = new HbAction( this );
mRestoreAction->setObjectName( "restoreAction" );
mRestoreAction->setText( hbTrId( "Restore data" ) );
menu()->addAction( mRestoreAction );
+ mRestoreAction->setEnabled(false);
+ connect( mRestoreAction, SIGNAL(triggered()), this, SLOT( on_restoreAction_triggered() ), Qt::QueuedConnection );
}
void FmRestoreView::initMainWidget()
@@ -70,6 +68,7 @@
mRestoreWigdet = new FmRestoreWigdet( this );
setWidget( mRestoreWigdet );
+ connect(mRestoreWigdet, SIGNAL(stateChanged(int)), this, SLOT(onCheckBoxStateChange()));
}
@@ -79,7 +78,9 @@
mLeftAction->setObjectName( "leftAction" );
mLeftAction->setText( hbTrId( "Restore" ) );
toolBar()->addAction( mLeftAction );
-
+ connect( mLeftAction, SIGNAL(triggered()), this, SLOT( on_leftAction_triggered() ), Qt::QueuedConnection );
+
+ mLeftAction->setEnabled(false);
toolBar()->setOrientation( Qt::Horizontal );
}
@@ -98,13 +99,13 @@
case FmErrNone:
break;
case FmErrWrongParam:
- HbMessageBox::information( QString( hbTrId("Operation canceled with wrong param!") ) );
+ FmDlgUtils::information( QString( hbTrId("Operation canceled with wrong param!") ) );
break;
case FmErrAlreadyStarted:
- HbMessageBox::information( QString( hbTrId("Operation canceled because already started!") ) );
+ FmDlgUtils::information( QString( hbTrId("Operation canceled because already started!") ) );
break;
default:
- HbMessageBox::information(tr("restore failed"));
+ FmDlgUtils::information(hbTrId("restore failed"));
break;
}
}
@@ -126,19 +127,24 @@
on_leftAction_triggered();
}
-void FmRestoreView::adjustActions()
-{
- if( mRestoreWigdet->backupDataCount() > 0 ) {
- mRestoreAction->setDisabled( false );
- mLeftAction->setDisabled( false );
- } else {
- mRestoreAction->setDisabled( true );
- mLeftAction->setDisabled( true );
- }
-}
-
void FmRestoreView::removeToolBarAction()
{
toolBar()->removeAction( mLeftAction );
}
+void FmRestoreView::onCheckBoxStateChange()
+{
+ QList<int> items = mRestoreWigdet->selectionIndexes();
+ if (items.count() > 0) {
+ mLeftAction->setEnabled(true);
+ mRestoreAction->setEnabled(true);
+ } else {
+ mLeftAction->setEnabled(false);
+ mRestoreAction->setEnabled(false);
+ }
+}
+
+void FmRestoreView::refreshRestoreView()
+{
+ mRestoreWigdet->refresh();
+}