diff options
author | Andre Heinecke <[email protected]> | 2016-11-14 19:40:29 +0000 |
---|---|---|
committer | Andre Heinecke <[email protected]> | 2016-11-14 19:48:20 +0000 |
commit | 9451faa2ee333904cff59f92ab62918e13ab4b87 (patch) | |
tree | e2d9d2a59d405a9b9d2b042d0b158d7be85a3209 /lang/qt/src/threadedjobmixin.h | |
parent | cpp: Add get / set Sender API (diff) | |
download | gpgme-9451faa2ee333904cff59f92ab62918e13ab4b87.tar.gz gpgme-9451faa2ee333904cff59f92ab62918e13ab4b87.zip |
qt: Add API to get the context for a Job
* lang/qt/src/job.cpp,
lang/qt/src/job.h (Job::context): New.
* lang/qt/src/threadedjobmixin.cpp
(ThreadedJobMixin::~ThreadedJobMixin): New. Unregister context.
(ThreadedJobMixin::lateInitialization): Register context.
* NEWS: Update for cpp and qt.
--
The global map hack is necessary because the job class does
not know about the context which is held in threadedjobmixin.
Adding a virtual function in Job would be an ABI break which
I'd like to avoid at this point. Although QGpgME's API will
need a big ABI break to make it ABI maintainable. The virtual
jobs -> implementation classes are nearly unmaintainable ABI wise.
The context is exposed to provide more flexibility to users, e.g.
to add a passphrase callback or to set the sender in a context.
Diffstat (limited to 'lang/qt/src/threadedjobmixin.h')
-rw-r--r-- | lang/qt/src/threadedjobmixin.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lang/qt/src/threadedjobmixin.h b/lang/qt/src/threadedjobmixin.h index d1b10432..aef2723a 100644 --- a/lang/qt/src/threadedjobmixin.h +++ b/lang/qt/src/threadedjobmixin.h @@ -48,6 +48,7 @@ # include <gpgme++/interfaces/progressprovider.h> #endif +#include "job.h" #include <cassert> @@ -147,7 +148,6 @@ protected: explicit ThreadedJobMixin(GpgME::Context *ctx) : T_base(0), m_ctx(ctx), m_thread(), m_auditLog(), m_auditLogError() { - } void lateInitialization() @@ -155,6 +155,12 @@ protected: assert(m_ctx); QObject::connect(&m_thread, SIGNAL(finished()), this, SLOT(slotFinished())); m_ctx->setProgressProvider(this); + QGpgME::g_context_map.insert(this, m_ctx.get()); + } + + ~ThreadedJobMixin() + { + QGpgME::g_context_map.remove(this); } template <typename T_binder> |