diff --git a/plugins/libarchive/readwritelibarchiveplugin.cpp b/plugins/libarchive/readwritelibarchiveplugin.cpp --- a/plugins/libarchive/readwritelibarchiveplugin.cpp +++ b/plugins/libarchive/readwritelibarchiveplugin.cpp @@ -184,6 +184,18 @@ QLatin1String(archive_error_string(arch_writer.data())))); 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:%1", + QLatin1String(archive_error_string(arch_writer.data())))); + return false; + } + } } ret = archive_write_open_fd(arch_writer.data(), tempFile.handle());