21 #include <kleo/verifyopaquejob.h>
22 #include <kleo/keylistjob.h>
24 #include <gpgme++/keylistresult.h>
26 #include <qstringlist.h>
31 using namespace GpgME;
32 using namespace MessageViewer;
34 VerifyOpaqueBodyPartMemento::VerifyOpaqueBodyPartMemento( VerifyOpaqueJob * job,
38 m_signature( signature ),
49 m_keylistjob->slotCancel();
54 #ifdef DEBUG_SIGNATURE
55 kDebug() <<
"tokoe: VerifyOpaqueBodyPartMemento started";
57 if (
const Error err = m_job->start( m_signature ) ) {
58 m_vr = VerificationResult( err );
59 #ifdef DEBUG_SIGNATURE
60 kDebug() <<
"tokoe: VerifyOpaqueBodyPartMemento stopped with error";
65 this, SLOT(slotResult(GpgME::VerificationResult,
QByteArray)) );
74 #ifdef DEBUG_SIGNATURE
75 kDebug() <<
"tokoe: VerifyOpaqueBodyPartMemento execed";
77 saveResult( m_job->exec( m_signature, plainText ),
plainText );
78 #ifdef DEBUG_SIGNATURE
79 kDebug() <<
"tokoe: VerifyOpaqueBodyPartMemento after execed";
83 if ( canStartKeyListJob() ) {
84 std::vector<GpgME::Key> keys;
85 m_keylistjob->exec( keyListPattern(),
false, keys );
90 m_keylistjob->deleteLater();
95 bool VerifyOpaqueBodyPartMemento::canStartKeyListJob()
const
99 const char *
const fpr = m_vr.signature( 0 ).fingerprint();
103 QStringList VerifyOpaqueBodyPartMemento::keyListPattern()
const
105 assert( canStartKeyListJob() );
109 void VerifyOpaqueBodyPartMemento::saveResult(
const VerificationResult & vr,
113 #ifdef DEBUG_SIGNATURE
114 kDebug() <<
"tokoe: VerifyOpaqueBodyPartMemento::saveResult called";
118 setAuditLog( m_job->auditLogError(), m_job->auditLogAsHtml() );
121 void VerifyOpaqueBodyPartMemento::slotResult(
const VerificationResult & vr,
124 #ifdef DEBUG_SIGNATURE
125 kDebug() <<
"tokoe: VerifyOpaqueBodyPartMemento::slotResult called";
127 saveResult( vr, plainText );
129 if ( canStartKeyListJob() && startKeyListJob() ) {
130 #ifdef DEBUG_SIGNATURE
131 kDebug() <<
"tokoe: VerifyOpaqueBodyPartMemento: canStartKeyListJob && startKeyListJob";
136 m_keylistjob->deleteLater();
142 bool VerifyOpaqueBodyPartMemento::startKeyListJob()
144 assert( canStartKeyListJob() );
145 if (
const GpgME::Error err = m_keylistjob->start( keyListPattern() ) )
147 connect( m_keylistjob, SIGNAL(done()),
this, SLOT(slotKeyListJobDone()) );
148 connect( m_keylistjob, SIGNAL(nextKey(GpgME::Key)),
149 this, SLOT(slotNextKey(GpgME::Key)) );
153 void VerifyOpaqueBodyPartMemento::slotNextKey(
const GpgME::Key & key )
155 #ifdef DEBUG_SIGNATURE
156 kDebug() <<
"tokoe: VerifyOpaqueBodyPartMemento::slotNextKey called";
161 void VerifyOpaqueBodyPartMemento::slotKeyListJobDone()
163 #ifdef DEBUG_SIGNATURE
164 kDebug() <<
"tokoe: VerifyOpaqueBodyPartMemento::slotKeyListJobDone called";
void setAuditLog(const GpgME::Error &err, const QString &log)
void setRunning(bool running)
~VerifyOpaqueBodyPartMemento()
const QByteArray & plainText() const
QString fromLatin1(const char *str, int size)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)