From 234daf6935043775ffce6b5a3ca78e06f56fd81e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Knau=C3=9F?= Date: Thu, 14 Jul 2016 12:55:08 +0200 Subject: First thoughts for the new messagepart interface --- framework/domain/mimetreeparser/interface.h | 327 ++++++++++++++++++++++++++++ 1 file changed, 327 insertions(+) create mode 100644 framework/domain/mimetreeparser/interface.h (limited to 'framework/domain/mimetreeparser/interface.h') diff --git a/framework/domain/mimetreeparser/interface.h b/framework/domain/mimetreeparser/interface.h new file mode 100644 index 00000000..a9e394db --- /dev/null +++ b/framework/domain/mimetreeparser/interface.h @@ -0,0 +1,327 @@ +/* + Copyright (c) 2016 Sandro Knauß + + This library is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + This library 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 Library General Public + License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ + +#pragma once + +#include +#include + +class Part; +class EncryptionPart; +class SignaturePart; + +class MimePart; +class MimePartPrivate; + +class ContentPart; +class ContentPartPrivate; + +class EncryptionErrorPart; +class EncryptionErrorPartPrivate; + +class AttachmentPart; +class AttachmentPartPrivate; + +class EncapsulatedPart; +class EncapsulatedPart; + +class CertPart; +class CertPart; + +class Key; +class Signature; +class Encryption; + +class Parser; +class ParserPrivate; + +class Parser +{ +public: + Parser(const QByteArray &mimeMessage); + + std::shared_ptr getPart(QUrl url); + + QVector> collect() const; + QVector> collect() const; + QVector> collect(Part start, std::function select, std::function &)> filter) const; + +private: + std::unique_ptr d; +}; + +class Part +{ +public: + virtual QByteArray type() const = 0; + + bool hasSubParts() const; + QList subParts() const; + Part partent() const; +}; + +/* + * A MessagePart that is based on a KMime::Content + */ +class MimePart : public Part +{ +public: + /** + * Various possible values for the "Content-Disposition" header. + */ + enum Disposition { + Invalid, ///< Default, invalid value + Inline, ///< inline + Attachment, ///< attachment + Parallel ///< parallel (invalid, do not use) + }; + + // interessting header parts of a KMime::Content + QByteArray content() const; + QMimeType mimetype() const; + Disposition dispossition() const + QUrl label() const; + QByteArray cid() const; + QByteArray charset() const; + + // we wanna overrwrite the charset of the content, because some clients set the charset wrong + void setCharset(QByteArray charset); + + // Unique identifier to ecactly this KMime::Content + QByteArray link() const; + + + QByteArray type() const Q_DECL_OVERRIDE; +private: + std::unique_ptr d; +}; + +/* + * The main ContentPart + * is MimePart a good parent class? + * do we wanna need parts of the header of the connected KMime::Contents + * usecases: + * - + * for htmlonly it is representating only one MimePart (ok) + * for plaintext only also only one MimePart (ok) + * for alternative, we are represating three messageparts + * - "headers" do we return?, we can use setType to make it possible to select and than return these headers + */ +class ContentPart : public MimePart +{ +public: + enum Types { + PlainText, + Html + }; + Q_DECLARE_FLAGS(Types, Type) + + QByteArray content(Content::Type ct) const; + + // convert content with charset + QString content(Content::Type ct) const; + + Content::Types availableContent() const; + QVector signature() const; + QVector encryption() const; + + QByteArray type() const Q_DECL_OVERRIDE; + +private: + std::unique_ptr d; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(ContentPart::Type) + +class AttachmentPart : public MimePart +{ +public: + QByteArray type() const Q_DECL_OVERRIDE; + +private: + std::unique_ptr d; +}; + +/* + * Faild to decrypt part + * thigs liks this can happen: + * decryption in progress + * have not tried at all to decrypt + * wrong passphrase + * no private key + * cryptobackend is not configured correctly (no gpg available) + * -> S/Mime and PGP have different meaning in their errors + * + * Open Questions: + * - How to make the string translateable for multiple clients, so that multiple clients can show same error messages, + * that helps users to understand what is going on ? + * - Does openpgp have translations already? + */ +class EncryptionErrorPart : public Part +{ +public: + Error errorId() const; + + CryptoBackend cryptoBackend(); + + QByteArray type() const Q_DECL_OVERRIDE; + +private: + std::unique_ptr d; +}; + +/* + * we want to request complete headers like: + * from/to... + */ + +class EncapsulatedPart :: public AttachmentPart +{ +public: + QByteArray type() const Q_DECL_OVERRIDE; + + QByteArray header(); +private: + std::unique_ptr d; +}; + +/* + * importing a cert GpgMe::ImportResult + * checking a cert (if it is a valid cert) + */ + +class CertPart :: public AttachmentPart +{ +public: + QByteArray type() const Q_DECL_OVERRIDE; + + bool checkCert() const; + Status importCert() const; + +private: + std::unique_ptr d; +}; + +/* +the ggme error class + +// class GPGMEPP_EXPORT ErrorImportResult +{ +public: + Error() : mErr(0), mMessage() {} + explicit Error(unsigned int e) : mErr(e), mMessage() {} + + const char *source() const; + const char *asString() const; + + int code() const; + int sourceID() const; + + bool isCanceled() const; + + unsigned int encodedError() const + { + return mErr; + } + int toErrno() const; + + static bool hasSystemError(); + static Error fromSystemError(unsigned int src = GPGMEPP_ERR_SOURCE_DEFAULT); + static void setSystemError(gpg_err_code_t err); + static void setErrno(int err); + static Error fromErrno(int err, unsigned int src = GPGMEPP_ERR_SOURCE_DEFAULT); + static Error fromCode(unsigned int err, unsigned int src = GPGMEPP_ERR_SOURCE_DEFAULT); + + GPGMEPP_MAKE_SAFE_BOOL_OPERATOR(mErr &&!isCanceled()) +private: + unsigned int mErr; + mutable std::string mMessage; +}; +*/ + +/* + * a used smime/PGP key + * in the end we also need things like: + bool isRevokation() const; + bool isInvalid() const; + bool isExpired() const; + + -> so we end up wrapping GpgME::Key + */ +class Key +{ + QString keyid() const; + QString name() const; + QString email() const; + QString comment() const; + QVector emails() const; + KeyTrust keyTrust() const; + CryptoBackend cryptoBackend() const; + + std::vector subkeys(); + Key parentkey() const; +}; + +class Signature +{ + Key key() const; + QDateTime creationDateTime() const; + QDateTime expirationTime() const; + bool neverExpires() const; + + bool inProgress(); //if the verfication is inProgress + + enum Validity { + Unknown, Undefined, Never, Marginal, Full, Ultimate + }; + Validity validity() const; + + // to determine if we need this in our usecase (email) + // GpgME::VerificationResult + enum Summary { + None = 0x000, + Valid = 0x001, + Green = 0x002, + Red = 0x004, + KeyRevoked = 0x008, + KeyExpired = 0x010, + SigExpired = 0x020, + KeyMissing = 0x040, + CrlMissing = 0x080, + CrlTooOld = 0x100, + BadPolicy = 0x200, + SysError = 0x400 + }; + Summary summary() const; + + const char *policyURL() const; + GpgME::Notation notation(unsigned int index) const; + std::vector notations() const; + +}; + +/* + * Normally the Keys for encryption are subkeys + * for clients the parentkeys are "more interessting", because they store the name, email etc. + * but a client may also wants show to what subkey the mail is really encrypted, an if this subkey isRevoked or something else + */ +class Encryption +{ + std::vector recipients() const; +}; \ No newline at end of file -- cgit v1.2.3 From 7815e94c52d092701804521eee850ac35d7f7781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Knau=C3=9F?= Date: Thu, 14 Jul 2016 18:36:02 +0200 Subject: updated --- framework/domain/mimetreeparser/interface.h | 81 ++++++++++++++++++++++------- 1 file changed, 62 insertions(+), 19 deletions(-) (limited to 'framework/domain/mimetreeparser/interface.h') diff --git a/framework/domain/mimetreeparser/interface.h b/framework/domain/mimetreeparser/interface.h index a9e394db..320030b7 100644 --- a/framework/domain/mimetreeparser/interface.h +++ b/framework/domain/mimetreeparser/interface.h @@ -23,32 +23,41 @@ #include class Part; +typedef std::shared_ptr Part::Ptr; class EncryptionPart; +typedef std::shared_ptr EncryptionPart::Ptr; class SignaturePart; +typedef std::shared_ptr SignaturePart::Ptr; class MimePart; +typedef std::shared_ptr MimePart::Ptr; class MimePartPrivate; class ContentPart; +typedef std::shared_ptr ContentPart::Ptr; class ContentPartPrivate; class EncryptionErrorPart; +typedef std::shared_ptr EncryptionErrorPart::Ptr; class EncryptionErrorPartPrivate; class AttachmentPart; +typedef std::shared_ptr AttachmentPart::Ptr; class AttachmentPartPrivate; class EncapsulatedPart; +typedef std::shared_ptr EncapsulatedPart::Ptr; class EncapsulatedPart; class CertPart; -class CertPart; +typedef std::shared_ptr CertPart::Ptr; class Key; class Signature; class Encryption; class Parser; +typedef std::shared_ptr Parser::Ptr; class ParserPrivate; class Parser @@ -56,30 +65,71 @@ class Parser public: Parser(const QByteArray &mimeMessage); - std::shared_ptr getPart(QUrl url); + Part::Ptr getPart(QUrl url); - QVector> collect() const; - QVector> collect() const; - QVector> collect(Part start, std::function select, std::function &)> filter) const; + QVector collect() const; + QVector collect() const; + QVector collect(Part start, std::function select, std::function filter) const; private: std::unique_ptr d; }; + class Part { public: virtual QByteArray type() const = 0; bool hasSubParts() const; - QList subParts() const; - Part partent() const; + QList subParts() const; + Part parent() const; + + virtual QVector signatures() const; + virtual QVector encryptions() const; }; +//A structure element, that we need to reflect, that there is a Encryption starts +// only add a new Encrption block to encryptions block +class EncryptionPart : public Part +{ +public: + QVector encryptions() const Q_DECL_OVERRIDE; + QByteArray type() const Q_DECL_OVERRIDE; +}; + +// A structure element, that we need to reflect, that there is a Signature starts +// only add a new Signature block to signature block +// With this we can a new Singature type like pep aka +/* + * add a bodypartformatter, that returns a PEPSignaturePart with all signed subparts that are signed with pep. + * subclass Signature aka PEPSignature to reflect different way of properties of PEPSignatures. + */ +class SignaturePart : public Part +{ +public: + QVector signatures() const Q_DECL_OVERRIDE; + QByteArray type() const Q_DECL_OVERRIDE; +}; + + + +class TextPart : public Part +{ +public: + QByteArray content() const; + + //Use default charset + QString encodedContent() const; + + // overwrite default charset with given charset + QString encodedContent(QByteArray charset) const; +} + /* * A MessagePart that is based on a KMime::Content */ -class MimePart : public Part +class MimePart : public TextPart { public: /** @@ -88,14 +138,12 @@ public: enum Disposition { Invalid, ///< Default, invalid value Inline, ///< inline - Attachment, ///< attachment - Parallel ///< parallel (invalid, do not use) + Attachment ///< attachment }; // interessting header parts of a KMime::Content - QByteArray content() const; QMimeType mimetype() const; - Disposition dispossition() const + Disposition disposition() const; QUrl label() const; QByteArray cid() const; QByteArray charset() const; @@ -123,7 +171,7 @@ private: * for alternative, we are represating three messageparts * - "headers" do we return?, we can use setType to make it possible to select and than return these headers */ -class ContentPart : public MimePart +class MainContentPart : public MimePart { public: enum Types { @@ -132,14 +180,9 @@ public: }; Q_DECLARE_FLAGS(Types, Type) - QByteArray content(Content::Type ct) const; - - // convert content with charset - QString content(Content::Type ct) const; + QVector content(Content::Type ct) const; Content::Types availableContent() const; - QVector signature() const; - QVector encryption() const; QByteArray type() const Q_DECL_OVERRIDE; -- cgit v1.2.3 From 2fdddd2f795da4645dc9a48fee4865324143a21b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Knau=C3=9F?= Date: Mon, 18 Jul 2016 15:35:07 +0200 Subject: first tests with mimetreeparser interface --- framework/domain/mimetreeparser/interface.h | 281 ++++++++++++---------------- 1 file changed, 119 insertions(+), 162 deletions(-) (limited to 'framework/domain/mimetreeparser/interface.h') diff --git a/framework/domain/mimetreeparser/interface.h b/framework/domain/mimetreeparser/interface.h index 320030b7..82f88e73 100644 --- a/framework/domain/mimetreeparser/interface.h +++ b/framework/domain/mimetreeparser/interface.h @@ -19,104 +19,70 @@ #pragma once +#include +#include + +#include #include #include class Part; -typedef std::shared_ptr Part::Ptr; -class EncryptionPart; -typedef std::shared_ptr EncryptionPart::Ptr; -class SignaturePart; -typedef std::shared_ptr SignaturePart::Ptr; +class PartPrivate; class MimePart; -typedef std::shared_ptr MimePart::Ptr; class MimePartPrivate; class ContentPart; -typedef std::shared_ptr ContentPart::Ptr; class ContentPartPrivate; -class EncryptionErrorPart; -typedef std::shared_ptr EncryptionErrorPart::Ptr; -class EncryptionErrorPartPrivate; +class EncryptionPart; +class EncryptionPartPrivate; class AttachmentPart; -typedef std::shared_ptr AttachmentPart::Ptr; class AttachmentPartPrivate; class EncapsulatedPart; -typedef std::shared_ptr EncapsulatedPart::Ptr; -class EncapsulatedPart; +class EncapsulatedPartPrivate; class CertPart; -typedef std::shared_ptr CertPart::Ptr; +class CertPartPrivate; + +class Content; +class ContentPrivate; class Key; class Signature; class Encryption; class Parser; -typedef std::shared_ptr Parser::Ptr; class ParserPrivate; -class Parser -{ -public: - Parser(const QByteArray &mimeMessage); - - Part::Ptr getPart(QUrl url); - - QVector collect() const; - QVector collect() const; - QVector collect(Part start, std::function select, std::function filter) const; - -private: - std::unique_ptr d; -}; - - class Part { public: - virtual QByteArray type() const = 0; + typedef std::shared_ptr Ptr; + Part(); + virtual QByteArray type() const; bool hasSubParts() const; - QList subParts() const; - Part parent() const; + QVector subParts() const; + Part::Ptr parent() const; virtual QVector signatures() const; virtual QVector encryptions() const; +private: + std::unique_ptr d; + friend class ParserPrivate; + friend class PartPrivate; }; -//A structure element, that we need to reflect, that there is a Encryption starts -// only add a new Encrption block to encryptions block -class EncryptionPart : public Part -{ -public: - QVector encryptions() const Q_DECL_OVERRIDE; - QByteArray type() const Q_DECL_OVERRIDE; -}; - -// A structure element, that we need to reflect, that there is a Signature starts -// only add a new Signature block to signature block -// With this we can a new Singature type like pep aka -/* - * add a bodypartformatter, that returns a PEPSignaturePart with all signed subparts that are signed with pep. - * subclass Signature aka PEPSignature to reflect different way of properties of PEPSignatures. - */ -class SignaturePart : public Part +class Content { public: - QVector signatures() const Q_DECL_OVERRIDE; - QByteArray type() const Q_DECL_OVERRIDE; -}; - + typedef std::shared_ptr Ptr; + Content(const QByteArray &content, ContentPart *parent); + virtual ~Content(); - -class TextPart : public Part -{ -public: QByteArray content() const; //Use default charset @@ -124,14 +90,20 @@ public: // overwrite default charset with given charset QString encodedContent(QByteArray charset) const; -} + + virtual QVector signatures() const; + virtual QVector encryptions() const; +private: + std::unique_ptr d; +}; /* * A MessagePart that is based on a KMime::Content */ -class MimePart : public TextPart +class MimePart : public Part { public: + typedef std::shared_ptr Ptr; /** * Various possible values for the "Content-Disposition" header. */ @@ -154,6 +126,13 @@ public: // Unique identifier to ecactly this KMime::Content QByteArray link() const; + QByteArray content() const; + + //Use default charset + QString encodedContent() const; + + // overwrite default charset with given charset + QString encodedContent(QByteArray charset) const; QByteArray type() const Q_DECL_OVERRIDE; private: @@ -171,77 +150,84 @@ private: * for alternative, we are represating three messageparts * - "headers" do we return?, we can use setType to make it possible to select and than return these headers */ -class MainContentPart : public MimePart +class ContentPart : public Part { public: - enum Types { - PlainText, - Html + typedef std::shared_ptr Ptr; + enum Type { + PlainText = 0x0001, + Html = 0x0002 }; Q_DECLARE_FLAGS(Types, Type) - QVector content(Content::Type ct) const; + ContentPart(); + virtual ~ContentPart(); + + QVector content(Type ct) const; - Content::Types availableContent() const; + Types availableContents() const; QByteArray type() const Q_DECL_OVERRIDE; private: std::unique_ptr d; + + friend class ParserPrivate; }; -Q_DECLARE_OPERATORS_FOR_FLAGS(ContentPart::Type) +Q_DECLARE_OPERATORS_FOR_FLAGS(ContentPart::Types); class AttachmentPart : public MimePart { public: + typedef std::shared_ptr Ptr; QByteArray type() const Q_DECL_OVERRIDE; private: std::unique_ptr d; + friend class ParserPrivate; }; /* - * Faild to decrypt part - * thigs liks this can happen: - * decryption in progress - * have not tried at all to decrypt - * wrong passphrase - * no private key - * cryptobackend is not configured correctly (no gpg available) - * -> S/Mime and PGP have different meaning in their errors - * * Open Questions: * - How to make the string translateable for multiple clients, so that multiple clients can show same error messages, * that helps users to understand what is going on ? * - Does openpgp have translations already? */ -class EncryptionErrorPart : public Part +class EncryptionError { public: - Error errorId() const; - - CryptoBackend cryptoBackend(); + int errorId() const; + QString errorString() const; +}; +class EncryptionPart : public MimePart +{ +public: + typedef std::shared_ptr Ptr; QByteArray type() const Q_DECL_OVERRIDE; + EncryptionError error() const; + private: - std::unique_ptr d; + std::unique_ptr d; }; + /* * we want to request complete headers like: * from/to... */ -class EncapsulatedPart :: public AttachmentPart +class EncapsulatedPart : public AttachmentPart { public: + typedef std::shared_ptr Ptr; QByteArray type() const Q_DECL_OVERRIDE; - QByteArray header(); + //template QByteArray header(); private: - std::unique_ptr d; + std::unique_ptr d; }; /* @@ -249,64 +235,31 @@ private: * checking a cert (if it is a valid cert) */ -class CertPart :: public AttachmentPart +class CertPart : public AttachmentPart { public: + typedef std::shared_ptr Ptr; QByteArray type() const Q_DECL_OVERRIDE; - bool checkCert() const; - Status importCert() const; - -private: - std::unique_ptr d; -}; - -/* -the ggme error class - -// class GPGMEPP_EXPORT ErrorImportResult -{ -public: - Error() : mErr(0), mMessage() {} - explicit Error(unsigned int e) : mErr(e), mMessage() {} - - const char *source() const; - const char *asString() const; - - int code() const; - int sourceID() const; - - bool isCanceled() const; + enum CertType { + Pgp, + SMime + }; - unsigned int encodedError() const - { - return mErr; - } - int toErrno() const; + enum CertSubType { + Public, + Private + }; - static bool hasSystemError(); - static Error fromSystemError(unsigned int src = GPGMEPP_ERR_SOURCE_DEFAULT); - static void setSystemError(gpg_err_code_t err); - static void setErrno(int err); - static Error fromErrno(int err, unsigned int src = GPGMEPP_ERR_SOURCE_DEFAULT); - static Error fromCode(unsigned int err, unsigned int src = GPGMEPP_ERR_SOURCE_DEFAULT); + CertType certType() const; + CertSubType certSubType() const; + int keyLength() const; - GPGMEPP_MAKE_SAFE_BOOL_OPERATOR(mErr &&!isCanceled()) private: - unsigned int mErr; - mutable std::string mMessage; + std::unique_ptr d; }; -*/ -/* - * a used smime/PGP key - * in the end we also need things like: - bool isRevokation() const; - bool isInvalid() const; - bool isExpired() const; - -> so we end up wrapping GpgME::Key - */ class Key { QString keyid() const; @@ -314,8 +267,14 @@ class Key QString email() const; QString comment() const; QVector emails() const; + enum KeyTrust { + Unknown, Undefined, Never, Marginal, Full, Ultimate + }; KeyTrust keyTrust() const; - CryptoBackend cryptoBackend() const; + + bool isRevokation() const; + bool isInvalid() const; + bool isExpired() const; std::vector subkeys(); Key parentkey() const; @@ -328,35 +287,7 @@ class Signature QDateTime expirationTime() const; bool neverExpires() const; - bool inProgress(); //if the verfication is inProgress - - enum Validity { - Unknown, Undefined, Never, Marginal, Full, Ultimate - }; - Validity validity() const; - - // to determine if we need this in our usecase (email) - // GpgME::VerificationResult - enum Summary { - None = 0x000, - Valid = 0x001, - Green = 0x002, - Red = 0x004, - KeyRevoked = 0x008, - KeyExpired = 0x010, - SigExpired = 0x020, - KeyMissing = 0x040, - CrlMissing = 0x080, - CrlTooOld = 0x100, - BadPolicy = 0x200, - SysError = 0x400 - }; - Summary summary() const; - - const char *policyURL() const; - GpgME::Notation notation(unsigned int index) const; - std::vector notations() const; - + //template <> StatusObject verify() const; }; /* @@ -367,4 +298,30 @@ class Signature class Encryption { std::vector recipients() const; +}; + +class Parser +{ +public: + typedef std::shared_ptr Ptr; + Parser(const QByteArray &mimeMessage); + ~Parser(); + + Part::Ptr getPart(QUrl url); + + //template QVector collect(Part start, std::function select, std::function filter) const; + QVector collectAttachments(Part::Ptr start, std::function select, std::function filter) const; + ContentPart::Ptr collectContentPart(Part::Ptr start, std::function select, std::function filter) const; + ContentPart::Ptr collectContentPart(const Part::Ptr& start) const; + ContentPart::Ptr collectContentPart() const; + //template <> QVector collect() const; + + //template <> static StatusObject verifySignature(const Signature signature) const; + //template <> static StatusObject decrypt(const EncryptedPart part) const; + +signals: + void partsChanged(); + +private: + std::unique_ptr d; }; \ No newline at end of file -- cgit v1.2.3 From 9516f3b02f74f239ce2776abf7cf1147952065cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Knau=C3=9F?= Date: Tue, 19 Jul 2016 14:46:23 +0200 Subject: new mimetreeparser interface Reviewers: cmollekopf Maniphest Tasks: T3208 Differential Revision: https://phabricator.kde.org/D2221 --- framework/domain/mimetreeparser/interface.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'framework/domain/mimetreeparser/interface.h') diff --git a/framework/domain/mimetreeparser/interface.h b/framework/domain/mimetreeparser/interface.h index 82f88e73..8a0047ff 100644 --- a/framework/domain/mimetreeparser/interface.h +++ b/framework/domain/mimetreeparser/interface.h @@ -66,7 +66,7 @@ public: bool hasSubParts() const; QVector subParts() const; - Part::Ptr parent() const; + Part *parent() const; virtual QVector signatures() const; virtual QVector encryptions() const; @@ -85,6 +85,8 @@ public: QByteArray content() const; + QByteArray charset() const; + //Use default charset QString encodedContent() const; @@ -162,8 +164,8 @@ public: ContentPart(); virtual ~ContentPart(); - - QVector content(Type ct) const; + + QVector content(Type ct) const; Types availableContents() const; @@ -259,7 +261,6 @@ private: std::unique_ptr d; }; - class Key { QString keyid() const; @@ -309,7 +310,7 @@ public: Part::Ptr getPart(QUrl url); - //template QVector collect(Part start, std::function select, std::function filter) const; + template QVector collect(const Part::Ptr &start, std::function select, std::function filter) const; QVector collectAttachments(Part::Ptr start, std::function select, std::function filter) const; ContentPart::Ptr collectContentPart(Part::Ptr start, std::function select, std::function filter) const; ContentPart::Ptr collectContentPart(const Part::Ptr& start) const; @@ -324,4 +325,5 @@ signals: private: std::unique_ptr d; -}; \ No newline at end of file +}; + -- cgit v1.2.3 From 550aa371cbf39d7d0cb735f890b338a3ac6883ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Knau=C3=9F?= Date: Wed, 20 Jul 2016 10:04:49 +0200 Subject: add encrypted tests --- framework/domain/mimetreeparser/interface.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'framework/domain/mimetreeparser/interface.h') diff --git a/framework/domain/mimetreeparser/interface.h b/framework/domain/mimetreeparser/interface.h index 8a0047ff..0aef7fd0 100644 --- a/framework/domain/mimetreeparser/interface.h +++ b/framework/domain/mimetreeparser/interface.h @@ -187,6 +187,7 @@ public: private: std::unique_ptr d; + friend class ParserPrivate; }; @@ -325,5 +326,7 @@ signals: private: std::unique_ptr d; + + friend class InterfaceTest; }; -- cgit v1.2.3 From cf5b3e797421e7dbf2c0d7b1efff91fc07277652 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Knau=C3=9F?= Date: Wed, 20 Jul 2016 17:35:29 +0200 Subject: new thoughts for interface --- framework/domain/mimetreeparser/interface.h | 246 ++++++++++++++-------------- 1 file changed, 122 insertions(+), 124 deletions(-) (limited to 'framework/domain/mimetreeparser/interface.h') diff --git a/framework/domain/mimetreeparser/interface.h b/framework/domain/mimetreeparser/interface.h index 0aef7fd0..5133b87e 100644 --- a/framework/domain/mimetreeparser/interface.h +++ b/framework/domain/mimetreeparser/interface.h @@ -29,11 +29,14 @@ class Part; class PartPrivate; -class MimePart; -class MimePartPrivate; +class MailMime; +class MailMimePrivate; -class ContentPart; -class ContentPartPrivate; +class AlternativePart; +class AlternativePartPrivate; + +class SinglePart; +class SinglePartPrivate; class EncryptionPart; class EncryptionPartPrivate; @@ -44,12 +47,14 @@ class AttachmentPartPrivate; class EncapsulatedPart; class EncapsulatedPartPrivate; -class CertPart; -class CertPartPrivate; - class Content; class ContentPrivate; +class CertContent; +class CertContentPrivate; + +class EncryptionError; + class Key; class Signature; class Encryption; @@ -57,30 +62,48 @@ class Encryption; class Parser; class ParserPrivate; -class Part +/* + * A MessagePart that is based on a KMime::Content + */ +class MailMime { public: - typedef std::shared_ptr Ptr; - Part(); - virtual QByteArray type() const; + typedef std::shared_ptr Ptr; + /** + * Various possible values for the "Content-Disposition" header. + */ + enum Disposition { + Invalid, ///< Default, invalid value + Inline, ///< inline + Attachment ///< attachment + }; - bool hasSubParts() const; - QVector subParts() const; - Part *parent() const; + // interessting header parts of a KMime::Content + QMimeType mimetype() const; + Disposition disposition() const; + QUrl label() const; + QByteArray cid() const; + QByteArray charset() const; + + // Unique identifier to ecactly this KMime::Content + QByteArray link() const; + + QByteArray content() const; + //Use default charset + QString encodedContent() const; + + // overwrite default charset with given charset + QString encodedContent(QByteArray charset) const; - virtual QVector signatures() const; - virtual QVector encryptions() const; private: - std::unique_ptr d; - friend class ParserPrivate; - friend class PartPrivate; + std::unique_ptr d; }; class Content { public: typedef std::shared_ptr Ptr; - Content(const QByteArray &content, ContentPart *parent); + Content(const QByteArray &content, Part *parent); virtual ~Content(); QByteArray content() const; @@ -95,123 +118,122 @@ public: virtual QVector signatures() const; virtual QVector encryptions() const; + MailMime::Ptr mailMime() const; + virtual QByteArray type() const; private: std::unique_ptr d; }; -/* - * A MessagePart that is based on a KMime::Content - */ -class MimePart : public Part +class PlainTextContent : public Content { public: - typedef std::shared_ptr Ptr; - /** - * Various possible values for the "Content-Disposition" header. - */ - enum Disposition { - Invalid, ///< Default, invalid value - Inline, ///< inline - Attachment ///< attachment - }; + QByteArray type() const Q_DECL_OVERRIDE; +}; - // interessting header parts of a KMime::Content - QMimeType mimetype() const; - Disposition disposition() const; - QUrl label() const; - QByteArray cid() const; - QByteArray charset() const; +class HtmlContent : public Content +{ +public: + QByteArray type() const Q_DECL_OVERRIDE; +}; - // we wanna overrwrite the charset of the content, because some clients set the charset wrong - void setCharset(QByteArray charset); +/* + * importing a cert GpgMe::ImportResult + * checking a cert (if it is a valid cert) + */ - // Unique identifier to ecactly this KMime::Content - QByteArray link() const; +class CertContent : public Content +{ +public: + typedef std::shared_ptr Ptr; - QByteArray content() const; + QByteArray type() const Q_DECL_OVERRIDE; + enum CertType { + Pgp, + SMime + }; - //Use default charset - QString encodedContent() const; + enum CertSubType { + Public, + Private + }; - // overwrite default charset with given charset - QString encodedContent(QByteArray charset) const; + CertType certType() const; + CertSubType certSubType() const; + int keyLength() const; - QByteArray type() const Q_DECL_OVERRIDE; private: - std::unique_ptr d; + std::unique_ptr d; }; -/* - * The main ContentPart - * is MimePart a good parent class? - * do we wanna need parts of the header of the connected KMime::Contents - * usecases: - * - - * for htmlonly it is representating only one MimePart (ok) - * for plaintext only also only one MimePart (ok) - * for alternative, we are represating three messageparts - * - "headers" do we return?, we can use setType to make it possible to select and than return these headers - */ -class ContentPart : public Part +class Part { public: - typedef std::shared_ptr Ptr; - enum Type { - PlainText = 0x0001, - Html = 0x0002 - }; - Q_DECLARE_FLAGS(Types, Type) - - ContentPart(); - virtual ~ContentPart(); - - QVector content(Type ct) const; + typedef std::shared_ptr Ptr; + Part(); + virtual QByteArray type() const; - Types availableContents() const; + virtual QVector availableContents() const; + virtual QVector content() const; - QByteArray type() const Q_DECL_OVERRIDE; + bool hasSubParts() const; + QVector subParts() const; + Part *parent() const; + virtual QVector signatures() const; + virtual QVector encryptions() const; + virtual MailMime::Ptr mailMime() const; private: - std::unique_ptr d; - + std::unique_ptr d; friend class ParserPrivate; + friend class PartPrivate; }; -Q_DECLARE_OPERATORS_FOR_FLAGS(ContentPart::Types); - -class AttachmentPart : public MimePart +class AlternativePart : public Part { public: - typedef std::shared_ptr Ptr; + typedef std::shared_ptr Ptr; + + AlternativePart(); + virtual ~AlternativePart(); + + QVector content() const Q_DECL_OVERRIDE; + QVector availableContents() const Q_DECL_OVERRIDE; + QVector content(const QByteArray& ct) const; + QByteArray type() const Q_DECL_OVERRIDE; private: - std::unique_ptr d; + std::unique_ptr d; friend class ParserPrivate; }; -/* - * Open Questions: - * - How to make the string translateable for multiple clients, so that multiple clients can show same error messages, - * that helps users to understand what is going on ? - * - Does openpgp have translations already? - */ -class EncryptionError +class SinglePart : public Part { -public: - int errorId() const; - QString errorString() const; + public: + typedef std::shared_ptr Ptr; + + SinglePart(); + virtual ~SinglePart(); + + QVector content() const Q_DECL_OVERRIDE; + QVector availableContents() const Q_DECL_OVERRIDE; + + QByteArray type() const Q_DECL_OVERRIDE; +private: + std::unique_ptr d; + + friend class ParserPrivate; }; -class EncryptionPart : public MimePart + +class EncryptionPart : public Part { public: typedef std::shared_ptr Ptr; QByteArray type() const Q_DECL_OVERRIDE; EncryptionError error() const; - private: std::unique_ptr d; }; @@ -222,7 +244,7 @@ private: * from/to... */ -class EncapsulatedPart : public AttachmentPart +class EncapsulatedPart : public SinglePart { public: typedef std::shared_ptr Ptr; @@ -233,33 +255,11 @@ private: std::unique_ptr d; }; -/* - * importing a cert GpgMe::ImportResult - * checking a cert (if it is a valid cert) - */ - -class CertPart : public AttachmentPart +class EncryptionError { public: - typedef std::shared_ptr Ptr; - QByteArray type() const Q_DECL_OVERRIDE; - - enum CertType { - Pgp, - SMime - }; - - enum CertSubType { - Public, - Private - }; - - CertType certType() const; - CertSubType certSubType() const; - int keyLength() const; - -private: - std::unique_ptr d; + int errorId() const; + QString errorString() const; }; class Key @@ -312,10 +312,8 @@ public: Part::Ptr getPart(QUrl url); template QVector collect(const Part::Ptr &start, std::function select, std::function filter) const; - QVector collectAttachments(Part::Ptr start, std::function select, std::function filter) const; - ContentPart::Ptr collectContentPart(Part::Ptr start, std::function select, std::function filter) const; - ContentPart::Ptr collectContentPart(const Part::Ptr& start) const; - ContentPart::Ptr collectContentPart() const; + //QVector collectAttachments(Part::Ptr start, std::function select, std::function filter) const; + QVector collectContentParts() const; //template <> QVector collect() const; //template <> static StatusObject verifySignature(const Signature signature) const; -- cgit v1.2.3 From 903960116eb3329631702723bba11f5463eff573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Knau=C3=9F?= Date: Fri, 22 Jul 2016 13:23:17 +0200 Subject: fixes the build issues --- framework/domain/mimetreeparser/interface.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'framework/domain/mimetreeparser/interface.h') diff --git a/framework/domain/mimetreeparser/interface.h b/framework/domain/mimetreeparser/interface.h index 5133b87e..f6ee41ee 100644 --- a/framework/domain/mimetreeparser/interface.h +++ b/framework/domain/mimetreeparser/interface.h @@ -41,9 +41,6 @@ class SinglePartPrivate; class EncryptionPart; class EncryptionPartPrivate; -class AttachmentPart; -class AttachmentPartPrivate; - class EncapsulatedPart; class EncapsulatedPartPrivate; @@ -84,6 +81,7 @@ public: QUrl label() const; QByteArray cid() const; QByteArray charset() const; + QByteArray filename() const; // Unique identifier to ecactly this KMime::Content QByteArray link() const; @@ -95,6 +93,8 @@ public: // overwrite default charset with given charset QString encodedContent(QByteArray charset) const; + bool isFirstTextPart() const; + private: std::unique_ptr d; }; @@ -127,12 +127,14 @@ private: class PlainTextContent : public Content { public: + PlainTextContent(const QByteArray &content, Part *parent); QByteArray type() const Q_DECL_OVERRIDE; }; class HtmlContent : public Content { public: + HtmlContent(const QByteArray &content, Part *parent); QByteArray type() const Q_DECL_OVERRIDE; }; @@ -145,6 +147,7 @@ class CertContent : public Content { public: typedef std::shared_ptr Ptr; + CertContent(const QByteArray &content, Part *parent); QByteArray type() const Q_DECL_OVERRIDE; enum CertType { @@ -173,7 +176,8 @@ public: virtual QByteArray type() const; virtual QVector availableContents() const; - virtual QVector content() const; + virtual QVector content(const QByteArray& ct) const; + QVector content() const; bool hasSubParts() const; QVector subParts() const; @@ -196,9 +200,8 @@ public: AlternativePart(); virtual ~AlternativePart(); - QVector content() const Q_DECL_OVERRIDE; QVector availableContents() const Q_DECL_OVERRIDE; - QVector content(const QByteArray& ct) const; + QVector content(const QByteArray& ct) const Q_DECL_OVERRIDE; QByteArray type() const Q_DECL_OVERRIDE; @@ -216,7 +219,7 @@ class SinglePart : public Part SinglePart(); virtual ~SinglePart(); - QVector content() const Q_DECL_OVERRIDE; + QVector content(const QByteArray& ct) const Q_DECL_OVERRIDE; QVector availableContents() const Q_DECL_OVERRIDE; QByteArray type() const Q_DECL_OVERRIDE; @@ -311,9 +314,9 @@ public: Part::Ptr getPart(QUrl url); - template QVector collect(const Part::Ptr &start, std::function select, std::function filter) const; - //QVector collectAttachments(Part::Ptr start, std::function select, std::function filter) const; + QVector collect(const Part::Ptr &start, std::function select, std::function filter) const; QVector collectContentParts() const; + QVector collectAttachmentParts() const; //template <> QVector collect() const; //template <> static StatusObject verifySignature(const Signature signature) const; -- cgit v1.2.3 From 0272f1e8bb7f8c86c86958e3e022aac8b34a266c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Knau=C3=9F?= Date: Tue, 26 Jul 2016 13:52:06 +0200 Subject: make the tests compile again --- framework/domain/mimetreeparser/interface.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'framework/domain/mimetreeparser/interface.h') diff --git a/framework/domain/mimetreeparser/interface.h b/framework/domain/mimetreeparser/interface.h index f6ee41ee..c71b86d6 100644 --- a/framework/domain/mimetreeparser/interface.h +++ b/framework/domain/mimetreeparser/interface.h @@ -75,13 +75,15 @@ public: Attachment ///< attachment }; + MailMime(); + // interessting header parts of a KMime::Content QMimeType mimetype() const; Disposition disposition() const; QUrl label() const; QByteArray cid() const; QByteArray charset() const; - QByteArray filename() const; + QString filename() const; // Unique identifier to ecactly this KMime::Content QByteArray link() const; -- cgit v1.2.3 From a34e14a57c7726a99e63d767935379cba1ff6ea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Knau=C3=9F?= Date: Tue, 2 Aug 2016 09:32:12 +0200 Subject: Implement the interface --- framework/domain/mimetreeparser/interface.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'framework/domain/mimetreeparser/interface.h') diff --git a/framework/domain/mimetreeparser/interface.h b/framework/domain/mimetreeparser/interface.h index c71b86d6..a6a7f39d 100644 --- a/framework/domain/mimetreeparser/interface.h +++ b/framework/domain/mimetreeparser/interface.h @@ -96,9 +96,12 @@ public: QString encodedContent(QByteArray charset) const; bool isFirstTextPart() const; + bool isTopLevelPart() const; private: std::unique_ptr d; + + friend class PartPrivate; }; class Content @@ -122,6 +125,7 @@ public: virtual QVector encryptions() const; MailMime::Ptr mailMime() const; virtual QByteArray type() const; + Part* parent() const; private: std::unique_ptr d; }; @@ -188,8 +192,9 @@ public: virtual QVector signatures() const; virtual QVector encryptions() const; virtual MailMime::Ptr mailMime() const; -private: +protected: std::unique_ptr d; +private: friend class ParserPrivate; friend class PartPrivate; }; @@ -208,9 +213,11 @@ public: QByteArray type() const Q_DECL_OVERRIDE; private: + PartPrivate *reachParentD() const; std::unique_ptr d; friend class ParserPrivate; + friend class AlternativePartPrivate; }; class SinglePart : public Part @@ -226,9 +233,11 @@ class SinglePart : public Part QByteArray type() const Q_DECL_OVERRIDE; private: + PartPrivate *reachParentD() const; std::unique_ptr d; - friend class ParserPrivate; + friend class ParserPrivate; + friend class SinglePartPrivate; }; -- cgit v1.2.3 From 92d6fbd8f6a504da869454ca85f861e30c89a73c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Knau=C3=9F?= Date: Tue, 2 Aug 2016 18:14:00 +0200 Subject: make signs & encrytiopn work --- framework/domain/mimetreeparser/interface.h | 34 ++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'framework/domain/mimetreeparser/interface.h') diff --git a/framework/domain/mimetreeparser/interface.h b/framework/domain/mimetreeparser/interface.h index a6a7f39d..a482a824 100644 --- a/framework/domain/mimetreeparser/interface.h +++ b/framework/domain/mimetreeparser/interface.h @@ -54,7 +54,12 @@ class EncryptionError; class Key; class Signature; +class SignaturePrivate; class Encryption; +class EncryptionPrivate; + +typedef std::shared_ptr SignaturePtr; +typedef std::shared_ptr EncryptionPtr; class Parser; class ParserPrivate; @@ -109,6 +114,7 @@ class Content public: typedef std::shared_ptr Ptr; Content(const QByteArray &content, Part *parent); + Content(ContentPrivate *d_ptr); virtual ~Content(); QByteArray content() const; @@ -121,8 +127,8 @@ public: // overwrite default charset with given charset QString encodedContent(QByteArray charset) const; - virtual QVector signatures() const; - virtual QVector encryptions() const; + QVector signatures() const; + QVector encryptions() const; MailMime::Ptr mailMime() const; virtual QByteArray type() const; Part* parent() const; @@ -134,6 +140,7 @@ class PlainTextContent : public Content { public: PlainTextContent(const QByteArray &content, Part *parent); + PlainTextContent(ContentPrivate *d_ptr); QByteArray type() const Q_DECL_OVERRIDE; }; @@ -141,6 +148,7 @@ class HtmlContent : public Content { public: HtmlContent(const QByteArray &content, Part *parent); + HtmlContent(ContentPrivate* d_ptr); QByteArray type() const Q_DECL_OVERRIDE; }; @@ -171,9 +179,8 @@ public: int keyLength() const; private: - std::unique_ptr d; + std::unique_ptr d; }; - class Part { public: @@ -189,8 +196,8 @@ public: QVector subParts() const; Part *parent() const; - virtual QVector signatures() const; - virtual QVector encryptions() const; + QVector signatures() const; + QVector encryptions() const; virtual MailMime::Ptr mailMime() const; protected: std::unique_ptr d; @@ -298,12 +305,20 @@ class Key class Signature { +public: + typedef std::shared_ptr Ptr; + Signature(); + Signature(SignaturePrivate *); + ~Signature(); + Key key() const; QDateTime creationDateTime() const; QDateTime expirationTime() const; bool neverExpires() const; //template <> StatusObject verify() const; + private: + std::unique_ptr d; }; /* @@ -313,7 +328,14 @@ class Signature */ class Encryption { +public: + typedef std::shared_ptr Ptr; + Encryption(); + Encryption(EncryptionPrivate *); + ~Encryption(); std::vector recipients() const; +private: + std::unique_ptr d; }; class Parser -- cgit v1.2.3 From 349e404b539c1f9d1feb54658e2e6fbbd2165462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Knau=C3=9F?= Date: Wed, 10 Aug 2016 13:20:11 +0200 Subject: Use new mimetreeparser interface --- framework/domain/mimetreeparser/interface.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'framework/domain/mimetreeparser/interface.h') diff --git a/framework/domain/mimetreeparser/interface.h b/framework/domain/mimetreeparser/interface.h index a482a824..7eadc311 100644 --- a/framework/domain/mimetreeparser/interface.h +++ b/framework/domain/mimetreeparser/interface.h @@ -181,6 +181,7 @@ public: private: std::unique_ptr d; }; + class Part { public: @@ -346,6 +347,7 @@ public: ~Parser(); Part::Ptr getPart(QUrl url); + QUrl getPart(const QByteArray &cid); QVector collect(const Part::Ptr &start, std::function select, std::function filter) const; QVector collectContentParts() const; -- cgit v1.2.3 From 1974c19eadd497e355ac985a00d0571f3e6c7712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Knau=C3=9F?= Date: Tue, 11 Oct 2016 16:18:50 +0200 Subject: create model for new mailviewer --- framework/domain/mimetreeparser/interface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'framework/domain/mimetreeparser/interface.h') diff --git a/framework/domain/mimetreeparser/interface.h b/framework/domain/mimetreeparser/interface.h index 7eadc311..67246f37 100644 --- a/framework/domain/mimetreeparser/interface.h +++ b/framework/domain/mimetreeparser/interface.h @@ -125,7 +125,7 @@ public: QString encodedContent() const; // overwrite default charset with given charset - QString encodedContent(QByteArray charset) const; + QString encodedContent(const QByteArray &charset) const; QVector signatures() const; QVector encryptions() const; -- cgit v1.2.3 From b40e6c476e54c5dab834c4d01936d1f7bc33c60e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Knau=C3=9F?= Date: Wed, 12 Oct 2016 16:41:00 +0200 Subject: Make nested mails work with mailviewer --- framework/domain/mimetreeparser/interface.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'framework/domain/mimetreeparser/interface.h') diff --git a/framework/domain/mimetreeparser/interface.h b/framework/domain/mimetreeparser/interface.h index 67246f37..4b569546 100644 --- a/framework/domain/mimetreeparser/interface.h +++ b/framework/domain/mimetreeparser/interface.h @@ -101,8 +101,11 @@ public: QString encodedContent(QByteArray charset) const; bool isFirstTextPart() const; + bool isFirstPart() const; bool isTopLevelPart() const; + MailMime::Ptr parent() const; + private: std::unique_ptr d; -- cgit v1.2.3 From b7a02699eefd84c68ff602bfea91640faec5c4ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Knau=C3=9F?= Date: Mon, 17 Oct 2016 13:05:43 +0200 Subject: find part by cid --- framework/domain/mimetreeparser/interface.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'framework/domain/mimetreeparser/interface.h') diff --git a/framework/domain/mimetreeparser/interface.h b/framework/domain/mimetreeparser/interface.h index 4b569546..cc6c68d2 100644 --- a/framework/domain/mimetreeparser/interface.h +++ b/framework/domain/mimetreeparser/interface.h @@ -349,10 +349,10 @@ public: Parser(const QByteArray &mimeMessage); ~Parser(); - Part::Ptr getPart(QUrl url); - QUrl getPart(const QByteArray &cid); + Part::Ptr getPart(const QUrl &url); QVector collect(const Part::Ptr &start, std::function select, std::function filter) const; + Part::Ptr find(const Part::Ptr &start, std::function select) const; QVector collectContentParts() const; QVector collectAttachmentParts() const; //template <> QVector collect() const; -- cgit v1.2.3 From 1fe0ab05ae2bfe6505736f598bd535a71fb86a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Knau=C3=9F?= Date: Mon, 17 Oct 2016 15:35:49 +0200 Subject: replace cid links with actuall content of the images --- framework/domain/mimetreeparser/interface.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'framework/domain/mimetreeparser/interface.h') diff --git a/framework/domain/mimetreeparser/interface.h b/framework/domain/mimetreeparser/interface.h index cc6c68d2..f88271af 100644 --- a/framework/domain/mimetreeparser/interface.h +++ b/framework/domain/mimetreeparser/interface.h @@ -100,6 +100,8 @@ public: // overwrite default charset with given charset QString encodedContent(QByteArray charset) const; + QByteArray decodedContent() const; + bool isFirstTextPart() const; bool isFirstPart() const; bool isTopLevelPart() const; -- cgit v1.2.3 From d15a02d3c26c24530e8d9360629212e419c81c79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20Knau=C3=9F?= Date: Mon, 17 Oct 2016 19:06:12 +0200 Subject: fill Encryption and Signatures with content --- framework/domain/mimetreeparser/interface.h | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'framework/domain/mimetreeparser/interface.h') diff --git a/framework/domain/mimetreeparser/interface.h b/framework/domain/mimetreeparser/interface.h index f88271af..3ff29d5d 100644 --- a/framework/domain/mimetreeparser/interface.h +++ b/framework/domain/mimetreeparser/interface.h @@ -53,6 +53,7 @@ class CertContentPrivate; class EncryptionError; class Key; +class KeyPrivate; class Signature; class SignaturePrivate; class Encryption; @@ -262,10 +263,9 @@ public: EncryptionError error() const; private: - std::unique_ptr d; + std::unique_ptr d; }; - /* * we want to request complete headers like: * from/to... @@ -279,7 +279,7 @@ public: //template QByteArray header(); private: - std::unique_ptr d; + std::unique_ptr d; }; class EncryptionError @@ -291,6 +291,12 @@ public: class Key { +public: + typedef std::shared_ptr Ptr; + Key(); + Key(KeyPrivate *); + ~Key(); + QString keyid() const; QString name() const; QString email() const; @@ -305,8 +311,10 @@ class Key bool isInvalid() const; bool isExpired() const; - std::vector subkeys(); + std::vector subkeys(); Key parentkey() const; +private: + std::unique_ptr d; }; class Signature @@ -317,9 +325,9 @@ public: Signature(SignaturePrivate *); ~Signature(); - Key key() const; + Key::Ptr key() const; QDateTime creationDateTime() const; - QDateTime expirationTime() const; + QDateTime expirationDateTime() const; bool neverExpires() const; //template <> StatusObject verify() const; @@ -339,7 +347,7 @@ public: Encryption(); Encryption(EncryptionPrivate *); ~Encryption(); - std::vector recipients() const; + std::vector recipients() const; private: std::unique_ptr d; }; -- cgit v1.2.3