|
|
@ -32,6 +32,26 @@ |
|
|
|
|
|
|
|
#include <AkonadiCore/ServerManager>
|
|
|
|
|
|
|
|
// The pEp engine
|
|
|
|
#include <pEp/message.h>
|
|
|
|
|
|
|
|
// The pEp D-Bus binding
|
|
|
|
#include <pEpDBusAdapter/types/pEpDBusMessage.h>
|
|
|
|
#include <pEpDBusAdapter/types/pEpDBusStringList.h>
|
|
|
|
#include <pEpDBusAdapter/types/pEpDBusRating.h>
|
|
|
|
#include <pEpDBusAdapter/types/pEpDBusEncryptionFlags.h>
|
|
|
|
#include <pEpDBusAdapter/types/pEpDBusStatus.h>
|
|
|
|
#include <pEpDBusAdapter/pep-client.h>
|
|
|
|
|
|
|
|
DBus::BusDispatcher dispatcher; |
|
|
|
|
|
|
|
pEp::Client *start_pEpClient() |
|
|
|
{ |
|
|
|
DBus::default_dispatcher = &dispatcher; |
|
|
|
DBus::Connection conn = DBus::Connection::SessionBus(); |
|
|
|
return new pEp::Client(conn, "/pep/security", "pep.security"); |
|
|
|
} |
|
|
|
|
|
|
|
using namespace MessageViewer; |
|
|
|
|
|
|
|
pEpViewerInterface::pEpViewerInterface(KActionCollection *ac, QWidget *parent) |
|
|
@ -40,12 +60,9 @@ pEpViewerInterface::pEpViewerInterface(KActionCollection *ac, QWidget *parent) |
|
|
|
mStatusWidget = new QWidget(parent); |
|
|
|
mStatusWidget->setFixedHeight(20); |
|
|
|
parent->layout()->addWidget(mStatusWidget); |
|
|
|
|
|
|
|
DBus::Connection conn = DBus::Connection::SessionBus(); |
|
|
|
m_pEpDBusAdapter = new QpEpClient(conn, "pep.security", "/pep/security"); |
|
|
|
m_pEpDBusAdapter = ::start_pEpClient(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pEpViewerInterface::~pEpViewerInterface() |
|
|
|
{ |
|
|
|
qDebug() << __FUNCTION__; |
|
|
@ -80,33 +97,17 @@ bool pEpViewerInterface::isApEpMessage(KMime::Content *content) |
|
|
|
|
|
|
|
void pEpViewerInterface::decryptMessage() |
|
|
|
{ |
|
|
|
QByteArray type; |
|
|
|
QByteArray pgpText; |
|
|
|
|
|
|
|
if(!m_pEpDBusAdapter) { |
|
|
|
} |
|
|
|
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"));
|
|
|
|
pEpDBusMessage src; |
|
|
|
message m = convert_mMessage_to_pEpMessage(); |
|
|
|
pEpDBusMessage src, dst; |
|
|
|
pEpDBusStringList keylist; |
|
|
|
pEpDBusRating rating; |
|
|
|
pEpDBusEncryptionFlags flags; |
|
|
|
pEpDBusStatus status; |
|
|
|
pEpDBusMessage dst; |
|
|
|
m_pEpDBusAdapter->decrypt_message(src,keylist,rating,flags,status,dst); |
|
|
|
src << m; |
|
|
|
//m_pEpDBusAdapter->decrypt_message(src,keylist,rating,flags,status,dst);
|
|
|
|
dst >> m; |
|
|
|
convert_pEpMessage_to_mMessage(m); |
|
|
|
//mMessage->contentType()->setMimeType(QByteArray("text/plain"));
|
|
|
|
} |
|
|
|
|
|
|
|
void pEpViewerInterface::setMessage(const KMime::Message::Ptr &value) |
|
|
|