Commit 92fe1c13 authored by Elvis Angelaccio's avatar Elvis Angelaccio

Mark canceled extractions as killed jobs

If the user canceled an OverwriteQuery dialog, we should not claim the
extraction finished. By emitting the canceled() signal, the extraction
jobs will set the KilledJobError error and the plasma applet will not
show the "Finished" string in the notification.

BUG: 382601
FIXED-IN: 17.12.3

Task: T6707
parent 2af8d35e
......@@ -407,6 +407,7 @@ void CliInterface::extractProcessFinished(int exitCode, QProcess::ExitStatus exi
if (m_extractionOptions.isDragAndDropEnabled()) {
if (!moveDroppedFilesToDest(m_extractedFiles, m_extractDestDir)) {
// FIXME: if the user canceled the overwrite query, we should emit cancelled(), not error().
emit error(i18ncp("@info",
"Could not move the extracted file to the destination directory.",
"Could not move the extracted files to the destination directory.",
......@@ -979,6 +980,7 @@ bool CliInterface::handleFileExistsMessage(const QString& line)
} else if (query.responseAutoSkip()) {
responseToProcess = choices.at(3);
} else if (query.responseCancelled()) {
emit cancelled();
if (choices.count() < 5) { // If the program has no way to cancel the extraction, we resort to killing it
return doKill();
}
......
......@@ -353,6 +353,8 @@ BatchExtractJob::BatchExtractJob(LoadJob *loadJob, const QString &destination, b
void BatchExtractJob::doWork()
{
connect(m_loadJob, &KJob::result, this, &BatchExtractJob::slotLoadingFinished);
connect(archiveInterface(), &ReadOnlyArchiveInterface::cancelled, this, &BatchExtractJob::onCancelled);
if (archiveInterface()->hasBatchExtractionProgress()) {
// progress() will be actually emitted by the LoadJob, but the archiveInterface() is the same.
connect(archiveInterface(), &ReadOnlyArchiveInterface::progress, this, &BatchExtractJob::slotLoadingProgress);
......
......@@ -314,6 +314,7 @@ bool LibarchivePlugin::extractFiles(const QVector<Archive::Entry*> &files, const
query.waitForResponse();
if (query.responseCancelled()) {
emit cancelled();
archive_read_data_skip(m_archiveReader.data());
archive_entry_clear(entry);
break;
......
......@@ -659,6 +659,7 @@ bool LibzipPlugin::extractEntry(zip_t *archive, const QString &entry, const QStr
query.waitForResponse();
if (query.responseCancelled()) {
emit cancelled();
return false;
} else if (query.responseSkip()) {
return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment