1 /* -*- mode: C++; c-file-style: "gnu" -*-
4 This file is part of KMail, the KDE mail client.
5 Copyright (C) 2009 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.net
6 Copyright (c) 2009 Andras Mantia <andras@kdab.net>
8 KMail is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License, version 2, as
10 published by the Free Software Foundation.
12 KMail is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 In addition, as a special exception, the copyright holders give
22 permission to link the code of this program with any edition of
23 the Qt library by Trolltech AS, Norway (or with modified versions
24 of Qt that use the same license as Qt), and distribute linked
25 combinations including the two. You must obey the GNU General
26 Public License in all respects for all of the code used other than
27 Qt. If you modify this file, you may extend this exception to
28 your version of the file, but you are not obligated to do so. If
29 you do not wish to do so, delete this exception statement from
33 #ifndef _MESSAGEVIEWER_OBJECTTREEPARSER_P_H_
34 #define _MESSAGEVIEWER_OBJECTTREEPARSER_P_H_
36 #include <gpgme++/verificationresult.h>
37 #include <gpgme++/decryptionresult.h>
38 #include <gpgme++/key.h>
44 #include "interfaces/bodypart.h"
48 class DecryptVerifyJob
;
49 class VerifyDetachedJob
;
50 class VerifyOpaqueJob
;
56 namespace MessageViewer
{
58 class CryptoBodyPartMemento
60 public Interface::BodyPartMemento
64 CryptoBodyPartMemento();
65 ~CryptoBodyPartMemento();
67 bool isRunning() const { return m_running
; }
69 const QString
& auditLogAsHtml() const { return m_auditLog
; }
70 GpgME::Error
auditLogError() const { return m_auditLogError
; }
75 void update(MessageViewer::Viewer::UpdateMode
);
79 emit
update(Viewer::Force
);
83 void setAuditLog( const GpgME::Error
& err
, const QString
& log
);
84 void setRunning( bool running
);
89 GpgME::Error m_auditLogError
;
92 class DecryptVerifyBodyPartMemento
93 : public CryptoBodyPartMemento
97 DecryptVerifyBodyPartMemento( Kleo::DecryptVerifyJob
* job
, const QByteArray
& cipherText
);
98 ~DecryptVerifyBodyPartMemento();
103 const QByteArray
& plainText() const { return m_plainText
; }
104 const GpgME::DecryptionResult
& decryptResult() const { return m_dr
; }
105 const GpgME::VerificationResult
& verifyResult() const { return m_vr
; }
108 void slotResult( const GpgME::DecryptionResult
& dr
,
109 const GpgME::VerificationResult
& vr
,
110 const QByteArray
& plainText
);
113 void saveResult( const GpgME::DecryptionResult
&,
114 const GpgME::VerificationResult
&,
115 const QByteArray
& );
118 const QByteArray m_cipherText
;
119 QPointer
<Kleo::DecryptVerifyJob
> m_job
;
121 GpgME::DecryptionResult m_dr
;
122 GpgME::VerificationResult m_vr
;
123 QByteArray m_plainText
;
127 class VerifyDetachedBodyPartMemento
128 : public CryptoBodyPartMemento
132 VerifyDetachedBodyPartMemento( Kleo::VerifyDetachedJob
* job
,
133 Kleo::KeyListJob
* klj
,
134 const QByteArray
& signature
,
135 const QByteArray
& plainText
);
136 ~VerifyDetachedBodyPartMemento();
141 const GpgME::VerificationResult
& verifyResult() const { return m_vr
; }
142 const GpgME::Key
& signingKey() const { return m_key
; }
145 void slotResult( const GpgME::VerificationResult
& vr
);
146 void slotKeyListJobDone();
147 void slotNextKey( const GpgME::Key
& );
150 void saveResult( const GpgME::VerificationResult
& );
151 bool canStartKeyListJob() const;
152 QStringList
keyListPattern() const;
153 bool startKeyListJob();
156 const QByteArray m_signature
;
157 const QByteArray m_plainText
;
158 QPointer
<Kleo::VerifyDetachedJob
> m_job
;
159 QPointer
<Kleo::KeyListJob
> m_keylistjob
;
161 GpgME::VerificationResult m_vr
;
166 class VerifyOpaqueBodyPartMemento
167 : public CryptoBodyPartMemento
171 VerifyOpaqueBodyPartMemento( Kleo::VerifyOpaqueJob
* job
,
172 Kleo::KeyListJob
* klj
,
173 const QByteArray
& signature
);
174 ~VerifyOpaqueBodyPartMemento();
179 const QByteArray
& plainText() const { return m_plainText
; }
180 const GpgME::VerificationResult
& verifyResult() const { return m_vr
; }
181 const GpgME::Key
& signingKey() const { return m_key
; }
184 void slotResult( const GpgME::VerificationResult
& vr
,
185 const QByteArray
& plainText
);
186 void slotKeyListJobDone();
187 void slotNextKey( const GpgME::Key
& );
190 void saveResult( const GpgME::VerificationResult
&,
191 const QByteArray
& );
192 bool canStartKeyListJob() const;
193 QStringList
keyListPattern() const;
194 bool startKeyListJob();
197 const QByteArray m_signature
;
198 QPointer
<Kleo::VerifyOpaqueJob
> m_job
;
199 QPointer
<Kleo::KeyListJob
> m_keylistjob
;
201 GpgME::VerificationResult m_vr
;
202 QByteArray m_plainText
;
209 #endif // _KMAIL_OBJECTTREEPARSER_H_