-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index a6b59c7..98d024d 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -297,396 +297,394 @@ void AdvancedFm::remoteDelete() { | |||
297 | QString myFile; | 297 | QString myFile; |
298 | 298 | ||
299 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 299 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
300 | myFile = (*it); | 300 | myFile = (*it); |
301 | if(myFile.find(" -> ",0,TRUE) != -1) | 301 | if(myFile.find(" -> ",0,TRUE) != -1) |
302 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); | 302 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); |
303 | QString f = currentRemoteDir.canonicalPath(); | 303 | QString f = currentRemoteDir.canonicalPath(); |
304 | if(f.right(1).find("/",0,TRUE) == -1) | 304 | if(f.right(1).find("/",0,TRUE) == -1) |
305 | f+="/"; | 305 | f+="/"; |
306 | f+=myFile; | 306 | f+=myFile; |
307 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 307 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
308 | switch ( QMessageBox::warning(this,tr("Delete Directory"),tr("Really delete\n")+f+ | 308 | switch ( QMessageBox::warning(this,tr("Delete Directory"),tr("Really delete\n")+f+ |
309 | "\nand all it's contents ?", | 309 | "\nand all it's contents ?", |
310 | tr("Yes"),tr("No"),0,0,1) ) { | 310 | tr("Yes"),tr("No"),0,0,1) ) { |
311 | case 0: { | 311 | case 0: { |
312 | f=f.left(f.length()-1); | 312 | f=f.left(f.length()-1); |
313 | QString cmd="rm -rf "+f; | 313 | QString cmd="rm -rf "+f; |
314 | startProcess( (const QString)cmd ); | 314 | startProcess( (const QString)cmd ); |
315 | populateRemoteView(); | 315 | populateRemoteView(); |
316 | } | 316 | } |
317 | break; | 317 | break; |
318 | case 1: | 318 | case 1: |
319 | // exit | 319 | // exit |
320 | break; | 320 | break; |
321 | }; | 321 | }; |
322 | 322 | ||
323 | } else { | 323 | } else { |
324 | if(doMsg) { | 324 | if(doMsg) { |
325 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f | 325 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f |
326 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 326 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
327 | case 1: | 327 | case 1: |
328 | return; | 328 | return; |
329 | break; | 329 | break; |
330 | }; | 330 | }; |
331 | } | 331 | } |
332 | QString cmd="rm "+f; | 332 | QString cmd="rm "+f; |
333 | QFile file(f); | 333 | QFile file(f); |
334 | if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1) | 334 | if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1) |
335 | file.remove(); | 335 | file.remove(); |
336 | } | 336 | } |
337 | } | 337 | } |
338 | } | 338 | } |
339 | populateRemoteView(); | 339 | populateRemoteView(); |
340 | } | 340 | } |
341 | 341 | ||
342 | void AdvancedFm::localRename() { | 342 | void AdvancedFm::localRename() { |
343 | QString curFile = Local_View->currentItem()->text(0); | 343 | QString curFile = Local_View->currentItem()->text(0); |
344 | qDebug("currentItem "+curFile); | 344 | qDebug("currentItem "+curFile); |
345 | if( curFile !="../") { | 345 | if( curFile !="../") { |
346 | InputDialog *fileDlg; | 346 | InputDialog *fileDlg; |
347 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 347 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
348 | fileDlg->setInputText((const QString &)curFile); | 348 | fileDlg->setInputText((const QString &)curFile); |
349 | fileDlg->exec(); | 349 | fileDlg->exec(); |
350 | if( fileDlg->result() == 1 ) { | 350 | if( fileDlg->result() == 1 ) { |
351 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 351 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
352 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); | 352 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); |
353 | //+".playlist"; | 353 | //+".playlist"; |
354 | if( rename(oldname.latin1(), newName.latin1())== -1) | 354 | if( rename(oldname.latin1(), newName.latin1())== -1) |
355 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 355 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
356 | } | 356 | } |
357 | populateLocalView(); | 357 | populateLocalView(); |
358 | } | 358 | } |
359 | } | 359 | } |
360 | 360 | ||
361 | void AdvancedFm::remoteRename() | 361 | void AdvancedFm::remoteRename() |
362 | { | 362 | { |
363 | QString curFile = Remote_View->currentItem()->text(0); | 363 | QString curFile = Remote_View->currentItem()->text(0); |
364 | if( curFile !="../") { | 364 | if( curFile !="../") { |
365 | InputDialog *fileDlg; | 365 | InputDialog *fileDlg; |
366 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 366 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
367 | fileDlg->setInputText((const QString &)curFile); | 367 | fileDlg->setInputText((const QString &)curFile); |
368 | fileDlg->exec(); | 368 | fileDlg->exec(); |
369 | if( fileDlg->result() == 1 ) { | 369 | if( fileDlg->result() == 1 ) { |
370 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; | 370 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; |
371 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); | 371 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); |
372 | //+".playlist"; | 372 | //+".playlist"; |
373 | if( rename(oldname.latin1(), newName.latin1())== -1) | 373 | if( rename(oldname.latin1(), newName.latin1())== -1) |
374 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 374 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
375 | } | 375 | } |
376 | populateRemoteView(); | 376 | populateRemoteView(); |
377 | } | 377 | } |
378 | } | 378 | } |
379 | 379 | ||
380 | 380 | ||
381 | void AdvancedFm::filePerms() { | 381 | void AdvancedFm::filePerms() { |
382 | 382 | ||
383 | QStringList curFileList = getPath(); | 383 | QStringList curFileList = getPath(); |
384 | QString filePath; | 384 | QString filePath; |
385 | 385 | ||
386 | if (TabWidget->getCurrentTab() == 0) { | 386 | if (TabWidget->getCurrentTab() == 0) { |
387 | filePath = currentDir.canonicalPath()+"/"; | 387 | filePath = currentDir.canonicalPath()+"/"; |
388 | } else { | 388 | } else { |
389 | filePath= currentRemoteDir.canonicalPath()+"/"; | 389 | filePath= currentRemoteDir.canonicalPath()+"/"; |
390 | } | 390 | } |
391 | 391 | ||
392 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 392 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
393 | filePermissions *filePerm; | 393 | filePermissions *filePerm; |
394 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); | 394 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); |
395 | filePerm->showMaximized(); | 395 | filePerm->showMaximized(); |
396 | filePerm->exec(); | 396 | filePerm->exec(); |
397 | if( filePerm) | 397 | if( filePerm) |
398 | delete filePerm; | 398 | delete filePerm; |
399 | } | 399 | } |
400 | if (TabWidget->getCurrentTab() == 0) { | 400 | if (TabWidget->getCurrentTab() == 0) { |
401 | populateLocalView(); | 401 | populateLocalView(); |
402 | } else { | 402 | } else { |
403 | populateRemoteView(); | 403 | populateRemoteView(); |
404 | } | 404 | } |
405 | } | 405 | } |
406 | 406 | ||
407 | void AdvancedFm::doProperties() { | 407 | void AdvancedFm::doProperties() { |
408 | #if defined(QT_QWS_OPIE) | 408 | #if defined(QT_QWS_OPIE) |
409 | 409 | ||
410 | QStringList curFileList = getPath(); | 410 | QStringList curFileList = getPath(); |
411 | 411 | ||
412 | QString filePath; | 412 | QString filePath; |
413 | if (TabWidget->getCurrentTab() == 0) { | 413 | if (TabWidget->getCurrentTab() == 0) { |
414 | filePath = currentDir.canonicalPath()+"/"; | 414 | filePath = currentDir.canonicalPath()+"/"; |
415 | } else { | 415 | } else { |
416 | filePath= currentRemoteDir.canonicalPath()+"/"; | 416 | filePath= currentRemoteDir.canonicalPath()+"/"; |
417 | } | 417 | } |
418 | qDebug("%d",curFileList.count()); | 418 | qDebug("%d",curFileList.count()); |
419 | 419 | ||
420 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 420 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
421 | qDebug((filePath+*it)); | 421 | qDebug((filePath+*it)); |
422 | DocLnk lnk( (filePath+*it)); | 422 | DocLnk lnk( (filePath+*it)); |
423 | LnkProperties prop( &lnk ); | 423 | LnkProperties prop( &lnk ); |
424 | prop.showMaximized(); | 424 | prop.showMaximized(); |
425 | prop.exec(); | 425 | prop.exec(); |
426 | } | 426 | } |
427 | #endif | 427 | #endif |
428 | 428 | ||
429 | } | 429 | } |
430 | 430 | ||
431 | void AdvancedFm::upDir() { | 431 | void AdvancedFm::upDir() { |
432 | if (TabWidget->getCurrentTab() == 0) { | 432 | if (TabWidget->getCurrentTab() == 0) { |
433 | QString current = currentDir.canonicalPath(); | 433 | QString current = currentDir.canonicalPath(); |
434 | QDir dir(current); | 434 | QDir dir(current); |
435 | dir.cdUp(); | 435 | dir.cdUp(); |
436 | current = dir.canonicalPath(); | 436 | current = dir.canonicalPath(); |
437 | chdir( current.latin1() ); | 437 | chdir( current.latin1() ); |
438 | currentDir.cd( current, TRUE); | 438 | currentDir.cd( current, TRUE); |
439 | populateLocalView(); | 439 | populateLocalView(); |
440 | update(); | 440 | update(); |
441 | } else { | 441 | } else { |
442 | QString current = currentRemoteDir.canonicalPath(); | 442 | QString current = currentRemoteDir.canonicalPath(); |
443 | QDir dir(current); | 443 | QDir dir(current); |
444 | dir.cdUp(); | 444 | dir.cdUp(); |
445 | current = dir.canonicalPath(); | 445 | current = dir.canonicalPath(); |
446 | chdir( current.latin1() ); | 446 | chdir( current.latin1() ); |
447 | currentRemoteDir.cd( current, TRUE); | 447 | currentRemoteDir.cd( current, TRUE); |
448 | populateRemoteView(); | 448 | populateRemoteView(); |
449 | update(); | 449 | update(); |
450 | } | 450 | } |
451 | } | 451 | } |
452 | 452 | ||
453 | void AdvancedFm::copy() { | 453 | void AdvancedFm::copy() { |
454 | qApp->processEvents(); | 454 | qApp->processEvents(); |
455 | QStringList curFileList = getPath(); | 455 | QStringList curFileList = getPath(); |
456 | bool doMsg=true; | 456 | bool doMsg=true; |
457 | int count=curFileList.count(); | 457 | int count=curFileList.count(); |
458 | if( count > 0) { | 458 | if( count > 0) { |
459 | if(count > 1 ){ | 459 | if(count > 1 ){ |
460 | QString msg; | 460 | QString msg; |
461 | msg=tr("Really copy\n%1 files?").arg(count); | 461 | msg=tr("Really copy\n%1 files?").arg(count); |
462 | switch ( QMessageBox::warning(this,tr("Delete"),msg | 462 | switch ( QMessageBox::warning(this,tr("Delete"),msg |
463 | ,tr("Yes"),tr("No"),0,0,1) ) { | 463 | ,tr("Yes"),tr("No"),0,0,1) ) { |
464 | case 0: | 464 | case 0: |
465 | doMsg=false; | 465 | doMsg=false; |
466 | break; | 466 | break; |
467 | case 1: | 467 | case 1: |
468 | return; | 468 | return; |
469 | break; | 469 | break; |
470 | }; | 470 | }; |
471 | } | 471 | } |
472 | 472 | ||
473 | QString curFile, item, destFile; | 473 | QString curFile, item, destFile; |
474 | if (TabWidget->getCurrentTab() == 0) { | 474 | if (TabWidget->getCurrentTab() == 0) { |
475 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 475 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
476 | item=(*it); | 476 | item=(*it); |
477 | if(item.find("->",0,TRUE)) //symlink | 477 | if(item.find("->",0,TRUE)) //symlink |
478 | item = item.left(item.find("->",0,TRUE)); | 478 | item = item.left(item.find("->",0,TRUE)); |
479 | 479 | ||
480 | destFile = currentRemoteDir.canonicalPath()+"/"+ item; | 480 | destFile = currentRemoteDir.canonicalPath()+"/"+ item; |
481 | qDebug("Destination file is "+destFile); | 481 | qDebug("Destination file is "+destFile); |
482 | 482 | ||
483 | curFile = currentDir.canonicalPath()+"/"+ item; | 483 | curFile = currentDir.canonicalPath()+"/"+ item; |
484 | qDebug("CurrentFile file is " + curFile); | 484 | qDebug("CurrentFile file is " + curFile); |
485 | 485 | ||
486 | QFile f(destFile); | 486 | QFile f(destFile); |
487 | if( f.exists()) { | 487 | if( f.exists()) { |
488 | if(doMsg) { | 488 | if(doMsg) { |
489 | switch ( QMessageBox::warning(this,tr("File Exists!"), | 489 | switch ( QMessageBox::warning(this,tr("File Exists!"), tr("%1 exists. Ok to overwrite?").arg( item ), tr("Yes"),tr("No"),0,0,1) ) { |
490 | item+tr("\nexists. Ok to overwrite?"), | ||
491 | tr("Yes"),tr("No"),0,0,1) ) { | ||
492 | case 1: | 490 | case 1: |
493 | return; | 491 | return; |
494 | break; | 492 | break; |
495 | }; | 493 | }; |
496 | } | 494 | } |
497 | f.remove(); | 495 | f.remove(); |
498 | } | 496 | } |
499 | if(!copyFile( curFile, destFile) ) { | 497 | if(!copyFile( curFile, destFile) ) { |
500 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | 498 | QMessageBox::message("AdvancedFm",tr( "Could not copy %1 to %2").arg( curFile ).arg( destFile ) ); |
501 | return; | 499 | return; |
502 | } | 500 | } |
503 | } | 501 | } |
504 | populateRemoteView(); | 502 | populateRemoteView(); |
505 | TabWidget->setCurrentTab(1); | 503 | TabWidget->setCurrentTab(1); |
506 | 504 | ||
507 | } else { | 505 | } else { |
508 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 506 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
509 | item= (*it); | 507 | item= (*it); |
510 | if(item.find("->",0,TRUE)) //symlink | 508 | if(item.find("->",0,TRUE)) //symlink |
511 | item = item.left(item.find("->",0,TRUE)); | 509 | item = item.left(item.find("->",0,TRUE)); |
512 | 510 | ||
513 | destFile = currentDir.canonicalPath()+"/"+ item; | 511 | destFile = currentDir.canonicalPath()+"/"+ item; |
514 | qDebug("Destination file is "+destFile); | 512 | qDebug("Destination file is "+destFile); |
515 | 513 | ||
516 | curFile = currentRemoteDir.canonicalPath()+"/"+ item;; | 514 | curFile = currentRemoteDir.canonicalPath()+"/"+ item;; |
517 | qDebug("CurrentFile file is " + curFile); | 515 | qDebug("CurrentFile file is " + curFile); |
518 | 516 | ||
519 | QFile f(destFile); | 517 | QFile f(destFile); |
520 | if( f.exists()) { | 518 | if( f.exists()) { |
521 | switch ( QMessageBox::warning(this,tr("File Exists!"), | 519 | switch ( QMessageBox::warning(this,tr("File Exists!"), |
522 | item+tr("\nexists. Ok to overwrite?"), | 520 | item+tr("\nexists. Ok to overwrite?"), |
523 | tr("Yes"),tr("No"),0,0,1) ) { | 521 | tr("Yes"),tr("No"),0,0,1) ) { |
524 | case 1: | 522 | case 1: |
525 | return; | 523 | return; |
526 | break; | 524 | break; |
527 | }; | 525 | }; |
528 | f.remove(); | 526 | f.remove(); |
529 | } | 527 | } |
530 | if(!copyFile( curFile, destFile) ) { | 528 | if(!copyFile( curFile, destFile) ) { |
531 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 529 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
532 | +curFile +tr("to\n")+destFile); | 530 | +curFile +tr("to\n")+destFile); |
533 | return; | 531 | return; |
534 | 532 | ||
535 | } | 533 | } |
536 | } | 534 | } |
537 | populateLocalView(); | 535 | populateLocalView(); |
538 | TabWidget->setCurrentTab(0); | 536 | TabWidget->setCurrentTab(0); |
539 | } | 537 | } |
540 | 538 | ||
541 | } | 539 | } |
542 | } | 540 | } |
543 | 541 | ||
544 | void AdvancedFm::copyAs() { | 542 | void AdvancedFm::copyAs() { |
545 | qApp->processEvents(); | 543 | qApp->processEvents(); |
546 | 544 | ||
547 | QStringList curFileList = getPath(); | 545 | QStringList curFileList = getPath(); |
548 | QString curFile, item; | 546 | QString curFile, item; |
549 | InputDialog *fileDlg; | 547 | InputDialog *fileDlg; |
550 | if (TabWidget->getCurrentTab() == 0) { | 548 | if (TabWidget->getCurrentTab() == 0) { |
551 | qDebug("tab 1"); | 549 | qDebug("tab 1"); |
552 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 550 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
553 | QString destFile; | 551 | QString destFile; |
554 | item=(*it); | 552 | item=(*it); |
555 | curFile = currentDir.canonicalPath()+"/"+(*it); | 553 | curFile = currentDir.canonicalPath()+"/"+(*it); |
556 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); | 554 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); |
557 | 555 | ||
558 | fileDlg->setInputText((const QString &) destFile ); | 556 | fileDlg->setInputText((const QString &) destFile ); |
559 | fileDlg->exec(); | 557 | fileDlg->exec(); |
560 | 558 | ||
561 | if( fileDlg->result() == 1 ) { | 559 | if( fileDlg->result() == 1 ) { |
562 | QString filename = fileDlg->LineEdit1->text(); | 560 | QString filename = fileDlg->LineEdit1->text(); |
563 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; | 561 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; |
564 | 562 | ||
565 | QFile f(destFile); | 563 | QFile f(destFile); |
566 | if( f.exists()) { | 564 | if( f.exists()) { |
567 | switch (QMessageBox::warning(this,tr("File Exists!"), | 565 | switch (QMessageBox::warning(this,tr("File Exists!"), |
568 | item+tr("\nexists. Ok to overwrite?"), | 566 | item+tr("\nexists. Ok to overwrite?"), |
569 | tr("Yes"),tr("No"),0,0,1) ) { | 567 | tr("Yes"),tr("No"),0,0,1) ) { |
570 | case 0: | 568 | case 0: |
571 | f.remove(); | 569 | f.remove(); |
572 | break; | 570 | break; |
573 | case 1: | 571 | case 1: |
574 | return; | 572 | return; |
575 | break; | 573 | break; |
576 | }; | 574 | }; |
577 | } | 575 | } |
578 | if(!copyFile( curFile,destFile) ) { | 576 | if(!copyFile( curFile,destFile) ) { |
579 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 577 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
580 | +curFile +tr("to\n")+destFile); | 578 | +curFile +tr("to\n")+destFile); |
581 | return; | 579 | return; |
582 | } | 580 | } |
583 | } | 581 | } |
584 | delete fileDlg; | 582 | delete fileDlg; |
585 | 583 | ||
586 | } | 584 | } |
587 | populateRemoteView(); | 585 | populateRemoteView(); |
588 | TabWidget->setCurrentTab(1); | 586 | TabWidget->setCurrentTab(1); |
589 | 587 | ||
590 | } else { | 588 | } else { |
591 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 589 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
592 | 590 | ||
593 | item=(*it); | 591 | item=(*it); |
594 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 592 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
595 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); | 593 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); |
596 | 594 | ||
597 | QString destFile; | 595 | QString destFile; |
598 | fileDlg->setInputText((const QString &) destFile); | 596 | fileDlg->setInputText((const QString &) destFile); |
599 | fileDlg->exec(); | 597 | fileDlg->exec(); |
600 | 598 | ||
601 | if( fileDlg->result() == 1 ) { | 599 | if( fileDlg->result() == 1 ) { |
602 | QString filename = fileDlg->LineEdit1->text(); | 600 | QString filename = fileDlg->LineEdit1->text(); |
603 | destFile = currentDir.canonicalPath()+"/"+filename; | 601 | destFile = currentDir.canonicalPath()+"/"+filename; |
604 | 602 | ||
605 | QFile f( destFile); | 603 | QFile f( destFile); |
606 | if( f.exists()) { | 604 | if( f.exists()) { |
607 | switch ( QMessageBox::warning(this,tr("File Exists!"), | 605 | switch ( QMessageBox::warning(this,tr("File Exists!"), |
608 | item+tr("\nexists. Ok to overwrite?"), | 606 | item+tr("\nexists. Ok to overwrite?"), |
609 | tr("Yes"),tr("No"),0,0,1) ) { | 607 | tr("Yes"),tr("No"),0,0,1) ) { |
610 | case 0: | 608 | case 0: |
611 | f.remove(); | 609 | f.remove(); |
612 | break; | 610 | break; |
613 | case 1: | 611 | case 1: |
614 | return; | 612 | return; |
615 | break; | 613 | break; |
616 | }; | 614 | }; |
617 | } | 615 | } |
618 | if(!copyFile( curFile,destFile) ) { | 616 | if(!copyFile( curFile,destFile) ) { |
619 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 617 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
620 | +curFile +tr("to\n")+destFile); | 618 | +curFile +tr("to\n")+destFile); |
621 | return; | 619 | return; |
622 | } | 620 | } |
623 | 621 | ||
624 | } | 622 | } |
625 | delete fileDlg; | 623 | delete fileDlg; |
626 | 624 | ||
627 | } | 625 | } |
628 | populateLocalView(); | 626 | populateLocalView(); |
629 | TabWidget->setCurrentTab(0); | 627 | TabWidget->setCurrentTab(0); |
630 | } | 628 | } |
631 | } | 629 | } |
632 | 630 | ||
633 | void AdvancedFm::copySameDir() { | 631 | void AdvancedFm::copySameDir() { |
634 | qApp->processEvents(); | 632 | qApp->processEvents(); |
635 | QStringList curFileList = getPath(); | 633 | QStringList curFileList = getPath(); |
636 | QString curFile, item, destFile; | 634 | QString curFile, item, destFile; |
637 | InputDialog *fileDlg; | 635 | InputDialog *fileDlg; |
638 | 636 | ||
639 | if (TabWidget->getCurrentTab() == 0) { | 637 | if (TabWidget->getCurrentTab() == 0) { |
640 | 638 | ||
641 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 639 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
642 | item=(*it); | 640 | item=(*it); |
643 | curFile = currentDir.canonicalPath()+"/"+ item; | 641 | curFile = currentDir.canonicalPath()+"/"+ item; |
644 | 642 | ||
645 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); | 643 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); |
646 | fileDlg->setInputText((const QString &) destFile ); | 644 | fileDlg->setInputText((const QString &) destFile ); |
647 | fileDlg->exec(); | 645 | fileDlg->exec(); |
648 | 646 | ||
649 | if( fileDlg->result() == 1 ) { | 647 | if( fileDlg->result() == 1 ) { |
650 | 648 | ||
651 | QString filename = fileDlg->LineEdit1->text(); | 649 | QString filename = fileDlg->LineEdit1->text(); |
652 | destFile = currentDir.canonicalPath()+"/"+filename; | 650 | destFile = currentDir.canonicalPath()+"/"+filename; |
653 | 651 | ||
654 | QFile f(destFile); | 652 | QFile f(destFile); |
655 | if( f.exists()) { | 653 | if( f.exists()) { |
656 | switch (QMessageBox::warning(this,tr("Delete"), | 654 | switch (QMessageBox::warning(this,tr("Delete"), |
657 | destFile+tr(" already exists.\nDo you really want to delete it?"), | 655 | destFile+tr(" already exists.\nDo you really want to delete it?"), |
658 | tr("Yes"),tr("No"),0,0,1) ) { | 656 | tr("Yes"),tr("No"),0,0,1) ) { |
659 | case 0: | 657 | case 0: |
660 | 658 | ||
661 | f.remove(); | 659 | f.remove(); |
662 | break; | 660 | break; |
663 | case 1: | 661 | case 1: |
664 | return; | 662 | return; |
665 | break; | 663 | break; |
666 | }; | 664 | }; |
667 | } | 665 | } |
668 | if(!copyFile( curFile,destFile) ) { | 666 | if(!copyFile( curFile,destFile) ) { |
669 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 667 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
670 | +curFile +tr("to\n")+destFile); | 668 | +curFile +tr("to\n")+destFile); |
671 | return; | 669 | return; |
672 | } | 670 | } |
673 | 671 | ||
674 | qDebug("copy "+curFile+" as "+destFile); | 672 | qDebug("copy "+curFile+" as "+destFile); |
675 | } | 673 | } |
676 | delete fileDlg; | 674 | delete fileDlg; |
677 | } | 675 | } |
678 | populateLocalView(); | 676 | populateLocalView(); |
679 | 677 | ||
680 | } else { | 678 | } else { |
681 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 679 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
682 | item=(*it); | 680 | item=(*it); |
683 | curFile = currentRemoteDir.canonicalPath()+"/"+ item; | 681 | curFile = currentRemoteDir.canonicalPath()+"/"+ item; |
684 | 682 | ||
685 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); | 683 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); |
686 | fileDlg->setInputText((const QString &) destFile); | 684 | fileDlg->setInputText((const QString &) destFile); |
687 | fileDlg->exec(); | 685 | fileDlg->exec(); |
688 | if( fileDlg->result() == 1 ) { | 686 | if( fileDlg->result() == 1 ) { |
689 | QString filename = fileDlg->LineEdit1->text(); | 687 | QString filename = fileDlg->LineEdit1->text(); |
690 | 688 | ||
691 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; | 689 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; |
692 | 690 | ||