Commit 05f3e990 authored by Andre Heinecke's avatar Andre Heinecke
Browse files

Make ASCII Armor for files configurable

parent 0c94da23
......@@ -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) {
......
......@@ -65,7 +65,8 @@ private:
QCheckBox *mQuickEncryptCB,
*mQuickSignCB,
*mPGPFileExtCB,
*mAutoDecryptVerifyCB;
*mAutoDecryptVerifyCB,
*mASCIIArmorCB;
QComboBox *mChecksumDefinitionCB,
*mArchiveDefinitionCB;
};
......
......@@ -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) {
......
......@@ -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>
Supports Markdown
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