filemanager/src/filemanager/src/fmviewmanager.cpp
changeset 44 22e202702210
parent 41 fc4654ce4fcb
child 48 1bebd60c0f00
--- a/filemanager/src/filemanager/src/fmviewmanager.cpp	Thu Sep 02 20:16:57 2010 +0300
+++ b/filemanager/src/filemanager/src/fmviewmanager.cpp	Fri Sep 17 08:27:42 2010 +0300
@@ -39,6 +39,8 @@
 #include <QFileInfo>
 #include <QPixmap>
 
+#include <shareui.h>
+
 FmViewManager *FmViewManager::mViewManager = 0;
 
 
@@ -73,7 +75,7 @@
 	return mDialog;
 }
 
-FmViewManager::FmViewManager( FmMainWindow* mainWindow ) : mOperationService( 0 )
+FmViewManager::FmViewManager( FmMainWindow* mainWindow ) : mOperationService( 0 ), mShareUi( 0 )
 {
     mMainWindow = mainWindow;
     mDriveWatcher = new FmDriveWatcher( this );
@@ -98,6 +100,9 @@
     mDriveWatcher->cancelWatch();
     delete mDriveWatcher;
     mDriveWatcher = 0;
+    
+    delete mShareUi;
+    mShareUi = 0;
 
 }
 
@@ -129,6 +134,17 @@
     return mOperationService;
 }
 
+/*
+   return \a shareUi which is used to send files. 
+ */
+ShareUi *FmViewManager::shareUi()
+{
+    if( !mShareUi ) {
+        mShareUi = new ShareUi;
+    }
+    return mShareUi;
+}
+
 void FmViewManager::popViewAndShow()
 {
     FmViewBase *view = static_cast<FmViewBase *>( mMainWindow->currentView() );
@@ -137,7 +153,13 @@
     if( viewCount() == 1 ) {
         mScreenShot = QPixmap::grabWidget(mMainWindow, mMainWindow->rect());
     }
-    mMainWindow->removeView( view );   
+    mMainWindow->removeView( view );  
+	// If call QEventLoop in destructor of HbView, it will panic
+	// So add aboutToClose function to do some prepare when view will be closed
+	// for example, close find view while find is inprogress.
+    // stop find thread in destructor of FmFindView(called by delete container->model...)
+    // and use QEventLoop to wait till thread exit.
+    view->aboutToClose();
     delete view;
 
     if( viewCount() < 1 )
@@ -236,14 +258,17 @@
         this, SLOT( popViewAndShow() ), Qt::QueuedConnection );
 }
 
-void FmViewManager::createFindView( const QString &keyword, const QString &path )
+/*
+    Create fild view and search \a keyword in \a pathList
+*/
+void FmViewManager::createFindView( const QString &keyword, const QStringList &pathList )
 {
     FmFindView *findView= new FmFindView();
     
     mMainWindow->addView( findView );
     mMainWindow->setCurrentView( findView );
 
-    findView->find( keyword, path );
+    findView->find( keyword, pathList );
  }
 
 void FmViewManager::createSplitView()
@@ -327,10 +352,7 @@
     HbActivityManager* activityManager = qobject_cast<HbApplication*>(qApp)->activityManager();     
     // add the activity to the activity manager
     bool ok = activityManager->addActivity("FMMemoryStoragesList", QVariant(), metadata);
-    if ( !ok )
-    {
-    qFatal("Add failed" );
-    }
+    // do not need check return value
 
 }