author | llornkcor <llornkcor> | 2005-03-24 20:14:38 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2005-03-24 20:14:38 (UTC) |
commit | 1e6c3181dcc7ec4edbe99db0d886ce7a9c483056 (patch) (unidiff) | |
tree | 38e98006c0bb49bb6b1008dddb840e961bb2b775 | |
parent | 38ace7e9b3c9665336c0e6d2350895b147858f1f (diff) | |
download | opie-1e6c3181dcc7ec4edbe99db0d886ce7a9c483056.zip opie-1e6c3181dcc7ec4edbe99db0d886ce7a9c483056.tar.gz opie-1e6c3181dcc7ec4edbe99db0d886ce7a9c483056.tar.bz2 |
cd to sd or mmc
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index fd81313..979549d 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -272,130 +272,135 @@ void AdvancedFm::switchToRemoteTab() { | |||
272 | Remote_View->setFocus(); | 272 | Remote_View->setFocus(); |
273 | // whichTab = 2; | 273 | // whichTab = 2; |
274 | } | 274 | } |
275 | 275 | ||
276 | void AdvancedFm::currentPathComboChanged() { | 276 | void AdvancedFm::currentPathComboChanged() { |
277 | QString pDir = currentPathCombo->lineEdit()->text(); | 277 | QString pDir = currentPathCombo->lineEdit()->text(); |
278 | if(QDir(pDir).exists()) { | 278 | if(QDir(pDir).exists()) { |
279 | CurrentDir()->setPath(pDir ); | 279 | CurrentDir()->setPath(pDir ); |
280 | populateView(); | 280 | populateView(); |
281 | } else { | 281 | } else { |
282 | QMessageBox::message(tr("Note"),tr("<p>%1 does not exist</p>").arg(pDir)); | 282 | QMessageBox::message(tr("Note"),tr("<p>%1 does not exist</p>").arg(pDir)); |
283 | } | 283 | } |
284 | } | 284 | } |
285 | 285 | ||
286 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 286 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
287 | 287 | ||
288 | if ( TabWidget->currentWidget() == tab) { | 288 | if ( TabWidget->currentWidget() == tab) { |
289 | // if ( whichTab == 1) { | 289 | // if ( whichTab == 1) { |
290 | currentPathCombo->lineEdit()->setText( currentPath); | 290 | currentPathCombo->lineEdit()->setText( currentPath); |
291 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 291 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
292 | currentPathCombo->clear(); | 292 | currentPathCombo->clear(); |
293 | localDirPathStringList.prepend( currentPath ); | 293 | localDirPathStringList.prepend( currentPath ); |
294 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 294 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
295 | } | 295 | } |
296 | } else { | 296 | } else { |
297 | currentPathCombo->lineEdit()->setText( currentPath); | 297 | currentPathCombo->lineEdit()->setText( currentPath); |
298 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 298 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
299 | currentPathCombo->clear(); | 299 | currentPathCombo->clear(); |
300 | remoteDirPathStringList.prepend( currentPath ); | 300 | remoteDirPathStringList.prepend( currentPath ); |
301 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 301 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
302 | } | 302 | } |
303 | } | 303 | } |
304 | } | 304 | } |
305 | 305 | ||
306 | QStringList AdvancedFm::getPath() { | 306 | QStringList AdvancedFm::getPath() { |
307 | QStringList strList; | 307 | QStringList strList; |
308 | QListView *thisView=CurrentView(); | 308 | QListView *thisView=CurrentView(); |
309 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); | 309 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); |
310 | QListViewItemIterator it( thisView ); | 310 | QListViewItemIterator it( thisView ); |
311 | for ( ; it.current(); ++it ) { | 311 | for ( ; it.current(); ++it ) { |
312 | if ( it.current()->isSelected() ) { | 312 | if ( it.current()->isSelected() ) { |
313 | strList << it.current()->text(0); | 313 | strList << it.current()->text(0); |
314 | // odebug << it.current()->text(0) << oendl; | 314 | // odebug << it.current()->text(0) << oendl; |
315 | } | 315 | } |
316 | } | 316 | } |
317 | return strList; | 317 | return strList; |
318 | } | 318 | } |
319 | 319 | ||
320 | void AdvancedFm::changeTo(const QString &dir) { | 320 | void AdvancedFm::changeTo(const QString &dir) { |
321 | chdir( dir.latin1()); | 321 | chdir( dir.latin1()); |
322 | CurrentDir()->cd(dir, TRUE); | 322 | CurrentDir()->cd(dir, TRUE); |
323 | populateView(); | 323 | populateView(); |
324 | update(); | 324 | update(); |
325 | } | 325 | } |
326 | 326 | ||
327 | void AdvancedFm::homeButtonPushed() { | 327 | void AdvancedFm::homeButtonPushed() { |
328 | changeTo(QDir::homeDirPath()); | 328 | changeTo(QDir::homeDirPath()); |
329 | } | 329 | } |
330 | 330 | ||
331 | void AdvancedFm::docButtonPushed() { | 331 | void AdvancedFm::docButtonPushed() { |
332 | changeTo(QPEApplication::documentDir()); | 332 | changeTo(QPEApplication::documentDir()); |
333 | } | 333 | } |
334 | 334 | ||
335 | void AdvancedFm::SDButtonPushed() { | 335 | void AdvancedFm::SDButtonPushed() { |
336 | Opie::Core::OStorageInfo info; | 336 | Opie::Core::OStorageInfo info; |
337 | changeTo(info.sdPath()); | 337 | if(StorageInfo::hasSd() ) { |
338 | changeTo(info.sdPath()); | ||
339 | } | ||
340 | else if(StorageInfo::hasMmc()) { | ||
341 | changeTo(info.mmcPath()); | ||
342 | } | ||
338 | } | 343 | } |
339 | 344 | ||
340 | void AdvancedFm::CFButtonPushed() { | 345 | void AdvancedFm::CFButtonPushed() { |
341 | Opie::Core::OStorageInfo info; | 346 | Opie::Core::OStorageInfo info; |
342 | changeTo(info.cfPath()); | 347 | changeTo(info.cfPath()); |
343 | } | 348 | } |
344 | 349 | ||
345 | void AdvancedFm::QPEButtonPushed() { | 350 | void AdvancedFm::QPEButtonPushed() { |
346 | changeTo(QPEApplication::qpeDir()); | 351 | changeTo(QPEApplication::qpeDir()); |
347 | } | 352 | } |
348 | 353 | ||
349 | void AdvancedFm::doAbout() { | 354 | void AdvancedFm::doAbout() { |
350 | QMessageBox::message("AdvancedFm",tr("<P>Advanced FileManager is copyright 2002-2003 by L.J.Potter<llornkcor@handhelds.org> and is licensed by the GPL</P>")); | 355 | QMessageBox::message("AdvancedFm",tr("<P>Advanced FileManager is copyright 2002-2003 by L.J.Potter<llornkcor@handhelds.org> and is licensed by the GPL</P>")); |
351 | } | 356 | } |
352 | 357 | ||
353 | void AdvancedFm::keyPressEvent( QKeyEvent *e) { | 358 | void AdvancedFm::keyPressEvent( QKeyEvent *e) { |
354 | Q_UNUSED(e); | 359 | Q_UNUSED(e); |
355 | } | 360 | } |
356 | 361 | ||
357 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { | 362 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { |
358 | // if( CurrentView()->hasFocus() ) | 363 | // if( CurrentView()->hasFocus() ) |
359 | // e->ignore(); | 364 | // e->ignore(); |
360 | 365 | ||
361 | if( currentPathCombo->lineEdit()->hasFocus()) { | 366 | if( currentPathCombo->lineEdit()->hasFocus()) { |
362 | // qDebug("shout!"); | 367 | // qDebug("shout!"); |
363 | } | 368 | } |
364 | 369 | ||
365 | else if( e->key() == Key_Left ) | 370 | else if( e->key() == Key_Left ) |
366 | upDir(); | 371 | upDir(); |
367 | else if( e->key() == Key_Return || e->key() == Key_Enter) | 372 | else if( e->key() == Key_Return || e->key() == Key_Enter) |
368 | navigateToSelected(); | 373 | navigateToSelected(); |
369 | else if( e->key() == Key_Tab) | 374 | else if( e->key() == Key_Tab) |
370 | setOtherTabCurrent(); | 375 | setOtherTabCurrent(); |
371 | else if( e->key() == Key_Delete ) | 376 | else if( e->key() == Key_Delete ) |
372 | del(); | 377 | del(); |
373 | else | 378 | else |
374 | e->accept(); | 379 | e->accept(); |
375 | 380 | ||
376 | } | 381 | } |
377 | 382 | ||
378 | 383 | ||
379 | void AdvancedFm::parsetab(const QString &fileName) { | 384 | void AdvancedFm::parsetab(const QString &fileName) { |
380 | 385 | ||
381 | fileSystemTypeList.clear(); | 386 | fileSystemTypeList.clear(); |
382 | fsList.clear(); | 387 | fsList.clear(); |
383 | struct mntent *me; | 388 | struct mntent *me; |
384 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); | 389 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); |
385 | if ( mntfp ) { | 390 | if ( mntfp ) { |
386 | while ( (me = getmntent( mntfp )) != 0 ) { | 391 | while ( (me = getmntent( mntfp )) != 0 ) { |
387 | QString deviceName = me->mnt_fsname; | 392 | QString deviceName = me->mnt_fsname; |
388 | QString filesystemType = me->mnt_type; | 393 | QString filesystemType = me->mnt_type; |
389 | QString mountDir = me->mnt_dir; | 394 | QString mountDir = me->mnt_dir; |
390 | if(deviceName != "none") { | 395 | if(deviceName != "none") { |
391 | if( fsList.contains(filesystemType) == 0 | 396 | if( fsList.contains(filesystemType) == 0 |
392 | & filesystemType.find("proc",0,TRUE) == -1 | 397 | & filesystemType.find("proc",0,TRUE) == -1 |
393 | & filesystemType.find("cramfs",0,TRUE) == -1 | 398 | & filesystemType.find("cramfs",0,TRUE) == -1 |
394 | & filesystemType.find("auto",0,TRUE) == -1) | 399 | & filesystemType.find("auto",0,TRUE) == -1) |
395 | fsList << filesystemType; | 400 | fsList << filesystemType; |
396 | fileSystemTypeList << mountDir+"::"+filesystemType; | 401 | fileSystemTypeList << mountDir+"::"+filesystemType; |
397 | } | 402 | } |
398 | } | 403 | } |
399 | } | 404 | } |
400 | endmntent( mntfp ); | 405 | endmntent( mntfp ); |
401 | } | 406 | } |