[kde-doc-english] [kdepim] /: Delete Chiasmus support from ObjectTreeParser
Sandro Knauß
sknauss at kde.org
Tue Nov 3 09:25:30 UTC 2015
Git commit ac890314f9d859283b2ea7ffae054978bf9ef281 by Sandro Knauß.
Committed on 03/11/2015 at 09:24.
Pushed by knauss into branch 'master'.
Delete Chiasmus support from ObjectTreeParser
M +0 -1 doc/kmail/configure.docbook
M +0 -1 kmail/kmcomposerui.rc
M +0 -2 messageviewer/src/CMakeLists.txt
M +2 -3 messageviewer/src/Mainpage.dox
D +0 -225 messageviewer/src/job/attachmentencryptwithchiasmusjob.cpp
D +0 -60 messageviewer/src/job/attachmentencryptwithchiasmusjob.h
M +0 -2 messageviewer/src/settings/messageviewer.kcfg.cmake
M +0 -2 messageviewer/src/viewer/bodypartformatter.cpp
D +0 -83 messageviewer/src/viewer/chiasmuskeyselector.cpp
D +0 -39 messageviewer/src/viewer/chiasmuskeyselector.h
M +0 -117 messageviewer/src/viewer/objecttreeparser.cpp
M +0 -2 messageviewer/src/viewer/objecttreeparser.h
M +0 -19 messageviewer/src/viewer/viewer_p.cpp
M +0 -1 messageviewer/src/viewer/viewer_p.h
http://commits.kde.org/kdepim/ac890314f9d859283b2ea7ffae054978bf9ef281
diff --git a/doc/kmail/configure.docbook b/doc/kmail/configure.docbook
index 09c2e2f..bb0c82b 100644
--- a/doc/kmail/configure.docbook
+++ b/doc/kmail/configure.docbook
@@ -1843,7 +1843,6 @@ of key words can be modified.</para>
</varlistentry>
<!--
GnuPG Settings
- Chiasmus Settings
-->
<varlistentry id="configure-security-warnings-reenable-all-warnings">
<term>
diff --git a/kmail/kmcomposerui.rc b/kmail/kmcomposerui.rc
index 0237d21..91e897d 100644
--- a/kmail/kmcomposerui.rc
+++ b/kmail/kmcomposerui.rc
@@ -44,7 +44,6 @@
<Separator/>
<Action name="sign_message" />
<Action name="encrypt_message" />
- <Action name="encrypt_message_chiasmus"/>
<Separator/>
<Action name="options_select_crypto" />
<Action name="html"/>
diff --git a/messageviewer/src/CMakeLists.txt b/messageviewer/src/CMakeLists.txt
index 1729091..ffe76da 100644
--- a/messageviewer/src/CMakeLists.txt
+++ b/messageviewer/src/CMakeLists.txt
@@ -75,7 +75,6 @@ set(libmessageviewer_viewer_SRCS
viewer/attachmentstrategy.cpp
viewer/bodypartformatter.cpp
viewer/bodypartformatterfactory.cpp
- viewer/chiasmuskeyselector.cpp
viewer/cryptohelper.cpp
viewer/csshelper.cpp
viewer/csshelperbase.cpp
@@ -170,7 +169,6 @@ set(libmessageviewer_job_SRCS
job/createtodojob.cpp
job/createeventjob.cpp
job/createnotejob.cpp
- job/attachmentencryptwithchiasmusjob.cpp
job/attachmenteditjob.cpp
job/modifymessagedisplayformatjob.cpp
job/kleojobexecutor.cpp
diff --git a/messageviewer/src/Mainpage.dox b/messageviewer/src/Mainpage.dox
index bce8bf7..f56c47b 100644
--- a/messageviewer/src/Mainpage.dox
+++ b/messageviewer/src/Mainpage.dox
@@ -134,9 +134,8 @@ StringUtil or into NodeHelper.
The last utilitly thing are the functions in stl_util.h, which are supposed to be used in
combination with STL algorithms.
-There are a bunch of smaller classes like AutoQPointer, ChiasmusKeySelector, EditorWatcher,
-IconNameCache, KCursorSaver, KleoJobExecutor, KabcBridge and many more. See the full class list if
-you're curious.
+There are a bunch of smaller classes like AutoQPointer, EditorWatcher, IconNameCache, KCursorSaver,
+KleoJobExecutor, KabcBridge and many more. See the full class list if you're curious.
You should also read the documentation of the following classes, which are extensivly documented:
\sa MessageViewer::ViewerPrivate
diff --git a/messageviewer/src/job/attachmentencryptwithchiasmusjob.cpp b/messageviewer/src/job/attachmentencryptwithchiasmusjob.cpp
deleted file mode 100644
index ace6174..0000000
--- a/messageviewer/src/job/attachmentencryptwithchiasmusjob.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- Copyright (c) 2014-2015 Montel Laurent <montel at kde.org>
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License, version 2, as
- published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#include "attachmentencryptwithchiasmusjob.h"
-#include "viewer/chiasmuskeyselector.h"
-#include "messageviewer/messageviewerutil.h"
-#include "settings/messageviewersettings.h"
-
-#include <gpgme++/error.h>
-
-#include <kio/jobuidelegate.h>
-#include <KIO/Job>
-#include <KMessageBox>
-#include <KLocalizedString>
-#include <QFileDialog>
-#include <KJobWidgets>
-
-#include <Libkleo/CryptoBackendFactory>
-#include <Libkleo/CryptoBackend>
-#include <Libkleo/SpecialJob>
-
-using namespace MessageViewer;
-
-static const QString chomp(const QString &base, const QString &suffix, bool cs)
-{
- return base.endsWith(suffix, cs ? (Qt::CaseSensitive) : (Qt::CaseInsensitive)) ? base.left(base.length() - suffix.length()) : base;
-}
-
-AttachmentEncryptWithChiasmusJob::AttachmentEncryptWithChiasmusJob(QObject *parent)
- : QObject(parent),
- mJob(0),
- mMainWindow(0),
- mContent(0)
-{
-
-}
-
-AttachmentEncryptWithChiasmusJob::~AttachmentEncryptWithChiasmusJob()
-{
-
-}
-
-void AttachmentEncryptWithChiasmusJob::setContent(KMime::Content *content)
-{
- mContent = content;
-}
-
-void AttachmentEncryptWithChiasmusJob::setCurrentFileName(const QString ¤tFileName)
-{
- mCurrentFileName = currentFileName;
-}
-
-void AttachmentEncryptWithChiasmusJob::setMainWindow(QWidget *mainWindow)
-{
- mMainWindow = mainWindow;
-}
-
-void AttachmentEncryptWithChiasmusJob::start()
-{
- Q_UNUSED(mContent);
-
- // FIXME: better detection of mimetype??
- if (!mCurrentFileName.endsWith(QStringLiteral(".xia"), Qt::CaseInsensitive)) {
- deleteLater();
- return;
- }
-
- const Kleo::CryptoBackend::Protocol *chiasmus =
- Kleo::CryptoBackendFactory::instance()->protocol("Chiasmus");
- Q_ASSERT(chiasmus);
- if (!chiasmus) {
- deleteLater();
- return;
- }
-
- const std::unique_ptr<Kleo::SpecialJob> listjob(chiasmus->specialJob("x-obtain-keys", QMap<QString, QVariant>()));
- if (!listjob.get()) {
- const QString msg = i18n("Chiasmus backend does not offer the "
- "\"x-obtain-keys\" function. Please report this bug.");
- KMessageBox::error(mMainWindow, msg, i18n("Chiasmus Backend Error"));
- deleteLater();
- return;
- }
-
- if (listjob->exec()) {
- listjob->showErrorDialog(mMainWindow, i18n("Chiasmus Backend Error"));
- deleteLater();
- return;
- }
-
- const QVariant result = listjob->property("result");
- if (result.type() != QVariant::StringList) {
- const QString msg = i18n("Unexpected return value from Chiasmus backend: "
- "The \"x-obtain-keys\" function did not return a "
- "string list. Please report this bug.");
- KMessageBox::error(mMainWindow, msg, i18n("Chiasmus Backend Error"));
- deleteLater();
- return;
- }
-
- const QStringList keys = result.toStringList();
- if (keys.empty()) {
- const QString msg = i18n("No keys have been found. Please check that a "
- "valid key path has been set in the Chiasmus "
- "configuration.");
- KMessageBox::error(mMainWindow, msg, i18n("Chiasmus Backend Error"));
- deleteLater();
- return;
- }
- QScopedPointer<ChiasmusKeySelector> selectorDlg(new ChiasmusKeySelector(mMainWindow,
- i18n("Chiasmus Decryption Key Selection"),
- keys, MessageViewer::MessageViewerSettings::chiasmusDecryptionKey(),
- MessageViewer::MessageViewerSettings::chiasmusDecryptionOptions()));
- if (selectorDlg->exec() != QDialog::Accepted || !selectorDlg) {
- deleteLater();
- return;
- }
-
- MessageViewer::MessageViewerSettings::setChiasmusDecryptionOptions(selectorDlg->options());
- MessageViewer::MessageViewerSettings::setChiasmusDecryptionKey(selectorDlg->key());
- assert(!MessageViewer::MessageViewerSettings::chiasmusDecryptionKey().isEmpty());
- Kleo::SpecialJob *job = chiasmus->specialJob("x-decrypt", QMap<QString, QVariant>());
- if (!job) {
- const QString msg = i18n("Chiasmus backend does not offer the "
- "\"x-decrypt\" function. Please report this bug.");
- KMessageBox::error(mMainWindow, msg, i18n("Chiasmus Backend Error"));
- deleteLater();
- return;
- }
-
- //PORT IT
- const QByteArray input;// = node->msgPart().bodyDecodedBinary();
-
- if (!job->setProperty("key", MessageViewer::MessageViewerSettings::chiasmusDecryptionKey()) ||
- !job->setProperty("options", MessageViewer::MessageViewerSettings::chiasmusDecryptionOptions()) ||
- !job->setProperty("input", input)) {
- const QString msg = i18n("The \"x-decrypt\" function does not accept "
- "the expected parameters. Please report this bug.");
- KMessageBox::error(mMainWindow, msg, i18n("Chiasmus Backend Error"));
- deleteLater();
- return;
- }
-
- if (job->start()) {
- job->showErrorDialog(mMainWindow, i18n("Chiasmus Decryption Error"));
- deleteLater();
- return;
- }
-
- mJob = job;
- connect(job, SIGNAL(result(GpgME::Error,QVariant)),
- this, SLOT(slotAtmDecryptWithChiasmusResult(GpgME::Error,QVariant)));
-}
-
-void AttachmentEncryptWithChiasmusJob::slotAtmDecryptWithChiasmusResult(const GpgME::Error &err, const QVariant &result)
-{
- if (!mJob) {
- deleteLater();
- return;
- }
- Q_ASSERT(mJob == sender());
- if (mJob != sender()) {
- deleteLater();
- return;
- }
- Kleo::Job *job = mJob;
- mJob = 0;
- if (err.isCanceled()) {
- deleteLater();
- return;
- }
- if (err) {
- job->showErrorDialog(mMainWindow, i18n("Chiasmus Decryption Error"));
- deleteLater();
- return;
- }
-
- if (result.type() != QVariant::ByteArray) {
- const QString msg = i18n("Unexpected return value from Chiasmus backend: "
- "The \"x-decrypt\" function did not return a "
- "byte array. Please report this bug.");
- KMessageBox::error(mMainWindow, msg, i18n("Chiasmus Backend Error"));
- deleteLater();
- return;
- }
-
- const QUrl url = QFileDialog::getSaveFileUrl(mMainWindow, QString(), QUrl::fromLocalFile(chomp(mCurrentFileName, QStringLiteral(".xia"), false)));
- if (url.isEmpty()) {
- deleteLater();
- return;
- }
-
- bool overwrite = MessageViewer::Util::checkOverwrite(url, mMainWindow);
- if (!overwrite) {
- deleteLater();
- return;
- }
-
- KIO::Job *uploadJob = KIO::storedPut(result.toByteArray(), url, -1, KIO::Overwrite);
- KJobWidgets::setWindow(uploadJob, mMainWindow);
- connect(uploadJob, &KJob::result,
- this, &AttachmentEncryptWithChiasmusJob::slotAtmDecryptWithChiasmusUploadResult);
-}
-
-void AttachmentEncryptWithChiasmusJob::slotAtmDecryptWithChiasmusUploadResult(KJob *job)
-{
- if (job->error()) {
- static_cast<KIO::Job *>(job)->ui()->showErrorMessage();
- }
- deleteLater();
-}
diff --git a/messageviewer/src/job/attachmentencryptwithchiasmusjob.h b/messageviewer/src/job/attachmentencryptwithchiasmusjob.h
deleted file mode 100644
index 69d3ae9..0000000
--- a/messageviewer/src/job/attachmentencryptwithchiasmusjob.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- Copyright (c) 2014-2015 Montel Laurent <montel at kde.org>
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License, version 2, as
- published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#ifndef ATTACHMENTENCRYPTWITHCHIASMUSJOB_H
-#define ATTACHMENTENCRYPTWITHCHIASMUSJOB_H
-
-#include <QObject>
-namespace KMime
-{
-class Content;
-}
-namespace Kleo
-{
-class SpecialJob;
-}
-namespace GpgME
-{
-class Error;
-}
-class KJob;
-namespace MessageViewer
-{
-class AttachmentEncryptWithChiasmusJob : public QObject
-{
- Q_OBJECT
-public:
- explicit AttachmentEncryptWithChiasmusJob(QObject *parent = Q_NULLPTR);
- ~AttachmentEncryptWithChiasmusJob();
- void start();
-
- void setContent(KMime::Content *content);
- void setCurrentFileName(const QString ¤tFileName);
-
- void setMainWindow(QWidget *mainWindow);
-
-private Q_SLOTS:
- void slotAtmDecryptWithChiasmusResult(const GpgME::Error &err, const QVariant &result);
- void slotAtmDecryptWithChiasmusUploadResult(KJob *job);
-private:
- QString mCurrentFileName;
- Kleo::SpecialJob *mJob;
- QWidget *mMainWindow;
- KMime::Content *mContent;
-};
-}
-#endif // ATTACHMENTENCRYPTWITHCHIASMUSJOB_H
diff --git a/messageviewer/src/settings/messageviewer.kcfg.cmake b/messageviewer/src/settings/messageviewer.kcfg.cmake
index 167189f..2e225bf 100644
--- a/messageviewer/src/settings/messageviewer.kcfg.cmake
+++ b/messageviewer/src/settings/messageviewer.kcfg.cmake
@@ -77,8 +77,6 @@ xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 http://www.kde.org/sta
<label>Reduce font size for quoted text</label>
<whatsthis>Enable this option to show quoted text with a smaller font.</whatsthis>
</entry>
- <entry name="ChiasmusDecryptionKey" type="String"></entry>
- <entry name="ChiasmusDecryptionOptions" type="String"></entry>
<entry name="ShowUserAgent" type="Bool">
<default>false</default>
<label>Show user agent in fancy headers</label>
diff --git a/messageviewer/src/viewer/bodypartformatter.cpp b/messageviewer/src/viewer/bodypartformatter.cpp
index 3bd3e19..6acec5d 100644
--- a/messageviewer/src/viewer/bodypartformatter.cpp
+++ b/messageviewer/src/viewer/bodypartformatter.cpp
@@ -255,7 +255,6 @@ CREATE_BODY_PART_FORMATTER(TextPlain)
CREATE_BODY_PART_FORMATTER(TextHtml)
CREATE_BODY_PART_FORMATTER(ApplicationPkcs7Mime)
-CREATE_BODY_PART_FORMATTER(ApplicationChiasmusText)
CREATE_BODY_PART_FORMATTER(MultiPartMixed)
CREATE_BODY_PART_FORMATTER(MultiPartAlternative)
@@ -275,7 +274,6 @@ void BodyPartFormatterFactoryPrivate::messageviewer_create_builtin_bodypart_form
(*reg)["application"]["pgp"] = ApplicationPgpBodyPartFormatter::create();
(*reg)["application"]["pkcs7-mime"] = ApplicationPkcs7MimeBodyPartFormatter::create();
(*reg)["application"]["x-pkcs7-mime"] = ApplicationPkcs7MimeBodyPartFormatter::create();
- (*reg)["application"]["vnd.de.bund.bsi.chiasmus-text"] = ApplicationChiasmusTextBodyPartFormatter::create();
(*reg)["application"]["*"] = AnyTypeBodyPartFormatter::create();
(*reg)["text"]["plain"] = TextPlainBodyPartFormatter::create();
diff --git a/messageviewer/src/viewer/chiasmuskeyselector.cpp b/messageviewer/src/viewer/chiasmuskeyselector.cpp
deleted file mode 100644
index 765a104..0000000
--- a/messageviewer/src/viewer/chiasmuskeyselector.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-
-#include "chiasmuskeyselector.h"
-
-#include <QLineEdit>
-#include <QListWidget>
-#include <KLocalizedString>
-
-#include <QLabel>
-#include <QVBoxLayout>
-#include <QPushButton>
-#include <KConfigGroup>
-#include <QDialogButtonBox>
-
-using namespace MessageViewer;
-
-ChiasmusKeySelector::ChiasmusKeySelector(QWidget *parent, const QString &caption,
- const QStringList &keys, const QString ¤tKey,
- const QString &lastOptions)
- : QDialog(parent)
-{
- setWindowTitle(caption);
- QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
- QVBoxLayout *mainLayout = new QVBoxLayout;
- setLayout(mainLayout);
- mOkButton = buttonBox->button(QDialogButtonBox::Ok);
- mOkButton->setDefault(true);
- mOkButton->setShortcut(Qt::CTRL | Qt::Key_Return);
- connect(buttonBox, &QDialogButtonBox::accepted, this, &ChiasmusKeySelector::accept);
- connect(buttonBox, &QDialogButtonBox::rejected, this, &ChiasmusKeySelector::reject);
- QWidget *page = new QWidget(this);
- mainLayout->addWidget(page);
- mainLayout->addWidget(buttonBox);
-
- QVBoxLayout *layout = new QVBoxLayout(page);
-
- mLabel = new QLabel(i18n("Please select the Chiasmus key file to use:"), page);
- mainLayout->addWidget(mLabel);
- layout->addWidget(mLabel);
-
- mListBox = new QListWidget(page);
- mainLayout->addWidget(mListBox);
- mListBox->addItems(keys);
- const int current = keys.indexOf(currentKey);
- mListBox->setCurrentRow(qMax(0, current));
- mListBox->scrollToItem(mListBox->item(qMax(0, current)));
- layout->addWidget(mListBox, 1);
-
- QLabel *optionLabel = new QLabel(i18n("Additional arguments for chiasmus:"), page);
- mainLayout->addWidget(optionLabel);
- layout->addWidget(optionLabel);
-
- mOptions = new QLineEdit(lastOptions, page);
- mainLayout->addWidget(mOptions);
- optionLabel->setBuddy(mOptions);
- layout->addWidget(mOptions);
-
- layout->addStretch();
-
- connect(mListBox, &QListWidget::itemDoubleClicked, this, &ChiasmusKeySelector::accept);
- connect(mListBox, &QListWidget::itemSelectionChanged, this, &ChiasmusKeySelector::slotItemSelectionChanged);
-
- slotItemSelectionChanged();
- mListBox->setFocus();
-}
-
-void ChiasmusKeySelector::slotItemSelectionChanged()
-{
- mOkButton->setEnabled(!mListBox->selectedItems().isEmpty());
-}
-
-QString ChiasmusKeySelector::key() const
-{
- if (mListBox->selectedItems().isEmpty()) {
- return QString();
- } else {
- return mListBox->currentItem()->text();
- }
-}
-
-QString ChiasmusKeySelector::options() const
-{
- return mOptions->text();
-}
diff --git a/messageviewer/src/viewer/chiasmuskeyselector.h b/messageviewer/src/viewer/chiasmuskeyselector.h
deleted file mode 100644
index be37c94..0000000
--- a/messageviewer/src/viewer/chiasmuskeyselector.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef CHIASMUSKEYSELECTOR_H
-#define CHIASMUSKEYSELECTOR_H
-
-#include <QDialog>
-#include <KConfigGroup>
-
-class QListWidget;
-class QLineEdit;
-class QLabel;
-class QPushButton;
-
-namespace MessageViewer
-{
-
-class ChiasmusKeySelector : public QDialog
-{
- Q_OBJECT
-
-public:
- ChiasmusKeySelector(QWidget *parent, const QString &caption,
- const QStringList &keys, const QString ¤tKey,
- const QString &lastOptions);
-
- QString key() const;
- QString options() const;
-
-private Q_SLOTS:
- void slotItemSelectionChanged();
-
-private:
- QLabel *mLabel;
- QListWidget *mListBox;
- QLineEdit *mOptions;
- QPushButton *mOkButton;
-};
-
-}
-
-#endif
diff --git a/messageviewer/src/viewer/objecttreeparser.cpp b/messageviewer/src/viewer/objecttreeparser.cpp
index 2f6d3aa..c8b571a 100644
--- a/messageviewer/src/viewer/objecttreeparser.cpp
+++ b/messageviewer/src/viewer/objecttreeparser.cpp
@@ -58,7 +58,6 @@
#include "messageviewer/nodehelper.h"
#include "utils/iconnamecache.h"
#include "viewer/htmlquotecolorer.h"
-#include "chiasmuskeyselector.h"
#include "messageviewer_debug.h"
#include "converthtmltoplaintext.h"
@@ -1438,122 +1437,6 @@ bool ObjectTreeParser::processApplicationPkcs7MimeSubtype(KMime::Content *node,
return isSigned || isEncrypted;
}
-bool ObjectTreeParser::decryptChiasmus(const QByteArray &data, QByteArray &bodyDecoded, QString &errorText)
-{
- const Kleo::CryptoBackend::Protocol *chiasmus =
- Kleo::CryptoBackendFactory::instance()->protocol("Chiasmus");
- if (!chiasmus) {
- return false;
- }
-
- const std::unique_ptr<Kleo::SpecialJob> listjob(chiasmus->specialJob("x-obtain-keys", QMap<QString, QVariant>()));
- if (!listjob.get()) {
- errorText = i18n("Chiasmus backend does not offer the "
- "\"x-obtain-keys\" function. Please report this bug.");
- return false;
- }
-
- if (listjob->exec()) {
- errorText = i18n("Chiasmus Backend Error");
- return false;
- }
-
- const QVariant result = listjob->property("result");
- if (result.type() != QVariant::StringList) {
- errorText = i18n("Unexpected return value from Chiasmus backend: "
- "The \"x-obtain-keys\" function did not return a "
- "string list. Please report this bug.");
- return false;
- }
-
- const QStringList keys = result.toStringList();
- if (keys.empty()) {
- errorText = i18n("No keys have been found. Please check that a "
- "valid key path has been set in the Chiasmus "
- "configuration.");
- return false;
- }
-
- QScopedPointer<ChiasmusKeySelector> selectorDlg(new ChiasmusKeySelector(/*mReader*/0, i18n("Chiasmus Decryption Key Selection"),
- keys, MessageViewer::MessageViewerSettings::chiasmusDecryptionKey(),
- MessageViewer::MessageViewerSettings::chiasmusDecryptionOptions()));
-
- if (selectorDlg->exec() != QDialog::Accepted || !selectorDlg) {
- return false;
- }
- MessageViewer::MessageViewerSettings::setChiasmusDecryptionOptions(selectorDlg->options());
- MessageViewer::MessageViewerSettings::setChiasmusDecryptionKey(selectorDlg->key());
- assert(!MessageViewer::MessageViewerSettings::chiasmusDecryptionKey().isEmpty());
-
- Kleo::SpecialJob *job = chiasmus->specialJob("x-decrypt", QMap<QString, QVariant>());
- if (!job) {
- errorText = i18n("Chiasmus backend does not offer the "
- "\"x-decrypt\" function. Please report this bug.");
- return false;
- }
-
- if (!job->setProperty("key", MessageViewer::MessageViewerSettings::chiasmusDecryptionKey()) ||
- !job->setProperty("options", MessageViewer::MessageViewerSettings::chiasmusDecryptionOptions()) ||
- !job->setProperty("input", data)) {
- errorText = i18n("The \"x-decrypt\" function does not accept "
- "the expected parameters. Please report this bug.");
- return false;
- }
-
- if (job->exec()) {
- errorText = i18n("Chiasmus Decryption Error");
- return false;
- }
-
- const QVariant resultData = job->property("result");
- if (resultData.type() != QVariant::ByteArray) {
- errorText = i18n("Unexpected return value from Chiasmus backend: "
- "The \"x-decrypt\" function did not return a "
- "byte array. Please report this bug.");
- return false;
- }
- bodyDecoded = resultData.toByteArray();
- return true;
-}
-
-bool ObjectTreeParser::processApplicationChiasmusTextSubtype(KMime::Content *curNode, ProcessResult &result)
-{
- if (!htmlWriter()) {
-
- // ### Surely this is totally wrong? The decoded text of this node is just garbage, since it is
- // encrypted. This whole if statement should be removed, and the decrypted body
- // should be added to mPlainTextContent. Needs testing with Chiasmus though, which I don't have.
- mPlainTextContent += curNode->decodedText();
- mPlainTextContentCharset = NodeHelper::charset(curNode);
- return true;
- }
-
- QByteArray decryptedBody;
- QString errorText;
- const QByteArray data = curNode->decodedContent();
- bool bOkDecrypt = decryptChiasmus(data, decryptedBody, errorText);
- PartMetaData messagePart;
- messagePart.isDecryptable = bOkDecrypt;
- messagePart.isEncrypted = true;
- messagePart.isSigned = false;
- messagePart.errorText = errorText;
- if (htmlWriter())
- htmlWriter()->queue(writeSigstatHeader(messagePart,
- 0, //cryptPlugWrapper(),
- NodeHelper::fromAsString(curNode)));
- const QByteArray body = bOkDecrypt ? decryptedBody : data;
- const QString chiasmusCharset = curNode->contentType()->parameter(QStringLiteral("chiasmus-charset"));
- const QTextCodec *aCodec = chiasmusCharset.isEmpty() ? codecFor(curNode)
- : NodeHelper::codecForName(chiasmusCharset.toLatin1());
- htmlWriter()->queue(quotedHTML(aCodec->toUnicode(body), false /*decorate*/));
- result.setInlineEncryptionState(KMMsgFullyEncrypted);
- if (htmlWriter()) {
- htmlWriter()->queue(writeSigstatFooter(messagePart));
- }
- mNodeHelper->setPartMetaData(curNode, messagePart);
- return true;
-}
-
void ObjectTreeParser::writeBodyString(const QByteArray &bodyString,
const QString &fromAddress,
const QTextCodec *codec,
diff --git a/messageviewer/src/viewer/objecttreeparser.h b/messageviewer/src/viewer/objecttreeparser.h
index ec93056..d484124 100644
--- a/messageviewer/src/viewer/objecttreeparser.h
+++ b/messageviewer/src/viewer/objecttreeparser.h
@@ -417,9 +417,7 @@ public:// (during refactoring)
MessagePart::Ptr processMultiPartEncryptedSubtype(KMime::Content *node, ProcessResult &result);
bool processApplicationPkcs7MimeSubtype(KMime::Content *node, ProcessResult &result);
- bool processApplicationChiasmusTextSubtype(KMime::Content *node, ProcessResult &result);
- bool decryptChiasmus(const QByteArray &data, QByteArray &bodyDecoded, QString &errorText);
void writeBodyString(const QByteArray &bodyString,
const QString &fromAddress,
const QTextCodec *codec,
diff --git a/messageviewer/src/viewer/viewer_p.cpp b/messageviewer/src/viewer/viewer_p.cpp
index 50d7991..9f1259a 100644
--- a/messageviewer/src/viewer/viewer_p.cpp
+++ b/messageviewer/src/viewer/viewer_p.cpp
@@ -37,7 +37,6 @@
#include "kpimtextedit/slidecontainer.h"
#include "Gravatar/GravatarCache"
#include "gravatarsettings.h"
-#include "job/attachmentencryptwithchiasmusjob.h"
#include "job/attachmenteditjob.h"
#include "job/modifymessagedisplayformatjob.h"
#include "viewerplugins/viewerplugintoolmanager.h"
@@ -621,12 +620,6 @@ void ViewerPrivate::showAttachmentPopup(KMime::Content *node, const QString &nam
connect(action, SIGNAL(triggered()), attachmentMapper, SLOT(map()));
attachmentMapper->setMapping(action, Viewer::Delete);
action->setEnabled(canChange && !deletedAttachment);
- if (name.endsWith(QLatin1String(".xia"), Qt::CaseInsensitive)
- && Kleo::CryptoBackendFactory::instance()->protocol("Chiasmus")) {
- action = menu->addAction(i18n("Decrypt With Chiasmus..."));
- connect(action, SIGNAL(triggered(bool)), attachmentMapper, SLOT(map()));
- attachmentMapper->setMapping(action, Viewer::ChiasmusEncrypt);
- }
action = menu->addAction(i18n("Properties"));
connect(action, SIGNAL(triggered(bool)), attachmentMapper, SLOT(map()));
attachmentMapper->setMapping(action, Viewer::Properties);
@@ -2544,9 +2537,6 @@ void ViewerPrivate::slotHandleAttachment(int choice)
case Viewer::View:
attachmentView(mCurrentContent);
break;
- case Viewer::ChiasmusEncrypt:
- attachmentEncryptWithChiasmus(mCurrentContent);
- break;
case Viewer::Copy:
attachmentCopy(KMime::Content::List() << mCurrentContent);
break;
@@ -2731,15 +2721,6 @@ void ViewerPrivate::setUseFixedFont(bool useFixedFont)
}
}
-void ViewerPrivate::attachmentEncryptWithChiasmus(KMime::Content *content)
-{
- MessageViewer::AttachmentEncryptWithChiasmusJob *job = new MessageViewer::AttachmentEncryptWithChiasmusJob(this);
- job->setContent(content);
- job->setCurrentFileName(mCurrentFileName);
- job->setMainWindow(mMainWindow);
- job->start();
-}
-
bool ViewerPrivate::showFullToAddressList() const
{
return mShowFullToAddressList;
diff --git a/messageviewer/src/viewer/viewer_p.h b/messageviewer/src/viewer/viewer_p.h
index 97ddde6..2d99e33 100644
--- a/messageviewer/src/viewer/viewer_p.h
+++ b/messageviewer/src/viewer/viewer_p.h
@@ -400,7 +400,6 @@ public:
void setUseFixedFont(bool useFixedFont);
void attachmentView(KMime::Content *atmNode);
- void attachmentEncryptWithChiasmus(KMime::Content *content);
/** Return weather to show or hide the full list of "To" addresses */
bool showFullToAddressList() const;
More information about the kde-doc-english
mailing list