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 | Q_D(FileCopyJob); | | |||
582 | | ||||
583 | // If we are interrupted in the middle of file copying, | | |||
584 | // we may end up with corrupted file at the destination. | | |||
585 | // 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 | | |||
587 | // source file is intact (m_delJob == NULL). | | |||
588 | if (d->m_bFileCopyInProgress && d->m_copyJob && d->m_dest.isLocalFile()) { | | |||
589 | if (d->m_flags & Overwrite) { | | |||
590 | QFile::remove(d->m_dest.toLocalFile() + QStringLiteral(".part")); | | |||
591 | } else { | | |||
592 | QFile::remove(d->m_dest.toLocalFile()); | | |||
593 | } | | |||
594 | } | | |||
595 | | ||||
596 | return Job::doKill(); | 581 | return Job::doKill(); | ||
597 | } | 582 | } | ||
598 | 583 | | |||
599 | FileCopyJob *KIO::file_copy(const QUrl &src, const QUrl &dest, int permissions, | 584 | FileCopyJob *KIO::file_copy(const QUrl &src, const QUrl &dest, int permissions, | ||
600 | JobFlags flags) | 585 | JobFlags flags) | ||
601 | { | 586 | { | ||
602 | return FileCopyJobPrivate::newJob(src, dest, permissions, false, flags); | 587 | return FileCopyJobPrivate::newJob(src, dest, permissions, false, flags); | ||
603 | } | 588 | } | ||
Show All 12 Lines |