21 #include <kleo/verifydetachedjob.h>
22 #include <kleo/keylistjob.h>
24 #include <gpgme++/keylistresult.h>
26 #include <qstringlist.h>
31 using namespace GpgME;
32 using namespace MessageViewer;
36 VerifyDetachedBodyPartMemento::VerifyDetachedBodyPartMemento( VerifyDetachedJob * job,
41 m_signature( signature ),
42 m_plainText( plainText ),
53 m_keylistjob->slotCancel();
58 #ifdef DEBUG_SIGNATURE
59 kDebug() <<
"tokoe: VerifyDetachedBodyPartMemento started";
61 connect( m_job, SIGNAL(result(GpgME::VerificationResult)),
62 this, SLOT(slotResult(GpgME::VerificationResult)) );
63 if (
const Error err = m_job->start( m_signature, m_plainText ) ) {
64 m_vr = VerificationResult( err );
65 #ifdef DEBUG_SIGNATURE
66 kDebug() <<
"tokoe: VerifyDetachedBodyPartMemento stopped with error";
77 #ifdef DEBUG_SIGNATURE
78 kDebug() <<
"tokoe: VerifyDetachedBodyPartMemento execed";
80 saveResult( m_job->exec( m_signature, m_plainText ) );
83 #ifdef DEBUG_SIGNATURE
84 kDebug() <<
"tokoe: VerifyDetachedBodyPartMemento after execed";
86 if ( canStartKeyListJob() ) {
87 std::vector<GpgME::Key> keys;
88 m_keylistjob->exec( keyListPattern(),
false, keys );
93 m_keylistjob->deleteLater();
98 bool VerifyDetachedBodyPartMemento::canStartKeyListJob()
const
102 const char *
const fpr = m_vr.signature( 0 ).fingerprint();
106 QStringList VerifyDetachedBodyPartMemento::keyListPattern()
const
108 assert( canStartKeyListJob() );
112 void VerifyDetachedBodyPartMemento::saveResult(
const VerificationResult & vr )
115 #ifdef DEBUG_SIGNATURE
116 kDebug() <<
"tokoe: VerifyDetachedBodyPartMemento::saveResult called";
119 setAuditLog( m_job->auditLogError(), m_job->auditLogAsHtml() );
122 void VerifyDetachedBodyPartMemento::slotResult(
const VerificationResult & vr )
124 #ifdef DEBUG_SIGNATURE
125 kDebug() <<
"tokoe: VerifyDetachedBodyPartMemento::slotResult called";
129 if ( canStartKeyListJob() && startKeyListJob() ) {
130 #ifdef DEBUG_SIGNATURE
131 kDebug() <<
"tokoe: VerifyDetachedBodyPartMemento: canStartKeyListJob && startKeyListJob";
136 m_keylistjob->deleteLater();
142 bool VerifyDetachedBodyPartMemento::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 VerifyDetachedBodyPartMemento::slotNextKey(
const GpgME::Key & key )
155 #ifdef DEBUG_SIGNATURE
156 kDebug() <<
"tokoe: VerifyDetachedBodyPartMemento::slotNextKey called";
161 void VerifyDetachedBodyPartMemento::slotKeyListJobDone()
163 #ifdef DEBUG_SIGNATURE
164 kDebug() <<
"tokoe: VerifyDetachedBodyPartMemento::slotKeyListJobDone called";
void setAuditLog(const GpgME::Error &err, const QString &log)
void setRunning(bool running)
~VerifyDetachedBodyPartMemento()
QString fromLatin1(const char *str, int size)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)