author | llornkcor <llornkcor> | 2002-05-02 02:09:49 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-05-02 02:09:49 (UTC) |
commit | 6dfc6f34420b8c9222d1c785efc950fc5031a7f0 (patch) (side-by-side diff) | |
tree | a144e5e4c2be3e57d0939090ee5a39982f17804d | |
parent | 45ba3b844e3fb8d9b9e1936ad2abec869d25dd33 (diff) | |
download | opie-6dfc6f34420b8c9222d1c785efc950fc5031a7f0.zip opie-6dfc6f34420b8c9222d1c785efc950fc5031a7f0.tar.gz opie-6dfc6f34420b8c9222d1c785efc950fc5031a7f0.tar.bz2 |
damned QFileInfo::isExecutable bug...
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index e3ab76b..7cd8644 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp @@ -637,212 +637,219 @@ void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint }; } void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) { switch (mouse) { case 1: break; case 2: showRemoteMenu(item); Remote_View->clearSelection(); break; }; } void AdvancedFm::showLocalMenu(QListViewItem * item) { if(item) { QPopupMenu m; m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); m.insertSeparator(); if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); else m.insertItem( tr( "Open" ), this, SLOT( runThis() )); m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); m.insertSeparator(); m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); m.insertItem( tr( "Copy" ), this, SLOT( copy() )); m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); m.insertItem( tr( "Move" ), this, SLOT( move() )); m.insertSeparator(); m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); m.insertSeparator(); m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); m.insertSeparator(); m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); m.setCheckable(TRUE); if (!b) m.setItemChecked(m.idAt(0),TRUE); else m.setItemChecked(m.idAt(0),FALSE); m.exec( QCursor::pos() ); } } void AdvancedFm::showRemoteMenu(QListViewItem * item) { if(item) { QPopupMenu m; m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); m.insertSeparator(); if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); else m.insertItem( tr( "Open" ), this, SLOT( runThis() )); m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); m.insertSeparator(); m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); m.insertItem( tr( "Copy" ), this, SLOT( copy() )); m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); m.insertItem( tr( "Move" ), this, SLOT( move() )); m.insertSeparator(); m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); m.insertSeparator(); m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); m.insertSeparator(); m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); m.setCheckable(TRUE); if (!b) m.setItemChecked(m.idAt(0),TRUE); else m.setItemChecked(m.idAt(0),FALSE); m.exec( QCursor::pos() ); } } void AdvancedFm::runThis() { // QFileInfo *fi; QString fs; if (TabWidget->currentPageIndex() == 0) { QString curFile = Local_View->currentItem()->text(0); fs= getFileSystemType((const QString &) currentDir.canonicalPath()); QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); qDebug( fileInfo.owner()); - if( fileInfo.isExecutable() || fs == "vfat" && fileInfo.filePath().contains("/bin") ) { - QCopEnvelope e("QPE/System", "execute(QString)" ); - e << 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") ) { +// if( fileInfo.isExecutable() | + 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(); } } // MimeType mt( curFile); } else { QString curFile = Remote_View->currentItem()->text(0); fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); qDebug("Filesystemtype is "+fs); QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); - if(fileInfo.isExecutable() || fs == "vfat" && fileInfo.filePath().contains("/bin") ) { + 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); if( execStr.isEmpty() ) { } else { nf.execute(); } } // MimeType mt( curFile); } } void AdvancedFm::runText() { if (TabWidget->currentPageIndex() == 0) { QString curFile = Local_View->currentItem()->text(0); curFile = currentDir.canonicalPath()+"/"+curFile; QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); e << curFile; } else { QString curFile = Remote_View->currentItem()->text(0); curFile = currentRemoteDir.canonicalPath()+"/"+curFile; DocLnk nf(curFile); QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); e << curFile; } } void AdvancedFm::localMakDir() { InputDialog *fileDlg; fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); fileDlg->exec(); if( fileDlg->result() == 1 ) { QString filename = fileDlg->LineEdit1->text(); currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); } populateLocalView(); } void AdvancedFm::remoteMakDir() { InputDialog *fileDlg; fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); fileDlg->exec(); if( fileDlg->result() == 1 ) { QString filename = fileDlg->LineEdit1->text(); currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); } populateRemoteView(); } void AdvancedFm::localDelete() { QStringList curFileList = getPath(); QString myFile; for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { myFile = (*it); if( myFile.find(" -> ",0,TRUE) != -1) myFile = myFile.left( myFile.find(" -> ",0,TRUE)); QString f = currentDir.canonicalPath(); if(f.right(1).find("/",0,TRUE) == -1) f+="/"; f+=myFile; if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ "\nand all it's contents ?" ,tr("Yes"),tr("No"),0,0,1) ) { case 0: { f=f.left(f.length()-1); QString cmd="rm -rf "+f; system( cmd.latin1()); populateLocalView(); } break; case 1: // exit break; }; } else { switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f +" ?",tr("Yes"),tr("No"),0,0,1) ) { case 0: { QString cmd="rm "+f; QFile file(f); file.remove(); // system( cmd.latin1()); populateLocalView(); } break; case 1: |