summaryrefslogtreecommitdiff
path: root/noncore/apps/advancedfm/advancedfmMenu.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/advancedfm/advancedfmMenu.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp55
1 files changed, 29 insertions, 26 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 81a4318..d34f330 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -6,45 +6,48 @@
email : ljp@llornkcor.com
* This program is free software; you can redistribute it and/or modify *
* 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 "output.h"
#include "filePermissions.h"
+/* OPIE */
+#include <opie2/odebug.h>
#include <qpe/lnkproperties.h>
#include <qpe/qpeapplication.h>
#include <qpe/applnk.h>
+using namespace Opie::Core;
-#include <qmessagebox.h>
-
+/* QT*/
+#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qlistview.h>
+/* STD */
+
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <dirent.h>
#include <sys/sendfile.h>
#include <fcntl.h>
-
-using namespace Opie::Core;
-using namespace Opie::Core;
void AdvancedFm::doDirChange() {
QString pathItem = CurrentView()->currentItem()->text(0);
if( pathItem == "../") {
ListClicked( CurrentView()->currentItem());
} else {
if( pathItem.find(" -> ",0,TRUE) != -1)
pathItem = dealWithSymName((const QString&)pathItem)+"/";
-// qWarning(pathItem);
+// owarn << pathItem << oendl;
gotoDirectory( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) );
}
}
void AdvancedFm::showMenuHidden() {
if (b) {
@@ -89,25 +92,25 @@ void AdvancedFm::runThis() {
curFile = dealWithSymName((const QString&)curFile);
if(curFile != "../") {
fs = getFileSystemType((const QString &) path);
QFileInfo fileInfo( path + "/" + curFile);
-// qDebug( fileInfo.owner());
+// odebug << fileInfo.owner() << oendl;
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 = path + "/" + curFile;
DocLnk nf(curFile);
QString execStr = nf.exec();
-// qDebug( execStr);
+// odebug << execStr << oendl;
if( execStr.isEmpty() ) {
} else {
nf.execute();
}
}
}
@@ -199,18 +202,18 @@ void AdvancedFm::doDelete() {
}
QString cmd="rm "+f;
QFile file(f);
QFileInfo fi(myFile);
if( fi.fileName().find("../",0,TRUE)==-1) {
-// qDebug("remove link files "+myFile);
+// odebug << "remove link files "+myFile << oendl;
// DocLnk lnk(f);
DocLnk *lnk;
lnk = new DocLnk(f);
-// qDebug("Deleting doclnk " + lnk->linkFile());
+// odebug << "Deleting doclnk " + lnk->linkFile() << oendl;
if(lnk->isValid())
lnk->removeLinkFile();
// delete lnk;
file.remove();
}
}
@@ -240,16 +243,16 @@ void AdvancedFm::doProperties() {
QStringList curFileList = getPath();
QString filePath;
filePath = CurrentDir()->canonicalPath()+"/";
-// qDebug("%d",curFileList.count());
+// odebug << "" << curFileList.count() << "" << oendl;
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
-// qDebug((filePath+*it));
+// odebug << (filePath+*it) << oendl;
DocLnk lnk( (filePath+*it));
LnkProperties prop( &lnk );
QPEApplication::execDialog( &prop );
}
#endif
@@ -299,14 +302,14 @@ void AdvancedFm::copy() {
if(item.find("->",0,TRUE)) //symlink
item = item.left(item.find("->",0,TRUE));
curFile = thisDir->canonicalPath()+"/"+ item;
destFile = thatDir->canonicalPath()+"/"+ item;
-// qDebug("Destination file is "+destFile);
-// qDebug("CurrentFile file is " + curFile);
+// odebug << "Destination file is "+destFile << oendl;
+// odebug << "CurrentFile file is " + curFile << oendl;
QFile f(destFile);
if( f.exists()) {
if(doMsg) {
switch ( QMessageBox::warning(this,tr("File Exists!"),
tr("%1 exists. Ok to overwrite?").arg( item ),
@@ -417,13 +420,13 @@ void AdvancedFm::copySameDir() {
if(!copyFile( curFile,destFile) ) {
QMessageBox::message("AdvancedFm",tr("Could not copy\n")
+curFile +tr("to\n")+destFile);
return;
}
-// qDebug("copy "+curFile+" as "+destFile);
+// odebug << "copy "+curFile+" as "+destFile << oendl;
}
delete fileDlg;
}
rePopulate();
}
@@ -440,19 +443,19 @@ void AdvancedFm::move() {
item=(*it);
QString destFile = thatDir->canonicalPath();
if(destFile.right(1).find("/",0,TRUE) == -1)
destFile+="/";
destFile += item;
-// qDebug("Destination file is "+destFile);
+// odebug << "Destination file is "+destFile << oendl;
curFile = thisDir->canonicalPath();
if(curFile.right(1).find("/",0,TRUE) == -1)
curFile +="/";
curFile+= item;
-// qDebug("CurrentFile file is " + curFile);
+// odebug << "CurrentFile file is " + curFile << oendl;
if(QFileInfo(curFile).isDir()) {
moveDirectory( curFile, destFile );
rePopulate();
return;
}
@@ -486,13 +489,13 @@ bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) {
return true;
}
bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) {
QString cmd = "/bin/cp -fpR " + src + " " + dest;
- qWarning(cmd);
+ owarn << cmd << oendl;
int err = system( (const char *) cmd );
if ( err != 0 ) {
QMessageBox::message("AdvancedFm",
tr( "Could not copy \n%1 \nto \n%2").arg( src ).arg( dest ) );
return false;
}
@@ -522,20 +525,20 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) {
int err=0;
int read_fd=0;
int write_fd=0;
struct stat stat_buf;
off_t offset = 0;
if(!srcFile.open( IO_ReadOnly|IO_Raw)) {
-// qWarning("open failed");
+// owarn << "open failed" << oendl;
return success = false;
}
read_fd = srcFile.handle();
if(read_fd != -1) {
fstat (read_fd, &stat_buf);
if( !destFile.open( IO_WriteOnly|IO_Raw ) ) {
-// qWarning("destfile open failed");
+// owarn << "destfile open failed" << oendl;
return success = false;
}
write_fd = destFile.handle();
if(write_fd != -1) {
err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size);
if( err == -1) {
@@ -544,13 +547,13 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) {
case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. ";
case EINVAL: msg = "Descriptor is not valid or locked. ";
case ENOMEM: msg = "Insufficient memory to read from in_fd.";
case EIO: msg = "Unspecified error while reading from in_fd.";
};
success = false;
-// qWarning(msg);
+// owarn << msg << oendl;
}
} else {
success = false;
}
} else {
success = false;
@@ -576,13 +579,13 @@ void AdvancedFm::runCommand() {
fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
fileDlg->setInputText(curFile);
fileDlg->exec();
//QString command;
if( fileDlg->result() == 1 ) {
-// qDebug(fileDlg->LineEdit1->text());
+// odebug << fileDlg->LineEdit1->text() << oendl;
QStringList command;
command << "/bin/sh";
command << "-c";
command << fileDlg->LineEdit1->text();
Output *outDlg;
@@ -659,13 +662,13 @@ void AdvancedFm::mkSym() {
if( curFile.right(1) == "/") {
curFile = curFile.left( curFile.length() -1);
}
cmd = "ln -s "+curFile+" "+destName;
-// qDebug(cmd);
+// odebug << cmd << oendl;
startProcess( (const QString)cmd );
}
rePopulate();
setOtherTabCurrent();
}
}
@@ -712,21 +715,21 @@ void AdvancedFm::startProcess(const QString & cmd) {
command << "/bin/sh";
command << "-c";
command << cmd.latin1();
*process << command;
if(!process->start(OProcess::NotifyOnExit, OProcess::All) )
- qDebug("could not start process");
+ odebug << "could not start process" << oendl;
}
void AdvancedFm::processEnded(OProcess *) {
rePopulate();
}
void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) {
-// qWarning("received stderrt %d bytes", buflen);
+// owarn << "received stderrt " << buflen << " bytes" << oendl;
QString lineStr = buffer;
QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") );
}
bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) {
@@ -762,13 +765,13 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) {
return QWidget::eventFilter( o, e );
}
void AdvancedFm::cancelRename() {
-// qDebug("cancel rename");
+// odebug << "cancel rename" << oendl;
QListView * view;
view = CurrentView();
bool resetFocus = view->viewport()->focusProxy() == renameBox;
delete renameBox;
renameBox = 0;