equal
deleted
inserted
replaced
31 |
31 |
32 #include <hbview.h> |
32 #include <hbview.h> |
33 #include <hbmessagebox.h> |
33 #include <hbmessagebox.h> |
34 #include <QFileSystemWatcher> |
34 #include <QFileSystemWatcher> |
35 #include <QFileInfo> |
35 #include <QFileInfo> |
|
36 #include <hbdialog.h> |
36 |
37 |
37 FmViewManager *FmViewManager::mViewManager = 0; |
38 FmViewManager *FmViewManager::mViewManager = 0; |
|
39 |
|
40 |
|
41 FmDlgCloseUnit::FmDlgCloseUnit( HbDialog *dialog ) : mDialog( dialog ) |
|
42 { |
|
43 } |
|
44 FmDlgCloseUnit::~FmDlgCloseUnit() |
|
45 { |
|
46 } |
|
47 |
|
48 void FmDlgCloseUnit::addAssociatedDrives( QString drives ) |
|
49 { |
|
50 for( int i = 0; i< drives.length(); ++i ) { |
|
51 if( !mAssociatedDrives.contains( drives[i], Qt::CaseInsensitive ) ) { |
|
52 mAssociatedDrives += drives[i]; |
|
53 } |
|
54 } |
|
55 } |
|
56 void FmDlgCloseUnit::removeAssociatedDrives( QString drives ) |
|
57 { |
|
58 for( int i = 0; i < drives.length(); ++i ){ |
|
59 mAssociatedDrives.remove( drives[i], Qt::CaseInsensitive ); |
|
60 } |
|
61 } |
|
62 QString FmDlgCloseUnit::associatedDrives() |
|
63 { |
|
64 return mAssociatedDrives; |
|
65 } |
|
66 |
|
67 HbDialog *FmDlgCloseUnit::dialog() |
|
68 { |
|
69 return mDialog; |
|
70 } |
38 |
71 |
39 FmViewManager::FmViewManager( FmMainWindow* mainWindow ) |
72 FmViewManager::FmViewManager( FmMainWindow* mainWindow ) |
40 { |
73 { |
41 mMainWindow = mainWindow; |
74 mMainWindow = mainWindow; |
42 mOperationService = new FmOperationService( this ); |
75 mOperationService = new FmOperationService( this ); |
68 mFsWatcher = 0; |
101 mFsWatcher = 0; |
69 |
102 |
70 mDriveWatcher->cancelWatch(); |
103 mDriveWatcher->cancelWatch(); |
71 delete mDriveWatcher; |
104 delete mDriveWatcher; |
72 mDriveWatcher = 0; |
105 mDriveWatcher = 0; |
|
106 |
73 } |
107 } |
74 |
108 |
75 FmViewManager *FmViewManager::CreateViewManager( FmMainWindow* mainWindow ) |
109 FmViewManager *FmViewManager::CreateViewManager( FmMainWindow* mainWindow ) |
76 { |
110 { |
77 if( !mViewManager ){ |
111 if( !mViewManager ){ |
139 { |
173 { |
140 QFileInfo fileInfo( path ); |
174 QFileInfo fileInfo( path ); |
141 QString absolutePath = fileInfo.absoluteFilePath(); |
175 QString absolutePath = fileInfo.absoluteFilePath(); |
142 |
176 |
143 QString checkedPath = FmUtils::checkDriveToFolderFilter( absolutePath ); |
177 QString checkedPath = FmUtils::checkDriveToFolderFilter( absolutePath ); |
144 |
178 FmDriverInfo::DriveState driveState = FmUtils::queryDriverInfo( path ).driveState(); |
145 if( !FmUtils::isPathAccessabel( checkedPath ) ) { |
179 if( driveState & FmDriverInfo::EDriveAvailable ) { |
146 checkedPath.clear(); |
180 if( !FmUtils::isPathAccessabel( checkedPath ) ) { |
147 } |
181 checkedPath.clear(); |
|
182 } |
|
183 } |
|
184 |
148 if( checkedPath.isEmpty() ) { |
185 if( checkedPath.isEmpty() ) { |
149 HbMessageBox::information( QString( tr("Path: %1 is unavailable!").arg( path )) ); |
186 HbMessageBox::information( QString( hbTrId("Path: %1 is unavailable!").arg( path )) ); |
150 return; |
187 return; |
151 } |
188 } |
152 |
189 |
153 FmFileView *fileView= new FmFileView(); |
190 FmFileView *fileView= new FmFileView(); |
154 fileView->setRootPath( checkedPath ); |
191 fileView->setRootPath( checkedPath ); |
240 |
277 |
241 void FmViewManager::on_driveWatcher_driveAddedOrChanged() |
278 void FmViewManager::on_driveWatcher_driveAddedOrChanged() |
242 { |
279 { |
243 FmLogger::log( QString( "FmViewManager::on_driveWatcher_driveAddedOrChanged start" ) ); |
280 FmLogger::log( QString( "FmViewManager::on_driveWatcher_driveAddedOrChanged start" ) ); |
244 emit refreshModel( QString("") ); |
281 emit refreshModel( QString("") ); |
|
282 checkDlgCloseUnit(); |
245 FmLogger::log( QString( "FmViewManager::on_driveWatcher_driveAddedOrChanged end" ) ); |
283 FmLogger::log( QString( "FmViewManager::on_driveWatcher_driveAddedOrChanged end" ) ); |
246 |
284 |
247 } |
285 } |
248 |
286 |
|
287 |
|
288 void FmViewManager::checkDlgCloseUnit() |
|
289 { |
|
290 foreach( FmDlgCloseUnit* unit, mDlgCloseUnitList ) { |
|
291 QString drives( unit->associatedDrives() ); |
|
292 for( int i = 0; i < drives.length(); i++ ) { |
|
293 QString drive( drives[i] + QString( ":/" ) ); |
|
294 if( !FmUtils::isDriveAvailable( drive ) ) { |
|
295 FmLogger::log( " close Dialog start " ); |
|
296 unit->dialog()->close(); |
|
297 FmLogger::log( " close Dialog end " ); |
|
298 } |
|
299 } |
|
300 } |
|
301 } |