summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElvis Angelaccio <elvis.angelaccio@kde.org>2016-11-15 18:14:57 (GMT)
committerElvis Angelaccio <elvis.angelaccio@kde.org>2016-11-15 18:14:57 (GMT)
commit046b209258456a2e81b1c06e3b6601a4f77432f8 (patch)
tree1d1dbe533d04e5e230775c67b0b828855a69b8a7
parentca57e721819ff05d5f2d8367eb65b5bbafe1bb5a (diff)
Show warning when using AES encryption with zip
This shows a messagewidget with Warning type above the encryption method combobox. The message is shown only when using AES with zip archives. Differential Revision: D3359
-rw-r--r--kerfuffle/compressionoptionswidget.cpp12
-rw-r--r--kerfuffle/compressionoptionswidget.h1
-rw-r--r--kerfuffle/compressionoptionswidget.ui23
3 files changed, 32 insertions, 4 deletions
diff --git a/kerfuffle/compressionoptionswidget.cpp b/kerfuffle/compressionoptionswidget.cpp
index df8a997..56e35a8 100644
--- a/kerfuffle/compressionoptionswidget.cpp
+++ b/kerfuffle/compressionoptionswidget.cpp
@@ -50,6 +50,7 @@ CompressionOptionsWidget::CompressionOptionsWidget(QWidget *parent,
connect(multiVolumeCheckbox, &QCheckBox::stateChanged, this, &CompressionOptionsWidget::slotMultiVolumeChecked);
connect(compMethodComboBox, &QComboBox::currentTextChanged, this, &CompressionOptionsWidget::slotCompMethodChanged);
+ connect(encMethodComboBox, &QComboBox::currentTextChanged, this, &CompressionOptionsWidget::slotEncryptionMethodChanged);
if (m_opts.isVolumeSizeSet()) {
multiVolumeCheckbox->setChecked(true);
@@ -283,4 +284,15 @@ void CompressionOptionsWidget::slotCompMethodChanged(const QString &value)
}
}
+void CompressionOptionsWidget::slotEncryptionMethodChanged(const QString &value)
+{
+ if (value.isEmpty() || m_mimetype != QMimeDatabase().mimeTypeForName(QStringLiteral("application/zip"))) {
+ warningMsgWidget->hide();
+ return;
+ }
+
+ // AES encryption is not supported by unzip, warn the users if they are creating a zip.
+ warningMsgWidget->setVisible(value != QLatin1String("ZipCrypto"));
+}
+
}
diff --git a/kerfuffle/compressionoptionswidget.h b/kerfuffle/compressionoptionswidget.h
index 42dbc51..0c38034 100644
--- a/kerfuffle/compressionoptionswidget.h
+++ b/kerfuffle/compressionoptionswidget.h
@@ -68,6 +68,7 @@ private:
private slots:
void slotMultiVolumeChecked(int state);
void slotCompMethodChanged(const QString &value);
+ void slotEncryptionMethodChanged(const QString &value);
};
}
diff --git a/kerfuffle/compressionoptionswidget.ui b/kerfuffle/compressionoptionswidget.ui
index 14bcdab..d9eea91 100644
--- a/kerfuffle/compressionoptionswidget.ui
+++ b/kerfuffle/compressionoptionswidget.ui
@@ -121,7 +121,7 @@
<bool>false</bool>
</property>
<layout class="QFormLayout" name="formLayout_2">
- <item row="0" column="0">
+ <item row="1" column="0">
<widget class="QLabel" name="lblEncMethod">
<property name="enabled">
<bool>false</bool>
@@ -131,21 +131,21 @@
</property>
</widget>
</item>
- <item row="0" column="1">
+ <item row="1" column="1">
<widget class="QComboBox" name="encMethodComboBox">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
- <item row="1" column="0" colspan="2">
+ <item row="2" column="0" colspan="2">
<widget class="KNewPasswordWidget" name="pwdWidget">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
- <item row="2" column="0" colspan="2">
+ <item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="encryptHeaderCheckBox">
<property name="enabled">
<bool>false</bool>
@@ -161,6 +161,16 @@
</property>
</widget>
</item>
+ <item row="0" column="0" colspan="2">
+ <widget class="KMessageWidget" name="warningMsgWidget">
+ <property name="text">
+ <string>This encryption method may not be supported by older archiving software.</string>
+ </property>
+ <property name="messageType">
+ <enum>KMessageWidget::Warning</enum>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
@@ -246,6 +256,11 @@
<header>knewpasswordwidget.h</header>
<container>1</container>
</customwidget>
+ <customwidget>
+ <class>KMessageWidget</class>
+ <extends>QFrame</extends>
+ <header>kmessagewidget.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>