Commit 38ca2686 authored by Sandro Knauß's avatar Sandro Knauß 🐝
Browse files

MessageViewer: viewerprivate add reference to IdentityManager.

In order to support Autocrypt we need to know if the corresponding
identity for an email wants Autocrypt support or not.
parent adbb6f0e
Pipeline #46633 passed with stage
in 45 minutes and 29 seconds
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
set(PIM_VERSION "5.16.40")
set(PIM_VERSION "5.16.41")
if (POLICY CMP0053)
cmake_policy(SET CMP0053 NEW)
......@@ -23,7 +23,7 @@ set(AKONADICONTACT_LIB_VERSION "5.16.40")
set(AKONADI_VERSION "5.16.40")
set(GRANTLEETHEME_LIB_VERSION "5.16.40")
set(GRAVATAR_LIB_VERSION "5.16.40")
set(IDENTITYMANAGEMENT_LIB_VERSION "5.16.40")
set(IDENTITYMANAGEMENT_LIB_VERSION "5.16.41")
set(KLDAP_LIB_VERSION "5.16.40")
set(KMAILTRANSPORT_LIB_VERSION "5.16.40")
set(KMBOX_LIB_VERSION "5.16.40")
......
......@@ -348,6 +348,7 @@ target_link_libraries(KF5MessageViewer
KF5::Mbox
KF5::PimTextEdit
KF5::Gravatar
KF5::IdentityManagement
KF5::IconThemes
KF5::I18n
KF5::KIOFileWidgets
......
......@@ -767,4 +767,10 @@ void Viewer::showDevelopmentTools()
d->slotShowDevelopmentTools();
}
void Viewer::setIdentityManager(KIdentityManagement::IdentityManager *ident)
{
Q_D(Viewer);
d->setIdentityManager(ident);
}
}
......@@ -24,6 +24,10 @@ class Item;
class ItemFetchJob;
}
namespace KIdentityManagement {
class IdentityManager;
}
class KActionCollection;
class QAction;
class KToggleAction;
......@@ -340,6 +344,8 @@ public:
void exportToPdf(const QString &fileName);
void showDevelopmentTools();
void setIdentityManager(KIdentityManagement::IdentityManager *ident);
Q_SIGNALS:
void moveMessageToTrash();
void pageIsScrolledToBottom(bool);
......
......@@ -85,6 +85,9 @@
#include <AkonadiCore/attributefactory.h>
#include <Akonadi/KMime/MessageParts>
#include <KIdentityManagement/Identity>
#include <KIdentityManagement/IdentityManager>
//own includes
#include "widgets/attachmentdialog.h"
#include "csshelper.h"
......@@ -3151,3 +3154,29 @@ DKIMViewerMenu *ViewerPrivate::dkimViewerMenu()
}
return nullptr;
}
bool ViewerPrivate::isAutocryptEnabled(const KMime::Content *content)
{
if (!mIdentityManager) {
return false;
}
QString addresses;
if (content->headerByType("to")) {
addresses += content->headerByType("to")->asUnicodeString();
}
if (content->headerByType("cc")) {
if (!addresses.isEmpty()) {
addresses += QLatin1String(", ");
}
addresses += content->headerByType("cc")->asUnicodeString();
}
const auto id = mIdentityManager->identityForAddress(addresses);
return id.autocryptEnabled();
}
void ViewerPrivate::setIdentityManager(KIdentityManagement::IdentityManager* ident)
{
mIdentityManager = ident;
}
......@@ -46,6 +46,10 @@ class QSplitter;
class QModelIndex;
class QPrinter;
namespace KIdentityManagement {
class IdentityManager;
}
namespace KPIMTextEdit {
class SlideContainer;
class TextToSpeechWidget;
......@@ -427,6 +431,10 @@ public:
void hasMultiMessages(bool messages);
void updateShowMultiMessagesButton(bool enablePreviousButton, bool enableNextButton);
MessageViewer::DKIMViewerMenu *dkimViewerMenu();
Q_REQUIRED_RESULT bool isAutocryptEnabled(const KMime::Content *content);
void setIdentityManager(KIdentityManagement::IdentityManager *ident);
private Q_SLOTS:
void slotActivatePlugin(MessageViewer::ViewerPluginInterface *interface);
void slotModifyItemDone(KJob *job);
......@@ -690,6 +698,7 @@ public:
MessageViewer::DKIMWidgetInfo *mDkimWidgetInfo = nullptr;
MessageViewer::DKIMViewerMenu *mDkimViewerMenu = nullptr;
MessageViewer::MessageViewerRenderer *mMessageViewerRenderer = nullptr;
KIdentityManagement::IdentityManager *mIdentityManager = nullptr;
};
}
......
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