Diffstat (limited to 'noncore/apps/advancedfm/advancedfmMenu.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 73 |
1 files changed, 36 insertions, 37 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 | |||
@@ -271,8 +271,11 @@ void AdvancedFm::upDir() { | |||
271 | update(); | 271 | update(); |
272 | } | 272 | } |
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(); | ||
276 | QStringList curFileList = getPath(); | 279 | QStringList curFileList = getPath(); |
277 | 280 | ||
278 | QDir *thisDir = CurrentDir(); | 281 | QDir *thisDir = CurrentDir(); |
@@ -312,7 +315,7 @@ void AdvancedFm::copy() { | |||
312 | if( f.exists()) { | 315 | if( f.exists()) { |
313 | if(doMsg) { | 316 | if(doMsg) { |
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: |
318 | return; | 321 | return; |
@@ -324,15 +327,18 @@ void AdvancedFm::copy() { | |||
324 | 327 | ||
325 | if( !copyFile( curFile, destFile) ) { | 328 | if( !copyFile( curFile, destFile) ) { |
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; |
329 | } | 332 | } |
330 | } | 333 | } |
331 | setOtherTabCurrent(); | ||
332 | rePopulate(); | 334 | rePopulate(); |
333 | } | 335 | } |
334 | } | 336 | } |
335 | 337 | ||
338 | void AdvancedFm::copyAsTimer() { | ||
339 | QTimer::singleShot(125,this,SLOT(copyAs())); | ||
340 | } | ||
341 | |||
336 | void AdvancedFm::copyAs() { | 342 | void AdvancedFm::copyAs() { |
337 | 343 | ||
338 | QStringList curFileList = getPath(); | 344 | QStringList curFileList = getPath(); |
@@ -346,7 +352,7 @@ void AdvancedFm::copyAs() { | |||
346 | QString destFile; | 352 | QString destFile; |
347 | item=(*it); | 353 | item=(*it); |
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 | ||
351 | fileDlg->setInputText((const QString &) destFile ); | 357 | fileDlg->setInputText((const QString &) destFile ); |
352 | fileDlg->exec(); | 358 | fileDlg->exec(); |
@@ -358,7 +364,7 @@ void AdvancedFm::copyAs() { | |||
358 | QFile f( destFile); | 364 | QFile f( destFile); |
359 | if( f.exists()) { | 365 | if( f.exists()) { |
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) ) { |
363 | case 0: | 369 | case 0: |
364 | f.remove(); | 370 | f.remove(); |
@@ -369,8 +375,7 @@ void AdvancedFm::copyAs() { | |||
369 | }; | 375 | }; |
370 | } | 376 | } |
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; |
375 | } | 380 | } |
376 | } | 381 | } |
@@ -378,11 +383,15 @@ void AdvancedFm::copyAs() { | |||
378 | 383 | ||
379 | } | 384 | } |
380 | rePopulate(); | 385 | rePopulate(); |
381 | setOtherTabCurrent(); | 386 | // setOtherTabCurrent(); |
382 | qApp->processEvents(); | 387 | qApp->processEvents(); |
383 | 388 | ||
384 | } | 389 | } |
385 | 390 | ||
391 | void AdvancedFm::copySameDirTimer() { | ||
392 | QTimer::singleShot(125,this,SLOT(copySameDir())); | ||
393 | } | ||
394 | |||
386 | void AdvancedFm::copySameDir() { | 395 | void AdvancedFm::copySameDir() { |
387 | qApp->processEvents(); | 396 | qApp->processEvents(); |
388 | QStringList curFileList = getPath(); | 397 | QStringList curFileList = getPath(); |
@@ -407,7 +416,7 @@ void AdvancedFm::copySameDir() { | |||
407 | QFile f(destFile); | 416 | QFile f(destFile); |
408 | if( f.exists()) { | 417 | if( f.exists()) { |
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) ) { |
412 | case 0: | 421 | case 0: |
413 | 422 | ||
@@ -419,8 +428,7 @@ void AdvancedFm::copySameDir() { | |||
419 | }; | 428 | }; |
420 | } | 429 | } |
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; |
425 | } | 433 | } |
426 | 434 | ||
@@ -431,8 +439,11 @@ void AdvancedFm::copySameDir() { | |||
431 | rePopulate(); | 439 | rePopulate(); |
432 | } | 440 | } |
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 | ||
437 | QStringList curFileList = getPath(); | 448 | QStringList curFileList = getPath(); |
438 | if( curFileList.count() > 0) { | 449 | if( curFileList.count() > 0) { |
@@ -460,7 +471,6 @@ void AdvancedFm::move() { | |||
460 | rePopulate(); | 471 | rePopulate(); |
461 | return; | 472 | return; |
462 | } | 473 | } |
463 | |||
464 | QFile f( curFile); | 474 | QFile f( curFile); |
465 | if( f.exists()) { | 475 | if( f.exists()) { |
466 | if( !copyFile( curFile, destFile) ) { | 476 | if( !copyFile( curFile, destFile) ) { |
@@ -473,7 +483,7 @@ void AdvancedFm::move() { | |||
473 | 483 | ||
474 | } | 484 | } |
475 | rePopulate(); | 485 | rePopulate(); |
476 | setOtherTabCurrent(); | 486 | //setOtherTabCurrent(); |
477 | } | 487 | } |
478 | 488 | ||
479 | bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) { | 489 | bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) { |
@@ -506,12 +516,10 @@ bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) { | |||
506 | 516 | ||
507 | 517 | ||
508 | bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { | 518 | bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { |
509 | |||
510 | |||
511 | if(QFileInfo(src).isDir()) { | 519 | if(QFileInfo(src).isDir()) { |
512 | if( copyDirectory( src, dest )) { | 520 | if( copyDirectory( src, dest )) { |
513 | setOtherTabCurrent(); | 521 | // setOtherTabCurrent(); |
514 | populateView(); | 522 | rePopulate(); |
515 | return true; | 523 | return true; |
516 | } | 524 | } |
517 | else | 525 | else |
@@ -708,11 +716,9 @@ void AdvancedFm::startProcess(const QString & cmd) { | |||
708 | QStringList command; | 716 | QStringList command; |
709 | OProcess *process; | 717 | OProcess *process; |
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 | ||
717 | command << "/bin/sh"; | 723 | command << "/bin/sh"; |
718 | command << "-c"; | 724 | command << "-c"; |
@@ -754,13 +760,13 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { | |||
754 | } | 760 | } |
755 | if ( o->inherits( "QListView" ) ) { | 761 | if ( o->inherits( "QListView" ) ) { |
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 | } |
765 | OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection | 771 | OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection |
766 | } | 772 | } |
@@ -789,24 +795,17 @@ void AdvancedFm::doRename(QListView * view) { | |||
789 | QRect r = view->itemRect( view->currentItem( )); | 795 | QRect r = view->itemRect( view->currentItem( )); |
790 | r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); | 796 | r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); |
791 | r.setX( view->contentsX() ); | 797 | r.setX( view->contentsX() ); |
792 | |||
793 | if ( r.width() > view->visibleWidth() ) | 798 | if ( r.width() > view->visibleWidth() ) |
794 | r.setWidth( view->visibleWidth() ); | 799 | r.setWidth( view->visibleWidth() ); |
795 | 800 | ||
796 | renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); | 801 | renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); |
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 | |||
806 | renameBox->resize( r.size() ); | 807 | renameBox->resize( r.size() ); |
807 | |||
808 | view->viewport()->setFocusProxy( renameBox ); | 808 | view->viewport()->setFocusProxy( renameBox ); |
809 | |||
810 | renameBox->setFocus(); | 809 | renameBox->setFocus(); |
811 | renameBox->show(); | 810 | renameBox->show(); |
812 | } | 811 | } |