-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 9 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 18 |
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 | |||
@@ -704,70 +704,65 @@ QString AdvancedFm::getDiskSpace( const QString &path) { | |||
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 | ||
716 | void AdvancedFm::showFileMenu() { | 716 | void 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 | ||
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 | |||
@@ -32,76 +32,78 @@ | |||
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 | ||
47 | void AdvancedFm::doLocalCd() { | 47 | void AdvancedFm::doLocalCd() { |
48 | localListClicked( Local_View->currentItem()); | 48 | localListClicked( Local_View->currentItem()); |
49 | } | 49 | } |
50 | 50 | ||
51 | void AdvancedFm::doRemoteCd() { | 51 | void AdvancedFm::doRemoteCd() { |
52 | localListClicked( Remote_View->currentItem()); | 52 | localListClicked( Remote_View->currentItem()); |
53 | } | 53 | } |
54 | 54 | ||
55 | void AdvancedFm::showMenuHidden() { | 55 | void 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 | ||
61 | void AdvancedFm::showHidden() { | 64 | void 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 | ||
76 | void AdvancedFm::showRemoteHidden() { | 78 | void 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 | ||
88 | void AdvancedFm::runThis() { | 90 | void 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); |