-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index b9e254e..18952c3 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -639,132 +639,134 @@ void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint | |||
639 | switch (mouse) { | 639 | switch (mouse) { |
640 | case 1: | 640 | case 1: |
641 | break; | 641 | break; |
642 | case 2: | 642 | case 2: |
643 | showLocalMenu(item); | 643 | showLocalMenu(item); |
644 | Local_View->clearSelection(); | 644 | Local_View->clearSelection(); |
645 | break; | 645 | break; |
646 | }; | 646 | }; |
647 | } | 647 | } |
648 | 648 | ||
649 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 649 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
650 | { | 650 | { |
651 | switch (mouse) { | 651 | switch (mouse) { |
652 | case 1: | 652 | case 1: |
653 | break; | 653 | break; |
654 | case 2: | 654 | case 2: |
655 | showRemoteMenu(item); | 655 | showRemoteMenu(item); |
656 | Remote_View->clearSelection(); | 656 | Remote_View->clearSelection(); |
657 | break; | 657 | break; |
658 | }; | 658 | }; |
659 | } | 659 | } |
660 | 660 | ||
661 | void AdvancedFm::showLocalMenu(QListViewItem * item) | 661 | void AdvancedFm::showLocalMenu(QListViewItem * item) |
662 | { | 662 | { |
663 | if(item) { | 663 | if(item) { |
664 | QPopupMenu m; | 664 | QPopupMenu m; |
665 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 665 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
666 | m.insertSeparator(); | 666 | m.insertSeparator(); |
667 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 667 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) |
668 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | 668 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); |
669 | else | 669 | else |
670 | m.insertItem( tr( "Open / Execute" ), this, SLOT( runThis() )); | 670 | m.insertItem( tr( "Open / Execute" ), this, SLOT( runThis() )); |
671 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); | 671 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); |
672 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 672 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
673 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 673 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
674 | m.insertSeparator(); | 674 | m.insertSeparator(); |
675 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 675 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
676 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); | 676 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); |
677 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 677 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
678 | m.insertItem( tr( "Move" ), this, SLOT( move() )); | 678 | m.insertItem( tr( "Move" ), this, SLOT( move() )); |
679 | m.insertSeparator(); | 679 | m.insertSeparator(); |
680 | m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); | 680 | m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); |
681 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 681 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
682 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 682 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
683 | m.insertSeparator(); | 683 | m.insertSeparator(); |
684 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 684 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
685 | m.insertSeparator(); | 685 | m.insertSeparator(); |
686 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 686 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
687 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings | ||
687 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 688 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
688 | m.setCheckable(TRUE); | 689 | m.setCheckable(TRUE); |
689 | if (!b) | 690 | if (!b) |
690 | m.setItemChecked(m.idAt(0),TRUE); | 691 | m.setItemChecked(m.idAt(0),TRUE); |
691 | else | 692 | else |
692 | m.setItemChecked(m.idAt(0),FALSE); | 693 | m.setItemChecked(m.idAt(0),FALSE); |
693 | m.exec( QCursor::pos() ); | 694 | m.exec( QCursor::pos() ); |
694 | } | 695 | } |
695 | } | 696 | } |
696 | 697 | ||
697 | void AdvancedFm::showRemoteMenu(QListViewItem * item) | 698 | void AdvancedFm::showRemoteMenu(QListViewItem * item) |
698 | { | 699 | { |
699 | if(item) { | 700 | if(item) { |
700 | QPopupMenu m; | 701 | QPopupMenu m; |
701 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); | 702 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); |
702 | m.insertSeparator(); | 703 | m.insertSeparator(); |
703 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 704 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) |
704 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); | 705 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); |
705 | else | 706 | else |
706 | m.insertItem( tr( "Open / Execute" ), this, SLOT( runThis() )); | 707 | m.insertItem( tr( "Open / Execute" ), this, SLOT( runThis() )); |
707 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); | 708 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); |
708 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 709 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
709 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 710 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
710 | m.insertSeparator(); | 711 | m.insertSeparator(); |
711 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 712 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
712 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); | 713 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); |
713 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 714 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
714 | m.insertItem( tr( "Move" ), this, SLOT( move() )); | 715 | m.insertItem( tr( "Move" ), this, SLOT( move() )); |
715 | m.insertSeparator(); | 716 | m.insertSeparator(); |
716 | m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); | 717 | m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); |
717 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 718 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
718 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 719 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
719 | m.insertSeparator(); | 720 | m.insertSeparator(); |
720 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 721 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
721 | m.insertSeparator(); | 722 | m.insertSeparator(); |
722 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 723 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
724 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings | ||
723 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 725 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
724 | m.setCheckable(TRUE); | 726 | m.setCheckable(TRUE); |
725 | if (!b) | 727 | if (!b) |
726 | m.setItemChecked(m.idAt(0),TRUE); | 728 | m.setItemChecked(m.idAt(0),TRUE); |
727 | else | 729 | else |
728 | m.setItemChecked(m.idAt(0),FALSE); | 730 | m.setItemChecked(m.idAt(0),FALSE); |
729 | m.exec( QCursor::pos() ); | 731 | m.exec( QCursor::pos() ); |
730 | } | 732 | } |
731 | } | 733 | } |
732 | 734 | ||
733 | void AdvancedFm::runThis() { | 735 | void AdvancedFm::runThis() { |
734 | // QFileInfo *fi; | 736 | // QFileInfo *fi; |
735 | QString fs; | 737 | QString fs; |
736 | if (TabWidget->currentPageIndex() == 0) { | 738 | if (TabWidget->currentPageIndex() == 0) { |
737 | QString curFile = Local_View->currentItem()->text(0); | 739 | QString curFile = Local_View->currentItem()->text(0); |
738 | 740 | ||
739 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 741 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
740 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); | 742 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); |
741 | qDebug( fileInfo.owner()); | 743 | qDebug( fileInfo.owner()); |
742 | if( (fileInfo.permission( QFileInfo::ExeUser) | 744 | if( (fileInfo.permission( QFileInfo::ExeUser) |
743 | | fileInfo.permission( QFileInfo::ExeGroup) | 745 | | fileInfo.permission( QFileInfo::ExeGroup) |
744 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 746 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
745 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 747 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
746 | // if( fileInfo.isExecutable() | | 748 | // if( fileInfo.isExecutable() | |
747 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 749 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
748 | e << curFile; | 750 | e << curFile; |
749 | } else { | 751 | } else { |
750 | curFile = currentDir.canonicalPath()+"/"+curFile; | 752 | curFile = currentDir.canonicalPath()+"/"+curFile; |
751 | DocLnk nf(curFile); | 753 | DocLnk nf(curFile); |
752 | QString execStr = nf.exec(); | 754 | QString execStr = nf.exec(); |
753 | qDebug( execStr); | 755 | qDebug( execStr); |
754 | if( execStr.isEmpty() ) { | 756 | if( execStr.isEmpty() ) { |
755 | } else { | 757 | } else { |
756 | nf.execute(); | 758 | nf.execute(); |
757 | } | 759 | } |
758 | } | 760 | } |
759 | // MimeType mt( curFile); | 761 | // MimeType mt( curFile); |
760 | } else { | 762 | } else { |
761 | QString curFile = Remote_View->currentItem()->text(0); | 763 | QString curFile = Remote_View->currentItem()->text(0); |
762 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 764 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
763 | qDebug("Filesystemtype is "+fs); | 765 | qDebug("Filesystemtype is "+fs); |
764 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); | 766 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); |
765 | if( (fileInfo.permission( QFileInfo::ExeUser) | 767 | if( (fileInfo.permission( QFileInfo::ExeUser) |
766 | | fileInfo.permission( QFileInfo::ExeGroup) | 768 | | fileInfo.permission( QFileInfo::ExeGroup) |
767 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 769 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
768 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 770 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
769 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 771 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
770 | e << curFile; | 772 | e << curFile; |
@@ -1011,101 +1013,104 @@ void AdvancedFm::fillCombo(const QString ¤tPath) { | |||
1011 | } | 1013 | } |
1012 | 1014 | ||
1013 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { | 1015 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { |
1014 | if (TabWidget->currentPageIndex() == 0) { | 1016 | if (TabWidget->currentPageIndex() == 0) { |
1015 | chdir( currentPath.latin1() ); | 1017 | chdir( currentPath.latin1() ); |
1016 | currentDir.cd( currentPath, TRUE); | 1018 | currentDir.cd( currentPath, TRUE); |
1017 | populateLocalView(); | 1019 | populateLocalView(); |
1018 | update(); | 1020 | update(); |
1019 | } else { | 1021 | } else { |
1020 | chdir( currentPath.latin1() ); | 1022 | chdir( currentPath.latin1() ); |
1021 | currentRemoteDir.cd( currentPath, TRUE); | 1023 | currentRemoteDir.cd( currentPath, TRUE); |
1022 | populateRemoteView(); | 1024 | populateRemoteView(); |
1023 | update(); | 1025 | update(); |
1024 | } | 1026 | } |
1025 | } | 1027 | } |
1026 | 1028 | ||
1027 | void AdvancedFm::filePerms() { | 1029 | void AdvancedFm::filePerms() { |
1028 | 1030 | ||
1029 | QStringList curFileList = getPath(); | 1031 | QStringList curFileList = getPath(); |
1030 | QString filePath; | 1032 | QString filePath; |
1031 | 1033 | ||
1032 | if (TabWidget->currentPageIndex() == 0) { | 1034 | if (TabWidget->currentPageIndex() == 0) { |
1033 | filePath = currentDir.canonicalPath()+"/"; | 1035 | filePath = currentDir.canonicalPath()+"/"; |
1034 | } else { | 1036 | } else { |
1035 | filePath= currentRemoteDir.canonicalPath()+"/"; | 1037 | filePath= currentRemoteDir.canonicalPath()+"/"; |
1036 | } | 1038 | } |
1037 | 1039 | ||
1038 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1040 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1039 | filePermissions *filePerm; | 1041 | filePermissions *filePerm; |
1040 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); | 1042 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); |
1041 | filePerm->showMaximized(); | 1043 | filePerm->showMaximized(); |
1042 | filePerm->exec(); | 1044 | filePerm->exec(); |
1043 | if( filePerm) | 1045 | if( filePerm) |
1044 | delete filePerm; | 1046 | delete filePerm; |
1045 | } | 1047 | } |
1046 | if (TabWidget->currentPageIndex() == 0) { | 1048 | if (TabWidget->currentPageIndex() == 0) { |
1047 | populateLocalView(); | 1049 | populateLocalView(); |
1048 | } else { | 1050 | } else { |
1049 | populateRemoteView(); | 1051 | populateRemoteView(); |
1050 | } | 1052 | } |
1051 | 1053 | ||
1052 | 1054 | ||
1053 | } | 1055 | } |
1054 | 1056 | ||
1055 | void AdvancedFm::doProperties() { | 1057 | void AdvancedFm::doProperties() { |
1056 | QStringList curFileList = getPath(); | 1058 | QStringList curFileList = getPath(); |
1057 | QString filePath; | 1059 | QString filePath; |
1058 | if (TabWidget->currentPageIndex() == 0) { | 1060 | if (TabWidget->currentPageIndex() == 0) { |
1061 | |||
1059 | filePath = currentDir.canonicalPath()+"/"; | 1062 | filePath = currentDir.canonicalPath()+"/"; |
1060 | } else { | 1063 | } else { |
1061 | filePath= currentRemoteDir.canonicalPath()+"/"; | 1064 | filePath= currentRemoteDir.canonicalPath()+"/"; |
1062 | } | 1065 | } |
1066 | // qDebug("%d",curFileList.count()); | ||
1063 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1067 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1068 | qDebug((filePath+*it)); | ||
1064 | DocLnk lnk( (filePath+*it)); | 1069 | DocLnk lnk( (filePath+*it)); |
1065 | LnkProperties prop( &lnk ); | 1070 | LnkProperties prop( &lnk ); |
1066 | // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); | 1071 | // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); |
1067 | prop.showMaximized(); | 1072 | prop.showMaximized(); |
1068 | prop.exec(); | 1073 | prop.exec(); |
1069 | } | 1074 | } |
1070 | } | 1075 | } |
1071 | 1076 | ||
1072 | QStringList AdvancedFm::getPath() { | 1077 | QStringList AdvancedFm::getPath() { |
1073 | QStringList strList; | 1078 | QStringList strList; |
1074 | if (TabWidget->currentPageIndex() == 0) { | 1079 | if (TabWidget->currentPageIndex() == 0) { |
1075 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 1080 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
1076 | QListViewItemIterator it( Local_View ); | 1081 | QListViewItemIterator it( Local_View ); |
1077 | for ( ; it.current(); ++it ) { | 1082 | for ( ; it.current(); ++it ) { |
1078 | if ( it.current()->isSelected() ) { | 1083 | if ( it.current()->isSelected() ) { |
1079 | strList << it.current()->text(0); | 1084 | strList << it.current()->text(0); |
1080 | } | 1085 | } |
1081 | } | 1086 | } |
1082 | return strList; | 1087 | return strList; |
1083 | } else { | 1088 | } else { |
1084 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); | 1089 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
1085 | QListViewItemIterator it( Remote_View ); | 1090 | QListViewItemIterator it( Remote_View ); |
1086 | for ( ; it.current(); ++it ) { | 1091 | for ( ; it.current(); ++it ) { |
1087 | if ( it.current()->isSelected() ) { | 1092 | if ( it.current()->isSelected() ) { |
1088 | strList << it.current()->text(0); | 1093 | strList << it.current()->text(0); |
1089 | } | 1094 | } |
1090 | } | 1095 | } |
1091 | return strList; | 1096 | return strList; |
1092 | } | 1097 | } |
1093 | return ""; | 1098 | return ""; |
1094 | } | 1099 | } |
1095 | 1100 | ||
1096 | void AdvancedFm::homeButtonPushed() { | 1101 | void AdvancedFm::homeButtonPushed() { |
1097 | QString current = QDir::homeDirPath(); | 1102 | QString current = QDir::homeDirPath(); |
1098 | chdir( current.latin1() ); | 1103 | chdir( current.latin1() ); |
1099 | if (TabWidget->currentPageIndex() == 0) { | 1104 | if (TabWidget->currentPageIndex() == 0) { |
1100 | currentDir.cd( current, TRUE); | 1105 | currentDir.cd( current, TRUE); |
1101 | populateLocalView(); | 1106 | populateLocalView(); |
1102 | } else { | 1107 | } else { |
1103 | currentRemoteDir.cd( current, TRUE); | 1108 | currentRemoteDir.cd( current, TRUE); |
1104 | populateRemoteView(); | 1109 | populateRemoteView(); |
1105 | } | 1110 | } |
1106 | update(); | 1111 | update(); |
1107 | } | 1112 | } |
1108 | 1113 | ||
1109 | void AdvancedFm::docButtonPushed() { | 1114 | void AdvancedFm::docButtonPushed() { |
1110 | QString current = QPEApplication::documentDir(); | 1115 | QString current = QPEApplication::documentDir(); |
1111 | chdir( current.latin1() ); | 1116 | chdir( current.latin1() ); |