Browse Source

Backup in case laptop explodes

master
David Lanzendörfer 9 months ago
parent
commit
fc064c596f
7 changed files with 246 additions and 28 deletions
  1. +121
    -0
      CMakeLists.txt
  2. +19
    -0
      icons/128-apps-akonadi-pep-invertd.svg
  3. +14
    -0
      icons/128-apps-akonadi-pep.svg
  4. +14
    -0
      icons/CMakeLists.txt
  5. +45
    -0
      messageviewerplugin/'
  6. +30
    -27
      messageviewerplugin/viewerpluginpepinterface.cpp
  7. +3
    -1
      messageviewerplugin/viewerpluginpepinterface.h

+ 121
- 0
CMakeLists.txt View File

@ -0,0 +1,121 @@
project(pEpForKDE)
# setting the version of this viewer:
set(PROJECT_VERSION_STRING "alpha")
set(PEP_MESSAGEVIEWER_VERSION_STRING ${PROJECT_VERSION_STRING})
set(PEP_MESSAGEVIEWER_SOVERSION 1)
# now the dependencies:
cmake_minimum_required(VERSION 3.5)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(PIM_VERSION "5.16.2")
set(KF5_MIN_VERSION "5.75.0")
set(MESSAGELIB_LIB_VERSION ${PIM_VERSION})
set(AKONADIMIME_LIB_VERSION "5.16.2")
set(QT_REQUIRED_VERSION "5.13.0")
set(AKONADICONTACT_LIB_VERSION "5.16.2")
set(AKONADI_VERSION "5.16.2")
set(GRANTLEETHEME_LIB_VERSION "5.16.2")
set(GRAVATAR_LIB_VERSION "5.16.2")
set(IDENTITYMANAGEMENT_LIB_VERSION "5.16.2")
set(KLDAP_LIB_VERSION "5.16.2")
set(KMAILTRANSPORT_LIB_VERSION "5.16.2")
set(KMBOX_LIB_VERSION "5.16.2")
set(KMIME_LIB_VERSION "5.16.2")
set(KPIMTEXTEDIT_LIB_VERSION "5.16.2")
set(LIBKDEPIM_LIB_VERSION "5.16.2")
set(LIBKLEO_LIB_VERSION "5.16.2")
set(PIMCOMMON_LIB_VERSION "5.16.2")
set(GPGME_LIB_VERSION "1.11.1")
set(AKONADI_SEARCH_VERSION "5.16.2")
set(ECM_VERSION ${KF5_MIN_VERSION})
set(AKONADINOTES_LIB_VERSION "5.16.2")
set(INCIDENCEEDITOR_LIB_VERSION "5.16.2")
set(MAILCOMMON_LIB_VERSION "5.16.2")
set(XSLTPROC_EXECUTABLE /usr/bin/xsltproc)
find_package(ECM 1.0.0 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(KDEClangFormat)
include(KDECompilerSettings)
include(KDEFrameworkCompilerSettings)
include(KDEGitCommitHooks)
include(KDEInstallDirs)
include(KDEPackageAppTemplates)
include(FeatureSummary)
include(GenerateExportHeader)
include(ECMInstallIcons)
include(ECMGenerateHeaders)
include(ECMQtDeclareLoggingCategory)
include(ECMGeneratePriFile)
find_package(KF5IncidenceEditor ${INCIDENCEEDITOR_LIB_VERSION} CONFIG REQUIRED)
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Gui Test)
find_package(KF5Codecs ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5I18n ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Mime ${KMIME_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5NewStuff ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(QGpgme ${GPGME_LIB_VERSION} CONFIG REQUIRED)
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Network PrintSupport WebEngine WebEngineWidgets)
find_package(KF5Archive ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Completion ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Config ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5ConfigWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5IconThemes ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5ItemViews ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5JobWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5KIO ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Service ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Sonnet ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5TextWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5WidgetsAddons ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5XmlGui ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5SyntaxHighlighting ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5DBusAddons ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5GuiAddons ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Notifications ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5MessageCore ${AKONADIMIME_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5MimeTreeParser ${AKONADIMIME_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5WebEngineViewer ${AKONADIMIME_LIB_VERSION} CONFIG REQUIRED)
find_package(Grantlee5 ${GRANTLEE_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5GrantleeTheme ${GRANTLEETHEME_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5Akonadi ${AKONADI_VERSION} CONFIG REQUIRED)
find_package(KF5AkonadiMime ${AKONADIMIME_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5Contacts ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5AkonadiContact ${AKONADICONTACT_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5Gravatar ${GRAVATAR_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5IdentityManagement ${IDENTITYMANAGEMENT_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5Ldap ${KLDAP_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5Libkleo ${LIBKLEO_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5MailTransportAkonadi ${KMAILTRANSPORT_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5MailCommon ${MAILCOMMON_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5Mbox ${KMBOX_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5PimCommonAkonadi ${PIMCOMMON_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5PimTextEdit ${KPIMTEXTEDIT_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5Libkdepim ${LIBKDEPIM_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5AkonadiSearch ${AKONADI_SEARCH_VERSION} CONFIG REQUIRED)
find_package(KF5MessageViewer ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5AkonadiNotes ${AKONADINOTES_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5KontactInterface ${AKONADINOTES_LIB_VERSION} CONFIG REQUIRED)
find_package(Inotify)
find_package(Qca-qt5 2.2.0 CONFIG REQUIRED)
find_package(Grantlee5 ${GRANTLEE_MIN_VERSION} CONFIG REQUIRED)
#include_directories(${pEpForKDE_SOURCE_DIR}/messagelib/messageviewer/src/messagepartthemes/default)
add_subdirectory(icons)
add_subdirectory(akonadi_pep_agent)
add_subdirectory(messageviewerplugin)
#add_subdirectory(peprenderer)
#add_subdirectory(pEpDBusAdapter/src)

+ 19
- 0
icons/128-apps-akonadi-pep-invertd.svg View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 128 128" style="enable-background:new 0 0 128 128;" xml:space="preserve">
<style type="text/css">
.st0{fill:#03AA4B;}
.st1{fill:#FFFFFF;}
</style>
<rect class="st0" width="128" height="128"/>
<g>
<path class="st1" d="M0.6,44.7c0-1.6-0.1-2.5-0.2-6.1h7l0.1,6.1C11,38.9,17.2,38,20.2,38c8,0,15.6,5.5,15.6,19.2
c0,13.8-8.1,19.9-16.9,19.9c-5.4,0-9.4-2.3-11.4-5.5V90H0.6V44.7z M17.7,72c1.8,0,5.5-0.4,7.8-3.6c2.7-3.6,3-8.9,3-11.6
c0-6.7-2-13.6-10.2-13.6c-11,0-11,11.7-11,15C7.3,62.8,7.9,72,17.7,72z"/>
<path class="st1" d="M43.2,53.3h39.3v5.1H43.2V53.3z M43.2,38.6h39.3v5.1H43.2V38.6z M43.2,68.1h39.3v5.1H43.2V68.1z"/>
<path class="st1" d="M92.4,44.7c0-1.6-0.1-2.5-0.2-6.1h7l0.1,6.1c3.5-5.8,9.6-6.7,12.7-6.7c8,0,15.6,5.5,15.6,19.2
c0,13.8-8.1,19.9-16.9,19.9c-5.4,0-9.4-2.3-11.4-5.5V90h-6.9L92.4,44.7L92.4,44.7z M109.5,72c1.8,0,5.5-0.4,7.8-3.6
c2.7-3.6,3-8.9,3-11.6c0-6.7-2-13.6-10.2-13.6C99,43.2,99,55,99,58.3C99.1,62.8,99.7,72,109.5,72z"/>
</g>
</svg>

+ 14
- 0
icons/128-apps-akonadi-pep.svg View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="128px" height="128px" viewBox="0 0 128 128" style="enable-background:new 0 0 128 128;" xml:space="preserve">
<g>
<path fill="#03AA4B" d="M0.6,44.7c0-1.6-0.1-2.5-0.2-6.1h7l0.1,6.1C11,38.9,17.2,38,20.2,38c8,0,15.6,5.5,15.6,19.2
c0,13.8-8.1,19.9-16.9,19.9c-5.4,0-9.4-2.3-11.4-5.5V90H0.6V44.7z M17.7,72c1.8,0,5.5-0.4,7.8-3.6c2.7-3.6,3-8.9,3-11.6
c0-6.7-2-13.6-10.2-13.6C7.3,43.2,7.3,54.9,7.3,58.2C7.3,62.8,7.9,72,17.7,72z"/>
<path fill="#03AA4B" d="M43.2,53.3h39.3v5.1H43.2V53.3z M43.2,38.6h39.3v5.1H43.2V38.6z M43.2,68.1h39.3v5.1H43.2V68.1z"/>
<path fill="#03AA4B" d="M92.4,44.7c0-1.6-0.1-2.5-0.2-6.1h7l0.1,6.1c3.5-5.8,9.6-6.7,12.7-6.7c8,0,15.6,5.5,15.6,19.2
c0,13.8-8.1,19.9-16.9,19.9c-5.4,0-9.4-2.3-11.4-5.5V90h-6.9L92.4,44.7L92.4,44.7z M109.5,72c1.8,0,5.5-0.4,7.8-3.6
c2.7-3.6,3-8.9,3-11.6c0-6.7-2-13.6-10.2-13.6c-11.1,0-11.1,11.8-11.1,15.1C99.1,62.8,99.7,72,109.5,72z"/>
</g>
</svg>

+ 14
- 0
icons/CMakeLists.txt View File

@ -0,0 +1,14 @@
ecm_install_icons(
ICONS
128-apps-akonadi-pep.svg
DESTINATION ${KDE_INSTALL_ICONDIR}
THEME hicolor
)
ecm_install_icons(
ICONS
128-apps-akonadi-pep-invertd.svg
DESTINATION ${KDE_INSTALL_ICONDIR}
THEME hicolor
)

+ 45
- 0
messageviewerplugin/' View File

@ -0,0 +1,45 @@
/*
SPDX-FileCopyrightText: 2015-2020 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef VIEWERPLUGINCREATENOTEINTERFACE_H
#define VIEWERPLUGINCREATENOTEINTERFACE_H
#include <MessageViewer/ViewerPluginInterface>
class KActionCollection;
class QLabel;
class QDBusInterface;
class QByteArray;
namespace MessageViewer {
class pEpViewerInterface : public ViewerPluginInterface
{
Q_OBJECT
public:
explicit pEpViewerInterface(KActionCollection *ac, QWidget *parent = nullptr);
~pEpViewerInterface() override;
Q_REQUIRED_RESULT QList<QAction *> actions() const override;
void setMessage(const KMime::Message::Ptr &value) override;
void closePlugin() override;
void showWidget() override;
void setMessageItem(const Akonadi::Item &item) override;
void updateAction(const Akonadi::Item &item) override;
Q_REQUIRED_RESULT ViewerPluginInterface::SpecificFeatureTypes featureTypes() const override;
//Q_REQUIRED_RESULT MessageViewer::ViewerPluginInterface *createView(QWidget *parent, KActionCollection *ac);
private:
QDBusInterface *m_pEpAgent = nullptr;
bool isApEpMessage(KMime::Content *c);
void decryptMessage();
KMime::Message::Ptr mMessage;
Akonadi::Item mMessageItem;
QList<QAction *> mAction;
QWidget *mStatusWidget = nullptr;
};
}
#endif // VIEWERPLUGINCREATENOTEINTERFACE_H

+ 30
- 27
messageviewerplugin/viewerpluginpepinterface.cpp View File

@ -18,6 +18,7 @@
#include <QPainter>
#include <QColor>
#include <QStringLiteral>
#include <QByteArray>
#include <QDBusInterface>
#include <QDBusReply>
@ -43,27 +44,13 @@ pEpViewerInterface::pEpViewerInterface(KActionCollection *ac, QWidget *parent)
const QString service = Akonadi::ServerManager::self()->agentServiceName(Akonadi::ServerManager::Agent, QStringLiteral("pEpAgent"));
qDebug() << service;
//qDebug() << QDBusConnection::sessionBus().objectRegisteredAt(service);
pEpAgent = new QDBusInterface(
m_pEpAgent = new QDBusInterface(
service,
QStringLiteral("/pEpAgent"),
QStringLiteral("org.freedesktop.Akonadi.Agent.pEpAgent"),
QDBusConnection::sessionBus()
);
if (pEpAgent->isValid()) {
m_pEpAgent = pEpAgent;
//qDebug() << m_pEpAgent->call(QStringLiteral("decryptMessage"), QVariant::fromValue(42));
qDebug() << m_pEpAgent->call(QStringLiteral("resetIdentity"));
} else {
qDebug() << __FUNCTION__ << ": Could not connect to the pEp agent (" << pEpAgent->lastError().message() << ")";
}
/*korgIface.call(QStringLiteral("showEventView"));
korgIface.call(QStringLiteral("showDate"), date);*/
//} else {
// qDebug() << __FUNCTION__ << "Could not activate pEp agent";
//}
}
@ -72,14 +59,6 @@ pEpViewerInterface::~pEpViewerInterface()
qDebug() << __FUNCTION__;
}
void pEpViewerInterface::setText(const QString &text)
{
qDebug() << __FUNCTION__;
//if(mTestWidget) mTestWidget->setText(text);
//Q_UNUSED(text);
//Nothing
}
QList<QAction *> pEpViewerInterface::actions() const
{
qDebug() << __FUNCTION__;
@ -107,6 +86,33 @@ bool pEpViewerInterface::isApEpMessage(KMime::Content *content)
return false;
}
void pEpViewerInterface::decryptMessage()
{
QByteArray type;
QByteArray pgpText;
if(!m_pEpAgent->isValid()) {
// We're not connected to the agent
qDebug() << "DBus not connected";
return;
}
foreach ( KMime::Content *attachment, mMessage->contents() ) {
type = attachment->contentType()->mimeType();
if(type==QByteArray("application/octet-stream")) {
//attachment->setContent(QByteArray("pEp"));
//attachment->contentType()->setMimeType(QByteArray("text/plain"));
//mMessage->contents().removeOne(attachment);
pgpText=attachment->decodedContent();
} else if(type==QByteArray("application/pgp-encrypted")) {
//attachment->setContent(QByteArray("pEp"));
//attachment->contentType()->setMimeType(QByteArray("text/plain"));
} else {
qDebug() << type;
}
}
//mMessage->contentType()->setMimeType(QByteArray("text/plain"));
qDebug() << m_pEpAgent->call(QStringLiteral("decryptMessage"), pgpText);
}
void pEpViewerInterface::setMessage(const KMime::Message::Ptr &value)
{
QByteArray type;
@ -114,15 +120,12 @@ void pEpViewerInterface::setMessage(const KMime::Message::Ptr &value)
QVariant testload = QVariant(QStringLiteral("test"));
if(value) {
mMessage = value;
if(!m_pEpAgent) { qDebug() << "DBus not connected"; return; } // We're not connected to the agent
type = mMessage->contentType()->mimeType();
if(type==QByteArray("multipart/mixed")) {
qDebug() << "Multipart detected";
} else if(type==QByteArray("multipart/encrypted")) {
qDebug() << "Encrypted message detected";
//reply = m_pEpAgent->call(QStringLiteral("decryptMessage"), mMessage);
reply = m_pEpAgent->call(QStringLiteral("decryptMessage"), testload);
qDebug() << reply;
decryptMessage();
} else {
qDebug() << type;
}


+ 3
- 1
messageviewerplugin/viewerpluginpepinterface.h View File

@ -11,6 +11,7 @@
class KActionCollection;
class QLabel;
class QDBusInterface;
class QByteArray;
namespace MessageViewer {
class pEpViewerInterface : public ViewerPluginInterface
@ -20,7 +21,6 @@ public:
explicit pEpViewerInterface(KActionCollection *ac, QWidget *parent = nullptr);
~pEpViewerInterface() override;
void setText(const QString &text) override;
Q_REQUIRED_RESULT QList<QAction *> actions() const override;
void setMessage(const KMime::Message::Ptr &value) override;
void closePlugin() override;
@ -34,6 +34,8 @@ private:
QDBusInterface *m_pEpAgent = nullptr;
bool isApEpMessage(KMime::Content *c);
void decryptMessage();
KMime::Message::Ptr mMessage;
Akonadi::Item mMessageItem;
QList<QAction *> mAction;


Loading…
Cancel
Save