summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElvis Angelaccio <[email protected]>2018-02-25 17:19:19 +0100
committerElvis Angelaccio <[email protected]>2018-02-25 23:52:54 +0100
commitef5c38a3f7465b640fa80f587068f662df27e680 (patch)
tree6cb037eb283a35111bb804ebd0fbdbc309060d92
parentb1a251ebb96b86c8cba83343719fa8e67ab4ee9b (diff)
LoadJob: check result in onFinished()
It doesn't make sense to set these properties if loading the archive failed. This also allows to fix the expected values of a testcase.
-rw-r--r--autotests/kerfuffle/loadtest.cpp4
-rw-r--r--kerfuffle/jobs.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/autotests/kerfuffle/loadtest.cpp b/autotests/kerfuffle/loadtest.cpp
index 858d408..b415735 100644
--- a/autotests/kerfuffle/loadtest.cpp
+++ b/autotests/kerfuffle/loadtest.cpp
@@ -62,8 +62,8 @@ void LoadTest::testProperties_data()
QTest::newRow("non-existent tar archive")
<< QStringLiteral("/tmp/foo.tar.gz")
<< QStringLiteral("foo")
- << false << false << false << true << false << 0 << Archive::Unencrypted
- << QStringLiteral("foo");
+ << false << false << false << false << false << 0 << Archive::Unencrypted
+ << QString();
// Test non-archive file
QTest::newRow("not an archive")
diff --git a/kerfuffle/jobs.cpp b/kerfuffle/jobs.cpp
index 83bd2ab..2dfe18b 100644
--- a/kerfuffle/jobs.cpp
+++ b/kerfuffle/jobs.cpp
@@ -279,7 +279,7 @@ void LoadJob::doWork()
void LoadJob::onFinished(bool result)
{
- if (archive()) {
+ if (archive() && result) {
archive()->setProperty("unpackedSize", extractedFilesSize());
archive()->setProperty("isSingleFolder", isSingleFolderArchive());
const auto name = subfolderName().isEmpty() ? archive()->completeBaseName() : subfolderName();