71 FmDialog *FmDlgCloseUnit::dialog() |
73 FmDialog *FmDlgCloseUnit::dialog() |
72 { |
74 { |
73 return mDialog; |
75 return mDialog; |
74 } |
76 } |
75 |
77 |
76 FmViewManager::FmViewManager( FmMainWindow* mainWindow ) : mOperationService( 0 ) |
78 FmViewManager::FmViewManager( FmMainWindow* mainWindow ) : mOperationService( 0 ), mShareUi( 0 ) |
77 { |
79 { |
78 mMainWindow = mainWindow; |
80 mMainWindow = mainWindow; |
79 mDriveWatcher = new FmDriveWatcher( this ); |
81 mDriveWatcher = new FmDriveWatcher( this ); |
80 mDriveWatcher->setObjectName( "driveWatcher" ); |
82 mDriveWatcher->setObjectName( "driveWatcher" ); |
81 mDriveWatcher->startWatch(); |
83 mDriveWatcher->startWatch(); |
127 mOperationService->setObjectName( "operationService" ); |
132 mOperationService->setObjectName( "operationService" ); |
128 } |
133 } |
129 return mOperationService; |
134 return mOperationService; |
130 } |
135 } |
131 |
136 |
|
137 /* |
|
138 return \a shareUi which is used to send files. |
|
139 */ |
|
140 ShareUi *FmViewManager::shareUi() |
|
141 { |
|
142 if( !mShareUi ) { |
|
143 mShareUi = new ShareUi; |
|
144 } |
|
145 return mShareUi; |
|
146 } |
|
147 |
132 void FmViewManager::popViewAndShow() |
148 void FmViewManager::popViewAndShow() |
133 { |
149 { |
134 FmViewBase *view = static_cast<FmViewBase *>( mMainWindow->currentView() ); |
150 FmViewBase *view = static_cast<FmViewBase *>( mMainWindow->currentView() ); |
135 view->setNavigationAction( 0 ); |
151 view->setNavigationAction( 0 ); |
136 // grap the screen when only the drive view is in view stack. |
152 // grap the screen when only the drive view is in view stack. |
137 if( viewCount() == 1 ) { |
153 if( viewCount() == 1 ) { |
138 mScreenShot = QPixmap::grabWidget(mMainWindow, mMainWindow->rect()); |
154 mScreenShot = QPixmap::grabWidget(mMainWindow, mMainWindow->rect()); |
139 } |
155 } |
140 mMainWindow->removeView( view ); |
156 mMainWindow->removeView( view ); |
|
157 // If call QEventLoop in destructor of HbView, it will panic |
|
158 // So add aboutToClose function to do some prepare when view will be closed |
|
159 // for example, close find view while find is inprogress. |
|
160 // stop find thread in destructor of FmFindView(called by delete container->model...) |
|
161 // and use QEventLoop to wait till thread exit. |
|
162 view->aboutToClose(); |
141 delete view; |
163 delete view; |
142 |
164 |
143 if( viewCount() < 1 ) |
165 if( viewCount() < 1 ) |
144 { |
166 { |
145 mMainWindow->close(); |
167 mMainWindow->close(); |
234 |
256 |
235 connect( fileView, SIGNAL( popViewAndShow() ), //emit when fileView need delete itself and pop&show view from stack. |
257 connect( fileView, SIGNAL( popViewAndShow() ), //emit when fileView need delete itself and pop&show view from stack. |
236 this, SLOT( popViewAndShow() ), Qt::QueuedConnection ); |
258 this, SLOT( popViewAndShow() ), Qt::QueuedConnection ); |
237 } |
259 } |
238 |
260 |
239 void FmViewManager::createFindView( const QString &keyword, const QString &path ) |
261 /* |
|
262 Create fild view and search \a keyword in \a pathList |
|
263 */ |
|
264 void FmViewManager::createFindView( const QString &keyword, const QStringList &pathList ) |
240 { |
265 { |
241 FmFindView *findView= new FmFindView(); |
266 FmFindView *findView= new FmFindView(); |
242 |
267 |
243 mMainWindow->addView( findView ); |
268 mMainWindow->addView( findView ); |
244 mMainWindow->setCurrentView( findView ); |
269 mMainWindow->setCurrentView( findView ); |
245 |
270 |
246 findView->find( keyword, path ); |
271 findView->find( keyword, pathList ); |
247 } |
272 } |
248 |
273 |
249 void FmViewManager::createSplitView() |
274 void FmViewManager::createSplitView() |
250 { |
275 { |
251 FmSplitView *splitView = new FmSplitView(); |
276 FmSplitView *splitView = new FmSplitView(); |
325 QVariantHash metadata; |
350 QVariantHash metadata; |
326 metadata.insert("screenshot", mScreenShot); |
351 metadata.insert("screenshot", mScreenShot); |
327 HbActivityManager* activityManager = qobject_cast<HbApplication*>(qApp)->activityManager(); |
352 HbActivityManager* activityManager = qobject_cast<HbApplication*>(qApp)->activityManager(); |
328 // add the activity to the activity manager |
353 // add the activity to the activity manager |
329 bool ok = activityManager->addActivity("FMMemoryStoragesList", QVariant(), metadata); |
354 bool ok = activityManager->addActivity("FMMemoryStoragesList", QVariant(), metadata); |
330 if ( !ok ) |
355 // do not need check return value |
331 { |
|
332 qFatal("Add failed" ); |
|
333 } |
|
334 |
356 |
335 } |
357 } |
336 |
358 |
337 void FmViewManager::onAboutToChangeView(HbView * oldView, HbView *newView) |
359 void FmViewManager::onAboutToChangeView(HbView * oldView, HbView *newView) |
338 { |
360 { |