diff --git a/lang/qt/src/job.cpp b/lang/qt/src/job.cpp index 85de2ce7..5e07f787 100644 --- a/lang/qt/src/job.cpp +++ b/lang/qt/src/job.cpp @@ -94,7 +94,12 @@ void QGpgME::setJobPrivate(const Job *job, std::unique_ptr d) ref = std::move(d); } -QGpgME::JobPrivate *QGpgME::getJobPrivate(const Job *job) +const QGpgME::JobPrivate *QGpgME::getJobPrivate(const Job *job) +{ + return d_func()->operator[](job).get(); +} + +QGpgME::JobPrivate *QGpgME::getJobPrivate(Job *job) { return d_func()->operator[](job).get(); } diff --git a/lang/qt/src/job_p.h b/lang/qt/src/job_p.h index 7d0f9952..43063dd1 100644 --- a/lang/qt/src/job_p.h +++ b/lang/qt/src/job_p.h @@ -56,10 +56,18 @@ public: // BCI: Add a real d-pointer to Job void setJobPrivate(const Job *job, std::unique_ptr d); -JobPrivate *getJobPrivate(const Job *job); +const JobPrivate *getJobPrivate(const Job *job); + +JobPrivate *getJobPrivate(Job *job); template -static T *jobPrivate(const Job *job) { +static const T *jobPrivate(const Job *job) { + auto d = getJobPrivate(job); + return dynamic_cast(d); +} + +template +static T *jobPrivate(Job *job) { auto d = getJobPrivate(job); return dynamic_cast(d); }