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
7 KMail is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License, version 2, as
9 published by the Free Software Foundation.
11 KMail is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 In addition, as a special exception, the copyright holders give
21 permission to link the code of this program with any edition of
22 the Qt library by Trolltech AS, Norway (or with modified versions
23 of Qt that use the same license as Qt), and distribute linked
24 combinations including the two. You must obey the GNU General
25 Public License in all respects for all of the code used other than
26 Qt. If you modify this file, you may extend this exception to
27 your version of the file, but you are not obligated to do so. If
28 you do not wish to do so, delete this exception statement from
32 #ifndef _KMAIL_OBJECTTREEPARSER_P_H_
33 #define _KMAIL_OBJECTTREEPARSER_P_H_
35 #include <gpgme++/verificationresult.h>
36 #include <gpgme++/decryptionresult.h>
37 #include <gpgme++/key.h>
44 #include "interfaces/bodypart.h"
47 class DecryptVerifyJob
;
48 class VerifyDetachedJob
;
49 class VerifyOpaqueJob
;
57 class DecryptVerifyBodyPartMemento
59 public KMail::Interface::BodyPartMemento
,
60 public KMail::ISubject
64 DecryptVerifyBodyPartMemento( Kleo::DecryptVerifyJob
* job
, const QByteArray
& cipherText
);
65 ~DecryptVerifyBodyPartMemento();
67 /* reimp */ Interface::Observer
* asObserver() { return 0; }
68 /* reimp */ Interface::Observable
* asObservable() { return this; }
73 bool isRunning() const { return m_running
; }
75 const QByteArray
& plainText() const { return m_plainText
; }
76 const GpgME::DecryptionResult
& decryptResult() const { return m_dr
; }
77 const GpgME::VerificationResult
& verifyResult() const { return m_vr
; }
78 const QString
& auditLogAsHtml() const { return m_auditLog
; }
79 GpgME::Error
auditLogError() const { return m_auditLogError
; }
82 void slotResult( const GpgME::DecryptionResult
& dr
,
83 const GpgME::VerificationResult
& vr
,
84 const QByteArray
& plainText
);
90 void saveResult( const GpgME::DecryptionResult
&,
91 const GpgME::VerificationResult
&,
95 const QByteArray m_cipherText
;
96 QPointer
<Kleo::DecryptVerifyJob
> m_job
;
99 GpgME::DecryptionResult m_dr
;
100 GpgME::VerificationResult m_vr
;
101 QByteArray m_plainText
;
103 GpgME::Error m_auditLogError
;
107 class VerifyDetachedBodyPartMemento
109 public KMail::Interface::BodyPartMemento
,
110 public KMail::ISubject
114 VerifyDetachedBodyPartMemento( Kleo::VerifyDetachedJob
* job
,
115 Kleo::KeyListJob
* klj
,
116 const QByteArray
& signature
,
117 const QByteArray
& plainText
);
118 ~VerifyDetachedBodyPartMemento();
120 /* reimp */ Interface::Observer
* asObserver() { return 0; }
121 /* reimp */ Interface::Observable
* asObservable() { return this; }
126 bool isRunning() const { return m_running
; }
128 const GpgME::VerificationResult
& verifyResult() const { return m_vr
; }
129 const QString
& auditLogAsHtml() const { return m_auditLog
; }
130 GpgME::Error
auditLogError() const { return m_auditLogError
; }
131 const GpgME::Key
& signingKey() const { return m_key
; }
134 void slotResult( const GpgME::VerificationResult
& vr
);
135 void slotKeyListJobDone();
136 void slotNextKey( const GpgME::Key
& );
142 void saveResult( const GpgME::VerificationResult
& );
143 bool canStartKeyListJob() const;
144 QStringList
keyListPattern() const;
145 bool startKeyListJob();
148 const QByteArray m_signature
;
149 const QByteArray m_plainText
;
150 QPointer
<Kleo::VerifyDetachedJob
> m_job
;
151 QPointer
<Kleo::KeyListJob
> m_keylistjob
;
154 GpgME::VerificationResult m_vr
;
156 GpgME::Error m_auditLogError
;
161 class VerifyOpaqueBodyPartMemento
163 public KMail::Interface::BodyPartMemento
,
164 public KMail::ISubject
168 VerifyOpaqueBodyPartMemento( Kleo::VerifyOpaqueJob
* job
,
169 Kleo::KeyListJob
* klj
,
170 const QByteArray
& signature
);
171 ~VerifyOpaqueBodyPartMemento();
173 /* reimp */ Interface::Observer
* asObserver() { return 0; }
174 /* reimp */ Interface::Observable
* asObservable() { return this; }
179 bool isRunning() const { return m_running
; }
181 const QByteArray
& plainText() const { return m_plainText
; }
182 const GpgME::VerificationResult
& verifyResult() const { return m_vr
; }
183 const QString
& auditLogAsHtml() const { return m_auditLog
; }
184 GpgME::Error
auditLogError() const { return m_auditLogError
; }
185 const GpgME::Key
& signingKey() const { return m_key
; }
188 void slotResult( const GpgME::VerificationResult
& vr
,
189 const QByteArray
& plainText
);
190 void slotKeyListJobDone();
191 void slotNextKey( const GpgME::Key
& );
197 void saveResult( const GpgME::VerificationResult
&,
198 const QByteArray
& );
199 bool canStartKeyListJob() const;
200 QStringList
keyListPattern() const;
201 bool startKeyListJob();
204 const QByteArray m_signature
;
205 QPointer
<Kleo::VerifyOpaqueJob
> m_job
;
206 QPointer
<Kleo::KeyListJob
> m_keylistjob
;
209 GpgME::VerificationResult m_vr
;
210 QByteArray m_plainText
;
212 GpgME::Error m_auditLogError
;
219 #endif // _KMAIL_OBJECTTREEPARSER_H_