summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-10-16 15:48:52 (UTC)
committer llornkcor <llornkcor>2002-10-16 15:48:52 (UTC)
commit0176ce245c348baf392dba790878458a5e39077f (patch) (unidiff)
tree91665a3e143c14d3a785d1c660df88e2aafde9fc
parent321cea04e34658fde3de47c104682b5cefce6eeb (diff)
downloadopie-0176ce245c348baf392dba790878458a5e39077f.zip
opie-0176ce245c348baf392dba790878458a5e39077f.tar.gz
opie-0176ce245c348baf392dba790878458a5e39077f.tar.bz2
fix showhidden files handling
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp9
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp18
2 files changed, 12 insertions, 15 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index b6e7a30..f23fd86 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -536,325 +536,320 @@ void AdvancedFm::docButtonPushed() {
536} 536}
537 537
538void AdvancedFm::SDButtonPushed() { 538void AdvancedFm::SDButtonPushed() {
539 QString current = "/mnt/card";// this can change so fix 539 QString current = "/mnt/card";// this can change so fix
540 chdir( current.latin1() ); 540 chdir( current.latin1() );
541 if (TabWidget->currentPageIndex() == 0) { 541 if (TabWidget->currentPageIndex() == 0) {
542 currentDir.cd( current, TRUE); 542 currentDir.cd( current, TRUE);
543 populateLocalView(); 543 populateLocalView();
544 } else { 544 } else {
545 currentRemoteDir.cd( current, TRUE); 545 currentRemoteDir.cd( current, TRUE);
546 populateRemoteView(); 546 populateRemoteView();
547 } 547 }
548 update(); 548 update();
549 549
550} 550}
551 551
552void AdvancedFm::CFButtonPushed() { 552void AdvancedFm::CFButtonPushed() {
553 QString current; 553 QString current;
554 if(zaurusDevice) 554 if(zaurusDevice)
555 current= "/mnt/cf"; //zaurus 555 current= "/mnt/cf"; //zaurus
556 else 556 else
557 current = "/mnt/hda"; //ipaq 557 current = "/mnt/hda"; //ipaq
558 558
559 chdir( current.latin1() ); 559 chdir( current.latin1() );
560 if (TabWidget->currentPageIndex() == 0) { 560 if (TabWidget->currentPageIndex() == 0) {
561 currentDir.cd( current, TRUE); 561 currentDir.cd( current, TRUE);
562 populateLocalView(); 562 populateLocalView();
563 } else { 563 } else {
564 currentRemoteDir.cd( current, TRUE); 564 currentRemoteDir.cd( current, TRUE);
565 populateRemoteView(); 565 populateRemoteView();
566 } 566 }
567 update(); 567 update();
568} 568}
569 569
570 570
571 571
572void AdvancedFm::doAbout() { 572void AdvancedFm::doAbout() {
573 QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" 573 QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n"
574 "is copyright 2002 by\n" 574 "is copyright 2002 by\n"
575 "L.J.Potter<llornkcor@handhelds.org>\n" 575 "L.J.Potter<llornkcor@handhelds.org>\n"
576 "and is licensed by the GPL")); 576 "and is licensed by the GPL"));
577} 577}
578 578
579void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { 579void AdvancedFm::keyReleaseEvent( QKeyEvent *e) {
580 if( TabWidget->hasFocus()) 580 if( TabWidget->hasFocus())
581 switch ( e->key() ) { 581 switch ( e->key() ) {
582 case Key_Delete: 582 case Key_Delete:
583 del(); 583 del();
584 break; 584 break;
585 case Key_H: 585 case Key_H:
586 showHidden(); 586 showHidden();
587 break; 587 break;
588 case Key_E: 588 case Key_E:
589 runThis(); 589 runThis();
590 break; 590 break;
591 case Key_C: 591 case Key_C:
592 copy(); 592 copy();
593 break; 593 break;
594 case Key_A: 594 case Key_A:
595 copyAs(); 595 copyAs();
596 break; 596 break;
597 case Key_M: 597 case Key_M:
598 move(); 598 move();
599 break; 599 break;
600 case Key_R: 600 case Key_R:
601 rn(); 601 rn();
602 break; 602 break;
603 case Key_I: 603 case Key_I:
604 fileStatus(); 604 fileStatus();
605 break; 605 break;
606 case Key_U: 606 case Key_U:
607 upDir(); 607 upDir();
608 break; 608 break;
609 case Key_P: 609 case Key_P:
610 filePerms(); 610 filePerms();
611 break; 611 break;
612 case Key_N: 612 case Key_N:
613 mkDir(); 613 mkDir();
614 break; 614 break;
615 case Key_1: 615 case Key_1:
616 switchToLocalTab(); 616 switchToLocalTab();
617 break; 617 break;
618 case Key_2: 618 case Key_2:
619 switchToRemoteTab(); 619 switchToRemoteTab();
620 break; 620 break;
621 case Key_3: 621 case Key_3:
622 CFButtonPushed(); 622 CFButtonPushed();
623 break; 623 break;
624 case Key_4: 624 case Key_4:
625 SDButtonPushed(); 625 SDButtonPushed();
626 break; 626 break;
627 case Key_5: 627 case Key_5:
628 homeButtonPushed(); 628 homeButtonPushed();
629 break; 629 break;
630 case Key_6: 630 case Key_6:
631 docButtonPushed(); 631 docButtonPushed();
632 break; 632 break;
633 case Key_7: 633 case Key_7:
634 break; 634 break;
635 case Key_8: 635 case Key_8:
636 break; 636 break;
637 case Key_9: 637 case Key_9:
638 break; 638 break;
639 case Key_0: 639 case Key_0:
640 break; 640 break;
641 } 641 }
642} 642}
643 643
644 644
645void AdvancedFm::QPEButtonPushed() { 645void AdvancedFm::QPEButtonPushed() {
646 QString current = QPEApplication::qpeDir(); 646 QString current = QPEApplication::qpeDir();
647 chdir( current.latin1() ); 647 chdir( current.latin1() );
648 if (TabWidget->currentPageIndex() == 0) { 648 if (TabWidget->currentPageIndex() == 0) {
649 currentDir.cd( current, TRUE); 649 currentDir.cd( current, TRUE);
650 populateLocalView(); 650 populateLocalView();
651 } else { 651 } else {
652 currentRemoteDir.cd( current, TRUE); 652 currentRemoteDir.cd( current, TRUE);
653 populateRemoteView(); 653 populateRemoteView();
654 } 654 }
655 update(); 655 update();
656} 656}
657 657
658void AdvancedFm::parsetab(const QString &fileName) { 658void AdvancedFm::parsetab(const QString &fileName) {
659 659
660 fileSystemTypeList.clear(); 660 fileSystemTypeList.clear();
661 fsList.clear(); 661 fsList.clear();
662 struct mntent *me; 662 struct mntent *me;
663 FILE *mntfp = setmntent( fileName.latin1(), "r" ); 663 FILE *mntfp = setmntent( fileName.latin1(), "r" );
664 if ( mntfp ) { 664 if ( mntfp ) {
665 while ( (me = getmntent( mntfp )) != 0 ) { 665 while ( (me = getmntent( mntfp )) != 0 ) {
666 QString deviceName = me->mnt_fsname; 666 QString deviceName = me->mnt_fsname;
667 QString filesystemType = me->mnt_type; 667 QString filesystemType = me->mnt_type;
668 QString mountDir = me->mnt_dir; 668 QString mountDir = me->mnt_dir;
669 if(deviceName != "none") { 669 if(deviceName != "none") {
670 if( fsList.contains(filesystemType) == 0 670 if( fsList.contains(filesystemType) == 0
671 & filesystemType.find("proc",0,TRUE) == -1 671 & filesystemType.find("proc",0,TRUE) == -1
672 & filesystemType.find("cramfs",0,TRUE) == -1 672 & filesystemType.find("cramfs",0,TRUE) == -1
673 & filesystemType.find("auto",0,TRUE) == -1) 673 & filesystemType.find("auto",0,TRUE) == -1)
674 fsList << filesystemType; 674 fsList << filesystemType;
675 fileSystemTypeList << mountDir+"::"+filesystemType; 675 fileSystemTypeList << mountDir+"::"+filesystemType;
676 } 676 }
677 } 677 }
678 } 678 }
679 endmntent( mntfp ); 679 endmntent( mntfp );
680} 680}
681 681
682QString AdvancedFm::getFileSystemType(const QString &currentText) { 682QString AdvancedFm::getFileSystemType(const QString &currentText) {
683 parsetab("/etc/mtab"); //why did TT forget filesystem type? 683 parsetab("/etc/mtab"); //why did TT forget filesystem type?
684 QString current = currentText;//.right( currentText.length()-1); 684 QString current = currentText;//.right( currentText.length()-1);
685 QString baseFs; 685 QString baseFs;
686 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { 686 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) {
687 QString temp = (*it); 687 QString temp = (*it);
688 QString path = temp.left(temp.find("::",0,TRUE) ); 688 QString path = temp.left(temp.find("::",0,TRUE) );
689 path = path.right( path.length()-1); 689 path = path.right( path.length()-1);
690 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 690 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
691 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { 691 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) {
692 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 692 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
693 } 693 }
694 } 694 }
695 return baseFs; 695 return baseFs;
696} 696}
697 697
698QString AdvancedFm::getDiskSpace( const QString &path) { 698QString AdvancedFm::getDiskSpace( const QString &path) {
699 struct statfs fss; 699 struct statfs fss;
700 if ( !statfs( path.latin1(), &fss ) ) { 700 if ( !statfs( path.latin1(), &fss ) ) {
701 int blkSize = fss.f_bsize; 701 int blkSize = fss.f_bsize;
702 // int totalBlks = fs.f_blocks; 702 // int totalBlks = fs.f_blocks;
703 int availBlks = fss.f_bavail; 703 int availBlks = fss.f_bavail;
704 704
705 long mult = blkSize / 1024; 705 long mult = blkSize / 1024;
706 long div = 1024 / blkSize; 706 long div = 1024 / blkSize;
707 if ( !mult ) mult = 1; 707 if ( !mult ) mult = 1;
708 if ( !div ) div = 1; 708 if ( !div ) div = 1;
709 709
710 return QString::number(availBlks * mult / div); 710 return QString::number(availBlks * mult / div);
711 } 711 }
712 return ""; 712 return "";
713} 713}
714 714
715 715
716void AdvancedFm::showFileMenu() { 716void AdvancedFm::showFileMenu() {
717 717
718 QString curApp; 718 QString curApp;
719 bool isLocalView = false; 719 bool isLocalView = false;
720 if (TabWidget->currentPageIndex() == 0) { 720 if (TabWidget->currentPageIndex() == 0) {
721 isLocalView = TRUE; 721 isLocalView = TRUE;
722 curApp = Local_View->currentItem()->text(0); 722 curApp = Local_View->currentItem()->text(0);
723 } else { 723 } else {
724 curApp = Remote_View->currentItem()->text(0); 724 curApp = Remote_View->currentItem()->text(0);
725 } 725 }
726 726
727 MimeType mt( curApp ); 727 MimeType mt( curApp );
728
729 const AppLnk* app = mt.application(); 728 const AppLnk* app = mt.application();
730
731 QFile fi(curApp); 729 QFile fi(curApp);
732
733 QPopupMenu *m = new QPopupMenu(0); 730 QPopupMenu *m = new QPopupMenu(0);
734 QPopupMenu *n = new QPopupMenu(0); 731 QPopupMenu *n = new QPopupMenu(0);
735 // QPopupMenu *o = new QPopupMenu(0); 732 // QPopupMenu *o = new QPopupMenu(0);
736 733 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() ));
737 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
738 734
739 if ( QFileInfo(fi).isDir() ) { 735 if ( QFileInfo(fi).isDir() ) {
740 m->insertSeparator(); 736 m->insertSeparator();
741 m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); 737 m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
742 } else { 738 } else {
743 739
744 if ( app ) 740 if ( app )
745 m->insertItem( app->pixmap(), tr( "Open in " 741 m->insertItem( app->pixmap(), tr( "Open in "
746 + app->name() ), this, SLOT( runThis() ) ); 742 + app->name() ), this, SLOT( runThis() ) );
747 else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this 743 else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this
748 m->insertItem( /*Resource::loadPixmap( app->name()),*/ tr( "Execute" ), this, SLOT( runThis() ) ); 744 m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) );
749
750 m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); 745 m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) );
751 } 746 }
752 747
753 m->insertItem(tr("Actions"),n); 748 m->insertItem(tr("Actions"),n);
754 if(isLocalView) 749 if(isLocalView)
755 n->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 750 n->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
756 else 751 else
757 n->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 752 n->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
758 753
759 n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 754 n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
760 755
761 n->insertSeparator(); 756 n->insertSeparator();
762 757
763 758
764 if(isLocalView) 759 if(isLocalView)
765 n->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 760 n->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
766 else 761 else
767 n->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 762 n->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
768 763
769 n->insertItem( tr( "Copy" ), this, SLOT( copy() )); 764 n->insertItem( tr( "Copy" ), this, SLOT( copy() ));
770 n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); 765 n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
771 n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); 766 n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() ));
772 n->insertItem( tr( "Move" ), this, SLOT( move() )); 767 n->insertItem( tr( "Move" ), this, SLOT( move() ));
773 768
774 n->insertSeparator(); 769 n->insertSeparator();
775 770
776 if(isLocalView) 771 if(isLocalView)
777 n->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 772 n->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
778 else 773 else
779 n->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 774 n->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
780 775
781 776
782 m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); 777 m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ));
783 778
784 m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); 779 m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
785 m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 780 m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
786 781
787 m->insertSeparator(); 782 m->insertSeparator();
788 m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); 783 m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
789 784
790#if defined(QT_QWS_OPIE) 785#if defined(QT_QWS_OPIE)
791 m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 786 m->insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
792#endif 787#endif
793 m->setCheckable(TRUE); 788 m->setCheckable(TRUE);
794 if (!b) 789 if (!b)
795 m->setItemChecked(m->idAt(0),TRUE); 790 m->setItemChecked(m->idAt(0),TRUE);
796 else 791 else
797 m->setItemChecked(m->idAt(0),FALSE); 792 m->setItemChecked(m->idAt(0),FALSE);
798 793
799 if(Ir::supported()) 794 if(Ir::supported())
800 m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); 795 m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() ));
801 m->setFocus(); 796 m->setFocus();
802 m->exec( QCursor::pos() ); 797 m->exec( QCursor::pos() );
803 sleep(1); 798 sleep(1);
804 if(m) delete m; 799 if(m) delete m;
805} 800}
806 801
807 802
808void AdvancedFm::cancelMenuTimer() { 803void AdvancedFm::cancelMenuTimer() {
809 804
810// qDebug("selectionChanged: cancel menu timer"); 805// qDebug("selectionChanged: cancel menu timer");
811 if( menuTimer.isActive() ) 806 if( menuTimer.isActive() )
812 menuTimer.stop(); 807 menuTimer.stop();
813} 808}
814 809
815QString AdvancedFm::checkDiskSpace(const QString &path) { 810QString AdvancedFm::checkDiskSpace(const QString &path) {
816 struct statfs fss; 811 struct statfs fss;
817 if ( !statfs( path.latin1(), &fss ) ) { 812 if ( !statfs( path.latin1(), &fss ) ) {
818 int blkSize = fss.f_bsize; 813 int blkSize = fss.f_bsize;
819// int totalBlks = fs.f_blocks; 814// int totalBlks = fs.f_blocks;
820 int availBlks = fss.f_bavail; 815 int availBlks = fss.f_bavail;
821 816
822 long mult = blkSize / 1024; 817 long mult = blkSize / 1024;
823 long div = 1024 / blkSize; 818 long div = 1024 / blkSize;
824 if ( !mult ) mult = 1; 819 if ( !mult ) mult = 1;
825 if ( !div ) div = 1; 820 if ( !div ) div = 1;
826 821
827 822
828 return QString::number(availBlks * mult / div); 823 return QString::number(availBlks * mult / div);
829 } 824 }
830 return ""; 825 return "";
831} 826}
832 827
833void AdvancedFm::addToDocs() { 828void AdvancedFm::addToDocs() {
834 QStringList strListPaths = getPath(); 829 QStringList strListPaths = getPath();
835 if( strListPaths.count() > 0) { 830 if( strListPaths.count() > 0) {
836 QString curFile; 831 QString curFile;
837 if (TabWidget->currentPageIndex() == 0) { 832 if (TabWidget->currentPageIndex() == 0) {
838 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { 833 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
839 curFile = currentDir.canonicalPath()+"/"+(*it); 834 curFile = currentDir.canonicalPath()+"/"+(*it);
840 qDebug(curFile); 835 qDebug(curFile);
841 DocLnk f; 836 DocLnk f;
842// curFile.replace(QRegExp("\\..*"),""); 837// curFile.replace(QRegExp("\\..*"),"");
843 f.setName((*it)); 838 f.setName((*it));
844 f.setFile( curFile); 839 f.setFile( curFile);
845 f.writeLink(); 840 f.writeLink();
846 } 841 }
847 } else { 842 } else {
848 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { 843 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
849 curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 844 curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
850 qDebug(curFile); 845 qDebug(curFile);
851 846
852 DocLnk f; 847 DocLnk f;
853// curFile.replace(QRegExp("\\..*"),""); 848// curFile.replace(QRegExp("\\..*"),"");
854 f.setName((*it)); 849 f.setName((*it));
855 f.setFile( curFile); 850 f.setFile( curFile);
856 f.writeLink(); 851 f.writeLink();
857 } 852 }
858 } 853 }
859 } 854 }
860} 855}
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 6d37904..5fa8d0c 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -1,275 +1,277 @@
1/*************************************************************************** 1/***************************************************************************
2 AdvancedFm.cpp 2 AdvancedFm.cpp
3 ------------------- 3 -------------------
4 ** Created: Sat Mar 9 23:33:09 2002 4 ** Created: Sat Mar 9 23:33:09 2002
5 copyright : (C) 2002 by ljp 5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
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#include "advancedfm.h" 12#include "advancedfm.h"
13#include "inputDialog.h" 13#include "inputDialog.h"
14#include "output.h" 14#include "output.h"
15#include "filePermissions.h" 15#include "filePermissions.h"
16 16
17#include <qpe/lnkproperties.h> 17#include <qpe/lnkproperties.h>
18#include <qpe/qpeapplication.h> 18#include <qpe/qpeapplication.h>
19#include <qpe/qpemenubar.h> 19#include <qpe/qpemenubar.h>
20#include <qpe/qpetoolbar.h> 20#include <qpe/qpetoolbar.h>
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
23#include <qpe/applnk.h> 23#include <qpe/applnk.h>
24#include <qpe/ir.h> 24#include <qpe/ir.h>
25 25
26#include <qmessagebox.h> 26#include <qmessagebox.h>
27#include <qmultilineedit.h> 27#include <qmultilineedit.h>
28 28
29#include <qstring.h> 29#include <qstring.h>
30 30
31#include <qlayout.h> 31#include <qlayout.h>
32#include <qpixmap.h> 32#include <qpixmap.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35#include <qtabwidget.h> 35#include <qtabwidget.h>
36#include <qtoolbutton.h> 36#include <qtoolbutton.h>
37#include <qtabwidget.h> 37#include <qtabwidget.h>
38#include <qlineedit.h> 38#include <qlineedit.h>
39#include <qlistview.h> 39#include <qlistview.h>
40 40
41#include <stdlib.h> 41#include <stdlib.h>
42#include <unistd.h> 42#include <unistd.h>
43#include <sys/stat.h> 43#include <sys/stat.h>
44#include <dirent.h> 44#include <dirent.h>
45 45
46 46
47void AdvancedFm::doLocalCd() { 47void AdvancedFm::doLocalCd() {
48 localListClicked( Local_View->currentItem()); 48 localListClicked( Local_View->currentItem());
49} 49}
50 50
51void AdvancedFm::doRemoteCd() { 51void AdvancedFm::doRemoteCd() {
52 localListClicked( Remote_View->currentItem()); 52 localListClicked( Remote_View->currentItem());
53} 53}
54 54
55void AdvancedFm::showMenuHidden() { 55void AdvancedFm::showMenuHidden() {
56 showHidden(); 56 if(TabWidget->currentPageIndex() == 0)
57 if(b) b= false; else b=true; 57 showHidden();
58 showRemoteHidden(); 58 else
59 showRemoteHidden();
60// if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true");
61 if(b) b = false; else b = true;
59} 62}
60 63
61void AdvancedFm::showHidden() { 64void AdvancedFm::showHidden() {
62 if (b) { 65 if (b) {
63 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 66 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
64 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 67 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
65 b=FALSE; 68// b=FALSE;
66 69
67 } else { 70 } else {
68 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 71 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
69 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); 72 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
70 b=TRUE; 73// b=TRUE;
71 } 74 }
72 populateLocalView(); 75 populateLocalView();
73
74} 76}
75 77
76void AdvancedFm::showRemoteHidden() { 78void AdvancedFm::showRemoteHidden() {
77 if (b) { 79 if (b) {
78 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 80 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
79 b=TRUE; 81// b=TRUE;
80 82
81 } else { 83 } else {
82 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 84 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
83 b=FALSE; 85// b=FALSE;
84 } 86 }
85 populateRemoteView(); 87 populateRemoteView();
86} 88}
87 89
88void AdvancedFm::runThis() { 90void AdvancedFm::runThis() {
89 QString fs; 91 QString fs;
90 if (TabWidget->currentPageIndex() == 0) { 92 if (TabWidget->currentPageIndex() == 0) {
91 QString curFile = Local_View->currentItem()->text(0); 93 QString curFile = Local_View->currentItem()->text(0);
92 if(curFile != "../") { 94 if(curFile != "../") {
93 95
94 fs= getFileSystemType((const QString &) currentDir.canonicalPath()); 96 fs= getFileSystemType((const QString &) currentDir.canonicalPath());
95 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); 97 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile);
96 qDebug( fileInfo.owner()); 98 qDebug( fileInfo.owner());
97 if( (fileInfo.permission( QFileInfo::ExeUser) 99 if( (fileInfo.permission( QFileInfo::ExeUser)
98 | fileInfo.permission( QFileInfo::ExeGroup) 100 | fileInfo.permission( QFileInfo::ExeGroup)
99 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { 101 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
100 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 102 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
101 QCopEnvelope e("QPE/System", "execute(QString)" ); 103 QCopEnvelope e("QPE/System", "execute(QString)" );
102 e << curFile; 104 e << curFile;
103 } else { 105 } else {
104 curFile = currentDir.canonicalPath()+"/"+curFile; 106 curFile = currentDir.canonicalPath()+"/"+curFile;
105 DocLnk nf(curFile); 107 DocLnk nf(curFile);
106 QString execStr = nf.exec(); 108 QString execStr = nf.exec();
107 qDebug( execStr); 109 qDebug( execStr);
108 if( execStr.isEmpty() ) { 110 if( execStr.isEmpty() ) {
109 } else { 111 } else {
110 nf.execute(); 112 nf.execute();
111 } 113 }
112 } 114 }
113 } 115 }
114 } else { 116 } else {
115 QString curFile = Remote_View->currentItem()->text(0); 117 QString curFile = Remote_View->currentItem()->text(0);
116 if(curFile != "../") { 118 if(curFile != "../") {
117 119
118 fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); 120 fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath());
119 qDebug("Filesystemtype is "+fs); 121 qDebug("Filesystemtype is "+fs);
120 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); 122 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile);
121 if( (fileInfo.permission( QFileInfo::ExeUser) 123 if( (fileInfo.permission( QFileInfo::ExeUser)
122 | fileInfo.permission( QFileInfo::ExeGroup) 124 | fileInfo.permission( QFileInfo::ExeGroup)
123 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { 125 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
124 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 126 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
125 QCopEnvelope e("QPE/System", "execute(QString)" ); 127 QCopEnvelope e("QPE/System", "execute(QString)" );
126 e << curFile; 128 e << curFile;
127 } else { 129 } else {
128 curFile = currentRemoteDir.canonicalPath()+"/"+curFile; 130 curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
129 DocLnk nf(curFile); 131 DocLnk nf(curFile);
130 QString execStr = nf.exec(); 132 QString execStr = nf.exec();
131 qDebug(execStr); 133 qDebug(execStr);
132 if( execStr.isEmpty() ) { 134 if( execStr.isEmpty() ) {
133 } else { 135 } else {
134 nf.execute(); 136 nf.execute();
135 } 137 }
136 } 138 }
137 } 139 }
138 } 140 }
139} 141}
140 142
141void AdvancedFm::runText() { 143void AdvancedFm::runText() {
142 if (TabWidget->currentPageIndex() == 0) { 144 if (TabWidget->currentPageIndex() == 0) {
143 QString curFile = Local_View->currentItem()->text(0); 145 QString curFile = Local_View->currentItem()->text(0);
144 if(curFile != "../") { 146 if(curFile != "../") {
145 curFile = currentDir.canonicalPath()+"/"+curFile; 147 curFile = currentDir.canonicalPath()+"/"+curFile;
146 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 148 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
147 e << curFile; 149 e << curFile;
148 } 150 }
149 } else { 151 } else {
150 QString curFile = Remote_View->currentItem()->text(0); 152 QString curFile = Remote_View->currentItem()->text(0);
151 if(curFile != "../") { 153 if(curFile != "../") {
152 curFile = currentRemoteDir.canonicalPath()+"/"+curFile; 154 curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
153 DocLnk nf(curFile); 155 DocLnk nf(curFile);
154 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 156 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
155 e << curFile; 157 e << curFile;
156 } 158 }
157 } 159 }
158} 160}
159 161
160void AdvancedFm::localMakDir() { 162void AdvancedFm::localMakDir() {
161 InputDialog *fileDlg; 163 InputDialog *fileDlg;
162 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 164 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
163 fileDlg->exec(); 165 fileDlg->exec();
164 if( fileDlg->result() == 1 ) { 166 if( fileDlg->result() == 1 ) {
165 QString filename = fileDlg->LineEdit1->text(); 167 QString filename = fileDlg->LineEdit1->text();
166 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); 168 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename);
167 } 169 }
168 populateLocalView(); 170 populateLocalView();
169} 171}
170 172
171void AdvancedFm::remoteMakDir() { 173void AdvancedFm::remoteMakDir() {
172 InputDialog *fileDlg; 174 InputDialog *fileDlg;
173 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 175 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
174 fileDlg->exec(); 176 fileDlg->exec();
175 if( fileDlg->result() == 1 ) { 177 if( fileDlg->result() == 1 ) {
176 QString filename = fileDlg->LineEdit1->text(); 178 QString filename = fileDlg->LineEdit1->text();
177 currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); 179 currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename);
178 } 180 }
179 populateRemoteView(); 181 populateRemoteView();
180} 182}
181 183
182void AdvancedFm::localDelete() { 184void AdvancedFm::localDelete() {
183 QStringList curFileList = getPath(); 185 QStringList curFileList = getPath();
184 if(curFileList.count() > 0) { 186 if(curFileList.count() > 0) {
185 QString myFile; 187 QString myFile;
186 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 188 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
187 myFile = (*it); 189 myFile = (*it);
188 if( myFile.find(" -> ",0,TRUE) != -1) 190 if( myFile.find(" -> ",0,TRUE) != -1)
189 myFile = myFile.left( myFile.find(" -> ",0,TRUE)); 191 myFile = myFile.left( myFile.find(" -> ",0,TRUE));
190 192
191 QString f = currentDir.canonicalPath(); 193 QString f = currentDir.canonicalPath();
192 if(f.right(1).find("/",0,TRUE) == -1) 194 if(f.right(1).find("/",0,TRUE) == -1)
193 f+="/"; 195 f+="/";
194 f+=myFile; 196 f+=myFile;
195 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { 197 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) {
196 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ 198 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
197 "\nand all it's contents ?" 199 "\nand all it's contents ?"
198 ,tr("Yes"),tr("No"),0,0,1) ) { 200 ,tr("Yes"),tr("No"),0,0,1) ) {
199 case 0: { 201 case 0: {
200 f=f.left(f.length()-1); 202 f=f.left(f.length()-1);
201 QString cmd="rm -rf "+f; 203 QString cmd="rm -rf "+f;
202 system( cmd.latin1()); 204 system( cmd.latin1());
203 populateLocalView(); 205 populateLocalView();
204 } 206 }
205 break; 207 break;
206 case 1: 208 case 1:
207 // exit 209 // exit
208 break; 210 break;
209 }; 211 };
210 212
211 } else { 213 } else {
212 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f 214 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f
213 +" ?",tr("Yes"),tr("No"),0,0,1) ) { 215 +" ?",tr("Yes"),tr("No"),0,0,1) ) {
214 case 0: { 216 case 0: {
215 QString cmd="rm "+f; 217 QString cmd="rm "+f;
216 QFile file(f); 218 QFile file(f);
217 file.remove(); 219 file.remove();
218 // system( cmd.latin1()); 220 // system( cmd.latin1());
219 populateLocalView(); 221 populateLocalView();
220 } 222 }
221 break; 223 break;
222 case 1: 224 case 1:
223 // exit 225 // exit
224 break; 226 break;
225 }; 227 };
226 } 228 }
227 } 229 }
228 } 230 }
229} 231}
230 232
231void AdvancedFm::remoteDelete() { 233void AdvancedFm::remoteDelete() {
232 QStringList curFileList = getPath(); 234 QStringList curFileList = getPath();
233 if( curFileList.count() > 0) { 235 if( curFileList.count() > 0) {
234 QString myFile; 236 QString myFile;
235 237
236 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 238 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
237 myFile = (*it); 239 myFile = (*it);
238 if(myFile.find(" -> ",0,TRUE) != -1) 240 if(myFile.find(" -> ",0,TRUE) != -1)
239 myFile = myFile.left(myFile.find(" -> ",0,TRUE)); 241 myFile = myFile.left(myFile.find(" -> ",0,TRUE));
240 QString f = currentRemoteDir.canonicalPath(); 242 QString f = currentRemoteDir.canonicalPath();
241 if(f.right(1).find("/",0,TRUE) == -1) 243 if(f.right(1).find("/",0,TRUE) == -1)
242 f+="/"; 244 f+="/";
243 f+=myFile; 245 f+=myFile;
244 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { 246 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) {
245 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ 247 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
246 "\nand all it's contents ?", 248 "\nand all it's contents ?",
247 tr("Yes"),tr("No"),0,0,1) ) { 249 tr("Yes"),tr("No"),0,0,1) ) {
248 case 0: { 250 case 0: {
249 f=f.left(f.length()-1); 251 f=f.left(f.length()-1);
250 QString cmd="rm -rf "+f; 252 QString cmd="rm -rf "+f;
251 system( cmd.latin1()); 253 system( cmd.latin1());
252 populateRemoteView(); 254 populateRemoteView();
253 } 255 }
254 break; 256 break;
255 case 1: 257 case 1:
256 // exit 258 // exit
257 break; 259 break;
258 }; 260 };
259 261
260 } else { 262 } else {
261 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f 263 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f
262 +" ?",tr("Yes"),tr("No"),0,0,1) ) { 264 +" ?",tr("Yes"),tr("No"),0,0,1) ) {
263 case 0: { 265 case 0: {
264 QString cmd="rm "+f; 266 QString cmd="rm "+f;
265 QFile file(f); 267 QFile file(f);
266 file.remove(); 268 file.remove();
267 // system( cmd.latin1()); 269 // system( cmd.latin1());
268 populateRemoteView(); 270 populateRemoteView();
269 } 271 }
270 break; 272 break;
271 case 1: 273 case 1:
272 // exit 274 // exit
273 break; 275 break;
274 }; 276 };
275 } 277 }