Changeset View
Changeset View
Standalone View
Standalone View
src/core/filecopyjob.cpp
Show First 20 Lines • Show All 572 Lines • ▼ Show 20 Line(s) | 472 | { | |||
---|---|---|---|---|---|
573 | 573 | | |||
574 | if (!hasSubjobs()) { | 574 | if (!hasSubjobs()) { | ||
575 | emitResult(); | 575 | emitResult(); | ||
576 | } | 576 | } | ||
577 | } | 577 | } | ||
578 | 578 | | |||
579 | bool FileCopyJob::doKill() | 579 | bool FileCopyJob::doKill() | ||
580 | { | 580 | { | ||
581 | #ifdef Q_OS_WIN | ||||
582 | //TODO Use SetConsoleCtrlHandler on Windows or similar behaviour. | ||||
583 | // https://stackoverflow.com/questions/2007516/is-there-a-posix-sigterm-alternative-on-windows-a-gentle-kill-for-console-ap | ||||
584 | // https://danielkaes.wordpress.com/2009/06/04/how-to-catch-kill-events-with-python/ | ||||
585 | // https://phabricator.kde.org/D25117#566107 | ||||
586 | | ||||
581 | Q_D(FileCopyJob); | 587 | Q_D(FileCopyJob); | ||
582 | 588 | | |||
583 | // If we are interrupted in the middle of file copying, | 589 | // If we are interrupted in the middle of file copying, | ||
584 | // we may end up with corrupted file at the destination. | 590 | // we may end up with corrupted file at the destination. | ||
585 | // It is better to clean up this file. If a copy is being | 591 | // It is better to clean up this file. If a copy is being | ||
586 | // made as part of move operation then delete the dest only if | 592 | // made as part of move operation then delete the dest only if | ||
587 | // source file is intact (m_delJob == NULL). | 593 | // source file is intact (m_delJob == NULL). | ||
588 | if (d->m_bFileCopyInProgress && d->m_copyJob && d->m_dest.isLocalFile()) { | 594 | if (d->m_bFileCopyInProgress && d->m_copyJob && d->m_dest.isLocalFile()) { | ||
589 | if (d->m_flags & Overwrite) { | 595 | if (d->m_flags & Overwrite) { | ||
590 | QFile::remove(d->m_dest.toLocalFile() + QStringLiteral(".part")); | 596 | QFile::remove(d->m_dest.toLocalFile() + QStringLiteral(".part")); | ||
591 | } else { | 597 | } else { | ||
592 | QFile::remove(d->m_dest.toLocalFile()); | 598 | QFile::remove(d->m_dest.toLocalFile()); | ||
593 | } | 599 | } | ||
594 | } | 600 | } | ||
595 | 601 | #endif | |||
596 | return Job::doKill(); | 602 | return Job::doKill(); | ||
597 | } | 603 | } | ||
598 | 604 | | |||
599 | FileCopyJob *KIO::file_copy(const QUrl &src, const QUrl &dest, int permissions, | 605 | FileCopyJob *KIO::file_copy(const QUrl &src, const QUrl &dest, int permissions, | ||
600 | JobFlags flags) | 606 | JobFlags flags) | ||
601 | { | 607 | { | ||
602 | return FileCopyJobPrivate::newJob(src, dest, permissions, false, flags); | 608 | return FileCopyJobPrivate::newJob(src, dest, permissions, false, flags); | ||
603 | } | 609 | } | ||
Show All 12 Lines |