summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRagnar Thomsen <[email protected]>2016-07-08 18:57:30 +0200
committerRagnar Thomsen <[email protected]>2016-07-08 18:57:30 +0200
commit802a397932e0ec085882945983bf03c1e432f2ac (patch)
tree79c3fb43be3c35517bcfb3d376a91f7fe619041b
parent50f0cbb42dd28850e99ed8f17769d87a639c7469 (diff)
libarchiveplugin: Also set compression level when adding files
Previously, the compresion level was only set when creating new archives.
-rw-r--r--plugins/libarchive/readwritelibarchiveplugin.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/plugins/libarchive/readwritelibarchiveplugin.cpp b/plugins/libarchive/readwritelibarchiveplugin.cpp
index 565bea9..32a7772 100644
--- a/plugins/libarchive/readwritelibarchiveplugin.cpp
+++ b/plugins/libarchive/readwritelibarchiveplugin.cpp
@@ -147,18 +147,6 @@ bool ReadWriteLibarchivePlugin::addFiles(const QStringList& files, const Compres
return false;
}
- // Set compression level if passed in CompressionOptions.
- if (options.contains(QStringLiteral("CompressionLevel"))) {
- qCDebug(ARK) << "Using compression level:" << options.value(QStringLiteral("CompressionLevel")).toString();
- ret = archive_write_set_filter_option(arch_writer.data(), NULL, "compression-level", options.value(QStringLiteral("CompressionLevel")).toString().toUtf8());
- if (ret != ARCHIVE_OK) {
- qCWarning(ARK) << "Failed to set compression level";
- emit error(xi18nc("@info", "Setting the compression level failed with the following error:<nl/><message>%1</message>",
- QLatin1String(archive_error_string(arch_writer.data()))));
- return false;
- }
- }
-
} else {
switch (archive_filter_code(arch_reader.data(), 0)) {
case ARCHIVE_FILTER_GZIP:
@@ -210,6 +198,18 @@ bool ReadWriteLibarchivePlugin::addFiles(const QStringList& files, const Compres
}
}
+ // Set compression level if passed in CompressionOptions.
+ if (options.contains(QStringLiteral("CompressionLevel"))) {
+ qCDebug(ARK) << "Using compression level:" << options.value(QStringLiteral("CompressionLevel")).toString();
+ ret = archive_write_set_filter_option(arch_writer.data(), NULL, "compression-level", options.value(QStringLiteral("CompressionLevel")).toString().toUtf8());
+ if (ret != ARCHIVE_OK) {
+ qCWarning(ARK) << "Failed to set compression level";
+ emit error(xi18nc("@info", "Setting the compression level failed with the following error:<nl/><message>%1</message>",
+ QLatin1String(archive_error_string(arch_writer.data()))));
+ return false;
+ }
+ }
+
ret = archive_write_open_fd(arch_writer.data(), tempFile.handle());
if (ret != ARCHIVE_OK) {
emit error(xi18nc("@info", "Opening the archive for writing failed with the following error:<nl/><message>%1</message>",