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 | |||
@@ -9,12 +9,13 @@ | |||
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
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 | ||
18 | #include <qpe/filemanager.h> | 19 | #include <qpe/filemanager.h> |
19 | #include <qpe/qcopenvelope_qws.h> | 20 | #include <qpe/qcopenvelope_qws.h> |
20 | #include <qpe/qpemenubar.h> | 21 | #include <qpe/qpemenubar.h> |
@@ -84,22 +85,25 @@ void AdvancedFm::cleanUp() { | |||
84 | QFile file( sfile); | 85 | QFile file( sfile); |
85 | if(file.exists()) | 86 | if(file.exists()) |
86 | file.remove(); | 87 | file.remove(); |
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); |
94 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 96 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
95 | setCaption("AdvancedFm :: "+fs+" :: " | 97 | setCaption("AdvancedFm :: "+fs+" :: " |
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); |
103 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 107 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
104 | setCaption("AdvancedFm :: "+fs+" :: " | 108 | setCaption("AdvancedFm :: "+fs+" :: " |
105 | +checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); | 109 | +checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); |
@@ -411,51 +415,54 @@ void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, in | |||
411 | break; | 415 | break; |
412 | }; | 416 | }; |
413 | } | 417 | } |
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 | ||
426 | void AdvancedFm::readConfig() { | 430 | void AdvancedFm::readConfig() { |
427 | Config cfg("AdvancedFm"); | 431 | Config cfg("AdvancedFm"); |
428 | } | 432 | } |
429 | 433 | ||
430 | void AdvancedFm::writeConfig() { | 434 | void AdvancedFm::writeConfig() { |
431 | Config cfg("AdvancedFm"); | 435 | Config cfg("AdvancedFm"); |
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(); |
439 | } else { | 444 | } else { |
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(); |
447 | } else { | 453 | } else { |
448 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 454 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
449 | } | 455 | } |
450 | } | 456 | } |
451 | } | 457 | } |
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(); |
459 | localDirPathStringList.prepend( currentPath ); | 466 | localDirPathStringList.prepend( currentPath ); |
460 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 467 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
461 | } | 468 | } |
@@ -467,13 +474,14 @@ void AdvancedFm::fillCombo(const QString ¤tPath) { | |||
467 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 474 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
468 | } | 475 | } |
469 | } | 476 | } |
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(); |
477 | update(); | 485 | update(); |
478 | } else { | 486 | } else { |
479 | chdir( currentPath.latin1() ); | 487 | chdir( currentPath.latin1() ); |
@@ -482,13 +490,14 @@ void AdvancedFm::currentPathComboActivated(const QString & currentPath) { | |||
482 | update(); | 490 | update(); |
483 | } | 491 | } |
484 | } | 492 | } |
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 ) { |
492 | if ( it.current()->isSelected() ) { | 501 | if ( it.current()->isSelected() ) { |
493 | strList << it.current()->text(0); | 502 | strList << it.current()->text(0); |
494 | qDebug(it.current()->text(0)); | 503 | qDebug(it.current()->text(0)); |
@@ -509,39 +518,43 @@ QStringList AdvancedFm::getPath() { | |||
509 | return ""; | 518 | return ""; |
510 | } | 519 | } |
511 | 520 | ||
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 { |
519 | currentRemoteDir.cd( current, TRUE); | 529 | currentRemoteDir.cd( current, TRUE); |
520 | populateRemoteView(); | 530 | populateRemoteView(); |
521 | } | 531 | } |
522 | update(); | 532 | update(); |
523 | } | 533 | } |
524 | 534 | ||
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 { |
532 | currentRemoteDir.cd( current, TRUE); | 544 | currentRemoteDir.cd( current, TRUE); |
533 | populateRemoteView(); | 545 | populateRemoteView(); |
534 | } | 546 | } |
535 | update(); | 547 | update(); |
536 | } | 548 | } |
537 | 549 | ||
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 { |
545 | currentRemoteDir.cd( current, TRUE); | 558 | currentRemoteDir.cd( current, TRUE); |
546 | populateRemoteView(); | 559 | populateRemoteView(); |
547 | } | 560 | } |
@@ -554,13 +567,14 @@ void AdvancedFm::CFButtonPushed() { | |||
554 | if(zaurusDevice) | 567 | if(zaurusDevice) |
555 | current= "/mnt/cf"; //zaurus | 568 | current= "/mnt/cf"; //zaurus |
556 | else | 569 | else |
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 { |
564 | currentRemoteDir.cd( current, TRUE); | 578 | currentRemoteDir.cd( current, TRUE); |
565 | populateRemoteView(); | 579 | populateRemoteView(); |
566 | } | 580 | } |
@@ -642,13 +656,14 @@ void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { | |||
642 | } | 656 | } |
643 | 657 | ||
644 | 658 | ||
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 { |
652 | currentRemoteDir.cd( current, TRUE); | 667 | currentRemoteDir.cd( current, TRUE); |
653 | populateRemoteView(); | 668 | populateRemoteView(); |
654 | } | 669 | } |
@@ -714,27 +729,31 @@ QString AdvancedFm::getDiskSpace( const QString &path) { | |||
714 | 729 | ||
715 | 730 | ||
716 | void AdvancedFm::showFileMenu() { | 731 | 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 { |
724 | curApp = Remote_View->currentItem()->text(0); | 740 | curApp = Remote_View->currentItem()->text(0); |
725 | } | 741 | } |
726 | 742 | ||
727 | MimeType mt( curApp ); | 743 | MimeType mt( curApp ); |
728 | const AppLnk* app = mt.application(); | 744 | const AppLnk* app = mt.application(); |
729 | QFile fi(curApp); | 745 | QFile fi(curApp); |
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() )); |
738 | } else { | 757 | } else { |
739 | 758 | ||
740 | if ( app ) | 759 | if ( app ) |
@@ -826,13 +845,14 @@ QString AdvancedFm::checkDiskSpace(const QString &path) { | |||
826 | } | 845 | } |
827 | 846 | ||
828 | void AdvancedFm::addToDocs() { | 847 | 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); |
836 | DocLnk f; | 856 | DocLnk f; |
837 | // curFile.replace(QRegExp("\\..*"),""); | 857 | // curFile.replace(QRegExp("\\..*"),""); |
838 | f.setName((*it)); | 858 | f.setName((*it)); |