Diffstat (limited to 'noncore/apps/advancedfm/advancedfm.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 56 |
1 files changed, 38 insertions, 18 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index f23fd86..08dc24e 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -12,6 +12,7 @@ | |||
12 | #define DEVELOPERS_VERSION | 12 | #define DEVELOPERS_VERSION |
13 | #include "advancedfm.h" | 13 | #include "advancedfm.h" |
14 | 14 | ||
15 | #include <opie/otabwidget.h> | ||
15 | // #include <opie/ofileselector.h> | 16 | // #include <opie/ofileselector.h> |
16 | // #include <opie/ofiledialog.h> | 17 | // #include <opie/ofiledialog.h> |
17 | 18 | ||
@@ -87,7 +88,8 @@ void AdvancedFm::cleanUp() { | |||
87 | } | 88 | } |
88 | 89 | ||
89 | void AdvancedFm::tabChanged(QWidget *) { | 90 | void AdvancedFm::tabChanged(QWidget *) { |
90 | if (TabWidget->currentPageIndex() == 0) { | 91 | if (TabWidget->getCurrentTab() == 0) { |
92 | // if (TabWidget->currentPageIndex() == 0) { | ||
91 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 93 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
92 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); | 94 | viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); |
93 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); | 95 | viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); |
@@ -96,7 +98,9 @@ void AdvancedFm::tabChanged(QWidget *) { | |||
96 | +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); | 98 | +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); |
97 | 99 | ||
98 | } | 100 | } |
99 | if (TabWidget->currentPageIndex() == 1) { | 101 | if (TabWidget->getCurrentTab() == 1) { |
102 | |||
103 | // if (TabWidget->currentPageIndex() == 1) { | ||
100 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); | 104 | currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); |
101 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); | 105 | viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); |
102 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); | 106 | viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); |
@@ -414,12 +418,12 @@ void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, in | |||
414 | 418 | ||
415 | 419 | ||
416 | void AdvancedFm::switchToLocalTab() { | 420 | void AdvancedFm::switchToLocalTab() { |
417 | TabWidget->setCurrentPage(0); | 421 | TabWidget->setCurrentTab(0); |
418 | Local_View->setFocus(); | 422 | Local_View->setFocus(); |
419 | } | 423 | } |
420 | 424 | ||
421 | void AdvancedFm::switchToRemoteTab() { | 425 | void AdvancedFm::switchToRemoteTab() { |
422 | TabWidget->setCurrentPage(1); | 426 | TabWidget->setCurrentTab(1); |
423 | Remote_View->setFocus(); | 427 | Remote_View->setFocus(); |
424 | } | 428 | } |
425 | 429 | ||
@@ -432,7 +436,8 @@ void AdvancedFm::writeConfig() { | |||
432 | } | 436 | } |
433 | 437 | ||
434 | void AdvancedFm::currentPathComboChanged() { | 438 | void AdvancedFm::currentPathComboChanged() { |
435 | if (TabWidget->currentPageIndex() == 0) { | 439 | if (TabWidget->getCurrentTab() == 0) { |
440 | // if (TabWidget->currentPageIndex() == 0) { | ||
436 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 441 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
437 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); | 442 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); |
438 | populateLocalView(); | 443 | populateLocalView(); |
@@ -440,7 +445,8 @@ void AdvancedFm::currentPathComboChanged() { | |||
440 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 445 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
441 | } | 446 | } |
442 | } | 447 | } |
443 | if (TabWidget->currentPageIndex() == 0) { | 448 | if (TabWidget->getCurrentTab() == 0) { |
449 | // if (TabWidget->currentPageIndex() == 0) { | ||
444 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 450 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
445 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); | 451 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); |
446 | populateRemoteView(); | 452 | populateRemoteView(); |
@@ -452,7 +458,8 @@ void AdvancedFm::currentPathComboChanged() { | |||
452 | 458 | ||
453 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 459 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
454 | 460 | ||
455 | if (TabWidget->currentPageIndex() == 0) { | 461 | if (TabWidget->getCurrentTab() == 0) { |
462 | // if (TabWidget->currentPageIndex() == 0) { | ||
456 | currentPathCombo->lineEdit()->setText( currentPath); | 463 | currentPathCombo->lineEdit()->setText( currentPath); |
457 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 464 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
458 | currentPathCombo->clear(); | 465 | currentPathCombo->clear(); |
@@ -470,7 +477,8 @@ void AdvancedFm::fillCombo(const QString ¤tPath) { | |||
470 | } | 477 | } |
471 | 478 | ||
472 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { | 479 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { |
473 | if (TabWidget->currentPageIndex() == 0) { | 480 | if (TabWidget->getCurrentTab() == 0) { |
481 | // if (TabWidget->currentPageIndex() == 0) { | ||
474 | chdir( currentPath.latin1() ); | 482 | chdir( currentPath.latin1() ); |
475 | currentDir.cd( currentPath, TRUE); | 483 | currentDir.cd( currentPath, TRUE); |
476 | populateLocalView(); | 484 | populateLocalView(); |
@@ -485,7 +493,8 @@ void AdvancedFm::currentPathComboActivated(const QString & currentPath) { | |||
485 | 493 | ||
486 | QStringList AdvancedFm::getPath() { | 494 | QStringList AdvancedFm::getPath() { |
487 | QStringList strList; | 495 | QStringList strList; |
488 | if (TabWidget->currentPageIndex() == 0) { | 496 | if (TabWidget->getCurrentTab() == 0) { |
497 | // if (TabWidget->currentPageIndex() == 0) { | ||
489 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 498 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
490 | QListViewItemIterator it( Local_View ); | 499 | QListViewItemIterator it( Local_View ); |
491 | for ( ; it.current(); ++it ) { | 500 | for ( ; it.current(); ++it ) { |
@@ -512,7 +521,8 @@ QStringList AdvancedFm::getPath() { | |||
512 | void AdvancedFm::homeButtonPushed() { | 521 | void AdvancedFm::homeButtonPushed() { |
513 | QString current = QDir::homeDirPath(); | 522 | QString current = QDir::homeDirPath(); |
514 | chdir( current.latin1() ); | 523 | chdir( current.latin1() ); |
515 | if (TabWidget->currentPageIndex() == 0) { | 524 | if (TabWidget->getCurrentTab() == 0) { |
525 | // if (TabWidget->currentPageIndex() == 0) { | ||
516 | currentDir.cd( current, TRUE); | 526 | currentDir.cd( current, TRUE); |
517 | populateLocalView(); | 527 | populateLocalView(); |
518 | } else { | 528 | } else { |
@@ -525,7 +535,9 @@ void AdvancedFm::homeButtonPushed() { | |||
525 | void AdvancedFm::docButtonPushed() { | 535 | void AdvancedFm::docButtonPushed() { |
526 | QString current = QPEApplication::documentDir(); | 536 | QString current = QPEApplication::documentDir(); |
527 | chdir( current.latin1() ); | 537 | chdir( current.latin1() ); |
528 | if (TabWidget->currentPageIndex() == 0) { | 538 | |
539 | if (TabWidget->getCurrentTab() == 0) { | ||
540 | //if (TabWidget->currentPageIndex() == 0) { | ||
529 | currentDir.cd( current, TRUE); | 541 | currentDir.cd( current, TRUE); |
530 | populateLocalView(); | 542 | populateLocalView(); |
531 | } else { | 543 | } else { |
@@ -538,7 +550,8 @@ void AdvancedFm::docButtonPushed() { | |||
538 | void AdvancedFm::SDButtonPushed() { | 550 | void AdvancedFm::SDButtonPushed() { |
539 | QString current = "/mnt/card";// this can change so fix | 551 | QString current = "/mnt/card";// this can change so fix |
540 | chdir( current.latin1() ); | 552 | chdir( current.latin1() ); |
541 | if (TabWidget->currentPageIndex() == 0) { | 553 | if (TabWidget->getCurrentTab() == 0) { |
554 | // if (TabWidget->currentPageIndex() == 0) { | ||
542 | currentDir.cd( current, TRUE); | 555 | currentDir.cd( current, TRUE); |
543 | populateLocalView(); | 556 | populateLocalView(); |
544 | } else { | 557 | } else { |
@@ -557,7 +570,8 @@ void AdvancedFm::CFButtonPushed() { | |||
557 | current = "/mnt/hda"; //ipaq | 570 | current = "/mnt/hda"; //ipaq |
558 | 571 | ||
559 | chdir( current.latin1() ); | 572 | chdir( current.latin1() ); |
560 | if (TabWidget->currentPageIndex() == 0) { | 573 | if (TabWidget->getCurrentTab() == 0) { |
574 | // if (TabWidget->currentPageIndex() == 0) { | ||
561 | currentDir.cd( current, TRUE); | 575 | currentDir.cd( current, TRUE); |
562 | populateLocalView(); | 576 | populateLocalView(); |
563 | } else { | 577 | } else { |
@@ -645,7 +659,8 @@ void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { | |||
645 | void AdvancedFm::QPEButtonPushed() { | 659 | void AdvancedFm::QPEButtonPushed() { |
646 | QString current = QPEApplication::qpeDir(); | 660 | QString current = QPEApplication::qpeDir(); |
647 | chdir( current.latin1() ); | 661 | chdir( current.latin1() ); |
648 | if (TabWidget->currentPageIndex() == 0) { | 662 | if (TabWidget->getCurrentTab() == 0) { |
663 | // if (TabWidget->currentPageIndex() == 0) { | ||
649 | currentDir.cd( current, TRUE); | 664 | currentDir.cd( current, TRUE); |
650 | populateLocalView(); | 665 | populateLocalView(); |
651 | } else { | 666 | } else { |
@@ -717,7 +732,8 @@ void AdvancedFm::showFileMenu() { | |||
717 | 732 | ||
718 | QString curApp; | 733 | QString curApp; |
719 | bool isLocalView = false; | 734 | bool isLocalView = false; |
720 | if (TabWidget->currentPageIndex() == 0) { | 735 | if (TabWidget->getCurrentTab() == 0) { |
736 | // if (TabWidget->currentPageIndex() == 0) { | ||
721 | isLocalView = TRUE; | 737 | isLocalView = TRUE; |
722 | curApp = Local_View->currentItem()->text(0); | 738 | curApp = Local_View->currentItem()->text(0); |
723 | } else { | 739 | } else { |
@@ -730,8 +746,11 @@ void AdvancedFm::showFileMenu() { | |||
730 | QPopupMenu *m = new QPopupMenu(0); | 746 | QPopupMenu *m = new QPopupMenu(0); |
731 | QPopupMenu *n = new QPopupMenu(0); | 747 | QPopupMenu *n = new QPopupMenu(0); |
732 | // QPopupMenu *o = new QPopupMenu(0); | 748 | // QPopupMenu *o = new QPopupMenu(0); |
733 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); | 749 | if (TabWidget->getCurrentTab() == 0) |
734 | 750 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | |
751 | else | ||
752 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); | ||
753 | |||
735 | if ( QFileInfo(fi).isDir() ) { | 754 | if ( QFileInfo(fi).isDir() ) { |
736 | m->insertSeparator(); | 755 | m->insertSeparator(); |
737 | m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | 756 | m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); |
@@ -829,7 +848,8 @@ void AdvancedFm::addToDocs() { | |||
829 | QStringList strListPaths = getPath(); | 848 | QStringList strListPaths = getPath(); |
830 | if( strListPaths.count() > 0) { | 849 | if( strListPaths.count() > 0) { |
831 | QString curFile; | 850 | QString curFile; |
832 | if (TabWidget->currentPageIndex() == 0) { | 851 | if (TabWidget->getCurrentTab() == 0) { |
852 | // if (TabWidget->currentPageIndex() == 0) { | ||
833 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { | 853 | for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { |
834 | curFile = currentDir.canonicalPath()+"/"+(*it); | 854 | curFile = currentDir.canonicalPath()+"/"+(*it); |
835 | qDebug(curFile); | 855 | qDebug(curFile); |