diff options
author | JinWang An <jinwang.an@samsung.com> | 2021-12-01 16:54:36 +0900 |
---|---|---|
committer | JinWang An <jinwang.an@samsung.com> | 2021-12-01 16:54:36 +0900 |
commit | 10e16af58579b2e22154d944d8cb4144924a8406 (patch) | |
tree | 035206c11f62125c4b8aa66fb36daeb071c90184 /lang/qt | |
parent | e158cb38f461261d019c653a5f5e0ca9ddab8d6d (diff) | |
download | gpgme-75f32608758af0c9aec71d225b798aff76827846.tar.gz gpgme-75f32608758af0c9aec71d225b798aff76827846.tar.bz2 gpgme-75f32608758af0c9aec71d225b798aff76827846.zip |
Imported Upstream version 1.7.1upstream/1.7.1
Diffstat (limited to 'lang/qt')
55 files changed, 483 insertions, 74 deletions
diff --git a/lang/qt/src/AbstractImportJob b/lang/qt/src/AbstractImportJob new file mode 100644 index 0000000..4627c40 --- /dev/null +++ b/lang/qt/src/AbstractImportJob @@ -0,0 +1 @@ +#include "qgpgme/abstractimportjob.h" diff --git a/lang/qt/src/Makefile.am b/lang/qt/src/Makefile.am index c15da18..51fe314 100644 --- a/lang/qt/src/Makefile.am +++ b/lang/qt/src/Makefile.am @@ -22,7 +22,7 @@ EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \ gpgme_backend_debug.h qgpgme_version.h.in qgpgme_sources = \ - dataprovider.cpp job.cpp qgpgmeadduseridjob.cpp \ + dataprovider.cpp job.cpp multideletejob.cpp qgpgmeadduseridjob.cpp \ qgpgmebackend.cpp qgpgmechangeexpiryjob.cpp qgpgmechangeownertrustjob.cpp \ qgpgmechangepasswdjob.cpp qgpgmedecryptjob.cpp \ qgpgmedecryptverifyjob.cpp qgpgmedeletejob.cpp qgpgmedownloadjob.cpp \ @@ -39,6 +39,7 @@ qgpgme_sources = \ # If you add one here make sure that you also add one in camelcase qgpgme_headers= \ + abstractimportjob.h \ adduseridjob.h \ changeexpiryjob.h \ changeownertrustjob.h \ @@ -56,6 +57,7 @@ qgpgme_headers= \ protocol.h \ qgpgme_export.h \ qgpgmenewcryptoconfig.h \ + specialjob.h \ signjob.h \ signkeyjob.h \ signencryptjob.h \ @@ -75,6 +77,7 @@ qgpgme_headers= \ camelcase_headers= \ AddUserIDJob \ + AbstractImportJob \ ChangeExpiryJob \ ChangeOwnerTrustJob \ ChangePasswdJob \ @@ -89,6 +92,7 @@ camelcase_headers= \ MultiDeleteJob \ Protocol \ QGpgMENewCryptoConfig \ + SpecialJob \ SignJob \ SignKeyJob \ SignEncryptJob \ @@ -109,7 +113,6 @@ camelcase_headers= \ private_qgpgme_headers = \ qgpgme_export.h \ - abstractimportjob.h \ protocol_p.h \ qgpgmeadduseridjob.h \ qgpgmebackend.h \ @@ -137,7 +140,6 @@ private_qgpgme_headers = \ qgpgmekeyformailboxjob.h \ qgpgmewkspublishjob.h \ qgpgmetofupolicyjob.h \ - specialjob.h \ threadedjobmixin.h qgpgme_moc_sources = \ @@ -221,9 +223,9 @@ libsuffix=.so endif QGpgmeConfig.cmake: QGpgmeConfig.cmake.in - sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" > "$@" - sed -e 's|[@]libsuffix@|$(libsuffix)|g' < "$@" > "$@".2 - mv "$@".2 "$@" + sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \ + sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \ + sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@ $(camelcase_headers): Makefile.am echo -n "#include \"qgpgme/" > "$@" @@ -232,9 +234,9 @@ $(camelcase_headers): Makefile.am install-cmake-files: QGpgmeConfig.cmake QGpgmeConfigVersion.cmake -$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/Gpgmepp - $(INSTALL) QGpgmeConfig.cmake \ + $(INSTALL) -m 644 QGpgmeConfig.cmake \ $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfig.cmake - $(INSTALL) QGpgmeConfigVersion.cmake \ + $(INSTALL) -m 644 QGpgmeConfigVersion.cmake \ $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfigVersion.cmake uninstall-cmake-files: diff --git a/lang/qt/src/Makefile.in b/lang/qt/src/Makefile.in index d10eca3..0aa0590 100644 --- a/lang/qt/src/Makefile.in +++ b/lang/qt/src/Makefile.in @@ -138,17 +138,17 @@ am__installdirs = "$(DESTDIR)$(libdir)" \ LTLIBRARIES = $(lib_LTLIBRARIES) libqgpgme_la_DEPENDENCIES = ../../cpp/src/libgpgmepp.la \ ../../../src/libgpgme.la -am__objects_1 = dataprovider.lo job.lo qgpgmeadduseridjob.lo \ - qgpgmebackend.lo qgpgmechangeexpiryjob.lo \ - qgpgmechangeownertrustjob.lo qgpgmechangepasswdjob.lo \ - qgpgmedecryptjob.lo qgpgmedecryptverifyjob.lo \ - qgpgmedeletejob.lo qgpgmedownloadjob.lo qgpgmeencryptjob.lo \ - qgpgmeexportjob.lo qgpgmeimportfromkeyserverjob.lo \ - qgpgmeimportjob.lo qgpgmekeygenerationjob.lo \ - qgpgmekeylistjob.lo qgpgmelistallkeysjob.lo \ - qgpgmenewcryptoconfig.lo qgpgmerefreshkeysjob.lo \ - qgpgmesecretkeyexportjob.lo qgpgmesignencryptjob.lo \ - qgpgmesignjob.lo qgpgmesignkeyjob.lo \ +am__objects_1 = dataprovider.lo job.lo multideletejob.lo \ + qgpgmeadduseridjob.lo qgpgmebackend.lo \ + qgpgmechangeexpiryjob.lo qgpgmechangeownertrustjob.lo \ + qgpgmechangepasswdjob.lo qgpgmedecryptjob.lo \ + qgpgmedecryptverifyjob.lo qgpgmedeletejob.lo \ + qgpgmedownloadjob.lo qgpgmeencryptjob.lo qgpgmeexportjob.lo \ + qgpgmeimportfromkeyserverjob.lo qgpgmeimportjob.lo \ + qgpgmekeygenerationjob.lo qgpgmekeylistjob.lo \ + qgpgmelistallkeysjob.lo qgpgmenewcryptoconfig.lo \ + qgpgmerefreshkeysjob.lo qgpgmesecretkeyexportjob.lo \ + qgpgmesignencryptjob.lo qgpgmesignjob.lo qgpgmesignkeyjob.lo \ qgpgmeverifydetachedjob.lo qgpgmeverifyopaquejob.lo \ threadedjobmixin.lo qgpgmekeyformailboxjob.lo \ gpgme_backend_debug.lo qgpgmetofupolicyjob.lo \ @@ -464,7 +464,7 @@ EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \ gpgme_backend_debug.h qgpgme_version.h.in qgpgme_sources = \ - dataprovider.cpp job.cpp qgpgmeadduseridjob.cpp \ + dataprovider.cpp job.cpp multideletejob.cpp qgpgmeadduseridjob.cpp \ qgpgmebackend.cpp qgpgmechangeexpiryjob.cpp qgpgmechangeownertrustjob.cpp \ qgpgmechangepasswdjob.cpp qgpgmedecryptjob.cpp \ qgpgmedecryptverifyjob.cpp qgpgmedeletejob.cpp qgpgmedownloadjob.cpp \ @@ -482,6 +482,7 @@ qgpgme_sources = \ # If you add one here make sure that you also add one in camelcase qgpgme_headers = \ + abstractimportjob.h \ adduseridjob.h \ changeexpiryjob.h \ changeownertrustjob.h \ @@ -499,6 +500,7 @@ qgpgme_headers = \ protocol.h \ qgpgme_export.h \ qgpgmenewcryptoconfig.h \ + specialjob.h \ signjob.h \ signkeyjob.h \ signencryptjob.h \ @@ -518,6 +520,7 @@ qgpgme_headers = \ camelcase_headers = \ AddUserIDJob \ + AbstractImportJob \ ChangeExpiryJob \ ChangeOwnerTrustJob \ ChangePasswdJob \ @@ -532,6 +535,7 @@ camelcase_headers = \ MultiDeleteJob \ Protocol \ QGpgMENewCryptoConfig \ + SpecialJob \ SignJob \ SignKeyJob \ SignEncryptJob \ @@ -552,7 +556,6 @@ camelcase_headers = \ private_qgpgme_headers = \ qgpgme_export.h \ - abstractimportjob.h \ protocol_p.h \ qgpgmeadduseridjob.h \ qgpgmebackend.h \ @@ -580,7 +583,6 @@ private_qgpgme_headers = \ qgpgmekeyformailboxjob.h \ qgpgmewkspublishjob.h \ qgpgmetofupolicyjob.h \ - specialjob.h \ threadedjobmixin.h qgpgme_moc_sources = \ @@ -751,6 +753,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/defaultkeygenerationjob.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gpgme_backend_debug.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/job.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multideletejob.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmeadduseridjob.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmebackend.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmechangeexpiryjob.Plo@am__quote@ @@ -1090,9 +1093,9 @@ uninstall-am: uninstall-camelcaseincludeHEADERS \ QGpgmeConfig.cmake: QGpgmeConfig.cmake.in - sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" > "$@" - sed -e 's|[@]libsuffix@|$(libsuffix)|g' < "$@" > "$@".2 - mv "$@".2 "$@" + sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \ + sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \ + sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@ $(camelcase_headers): Makefile.am echo -n "#include \"qgpgme/" > "$@" @@ -1101,9 +1104,9 @@ $(camelcase_headers): Makefile.am install-cmake-files: QGpgmeConfig.cmake QGpgmeConfigVersion.cmake -$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/Gpgmepp - $(INSTALL) QGpgmeConfig.cmake \ + $(INSTALL) -m 644 QGpgmeConfig.cmake \ $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfig.cmake - $(INSTALL) QGpgmeConfigVersion.cmake \ + $(INSTALL) -m 644 QGpgmeConfigVersion.cmake \ $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfigVersion.cmake uninstall-cmake-files: diff --git a/lang/qt/src/QGpgmeConfig.cmake.in.in b/lang/qt/src/QGpgmeConfig.cmake.in.in index 3d19696..5b6c188 100644 --- a/lang/qt/src/QGpgmeConfig.cmake.in.in +++ b/lang/qt/src/QGpgmeConfig.cmake.in.in @@ -37,7 +37,7 @@ set(CMAKE_IMPORT_FILE_VERSION 1) set(_targetsDefined) set(_targetsNotDefined) set(_expectedTargets) -foreach(_expectedTarget QGpgme KF5::QGpgme) +foreach(_expectedTarget QGpgme) list(APPEND _expectedTargets ${_expectedTarget}) if(NOT TARGET ${_expectedTarget}) list(APPEND _targetsNotDefined ${_expectedTarget}) @@ -58,17 +58,11 @@ unset(_targetsDefined) unset(_targetsNotDefined) unset(_expectedTargets) -# Compute the installation prefix relative to this file. -get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) -get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) -get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) -get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) - # Create imported target QGpgme add_library(QGpgme SHARED IMPORTED) set_target_properties(QGpgme PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include/qgpgme" + INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/qgpgme;@resolved_includedir@" INTERFACE_LINK_LIBRARIES "Gpgmepp;Qt5::Core" IMPORTED_LOCATION "@resolved_libdir@/libqgpgme@libsuffix@" ) @@ -77,9 +71,6 @@ if(CMAKE_VERSION VERSION_LESS 2.8.12) message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.") endif() -# Cleanup temporary variables. -set(_IMPORT_PREFIX) - # Loop over all imported files and verify that they actually exist foreach(target ${_IMPORT_CHECK_TARGETS} ) foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} ) diff --git a/lang/qt/src/SpecialJob b/lang/qt/src/SpecialJob new file mode 100644 index 0000000..e869ebb --- /dev/null +++ b/lang/qt/src/SpecialJob @@ -0,0 +1 @@ +#include "qgpgme/specialjob.h" diff --git a/lang/qt/src/dataprovider.cpp b/lang/qt/src/dataprovider.cpp index 533b67d..8385686 100644 --- a/lang/qt/src/dataprovider.cpp +++ b/lang/qt/src/dataprovider.cpp @@ -1,5 +1,5 @@ /* dataprovider.cpp - Copyright (C) 2004 Klar�vdalens Datakonsult AB + Copyright (C) 2004 Klarävdalens Datakonsult AB Copyright (c) 2016 Intevation GmbH This file is part of QGPGME. @@ -21,6 +21,10 @@ // -*- c++ -*- +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include <dataprovider.h> #include <error.h> diff --git a/lang/qt/src/defaultkeygenerationjob.cpp b/lang/qt/src/defaultkeygenerationjob.cpp index 8257a72..d26e824 100644 --- a/lang/qt/src/defaultkeygenerationjob.cpp +++ b/lang/qt/src/defaultkeygenerationjob.cpp @@ -28,6 +28,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "defaultkeygenerationjob.h" #include "protocol.h" #include "keygenerationjob.h" diff --git a/lang/qt/src/gpgme_backend_debug.cpp b/lang/qt/src/gpgme_backend_debug.cpp index 6dfb313..6efe932 100644 --- a/lang/qt/src/gpgme_backend_debug.cpp +++ b/lang/qt/src/gpgme_backend_debug.cpp @@ -1,5 +1,9 @@ // This file is autogenerated by CMake: DO NOT EDIT +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "gpgme_backend_debug.h" diff --git a/lang/qt/src/job.cpp b/lang/qt/src/job.cpp index 8936ea5..38dbc99 100644 --- a/lang/qt/src/job.cpp +++ b/lang/qt/src/job.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "job.h" #include "keylistjob.h" diff --git a/lang/qt/src/multideletejob.cpp b/lang/qt/src/multideletejob.cpp new file mode 100644 index 0000000..67f2a78 --- /dev/null +++ b/lang/qt/src/multideletejob.cpp @@ -0,0 +1,117 @@ +/* + multideletejob.cpp + + This file is part of qgpgme, the Qt API binding for gpgme + Copyright (c) 2004 Klarälvdalens Datakonsult AB + + QGpgME is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + QGpgME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include "multideletejob.h" +#include "protocol.h" +#include "deletejob.h" + +#include <key.h> +#include <context.h> +#include <data.h> + +#include <iterator> + +#include <assert.h> + +QGpgME::MultiDeleteJob::MultiDeleteJob(const Protocol *protocol) + : Job(0), + mProtocol(protocol), + mJob(0) +{ + assert(protocol); +} + +QGpgME::MultiDeleteJob::~MultiDeleteJob() +{ + +} + +GpgME::Error QGpgME::MultiDeleteJob::start(const std::vector<GpgME::Key> &keys, bool allowSecretKeyDeletion) +{ + mKeys = keys; + mAllowSecretKeyDeletion = allowSecretKeyDeletion; + mIt = mKeys.begin(); + + const GpgME::Error err = startAJob(); + + if (err) { + deleteLater(); + } + return err; +} + +void QGpgME::MultiDeleteJob::slotCancel() +{ + if (mJob) { + mJob->slotCancel(); + } + mIt = mKeys.end(); +} + +void QGpgME::MultiDeleteJob::slotResult(const GpgME::Error &err) +{ + mJob = 0; + GpgME::Error error = err; + if (error || // error in last op + mIt == mKeys.end() || // (shouldn't happen) + ++mIt == mKeys.end() || // was the last key + (error = startAJob())) { // error starting the job for the new key + Q_EMIT done(); + Q_EMIT result(error, error && mIt != mKeys.end() ? *mIt : GpgME::Key::null); + deleteLater(); + return; + } + + const int current = mIt - mKeys.begin(); + const int total = mKeys.size(); + Q_EMIT progress(QStringLiteral("%1/%2").arg(current).arg(total), current, total); +} + +GpgME::Error QGpgME::MultiDeleteJob::startAJob() +{ + if (mIt == mKeys.end()) { + return GpgME::Error(0); + } + mJob = mProtocol->deleteJob(); + assert(mJob); // FIXME: we need a way to generate errors ourselves, + // but I don't like the dependency on gpg-error :/ + + connect(mJob.data(), &DeleteJob::result, this, &MultiDeleteJob::slotResult); + + return mJob->start(*mIt, mAllowSecretKeyDeletion); +} + +#include "multideletejob.moc" diff --git a/lang/qt/src/multideletejob.h b/lang/qt/src/multideletejob.h index 8915cd1..8e9eb14 100644 --- a/lang/qt/src/multideletejob.h +++ b/lang/qt/src/multideletejob.h @@ -36,7 +36,7 @@ #include "qgpgme_export.h" #include "job.h" -#include "cryptobackend.h" +#include "protocol.h" #include <QPointer> diff --git a/lang/qt/src/protocol.h b/lang/qt/src/protocol.h index 40ddcb5..15d83e0 100644 --- a/lang/qt/src/protocol.h +++ b/lang/qt/src/protocol.h @@ -76,7 +76,7 @@ class TofuPolicyJob; * two are always a QString for the auditlog and an GpgME::Error for * an eventual error. * - * In case async API is used and the result signal is emited a + * In case async API is used and the result signal is emitted a * job schedules its own deletion. * * Most jobs also provide a synchronous call exec in which case @@ -161,14 +161,14 @@ public: /** Obtain a reference to the OpenPGP Protocol. * * The reference is to a static object. - * @returns Refrence to the OpenPGP Protocol. + * @returns Reference to the OpenPGP Protocol. */ QGPGME_EXPORT Protocol *openpgp(); /** Obtain a reference to the smime Protocol. * * The reference is to a static object. - * @returns Refrence to the smime Protocol. + * @returns Reference to the smime Protocol. */ QGPGME_EXPORT Protocol *smime(); diff --git a/lang/qt/src/qgpgmeadduseridjob.cpp b/lang/qt/src/qgpgmeadduseridjob.cpp index eb3bfab..4fc80d1 100644 --- a/lang/qt/src/qgpgmeadduseridjob.cpp +++ b/lang/qt/src/qgpgmeadduseridjob.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmeadduseridjob.h" #include "dataprovider.h" diff --git a/lang/qt/src/qgpgmebackend.cpp b/lang/qt/src/qgpgmebackend.cpp index 797e58a..f06244b 100644 --- a/lang/qt/src/qgpgmebackend.cpp +++ b/lang/qt/src/qgpgmebackend.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmebackend.h" diff --git a/lang/qt/src/qgpgmechangeexpiryjob.cpp b/lang/qt/src/qgpgmechangeexpiryjob.cpp index 43ceee3..cf417ab 100644 --- a/lang/qt/src/qgpgmechangeexpiryjob.cpp +++ b/lang/qt/src/qgpgmechangeexpiryjob.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmechangeexpiryjob.h" #include "dataprovider.h" diff --git a/lang/qt/src/qgpgmechangeownertrustjob.cpp b/lang/qt/src/qgpgmechangeownertrustjob.cpp index 55131d9..d9a613f 100644 --- a/lang/qt/src/qgpgmechangeownertrustjob.cpp +++ b/lang/qt/src/qgpgmechangeownertrustjob.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmechangeownertrustjob.h" #include "dataprovider.h" diff --git a/lang/qt/src/qgpgmechangepasswdjob.cpp b/lang/qt/src/qgpgmechangepasswdjob.cpp index 0aec927..b04273c 100644 --- a/lang/qt/src/qgpgmechangepasswdjob.cpp +++ b/lang/qt/src/qgpgmechangepasswdjob.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmechangepasswdjob.h" #include "dataprovider.h" diff --git a/lang/qt/src/qgpgmedecryptjob.cpp b/lang/qt/src/qgpgmedecryptjob.cpp index 7116449..449e9aa 100644 --- a/lang/qt/src/qgpgmedecryptjob.cpp +++ b/lang/qt/src/qgpgmedecryptjob.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmedecryptjob.h" #include "dataprovider.h" diff --git a/lang/qt/src/qgpgmedecryptverifyjob.cpp b/lang/qt/src/qgpgmedecryptverifyjob.cpp index d46a9b5..e6d3ff2 100644 --- a/lang/qt/src/qgpgmedecryptverifyjob.cpp +++ b/lang/qt/src/qgpgmedecryptverifyjob.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmedecryptverifyjob.h" #include "dataprovider.h" diff --git a/lang/qt/src/qgpgmedeletejob.cpp b/lang/qt/src/qgpgmedeletejob.cpp index 323aec4..9145298 100644 --- a/lang/qt/src/qgpgmedeletejob.cpp +++ b/lang/qt/src/qgpgmedeletejob.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmedeletejob.h" #include "context.h" diff --git a/lang/qt/src/qgpgmedownloadjob.cpp b/lang/qt/src/qgpgmedownloadjob.cpp index 48cc907..b0dca56 100644 --- a/lang/qt/src/qgpgmedownloadjob.cpp +++ b/lang/qt/src/qgpgmedownloadjob.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmedownloadjob.h" #include "dataprovider.h" diff --git a/lang/qt/src/qgpgmeencryptjob.cpp b/lang/qt/src/qgpgmeencryptjob.cpp index 82c8ed8..d13acab 100644 --- a/lang/qt/src/qgpgmeencryptjob.cpp +++ b/lang/qt/src/qgpgmeencryptjob.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmeencryptjob.h" #include "dataprovider.h" diff --git a/lang/qt/src/qgpgmeexportjob.cpp b/lang/qt/src/qgpgmeexportjob.cpp index dfc5fc9..e6073f0 100644 --- a/lang/qt/src/qgpgmeexportjob.cpp +++ b/lang/qt/src/qgpgmeexportjob.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmeexportjob.h" #include "dataprovider.h" diff --git a/lang/qt/src/qgpgmeimportfromkeyserverjob.cpp b/lang/qt/src/qgpgmeimportfromkeyserverjob.cpp index 0f19679..acefbb2 100644 --- a/lang/qt/src/qgpgmeimportfromkeyserverjob.cpp +++ b/lang/qt/src/qgpgmeimportfromkeyserverjob.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmeimportfromkeyserverjob.h" #include "dataprovider.h" diff --git a/lang/qt/src/qgpgmeimportjob.cpp b/lang/qt/src/qgpgmeimportjob.cpp index f125b12..dcabad3 100644 --- a/lang/qt/src/qgpgmeimportjob.cpp +++ b/lang/qt/src/qgpgmeimportjob.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmeimportjob.h" #include "dataprovider.h" diff --git a/lang/qt/src/qgpgmekeyformailboxjob.cpp b/lang/qt/src/qgpgmekeyformailboxjob.cpp index 803d0e6..7054c78 100644 --- a/lang/qt/src/qgpgmekeyformailboxjob.cpp +++ b/lang/qt/src/qgpgmekeyformailboxjob.cpp @@ -30,6 +30,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmekeyformailboxjob.h" #include "qgpgmekeylistjob.h" diff --git a/lang/qt/src/qgpgmekeygenerationjob.cpp b/lang/qt/src/qgpgmekeygenerationjob.cpp index cba6b76..31f3342 100644 --- a/lang/qt/src/qgpgmekeygenerationjob.cpp +++ b/lang/qt/src/qgpgmekeygenerationjob.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmekeygenerationjob.h" #include "dataprovider.h" diff --git a/lang/qt/src/qgpgmekeylistjob.cpp b/lang/qt/src/qgpgmekeylistjob.cpp index 1169c46..887a902 100644 --- a/lang/qt/src/qgpgmekeylistjob.cpp +++ b/lang/qt/src/qgpgmekeylistjob.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmekeylistjob.h" #include "key.h" diff --git a/lang/qt/src/qgpgmelistallkeysjob.cpp b/lang/qt/src/qgpgmelistallkeysjob.cpp index fd8bfc3..7ba8bc9 100644 --- a/lang/qt/src/qgpgmelistallkeysjob.cpp +++ b/lang/qt/src/qgpgmelistallkeysjob.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmelistallkeysjob.h" #include "key.h" diff --git a/lang/qt/src/qgpgmenewcryptoconfig.cpp b/lang/qt/src/qgpgmenewcryptoconfig.cpp index 7303f10..eb3af56 100644 --- a/lang/qt/src/qgpgmenewcryptoconfig.cpp +++ b/lang/qt/src/qgpgmenewcryptoconfig.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmenewcryptoconfig.h" #include <QDebug> @@ -80,7 +84,7 @@ QGpgMENewCryptoConfig::~QGpgMENewCryptoConfig() clear(); } -void QGpgMENewCryptoConfig::reloadConfiguration(bool showErrors) +void QGpgMENewCryptoConfig::reloadConfiguration(bool) { clear(); diff --git a/lang/qt/src/qgpgmerefreshkeysjob.cpp b/lang/qt/src/qgpgmerefreshkeysjob.cpp index 3d221f6..493a010 100644 --- a/lang/qt/src/qgpgmerefreshkeysjob.cpp +++ b/lang/qt/src/qgpgmerefreshkeysjob.cpp @@ -2,7 +2,7 @@ qgpgmerefreshkeysjob.cpp This file is part of qgpgme, the Qt API binding for gpgme - Copyright (c) 2004 Klar�vdalens Datakonsult AB + Copyright (c) 2004 Klarävdalens Datakonsult AB Copyright (c) 2016 Intevation GmbH QGpgME is free software; you can redistribute it and/or @@ -33,6 +33,10 @@ #define MAX_CMD_LENGTH 32768 +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmerefreshkeysjob.h" #include <QDebug> diff --git a/lang/qt/src/qgpgmesecretkeyexportjob.cpp b/lang/qt/src/qgpgmesecretkeyexportjob.cpp index f4ec698..75cd83a 100644 --- a/lang/qt/src/qgpgmesecretkeyexportjob.cpp +++ b/lang/qt/src/qgpgmesecretkeyexportjob.cpp @@ -2,7 +2,7 @@ qgpgmesecretexportjob.cpp This file is part of qgpgme, the Qt API binding for gpgme - Copyright (c) 2004 Klar�vdalens Datakonsult AB + Copyright (c) 2004 Klarävdalens Datakonsult AB Copyright (c) 2016 Intevation GmbH QGpgME is free software; you can redistribute it and/or @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmesecretkeyexportjob.h" #include <QDebug> diff --git a/lang/qt/src/qgpgmesignencryptjob.cpp b/lang/qt/src/qgpgmesignencryptjob.cpp index d2e45b1..9dcc619 100644 --- a/lang/qt/src/qgpgmesignencryptjob.cpp +++ b/lang/qt/src/qgpgmesignencryptjob.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmesignencryptjob.h" #include "dataprovider.h" diff --git a/lang/qt/src/qgpgmesignjob.cpp b/lang/qt/src/qgpgmesignjob.cpp index 4e2312b..e165f52 100644 --- a/lang/qt/src/qgpgmesignjob.cpp +++ b/lang/qt/src/qgpgmesignjob.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmesignjob.h" #include "dataprovider.h" diff --git a/lang/qt/src/qgpgmesignkeyjob.cpp b/lang/qt/src/qgpgmesignkeyjob.cpp index e6c1478..27aff5e 100644 --- a/lang/qt/src/qgpgmesignkeyjob.cpp +++ b/lang/qt/src/qgpgmesignkeyjob.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmesignkeyjob.h" #include "dataprovider.h" diff --git a/lang/qt/src/qgpgmetofupolicyjob.cpp b/lang/qt/src/qgpgmetofupolicyjob.cpp index a24c946..34630a1 100644 --- a/lang/qt/src/qgpgmetofupolicyjob.cpp +++ b/lang/qt/src/qgpgmetofupolicyjob.cpp @@ -28,6 +28,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmetofupolicyjob.h" #include "context.h" diff --git a/lang/qt/src/qgpgmeverifydetachedjob.cpp b/lang/qt/src/qgpgmeverifydetachedjob.cpp index 8efef05..ee74861 100644 --- a/lang/qt/src/qgpgmeverifydetachedjob.cpp +++ b/lang/qt/src/qgpgmeverifydetachedjob.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmeverifydetachedjob.h" #include "dataprovider.h" diff --git a/lang/qt/src/qgpgmeverifyopaquejob.cpp b/lang/qt/src/qgpgmeverifyopaquejob.cpp index b513f82..aea406a 100644 --- a/lang/qt/src/qgpgmeverifyopaquejob.cpp +++ b/lang/qt/src/qgpgmeverifyopaquejob.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmeverifyopaquejob.h" #include "dataprovider.h" diff --git a/lang/qt/src/qgpgmewkspublishjob.cpp b/lang/qt/src/qgpgmewkspublishjob.cpp index 8f97cb5..9773893 100644 --- a/lang/qt/src/qgpgmewkspublishjob.cpp +++ b/lang/qt/src/qgpgmewkspublishjob.cpp @@ -28,6 +28,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "qgpgmewkspublishjob.h" #include "context.h" @@ -137,7 +141,7 @@ static QGpgMEWKSPublishJob::result_type create_worker(const char *fpr, const QSt proc.readAllStandardOutput(), proc.readAllStandardError(), QString(), Error()); } -static QGpgMEWKSPublishJob::result_type recieve_worker(const QByteArray &response) +static QGpgMEWKSPublishJob::result_type receive_worker(const QByteArray &response) { if (response.isEmpty()) { return std::make_tuple (Error(make_error(GPG_ERR_INV_ARG)), @@ -181,9 +185,9 @@ void QGpgMEWKSPublishJob::startCreate(const char *fpr, const QString &mailbox) { run(std::bind(&create_worker, fpr, mailbox)); } -void QGpgMEWKSPublishJob::startRecieve(const QByteArray &response) +void QGpgMEWKSPublishJob::startReceive(const QByteArray &response) { - run(std::bind(&recieve_worker, response)); + run(std::bind(&receive_worker, response)); } #include "qgpgmewkspublishjob.moc" diff --git a/lang/qt/src/qgpgmewkspublishjob.h b/lang/qt/src/qgpgmewkspublishjob.h index 1a31149..5fd3c03 100644 --- a/lang/qt/src/qgpgmewkspublishjob.h +++ b/lang/qt/src/qgpgmewkspublishjob.h @@ -62,7 +62,7 @@ public: void startCheck(const QString &mailbox) Q_DECL_OVERRIDE; void startCreate(const char *fpr, const QString &mailbox) Q_DECL_OVERRIDE; - void startRecieve(const QByteArray &response) Q_DECL_OVERRIDE; + void startReceive(const QByteArray &response) Q_DECL_OVERRIDE; }; } diff --git a/lang/qt/src/threadedjobmixin.cpp b/lang/qt/src/threadedjobmixin.cpp index cd6ab5f..66d21fb 100644 --- a/lang/qt/src/threadedjobmixin.cpp +++ b/lang/qt/src/threadedjobmixin.cpp @@ -31,6 +31,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "threadedjobmixin.h" #include "dataprovider.h" diff --git a/lang/qt/src/threadedjobmixin.h b/lang/qt/src/threadedjobmixin.h index 62d7f1c..d1b1043 100644 --- a/lang/qt/src/threadedjobmixin.h +++ b/lang/qt/src/threadedjobmixin.h @@ -223,7 +223,8 @@ protected: { return m_auditLogError; } - void showProgress(const char *what, int type, int current, int total) Q_DECL_OVERRIDE { + void showProgress(const char * /*what*/, + int /*type*/, int current, int total) Q_DECL_OVERRIDE { // will be called from the thread exec'ing the operation, so // just bounce everything to the owning thread: // ### hope this is thread-safe (meta obj is const, and diff --git a/lang/qt/src/wkspublishjob.h b/lang/qt/src/wkspublishjob.h index 782112f..0cec630 100644 --- a/lang/qt/src/wkspublishjob.h +++ b/lang/qt/src/wkspublishjob.h @@ -45,7 +45,7 @@ namespace QGpgME { * Handles Web Key Service Publishing. Needs WKS tools installed and * server support. * - * Remember that after a result is emited the job is auto deleted + * Remember that after a result is emitted the job is auto deleted * so you can only use it for a single action. */ class QGPGME_EXPORT WKSPublishJob: public Job @@ -82,7 +82,7 @@ public: * * @param response The response of the server. **/ - virtual void startRecieve(const QByteArray &response) = 0; + virtual void startReceive(const QByteArray &response) = 0; Q_SIGNALS: /* Result of the operation returned Data and returned Error are diff --git a/lang/qt/tests/Makefile.am b/lang/qt/tests/Makefile.am index f243a55..ad08ad4 100644 --- a/lang/qt/tests/Makefile.am +++ b/lang/qt/tests/Makefile.am @@ -25,10 +25,10 @@ TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) EXTRA_DIST = initial.test TESTS = initial.test t-keylist t-keylocate t-ownertrust t-tofuinfo \ - t-encrypt t-wkspublish + t-encrypt t-verify moc_files = t-keylist.moc t-keylocate.moc t-ownertrust.moc t-tofuinfo.moc \ - t-encrypt.moc t-support.hmoc t-wkspublish.moc + t-encrypt.moc t-support.hmoc t-wkspublish.moc t-verify.moc AM_LDFLAGS = -no-install @@ -56,6 +56,7 @@ t_ownertrust_SOURCES = t-ownertrust.cpp $(support_src) t_tofuinfo_SOURCES = t-tofuinfo.cpp $(support_src) t_encrypt_SOURCES = t-encrypt.cpp $(support_src) t_wkspublish_SOURCES = t-wkspublish.cpp $(support_src) +t_verify_SOURCES = t-verify.cpp $(support_src) run_keyformailboxjob_SOURCES = run-keyformailboxjob.cpp nodist_t_keylist_SOURCES = $(moc_files) @@ -63,7 +64,7 @@ nodist_t_keylist_SOURCES = $(moc_files) BUILT_SOURCES = $(moc_files) noinst_PROGRAMS = t-keylist t-keylocate t-ownertrust t-tofuinfo t-encrypt \ - run-keyformailboxjob t-wkspublish + run-keyformailboxjob t-wkspublish t-verify CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \ gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \ diff --git a/lang/qt/tests/Makefile.in b/lang/qt/tests/Makefile.in index 45d4c76..5149a08 100644 --- a/lang/qt/tests/Makefile.in +++ b/lang/qt/tests/Makefile.in @@ -98,10 +98,11 @@ build_triplet = @build@ host_triplet = @host@ TESTS = initial.test t-keylist$(EXEEXT) t-keylocate$(EXEEXT) \ t-ownertrust$(EXEEXT) t-tofuinfo$(EXEEXT) t-encrypt$(EXEEXT) \ - t-wkspublish$(EXEEXT) + t-verify$(EXEEXT) noinst_PROGRAMS = t-keylist$(EXEEXT) t-keylocate$(EXEEXT) \ t-ownertrust$(EXEEXT) t-tofuinfo$(EXEEXT) t-encrypt$(EXEEXT) \ - run-keyformailboxjob$(EXEEXT) t-wkspublish$(EXEEXT) + run-keyformailboxjob$(EXEEXT) t-wkspublish$(EXEEXT) \ + t-verify$(EXEEXT) subdir = lang/qt/tests DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/build-aux/mkinstalldirs \ @@ -163,6 +164,11 @@ t_tofuinfo_OBJECTS = $(am_t_tofuinfo_OBJECTS) t_tofuinfo_LDADD = $(LDADD) t_tofuinfo_DEPENDENCIES = ../../cpp/src/libgpgmepp.la \ ../src/libqgpgme.la ../../../src/libgpgme.la +am_t_verify_OBJECTS = t-verify.$(OBJEXT) $(am__objects_1) +t_verify_OBJECTS = $(am_t_verify_OBJECTS) +t_verify_LDADD = $(LDADD) +t_verify_DEPENDENCIES = ../../cpp/src/libgpgmepp.la \ + ../src/libqgpgme.la ../../../src/libgpgme.la am_t_wkspublish_OBJECTS = t-wkspublish.$(OBJEXT) $(am__objects_1) t_wkspublish_OBJECTS = $(am_t_wkspublish_OBJECTS) t_wkspublish_LDADD = $(LDADD) @@ -223,11 +229,12 @@ am__v_CCLD_1 = SOURCES = $(run_keyformailboxjob_SOURCES) $(t_encrypt_SOURCES) \ $(t_keylist_SOURCES) $(nodist_t_keylist_SOURCES) \ $(t_keylocate_SOURCES) $(t_ownertrust_SOURCES) \ - $(t_tofuinfo_SOURCES) $(t_wkspublish_SOURCES) + $(t_tofuinfo_SOURCES) $(t_verify_SOURCES) \ + $(t_wkspublish_SOURCES) DIST_SOURCES = $(run_keyformailboxjob_SOURCES) $(t_encrypt_SOURCES) \ $(t_keylist_SOURCES) $(t_keylocate_SOURCES) \ $(t_ownertrust_SOURCES) $(t_tofuinfo_SOURCES) \ - $(t_wkspublish_SOURCES) + $(t_verify_SOURCES) $(t_wkspublish_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -471,7 +478,7 @@ GPG = gpg TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) EXTRA_DIST = initial.test moc_files = t-keylist.moc t-keylocate.moc t-ownertrust.moc t-tofuinfo.moc \ - t-encrypt.moc t-support.hmoc t-wkspublish.moc + t-encrypt.moc t-support.hmoc t-wkspublish.moc t-verify.moc AM_LDFLAGS = -no-install LDADD = ../../cpp/src/libgpgmepp.la ../src/libqgpgme.la \ @@ -491,6 +498,7 @@ t_ownertrust_SOURCES = t-ownertrust.cpp $(support_src) t_tofuinfo_SOURCES = t-tofuinfo.cpp $(support_src) t_encrypt_SOURCES = t-encrypt.cpp $(support_src) t_wkspublish_SOURCES = t-wkspublish.cpp $(support_src) +t_verify_SOURCES = t-verify.cpp $(support_src) run_keyformailboxjob_SOURCES = run-keyformailboxjob.cpp nodist_t_keylist_SOURCES = $(moc_files) BUILT_SOURCES = $(moc_files) @@ -568,6 +576,10 @@ t-tofuinfo$(EXEEXT): $(t_tofuinfo_OBJECTS) $(t_tofuinfo_DEPENDENCIES) $(EXTRA_t_ @rm -f t-tofuinfo$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(t_tofuinfo_OBJECTS) $(t_tofuinfo_LDADD) $(LIBS) +t-verify$(EXEEXT): $(t_verify_OBJECTS) $(t_verify_DEPENDENCIES) $(EXTRA_t_verify_DEPENDENCIES) + @rm -f t-verify$(EXEEXT) + $(AM_V_CXXLD)$(CXXLINK) $(t_verify_OBJECTS) $(t_verify_LDADD) $(LIBS) + t-wkspublish$(EXEEXT): $(t_wkspublish_OBJECTS) $(t_wkspublish_DEPENDENCIES) $(EXTRA_t_wkspublish_DEPENDENCIES) @rm -f t-wkspublish$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(t_wkspublish_OBJECTS) $(t_wkspublish_LDADD) $(LIBS) @@ -585,6 +597,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-ownertrust.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-support.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-tofuinfo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-verify.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-wkspublish.Po@am__quote@ .cpp.o: diff --git a/lang/qt/tests/run-keyformailboxjob.cpp b/lang/qt/tests/run-keyformailboxjob.cpp index 9ac7668..73bedbd 100644 --- a/lang/qt/tests/run-keyformailboxjob.cpp +++ b/lang/qt/tests/run-keyformailboxjob.cpp @@ -29,6 +29,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "keyformailboxjob.h" #include "keylistjob.h" #include "protocol.h" diff --git a/lang/qt/tests/t-encrypt.cpp b/lang/qt/tests/t-encrypt.cpp index 3d4cfa9..4d65dc7 100644 --- a/lang/qt/tests/t-encrypt.cpp +++ b/lang/qt/tests/t-encrypt.cpp @@ -28,6 +28,10 @@ you do not wish to do so, delete this exception statement from your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include <QDebug> #include <QTest> #include <QTemporaryDir> @@ -49,6 +53,23 @@ using namespace QGpgME; using namespace GpgME; +static bool decryptSupported() +{ + /* With GnuPG 2.0.x (at least 2.0.26 by default on jessie) + * the passphrase_cb does not work. So the test popped up + * a pinentry. So tests requiring decryption don't work. */ + static auto version = GpgME::engineInfo(GpgME::GpgEngine).engineVersion(); + if (version < "2.0.0") { + /* With 1.4 it just works */ + return true; + } + if (version < "2.1.0") { + /* With 2.1 it works with loopback mode */ + return false; + } + return true; +} + class EncryptionTest : public QGpgMETest { Q_OBJECT @@ -78,6 +99,9 @@ private Q_SLOTS: Q_ASSERT(cipherString.startsWith("-----BEGIN PGP MESSAGE-----")); /* Now decrypt */ + if (!decryptSupported()) { + return; + } auto ctx = Context::createForProtocol(OpenPGP); TestPassphraseProvider provider; ctx->setPassphraseProvider(&provider); @@ -113,7 +137,7 @@ private Q_SLOTS: bool initSeen = false; bool finishSeen = false; - connect(job, &Job::progress, this, [this, &initSeen, &finishSeen] (const QString& what, int current, int total) { + connect(job, &Job::progress, this, [this, &initSeen, &finishSeen] (const QString&, int current, int total) { // We only check for progress 0 and max progress as the other progress // lines depend on the system speed and are as such unreliable to test. Q_ASSERT(total == PROGRESS_TEST_SIZE); @@ -125,8 +149,8 @@ private Q_SLOTS: } Q_ASSERT(current >= 0 && current <= total); }); - connect(job, &EncryptJob::result, this, [this, &initSeen, &finishSeen] (const GpgME::EncryptionResult &result, - const QByteArray &cipherText, + connect(job, &EncryptJob::result, this, [this, &initSeen, &finishSeen] (const GpgME::EncryptionResult &, + const QByteArray &, const QString, const GpgME::Error) { Q_ASSERT(initSeen); @@ -146,6 +170,9 @@ private Q_SLOTS: void testSymmetricEncryptDecrypt() { + if (!decryptSupported()) { + return; + } auto ctx = Context::createForProtocol(OpenPGP); TestPassphraseProvider provider; ctx->setPassphraseProvider(&provider); @@ -178,6 +205,9 @@ private: * So this test is disabled until gnupg(?) is fixed for this. */ void testMixedEncryptDecrypt() { + if (!decryptSupported()) { + return; + } auto listjob = openpgp()->keyListJob(false, false, false); std::vector<Key> keys; auto keylistresult = listjob->exec(QStringList() << QStringLiteral("alfa@example.net"), diff --git a/lang/qt/tests/t-keylist.cpp b/lang/qt/tests/t-keylist.cpp index 767c96b..2578576 100644 --- a/lang/qt/tests/t-keylist.cpp +++ b/lang/qt/tests/t-keylist.cpp @@ -29,6 +29,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include <QDebug> #include <QTest> #include <QSignalSpy> diff --git a/lang/qt/tests/t-keylocate.cpp b/lang/qt/tests/t-keylocate.cpp index e75f24d..63cb836 100644 --- a/lang/qt/tests/t-keylocate.cpp +++ b/lang/qt/tests/t-keylocate.cpp @@ -28,6 +28,10 @@ you do not wish to do so, delete this exception statement from your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include <QDebug> #include <QTest> #include <QSignalSpy> diff --git a/lang/qt/tests/t-ownertrust.cpp b/lang/qt/tests/t-ownertrust.cpp index b9efffd..db863b2 100644 --- a/lang/qt/tests/t-ownertrust.cpp +++ b/lang/qt/tests/t-ownertrust.cpp @@ -29,6 +29,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include <QDebug> #include <QTest> #include <QSignalSpy> diff --git a/lang/qt/tests/t-support.cpp b/lang/qt/tests/t-support.cpp index 86372f7..857d0a3 100644 --- a/lang/qt/tests/t-support.cpp +++ b/lang/qt/tests/t-support.cpp @@ -29,6 +29,10 @@ your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include "t-support.h" #include <QTest> diff --git a/lang/qt/tests/t-support.h b/lang/qt/tests/t-support.h index 59d9a4d..704fab4 100644 --- a/lang/qt/tests/t-support.h +++ b/lang/qt/tests/t-support.h @@ -39,8 +39,8 @@ namespace GpgME class TestPassphraseProvider : public PassphraseProvider { public: - char *getPassphrase(const char *useridHint, const char *description, - bool previousWasBad, bool &canceled) Q_DECL_OVERRIDE + char *getPassphrase(const char * /*useridHint*/, const char * /*description*/, + bool /*previousWasBad*/, bool &/*canceled*/) Q_DECL_OVERRIDE { return strdup("abc"); } diff --git a/lang/qt/tests/t-tofuinfo.cpp b/lang/qt/tests/t-tofuinfo.cpp index d76ff7b..2c87e4a 100644 --- a/lang/qt/tests/t-tofuinfo.cpp +++ b/lang/qt/tests/t-tofuinfo.cpp @@ -28,6 +28,10 @@ you do not wish to do so, delete this exception statement from your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include <QDebug> #include <QTest> #include <QTemporaryDir> diff --git a/lang/qt/tests/t-verify.cpp b/lang/qt/tests/t-verify.cpp new file mode 100644 index 0000000..aedfc19 --- /dev/null +++ b/lang/qt/tests/t-verify.cpp @@ -0,0 +1,93 @@ +/* t-verifiy.cpp + + This file is part of qgpgme, the Qt API binding for gpgme + Copyright (c) 2016 Intevation GmbH + + QGpgME is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + QGpgME is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include <QDebug> +#include <QTest> + + +#include "protocol.h" + +#include "verifyopaquejob.h" +#include "verificationresult.h" +#include "key.h" +#include "t-support.h" + +using namespace QGpgME; +using namespace GpgME; + +static const char testMsg1[] = +"-----BEGIN PGP MESSAGE-----\n" +"\n" +"owGbwMvMwCSoW1RzPCOz3IRxjXQSR0lqcYleSUWJTZOvjVdpcYmCu1+oQmaJIleH\n" +"GwuDIBMDGysTSIqBi1MApi+nlGGuwDeHao53HBr+FoVGP3xX+kvuu9fCMJvl6IOf\n" +"y1kvP4y+8D5a11ang0udywsA\n" +"=Crq6\n" +"-----END PGP MESSAGE-----\n"; + + +class VerifyTest: public QGpgMETest +{ + Q_OBJECT + +private Q_SLOTS: + + /* Check that a signature always has a key. */ + void testSignatureKey() + { + const QByteArray signedData(testMsg1); + auto verifyJob = openpgp()->verifyOpaqueJob(true); + QByteArray verified; + + auto result = verifyJob->exec(signedData, verified); + Q_ASSERT(!result.error()); + delete verifyJob; + + Q_ASSERT(result.numSignatures() == 1); + auto sig = result.signatures()[0]; + + const auto key = sig.key(true, false); + Q_ASSERT(!key.isNull()); + + bool found = false; + for (const auto subkey: key.subkeys()) { + if (!strcmp (subkey.fingerprint(), sig.fingerprint())) { + found = true; + } + } + Q_ASSERT(found); + } +}; + +QTEST_MAIN(VerifyTest) +#include "t-verify.moc" diff --git a/lang/qt/tests/t-wkspublish.cpp b/lang/qt/tests/t-wkspublish.cpp index 17d3447..326ecaa 100644 --- a/lang/qt/tests/t-wkspublish.cpp +++ b/lang/qt/tests/t-wkspublish.cpp @@ -28,6 +28,10 @@ you do not wish to do so, delete this exception statement from your version. */ +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + #include <QDebug> #include <QTest> #include <QSignalSpy> @@ -122,7 +126,7 @@ private Q_SLOTS: // First check if it is supported auto job = openpgp()->wksPublishJob(); connect(job, &WKSPublishJob::result, this, - [this] (Error err, QByteArray out, QByteArray errout, QString, Error) { + [this] (Error err, QByteArray, QByteArray, QString, Error) { Q_ASSERT(err); Q_EMIT asyncDone(); }); @@ -140,7 +144,7 @@ private: // First check if it is supported auto job = openpgp()->wksPublishJob(); connect(job, &WKSPublishJob::result, this, - [this] (Error err, QByteArray out, QByteArray errout, QString, Error) { + [this] (Error err, QByteArray, QByteArray, QString, Error) { if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.0.16") { std::cout << err; Q_ASSERT(err); @@ -161,7 +165,7 @@ private: } auto job = openpgp()->wksPublishJob(); connect(job, &WKSPublishJob::result, this, - [this] (Error err, QByteArray out, QByteArray errout, QString, Error) { + [this] (Error err, QByteArray, QByteArray, QString, Error) { Q_ASSERT(err); Q_EMIT asyncDone(); }); @@ -193,7 +197,7 @@ private: auto keygenjob = openpgp()->keyGenerationJob(); QByteArray fpr; connect(keygenjob, &KeyGenerationJob::result, this, - [this, &fpr](KeyGenerationResult result, QByteArray pubkeyData, QString, Error) + [this, &fpr](KeyGenerationResult result, QByteArray, QString, Error) { Q_ASSERT(!result.error()); fpr = QByteArray(result.fingerprint()); @@ -207,7 +211,7 @@ private: /* Then try to create a request. */ auto job = openpgp()->wksPublishJob(); connect(job, &WKSPublishJob::result, this, - [this] (Error err, QByteArray out, QByteArray errout, QString, Error) { + [this] (Error err, QByteArray out, QByteArray, QString, Error) { Q_ASSERT(!err); Q_EMIT asyncDone(); const QString outstr = QString(out); @@ -222,7 +226,7 @@ private: Q_ASSERT(spy.wait()); } - void testWKSPublishRecieve() { + void testWKSPublishReceive() { if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.0.16") { /* Not supported */ return; @@ -243,7 +247,7 @@ private: /* Get a response. */ auto job = openpgp()->wksPublishJob(); connect(job, &WKSPublishJob::result, this, - [this] (Error err, QByteArray out, QByteArray errout, QString, Error) { + [this] (Error err, QByteArray out, QByteArray, QString, Error) { Q_ASSERT(!err); Q_EMIT asyncDone(); const QString outstr = QString(out); @@ -254,7 +258,7 @@ private: Q_ASSERT(outstr.contains( QStringLiteral("From: " TEST_ADDRESS))); }); - job->startRecieve(QByteArray(testResponse)); + job->startReceive(QByteArray(testResponse)); Q_ASSERT(spy.wait()); } |