-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index bef701a..f89ad30 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -344,428 +344,430 @@ void AdvancedFm::localRename() { | |||
344 | } | 344 | } |
345 | populateLocalView(); | 345 | populateLocalView(); |
346 | } | 346 | } |
347 | } | 347 | } |
348 | 348 | ||
349 | void AdvancedFm::remoteRename() | 349 | void AdvancedFm::remoteRename() |
350 | { | 350 | { |
351 | QString curFile = Remote_View->currentItem()->text(0); | 351 | QString curFile = Remote_View->currentItem()->text(0); |
352 | if( curFile !="../") { | 352 | if( curFile !="../") { |
353 | InputDialog *fileDlg; | 353 | InputDialog *fileDlg; |
354 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 354 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
355 | fileDlg->setInputText((const QString &)curFile); | 355 | fileDlg->setInputText((const QString &)curFile); |
356 | fileDlg->exec(); | 356 | fileDlg->exec(); |
357 | if( fileDlg->result() == 1 ) { | 357 | if( fileDlg->result() == 1 ) { |
358 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; | 358 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; |
359 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); | 359 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); |
360 | //+".playlist"; | 360 | //+".playlist"; |
361 | if( rename(oldname.latin1(), newName.latin1())== -1) | 361 | if( rename(oldname.latin1(), newName.latin1())== -1) |
362 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 362 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
363 | } | 363 | } |
364 | populateRemoteView(); | 364 | populateRemoteView(); |
365 | } | 365 | } |
366 | } | 366 | } |
367 | 367 | ||
368 | 368 | ||
369 | void AdvancedFm::filePerms() { | 369 | void AdvancedFm::filePerms() { |
370 | 370 | ||
371 | QStringList curFileList = getPath(); | 371 | QStringList curFileList = getPath(); |
372 | QString filePath; | 372 | QString filePath; |
373 | 373 | ||
374 | if (TabWidget->getCurrentTab() == 0) { | 374 | if (TabWidget->getCurrentTab() == 0) { |
375 | filePath = currentDir.canonicalPath()+"/"; | 375 | filePath = currentDir.canonicalPath()+"/"; |
376 | } else { | 376 | } else { |
377 | filePath= currentRemoteDir.canonicalPath()+"/"; | 377 | filePath= currentRemoteDir.canonicalPath()+"/"; |
378 | } | 378 | } |
379 | 379 | ||
380 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 380 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
381 | filePermissions *filePerm; | 381 | filePermissions *filePerm; |
382 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); | 382 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); |
383 | filePerm->showMaximized(); | 383 | filePerm->showMaximized(); |
384 | filePerm->exec(); | 384 | filePerm->exec(); |
385 | if( filePerm) | 385 | if( filePerm) |
386 | delete filePerm; | 386 | delete filePerm; |
387 | } | 387 | } |
388 | if (TabWidget->getCurrentTab() == 0) { | 388 | if (TabWidget->getCurrentTab() == 0) { |
389 | populateLocalView(); | 389 | populateLocalView(); |
390 | } else { | 390 | } else { |
391 | populateRemoteView(); | 391 | populateRemoteView(); |
392 | } | 392 | } |
393 | } | 393 | } |
394 | 394 | ||
395 | void AdvancedFm::doProperties() { | 395 | void AdvancedFm::doProperties() { |
396 | #if defined(QT_QWS_OPIE) | 396 | #if defined(QT_QWS_OPIE) |
397 | 397 | ||
398 | QStringList curFileList = getPath(); | 398 | QStringList curFileList = getPath(); |
399 | 399 | ||
400 | QString filePath; | 400 | QString filePath; |
401 | if (TabWidget->getCurrentTab() == 0) { | 401 | if (TabWidget->getCurrentTab() == 0) { |
402 | filePath = currentDir.canonicalPath()+"/"; | 402 | filePath = currentDir.canonicalPath()+"/"; |
403 | } else { | 403 | } else { |
404 | filePath= currentRemoteDir.canonicalPath()+"/"; | 404 | filePath= currentRemoteDir.canonicalPath()+"/"; |
405 | } | 405 | } |
406 | qDebug("%d",curFileList.count()); | 406 | qDebug("%d",curFileList.count()); |
407 | 407 | ||
408 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 408 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
409 | qDebug((filePath+*it)); | 409 | qDebug((filePath+*it)); |
410 | DocLnk lnk( (filePath+*it)); | 410 | DocLnk lnk( (filePath+*it)); |
411 | LnkProperties prop( &lnk ); | 411 | LnkProperties prop( &lnk ); |
412 | prop.showMaximized(); | 412 | prop.showMaximized(); |
413 | prop.exec(); | 413 | prop.exec(); |
414 | } | 414 | } |
415 | #endif | 415 | #endif |
416 | 416 | ||
417 | } | 417 | } |
418 | 418 | ||
419 | void AdvancedFm::upDir() { | 419 | void AdvancedFm::upDir() { |
420 | if (TabWidget->getCurrentTab() == 0) { | 420 | if (TabWidget->getCurrentTab() == 0) { |
421 | QString current = currentDir.canonicalPath(); | 421 | QString current = currentDir.canonicalPath(); |
422 | QDir dir(current); | 422 | QDir dir(current); |
423 | dir.cdUp(); | 423 | dir.cdUp(); |
424 | current = dir.canonicalPath(); | 424 | current = dir.canonicalPath(); |
425 | chdir( current.latin1() ); | 425 | chdir( current.latin1() ); |
426 | currentDir.cd( current, TRUE); | 426 | currentDir.cd( current, TRUE); |
427 | populateLocalView(); | 427 | populateLocalView(); |
428 | update(); | 428 | update(); |
429 | } else { | 429 | } else { |
430 | QString current = currentRemoteDir.canonicalPath(); | 430 | QString current = currentRemoteDir.canonicalPath(); |
431 | QDir dir(current); | 431 | QDir dir(current); |
432 | dir.cdUp(); | 432 | dir.cdUp(); |
433 | current = dir.canonicalPath(); | 433 | current = dir.canonicalPath(); |
434 | chdir( current.latin1() ); | 434 | chdir( current.latin1() ); |
435 | currentRemoteDir.cd( current, TRUE); | 435 | currentRemoteDir.cd( current, TRUE); |
436 | populateRemoteView(); | 436 | populateRemoteView(); |
437 | update(); | 437 | update(); |
438 | } | 438 | } |
439 | } | 439 | } |
440 | 440 | ||
441 | void AdvancedFm::copy() { | 441 | void AdvancedFm::copy() { |
442 | qApp->processEvents(); | 442 | qApp->processEvents(); |
443 | QStringList curFileList = getPath(); | 443 | QStringList curFileList = getPath(); |
444 | bool doMsg=true; | 444 | bool doMsg=true; |
445 | int count=curFileList.count(); | 445 | int count=curFileList.count(); |
446 | if( count > 0) { | 446 | if( count > 0) { |
447 | if(count > 1 ){ | 447 | if(count > 1 ){ |
448 | QString msg; | 448 | QString msg; |
449 | msg=tr("Really copy\n%1 files?").arg(count); | 449 | msg=tr("Really copy\n%1 files?").arg(count); |
450 | switch ( QMessageBox::warning(this,tr("Delete"),msg | 450 | switch ( QMessageBox::warning(this,tr("Delete"),msg |
451 | ,tr("Yes"),tr("No"),0,0,1) ) { | 451 | ,tr("Yes"),tr("No"),0,0,1) ) { |
452 | case 0: | 452 | case 0: |
453 | doMsg=false; | 453 | doMsg=false; |
454 | break; | 454 | break; |
455 | case 1: | 455 | case 1: |
456 | return; | 456 | return; |
457 | break; | 457 | break; |
458 | }; | 458 | }; |
459 | } | 459 | } |
460 | 460 | ||
461 | QString curFile, item, destFile; | 461 | QString curFile, item, destFile; |
462 | if (TabWidget->getCurrentTab() == 0) { | 462 | if (TabWidget->getCurrentTab() == 0) { |
463 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 463 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
464 | item=(*it); | 464 | item=(*it); |
465 | if(item.find("->",0,TRUE)) //symlink | 465 | if(item.find("->",0,TRUE)) //symlink |
466 | item = item.left(item.find("->",0,TRUE)); | 466 | item = item.left(item.find("->",0,TRUE)); |
467 | 467 | ||
468 | destFile = currentRemoteDir.canonicalPath()+"/"+ item; | 468 | destFile = currentRemoteDir.canonicalPath()+"/"+ item; |
469 | qDebug("Destination file is "+destFile); | 469 | qDebug("Destination file is "+destFile); |
470 | 470 | ||
471 | curFile = currentDir.canonicalPath()+"/"+ item; | 471 | curFile = currentDir.canonicalPath()+"/"+ item; |
472 | qDebug("CurrentFile file is " + curFile); | 472 | qDebug("CurrentFile file is " + curFile); |
473 | 473 | ||
474 | QFile f(destFile); | 474 | QFile f(destFile); |
475 | if( f.exists()) { | 475 | if( f.exists()) { |
476 | if(doMsg) { | 476 | if(doMsg) { |
477 | switch ( QMessageBox::warning(this,tr("File Exists!"), | 477 | switch ( QMessageBox::warning(this,tr("File Exists!"), |
478 | item+tr("\nexists. Ok to overwrite?"), | 478 | item+tr("\nexists. Ok to overwrite?"), |
479 | tr("Yes"),tr("No"),0,0,1) ) { | 479 | tr("Yes"),tr("No"),0,0,1) ) { |
480 | case 1: | 480 | case 1: |
481 | return; | 481 | return; |
482 | break; | 482 | break; |
483 | }; | 483 | }; |
484 | } | 484 | } |
485 | f.remove(); | 485 | f.remove(); |
486 | } | 486 | } |
487 | if(!copyFile(destFile, curFile) ) { | 487 | if(!copyFile(destFile, curFile) ) { |
488 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | 488 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); |
489 | return; | 489 | return; |
490 | } | 490 | } |
491 | } | 491 | } |
492 | populateRemoteView(); | 492 | populateRemoteView(); |
493 | TabWidget->setCurrentTab(1); | 493 | TabWidget->setCurrentTab(1); |
494 | 494 | ||
495 | } else { | 495 | } else { |
496 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 496 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
497 | item= (*it); | 497 | item= (*it); |
498 | if(item.find("->",0,TRUE)) //symlink | 498 | if(item.find("->",0,TRUE)) //symlink |
499 | item = item.left(item.find("->",0,TRUE)); | 499 | item = item.left(item.find("->",0,TRUE)); |
500 | 500 | ||
501 | destFile = currentDir.canonicalPath()+"/"+ item; | 501 | destFile = currentDir.canonicalPath()+"/"+ item; |
502 | qDebug("Destination file is "+destFile); | 502 | qDebug("Destination file is "+destFile); |
503 | 503 | ||
504 | curFile = currentRemoteDir.canonicalPath()+"/"+ item;; | 504 | curFile = currentRemoteDir.canonicalPath()+"/"+ item;; |
505 | qDebug("CurrentFile file is " + curFile); | 505 | qDebug("CurrentFile file is " + curFile); |
506 | 506 | ||
507 | QFile f(destFile); | 507 | QFile f(destFile); |
508 | if( f.exists()) { | 508 | if( f.exists()) { |
509 | switch ( QMessageBox::warning(this,tr("File Exists!"), | 509 | switch ( QMessageBox::warning(this,tr("File Exists!"), |
510 | item+tr("\nexists. Ok to overwrite?"), | 510 | item+tr("\nexists. Ok to overwrite?"), |
511 | tr("Yes"),tr("No"),0,0,1) ) { | 511 | tr("Yes"),tr("No"),0,0,1) ) { |
512 | case 1: | 512 | case 1: |
513 | return; | 513 | return; |
514 | break; | 514 | break; |
515 | }; | 515 | }; |
516 | f.remove(); | 516 | f.remove(); |
517 | } | 517 | } |
518 | if(!copyFile(destFile, curFile) ) { | 518 | if(!copyFile(destFile, curFile) ) { |
519 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 519 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
520 | +curFile +tr("to\n")+destFile); | 520 | +curFile +tr("to\n")+destFile); |
521 | return; | 521 | return; |
522 | 522 | ||
523 | } | 523 | } |
524 | } | 524 | } |
525 | populateLocalView(); | 525 | populateLocalView(); |
526 | TabWidget->setCurrentTab(0); | 526 | TabWidget->setCurrentTab(0); |
527 | } | 527 | } |
528 | 528 | ||
529 | } | 529 | } |
530 | } | 530 | } |
531 | 531 | ||
532 | void AdvancedFm::copyAs() { | 532 | void AdvancedFm::copyAs() { |
533 | qApp->processEvents(); | 533 | qApp->processEvents(); |
534 | 534 | ||
535 | QStringList curFileList = getPath(); | 535 | QStringList curFileList = getPath(); |
536 | QString curFile; | 536 | QString curFile, item; |
537 | InputDialog *fileDlg; | 537 | InputDialog *fileDlg; |
538 | if (TabWidget->getCurrentTab() == 0) { | 538 | if (TabWidget->getCurrentTab() == 0) { |
539 | qDebug("tab 1"); | 539 | qDebug("tab 1"); |
540 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 540 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
541 | QString destFile; | 541 | QString destFile; |
542 | item=(*it); | ||
542 | curFile = currentDir.canonicalPath()+"/"+(*it); | 543 | curFile = currentDir.canonicalPath()+"/"+(*it); |
543 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); | 544 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); |
544 | 545 | ||
545 | fileDlg->setInputText((const QString &) destFile ); | 546 | fileDlg->setInputText((const QString &) destFile ); |
546 | fileDlg->exec(); | 547 | fileDlg->exec(); |
547 | 548 | ||
548 | if( fileDlg->result() == 1 ) { | 549 | if( fileDlg->result() == 1 ) { |
549 | QString filename = fileDlg->LineEdit1->text(); | 550 | QString filename = fileDlg->LineEdit1->text(); |
550 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; | 551 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; |
551 | 552 | ||
552 | QFile f(destFile); | 553 | QFile f(destFile); |
553 | if( f.exists()) { | 554 | if( f.exists()) { |
554 | switch (QMessageBox::warning(this,tr("File Exists!"), | 555 | switch (QMessageBox::warning(this,tr("File Exists!"), |
555 | item+tr("\nexists. Ok to overwrite?"), | 556 | item+tr("\nexists. Ok to overwrite?"), |
556 | tr("Yes"),tr("No"),0,0,1) ) { | 557 | tr("Yes"),tr("No"),0,0,1) ) { |
557 | case 0: | 558 | case 0: |
558 | f.remove(); | 559 | f.remove(); |
559 | break; | 560 | break; |
560 | case 1: | 561 | case 1: |
561 | return; | 562 | return; |
562 | break; | 563 | break; |
563 | }; | 564 | }; |
564 | } | 565 | } |
565 | if(!copyFile(destFile, curFile) ) { | 566 | if(!copyFile(destFile, curFile) ) { |
566 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 567 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
567 | +curFile +tr("to\n")+destFile); | 568 | +curFile +tr("to\n")+destFile); |
568 | return; | 569 | return; |
569 | } | 570 | } |
570 | } | 571 | } |
571 | delete fileDlg; | 572 | delete fileDlg; |
572 | 573 | ||
573 | } | 574 | } |
574 | populateRemoteView(); | 575 | populateRemoteView(); |
575 | TabWidget->setCurrentTab(1); | 576 | TabWidget->setCurrentTab(1); |
576 | 577 | ||
577 | } else { | 578 | } else { |
578 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 579 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
579 | 580 | ||
581 | item=(*it); | ||
580 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 582 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
581 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); | 583 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); |
582 | 584 | ||
583 | QString destFile; | 585 | QString destFile; |
584 | fileDlg->setInputText((const QString &) destFile); | 586 | fileDlg->setInputText((const QString &) destFile); |
585 | fileDlg->exec(); | 587 | fileDlg->exec(); |
586 | 588 | ||
587 | if( fileDlg->result() == 1 ) { | 589 | if( fileDlg->result() == 1 ) { |
588 | QString filename = fileDlg->LineEdit1->text(); | 590 | QString filename = fileDlg->LineEdit1->text(); |
589 | destFile = currentDir.canonicalPath()+"/"+filename; | 591 | destFile = currentDir.canonicalPath()+"/"+filename; |
590 | 592 | ||
591 | QFile f( destFile); | 593 | QFile f( destFile); |
592 | if( f.exists()) { | 594 | if( f.exists()) { |
593 | switch ( QMessageBox::warning(this,tr("File Exists!"), | 595 | switch ( QMessageBox::warning(this,tr("File Exists!"), |
594 | item+tr("\nexists. Ok to overwrite?"), | 596 | item+tr("\nexists. Ok to overwrite?"), |
595 | tr("Yes"),tr("No"),0,0,1) ) { | 597 | tr("Yes"),tr("No"),0,0,1) ) { |
596 | case 0: | 598 | case 0: |
597 | f.remove(); | 599 | f.remove(); |
598 | break; | 600 | break; |
599 | case 1: | 601 | case 1: |
600 | return; | 602 | return; |
601 | break; | 603 | break; |
602 | }; | 604 | }; |
603 | } | 605 | } |
604 | if(!copyFile(destFile, curFile) ) { | 606 | if(!copyFile(destFile, curFile) ) { |
605 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 607 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
606 | +curFile +tr("to\n")+destFile); | 608 | +curFile +tr("to\n")+destFile); |
607 | return; | 609 | return; |
608 | } | 610 | } |
609 | 611 | ||
610 | } | 612 | } |
611 | delete fileDlg; | 613 | delete fileDlg; |
612 | 614 | ||
613 | } | 615 | } |
614 | populateLocalView(); | 616 | populateLocalView(); |
615 | TabWidget->setCurrentTab(0); | 617 | TabWidget->setCurrentTab(0); |
616 | } | 618 | } |
617 | } | 619 | } |
618 | 620 | ||
619 | void AdvancedFm::copySameDir() { | 621 | void AdvancedFm::copySameDir() { |
620 | qApp->processEvents(); | 622 | qApp->processEvents(); |
621 | QStringList curFileList = getPath(); | 623 | QStringList curFileList = getPath(); |
622 | QString curFile, item, destFile; | 624 | QString curFile, item, destFile; |
623 | InputDialog *fileDlg; | 625 | InputDialog *fileDlg; |
624 | 626 | ||
625 | if (TabWidget->getCurrentTab() == 0) { | 627 | if (TabWidget->getCurrentTab() == 0) { |
626 | 628 | ||
627 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 629 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
628 | item=(*it); | 630 | item=(*it); |
629 | curFile = currentDir.canonicalPath()+"/"+ item; | 631 | curFile = currentDir.canonicalPath()+"/"+ item; |
630 | 632 | ||
631 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); | 633 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); |
632 | fileDlg->setInputText((const QString &) destFile ); | 634 | fileDlg->setInputText((const QString &) destFile ); |
633 | fileDlg->exec(); | 635 | fileDlg->exec(); |
634 | 636 | ||
635 | if( fileDlg->result() == 1 ) { | 637 | if( fileDlg->result() == 1 ) { |
636 | 638 | ||
637 | QString filename = fileDlg->LineEdit1->text(); | 639 | QString filename = fileDlg->LineEdit1->text(); |
638 | destFile = currentDir.canonicalPath()+"/"+filename; | 640 | destFile = currentDir.canonicalPath()+"/"+filename; |
639 | 641 | ||
640 | QFile f(destFile); | 642 | QFile f(destFile); |
641 | if( f.exists()) { | 643 | if( f.exists()) { |
642 | switch (QMessageBox::warning(this,tr("Delete"), | 644 | switch (QMessageBox::warning(this,tr("Delete"), |
643 | destFile+tr(" already exists\nDo you really want to delete it?"), | 645 | destFile+tr(" already exists\nDo you really want to delete it?"), |
644 | tr("Yes"),tr("No"),0,0,1) ) { | 646 | tr("Yes"),tr("No"),0,0,1) ) { |
645 | case 0: | 647 | case 0: |
646 | 648 | ||
647 | f.remove(); | 649 | f.remove(); |
648 | break; | 650 | break; |
649 | case 1: | 651 | case 1: |
650 | return; | 652 | return; |
651 | break; | 653 | break; |
652 | }; | 654 | }; |
653 | } | 655 | } |
654 | if(!copyFile(destFile, curFile) ) { | 656 | if(!copyFile(destFile, curFile) ) { |
655 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 657 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
656 | +curFile +tr("to\n")+destFile); | 658 | +curFile +tr("to\n")+destFile); |
657 | return; | 659 | return; |
658 | } | 660 | } |
659 | 661 | ||
660 | qDebug("copy "+curFile+" as "+destFile); | 662 | qDebug("copy "+curFile+" as "+destFile); |
661 | } | 663 | } |
662 | delete fileDlg; | 664 | delete fileDlg; |
663 | } | 665 | } |
664 | populateLocalView(); | 666 | populateLocalView(); |
665 | 667 | ||
666 | } else { | 668 | } else { |
667 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 669 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
668 | item=(*it); | 670 | item=(*it); |
669 | curFile = currentRemoteDir.canonicalPath()+"/"+ item; | 671 | curFile = currentRemoteDir.canonicalPath()+"/"+ item; |
670 | 672 | ||
671 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); | 673 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); |
672 | fileDlg->setInputText((const QString &) destFile); | 674 | fileDlg->setInputText((const QString &) destFile); |
673 | fileDlg->exec(); | 675 | fileDlg->exec(); |
674 | if( fileDlg->result() == 1 ) { | 676 | if( fileDlg->result() == 1 ) { |
675 | QString filename = fileDlg->LineEdit1->text(); | 677 | QString filename = fileDlg->LineEdit1->text(); |
676 | 678 | ||
677 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; | 679 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; |
678 | 680 | ||
679 | QFile f(destFile); | 681 | QFile f(destFile); |
680 | if( f.exists()) { | 682 | if( f.exists()) { |
681 | switch ( QMessageBox::warning(this,tr("Delete"), | 683 | switch ( QMessageBox::warning(this,tr("Delete"), |
682 | destFile+tr(" already exists\nDo you really want to delete it?"), | 684 | destFile+tr(" already exists\nDo you really want to delete it?"), |
683 | tr("Yes"),tr("No"),0,0,1) ) { | 685 | tr("Yes"),tr("No"),0,0,1) ) { |
684 | case 0: | 686 | case 0: |
685 | f.remove(); | 687 | f.remove(); |
686 | break; | 688 | break; |
687 | case 1: | 689 | case 1: |
688 | return; | 690 | return; |
689 | break; | 691 | break; |
690 | }; | 692 | }; |
691 | } | 693 | } |
692 | if(!copyFile(destFile, curFile) ) { | 694 | if(!copyFile(destFile, curFile) ) { |
693 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 695 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
694 | +curFile +tr("to\n")+destFile); | 696 | +curFile +tr("to\n")+destFile); |
695 | return; | 697 | return; |
696 | } | 698 | } |
697 | qDebug("copy "+curFile+" as "+destFile); | 699 | qDebug("copy "+curFile+" as "+destFile); |
698 | } | 700 | } |
699 | delete fileDlg; | 701 | delete fileDlg; |
700 | } | 702 | } |
701 | populateRemoteView(); | 703 | populateRemoteView(); |
702 | } | 704 | } |
703 | } | 705 | } |
704 | 706 | ||
705 | void AdvancedFm::move() { | 707 | void AdvancedFm::move() { |
706 | qApp->processEvents(); | 708 | qApp->processEvents(); |
707 | 709 | ||
708 | QStringList curFileList = getPath(); | 710 | QStringList curFileList = getPath(); |
709 | if( curFileList.count() > 0) { | 711 | if( curFileList.count() > 0) { |
710 | QString curFile, destFile, item; | 712 | QString curFile, destFile, item; |
711 | 713 | ||
712 | if (TabWidget->getCurrentTab() == 0) { | 714 | if (TabWidget->getCurrentTab() == 0) { |
713 | 715 | ||
714 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 716 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
715 | item=(*it); | 717 | item=(*it); |
716 | QString destFile = currentRemoteDir.canonicalPath(); | 718 | QString destFile = currentRemoteDir.canonicalPath(); |
717 | 719 | ||
718 | if(destFile.right(1).find("/",0,TRUE) == -1) | 720 | if(destFile.right(1).find("/",0,TRUE) == -1) |
719 | destFile+="/"; | 721 | destFile+="/"; |
720 | destFile += item; | 722 | destFile += item; |
721 | curFile = currentDir.canonicalPath(); | 723 | curFile = currentDir.canonicalPath(); |
722 | 724 | ||
723 | qDebug("Destination file is "+destFile); | 725 | qDebug("Destination file is "+destFile); |
724 | 726 | ||
725 | if(curFile.right(1).find("/",0,TRUE) == -1) | 727 | if(curFile.right(1).find("/",0,TRUE) == -1) |
726 | curFile +="/"; | 728 | curFile +="/"; |
727 | 729 | ||
728 | curFile+= item; | 730 | curFile+= item; |
729 | qDebug("CurrentFile file is " + curFile); | 731 | qDebug("CurrentFile file is " + curFile); |
730 | 732 | ||
731 | QFile f( curFile); | 733 | QFile f( curFile); |
732 | if( f.exists()) { | 734 | if( f.exists()) { |
733 | if(!copyFile( destFile, curFile) ) { | 735 | if(!copyFile( destFile, curFile) ) { |
734 | QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); | 736 | QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); |
735 | return; | 737 | return; |
736 | } else | 738 | } else |
737 | QFile::remove(curFile); | 739 | QFile::remove(curFile); |
738 | } | 740 | } |
739 | } | 741 | } |
740 | 742 | ||
741 | TabWidget->setCurrentTab(1); | 743 | TabWidget->setCurrentTab(1); |
742 | 744 | ||
743 | } else { //view 2 | 745 | } else { //view 2 |
744 | 746 | ||
745 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 747 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
746 | item = (*it); | 748 | item = (*it); |
747 | QString destFile = currentDir.canonicalPath(); | 749 | QString destFile = currentDir.canonicalPath(); |
748 | 750 | ||
749 | if(destFile.right(1).find("/",0,TRUE) == -1) | 751 | if(destFile.right(1).find("/",0,TRUE) == -1) |
750 | destFile+="/"; | 752 | destFile+="/"; |
751 | 753 | ||
752 | destFile += item; | 754 | destFile += item; |
753 | 755 | ||
754 | qDebug("Destination file is "+destFile); | 756 | qDebug("Destination file is "+destFile); |
755 | 757 | ||
756 | curFile = currentRemoteDir.canonicalPath(); | 758 | curFile = currentRemoteDir.canonicalPath(); |
757 | 759 | ||
758 | if(curFile.right(1).find("/",0,TRUE) == -1) | 760 | if(curFile.right(1).find("/",0,TRUE) == -1) |
759 | curFile +="/"; | 761 | curFile +="/"; |
760 | curFile+= item; | 762 | curFile+= item; |
761 | qDebug("CurrentFile file is " + curFile); | 763 | qDebug("CurrentFile file is " + curFile); |
762 | 764 | ||
763 | QFile f( curFile); | 765 | QFile f( curFile); |
764 | if( f.exists()) { | 766 | if( f.exists()) { |
765 | if(!copyFile( destFile, curFile) ) { | 767 | if(!copyFile( destFile, curFile) ) { |
766 | QMessageBox::message(tr("Note"),tr("Could not move\n") + curFile); | 768 | QMessageBox::message(tr("Note"),tr("Could not move\n") + curFile); |
767 | return; | 769 | return; |
768 | } else | 770 | } else |
769 | QFile::remove( curFile); | 771 | QFile::remove( curFile); |
770 | } | 772 | } |
771 | TabWidget->setCurrentTab(0); | 773 | TabWidget->setCurrentTab(0); |