Commit b564e0ac authored by Alexey Ivanov's avatar Alexey Ivanov 🐢 Committed by Elvis Angelaccio
Browse files

libzipplugin: hack for zstd max compression method.

parent 18698b25
......@@ -27,7 +27,6 @@
#include "compressionoptionswidget.h"
#include "ark_debug.h"
#include "archiveformat.h"
#include "pluginmanager.h"
#include "settings.h"
......@@ -110,10 +109,15 @@ QString CompressionOptionsWidget::password() const
return pwdWidget->password();
}
void CompressionOptionsWidget::updateWidgets()
ArchiveFormat CompressionOptionsWidget::getArchiveFormat() const
{
const KPluginMetaData metadata = PluginManager().preferredPluginFor(m_mimetype)->metaData();
const ArchiveFormat archiveFormat = ArchiveFormat::fromMetadata(m_mimetype, metadata);
return ArchiveFormat::fromMetadata(m_mimetype, metadata);
}
void CompressionOptionsWidget::updateWidgets()
{
const ArchiveFormat archiveFormat = getArchiveFormat();
Q_ASSERT(archiveFormat.isValid());
if (archiveFormat.encryptionType() != Archive::Unencrypted) {
......@@ -283,7 +287,19 @@ void CompressionOptionsWidget::slotCompMethodChanged(const QString &value)
} else {
encMethodComboBox->insertItem(0, QStringLiteral("AES256"));
}
}
const ArchiveFormat archiveFormat = getArchiveFormat();
Q_ASSERT(archiveFormat.isValid());
if (m_mimetype == QMimeDatabase().mimeTypeForName(QStringLiteral("application/zip"))) {
if (value == QLatin1String("Zstd")) {
compLevelSlider->setMaximum(22);
}
else {
compLevelSlider->setMaximum(archiveFormat.maxCompressionLevel());
}
}
}
......
......@@ -30,6 +30,7 @@
#include "kerfuffle_export.h"
#include "archive_kerfuffle.h"
#include "archiveformat.h"
#include "ui_compressionoptionswidget.h"
#include <QMimeType>
......@@ -61,6 +62,7 @@ public:
private:
void updateWidgets();
ArchiveFormat getArchiveFormat() const;
QMimeType m_mimetype;
CompressionOptions m_opts;
......
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