summaryrefslogtreecommitdiff
path: root/noncore/apps/advancedfm/advancedfmMenu.cpp
Unidiff
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
@@ -1,56 +1,59 @@
1/*************************************************************************** 1/***************************************************************************
2 AdvancedFm.cpp 2 AdvancedFm.cpp
3 ------------------- 3 -------------------
4 ** Created: Sat Mar 9 23:33:09 2002 4 ** Created: Sat Mar 9 23:33:09 2002
5 copyright : (C) 2002 by ljp 5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
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>
22using 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>
29#include <sys/stat.h> 35#include <sys/stat.h>
30#include <dirent.h> 36#include <dirent.h>
31#include <sys/sendfile.h> 37#include <sys/sendfile.h>
32#include <fcntl.h> 38#include <fcntl.h>
33 39
34
35using namespace Opie::Core;
36using namespace Opie::Core;
37void AdvancedFm::doDirChange() { 40void AdvancedFm::doDirChange() {
38 QString pathItem = CurrentView()->currentItem()->text(0); 41 QString pathItem = CurrentView()->currentItem()->text(0);
39 if( pathItem == "../") { 42 if( pathItem == "../") {
40 ListClicked( CurrentView()->currentItem()); 43 ListClicked( CurrentView()->currentItem());
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}
48 51
49void AdvancedFm::showMenuHidden() { 52void AdvancedFm::showMenuHidden() {
50 if (b) { 53 if (b) {
51 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 54 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
52 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 55 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
53 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 56 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
54 } else { 57 } else {
55 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 58 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
56 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 59 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
@@ -83,37 +86,37 @@ void AdvancedFm::runThis() {
83 86
84 QString curFile = CurrentView()->currentItem()->text(0); 87 QString curFile = CurrentView()->currentItem()->text(0);
85 QString path = thisDir->canonicalPath(); 88 QString path = thisDir->canonicalPath();
86 89
87 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink 90 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
88 91
89 curFile = dealWithSymName((const QString&)curFile); 92 curFile = dealWithSymName((const QString&)curFile);
90 93
91 if(curFile != "../") { 94 if(curFile != "../") {
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)
99 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { 102 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
100 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 103 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
101 QCopEnvelope e("QPE/System", "execute(QString)" ); 104 QCopEnvelope e("QPE/System", "execute(QString)" );
102 e << curFile; 105 e << curFile;
103 } else { 106 } else {
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();
111 } 114 }
112 } 115 }
113 } 116 }
114} 117}
115 118
116void AdvancedFm::runText() { 119void AdvancedFm::runText() {
117 if( !CurrentView()->currentItem()) return; 120 if( !CurrentView()->currentItem()) return;
118 QString curFile = CurrentView()->currentItem()->text(0); 121 QString curFile = CurrentView()->currentItem()->text(0);
119 if(curFile != "../") { 122 if(curFile != "../") {
@@ -193,30 +196,30 @@ void AdvancedFm::doDelete() {
193 tr("Really delete\n%1?").arg( myFile ), 196 tr("Really delete\n%1?").arg( myFile ),
194 tr("Yes"), tr("No"), 0, 0, 1) ) { 197 tr("Yes"), tr("No"), 0, 0, 1) ) {
195 case 1: 198 case 1:
196 return; 199 return;
197 break; 200 break;
198 }; 201 };
199 } 202 }
200 203
201 QString cmd="rm "+f; 204 QString cmd="rm "+f;
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;
214 file.remove(); 217 file.remove();
215 } 218 }
216 } 219 }
217 } 220 }
218 } 221 }
219 populateView(); 222 populateView();
220} 223}
221 224
222void AdvancedFm::filePerms() { 225void AdvancedFm::filePerms() {
@@ -234,28 +237,28 @@ void AdvancedFm::filePerms() {
234 } 237 }
235 populateView(); 238 populateView();
236} 239}
237 240
238void AdvancedFm::doProperties() { 241void AdvancedFm::doProperties() {
239#if defined(QT_QWS_OPIE) 242#if defined(QT_QWS_OPIE)
240 243
241 QStringList curFileList = getPath(); 244 QStringList curFileList = getPath();
242 245
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 );
253 } 256 }
254#endif 257#endif
255 258
256} 259}
257 260
258void AdvancedFm::upDir() { 261void AdvancedFm::upDir() {
259 QDir *thisDir = CurrentDir(); 262 QDir *thisDir = CurrentDir();
260 QString current = thisDir->canonicalPath(); 263 QString current = thisDir->canonicalPath();
261 QDir dir(current); 264 QDir dir(current);
@@ -293,26 +296,26 @@ void AdvancedFm::copy() {
293 }; 296 };
294 } 297 }
295 298
296 QString curFile, item, destFile; 299 QString curFile, item, destFile;
297 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 300 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
298 item=(*it); 301 item=(*it);
299 if(item.find("->",0,TRUE)) //symlink 302 if(item.find("->",0,TRUE)) //symlink
300 item = item.left(item.find("->",0,TRUE)); 303 item = item.left(item.find("->",0,TRUE));
301 304
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()) {
310 if(doMsg) { 313 if(doMsg) {
311 switch ( QMessageBox::warning(this,tr("File Exists!"), 314 switch ( QMessageBox::warning(this,tr("File Exists!"),
312 tr("%1 exists. Ok to overwrite?").arg( item ), 315 tr("%1 exists. Ok to overwrite?").arg( item ),
313 tr("Yes"),tr("No"),0,0,1) ) { 316 tr("Yes"),tr("No"),0,0,1) ) {
314 case 1: 317 case 1:
315 return; 318 return;
316 break; 319 break;
317 }; 320 };
318 } 321 }
@@ -411,54 +414,54 @@ void AdvancedFm::copySameDir() {
411 break; 414 break;
412 case 1: 415 case 1:
413 return; 416 return;
414 break; 417 break;
415 }; 418 };
416 } 419 }
417 if(!copyFile( curFile,destFile) ) { 420 if(!copyFile( curFile,destFile) ) {
418 QMessageBox::message("AdvancedFm",tr("Could not copy\n") 421 QMessageBox::message("AdvancedFm",tr("Could not copy\n")
419 +curFile +tr("to\n")+destFile); 422 +curFile +tr("to\n")+destFile);
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 }
427 rePopulate(); 430 rePopulate();
428} 431}
429 432
430void AdvancedFm::move() { 433void AdvancedFm::move() {
431 qApp->processEvents(); 434 qApp->processEvents();
432 435
433 QStringList curFileList = getPath(); 436 QStringList curFileList = getPath();
434 if( curFileList.count() > 0) { 437 if( curFileList.count() > 0) {
435 QString curFile, destFile, item; 438 QString curFile, destFile, item;
436 439
437 QDir *thisDir = CurrentDir(); 440 QDir *thisDir = CurrentDir();
438 QDir *thatDir = OtherDir(); 441 QDir *thatDir = OtherDir();
439 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 442 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
440 item=(*it); 443 item=(*it);
441 QString destFile = thatDir->canonicalPath(); 444 QString destFile = thatDir->canonicalPath();
442 445
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 );
456 rePopulate(); 459 rePopulate();
457 return; 460 return;
458 } 461 }
459 462
460 QFile f( curFile); 463 QFile f( curFile);
461 if( f.exists()) { 464 if( f.exists()) {
462 if( !copyFile( curFile, destFile) ) { 465 if( !copyFile( curFile, destFile) ) {
463 QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); 466 QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile);
464 return; 467 return;
@@ -480,25 +483,25 @@ bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) {
480 err = -1; 483 err = -1;
481 484
482 if(err!=0) { 485 if(err!=0) {
483 QMessageBox::message(tr("Note"),tr("Could not move\n") + src); 486 QMessageBox::message(tr("Note"),tr("Could not move\n") + src);
484 return false; 487 return false;
485 } 488 }
486 return true; 489 return true;
487} 490}
488 491
489bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) { 492bool 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",
496 tr( "Could not copy \n%1 \nto \n%2").arg( src ).arg( dest ) ); 499 tr( "Could not copy \n%1 \nto \n%2").arg( src ).arg( dest ) );
497 return false; 500 return false;
498 } 501 }
499 502
500 return true; 503 return true;
501} 504}
502 505
503 506
504bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { 507bool AdvancedFm::copyFile( const QString & src, const QString & dest ) {
@@ -516,47 +519,47 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) {
516 519
517 520
518 bool success = true; 521 bool success = true;
519 struct stat status; 522 struct stat status;
520 QFile srcFile(src); 523 QFile srcFile(src);
521 QFile destFile(dest); 524 QFile destFile(dest);
522 int err=0; 525 int err=0;
523 int read_fd=0; 526 int read_fd=0;
524 int write_fd=0; 527 int write_fd=0;
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();
539 if(write_fd != -1) { 542 if(write_fd != -1) {
540 err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); 543 err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size);
541 if( err == -1) { 544 if( err == -1) {
542 QString msg; 545 QString msg;
543 switch(err) { 546 switch(err) {
544 case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; 547 case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. ";
545 case EINVAL: msg = "Descriptor is not valid or locked. "; 548 case EINVAL: msg = "Descriptor is not valid or locked. ";
546 case ENOMEM: msg = "Insufficient memory to read from in_fd."; 549 case ENOMEM: msg = "Insufficient memory to read from in_fd.";
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;
554 } 557 }
555 } else { 558 } else {
556 success = false; 559 success = false;
557 } 560 }
558 srcFile.close(); 561 srcFile.close();
559 destFile.close(); 562 destFile.close();
560 // Set file permissions 563 // Set file permissions
561 if( stat( (const char *) src, &status ) == 0 ) { 564 if( stat( (const char *) src, &status ) == 0 ) {
562 chmod( (const char *) dest, status.st_mode ); 565 chmod( (const char *) dest, status.st_mode );
@@ -570,25 +573,25 @@ void AdvancedFm::runCommand() {
570 QDir *thisDir = CurrentDir(); 573 QDir *thisDir = CurrentDir();
571 574
572 QString curFile; 575 QString curFile;
573 curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0); 576 curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0);
574 577
575 InputDialog *fileDlg; 578 InputDialog *fileDlg;
576 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 579 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
577 fileDlg->setInputText(curFile); 580 fileDlg->setInputText(curFile);
578 fileDlg->exec(); 581 fileDlg->exec();
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";
586 command << "-c"; 589 command << "-c";
587 command << fileDlg->LineEdit1->text(); 590 command << fileDlg->LineEdit1->text();
588 Output *outDlg; 591 Output *outDlg;
589 outDlg = new Output( command, this, tr("AdvancedFm Output"), true); 592 outDlg = new Output( command, this, tr("AdvancedFm Output"), true);
590 QPEApplication::execDialog( outDlg ); 593 QPEApplication::execDialog( outDlg );
591 qApp->processEvents(); 594 qApp->processEvents();
592 595
593 } 596 }
594} 597}
@@ -653,25 +656,25 @@ void AdvancedFm::mkSym() {
653 QString destName = thatDir->canonicalPath()+"/"+(*it); 656 QString destName = thatDir->canonicalPath()+"/"+(*it);
654 if(destName.right(1) == "/") { 657 if(destName.right(1) == "/") {
655 destName = destName.left( destName.length() -1); 658 destName = destName.left( destName.length() -1);
656 } 659 }
657 660
658 QString curFile = thisDir->canonicalPath()+"/"+(*it); 661 QString curFile = thisDir->canonicalPath()+"/"+(*it);
659 662
660 if( curFile.right(1) == "/") { 663 if( curFile.right(1) == "/") {
661 curFile = curFile.left( curFile.length() -1); 664 curFile = curFile.left( curFile.length() -1);
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();
669 setOtherTabCurrent(); 672 setOtherTabCurrent();
670 } 673 }
671} 674}
672 675
673void AdvancedFm::doBeam() { 676void AdvancedFm::doBeam() {
674 Ir ir; 677 Ir ir;
675 if(!ir.supported()) { 678 if(!ir.supported()) {
676 } else { 679 } else {
677 QStringList curFileList = getPath(); 680 QStringList curFileList = getPath();
@@ -706,33 +709,33 @@ void AdvancedFm::startProcess(const QString & cmd) {
706 process = new OProcess(); 709 process = new OProcess();
707 connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), 710 connect(process, SIGNAL(processExited(Opie::Core::OProcess*)),
708 this, SLOT( processEnded(Opie::Core::OProcess*))); 711 this, SLOT( processEnded(Opie::Core::OProcess*)));
709 712
710 connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), 713 connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)),
711 this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); 714 this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int)));
712 715
713 command << "/bin/sh"; 716 command << "/bin/sh";
714 command << "-c"; 717 command << "-c";
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
721void AdvancedFm::processEnded(OProcess *) { 724void AdvancedFm::processEnded(OProcess *) {
722 rePopulate(); 725 rePopulate();
723} 726}
724 727
725void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { 728void 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") );
730} 733}
731 734
732bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { 735bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) {
733 if ( o->inherits( "QLineEdit" ) ) { 736 if ( o->inherits( "QLineEdit" ) ) {
734 if ( e->type() == QEvent::KeyPress ) { 737 if ( e->type() == QEvent::KeyPress ) {
735 QKeyEvent *ke = (QKeyEvent*)e; 738 QKeyEvent *ke = (QKeyEvent*)e;
736 if ( ke->key() == Key_Return || 739 if ( ke->key() == Key_Return ||
737 ke->key() == Key_Enter ) { 740 ke->key() == Key_Enter ) {
738 okRename(); 741 okRename();
@@ -756,25 +759,25 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) {
756 else { 759 else {
757 whichTab=2; 760 whichTab=2;
758 } 761 }
759 } 762 }
760 OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection 763 OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection
761 } 764 }
762 765
763 return QWidget::eventFilter( o, e ); 766 return QWidget::eventFilter( o, e );
764} 767}
765 768
766 769
767void AdvancedFm::cancelRename() { 770void 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
772 bool resetFocus = view->viewport()->focusProxy() == renameBox; 775 bool resetFocus = view->viewport()->focusProxy() == renameBox;
773 delete renameBox; 776 delete renameBox;
774 renameBox = 0; 777 renameBox = 0;
775 if ( resetFocus ) { 778 if ( resetFocus ) {
776 view->viewport()->setFocusProxy( view); 779 view->viewport()->setFocusProxy( view);
777 view->setFocus(); 780 view->setFocus();
778 } 781 }
779} 782}
780 783