26 #include "fmdeletebackupview.h" |
26 #include "fmdeletebackupview.h" |
27 #include "fmsplitview.h" |
27 #include "fmsplitview.h" |
28 #include "fmoperationservice.h" |
28 #include "fmoperationservice.h" |
29 #include "fmoperationbase.h" |
29 #include "fmoperationbase.h" |
30 #include "fmdrivewatcher.h" |
30 #include "fmdrivewatcher.h" |
|
31 #include "fmdialog.h" |
|
32 #include "fmdlgutils.h" |
31 |
33 |
32 #include <hbview.h> |
34 #include <hbview.h> |
33 #include <hbmessagebox.h> |
|
34 #include <QFileSystemWatcher> |
35 #include <QFileSystemWatcher> |
35 #include <QFileInfo> |
36 #include <QFileInfo> |
36 #include <hbdialog.h> |
37 |
37 |
38 |
38 FmViewManager *FmViewManager::mViewManager = 0; |
39 FmViewManager *FmViewManager::mViewManager = 0; |
39 |
40 |
40 |
41 |
41 FmDlgCloseUnit::FmDlgCloseUnit( HbDialog *dialog ) : mDialog( dialog ) |
42 FmDlgCloseUnit::FmDlgCloseUnit( FmDialog *dialog ) : mDialog( dialog ) |
42 { |
43 { |
43 } |
44 } |
44 FmDlgCloseUnit::~FmDlgCloseUnit() |
45 FmDlgCloseUnit::~FmDlgCloseUnit() |
45 { |
46 { |
46 } |
47 } |
148 { |
149 { |
149 Q_UNUSED( operationBase ); |
150 Q_UNUSED( operationBase ); |
150 emit refreshModel( path ); |
151 emit refreshModel( path ); |
151 } |
152 } |
152 |
153 |
|
154 void FmViewManager::on_operationService_notifyFinish( FmOperationBase *operationBase ) |
|
155 { |
|
156 if( !operationBase ){ |
|
157 Q_ASSERT_X( false, "FmViewManager", |
|
158 "NULL is not accepted in on_operationService_notifyFinish()" ); |
|
159 return; |
|
160 } |
|
161 |
|
162 if( operationBase->operationType() == FmOperationService::EOperationTypeBackup ) |
|
163 { |
|
164 // after finish backup, we need refresh backup date in backup view. |
|
165 emit refreshBackupDate(); |
|
166 } |
|
167 } |
|
168 |
153 |
169 |
154 int FmViewManager::viewCount() |
170 int FmViewManager::viewCount() |
155 { |
171 { |
156 return mMainWindow->viewCount(); |
172 return mMainWindow->views().count(); |
157 } |
173 } |
158 |
174 |
159 |
175 |
160 void FmViewManager::createDriverView() |
176 void FmViewManager::createDriverView() |
161 { |
177 { |
173 { |
189 { |
174 QFileInfo fileInfo( path ); |
190 QFileInfo fileInfo( path ); |
175 QString absolutePath = fileInfo.absoluteFilePath(); |
191 QString absolutePath = fileInfo.absoluteFilePath(); |
176 |
192 |
177 QString checkedPath = FmUtils::checkDriveToFolderFilter( absolutePath ); |
193 QString checkedPath = FmUtils::checkDriveToFolderFilter( absolutePath ); |
178 FmDriverInfo::DriveState driveState = FmUtils::queryDriverInfo( path ).driveState(); |
194 if( FmUtils::isDriveAvailable( path ) ) { |
179 if( driveState & FmDriverInfo::EDriveAvailable ) { |
195 if( FmErrNone != FmUtils::isPathAccessabel( checkedPath ) ) { |
180 if( !FmUtils::isPathAccessabel( checkedPath ) ) { |
|
181 checkedPath.clear(); |
196 checkedPath.clear(); |
182 } |
197 } |
183 } |
198 } |
184 |
199 |
185 if( checkedPath.isEmpty() ) { |
200 if( checkedPath.isEmpty() ) { |
186 HbMessageBox::information( QString( hbTrId("Path: %1 is unavailable!").arg( path )) ); |
201 FmDlgUtils::information( QString( hbTrId("Path: %1 is unavailable!").arg( path )) ); |
187 return; |
202 return; |
188 } |
203 } |
189 |
204 |
190 FmFileView *fileView= new FmFileView(); |
205 FmFileView *fileView= new FmFileView(); |
191 fileView->setRootPath( checkedPath ); |
206 fileView->setRootPath( checkedPath ); |
227 { |
242 { |
228 FmBackupView *backupView= new FmBackupView(); |
243 FmBackupView *backupView= new FmBackupView(); |
229 |
244 |
230 mMainWindow->addView( backupView ); |
245 mMainWindow->addView( backupView ); |
231 mMainWindow->setCurrentView( backupView ); |
246 mMainWindow->setCurrentView( backupView ); |
232 |
247 connect( this, SIGNAL( refreshModel( QString ) ), //emit when need refresh models |
|
248 backupView, SLOT( refreshModel( QString ) ) ); |
|
249 connect( this, SIGNAL( refreshBackupDate() ), //emit when need refresh backup date |
|
250 backupView, SLOT( refreshBackupDate() ) ); |
233 } |
251 } |
234 |
252 |
235 void FmViewManager::createRestoreView() |
253 void FmViewManager::createRestoreView() |
236 { |
254 { |
237 FmRestoreView *restoreView= new FmRestoreView(); |
255 FmRestoreView *restoreView= new FmRestoreView(); |
238 |
256 |
239 mMainWindow->addView( restoreView ); |
257 mMainWindow->addView( restoreView ); |
240 mMainWindow->setCurrentView( restoreView ); |
258 mMainWindow->setCurrentView( restoreView ); |
|
259 connect( this, SIGNAL( refreshRestoreView() ), restoreView, SLOT( refreshRestoreView() ) ); |
241 |
260 |
242 } |
261 } |
243 |
262 |
244 void FmViewManager::createDeleteBackupView() |
263 void FmViewManager::createDeleteBackupView() |
245 { |
264 { |
246 FmDeleteBackupView *deleteBackupView= new FmDeleteBackupView(); |
265 FmDeleteBackupView *deleteBackupView= new FmDeleteBackupView(); |
247 |
266 |
248 mMainWindow->addView( deleteBackupView ); |
267 mMainWindow->addView( deleteBackupView ); |
249 mMainWindow->setCurrentView( deleteBackupView ); |
268 mMainWindow->setCurrentView( deleteBackupView ); |
|
269 connect( this, SIGNAL( refreshDeleteBackupView() ), deleteBackupView, SLOT( refreshDeleteBackupView() ) ); |
250 |
270 |
251 } |
271 } |
252 |
272 |
253 Qt::Orientation FmViewManager::orientation(){ |
273 Qt::Orientation FmViewManager::orientation(){ |
254 return mMainWindow->orientation(); |
274 return mMainWindow->orientation(); |
277 |
297 |
278 void FmViewManager::on_driveWatcher_driveAddedOrChanged() |
298 void FmViewManager::on_driveWatcher_driveAddedOrChanged() |
279 { |
299 { |
280 FmLogger::log( QString( "FmViewManager::on_driveWatcher_driveAddedOrChanged start" ) ); |
300 FmLogger::log( QString( "FmViewManager::on_driveWatcher_driveAddedOrChanged start" ) ); |
281 emit refreshModel( QString("") ); |
301 emit refreshModel( QString("") ); |
|
302 emit refreshDeleteBackupView(); |
|
303 emit refreshRestoreView(); |
282 checkDlgCloseUnit(); |
304 checkDlgCloseUnit(); |
283 FmLogger::log( QString( "FmViewManager::on_driveWatcher_driveAddedOrChanged end" ) ); |
305 FmLogger::log( QString( "FmViewManager::on_driveWatcher_driveAddedOrChanged end" ) ); |
284 |
306 |
285 } |
307 } |
286 |
308 |