filemanager/src/filemanager/src/fmviewmanager.cpp
changeset 25 b7bfdea70ca2
parent 16 ada7962b4308
child 32 39cf9ced4cc4
--- a/filemanager/src/filemanager/src/fmviewmanager.cpp	Mon May 03 12:24:39 2010 +0300
+++ b/filemanager/src/filemanager/src/fmviewmanager.cpp	Fri Jun 25 17:08:34 2010 +0800
@@ -28,17 +28,18 @@
 #include "fmoperationservice.h"
 #include "fmoperationbase.h"
 #include "fmdrivewatcher.h"
+#include "fmdialog.h"
+#include "fmdlgutils.h"
 
 #include <hbview.h>
-#include <hbmessagebox.h>
 #include <QFileSystemWatcher>
 #include <QFileInfo>
-#include <hbdialog.h>
+
 
 FmViewManager *FmViewManager::mViewManager = 0;
 
 
-FmDlgCloseUnit::FmDlgCloseUnit( HbDialog *dialog ) : mDialog( dialog )
+FmDlgCloseUnit::FmDlgCloseUnit( FmDialog *dialog ) : mDialog( dialog )
 {
 }
 FmDlgCloseUnit::~FmDlgCloseUnit()
@@ -64,7 +65,7 @@
 	return mAssociatedDrives;
 }
 
-HbDialog *FmDlgCloseUnit::dialog()
+FmDialog *FmDlgCloseUnit::dialog()
 {
 	return mDialog;
 }
@@ -150,10 +151,25 @@
     emit refreshModel( path );
 }
 
+void FmViewManager::on_operationService_notifyFinish( FmOperationBase *operationBase )
+{
+    if( !operationBase ){
+        Q_ASSERT_X( false, "FmViewManager",
+                "NULL is not accepted in on_operationService_notifyFinish()" );
+        return;
+    }
+    
+    if( operationBase->operationType() == FmOperationService::EOperationTypeBackup )
+        {
+        // after finish backup, we need refresh backup date in backup view.
+        emit refreshBackupDate();
+        }
+}
+
 
 int FmViewManager::viewCount()
 {
-    return mMainWindow->viewCount();
+    return mMainWindow->views().count();
 }
 
 
@@ -175,15 +191,14 @@
     QString absolutePath = fileInfo.absoluteFilePath();
 
     QString checkedPath = FmUtils::checkDriveToFolderFilter( absolutePath );
-    FmDriverInfo::DriveState driveState = FmUtils::queryDriverInfo( path ).driveState();
-    if( driveState & FmDriverInfo::EDriveAvailable ) {
-        if( !FmUtils::isPathAccessabel( checkedPath ) ) {
+    if( FmUtils::isDriveAvailable( path ) ) {
+        if( FmErrNone != FmUtils::isPathAccessabel( checkedPath )  ) {
             checkedPath.clear();
         }
     }
    
     if( checkedPath.isEmpty() ) {
-        HbMessageBox::information( QString( hbTrId("Path: %1 is unavailable!").arg( path )) );
+        FmDlgUtils::information( QString( hbTrId("Path: %1 is unavailable!").arg( path )) );
         return;
     }
 
@@ -229,7 +244,10 @@
 
     mMainWindow->addView( backupView );
     mMainWindow->setCurrentView( backupView );
-
+    connect( this, SIGNAL( refreshModel( QString ) ), //emit when need refresh models
+            backupView, SLOT( refreshModel( QString ) ) );
+    connect( this, SIGNAL( refreshBackupDate() ),  //emit when need refresh backup date
+            backupView, SLOT( refreshBackupDate() ) );
 }
 
 void FmViewManager::createRestoreView()
@@ -238,6 +256,7 @@
 
     mMainWindow->addView( restoreView );
     mMainWindow->setCurrentView( restoreView );
+    connect( this, SIGNAL( refreshRestoreView() ), restoreView, SLOT( refreshRestoreView() ) );
 
 }
 
@@ -247,6 +266,7 @@
 
     mMainWindow->addView( deleteBackupView );
     mMainWindow->setCurrentView( deleteBackupView );
+    connect( this, SIGNAL( refreshDeleteBackupView() ), deleteBackupView, SLOT( refreshDeleteBackupView() ) );
 
 }
 
@@ -279,6 +299,8 @@
 {
     FmLogger::log( QString( "FmViewManager::on_driveWatcher_driveAddedOrChanged start" ) );
     emit refreshModel( QString("") );
+    emit refreshDeleteBackupView();
+    emit refreshRestoreView();
 	checkDlgCloseUnit();
     FmLogger::log( QString( "FmViewManager::on_driveWatcher_driveAddedOrChanged end" ) );