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

Generated by: LCOV version 1.13