author | llornkcor <llornkcor> | 2004-09-25 01:51:26 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-09-25 01:51:26 (UTC) |
commit | 40e681bf20db4f1e02212ae6e42a349ee000cf14 (patch) (unidiff) | |
tree | 86eea5377011775ff87ca50e1fd125ff8f30622f /noncore/apps/advancedfm/advancedfmMenu.cpp | |
parent | 0fe000754035c737ff0de97e5b2bd2cf03c16337 (diff) | |
download | opie-40e681bf20db4f1e02212ae6e42a349ee000cf14.zip opie-40e681bf20db4f1e02212ae6e42a349ee000cf14.tar.gz opie-40e681bf20db4f1e02212ae6e42a349ee000cf14.tar.bz2 |
fix stuff
Diffstat (limited to 'noncore/apps/advancedfm/advancedfmMenu.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 197 |
1 files changed, 98 insertions, 99 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 8d04c68..5a46579 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -273,5 +273,8 @@ void AdvancedFm::upDir() { | |||
273 | 273 | ||
274 | void AdvancedFm::copyTimer() { | ||
275 | QTimer::singleShot(125,this,SLOT(copy())); | ||
276 | } | ||
277 | |||
274 | void AdvancedFm::copy() { | 278 | void AdvancedFm::copy() { |
275 | qApp->processEvents(); | 279 | QStringList curFileList = getPath(); |
276 | QStringList curFileList = getPath(); | ||
277 | 280 | ||
@@ -314,4 +317,4 @@ void AdvancedFm::copy() { | |||
314 | switch ( QMessageBox::warning(this,tr("File Exists!"), | 317 | switch ( QMessageBox::warning(this,tr("File Exists!"), |
315 | tr("%1 exists. Ok to overwrite?").arg( item ), | 318 | tr("<p>%1 already exists. Ok to overwrite?</P>").arg(item), |
316 | tr("Yes"),tr("No"),0,0,1) ) { | 319 | tr("Yes"),tr("No"),0,0,1)) { |
317 | case 1: | 320 | case 1: |
@@ -326,3 +329,3 @@ void AdvancedFm::copy() { | |||
326 | QMessageBox::message("AdvancedFm", | 329 | QMessageBox::message("AdvancedFm", |
327 | tr( "Could not copy %1 to %2").arg( curFile ).arg( destFile ) ); | 330 | tr( "<P>Could not copy %1 to %2</P>").arg(curFile).arg(destFile)); |
328 | return; | 331 | return; |
@@ -330,4 +333,3 @@ void AdvancedFm::copy() { | |||
330 | } | 333 | } |
331 | setOtherTabCurrent(); | 334 | rePopulate(); |
332 | rePopulate(); | ||
333 | } | 335 | } |
@@ -335,2 +337,6 @@ void AdvancedFm::copy() { | |||
335 | 337 | ||
338 | void AdvancedFm::copyAsTimer() { | ||
339 | QTimer::singleShot(125,this,SLOT(copyAs())); | ||
340 | } | ||
341 | |||
336 | void AdvancedFm::copyAs() { | 342 | void AdvancedFm::copyAs() { |
@@ -348,3 +354,3 @@ void AdvancedFm::copyAs() { | |||
348 | curFile = thisDir->canonicalPath()+"/"+(*it); | 354 | curFile = thisDir->canonicalPath()+"/"+(*it); |
349 | fileDlg = new InputDialog( this, tr("Copy "+curFile+" As"), TRUE, 0); | 355 | fileDlg = new InputDialog( this, tr("Copy %1 As").arg(curFile), TRUE, 0); |
350 | 356 | ||
@@ -360,3 +366,3 @@ void AdvancedFm::copyAs() { | |||
360 | switch (QMessageBox::warning(this,tr("File Exists!"), | 366 | switch (QMessageBox::warning(this,tr("File Exists!"), |
361 | item+tr("\nexists. Ok to overwrite?"), | 367 | tr("<P> %1 already exists. Ok to overwrite?</p>").arg(item), |
362 | tr("Yes"),tr("No"),0,0,1) ) { | 368 | tr("Yes"),tr("No"),0,0,1) ) { |
@@ -371,4 +377,3 @@ void AdvancedFm::copyAs() { | |||
371 | if( !copyFile( curFile, destFile) ) { | 377 | if( !copyFile( curFile, destFile) ) { |
372 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 378 | QMessageBox::message("AdvancedFm",tr("<p>Could not copy %1 to %2</P>").arg(curFile).arg(destFile)); |
373 | +curFile +tr("to\n")+destFile); | ||
374 | return; | 379 | return; |
@@ -380,3 +385,3 @@ void AdvancedFm::copyAs() { | |||
380 | rePopulate(); | 385 | rePopulate(); |
381 | setOtherTabCurrent(); | 386 | // setOtherTabCurrent(); |
382 | qApp->processEvents(); | 387 | qApp->processEvents(); |
@@ -385,2 +390,6 @@ void AdvancedFm::copyAs() { | |||
385 | 390 | ||
391 | void AdvancedFm::copySameDirTimer() { | ||
392 | QTimer::singleShot(125,this,SLOT(copySameDir())); | ||
393 | } | ||
394 | |||
386 | void AdvancedFm::copySameDir() { | 395 | void AdvancedFm::copySameDir() { |
@@ -409,3 +418,3 @@ void AdvancedFm::copySameDir() { | |||
409 | switch (QMessageBox::warning(this,tr("Delete"), | 418 | switch (QMessageBox::warning(this,tr("Delete"), |
410 | destFile+tr(" already exists.\nDo you really want to delete it?"), | 419 | tr("<p> %1 already exists. Do you really want to delete it?</P>").arg(destFile), |
411 | tr("Yes"),tr("No"),0,0,1) ) { | 420 | tr("Yes"),tr("No"),0,0,1) ) { |
@@ -421,4 +430,3 @@ void AdvancedFm::copySameDir() { | |||
421 | if(!copyFile( curFile,destFile) ) { | 430 | if(!copyFile( curFile,destFile) ) { |
422 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 431 | QMessageBox::message("AdvancedFm",tr("<P>Could not copy %1 to %2</P>").arg(curFile).arg(destFile)); |
423 | +curFile +tr("to\n")+destFile); | ||
424 | return; | 432 | return; |
@@ -433,4 +441,7 @@ void AdvancedFm::copySameDir() { | |||
433 | 441 | ||
442 | void AdvancedFm::moveTimer() { | ||
443 | QTimer::singleShot(125,this,SLOT(move())); | ||
444 | } | ||
445 | |||
434 | void AdvancedFm::move() { | 446 | void AdvancedFm::move() { |
435 | qApp->processEvents(); | ||
436 | 447 | ||
@@ -462,4 +473,3 @@ void AdvancedFm::move() { | |||
462 | } | 473 | } |
463 | 474 | QFile f( curFile); | |
464 | QFile f( curFile); | ||
465 | if( f.exists()) { | 475 | if( f.exists()) { |
@@ -469,3 +479,3 @@ void AdvancedFm::move() { | |||
469 | } else | 479 | } else |
470 | QFile::remove(curFile); | 480 | QFile::remove(curFile); |
471 | } | 481 | } |
@@ -474,4 +484,4 @@ void AdvancedFm::move() { | |||
474 | } | 484 | } |
475 | rePopulate(); | 485 | rePopulate(); |
476 | setOtherTabCurrent(); | 486 | //setOtherTabCurrent(); |
477 | } | 487 | } |
@@ -508,63 +518,61 @@ bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) { | |||
508 | bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { | 518 | bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { |
509 | 519 | if(QFileInfo(src).isDir()) { | |
510 | 520 | if( copyDirectory( src, dest )) { | |
511 | if(QFileInfo(src).isDir()) { | 521 | // setOtherTabCurrent(); |
512 | if( copyDirectory( src, dest )) { | 522 | rePopulate(); |
513 | setOtherTabCurrent(); | 523 | return true; |
514 | populateView(); | 524 | } |
515 | return true; | 525 | else |
516 | } | 526 | return false; |
517 | else | 527 | } |
518 | return false; | 528 | |
519 | } | 529 | |
520 | 530 | bool success = true; | |
521 | 531 | struct stat status; | |
522 | bool success = true; | 532 | QFile srcFile(src); |
523 | struct stat status; | 533 | QFile destFile(dest); |
524 | QFile srcFile(src); | 534 | int err=0; |
525 | QFile destFile(dest); | 535 | int read_fd=0; |
526 | int err=0; | 536 | int write_fd=0; |
527 | int read_fd=0; | 537 | struct stat stat_buf; |
528 | int write_fd=0; | 538 | off_t offset = 0; |
529 | struct stat stat_buf; | 539 | if(!srcFile.open( IO_ReadOnly|IO_Raw)) { |
530 | off_t offset = 0; | ||
531 | if(!srcFile.open( IO_ReadOnly|IO_Raw)) { | ||
532 | // owarn << "open failed" << oendl; | 540 | // owarn << "open failed" << oendl; |
533 | return success = false; | 541 | return success = false; |
534 | } | 542 | } |
535 | read_fd = srcFile.handle(); | 543 | read_fd = srcFile.handle(); |
536 | if(read_fd != -1) { | 544 | if(read_fd != -1) { |
537 | fstat (read_fd, &stat_buf); | 545 | fstat (read_fd, &stat_buf); |
538 | if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { | 546 | if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { |
539 | // owarn << "destfile open failed" << oendl; | 547 | // owarn << "destfile open failed" << oendl; |
540 | return success = false; | 548 | return success = false; |
541 | } | 549 | } |
542 | write_fd = destFile.handle(); | 550 | write_fd = destFile.handle(); |
543 | if(write_fd != -1) { | 551 | if(write_fd != -1) { |
544 | err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); | 552 | err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); |
545 | if( err == -1) { | 553 | if( err == -1) { |
546 | QString msg; | 554 | QString msg; |
547 | switch(err) { | 555 | switch(err) { |
548 | case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; | 556 | case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; |
549 | case EINVAL: msg = "Descriptor is not valid or locked. "; | 557 | case EINVAL: msg = "Descriptor is not valid or locked. "; |
550 | case ENOMEM: msg = "Insufficient memory to read from in_fd."; | 558 | case ENOMEM: msg = "Insufficient memory to read from in_fd."; |
551 | case EIO: msg = "Unspecified error while reading from in_fd."; | 559 | case EIO: msg = "Unspecified error while reading from in_fd."; |
552 | }; | 560 | }; |
553 | success = false; | 561 | success = false; |
554 | // owarn << msg << oendl; | 562 | // owarn << msg << oendl; |
555 | } | 563 | } |
556 | } else { | 564 | } else { |
557 | success = false; | 565 | success = false; |
558 | } | 566 | } |
559 | } else { | 567 | } else { |
560 | success = false; | 568 | success = false; |
561 | } | 569 | } |
562 | srcFile.close(); | 570 | srcFile.close(); |
563 | destFile.close(); | 571 | destFile.close(); |
564 | // Set file permissions | 572 | // Set file permissions |
565 | if( stat( QFile::encodeName(src), &status ) == 0 ) { | 573 | if( stat( QFile::encodeName(src), &status ) == 0 ) { |
566 | chmod( QFile::encodeName(dest), status.st_mode ); | 574 | chmod( QFile::encodeName(dest), status.st_mode ); |
567 | } | 575 | } |
568 | 576 | ||
569 | return success; | 577 | return success; |
570 | } | 578 | } |
@@ -710,7 +718,5 @@ void AdvancedFm::startProcess(const QString & cmd) { | |||
710 | process = new OProcess(); | 718 | process = new OProcess(); |
711 | connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), | 719 | connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), this, SLOT( processEnded(Opie::Core::OProcess*))); |
712 | this, SLOT( processEnded(Opie::Core::OProcess*))); | ||
713 | 720 | ||
714 | connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), | 721 | connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); |
715 | this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); | ||
716 | 722 | ||
@@ -756,9 +762,9 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { | |||
756 | if ( e->type() == QEvent::FocusIn ) { | 762 | if ( e->type() == QEvent::FocusIn ) { |
757 | if( o == Local_View) { //keep track of which view | 763 | // if( o == Local_View) { //keep track of which view |
758 | qDebug("local view"); | 764 | // qDebug("local view"); |
759 | whichTab = 1; | 765 | // whichTab = 1; |
760 | } else { | 766 | // } else { |
761 | whichTab = 2; | 767 | // whichTab = 2; |
762 | qDebug("remote view"); | 768 | // qDebug("remote view"); |
763 | } | 769 | // } |
764 | } | 770 | } |
@@ -791,4 +797,3 @@ void AdvancedFm::doRename(QListView * view) { | |||
791 | r.setX( view->contentsX() ); | 797 | r.setX( view->contentsX() ); |
792 | 798 | if ( r.width() > view->visibleWidth() ) | |
793 | if ( r.width() > view->visibleWidth() ) | ||
794 | r.setWidth( view->visibleWidth() ); | 799 | r.setWidth( view->visibleWidth() ); |
@@ -797,15 +802,9 @@ void AdvancedFm::doRename(QListView * view) { | |||
797 | renameBox->setFrame(true); | 802 | renameBox->setFrame(true); |
798 | |||
799 | renameBox->setText( view->currentItem()->text(0) ); | 803 | renameBox->setText( view->currentItem()->text(0) ); |
800 | |||
801 | renameBox->selectAll(); | 804 | renameBox->selectAll(); |
802 | renameBox->installEventFilter( this ); | 805 | renameBox->installEventFilter( this ); |
803 | |||
804 | view->addChild( renameBox, r.x(), r.y() ); | 806 | view->addChild( renameBox, r.x(), r.y() ); |
805 | 807 | renameBox->resize( r.size() ); | |
806 | renameBox->resize( r.size() ); | 808 | view->viewport()->setFocusProxy( renameBox ); |
807 | 809 | renameBox->setFocus(); | |
808 | view->viewport()->setFocusProxy( renameBox ); | ||
809 | |||
810 | renameBox->setFocus(); | ||
811 | renameBox->show(); | 810 | renameBox->show(); |