summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Heinecke <aheinecke@intevation.de>2016-08-10 15:20:46 (GMT)
committerAndre Heinecke <aheinecke@intevation.de>2016-08-10 15:54:22 (GMT)
commit05f3e9901772bfad8e9b54d5adec6d75ea237300 (patch)
tree9acc4eea02bd3ef71a48b0cf6e6d7b842303552b
parent0c94da233d620bfd48f5728450052fdb69aafaee (diff)
Make ASCII Armor for files configurable
-rw-r--r--src/conf/cryptooperationsconfigwidget.cpp8
-rw-r--r--src/conf/cryptooperationsconfigwidget.h3
-rw-r--r--src/crypto/signencryptfilescontroller.cpp16
-rw-r--r--src/kcfg/fileoperationspreferences.kcfg5
4 files changed, 25 insertions, 7 deletions
diff --git a/src/conf/cryptooperationsconfigwidget.cpp b/src/conf/cryptooperationsconfigwidget.cpp
index 3de49bc..ff40a35 100644
--- a/src/conf/cryptooperationsconfigwidget.cpp
+++ b/src/conf/cryptooperationsconfigwidget.cpp
@@ -84,9 +84,14 @@ void CryptoOperationsConfigWidget::setupGui()
QGroupBox *fileGrp = new QGroupBox(i18n("File Operations"));
QVBoxLayout *fileGrpLay = new QVBoxLayout;
mPGPFileExtCB = new QCheckBox(i18n("Create OpenPGP encrypted files with \".pgp\" file extensions instead of \".gpg\""));
+ mASCIIArmorCB = new QCheckBox(i18n("Create signed and or encrypted files as text files."));
+ mASCIIArmorCB->setToolTip(i18nc("@info", "Set this option to encode encrypted and or signed files as base64 encoded text. "
+ "So that they can be opened with an editor or sent in a mail body. "
+ "This will increase file size by one third."));
mAutoDecryptVerifyCB = new QCheckBox(i18n("Automatically start operation based on input detection for decrypt/verify."));
fileGrpLay->addWidget(mPGPFileExtCB);
fileGrpLay->addWidget(mAutoDecryptVerifyCB);
+ fileGrpLay->addWidget(mASCIIArmorCB);
QGridLayout *comboLay = new QGridLayout;
QLabel *chkLabel = new QLabel(i18n("Checksum program to use when creating checksum files:"));
@@ -121,6 +126,7 @@ void CryptoOperationsConfigWidget::setupGui()
this, &CryptoOperationsConfigWidget::changed);
connect(mPGPFileExtCB, &QCheckBox::toggled, this, &CryptoOperationsConfigWidget::changed);
connect(mAutoDecryptVerifyCB, &QCheckBox::toggled, this, &CryptoOperationsConfigWidget::changed);
+ connect(mASCIIArmorCB, &QCheckBox::toggled, this, &CryptoOperationsConfigWidget::changed);
}
CryptoOperationsConfigWidget::~CryptoOperationsConfigWidget() {}
@@ -158,6 +164,7 @@ void CryptoOperationsConfigWidget::load()
const FileOperationsPreferences filePrefs;
mPGPFileExtCB->setChecked(filePrefs.usePGPFileExt());
mAutoDecryptVerifyCB->setChecked(filePrefs.autoDecryptVerify());
+ mASCIIArmorCB->setChecked(filePrefs.addASCIIArmor());
const std::vector< shared_ptr<ChecksumDefinition> > cds = ChecksumDefinition::getChecksumDefinitions();
const shared_ptr<ChecksumDefinition> default_cd = ChecksumDefinition::getDefaultChecksumDefinition(cds);
@@ -203,6 +210,7 @@ void CryptoOperationsConfigWidget::save()
FileOperationsPreferences filePrefs;
filePrefs.setUsePGPFileExt(mPGPFileExtCB->isChecked());
filePrefs.setAutoDecryptVerify(mAutoDecryptVerifyCB->isChecked());
+ filePrefs.setAddASCIIArmor(mASCIIArmorCB->isChecked());
const int idx = mChecksumDefinitionCB->currentIndex();
if (idx >= 0) {
diff --git a/src/conf/cryptooperationsconfigwidget.h b/src/conf/cryptooperationsconfigwidget.h
index 7cdab12..80f5c4b 100644
--- a/src/conf/cryptooperationsconfigwidget.h
+++ b/src/conf/cryptooperationsconfigwidget.h
@@ -65,7 +65,8 @@ private:
QCheckBox *mQuickEncryptCB,
*mQuickSignCB,
*mPGPFileExtCB,
- *mAutoDecryptVerifyCB;
+ *mAutoDecryptVerifyCB,
+ *mASCIIArmorCB;
QComboBox *mChecksumDefinitionCB,
*mArchiveDefinitionCB;
};
diff --git a/src/crypto/signencryptfilescontroller.cpp b/src/crypto/signencryptfilescontroller.cpp
index af2ec76..daeea1f 100644
--- a/src/crypto/signencryptfilescontroller.cpp
+++ b/src/crypto/signencryptfilescontroller.cpp
@@ -323,11 +323,14 @@ static QMap <int, QString> buildOutputNames(const QStringList &files)
} else {
baseNameCms = baseNamePgp = files.first() + QStringLiteral(".");
}
- nameMap.insert(SignEncryptFilesWizard::SignatureCMS, baseNameCms + extension(false, true, false, false, true));
- nameMap.insert(SignEncryptFilesWizard::EncryptedCMS, baseNameCms + extension(false, false, true, false, false));
- nameMap.insert(SignEncryptFilesWizard::CombinedPGP, baseNamePgp + extension(true, true, true, false, false));
- nameMap.insert(SignEncryptFilesWizard::EncryptedPGP, baseNamePgp + extension(true, false, true, false, false));
- nameMap.insert(SignEncryptFilesWizard::SignaturePGP, baseNamePgp + extension(true, true, false, false, true));
+ const FileOperationsPreferences prefs;
+ const bool ascii = prefs.addASCIIArmor();
+
+ nameMap.insert(SignEncryptFilesWizard::SignatureCMS, baseNameCms + extension(false, true, false, ascii, true));
+ nameMap.insert(SignEncryptFilesWizard::EncryptedCMS, baseNameCms + extension(false, false, true, ascii, false));
+ nameMap.insert(SignEncryptFilesWizard::CombinedPGP, baseNamePgp + extension(true, true, true, ascii, false));
+ nameMap.insert(SignEncryptFilesWizard::EncryptedPGP, baseNamePgp + extension(true, false, true, ascii, false));
+ nameMap.insert(SignEncryptFilesWizard::SignaturePGP, baseNamePgp + extension(true, true, false, ascii, true));
return nameMap;
}
@@ -517,7 +520,8 @@ void SignEncryptFilesController::Private::slotWizardOperationPrepared()
const QVector<Key> recipients = wizard->resolvedRecipients();
const QVector<Key> signers = wizard->resolvedSigners();
- const bool ascii = false; /* TODO andre config */
+ const FileOperationsPreferences prefs;
+ const bool ascii = prefs.addASCIIArmor();
QVector<Key> pgpRecipients, cmsRecipients, pgpSigners, cmsSigners;
Q_FOREACH (const Key k, recipients) {
diff --git a/src/kcfg/fileoperationspreferences.kcfg b/src/kcfg/fileoperationspreferences.kcfg
index aec5dce..11a4779 100644
--- a/src/kcfg/fileoperationspreferences.kcfg
+++ b/src/kcfg/fileoperationspreferences.kcfg
@@ -21,5 +21,10 @@
<whatsthis>When encrypting multiple files or a folder Kleopatra creates an encrypted archive with this command.</whatsthis>
<default>tar</default>
</entry>
+ <entry name="AddASCIIArmor" key="ascii-armor" type="Bool">
+ <label>Create signed and or encrypted files as text files.</label>
+ <whatsthis>Set this option to encode encrypted and or signed files as base64 encoded text. So that they can be opened with an editor or sent in a mail body. This will increase file size by one third.</whatsthis>
+ <default>false</default>
+ </entry>
</group>
</kcfg>