Diffstat (limited to 'noncore/apps/advancedfm/advancedfmMenu.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 55 |
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 | |||
@@ -9,20 +9,26 @@ | |||
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | |||
12 | #include "advancedfm.h" | 13 | #include "advancedfm.h" |
13 | #include "output.h" | 14 | #include "output.h" |
14 | #include "filePermissions.h" | 15 | #include "filePermissions.h" |
15 | 16 | ||
17 | /* OPIE */ | ||
18 | #include <opie2/odebug.h> | ||
16 | #include <qpe/lnkproperties.h> | 19 | #include <qpe/lnkproperties.h> |
17 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
18 | #include <qpe/applnk.h> | 21 | #include <qpe/applnk.h> |
22 | using namespace Opie::Core; | ||
19 | 23 | ||
20 | #include <qmessagebox.h> | 24 | /* QT*/ |
21 | |||
22 | 25 | ||
26 | #include <qmessagebox.h> | ||
23 | #include <qpopupmenu.h> | 27 | #include <qpopupmenu.h> |
24 | #include <qlistview.h> | 28 | #include <qlistview.h> |
25 | 29 | ||
30 | /* STD */ | ||
31 | |||
26 | #include <errno.h> | 32 | #include <errno.h> |
27 | #include <stdlib.h> | 33 | #include <stdlib.h> |
28 | #include <unistd.h> | 34 | #include <unistd.h> |
@@ -31,9 +37,6 @@ | |||
31 | #include <sys/sendfile.h> | 37 | #include <sys/sendfile.h> |
32 | #include <fcntl.h> | 38 | #include <fcntl.h> |
33 | 39 | ||
34 | |||
35 | using namespace Opie::Core; | ||
36 | using namespace Opie::Core; | ||
37 | void AdvancedFm::doDirChange() { | 40 | void AdvancedFm::doDirChange() { |
38 | QString pathItem = CurrentView()->currentItem()->text(0); | 41 | QString pathItem = CurrentView()->currentItem()->text(0); |
39 | if( pathItem == "../") { | 42 | if( pathItem == "../") { |
@@ -41,7 +44,7 @@ void AdvancedFm::doDirChange() { | |||
41 | } else { | 44 | } else { |
42 | if( pathItem.find(" -> ",0,TRUE) != -1) | 45 | if( pathItem.find(" -> ",0,TRUE) != -1) |
43 | pathItem = dealWithSymName((const QString&)pathItem)+"/"; | 46 | pathItem = dealWithSymName((const QString&)pathItem)+"/"; |
44 | // qWarning(pathItem); | 47 | // owarn << pathItem << oendl; |
45 | gotoDirectory( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) ); | 48 | gotoDirectory( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) ); |
46 | } | 49 | } |
47 | } | 50 | } |
@@ -92,7 +95,7 @@ void AdvancedFm::runThis() { | |||
92 | 95 | ||
93 | fs = getFileSystemType((const QString &) path); | 96 | fs = getFileSystemType((const QString &) path); |
94 | QFileInfo fileInfo( path + "/" + curFile); | 97 | QFileInfo fileInfo( path + "/" + curFile); |
95 | // qDebug( fileInfo.owner()); | 98 | // odebug << fileInfo.owner() << oendl; |
96 | 99 | ||
97 | if( (fileInfo.permission( QFileInfo::ExeUser) | 100 | if( (fileInfo.permission( QFileInfo::ExeUser) |
98 | | fileInfo.permission( QFileInfo::ExeGroup) | 101 | | fileInfo.permission( QFileInfo::ExeGroup) |
@@ -104,7 +107,7 @@ void AdvancedFm::runThis() { | |||
104 | curFile = path + "/" + curFile; | 107 | curFile = path + "/" + curFile; |
105 | DocLnk nf(curFile); | 108 | DocLnk nf(curFile); |
106 | QString execStr = nf.exec(); | 109 | QString execStr = nf.exec(); |
107 | // qDebug( execStr); | 110 | // odebug << execStr << oendl; |
108 | if( execStr.isEmpty() ) { | 111 | if( execStr.isEmpty() ) { |
109 | } else { | 112 | } else { |
110 | nf.execute(); | 113 | nf.execute(); |
@@ -202,12 +205,12 @@ void AdvancedFm::doDelete() { | |||
202 | QFile file(f); | 205 | QFile file(f); |
203 | QFileInfo fi(myFile); | 206 | QFileInfo fi(myFile); |
204 | if( fi.fileName().find("../",0,TRUE)==-1) { | 207 | if( fi.fileName().find("../",0,TRUE)==-1) { |
205 | // qDebug("remove link files "+myFile); | 208 | // odebug << "remove link files "+myFile << oendl; |
206 | 209 | ||
207 | // DocLnk lnk(f); | 210 | // DocLnk lnk(f); |
208 | DocLnk *lnk; | 211 | DocLnk *lnk; |
209 | lnk = new DocLnk(f); | 212 | lnk = new DocLnk(f); |
210 | // qDebug("Deleting doclnk " + lnk->linkFile()); | 213 | // odebug << "Deleting doclnk " + lnk->linkFile() << oendl; |
211 | if(lnk->isValid()) | 214 | if(lnk->isValid()) |
212 | lnk->removeLinkFile(); | 215 | lnk->removeLinkFile(); |
213 | // delete lnk; | 216 | // delete lnk; |
@@ -243,10 +246,10 @@ void AdvancedFm::doProperties() { | |||
243 | QString filePath; | 246 | QString filePath; |
244 | filePath = CurrentDir()->canonicalPath()+"/"; | 247 | filePath = CurrentDir()->canonicalPath()+"/"; |
245 | 248 | ||
246 | // qDebug("%d",curFileList.count()); | 249 | // odebug << "" << curFileList.count() << "" << oendl; |
247 | 250 | ||
248 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 251 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
249 | // qDebug((filePath+*it)); | 252 | // odebug << (filePath+*it) << oendl; |
250 | DocLnk lnk( (filePath+*it)); | 253 | DocLnk lnk( (filePath+*it)); |
251 | LnkProperties prop( &lnk ); | 254 | LnkProperties prop( &lnk ); |
252 | QPEApplication::execDialog( &prop ); | 255 | QPEApplication::execDialog( &prop ); |
@@ -302,8 +305,8 @@ void AdvancedFm::copy() { | |||
302 | curFile = thisDir->canonicalPath()+"/"+ item; | 305 | curFile = thisDir->canonicalPath()+"/"+ item; |
303 | destFile = thatDir->canonicalPath()+"/"+ item; | 306 | destFile = thatDir->canonicalPath()+"/"+ item; |
304 | 307 | ||
305 | // qDebug("Destination file is "+destFile); | 308 | // odebug << "Destination file is "+destFile << oendl; |
306 | // qDebug("CurrentFile file is " + curFile); | 309 | // odebug << "CurrentFile file is " + curFile << oendl; |
307 | 310 | ||
308 | QFile f(destFile); | 311 | QFile f(destFile); |
309 | if( f.exists()) { | 312 | if( f.exists()) { |
@@ -420,7 +423,7 @@ void AdvancedFm::copySameDir() { | |||
420 | return; | 423 | return; |
421 | } | 424 | } |
422 | 425 | ||
423 | // qDebug("copy "+curFile+" as "+destFile); | 426 | // odebug << "copy "+curFile+" as "+destFile << oendl; |
424 | } | 427 | } |
425 | delete fileDlg; | 428 | delete fileDlg; |
426 | } | 429 | } |
@@ -443,13 +446,13 @@ void AdvancedFm::move() { | |||
443 | if(destFile.right(1).find("/",0,TRUE) == -1) | 446 | if(destFile.right(1).find("/",0,TRUE) == -1) |
444 | destFile+="/"; | 447 | destFile+="/"; |
445 | destFile += item; | 448 | destFile += item; |
446 | // qDebug("Destination file is "+destFile); | 449 | // odebug << "Destination file is "+destFile << oendl; |
447 | 450 | ||
448 | curFile = thisDir->canonicalPath(); | 451 | curFile = thisDir->canonicalPath(); |
449 | if(curFile.right(1).find("/",0,TRUE) == -1) | 452 | if(curFile.right(1).find("/",0,TRUE) == -1) |
450 | curFile +="/"; | 453 | curFile +="/"; |
451 | curFile+= item; | 454 | curFile+= item; |
452 | // qDebug("CurrentFile file is " + curFile); | 455 | // odebug << "CurrentFile file is " + curFile << oendl; |
453 | 456 | ||
454 | if(QFileInfo(curFile).isDir()) { | 457 | if(QFileInfo(curFile).isDir()) { |
455 | moveDirectory( curFile, destFile ); | 458 | moveDirectory( curFile, destFile ); |
@@ -489,7 +492,7 @@ bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) { | |||
489 | bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) { | 492 | bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) { |
490 | 493 | ||
491 | QString cmd = "/bin/cp -fpR " + src + " " + dest; | 494 | QString cmd = "/bin/cp -fpR " + src + " " + dest; |
492 | qWarning(cmd); | 495 | owarn << cmd << oendl; |
493 | int err = system( (const char *) cmd ); | 496 | int err = system( (const char *) cmd ); |
494 | if ( err != 0 ) { | 497 | if ( err != 0 ) { |
495 | QMessageBox::message("AdvancedFm", | 498 | QMessageBox::message("AdvancedFm", |
@@ -525,14 +528,14 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { | |||
525 | struct stat stat_buf; | 528 | struct stat stat_buf; |
526 | off_t offset = 0; | 529 | off_t offset = 0; |
527 | if(!srcFile.open( IO_ReadOnly|IO_Raw)) { | 530 | if(!srcFile.open( IO_ReadOnly|IO_Raw)) { |
528 | // qWarning("open failed"); | 531 | // owarn << "open failed" << oendl; |
529 | return success = false; | 532 | return success = false; |
530 | } | 533 | } |
531 | read_fd = srcFile.handle(); | 534 | read_fd = srcFile.handle(); |
532 | if(read_fd != -1) { | 535 | if(read_fd != -1) { |
533 | fstat (read_fd, &stat_buf); | 536 | fstat (read_fd, &stat_buf); |
534 | if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { | 537 | if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { |
535 | // qWarning("destfile open failed"); | 538 | // owarn << "destfile open failed" << oendl; |
536 | return success = false; | 539 | return success = false; |
537 | } | 540 | } |
538 | write_fd = destFile.handle(); | 541 | write_fd = destFile.handle(); |
@@ -547,7 +550,7 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { | |||
547 | case EIO: msg = "Unspecified error while reading from in_fd."; | 550 | case EIO: msg = "Unspecified error while reading from in_fd."; |
548 | }; | 551 | }; |
549 | success = false; | 552 | success = false; |
550 | // qWarning(msg); | 553 | // owarn << msg << oendl; |
551 | } | 554 | } |
552 | } else { | 555 | } else { |
553 | success = false; | 556 | success = false; |
@@ -579,7 +582,7 @@ void AdvancedFm::runCommand() { | |||
579 | //QString command; | 582 | //QString command; |
580 | 583 | ||
581 | if( fileDlg->result() == 1 ) { | 584 | if( fileDlg->result() == 1 ) { |
582 | // qDebug(fileDlg->LineEdit1->text()); | 585 | // odebug << fileDlg->LineEdit1->text() << oendl; |
583 | QStringList command; | 586 | QStringList command; |
584 | 587 | ||
585 | command << "/bin/sh"; | 588 | command << "/bin/sh"; |
@@ -662,7 +665,7 @@ void AdvancedFm::mkSym() { | |||
662 | } | 665 | } |
663 | 666 | ||
664 | cmd = "ln -s "+curFile+" "+destName; | 667 | cmd = "ln -s "+curFile+" "+destName; |
665 | // qDebug(cmd); | 668 | // odebug << cmd << oendl; |
666 | startProcess( (const QString)cmd ); | 669 | startProcess( (const QString)cmd ); |
667 | } | 670 | } |
668 | rePopulate(); | 671 | rePopulate(); |
@@ -715,7 +718,7 @@ void AdvancedFm::startProcess(const QString & cmd) { | |||
715 | command << cmd.latin1(); | 718 | command << cmd.latin1(); |
716 | *process << command; | 719 | *process << command; |
717 | if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) | 720 | if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) |
718 | qDebug("could not start process"); | 721 | odebug << "could not start process" << oendl; |
719 | } | 722 | } |
720 | 723 | ||
721 | void AdvancedFm::processEnded(OProcess *) { | 724 | void AdvancedFm::processEnded(OProcess *) { |
@@ -723,7 +726,7 @@ void AdvancedFm::processEnded(OProcess *) { | |||
723 | } | 726 | } |
724 | 727 | ||
725 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { | 728 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { |
726 | // qWarning("received stderrt %d bytes", buflen); | 729 | // owarn << "received stderrt " << buflen << " bytes" << oendl; |
727 | 730 | ||
728 | QString lineStr = buffer; | 731 | QString lineStr = buffer; |
729 | QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); | 732 | QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); |
@@ -765,7 +768,7 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { | |||
765 | 768 | ||
766 | 769 | ||
767 | void AdvancedFm::cancelRename() { | 770 | void AdvancedFm::cancelRename() { |
768 | // qDebug("cancel rename"); | 771 | // odebug << "cancel rename" << oendl; |
769 | QListView * view; | 772 | QListView * view; |
770 | view = CurrentView(); | 773 | view = CurrentView(); |
771 | 774 | ||