-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 9 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 14 |
2 files changed, 10 insertions, 13 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 @@ -680,118 +680,113 @@ void AdvancedFm::parsetab(const QString &fileName) { } QString AdvancedFm::getFileSystemType(const QString ¤tText) { parsetab("/etc/mtab"); //why did TT forget filesystem type? QString current = currentText;//.right( currentText.length()-1); QString baseFs; for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { QString temp = (*it); QString path = temp.left(temp.find("::",0,TRUE) ); path = path.right( path.length()-1); if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); } } return baseFs; } QString AdvancedFm::getDiskSpace( const QString &path) { struct statfs fss; if ( !statfs( path.latin1(), &fss ) ) { int blkSize = fss.f_bsize; // int totalBlks = fs.f_blocks; int availBlks = fss.f_bavail; long mult = blkSize / 1024; long div = 1024 / blkSize; if ( !mult ) mult = 1; if ( !div ) div = 1; return QString::number(availBlks * mult / div); } return ""; } void AdvancedFm::showFileMenu() { QString curApp; bool isLocalView = false; if (TabWidget->currentPageIndex() == 0) { isLocalView = TRUE; curApp = Local_View->currentItem()->text(0); } else { curApp = Remote_View->currentItem()->text(0); } MimeType mt( curApp ); - const AppLnk* app = mt.application(); - QFile fi(curApp); - QPopupMenu *m = new QPopupMenu(0); QPopupMenu *n = new QPopupMenu(0); // QPopupMenu *o = new QPopupMenu(0); - - m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); + m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); if ( QFileInfo(fi).isDir() ) { m->insertSeparator(); m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); } else { if ( app ) m->insertItem( app->pixmap(), tr( "Open in " + app->name() ), this, SLOT( runThis() ) ); else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this - m->insertItem( /*Resource::loadPixmap( app->name()),*/ tr( "Execute" ), this, SLOT( runThis() ) ); - + m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); } m->insertItem(tr("Actions"),n); if(isLocalView) n->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); else n->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); n->insertSeparator(); if(isLocalView) n->insertItem( tr( "Rename" ), this, SLOT( localRename() )); else n->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); n->insertItem( tr( "Copy" ), this, SLOT( copy() )); n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); n->insertItem( tr( "Move" ), this, SLOT( move() )); n->insertSeparator(); if(isLocalView) n->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); else n->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); m->insertSeparator(); m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); #if defined(QT_QWS_OPIE) m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); #endif m->setCheckable(TRUE); if (!b) m->setItemChecked(m->idAt(0),TRUE); else m->setItemChecked(m->idAt(0),FALSE); 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 @@ -8,124 +8,126 @@ * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ #include "advancedfm.h" #include "inputDialog.h" #include "output.h" #include "filePermissions.h" #include <qpe/lnkproperties.h> #include <qpe/qpeapplication.h> #include <qpe/qpemenubar.h> #include <qpe/qpetoolbar.h> #include <qpe/resource.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/applnk.h> #include <qpe/ir.h> #include <qmessagebox.h> #include <qmultilineedit.h> #include <qstring.h> #include <qlayout.h> #include <qpixmap.h> #include <qcombobox.h> #include <qpopupmenu.h> #include <qtabwidget.h> #include <qtoolbutton.h> #include <qtabwidget.h> #include <qlineedit.h> #include <qlistview.h> #include <stdlib.h> #include <unistd.h> #include <sys/stat.h> #include <dirent.h> void AdvancedFm::doLocalCd() { localListClicked( Local_View->currentItem()); } void AdvancedFm::doRemoteCd() { localListClicked( Remote_View->currentItem()); } void AdvancedFm::showMenuHidden() { + if(TabWidget->currentPageIndex() == 0) showHidden(); - if(b) b= false; else b=true; + else showRemoteHidden(); +// if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true"); + if(b) b = false; else b = true; } void AdvancedFm::showHidden() { if (b) { currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); - b=FALSE; +// b=FALSE; } else { currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); - b=TRUE; +// b=TRUE; } populateLocalView(); - } void AdvancedFm::showRemoteHidden() { if (b) { currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); - b=TRUE; +// b=TRUE; } else { currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); - b=FALSE; +// b=FALSE; } populateRemoteView(); } void AdvancedFm::runThis() { QString fs; if (TabWidget->currentPageIndex() == 0) { QString curFile = Local_View->currentItem()->text(0); if(curFile != "../") { fs= getFileSystemType((const QString &) currentDir.canonicalPath()); QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); qDebug( fileInfo.owner()); if( (fileInfo.permission( QFileInfo::ExeUser) | fileInfo.permission( QFileInfo::ExeGroup) | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { QCopEnvelope e("QPE/System", "execute(QString)" ); e << curFile; } else { curFile = currentDir.canonicalPath()+"/"+curFile; DocLnk nf(curFile); QString execStr = nf.exec(); qDebug( execStr); if( execStr.isEmpty() ) { } else { nf.execute(); } } } } else { QString curFile = Remote_View->currentItem()->text(0); if(curFile != "../") { fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); qDebug("Filesystemtype is "+fs); QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); if( (fileInfo.permission( QFileInfo::ExeUser) | fileInfo.permission( QFileInfo::ExeGroup) | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { QCopEnvelope e("QPE/System", "execute(QString)" ); e << curFile; } else { curFile = currentRemoteDir.canonicalPath()+"/"+curFile; DocLnk nf(curFile); QString execStr = nf.exec(); qDebug(execStr); |