krop's commit fixes my problem in a better way, reverting
[kdepim.git] / kmail / objecttreeparser_p.h
blob85a1d1286d7497d3e78ce3ae565a4c0be72da209
1 /* -*- mode: C++; c-file-style: "gnu" -*-
2 objecttreeparser_p.h
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
29 your version.
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>
39 #include <QObject>
40 #include <QString>
41 #include <QPointer>
43 #include "isubject.h"
44 #include "interfaces/bodypart.h"
46 namespace Kleo {
47 class DecryptVerifyJob;
48 class VerifyDetachedJob;
49 class VerifyOpaqueJob;
50 class KeyListJob;
53 class QStringList;
55 namespace KMail {
57 class DecryptVerifyBodyPartMemento
58 : public QObject,
59 public KMail::Interface::BodyPartMemento,
60 public KMail::ISubject
62 Q_OBJECT
63 public:
64 DecryptVerifyBodyPartMemento( Kleo::DecryptVerifyJob * job, const QByteArray & cipherText );
65 ~DecryptVerifyBodyPartMemento();
67 /* reimp */ Interface::Observer * asObserver() { return 0; }
68 /* reimp */ Interface::Observable * asObservable() { return this; }
70 bool start();
71 void exec();
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; }
81 private slots:
82 void slotResult( const GpgME::DecryptionResult & dr,
83 const GpgME::VerificationResult & vr,
84 const QByteArray & plainText );
85 void notify() {
86 ISubject::notify();
89 private:
90 void saveResult( const GpgME::DecryptionResult &,
91 const GpgME::VerificationResult &,
92 const QByteArray & );
93 private:
94 // input:
95 const QByteArray m_cipherText;
96 QPointer<Kleo::DecryptVerifyJob> m_job;
97 bool m_running;
98 // output:
99 GpgME::DecryptionResult m_dr;
100 GpgME::VerificationResult m_vr;
101 QByteArray m_plainText;
102 QString m_auditLog;
103 GpgME::Error m_auditLogError;
107 class VerifyDetachedBodyPartMemento
108 : public QObject,
109 public KMail::Interface::BodyPartMemento,
110 public KMail::ISubject
112 Q_OBJECT
113 public:
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; }
123 bool start();
124 void exec();
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; }
133 private slots:
134 void slotResult( const GpgME::VerificationResult & vr );
135 void slotKeyListJobDone();
136 void slotNextKey( const GpgME::Key & );
137 void notify() {
138 ISubject::notify();
141 private:
142 void saveResult( const GpgME::VerificationResult & );
143 bool canStartKeyListJob() const;
144 QStringList keyListPattern() const;
145 bool startKeyListJob();
146 private:
147 // input:
148 const QByteArray m_signature;
149 const QByteArray m_plainText;
150 QPointer<Kleo::VerifyDetachedJob> m_job;
151 QPointer<Kleo::KeyListJob> m_keylistjob;
152 bool m_running;
153 // output:
154 GpgME::VerificationResult m_vr;
155 QString m_auditLog;
156 GpgME::Error m_auditLogError;
157 GpgME::Key m_key;
161 class VerifyOpaqueBodyPartMemento
162 : public QObject,
163 public KMail::Interface::BodyPartMemento,
164 public KMail::ISubject
166 Q_OBJECT
167 public:
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; }
176 bool start();
177 void exec();
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; }
187 private slots:
188 void slotResult( const GpgME::VerificationResult & vr,
189 const QByteArray & plainText );
190 void slotKeyListJobDone();
191 void slotNextKey( const GpgME::Key & );
192 void notify() {
193 ISubject::notify();
196 private:
197 void saveResult( const GpgME::VerificationResult &,
198 const QByteArray & );
199 bool canStartKeyListJob() const;
200 QStringList keyListPattern() const;
201 bool startKeyListJob();
202 private:
203 // input:
204 const QByteArray m_signature;
205 QPointer<Kleo::VerifyOpaqueJob> m_job;
206 QPointer<Kleo::KeyListJob> m_keylistjob;
207 bool m_running;
208 // output:
209 GpgME::VerificationResult m_vr;
210 QByteArray m_plainText;
211 QString m_auditLog;
212 GpgME::Error m_auditLogError;
213 GpgME::Key m_key;
217 } // namespace KMail
219 #endif // _KMAIL_OBJECTTREEPARSER_H_