LCOV - code coverage report
Current view: top level - lang/qt/src - job.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 17 44 38.6 %
Date: 2016-11-29 15:07:43 Functions: 17 86 19.8 %

          Line data    Source code
       1             : /*
       2             :     job.cpp
       3             : 
       4             :     This file is part of qgpgme, the Qt API binding for gpgme
       5             :     Copyright (c) 2004,2005 Klarälvdalens Datakonsult AB
       6             :     Copyright (c) 2016 Intevation GmbH
       7             : 
       8             :     QGpgME is free software; you can redistribute it and/or
       9             :     modify it under the terms of the GNU General Public License as
      10             :     published by the Free Software Foundation; either version 2 of the
      11             :     License, or (at your option) any later version.
      12             : 
      13             :     QGpgME is distributed in the hope that it will be useful,
      14             :     but WITHOUT ANY WARRANTY; without even the implied warranty of
      15             :     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      16             :     General Public License for more details.
      17             : 
      18             :     You should have received a copy of the GNU General Public License
      19             :     along with this program; if not, write to the Free Software
      20             :     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
      21             : 
      22             :     In addition, as a special exception, the copyright holders give
      23             :     permission to link the code of this program with any edition of
      24             :     the Qt library by Trolltech AS, Norway (or with modified versions
      25             :     of Qt that use the same license as Qt), and distribute linked
      26             :     combinations including the two.  You must obey the GNU General
      27             :     Public License in all respects for all of the code used other than
      28             :     Qt.  If you modify this file, you may extend this exception to
      29             :     your version of the file, but you are not obligated to do so.  If
      30             :     you do not wish to do so, delete this exception statement from
      31             :     your version.
      32             : */
      33             : 
      34             : #ifdef HAVE_CONFIG_H
      35             :  #include "config.h"
      36             : #endif
      37             : 
      38             : #include "job.h"
      39             : 
      40             : #include "keylistjob.h"
      41             : #include "listallkeysjob.h"
      42             : #include "encryptjob.h"
      43             : #include "decryptjob.h"
      44             : #include "decryptverifyjob.h"
      45             : #include "signjob.h"
      46             : #include "signkeyjob.h"
      47             : #include "signencryptjob.h"
      48             : #include "verifydetachedjob.h"
      49             : #include "verifyopaquejob.h"
      50             : #include "keygenerationjob.h"
      51             : #include "importjob.h"
      52             : #include "importfromkeyserverjob.h"
      53             : #include "exportjob.h"
      54             : #include "changeexpiryjob.h"
      55             : #include "changeownertrustjob.h"
      56             : #include "changepasswdjob.h"
      57             : #include "downloadjob.h"
      58             : #include "deletejob.h"
      59             : #include "refreshkeysjob.h"
      60             : #include "adduseridjob.h"
      61             : #include "specialjob.h"
      62             : #include "keyformailboxjob.h"
      63             : #include "wkspublishjob.h"
      64             : #include "tofupolicyjob.h"
      65             : #include "threadedjobmixin.h"
      66             : 
      67             : #include <QCoreApplication>
      68             : #include <QDebug>
      69             : 
      70             : #include <gpg-error.h>
      71             : 
      72          36 : QGpgME::Job::Job(QObject *parent)
      73          36 :     : QObject(parent)
      74             : {
      75          36 :     if (QCoreApplication *app = QCoreApplication::instance()) {
      76          36 :         connect(app, &QCoreApplication::aboutToQuit, this, &Job::slotCancel);
      77             :     }
      78          36 : }
      79             : 
      80          36 : QGpgME::Job::~Job()
      81             : {
      82          36 : }
      83             : 
      84           0 : QString QGpgME::Job::auditLogAsHtml() const
      85             : {
      86           0 :     qDebug() << "QGpgME::Job::auditLogAsHtml() should be reimplemented in Kleo::Job subclasses!";
      87           0 :     return QString();
      88             : }
      89             : 
      90           0 : GpgME::Error QGpgME::Job::auditLogError() const
      91             : {
      92           0 :     qDebug() << "QGpgME::Job::auditLogError() should be reimplemented in Kleo::Job subclasses!";
      93           0 :     return GpgME::Error::fromCode(GPG_ERR_NOT_IMPLEMENTED);
      94             : }
      95             : 
      96           0 : bool QGpgME::Job::isAuditLogSupported() const
      97             : {
      98           0 :     return auditLogError().code() != GPG_ERR_NOT_IMPLEMENTED;
      99             : }
     100             : 
     101           6 : QMap <QGpgME::Job *, GpgME::Context *> QGpgME::g_context_map;
     102             : 
     103             : /* static */
     104           1 : GpgME::Context *QGpgME::Job::context(QGpgME::Job *job)
     105             : {
     106           1 :     return QGpgME::g_context_map.value (job, nullptr);
     107             : }
     108             : 
     109             : #define make_job_subclass_ext(x,y)                \
     110             :     QGpgME::x::x( QObject * parent ) : y( parent ) {} \
     111             :     QGpgME::x::~x() {}
     112             : 
     113             : #define make_job_subclass(x) make_job_subclass_ext(x,Job)
     114             : 
     115          24 : make_job_subclass(KeyListJob)
     116           0 : make_job_subclass(ListAllKeysJob)
     117           6 : make_job_subclass(EncryptJob)
     118           4 : make_job_subclass(DecryptJob)
     119           0 : make_job_subclass(DecryptVerifyJob)
     120          12 : make_job_subclass(SignJob)
     121           0 : make_job_subclass(SignEncryptJob)
     122           0 : make_job_subclass(SignKeyJob)
     123           0 : make_job_subclass(VerifyDetachedJob)
     124          20 : make_job_subclass(VerifyOpaqueJob)
     125           0 : make_job_subclass(KeyGenerationJob)
     126           0 : make_job_subclass(AbstractImportJob)
     127           0 : make_job_subclass_ext(ImportJob, AbstractImportJob)
     128           0 : make_job_subclass_ext(ImportFromKeyserverJob, AbstractImportJob)
     129           0 : make_job_subclass(ExportJob)
     130           0 : make_job_subclass(ChangeExpiryJob)
     131           4 : make_job_subclass(ChangeOwnerTrustJob)
     132           0 : make_job_subclass(ChangePasswdJob)
     133           0 : make_job_subclass(DownloadJob)
     134           0 : make_job_subclass(DeleteJob)
     135           0 : make_job_subclass(RefreshKeysJob)
     136           0 : make_job_subclass(AddUserIDJob)
     137           0 : make_job_subclass(SpecialJob)
     138           0 : make_job_subclass(KeyForMailboxJob)
     139           0 : make_job_subclass(WKSPublishJob)
     140           2 : make_job_subclass(TofuPolicyJob)
     141             : 
     142             : #undef make_job_subclass
     143             : 
     144             : #include "job.moc"
     145             : 
     146             : #include "keylistjob.moc"
     147             : #include "listallkeysjob.moc"
     148             : #include "encryptjob.moc"
     149             : #include "decryptjob.moc"
     150             : #include "decryptverifyjob.moc"
     151             : #include "signjob.moc"
     152             : #include "signencryptjob.moc"
     153             : #include "signkeyjob.moc"
     154             : #include "verifydetachedjob.moc"
     155             : #include "verifyopaquejob.moc"
     156             : #include "keygenerationjob.moc"
     157             : #include "abstractimportjob.moc"
     158             : #include "importjob.moc"
     159             : #include "importfromkeyserverjob.moc"
     160             : #include "exportjob.moc"
     161             : #include "changeexpiryjob.moc"
     162             : #include "changeownertrustjob.moc"
     163             : #include "changepasswdjob.moc"
     164             : #include "downloadjob.moc"
     165             : #include "deletejob.moc"
     166             : #include "refreshkeysjob.moc"
     167             : #include "adduseridjob.moc"
     168             : #include "specialjob.moc"
     169             : #include "keyformailboxjob.moc"
     170             : #include "wkspublishjob.moc"
     171             : #include "tofupolicyjob.moc"

Generated by: LCOV version 1.11