Compare commits

...

47 Commits

Author SHA1 Message Date
Ingo Klöcker
5c095553e4
build,qt: Fix include path in CMake files
* lang/qt/src/Makefile.am (QGpgmeConfig.cmake, QGpgmeQt6Config.cmake):
Use new variables includeprefix{5,6} instead of replaced variable
includeprefix.
--

GnuPG-bug-id: 7205
2024-07-22 10:32:00 +02:00
Ingo Klöcker
9ab2ce36f9
build,qt: Don't put generated camel-case headers in tarball
* lang/qt/src/Makefile.am: Change camelcase5include_HEADERS to
nodist_camelcase5include_HEADERS. Change camelcase6include_HEADERS to
nodist_camelcase6include_HEADERS.
--
2024-07-18 16:16:33 +02:00
Ingo Klöcker
c69240c843
core: Remove obsolete source files
* src/isascii.c, src/putc_unlocked.c: Remove.
--

I noticed those files when I compared the content of the dist tarball
with the repo.
2024-07-18 15:51:44 +02:00
Ingo Klöcker
42e151b34b
build,qt: Allow building Qt 5 bindings and Qt 6 bindings
* configure.ac: Remove "qt" from default_languages. Add "qt5 qt6" to
default_languages. Remove "qt" from help for --enable-languages. Don't
fail anymore if "qt5" and "qt6" are enabled. Warn that "qt" is
deprecated if it was enabled.
* lang/qt/src/Makefile.am (libqgpgme_la, libqgpgmeqt6_la): New.
(lib_LTLIBRARIES): Set Qt 5 and/or Qt 6 variant of libqgpgme.
(AM_CPPFLAGS): Replace with libqgpgme_la_CPPFLAGS for Qt 5 and
libqgpgmeqt6_la_CPPFLAGS for Qt 6.
--

This makes it possible to build QGpgME simultaneously for Qt 5 and Qt 6.
By default, QGpgME is now built for all versions of Qt that are found.
Specifying "qt" as language is deprecated.

GnuPG-bug-id: 7205
2024-07-18 14:42:30 +02:00
Ingo Klöcker
e6830b58b6
build,qt: Decouple generation of moc files
* m4/qt5.m4: Export moc for Qt 5 in variable MOC5. Unset temporary MOC2.
* m4/qt6.m4: Export moc for Qt 6 in variable MOC6.
* lang/qt/src/Makefile.am: Generate .moc5 files from .h files. Generate
.moc forwarding headers in moc5 subfolder. Add moc5 subfolder to include
paths for Qt 5-based qgpgme library. Ditto for Qt 6. Clean up moc5 and
moc6 subfolders.
* lang/qt/tests/Makefile.am: List tests and test runners for Qt 5 and
Qt 6. Generate .moc5 files from .cpp files of tests. Generate .moc
forwarding headers in moc5 subfolder. Generate .hmoc file from
t-support.h directly in moc5 subfolder. Add moc5 subfolder to include
paths for all Qt 5-based tests and runners. Ditto for Qt 6. Specify
sources, LDADD and CPPFLAGS for all tests and test runners for Qt 5 and
Qt 6. Clean up moc5 and moc6 subfolders.
--

The output of Qt 5's moc and Qt 6's moc is incompatible. Therefore, we
need to generate different .moc files for Qt 5 and Qt 6 to support
co-building of the Qt 5 and Qt 6 bindings. The duplication of the
listing of the tests couldn't be avoided because automake doesn't
understand `the_tests5 = $(the_tests:%=%5)` and couldn't match the
tests with their _SOURCES. Maybe some m4 programming would have helped,
but that would have made the Makefiles even more unreadable.

GnuPG-bug-id: 7205
2024-07-18 14:41:52 +02:00
Ingo Klöcker
899a572b33
build,qt: Remove include directories on uninstall
* lang/qt/src/Makefile.am (uninstall-include-dirs-qt5,
uninstall-include-dirs-qt6): New targets.
(uninstall_include_dirs_qt5, uninstall_include_dirs_qt6): New variables.
(uninstall-local): Replace with...
(uninstall-hook): ...this. Add new uninstall_include_dirs_qt* variables.
--

We have to use uninstall-hook because uninstall-local runs before the
header files have been removed from the include folders we want to
remove.

GnuPG-bug-id: 7205
2024-07-18 14:41:32 +02:00
Ingo Klöcker
69558f2c0b
build,qt: Decouple handling of include headers
* lang/qt/src/Makefile.am (includeprefix): Replace with...
(includeprefix5, includeprefix6): ...these.
(qgpgmeincludedir): Replace with...
(qgpgme5includedir, qgpgme6includedir): ...these.
(qgpgmeinclude_HEADERS): Replace with...
(qgpgme5include_HEADERS, qgpgme6include_HEADERS): ...these.
(nodist_qgpgmeinclude_HEADERS): Replace with...
(nodist_qgpgme5include_HEADERS, nodist_qgpgme6include_HEADERS): ..these.
(camelcaseincludedir): Replace with...
(camelcase5includedir, camelcase6includedir): ...these.
(camelcaseinclude_HEADERS): Replace with...
(camelcase5include_HEADERS, camelcase6include_HEADERS): ...these.
--

This prepares the code for the case that WANT_QT5 and WANT_QT6 are both
true.

GnuPG-bug-id: 7205
2024-07-18 14:40:37 +02:00
Ingo Klöcker
576d2db9dd
build,qt: Decouple (un)install of CMake files
* lang/qt/src/Makefile.am (install-cmake-files): Rename target to
install-cmake-files-qt5 and install-cmake-files-qt6.
(uninstall-cmake-files): Rename target to uninstall-cmake-files-qt5 and
uninstall-cmake-files-qt6.
(install_cmake_files_qt5, uninstall_cmake_files_qt5,
install_cmake_files_qt6, uninstall_cmake_files_qt6): New variables.
(install-data-local): Depend on both install-cmake-files-qt* targets.
(uninstall-local): Depend on both uninstall-cmake-files-qt* targets.
--

This prepares the targets for the case that WANT_QT5 and WANT_QT6 are
both true.

GnuPG-bug-id: 7205
2024-07-18 14:35:46 +02:00
Ingo Klöcker
aa15a664b3
core: Support all keylist modes and fix possible overrun
* src/gpgme-tool.c (gt_get_keylist_mode): Increase NR_KEYLIST_MODES to
number of keylist modes. Add support for GPGME_KEYLIST_MODE_WITH_TOFU,
GPGME_KEYLIST_MODE_WITH_KEYGRIP, GPGME_KEYLIST_MODE_WITH_V5FPR. Write
all modes.
(hlp_keylist_mode): List all supported keylist modes.
(cmd_keylist_mode): Add support for GPGME_KEYLIST_MODE_WITH_TOFU,
GPGME_KEYLIST_MODE_WITH_KEYGRIP, GPGME_KEYLIST_MODE_WITH_V5FPR.
--

This fixes the possible overrun reported by Michal Hlavinka and adds
support for all keylist modes.
2024-07-15 22:19:13 +02:00
Ingo Klöcker
e46748a0d1
build,cpp: Fix include paths in forwarding headers in gpgme++ folder
* lang/cpp/src/Makefile.am (build rule for copied headers): Write
abs_srcdir instead of srcdir in the generated headers.
--

The generated include paths lacked a "../" if srcdir was relative. This
lead to self-including includes for in-source builds. Including the real
headers with their absolute paths fixes this.

GnuPG-bug-id: 7110
2024-07-10 23:28:27 +02:00
Ingo Klöcker
f6d020e24f
qt: Replace usage of deprecated Error::asString
* lang/qt/src/debug.cpp (operator<<): Use Error::asStdString instead of
Error::asString.
* lang/qt/src/qgpgmedecryptverifyjob.cpp (decrypt_verify),
lang/qt/src/qgpgmenewcryptoconfig.cpp
(QGpgMENewCryptoConfigComponent::sync),
lang/qt/src/qgpgmewkdlookupjob.cpp (startDirmngr): Use QDebug operator
for Error instead of Error::asString.
* lang/qt/src/threadedjobmixin.cpp (_detail::audit_log_as_html): Use
errorAsString instead of Error::asString.
* lang/qt/src/util.h (errorAsString): New.

* lang/qt/tests/run-decryptverifyarchivejob.cpp (main),
lang/qt/tests/run-decryptverifyjob.cpp (main),
lang/qt/tests/run-encryptarchivejob.cpp (main),
lang/qt/tests/run-encryptjob.cpp (main),
lang/qt/tests/run-exportjob.cpp (main),
lang/qt/tests/run-importjob.cpp (main),
lang/qt/tests/run-receivekeysjob.cpp (main),
lang/qt/tests/run-refreshkeysjob.cpp (main),
lang/qt/tests/run-signarchivejob.cpp (main),
lang/qt/tests/run-signjob.cpp (main),
lang/qt/tests/run-verifydetachedjob.cpp (main),
lang/qt/tests/run-verifyopaquejob.cpp (main),
lang/qt/tests/run-wkdrefreshjob.cpp (main),
lang/qt/tests/t-ownertrust.cpp (testChangeOwnerTrust),
lang/qt/tests/t-remarks.cpp (testRemarkOwnKey),
lang/qt/tests/t-tofuinfo.cpp (testTofuPolicy): Use QDebug operator for
Error instead of Error::asString.
* lang/qt/tests/t-changeexpiryjob.cpp (all test functions),
lang/qt/tests/t-trustsignatures.cpp (all test functions),
lang/qt/tests/t-various.cpp (testSignKeyWithoutExpiration,
testSignKeyWithExpiration): Use errorAsString instead of
Error::asString.
--

GnuPG-bug-id: 7188
2024-07-05 10:05:51 +02:00
Ingo Klöcker
28542b14c4
cpp: Deprecate Error::asString and update users
* lang/cpp/src/error.h (Error::asString): Mark as deprecated.
* lang/cpp/src/context.cpp (operator<<),
lang/cpp/src/editinteractor.cpp (edit_interactor_callback_impl),
lang/cpp/tests/run-getkey.cpp (main),
lang/cpp/tests/run-keylist.cpp (main),
lang/cpp/tests/run-wkdlookup.cpp (main): Use Error::asStdString instead
of Error::asString.
--

GnuPG-bug-id: 7188
2024-07-05 10:05:51 +02:00
Ingo Klöcker
2656d3ee5b
cpp: Add safer member function returning text describing an error
* lang/cpp/src/error.h, lang/cpp/src/context.cpp (class Error): New
member function asStdString.
--

Unlike asString the new function doesn't cache the value returned by
gpgme_strerror_r. This ensures that on Windows the UTF-8 encoded text
is returned for the main thread even if the function was called before
for another thread. For other threads asStdString will still return the
natively encoded error description until UTF-8 encoded error
descriptions can be enabled for all threads (T7185).

GnuPG-bug-id: 7188
2024-07-05 10:05:51 +02:00
Ingo Klöcker
acf574af64
qt: Always include C++ binding headers with gpgme++/ prefix
* lang/qt/src/Makefile.am, lang/qt/tests/Makefile.am (AM_CPPFLAGS):
Add builddir instead of srcdir of C++ bindings as include path.
* lang/qt/src/changeexpiryjob.cpp, lang/qt/src/changeexpiryjob.h,
lang/qt/src/changeownertrustjob.h, lang/qt/src/dataprovider.cpp,
lang/qt/src/dataprovider.h, lang/qt/src/debug.cpp,
lang/qt/src/decryptverifyarchivejob.cpp,
lang/qt/src/decryptverifyarchivejob.h,
lang/qt/src/encryptarchivejob.cpp, lang/qt/src/encryptarchivejob.h,
lang/qt/src/encryptjob.h, lang/qt/src/encryptjob_p.h,
lang/qt/src/filelistdataprovider.cpp,
lang/qt/src/filelistdataprovider.h,
lang/qt/src/hierarchicalkeylistjob.h, lang/qt/src/importjob.cpp,
lang/qt/src/importjob.h, lang/qt/src/importjob_p.h, lang/qt/src/job.h,
lang/qt/src/keyformailboxjob.h, lang/qt/src/keylistjob.h,
lang/qt/src/listallkeysjob.h, lang/qt/src/multideletejob.cpp,
lang/qt/src/qgpgmeaddexistingsubkeyjob.cpp,
lang/qt/src/qgpgmeadduseridjob.cpp, lang/qt/src/qgpgmebackend.cpp,
lang/qt/src/qgpgmechangeexpiryjob.cpp,
lang/qt/src/qgpgmechangeownertrustjob.cpp,
lang/qt/src/qgpgmechangepasswdjob.cpp, lang/qt/src/qgpgmedecryptjob.cpp,
lang/qt/src/qgpgmedecryptjob.h,
lang/qt/src/qgpgmedecryptverifyarchivejob.cpp,
lang/qt/src/qgpgmedecryptverifyarchivejob.h,
lang/qt/src/qgpgmedecryptverifyjob.cpp,
lang/qt/src/qgpgmedecryptverifyjob.h, lang/qt/src/qgpgmedeletejob.cpp,
lang/qt/src/qgpgmedownloadjob.cpp,
lang/qt/src/qgpgmeencryptarchivejob.cpp,
lang/qt/src/qgpgmeencryptarchivejob.h, lang/qt/src/qgpgmeencryptjob.cpp,
lang/qt/src/qgpgmeencryptjob.h, lang/qt/src/qgpgmeexportjob.cpp,
lang/qt/src/qgpgmeimportfromkeyserverjob.cpp,
lang/qt/src/qgpgmeimportfromkeyserverjob.h,
lang/qt/src/qgpgmeimportjob.cpp, lang/qt/src/qgpgmeimportjob.h,
lang/qt/src/qgpgmekeyformailboxjob.h,
lang/qt/src/qgpgmekeygenerationjob.cpp,
lang/qt/src/qgpgmekeygenerationjob.h, lang/qt/src/qgpgmekeylistjob.cpp,
lang/qt/src/qgpgmekeylistjob.h, lang/qt/src/qgpgmelistallkeysjob.cpp,
lang/qt/src/qgpgmelistallkeysjob.h,
lang/qt/src/qgpgmenewcryptoconfig.cpp,
lang/qt/src/qgpgmenewcryptoconfig.h, lang/qt/src/qgpgmequickjob.cpp,
lang/qt/src/qgpgmereceivekeysjob.h,
lang/qt/src/qgpgmerefreshsmimekeysjob.cpp,
lang/qt/src/qgpgmerefreshsmimekeysjob.h,
lang/qt/src/qgpgmerevokekeyjob.cpp,
lang/qt/src/qgpgmesetprimaryuseridjob.cpp,
lang/qt/src/qgpgmesignarchivejob.cpp,
lang/qt/src/qgpgmesignarchivejob.h,
lang/qt/src/qgpgmesignencryptarchivejob.cpp,
lang/qt/src/qgpgmesignencryptarchivejob.h,
lang/qt/src/qgpgmesignencryptjob.cpp,
lang/qt/src/qgpgmesignencryptjob.h, lang/qt/src/qgpgmesignjob.cpp,
lang/qt/src/qgpgmesignjob.h, lang/qt/src/qgpgmesignkeyjob.cpp,
lang/qt/src/qgpgmetofupolicyjob.cpp,
lang/qt/src/qgpgmeverifydetachedjob.cpp,
lang/qt/src/qgpgmeverifydetachedjob.h,
lang/qt/src/qgpgmeverifyopaquejob.cpp,
lang/qt/src/qgpgmeverifyopaquejob.h, lang/qt/src/qgpgmewkdlookupjob.cpp,
lang/qt/src/qgpgmewkdrefreshjob.cpp, lang/qt/src/qgpgmewkdrefreshjob.h,
lang/qt/src/qgpgmewkspublishjob.cpp, lang/qt/src/quickjob.h,
lang/qt/src/signarchivejob.cpp, lang/qt/src/signarchivejob.h,
lang/qt/src/signencryptarchivejob.cpp,
lang/qt/src/signencryptarchivejob.h, lang/qt/src/signencryptjob.h,
lang/qt/src/signencryptjob_p.h, lang/qt/src/signjob.h,
lang/qt/src/signjob_p.h, lang/qt/src/threadedjobmixin.cpp,
lang/qt/src/threadedjobmixin.h, lang/qt/src/tofupolicyjob.h,
lang/qt/src/util.cpp, lang/qt/src/wkdlookupresult.cpp,
lang/qt/src/wkdlookupresult.h, lang/qt/src/wkdrefreshjob_p.h,
lang/qt/tests/run-decryptverifyarchivejob.cpp,
lang/qt/tests/run-decryptverifyjob.cpp,
lang/qt/tests/run-encryptarchivejob.cpp,
lang/qt/tests/run-encryptjob.cpp, lang/qt/tests/run-exportjob.cpp,
lang/qt/tests/run-importjob.cpp, lang/qt/tests/run-keyformailboxjob.cpp,
lang/qt/tests/run-receivekeysjob.cpp,
lang/qt/tests/run-refreshkeysjob.cpp,
lang/qt/tests/run-signarchivejob.cpp, lang/qt/tests/run-signjob.cpp,
lang/qt/tests/run-verifydetachedjob.cpp,
lang/qt/tests/run-verifyopaquejob.cpp,
lang/qt/tests/run-wkdrefreshjob.cpp,
lang/qt/tests/t-addexistingsubkey.cpp,
lang/qt/tests/t-changeexpiryjob.cpp, lang/qt/tests/t-config.cpp,
lang/qt/tests/t-decryptverify.cpp, lang/qt/tests/t-encrypt.cpp,
lang/qt/tests/t-import.cpp, lang/qt/tests/t-keylist.cpp,
lang/qt/tests/t-keylocate.cpp, lang/qt/tests/t-ownertrust.cpp,
lang/qt/tests/t-remarks.cpp, lang/qt/tests/t-revokekey.cpp,
lang/qt/tests/t-setprimaryuserid.cpp, lang/qt/tests/t-support.cpp,
lang/qt/tests/t-support.h, lang/qt/tests/t-tofuinfo.cpp,
lang/qt/tests/t-trustsignatures.cpp, lang/qt/tests/t-various.cpp,
lang/qt/tests/t-verify.cpp, lang/qt/tests/t-wkdlookup.cpp,
lang/qt/tests/t-wkspublish.cpp: Include GpgME++ headers with gpgme++/
prefix.
--

This prepares the Qt bindings for building them separately from the C++
bindings.

GnuPG-bug-id: 7110
2024-07-05 10:05:50 +02:00
Ingo Klöcker
b7435b31f6
build,cpp: Create forwarding headers in a gpgme++ folder
* lang/cpp/src/Makefile.am (copied_headers): New.
(build rule for all copied headers): New.
(BUILT_SOURCES): New.
(CLEANFILES): Add copied_headers.
--

The forwarding headers make it easier to use the headers from the Qt
bindings when building them against the built but not installed C++
bindings because we can always include the C++ headers with gpgme++/
prefix. This also helps to avoid including a C++ header with the same
name as a header in the Qt bindings (e.g. util.h).

GnuPG-bug-id: 7110
2024-07-05 10:02:45 +02:00
NIIBE Yutaka
95bd4fa813
Fix calling CancelSynchronousIo.
* src/w32-util.c (_gpgme_w32_cancel_synchronous_io): Use HANDLE.

--

GnuPG-bug-id: 6634
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2024-07-05 13:52:33 +09:00
NIIBE Yutaka
de60684500
Fix printing size_t and off_t value for LLP64 Windows.
* src/debug.h (_trace_sysres_off_t): Use 'z' length specifier.
* src/w32-io.c (_gpgme_io_read): Likewise.
(writer, _gpgme_io_write): Likewise.

--

GnuPG-bug-id: 7187
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2024-07-05 13:49:26 +09:00
NIIBE Yutaka
8b4171680c
Remove ath.h and ath.c.
* src/Makefile.am (system_components): We don't use ath.h any more.
(main_sources): Remove ath.h and ath.c.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2024-07-05 11:48:11 +09:00
NIIBE Yutaka
9c276e762a
Don't use ath_self, but get thread ID directly.
* src/debug.c [HAVE_W32_SYSTEM or __linux] (tid_log_callback): Use
native thread ID call for Windows and Linux, ifdef-out-ed.
(debug_init): Only call gpgrt_log_set_pid_suffix_cb for relevant
systems.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2024-07-05 11:36:26 +09:00
NIIBE Yutaka
ec2c6dd8bc
Use gpgrt_b64dec in libgpg-error.
* src/b64dec.c: Remove.
* src/Makefile.am (main_sources): Remove b64dec.c.
* src/data-identify.c (pgp_binary_detection): Use gpgrt_b64dec in
libgpg-error.

--

gpgrt_b64dec is available in libgpg-error 1.27 and it is already in
use by JSON support.

GnuPG-bug-id: 7180
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2024-07-01 11:52:25 +09:00
Ingo Klöcker
6ed5c9a38a
cpp: Remove obsolete files
* lang/cpp/src/context_glib.cpp, lang/cpp/src/context_qt.cpp: Remove.
--

These files have never been used since gpgmepp was imported into this
repo.
2024-06-28 11:11:14 +02:00
Ingo Klöcker
7d5df0bf0d
qt: Allow appending a detached signature to an existing file
* lang/qt/src/qgpgmesignjob.cpp (sign_to_filename): Add argument
"appendSignature". Append new detached signature to an existing file if
requested.
* lang/qt/src/signjob.cpp, lang/qt/src/signjob.h (class SignJob): Add
member functions setAppendSignature, appendSignatureEnabled.
* lang/qt/src/signjob_p.h (struct SignJobPrivate): Add member
m_appendSignature.

* lang/qt/tests/run-signjob.cpp (struct CommandLineOptions): Add members
signingFlags, appendSignature. Initialize armor.
(parseCommandLine): Add command line options --detach-sign and --append.
(main): Do not exit if output file exists and append is enabled.
Pass new options to the job.
--

This change simplifies cross-signing a document by appending additional
detached signatures to a file with already existing detached signatures.

GnuPG-bug-id: 6867
2024-06-18 16:36:40 +02:00
Ingo Klöcker
09827ffc77
qt,build: Install headers for Qt 5 and Qt 6 in different locations
* lang/qt/src/Makefile.am (includeprefix): New.
(qgpgmeincludedir, camelcaseincludedir): Add $(includeprefix).
(QGpgmeConfig.cmake, QGpgmeQt6Config.cmake): Add $(includeprefix) to
replacement for @resolved_includedir@.
--

This installs the headers for Qt 5 in $(includedir)/qgpgme-qt5 and the
headers for Qt 6 in $(includedir)/qgpgme-qt6. For users of the CMake
files the change will be transparent, i.e. they don't have to do
anything. Packagers will have to change their scripts but in the end
this change will make their lifes easier.

GnuPG-bug-id: 7161
2024-06-17 11:55:26 +02:00
NIIBE Yutaka
53c367629a
Update gpg-error.m4 again for spell fix.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2024-06-14 13:52:19 +09:00
Ingo Klöcker
c52e1943a7
qt,tests: Fix deprecation warnings (in Qt 6 build)
* lang/qt/tests/t-tofuinfo.cpp (TofuInfoTest::signAndVerify,
TofuInfoTest::testTofuPolicy): Use range-based for loop instead of Qt's
deprecated foreach.
--
2024-06-13 10:23:49 +02:00
Ingo Klöcker
60b96d149c
qt: Specify import options as list of strings instead of as string
* lang/qt/src/importjob.cpp, lang/qt/src/importjob.h (setImportOptions):
Change type of argument "options" to QStringList.
(importOptions): Change return type to QStringList.
* lang/qt/src/importjob_p.h (struct ImportJobPrivate): Change type of
member m_importOptions to QStringList.
* lang/qt/src/qgpgmeimportjob.cpp (import_qba): Change type of argument
"importOptions" to QStringList. Join list of import options with ','
when setting the "import-options" context flag.

* lang/qt/tests/t-import.cpp (ImportTest::testImportWithImportOptions):
Adapt to API change.
--

This makes the API that was introduced with the previous commit easier
to use.

GnuPG-bug-id: 7152
2024-06-13 10:05:44 +02:00
NIIBE Yutaka
6c90ec7be2
m4: Update m4 files.
* m4/gpg-error.m4: Update libgpg-error master.
* m4/libassuan.m4: Update libassuan master.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2024-06-13 14:47:39 +09:00
NIIBE Yutaka
14b035034a
gpgme.m4: Fix setting/using GPG_ERROR_CONFIG.
gpgm4.m4 (_AM_PATH_GPGRT_CONFIG): Don't set GPG_ERROR_CONFIG and
gpg_error_config_version.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2024-06-13 14:46:08 +09:00
Ingo Klöcker
2187a4de8c
qt: Allow specifying import options when importing keys
* lang/qt/src/importjob.cpp, lang/qt/src/importjob.h (class ImportJob):
Add member functions setImportOptions and importOptions.
* lang/qt/src/importjob_p.h (struct ImportJobPrivate): Add member
m_importOptions.
* lang/qt/src/qgpgmeimportjob.cpp (import_qba): Add arg importOptions
and adjust the callers. Set import options context flag.

* lang/qt/tests/t-import.cpp (ImportTest): Add member function
testImportWithImportOptions.
--

GnuPG-bug-id: 7152
2024-06-12 11:34:41 +02:00
Ingo Klöcker
5b73b0722a
tests: Add --import-filter option to usage info of run-import
* tests/run-import.c (show_usage): Add option --import-filter.
--
2024-06-12 10:48:34 +02:00
Ingo Klöcker
3b9815bd8a
core: Allow setting import options when importing keys
* src/context.h (struct gpgme_context): New field import_options.
* src/engine-backend.h (struct engine_ops): Add arg import_options to
field 'import'.
* src/engine-gpg.c (gpg_import): Add arg import_options and pass option
--import-options with argument value to gpg.
* src/engine-gpgsm.c (gpgsm_import): Add dummy arg import_options.
* src/engine.c (_gpgme_engine_op_import): Add arg import_options and
pass option to import function of engine.
* src/engine.h (_gpgme_engine_op_import): Add arg import_options.
* src/gpgme.c (gpgme_release): Free 'import_options'.
(gpgme_set_ctx_flag, gpgme_get_ctx_flag): New flag "import-options".
* src/import.c (_gpgme_op_import_start, _gpgme_op_import_keys_start,
_gpgme_op_receive_keys_start): Pass import options stored in context to
_gpgme_engine_op_import.

* tests/run-import.c (show_usage, main): Add option --import-options.
--

This makes the --import-options option available in the GPGME API for
key imports.

GnuPG-bug-id: 7152
2024-06-12 10:45:11 +02:00
Ingo Klöcker
307256d277
qt,doc: Fix typos
* lang/qt/README: Fix typos.
--
2024-06-12 09:09:18 +02:00
Ingo Klöcker
87319b3fc7
qt: Align license of some Makefiles with license of other Makefiles
* lang/qt/doc/Makefile.am, lang/qt/tests/Makefile.am: Change license
from LGPL to GPL.
--

Both files are part of QGpgME (as lang/qt/Makefile.am and
lang/qt/src/Makefile.am). Hence, they should be licensed as other parts
of QGpgME.
2024-06-10 14:56:02 +02:00
Ingo Klöcker
29be63ae37
qt: Fix license headers of Makefiles
* lang/qt/Makefile.am, lang/qt/src/Makefile.am: Files are part of
QGpgme. Fix wrong package name (GPGME-CL -> QGpgME). Replace references
to LGPL with references to GPL.
--

The files were already licensed under the GPL but the license headers
contained multiple (copy&paste?) errors.
2024-06-10 14:55:50 +02:00
Ingo Klöcker
09cc0c81f7
qt: Fix license headers of CMake config files
* lang/qt/src/QGpgmeConfig-w32.cmake.in.in,
lang/qt/src/QGpgmeConfig.cmake.in.in,
lang/qt/src/QGpgmeConfigVersion.cmake.in: Files are part of QGpgME.
Fix copy&paste error (GPGME-CL -> QGpgME). Fix reference to license
to check for details.
* lang/qt/src/QGpgmeQt6Config-w32.cmake.in.in,
lang/qt/src/QGpgmeQt6Config.cmake.in.in,
lang/qt/src/QGpgmeQt6ConfigVersion.cmake.in: Files are part of QGpgME.
Fix reference to license to check for details.
--

The files were already licensed under the GPL but the license headers
contained multiple (copy&paste?) errors.
2024-06-10 14:55:42 +02:00
Ingo Klöcker
967b6b726e
qt: Fix license headers of dataprovider.*
* lang/qt/src/dataprovider.cpp, lang/qt/src/dataprovider.h: Change
license header from LGPL to GPL.
--

QGpgME is released under the GPL. As part of QGpgME these files (that
were originally licensed under the LGPL) are released under the GPL.
2024-06-10 14:55:26 +02:00
Ingo Klöcker
4136928f0d
cpp: Remove commented out and disabled code
* lang/cpp/src/configuration.cpp: Remove disabled, abandoned code.
* lang/cpp/src/context.cpp: Remove commented out, obsolete code.
--
2024-06-10 14:54:48 +02:00
Werner Koch
5d9269cb4f
doc: Extend description for GPGME_CREATE_ADSK
--
2024-06-05 13:50:17 +02:00
Ingo Klöcker
25dd284b0c
core,w32: Pass file names with forward slashes to gpg and gpgtar
src/conversion.c, src/util.h (_gpgme_replace_backslashes): New.
src/engine-gpg.c (_add_arg): Add argument file_name. On Windows, replace
backslashes in file name arguments with forward slashes.
(add_arg_ext, add_arg_with_locp, add_arg, add_arg_pfx, add_gpg_arg,
add_gpg_arg_with_value, add_arg_len): Adjust call of _add_arg.
(add_file_name_arg, add_file_name_arg_len, add_gpg_arg_with_file_name):
New.
(add_file_name_arg_or_data): Call add_file_name_arg for file name.
(gpg_new): Call add_gpg_arg_with_file_name for home directory.
(gpg_decrypt): Call add_file_name_arg for output directory and output
file name.
(append_args_from_recipients_string): Call add_file_name_arg_len for
recipients file name.
(gpg_encrypt): Call add_file_name_arg for output file name, base
directory and input file name. Call add_gpg_arg_with_file_name to set
file name stored in message.
(gpg_encrypt_sign): Call add_file_name_arg for output file name, base
directory and input file name. Call add_gpg_arg_with_file_name to set
file name stored in message.
(gpg_sign): Call add_file_name_arg for output file name, base directory
and input file name. Call add_gpg_arg_with_file_name to set file name
stored in message.
(gpg_verify): Call add_file_name_arg for output directory and output
file name.
--

By passing all file names with forward slashes to gpg and gpgtar we
avoid problems caused by the quoting of backslashes.

GnuPG-bug-id: 7141
2024-06-04 16:52:24 +02:00
Ingo Klöcker
1245b09012
build,python: Fix make distcheck for Python 3.9+
* lang/python/Makefile.am (uninstall-local): Remove installed .egg
folders.
--

Python 3.9+ install the module into a gpg-*.egg folder instead of in
"gpg" with accompanying gpg-*.egg-info file. Moreover, Python 3.9+
normalize version numbers, e.g. the version 1.24.0_beta576 is normalized
as 1.24.0b576.
2024-05-29 17:13:30 +02:00
Ingo Klöcker
09d81da665
build,python: Remove support for Python 3.4, 3.5, 3.7
* configure.ac: Don't look for Python 3.4, 3.5, 3.7 anymore.
--

This complements the previous commit where those versions where removed
from python.m4.
2024-05-29 17:06:16 +02:00
Ben Greiner
5844d9e700
build,python: Build Python bindings without distutils
* m4/python.m4: Add python3.12 and 3.11 as valid interpreters, remove
EOL 3.4, 3.5, 3.7 (keep 3.6 because some distributions still ship and
maintain it).
* lang/python/Makefile.am (clean-local): Remove dist and gpg.egg-info
created by Python 3.9+ on make install.
* lang/python/setup.py.in: switch from distutils to setuptools where
possible, remove obsolete and deprecated -py3 option of swig, add
classifiers up to 3.12, remove 3.4, 3.5, 3.7.
* lang/python/doc/src/gpgme-python-howto.org: replace distutils with
setuptools
* lang/python/examples/howto/advanced/cython/setup.py: replace distutils
with setuptools
--

This fixes building the Python bindings for Python 3.12 where distutils
has been removed.

Based on D545
2024-05-29 17:04:10 +02:00
Ingo Klöcker
986c5f0b94
tests: Add new files to distribution
* tests/json/Makefile.am (EXTRA_DIST): Add files added with f2575b63.
--

Fixes-commit: f2575b6313
GnuPG-bug-id: 7118
2024-05-24 13:46:55 +02:00
Ingo Klöcker
6aa359b1e8
cpp: Fix includes in public headers
* lang/cpp/src/defaultassuantransaction.h,
lang/cpp/src/gpgadduserideditinteractor.h,
lang/cpp/src/gpgagentgetinfoassuantransaction.h,
lang/cpp/src/gpggencardkeyinteractor.h,
lang/cpp/src/gpgsetexpirytimeeditinteractor.h,
lang/cpp/src/gpgsetownertrusteditinteractor.h,
lang/cpp/src/gpgsignkeyeditinteractor.h,
lang/cpp/src/interfaces/assuantransaction.h,
lang/cpp/src/interfaces/dataprovider.h,
lang/cpp/src/interfaces/statusconsumer.h,
lang/cpp/src/scdgetinfoassuantransaction.h,
lang/cpp/src/statusconsumerassuantransaction.h,
lang/cpp/src/trustitem.h: Use #include "foo.h" instead of
#include <foo.h> for own headers.
--

This fixes the build for projects that include the headers (as intended)
with #include <gpgme++/...> and that don't add the gpgme++ subdirectory
to the list of include paths for the compiler.

GnuPG-bug-id: 7110
2024-05-24 10:51:32 +02:00
Ingo Klöcker
f0d1f2c4c7
Merge branch 'ikloecker/t7118-revkeys' 2024-05-24 10:47:15 +02:00
Tobias Fella
15718cb295
qt,cpp: Implement adding ADSKs to existing keys
* lang/cpp/src/context.cpp: Add functions for adding ADSKs.
* lang/cpp/src/context.h: Ditto.
* lang/qt/src/qgpgmequickjob.cpp: Add implementation of ADSK job.
* lang/qt/src/qgpgmequickjob.h: Ditto.
* lang/qt/src/quickjob.h: Add job for adding ADSKs.
2024-05-22 13:08:50 +02:00
Tobias Fella
e42b72bc2b
core: Implement adding ADSKs through gpgme_createsubkey
* src/engine-gpg.c: Add and use function for adding ADSKs.
* src/genkey.c: Prevent error due to no status line.
* src/gpgme.h.in: Add flag GPGME_CREATE_ADSK
* doc/gpgme.texi: Add documentation for ADSKs
* tests/run-genkey.c: Add test for adding ADSKs
--

This adds the ability to add ADSKs through
the gpgme_createsubkey interface.
The function must be called with NULL userid,
the ADSK fingerprint in algo
and the GPGME_CREATE_ADSK flag.
2024-05-22 10:16:19 +02:00
207 changed files with 1519 additions and 1674 deletions

20
NEWS
View File

@ -9,27 +9,43 @@ Noteworthy changes in version 1.24.0 (unrelease)
* Add information about designated revocation keys. [T7118]
* New context flag "import-options". [T7152]
* cpp: Provide information about designated revocation keys for a Key.
[T7118]
* cpp: Add safer member function returning text describing an error.
[T5960]
* qt: Build QGpgME for Qt 5 and Qt 6 simultaneously. [T7205]
* qt: Install headers for Qt 5 and Qt 6 in separate folders. [T7161]
* qt: Allow reading the data to decrypt/encrypt/sign/verify directly from
files. [T6550]
* qt: Allow writing the decrypted/encrypted/signed/verified data directly
to files. [T6550]
* qt: Allow specifying import options when importing keys. [T7152]
* qt: Allow appending a detached signature to an existing file. [T6867]
* Interface changes relative to the 1.23.2 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GPGME_ENCRYPT_FILE NEW.
GPGME_SIG_MODE_FILE NEW.
gpgme_key_t EXTENDED: New field 'revkeys'.
gpgme_revocation_key_t NEW.
gpgme_set_ctx_flag EXTENDED: New flag 'import-options'.
cpp: Context::EncryptFile NEW.
cpp: SignatureMode::SignFile NEW.
cpp: RevocationKey NEW.
cpp: Key::revocationKey NEW.
cpp: Key::numRevocationKeys NEW.
cpp: Key::revocationKeys NEW.
cpp: Error::asStdString NEW.
cpp: Error::asString DEPRECATED.
qt: DecryptVerifyJob::setInputFile NEW.
qt: DecryptVerifyJob::inputFile NEW.
qt: DecryptVerifyJob::setOutputFile NEW.
@ -60,6 +76,8 @@ Noteworthy changes in version 1.24.0 (unrelease)
qt: SignJob::outputFile NEW.
qt: SignJob::setSigningFlags NEW.
qt: SignJob::signingFlags NEW.
qt: SignJob::setAppendSignature NEW.
qt: SignJob::appendSignatureEnabled NEW.
qt: VerifyDetachedJob::setSignatureFile NEW.
qt: VerifyDetachedJob::signatureFile NEW.
qt: VerifyDetachedJob::setSignedFile NEW.
@ -68,6 +86,8 @@ Noteworthy changes in version 1.24.0 (unrelease)
qt: VerifyOpaqueJob::inputFile NEW.
qt: VerifyOpaqueJob::setOutputFile NEW.
qt: VerifyOpaqueJob::outputFile NEW.
qt: ImportJob::setImportOptions NEW.
qt: ImportJob::importOptions NEW.
Noteworthy changes in version 1.23.2 (2023-11-28)

View File

@ -257,7 +257,7 @@ have_macos_system=no
build_w32_glib=no
build_w32_qt=no
available_languages="cl cpp python qt qt5 qt6"
default_languages="cl cpp python qt"
default_languages="cl cpp python qt5 qt6"
case "${host}" in
x86_64-*mingw32*)
have_w64_system=yes
@ -375,8 +375,7 @@ AC_ARG_ENABLE([no-direct-extern-access],
AC_ARG_ENABLE([languages],
AS_HELP_STRING([--enable-languages=languages],
[enable only specific language bindings:
cl cpp python qt qt5 qt6 (qt selects qt5 or qt6,
and qt5 and qt6 exclude each other)]),
cl cpp python qt5 qt6]),
[enabled_languages=`echo $enableval | \
tr ',:' ' ' | tr '[A-Z]' '[a-z]' | \
sed 's/c++/cpp/'`],
@ -402,76 +401,95 @@ for language in $enabled_languages; do
fi
done
# Check whether Qt5 and/or Qt6 are enabled explicitly
want_qt5="no";
# Check whether qt5 and/or qt6 are enabled
want_qt5="no"
LIST_MEMBER("qt5", $enabled_languages)
if test "$found" = "1"; then
want_qt5="yes";
if test "$explicit_languages" = "1"; then
want_qt5="yes"
else
want_qt5="maybe"
fi
# Remove qt5; further down qt will be added
enabled_languages=$(echo $enabled_languages | sed 's/qt5//')
fi
want_qt6="no";
want_qt6="no"
LIST_MEMBER("qt6", $enabled_languages)
if test "$found" = "1"; then
want_qt6="yes";
if test "$explicit_languages" = "1"; then
want_qt6="yes"
else
want_qt6="maybe"
fi
# Remove qt6; further down qt will be added
enabled_languages=$(echo $enabled_languages | sed 's/qt6//')
fi
if test "$want_qt5" = "yes" -a "$want_qt6" = "yes"; then
AC_MSG_ERROR([[
# Check whether qt is enabled; if yes then it has been enabled explicitly
want_qt="no"
LIST_MEMBER("qt", $enabled_languages)
if test "$found" = "1"; then
# Ignore qt if specified together with qt5 or qt6
if test "$want_qt5" = "no" -a "$want_qt6" = "no"; then
want_qt="yes"
fi
# Remove qt
enabled_languages=$(echo $enabled_languages | sed 's/qt//')
AC_MSG_WARN([[
***
*** The bindings for Qt5 and Qt6 cannot be built simultaneously.
*** Language binding "qt" is deprecated and will be removed in a future version.
*** Use "qt5" and/or "qt6" instead.
***]])
fi
# Ensure that pkg-config is available for all calls of FIND_QT5/FIND_QT6
PKG_PROG_PKG_CONFIG
# If the generic qt is enabled, then check for Qt5 or Qt6 (in this order)
LIST_MEMBER("qt", $enabled_languages)
if test "$found" = "1"; then
# Remove the generic qt (qt5 and qt6 have already been removed)
enabled_languages=$(echo $enabled_languages | sed 's/qt//')
# Check for Qt 5 (if qt5 or qt is enabled)
if test "$want_qt" = "yes"; then
want_qt5="maybe"
fi
if test "$want_qt5" != "no"; then
FIND_QT5
if test "$have_qt5_libs" = "yes"; then
want_qt5="yes";
else
FIND_QT6
if test "$have_qt6_libs" = "yes"; then
want_qt6="yes";
else
if test "$explicit_languages" = "1"; then
AC_MSG_ERROR([[
***
*** Qt5 (Qt5Core) or Qt6 (Qt6Core) is required for the Qt binding.
***]])
else
AC_MSG_WARN([[
***
*** Qt5 (Qt5Core) and Qt6 (Qt6Core) not found. Qt Binding will be disabled.
***]])
fi
fi
fi
elif test "$want_qt5" = "yes"; then
FIND_QT5
if test "$have_qt5_libs" != "yes"; then
want_qt5="yes"
elif test "$want_qt5" = "yes"; then
AC_MSG_ERROR([[
***
*** Qt5 (Qt5Core) is required for the Qt 5 binding.
***]])
else
want_qt5="no"
fi
elif test "$want_qt6" = "yes"; then
fi
# Check for Qt 6 (if qt6 is enabled or if qt is enabled and Qt 5 wasn't found)
if test "$want_qt" = "yes" -a "$have_qt5_libs" != "yes"; then
want_qt6="maybe"
fi
if test "$want_qt6" != "no"; then
FIND_QT6
if test "$have_qt6_libs" != "yes"; then
if test "$have_qt6_libs" = "yes"; then
want_qt6="yes";
elif test "$want_qt6" = "yes"; then
AC_MSG_ERROR([[
***
*** Qt6 (Qt6Core) is required for the Qt 6 binding.
***]])
else
want_qt6="no"
fi
fi
# Check that cpp is enabled if qt5 or qt6 is enabled
# Check if any Qt was found (if qt is enabled)
if test "$want_qt" = "yes" -a "$have_qt5_libs" != "yes" -a "$have_qt6_libs" != "yes"; then
AC_MSG_ERROR([[
***
*** Qt5 (Qt5Core) or Qt6 (Qt6Core) is required for the Qt bindings.
***]])
fi
# Check that cpp is enabled if qt5 or qt6 is enabled and was found
if test "$want_qt5" = "yes" -o "$want_qt6" = "yes"; then
LIST_MEMBER("cpp", $enabled_languages)
if test "$found" = "0"; then
@ -522,7 +540,7 @@ if test "$found" = "1" -a "$HAVE_CXX17" != "1"; then
fi
fi
# Now append qt to the list of language bindings
# Now append qt to the list of language bindings (to enable the subdir in lang)
if test "$want_qt5" = "yes" -o "$want_qt6" = "yes"; then
enabled_languages=$(echo $enabled_languages qt)
fi
@ -590,8 +608,7 @@ if test "$found_py" = "1"; then
if test "$found_py" = "1" -o "$found_py3" = "1"; then
# Reset everything, so that we can look for another Python.
m4_foreach([mym4pythonver],
[[2.7],[3.4],[3.5],[3.6],[3.7],[3.8],[3.9],[3.10],
[3.11],[3.12],[all]],
[[2.7],[3.6],[3.8],[3.9],[3.10],[3.11],[3.12],[all]],
[unset PYTHON
unset PYTHON_VERSION
unset PYTHON_CPPFLAGS
@ -1146,7 +1163,9 @@ AC_CONFIG_FILES([lang/python/Makefile
AC_CONFIG_FILES([lang/python/setup.py], [chmod a+x lang/python/setup.py])
AC_OUTPUT
if test "$want_qt5" = "yes"; then
if test "$want_qt5" = "yes" -a "$want_qt6" = "yes"; then
enabled_languages_v=$(echo ${enabled_languages_v:-$enabled_languages} | sed "s/qt/qt (Qt 5, Qt 6)/")
elif test "$want_qt5" = "yes"; then
enabled_languages_v=$(echo ${enabled_languages_v:-$enabled_languages} | sed "s/qt/qt (Qt 5)/")
elif test "$want_qt6" = "yes"; then
enabled_languages_v=$(echo ${enabled_languages_v:-$enabled_languages} | sed "s/qt/qt (Qt 6)/")

View File

@ -3279,6 +3279,12 @@ The string given in @var{value} is passed to the GnuPG engine to use as
filter when importing keys. Valid values are documented in the GnuPG
manual and the gpg man page under the option @option{--import-filter}.
@item "import-options"
@since{1.24.0}
The string given in @var{value} is passed to the GnuPG engine to use as
options when importing keys. Valid values are documented in the GnuPG
manual and the gpg man page under the option @option{--import-options}.
@item "no-auto-check-trustdb"
@since{1.19.0}
Setting the @var{value} to "1" forces the GPG backend to disable the
@ -4390,6 +4396,14 @@ override this check.
Request generation of keys that do not expire.
@item GPGME_CREATE_ADSK
@since{1.24.0}
Add an ADSK to the key. With this flag @var{algo} is expected to be
the hexified fingerprint of the ADSK to be added; this must be a
subkey. If the string "default" is used for @var{algo} the engine
will add all ADSK as it would do for new keys.
@end table
After the operation completed successfully, information about the
@ -4465,6 +4479,10 @@ values for timestamps and thus can only encode dates up to the year
@var{flags} takes the same values as described above for
@code{gpgme_op_createkey}.
If the @code{GPGME_CREATE_ADSK} flag is set, the subkey fingerprint
given in the @code{algo} parameter is added as an ADSK
to the key.
After the operation completed successfully, information about the
created key can be retrieved with @code{gpgme_op_genkey_result}.

View File

@ -88,6 +88,14 @@ else
libsuffix=.so
endif
copied_headers = $(gpgmepp_headers:%=gpgme++/%) $(interface_headers:%=gpgme++/%)
$(copied_headers): Makefile.am
mkdir -p $(builddir)/gpgme++/interfaces
echo -n "#include \"$(abs_srcdir)" > "$@"
echo -n "$@" | sed "s/gpgme++//" >> "$@"
echo "\"" >> "$@"
if HAVE_W32_SYSTEM
GpgmeppConfig.cmake: GpgmeppConfig-w32.cmake.in
sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \
@ -115,5 +123,8 @@ install-data-local: install-cmake-files
uninstall-local: uninstall-cmake-files
BUILT_SOURCES = $(copied_headers)
CLEANFILES = GpgmeppConfig.cmake GpgmeppConfigVersion.cmake \
gpgmepp_version.h GpgmeppConfig.cmake.in
gpgmepp_version.h GpgmeppConfig.cmake.in \
$(copied_headers)

View File

@ -257,158 +257,6 @@ Type Option::alternateType() const
return isNull() ? NoType : static_cast<Type>(opt->alt_type) ;
}
#if 0
static Option::Variant argument_to_variant(gpgme_conf_type_t type, bool list, gpgme_conf_arg_t arg)
{
assert(arg);
switch (type) {
case GPGME_CONF_NONE:
if (list) {
// return the count (number of times set):
return arg->value.count;
} else {
return none;
}
case GPGME_CONF_INT32:
if (list) {
std::vector<int> result;
for (gpgme_conf_arg_t a = arg ; a ; a = a->next) {
result.push_back(a->value.int32);
}
return result;
} else {
return arg->value.int32;
}
case GPGME_CONF_UINT32:
if (list) {
std::vector<unsigned int> result;
for (gpgme_conf_arg_t a = arg ; a ; a = a->next) {
result.push_back(a->value.uint32);
}
return result;
} else {
return arg->value.uint32;
}
case GPGME_CONF_FILENAME:
case GPGME_CONF_LDAP_SERVER:
case GPGME_CONF_KEY_FPR:
case GPGME_CONF_PUB_KEY:
case GPGME_CONF_SEC_KEY:
case GPGME_CONF_ALIAS_LIST:
// these should not happen in alt_type, but fall through
case GPGME_CONF_STRING:
if (list) {
std::vector<const char *> result;
for (gpgme_conf_arg_t a = arg ; a ; a = a->next) {
result.push_back(a->value.string);
}
return result;
} else {
return arg->value.string;
}
}
assert(!"Option: unknown alt_type!");
return Option::Variant();
}
namespace
{
inline const void *to_void_star(const char *s)
{
return s;
}
inline const void *to_void_star(const std::string &s)
{
return s.c_str();
}
inline const void *to_void_star(const int &i)
{
return &i; // const-&: sic!
}
inline const void *to_void_star(const unsigned int &i)
{
return &i; // const-&: sic!
}
struct VariantToArgumentVisitor : boost::static_visitor<gpgme_conf_arg_t> {
static gpgme_conf_arg_t make_argument(gpgme_conf_type_t type, const void *value)
{
gpgme_conf_arg_t arg = 0;
#ifdef HAVE_GPGME_CONF_ARG_NEW_WITH_CONST_VALUE
if (const gpgme_error_t err = gpgme_conf_arg_new(&arg, type, value)) {
return 0;
}
#else
if (const gpgme_error_t err = gpgme_conf_arg_new(&arg, type, const_cast<void *>(value))) {
return 0;
}
#endif
else {
return arg;
}
}
gpgme_conf_arg_t operator()(bool v) const
{
return v ? make_argument(0) : 0 ;
}
gpgme_conf_arg_t operator()(const char *s) const
{
return make_argument(s ? s : "");
}
gpgme_conf_arg_t operator()(const std::string &s) const
{
return operator()(s.c_str());
}
gpgme_conf_arg_t operator()(int i) const
{
return make_argument(&i);
}
gpgme_conf_arg_t operator()(unsigned int i) const
{
return make_argument(&i);
}
template <typename T>
gpgme_conf_arg_t operator()(const std::vector<T> &value) const
{
gpgme_conf_arg_t result = 0;
gpgme_conf_arg_t last = 0;
for (typename std::vector<T>::const_iterator it = value.begin(), end = value.end() ; it != end ; ++it) {
if (gpgme_conf_arg_t arg = make_argument(to_void_star(*it))) {
if (last) {
last = last->next = arg;
} else {
result = last = arg;
}
}
}
return result;
}
};
}
static gpgme_conf_arg_t variant_to_argument(const Option::Variant &value)
{
VariantToArgumentVisitor v;
return apply_visitor(v, value);
}
optional<Option::Variant> Option::defaultValue() const
{
if (isNull()) {
return optional<Variant>();
} else {
return argument_to_variant(opt->alt_type, opt->flags & GPGME_CONF_LIST, opt->default_value);
}
}
#endif
Argument Option::defaultValue() const
{
if (isNull()) {

View File

@ -130,6 +130,13 @@ const char *Error::asString() const
return mMessage.c_str();
}
std::string Error::asStdString() const
{
std::string message;
format_error(static_cast<gpgme_error_t>(mErr), message);
return message;
}
int Error::code() const
{
return gpgme_err_code(mErr);
@ -147,11 +154,7 @@ bool Error::isCanceled() const
int Error::toErrno() const
{
//#ifdef HAVE_GPGME_GPG_ERROR_WRAPPERS
return gpgme_err_code_to_errno(static_cast<gpgme_err_code_t>(code()));
//#else
// return gpg_err_code_to_errno( static_cast<gpg_err_code_t>( code() ) );
//#endif
}
// static
@ -192,7 +195,7 @@ Error Error::fromCode(unsigned int err, unsigned int src)
std::ostream &operator<<(std::ostream &os, const Error &err)
{
return os << "GpgME::Error(" << err.encodedError() << " (" << err.asString() << "))";
return os << "GpgME::Error(" << err.encodedError() << " (" << err.asStdString() << "))";
}
Context::KeyListModeSaver::KeyListModeSaver(Context *ctx)
@ -1799,6 +1802,16 @@ Error Context::startRevokeSignature(const Key &key, const Key &signingKey,
key.impl(), signingKey.impl(), uids.c_str(), flags));
}
Error Context::addAdsk(const Key &k, const char *adsk)
{
return Error(d->lasterr = gpgme_op_createsubkey(d->ctx, k.impl(), adsk, 0, 0, GPGME_CREATE_ADSK));
}
Error Context::startAddAdsk(const Key &k, const char *adsk)
{
return Error(d->lasterr = gpgme_op_createsubkey_start(d->ctx, k.impl(), adsk, 0, 0, GPGME_CREATE_ADSK));
}
Error Context::setFlag(const char *name, const char *value)
{
return Error(d->lasterr = gpgme_set_ctx_flag(d->ctx, name, value));

View File

@ -324,6 +324,9 @@ public:
Error startRevokeSignature(const Key &key, const Key &signingKey,
const std::vector<UserID> &userIds = std::vector<UserID>());
Error addAdsk(const Key &k, const char *adsk);
Error startAddAdsk(const Key &k, const char *adsk);
// using TofuInfo::Policy
Error setTofuPolicy(const Key &k, unsigned int policy);
Error setTofuPolicyStart(const Key &k, unsigned int policy);

View File

@ -1,41 +0,0 @@
/*
context_glib.cpp - wraps a gpgme key context, gpgme-glib-specific functions
Copyright (C) 2007 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
GPGME++ is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
GPGME++ 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 Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with GPGME++; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <global.h>
extern "C" GIOChannel *gpgme_get_fdptr(int);
GIOChannel *GpgME::getGIOChannel(int fd)
{
return gpgme_get_fdptr(fd);
}
QIODevice *GpgME::getQIODevice(int fd)
{
return 0;
}

View File

@ -1,41 +0,0 @@
/*
context_qt.cpp - wraps a gpgme key context, gpgme-qt-specific functions
Copyright (C) 2007 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
GPGME++ is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
GPGME++ 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 Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with GPGME++; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <global.h>
extern "C" QIODevice *gpgme_get_fdptr(int);
GIOChannel *GpgME::getGIOChannel(int)
{
return 0;
}
QIODevice *GpgME::getQIODevice(int fd)
{
return gpgme_get_fdptr(fd);
}

View File

@ -25,7 +25,7 @@
#ifndef __GPGMEPP_DEFAULTASSUANTRANSACTION_H__
#define __GPGMEPP_DEFAULTASSUANTRANSACTION_H__
#include <interfaces/assuantransaction.h>
#include "interfaces/assuantransaction.h"
#include <string>
#include <vector>

View File

@ -138,7 +138,7 @@ public:
if (writeAll(fd, result, len) != len) {
err = Error::fromSystemError();
if (ei->debug) {
std::fprintf(ei->debug, "EditInteractor: Could not write to fd %d (%s)\n", fd, err.asString());
std::fprintf(ei->debug, "EditInteractor: Could not write to fd %d (%s)\n", fd, err.asStdString().c_str());
}
goto error;
}
@ -147,7 +147,7 @@ public:
if (writeAll(fd, "\n", 1) != 1) {
err = Error::fromSystemError();
if (ei->debug) {
std::fprintf(ei->debug, "EditInteractor: Could not write to fd %d (%s)\n", fd, err.asString());
std::fprintf(ei->debug, "EditInteractor: Could not write to fd %d (%s)\n", fd, err.asStdString().c_str());
}
goto error;
}

View File

@ -47,7 +47,11 @@ public:
explicit Error(unsigned int e) : mErr(e), mMessage() {}
const char *source() const;
const char *asString() const;
/* This function is deprecated. Use asStdString() instead. asString() may
* return wrongly encoded (i.e. not UTF-8) results on Windows for the main
* thread if the function was first called from a secondary thread. */
GPGMEPP_DEPRECATED const char *asString() const;
std::string asStdString() const;
int code() const;
int sourceID() const;

View File

@ -25,7 +25,7 @@
#ifndef __GPGMEPP_GPGADDUSERIDEDITINTERACTOR_H__
#define __GPGMEPP_GPGADDUSERIDEDITINTERACTOR_H__
#include <editinteractor.h>
#include "editinteractor.h"
#include <string>

View File

@ -25,7 +25,7 @@
#ifndef __GPGMEPP_GPGAGENTGETINFOASSUANTRANSACTION_H__
#define __GPGMEPP_GPGAGENTGETINFOASSUANTRANSACTION_H__
#include <interfaces/assuantransaction.h>
#include "interfaces/assuantransaction.h"
#include <string>
#include <vector>

View File

@ -24,7 +24,7 @@
#ifndef __GPGMEPP_GPGGENCARDKEYEDITINTERACTOR_H__
#define __GPGMEPP_GPGGENCARDKEYEDITINTERACTOR_H__
#include <editinteractor.h>
#include "editinteractor.h"
#include <string>
#include <memory>

View File

@ -25,7 +25,7 @@
#ifndef __GPGMEPP_GPGSETEXPIRYTIMEEDITINTERACTOR_H__
#define __GPGMEPP_GPGSETEXPIRYTIMEEDITINTERACTOR_H__
#include <editinteractor.h>
#include "editinteractor.h"
#include <string>

View File

@ -25,8 +25,8 @@
#ifndef __GPGMEPP_GPGSETOWNERTRUSTEDITINTERACTOR_H__
#define __GPGMEPP_GPGSETOWNERTRUSTEDITINTERACTOR_H__
#include <editinteractor.h>
#include <key.h>
#include "editinteractor.h"
#include "key.h"
#include <string>

View File

@ -25,7 +25,7 @@
#ifndef __GPGMEPP_GPGSIGNKEYEDITINTERACTOR_H__
#define __GPGMEPP_GPGSIGNKEYEDITINTERACTOR_H__
#include <editinteractor.h>
#include "editinteractor.h"
#include <string>
#include <vector>

View File

@ -26,7 +26,7 @@
#ifndef __GPGMEPP_INTERFACES_ASSUANTRANSACTION_H__
#define __GPGMEPP_INTERFACES_ASSUANTRANSACTION_H__
#include "gpgmepp_export.h"
#include "../gpgmepp_export.h"
#include <stddef.h>

View File

@ -27,7 +27,7 @@
#include <sys/types.h>
#include "gpgmepp_export.h"
#include "../gpgmepp_export.h"
#include <gpg-error.h>

View File

@ -24,7 +24,7 @@
#ifndef __GPGMEPP_INTERFACES_STATUSCONSUMER_H__
#define __GPGMEPP_INTERFACES_STATUSCONSUMER_H__
#include "gpgmepp_export.h"
#include "../gpgmepp_export.h"
namespace GpgME
{

View File

@ -25,7 +25,7 @@
#ifndef __GPGMEPP_SCDGETINFOASSUANTRANSACTION_H__
#define __GPGMEPP_SCDGETINFOASSUANTRANSACTION_H__
#include <interfaces/assuantransaction.h>
#include "interfaces/assuantransaction.h"
#include <string>
#include <vector>

View File

@ -24,7 +24,7 @@
#ifndef __GPGMEPP_STATUSCONSUMERASSUANTRANSACTION_H__
#define __GPGMEPP_STATUSCONSUMERASSUANTRANSACTION_H__
#include <interfaces/assuantransaction.h>
#include "interfaces/assuantransaction.h"
namespace GpgME
{

View File

@ -27,7 +27,7 @@
#define __GPGMEPP_TRUSTITEM_H__
#include "gpgmefw.h"
#include <key.h>
#include "key.h"
#include "gpgmepp_export.h"
#include <algorithm>

View File

@ -150,7 +150,7 @@ main (int argc, char **argv)
const GpgME::Key key = ctx->key (*argv, err, only_secret);
std::stringstream ss;
ss << "Key " << key << " Err: " << err.asString() << "\n";
ss << "Key " << key << " Err: " << err.asStdString() << "\n";
std::cout << ss.str();

View File

@ -153,7 +153,7 @@ main (int argc, char **argv)
}
Error err = ctx->startKeyListing (*argv, only_secret);
if (err) {
std::cout << "Error: " << err.asString() << "\n";
std::cout << "Error: " << err.asStdString() << "\n";
return -1;
}
GpgME::Key key;

View File

@ -75,31 +75,31 @@ main (int argc, char **argv)
Error err;
auto ctx = std::unique_ptr<Context>{Context::createForEngine(AssuanEngine, &err)};
if (!ctx) {
std::cerr << "Failed to get context (Error: " << err.asString() << ")\n";
std::cerr << "Failed to get context (Error: " << err.asStdString() << ")\n";
return -1;
}
const std::string dirmngrSocket = GpgME::dirInfo("dirmngr-socket");
if ((err = ctx->setEngineFileName(dirmngrSocket.c_str()))) {
std::cerr << "Failed to set engine file name (Error: " << err.asString() << ")\n";
std::cerr << "Failed to set engine file name (Error: " << err.asStdString() << ")\n";
return -1;
}
if ((err = ctx->setEngineHomeDirectory(""))) {
std::cerr << "Failed to set engine home directory (Error: " << err.asString() << ")\n";
std::cerr << "Failed to set engine home directory (Error: " << err.asStdString() << ")\n";
return -1;
}
// try to connect to dirmngr
err = ctx->assuanTransact("GETINFO version");
if (err && err.code() != GPG_ERR_ASS_CONNECT_FAILED) {
std::cerr << "Failed to start assuan transaction (Error: " << err.asString() << ")\n";
std::cerr << "Failed to start assuan transaction (Error: " << err.asStdString() << ")\n";
return -1;
}
if (err.code() == GPG_ERR_ASS_CONNECT_FAILED) {
std::cerr << "Starting dirmngr ...\n";
auto spawnCtx = std::unique_ptr<Context>{Context::createForEngine(SpawnEngine, &err)};
if (!spawnCtx) {
std::cerr << "Failed to get context for spawn engine (Error: " << err.asString() << ")\n";
std::cerr << "Failed to get context for spawn engine (Error: " << err.asStdString() << ")\n";
return -1;
}
@ -120,7 +120,7 @@ main (int argc, char **argv)
ignoreIO, ignoreIO, ignoreIO,
Context::SpawnDetached);
if (err) {
std::cerr << "Failed to start dirmngr (Error: " << err.asString() << ")\n";
std::cerr << "Failed to start dirmngr (Error: " << err.asStdString() << ")\n";
return -1;
}
@ -137,7 +137,7 @@ main (int argc, char **argv)
const auto cmd = std::string{"WKD_GET "} + email;
err = ctx->assuanTransact(cmd.c_str());
if (err && err.code() != GPG_ERR_NO_NAME && err.code() != GPG_ERR_NO_DATA) {
std::cerr << "Error: WKD_GET returned " << err.asString() << "\n";
std::cerr << "Error: WKD_GET returned " << err.asStdString() << "\n";
return -1;
}

View File

@ -80,7 +80,7 @@ CLEANFILES = copystamp \
# 'make distclean' clears the write bit, breaking rm -rf. Fix the
# permissions.
clean-local:
rm -rf -- build
rm -rf -- build dist gpg.egg-info
for PYTHON in $(PYTHONS); do \
find "$$(basename "$${PYTHON}")-gpg" -type d ! -perm -200 -exec chmod u+w {} ';' ; \
rm -rf -- "$$(basename "$${PYTHON}")-gpg" ; \
@ -101,8 +101,12 @@ install-exec-local:
done
uninstall-local:
set -x; GV=$$(echo $(VERSION) | tr - _); for PYTHON in $(PYTHONS); do \
set -x; \
GV=$$(echo $(VERSION) | tr - _); \
normalizedGV=$$(echo $$GV | sed s/_beta/b/); \
for PYTHON in $(PYTHONS); do \
PLATLIB="$(prefix)/$$("$${PYTHON}" -c 'import sysconfig, os; print(os.path.relpath(sysconfig.get_path("platlib", scheme="posix_prefix"), sysconfig.get_config_var("prefix")))')" ; \
rm -rf -- "$(DESTDIR)$${PLATLIB}/gpg" \
"$(DESTDIR)$${PLATLIB}"/gpg-$$GV-py*.egg-info ; \
"$(DESTDIR)$${PLATLIB}"/gpg-$$GV-py*.egg-info \
"$(DESTDIR)$${PLATLIB}"/gpg-$$normalizedGV-py*.egg ; \
done

View File

@ -2945,7 +2945,7 @@ Save that into a file called =keycount.pyx= and then create a
=setup.py= file which contains this:
#+BEGIN_SRC python -i
from distutils.core import setup
from setuptools import setup
from Cython.Build import cythonize
setup(

View File

@ -1,4 +1,4 @@
from distutils.core import setup
from setuptools import setup
from Cython.Build import cythonize
setup(

View File

@ -18,8 +18,12 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from distutils.core import setup, Extension
from distutils.command.build import build
try:
from setuptools import setup, Extension
from setuptools.command.build import build
except ImportError:
from distutils.core import setup, Extension
from distutils.command.build import build
import glob
import os
@ -225,9 +229,8 @@ class BuildExtFirstHack(build):
build.run(self)
py3 = [] if sys.version_info.major < 3 else ['-py3']
swig_sources = []
swig_opts = ['-threads'] + py3 + extra_swig_opts
swig_opts = ['-threads'] + extra_swig_opts
swige = Extension(
'gpg._gpgme',
sources=swig_sources,
@ -282,10 +285,12 @@ GPGME and these bindings is available here:
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Operating System :: POSIX',
'Operating System :: Microsoft :: Windows',
'Topic :: Communications :: Email',

View File

@ -1,22 +1,22 @@
# Makefile.am for GPGMEPP.
# Makefile.am - Makefile for QGpgME.
# Copyright (C) 2016 Bundesamt für Sicherheit in der Informationstechnik
# Software engineering by Intevation GmbH
#
# This file is part of GPGMEPP.
# This file is part of QGpgME, the Qt API binding for GpgME.
#
# GPGME-CL is free software; you can redistribute it and/or modify it
# 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.
#
# GPGME-CL is distributed in the hope that it will be useful,
# 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 Lesser General Public License for more details.
# 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 Lesser General Public
# License along with this program; if not, see <https://gnu.org/licenses/>.
# SPDX-License-Identifier: LGPL-2.1-or-later
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <https://gnu.org/licenses/>.
# SPDX-License-Identifier: GPL-2.0-or-later
if RUN_GPG_TESTS
tests = tests

View File

@ -32,7 +32,7 @@ To use QGpgME first you need to obtain a Protocol class
either for CMS (S/MIME) or OpenPGP. This Protocol class
can then be used to create a Job.
Each Job can be started asynchronusly and emits a result
Each Job can be started asynchronously and emits a result
signal when done. The jobs are deleted automatically
with QObject::deleteLater so they can be started without
result handlers.
@ -53,7 +53,7 @@ in the result signal.
Jobs also provide progress signal whenever GnuPG emits
a progress status line.
Most jobs also provide a way synchronusly execute them.
Most jobs also provide a way synchronously execute them.
Please not that synchronous use does not cause the autodeletion
to take place so you have to manually delete them.

View File

@ -1,21 +1,22 @@
# Makefile.am - Makefile for GPGME Qt docs.
# Makefile.am - Makefile for QGpgME docs.
# Copyright (C) 2016 Bundesamt für Sicherheit in der Informationstechnik
# Software engineering by Intevation GmbH
#
# This file is part of GPGME.
# This file is part of QGpgME.
#
# GPGME is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of the
# License, or (at your option) any later version.
# 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.
#
# GPGME 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 Lesser General
# Public License for more details.
# 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 Lesser General Public
# License along with this program; if not, see <https://www.gnu.org/licenses/>.
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <https://gnu.org/licenses/>.
# SPDX-License-Identifier: GPL-2.0-or-later
## Process this file with automake to produce Makefile.in

View File

@ -1,18 +1,18 @@
# Makefile.am for GPGMEPP.
# Makefile.am for QGpgME.
# Copyright (C) 2016 Bundesamt für Sicherheit in der Informationstechnik
# Software engineering by Intevation GmbH
#
# This file is part of GPGMEPP.
# This file is part of QGpgME, the Qt API binding for GpgME.
#
# GPGME-CL is free software; you can redistribute it and/or modify it
# 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.
#
# GPGME-CL is distributed in the hope that it will be useful,
# 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 Lesser General Public License for more details.
# 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
@ -20,11 +20,12 @@
# 02111-1307, USA
if WANT_QT5
lib_LTLIBRARIES = libqgpgme.la
libqgpgme_la = libqgpgme.la
endif
if WANT_QT6
lib_LTLIBRARIES = libqgpgmeqt6.la
libqgpgmeqt6_la = libqgpgmeqt6.la
endif
lib_LTLIBRARIES = $(libqgpgme_la) $(libqgpgmeqt6_la)
EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \
qgpgme_debug.h qgpgme_version.h.in \
@ -319,33 +320,84 @@ qgpgme_moc_sources = \
gpgcardjob.moc \
qgpgmegpgcardjob.moc
qgpgmeincludedir = $(includedir)/qgpgme
qgpgmeinclude_HEADERS = $(qgpgme_headers)
camelcaseincludedir = $(includedir)/QGpgME
camelcaseinclude_HEADERS = $(camelcase_headers)
nodist_qgpgmeinclude_HEADERS = qgpgme_version.h
if WANT_QT5
includeprefix5 = qgpgme-qt5
qgpgme5includedir = $(includedir)/$(includeprefix5)/qgpgme
qgpgme5include_HEADERS = $(qgpgme_headers)
nodist_qgpgme5include_HEADERS = qgpgme_version.h
camelcase5includedir = $(includedir)/$(includeprefix5)/QGpgME
nodist_camelcase5include_HEADERS = $(camelcase_headers)
endif
if WANT_QT6
includeprefix6 = qgpgme-qt6
qgpgme6includedir = $(includedir)/$(includeprefix6)/qgpgme
qgpgme6include_HEADERS = $(qgpgme_headers)
nodist_qgpgme6include_HEADERS = qgpgme_version.h
camelcase6includedir = $(includedir)/$(includeprefix6)/QGpgME
nodist_camelcase6include_HEADERS = $(camelcase_headers)
endif
# generate the moc files in two steps:
# 1. generate Qt 5/6-specific moc files in builddir with extension .moc5/.moc6;
# this ensures correct dependencies on the source files
# 2. generate forwarding headers in subfolders moc5/moc6 with extension .moc;
# this ensures that the "foo.moc" includes in the source files work and
# include the correct version of the generated moc files for Qt 5/6
# GNU make's pattern rules would make this easier, but we don't want to use them
if WANT_QT5
moc5_dir = moc5
qgpgme_moc5_sources = $(qgpgme_moc_sources:%.moc=%.moc5)
qgpgme_moc5_forward_headers = $(qgpgme_moc_sources:%=$(moc5_dir)/%)
.h.moc5:
$(MOC5) `test -f '$<' || echo '$(srcdir)/'`$< -o $@
$(moc5_dir):
mkdir $(moc5_dir)
$(qgpgme_moc5_forward_headers): Makefile.am | $(moc5_dir)
echo "#include \"../$(notdir $@)5\"" > "$@"
endif
if WANT_QT6
moc6_dir = moc6
qgpgme_moc6_sources = $(qgpgme_moc_sources:%.moc=%.moc6)
qgpgme_moc6_forward_headers = $(qgpgme_moc_sources:%=$(moc6_dir)/%)
.h.moc6:
$(MOC6) `test -f '$<' || echo '$(srcdir)/'`$< -o $@
$(moc6_dir):
mkdir $(moc6_dir)
$(qgpgme_moc6_forward_headers): Makefile.am | $(moc6_dir)
echo "#include \"../$(notdir $@)6\"" > "$@"
endif
if WANT_QT5
AM_CPPFLAGS = -I$(top_srcdir)/lang/cpp/src -I$(top_builddir)/src \
libqgpgme_la_CPPFLAGS = -I./moc5 -I$(top_builddir)/lang/cpp/src -I$(top_builddir)/src \
@GPGME_QT5_CFLAGS@ @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \
-DBUILDING_QGPGME -Wsuggest-override \
-Wzero-as-null-pointer-constant
libqgpgme_la_SOURCES = $(qgpgme_sources) $(qgpgme_headers) $(private_qgpgme_headers)
nodist_libqgpgme_la_SOURCES = $(qgpgme_moc5_sources) $(qgpgme_moc5_forward_headers)
libqgpgme_la_LIBADD = ../../cpp/src/libgpgmepp.la ../../../src/libgpgme.la \
@LIBASSUAN_LIBS@ @GPG_ERROR_LIBS@ @GPGME_QT5_LIBS@
libqgpgme_la_LDFLAGS = -no-undefined -version-info \
@LIBQGPGME_LT_CURRENT@:@LIBQGPGME_LT_REVISION@:@LIBQGPGME_LT_AGE@
endif
if WANT_QT6
AM_CPPFLAGS = -I$(top_srcdir)/lang/cpp/src -I$(top_builddir)/src \
libqgpgmeqt6_la_CPPFLAGS = -I./moc6 -I$(top_builddir)/lang/cpp/src -I$(top_builddir)/src \
@GPGME_QT6_CFLAGS@ @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \
-DBUILDING_QGPGME -Wsuggest-override \
-Wzero-as-null-pointer-constant
libqgpgmeqt6_la_SOURCES = $(qgpgme_sources) $(qgpgme_headers) $(private_qgpgme_headers)
nodist_libqgpgmeqt6_la_SOURCES = $(qgpgme_moc6_sources) $(qgpgme_moc6_forward_headers)
libqgpgmeqt6_la_LIBADD = ../../cpp/src/libgpgmepp.la ../../../src/libgpgme.la \
@LIBASSUAN_LIBS@ @GPG_ERROR_LIBS@ @GPGME_QT6_LIBS@
libqgpgmeqt6_la_LDFLAGS = -no-undefined -version-info \
@ -363,12 +415,12 @@ if HAVE_W32_SYSTEM
QGpgmeConfig.cmake: QGpgmeConfig-w32.cmake.in
sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \
sed -e 's|[@]resolved_libdir@|$(libdir)|g' | \
sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
sed -e 's|[@]resolved_includedir@|$(includedir)/$(includeprefix5)|g' > $@
else
QGpgmeConfig.cmake: QGpgmeConfig.cmake.in
sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
sed -e 's|[@]resolved_includedir@|$(includedir)/$(includeprefix5)|g' > $@
endif
endif
if WANT_QT6
@ -376,12 +428,12 @@ if HAVE_W32_SYSTEM
QGpgmeQt6Config.cmake: QGpgmeQt6Config-w32.cmake.in
sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \
sed -e 's|[@]resolved_libdir@|$(libdir)|g' | \
sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
sed -e 's|[@]resolved_includedir@|$(includedir)/$(includeprefix6)|g' > $@
else
QGpgmeQt6Config.cmake: QGpgmeQt6Config.cmake.in
sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
sed -e 's|[@]resolved_includedir@|$(includedir)/$(includeprefix6)|g' > $@
endif
endif
@ -391,50 +443,65 @@ $(camelcase_headers): Makefile.am
echo ".h\"" >> "$@"
if WANT_QT5
install-cmake-files: QGpgmeConfig.cmake QGpgmeConfigVersion.cmake
install-cmake-files-qt5: QGpgmeConfig.cmake QGpgmeConfigVersion.cmake
-$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/QGpgme
$(INSTALL) -m 644 QGpgmeConfig.cmake \
$(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake
$(INSTALL) -m 644 QGpgmeConfigVersion.cmake \
$(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake
install_cmake_files_qt5 = install-cmake-files-qt5
uninstall-cmake-files:
uninstall-cmake-files-qt5:
-rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake
-rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake
-rmdir $(DESTDIR)$(libdir)/cmake/QGpgme/
uninstall_cmake_files_qt5 = uninstall-cmake-files-qt5
uninstall-include-dirs-qt5:
-rmdir $(DESTDIR)$(qgpgme5includedir)
-rmdir $(DESTDIR)$(camelcase5includedir)
-rmdir $(DESTDIR)$(includedir)/$(includeprefix5)
uninstall_include_dirs_qt5 = uninstall-include-dirs-qt5
endif
if WANT_QT6
install-cmake-files: QGpgmeQt6Config.cmake QGpgmeQt6ConfigVersion.cmake
install-cmake-files-qt6: QGpgmeQt6Config.cmake QGpgmeQt6ConfigVersion.cmake
-$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/QGpgmeQt6
$(INSTALL) -m 644 QGpgmeQt6Config.cmake \
$(DESTDIR)$(libdir)/cmake/QGpgmeQt6/QGpgmeQt6Config.cmake
$(INSTALL) -m 644 QGpgmeQt6ConfigVersion.cmake \
$(DESTDIR)$(libdir)/cmake/QGpgmeQt6/QGpgmeQt6ConfigVersion.cmake
install_cmake_files_qt6 = install-cmake-files-qt6
uninstall-cmake-files:
uninstall-cmake-files-qt6:
-rm $(DESTDIR)$(libdir)/cmake/QGpgmeQt6/QGpgmeQt6ConfigVersion.cmake
-rm $(DESTDIR)$(libdir)/cmake/QGpgmeQt6/QGpgmeQt6Config.cmake
-rmdir $(DESTDIR)$(libdir)/cmake/QGpgmeQt6/
uninstall_cmake_files_qt6 = uninstall-cmake-files-qt6
uninstall-include-dirs-qt6:
-rmdir $(DESTDIR)$(qgpgme6includedir)
-rmdir $(DESTDIR)$(camelcase6includedir)
-rmdir $(DESTDIR)$(includedir)/$(includeprefix6)
uninstall_include_dirs_qt6 = uninstall-include-dirs-qt6
endif
install-data-local: install-cmake-files
install-data-local: $(install_cmake_files_qt5) $(install_cmake_files_qt6)
uninstall-local: uninstall-cmake-files
uninstall-hook: $(uninstall_cmake_files_qt5) $(uninstall_cmake_files_qt6) \
$(uninstall_include_dirs_qt5) $(uninstall_include_dirs_qt6)
BUILT_SOURCES = $(qgpgme_moc_sources) $(camelcase_headers)
BUILT_SOURCES = $(qgpgme_moc5_sources) $(qgpgme_moc5_forward_headers) \
$(qgpgme_moc6_sources) $(qgpgme_moc6_forward_headers) \
$(camelcase_headers)
CLEANFILES = $(qgpgme_moc_sources) $(camelcase_headers) QGpgmeConfig.cmake \
CLEANFILES = $(qgpgme_moc5_sources) $(qgpgme_moc5_forward_headers) \
$(qgpgme_moc6_sources) $(qgpgme_moc6_forward_headers) \
$(camelcase_headers) QGpgmeConfig.cmake \
qgpgme_version.h QGpgmeConfig.cmake.in \
QGpgmeConfig-w32.cmake.in QGpgmeConfigVersion.cmake \
QGpgmeQt6Config.cmake.in QGpgmeQt6Config-w32.cmake.in \
QGpgmeQt6Config.cmake QGpgmeQt6ConfigVersion.cmake
if WANT_QT5
nodist_libqgpgme_la_SOURCES = $(qgpgme_moc_sources)
endif
if WANT_QT6
nodist_libqgpgmeqt6_la_SOURCES = $(qgpgme_moc_sources)
endif
.h.moc:
$(MOC) `test -f '$<' || echo '$(srcdir)/'`$< -o $@
clean-local:
-test -z "$(moc5_dir)" || rm -rf $(moc5_dir)
-test -z "$(moc6_dir)" || rm -rf $(moc6_dir)

View File

@ -1,17 +1,17 @@
# CMake Config file for QGPGME.
# Copyright (C) 2016 Intevation GmbH
#
# This file is part of GPGME.
# This file is part of QGpgME.
#
# GPGME-CL is free software; you can redistribute it and/or modify it
# 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.
#
# GPGME-CL is distributed in the hope that it will be useful,
# 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 Lesser General Public License for more details.
# 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

View File

@ -1,17 +1,17 @@
# CMake Config file for QGPGME.
# Copyright (C) 2016 Intevation GmbH
#
# This file is part of GPGME.
# This file is part of QGpgME.
#
# GPGME-CL is free software; you can redistribute it and/or modify it
# 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.
#
# GPGME-CL is distributed in the hope that it will be useful,
# 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 Lesser General Public License for more details.
# 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

View File

@ -1,17 +1,17 @@
# CMake Version file for QGPGME.
# Copyright (C) 2016 Intevation GmbH
#
# This file is part of GPGME.
# This file is part of QGpgME.
#
# GPGME-CL is free software; you can redistribute it and/or modify it
# 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.
#
# GPGME-CL is distributed in the hope that it will be useful,
# 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 Lesser General Public License for more details.
# 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

View File

@ -1,7 +1,7 @@
# CMake Config file for QGpgME for Qt 6
# Copyright (C) 2016 Intevation GmbH
#
# This file is part of GPGME.
# This file is part of QGpgME.
#
# QGpgME is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -11,7 +11,7 @@
# 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 Lesser General Public License for more details.
# 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

View File

@ -1,7 +1,7 @@
# CMake Config file for QGpgME for Qt 6
# Copyright (C) 2016 Intevation GmbH
#
# This file is part of GPGME.
# This file is part of QGpgME.
#
# QGpgME is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -11,7 +11,7 @@
# 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 Lesser General Public License for more details.
# 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

View File

@ -1,7 +1,7 @@
# CMake Version file for QGpgME for Qt 6
# Copyright (C) 2016 Intevation GmbH
#
# This file is part of GPGME.
# This file is part of QGpgME.
#
# QGpgME is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -11,7 +11,7 @@
# 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 Lesser General Public License for more details.
# 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

View File

@ -38,7 +38,7 @@
#include "changeexpiryjob.h"
#include "changeexpiryjob_p.h"
#include <context.h>
#include <gpgme++/context.h>
using namespace GpgME;
using namespace QGpgME;

View File

@ -37,11 +37,7 @@
#include "job.h"
#ifdef BUILDING_QGPGME
# include "key.h"
#else
# include <gpgme++/key.h>
#endif
#include <gpgme++/key.h>
#include <vector>

View File

@ -37,11 +37,7 @@
#include "job.h"
#ifdef BUILDING_QGPGME
# include "key.h"
#else
# include <gpgme++/key.h>
#endif
#include <gpgme++/key.h>
namespace QGpgME
{

View File

@ -1,24 +1,24 @@
/* dataprovider.cpp
Copyright (C) 2004 Klarävdalens Datakonsult AB
This file is part of qgpgme, the Qt API binding for gpgme
Copyright (C) 2004 Klarävdalens Datakonsult AB
Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of QGPGME.
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 free software; you can redistribute it and/or modify it
under the terms of the GNU Library 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.
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 Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with QGPGME; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
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
*/
// -*- c++ -*-
@ -28,7 +28,7 @@
#include <dataprovider.h>
#include <error.h>
#include <gpgme++/error.h>
#include <QIODevice>
#include <QProcess>

View File

@ -1,24 +1,24 @@
/* dataprovider.h
Copyright (C) 2004 Klarälvdalens Datakonsult AB
This file is part of qgpgme, the Qt API binding for gpgme
Copyright (C) 2004 Klarälvdalens Datakonsult AB
Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of QGPGME.
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 free software; you can redistribute it and/or modify it
under the terms of the GNU Library 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.
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 Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with QGPGME; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
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
*/
// -*- c++ -*-
#ifndef __QGPGME_DATAPROVIDER_H__
@ -26,11 +26,7 @@
#include "qgpgme_export.h"
#ifdef BUILDING_QGPGME
#include <interfaces/dataprovider.h>
#else
#include <gpgme++/interfaces/dataprovider.h>
#endif
#include <memory>

View File

@ -35,7 +35,7 @@
#include "config.h"
#endif
#include "error.h"
#include <gpgme++/error.h>
#include "debug.h"
#include <QDebug>
@ -44,9 +44,9 @@ QDebug operator<<(QDebug debug, const GpgME::Error &err)
{
#ifdef Q_OS_WIN
// On Windows, we tell libgpg-error to return (translated) error messages as UTF-8
const auto errAsString = QString::fromUtf8(err.asString());
const auto errAsString = QString::fromStdString(err.asStdString());
#else
const auto errAsString = QString::fromLocal8Bit(err.asString());
const auto errAsString = QString::fromLocal8Bit(err.asStdString().c_str());
#endif
const bool oldSetting = debug.autoInsertSpaces();
debug.nospace() << errAsString << " (code: " << err.code() << ", source: " << err.source() << ")";

View File

@ -38,7 +38,7 @@
#include "decryptverifyarchivejob.h"
#include "decryptverifyarchivejob_p.h"
#include <engineinfo.h>
#include <gpgme++/engineinfo.h>
using namespace QGpgME;

View File

@ -36,11 +36,7 @@
#include "job.h"
#ifdef BUILDING_QGPGME
# include "context.h"
#else
# include <gpgme++/context.h>
#endif
#include <gpgme++/context.h>
namespace GpgME
{

View File

@ -38,7 +38,7 @@
#include "encryptarchivejob.h"
#include "encryptarchivejob_p.h"
#include <engineinfo.h>
#include <gpgme++/engineinfo.h>
using namespace QGpgME;

View File

@ -36,11 +36,7 @@
#include "job.h"
#ifdef BUILDING_QGPGME
# include "context.h"
#else
# include <gpgme++/context.h>
#endif
#include <gpgme++/context.h>
namespace GpgME
{

View File

@ -38,16 +38,12 @@
#define __KLEO_ENCRYPTJOB_H__
#include "job.h"
#include "data.h"
#include <gpgme++/data.h>
#include <memory>
#include <vector>
#ifdef BUILDING_QGPGME
# include "context.h"
#else
# include <gpgme++/context.h>
#endif
#include <gpgme++/context.h>
class QByteArray;
class QIODevice;

View File

@ -36,8 +36,8 @@
#include "job_p.h"
#include <data.h>
#include <key.h>
#include <gpgme++/data.h>
#include <gpgme++/key.h>
namespace QGpgME
{

View File

@ -41,7 +41,7 @@
#include <QString>
#include <error.h>
#include <gpgme++/error.h>
#include <numeric>

View File

@ -36,11 +36,7 @@
#include "qgpgme_export.h"
#ifdef BUILDING_QGPGME
#include <interfaces/dataprovider.h>
#else
#include <gpgme++/interfaces/dataprovider.h>
#endif
#include <memory>
#include <vector>

View File

@ -39,11 +39,7 @@
#include "keylistjob.h"
#include "cryptobackend.h"
#ifdef BUILDING_QGPGME
# include "keylistresult.h"
#else
#include <gpgme++/keylistresult.h>
#endif
#include <QPointer>

View File

@ -38,7 +38,7 @@
#include "importjob.h"
#include "importjob_p.h"
#include <context.h>
#include <gpgme++/context.h>
using namespace GpgME;
using namespace QGpgME;
@ -55,6 +55,18 @@ QString QGpgME::ImportJob::importFilter() const
return d->m_importFilter;
}
void QGpgME::ImportJob::setImportOptions(const QStringList &options)
{
const auto d = jobPrivate<ImportJobPrivate>(this);
d->m_importOptions = options;
}
QStringList QGpgME::ImportJob::importOptions() const
{
const auto d = jobPrivate<ImportJobPrivate>(this);
return d->m_importOptions;
}
void ImportJob::setKeyOrigin(GpgME::Key::Origin origin, const QString &url)
{
const auto d = jobPrivate<ImportJobPrivate>(this);

View File

@ -40,11 +40,7 @@
#include "abstractimportjob.h"
#include "qgpgme_export.h"
#ifdef BUILDING_QGPGME
# include <key.h>
#else
# include <gpgme++/key.h>
#endif
#include <gpgme++/key.h>
namespace GpgME
{
@ -79,6 +75,9 @@ public:
void setImportFilter(const QString &filter);
QString importFilter() const;
void setImportOptions(const QStringList &options);
QStringList importOptions() const;
void setKeyOrigin(GpgME::Key::Origin origin, const QString &url = {});
GpgME::Key::Origin keyOrigin() const;
QString keyOriginUrl() const;

View File

@ -36,7 +36,7 @@
#include "job_p.h"
#include <key.h>
#include <gpgme++/key.h>
namespace QGpgME
{
@ -44,6 +44,7 @@ namespace QGpgME
struct ImportJobPrivate : public JobPrivate
{
QString m_importFilter;
QStringList m_importOptions;
GpgME::Key::Origin m_keyOrigin = GpgME::Key::OriginUnknown;
QString m_keyOriginUrl;
};

View File

@ -41,11 +41,7 @@
#include <QString>
#include <QMap>
#ifdef BUILDING_QGPGME
# include "error.h"
#else
# include <gpgme++/error.h>
#endif
#include <gpgme++/error.h>
class QWidget;

View File

@ -37,11 +37,7 @@
#include "job.h"
#ifdef BUILDING_QGPGME
# include "key.h"
#else
# include <gpgme++/key.h>
#endif
#include <gpgme++/key.h>
namespace GpgME
{

View File

@ -38,11 +38,7 @@
#include "job.h"
#include "qgpgme_export.h"
#ifdef BUILDING_QGPGME
# include "key.h"
#else
# include <gpgme++/key.h>
#endif
#include <gpgme++/key.h>
#include <QtCore/QStringList>

View File

@ -40,11 +40,7 @@
#include "job.h"
#include "qgpgme_export.h"
#ifdef BUILDING_QGPGME
# include "key.h"
#else
# include <gpgme++/key.h>
#endif
#include <gpgme++/key.h>
#include <vector>

View File

@ -38,9 +38,9 @@
#include "protocol.h"
#include "deletejob.h"
#include <key.h>
#include <context.h>
#include <data.h>
#include <gpgme++/key.h>
#include <gpgme++/context.h>
#include <gpgme++/data.h>
#include <iterator>

View File

@ -41,10 +41,10 @@
#include <QDateTime>
#include "context.h"
#include "data.h"
#include "gpgaddexistingsubkeyeditinteractor.h"
#include "key.h"
#include <gpgme++/context.h>
#include <gpgme++/data.h>
#include <gpgme++/gpgaddexistingsubkeyeditinteractor.h>
#include <gpgme++/key.h>
#include <gpg-error.h>

View File

@ -40,10 +40,10 @@
#include "dataprovider.h"
#include "context.h"
#include "data.h"
#include "gpgadduserideditinteractor.h"
#include "key.h"
#include <gpgme++/context.h>
#include <gpgme++/data.h>
#include <gpgme++/gpgadduserideditinteractor.h>
#include <gpgme++/key.h>
#include <cassert>
#include <memory>

View File

@ -40,8 +40,8 @@
#include "qgpgmegpgcardjob.h"
#include "error.h"
#include "engineinfo.h"
#include <gpgme++/error.h>
#include <gpgme++/engineinfo.h>
#include "protocol_p.h"

View File

@ -42,8 +42,8 @@
#include "changeexpiryjob_p.h"
#include "context.h"
#include "key.h"
#include <gpgme++/context.h>
#include <gpgme++/key.h>
#include <QDateTime>

View File

@ -40,10 +40,10 @@
#include "dataprovider.h"
#include "context.h"
#include "data.h"
#include "gpgsetownertrusteditinteractor.h"
#include "key.h"
#include <gpgme++/context.h>
#include <gpgme++/data.h>
#include <gpgme++/gpgsetownertrusteditinteractor.h>
#include <gpgme++/key.h>
#include <cassert>
#include <memory>

View File

@ -40,9 +40,9 @@
#include "dataprovider.h"
#include "context.h"
#include "data.h"
#include "key.h"
#include <gpgme++/context.h>
#include <gpgme++/data.h>
#include <gpgme++/key.h>
#include <cassert>
#include <memory>

View File

@ -40,9 +40,9 @@
#include "dataprovider.h"
#include "context.h"
#include "decryptionresult.h"
#include "data.h"
#include <gpgme++/context.h>
#include <gpgme++/decryptionresult.h>
#include <gpgme++/data.h>
#include <QBuffer>

View File

@ -39,11 +39,7 @@
#include "threadedjobmixin.h"
#ifdef BUILDING_QGPGME
# include "decryptionresult.h"
#else
#include <gpgme++/decryptionresult.h>
#endif
namespace QGpgME
{

View File

@ -45,7 +45,7 @@
#include <QFile>
#include <data.h>
#include <gpgme++/data.h>
using namespace QGpgME;
using namespace GpgME;

View File

@ -38,8 +38,8 @@
#include "threadedjobmixin.h"
#include <decryptionresult.h>
#include <verificationresult.h>
#include <gpgme++/decryptionresult.h>
#include <gpgme++/verificationresult.h>
namespace QGpgME
{

View File

@ -39,13 +39,14 @@
#include "qgpgmedecryptverifyjob.h"
#include "dataprovider.h"
#include "debug.h"
#include "decryptverifyjob_p.h"
#include "util.h"
#include <context.h>
#include <decryptionresult.h>
#include <verificationresult.h>
#include <data.h>
#include <gpgme++/context.h>
#include <gpgme++/decryptionresult.h>
#include <gpgme++/verificationresult.h>
#include <gpgme++/data.h>
#include <QDebug>
#include "qgpgme_debug.h"
@ -118,7 +119,7 @@ static QGpgMEDecryptVerifyJob::result_type decrypt_verify(Context *ctx, QThread
const std::pair<DecryptionResult, VerificationResult> res = ctx->decryptAndVerify(indata, outdata);
Error ae;
const QString log = _detail::audit_log_as_html(ctx, ae);
qCDebug(QGPGME_LOG) << __func__ << "- End no plainText. Error:" << ae.asString();
qCDebug(QGPGME_LOG) << __func__ << "- End no plainText. Error:" << ae;
return std::make_tuple(res.first, res.second, out.data(), log, ae);
} else {
QGpgME::QIODeviceDataProvider out(plainText);
@ -127,7 +128,7 @@ static QGpgMEDecryptVerifyJob::result_type decrypt_verify(Context *ctx, QThread
const std::pair<DecryptionResult, VerificationResult> res = ctx->decryptAndVerify(indata, outdata);
Error ae;
const QString log = _detail::audit_log_as_html(ctx, ae);
qCDebug(QGPGME_LOG) << __func__ << "- End plainText. Error:" << ae.asString();
qCDebug(QGPGME_LOG) << __func__ << "- End plainText. Error:" << ae;
return std::make_tuple(res.first, res.second, QByteArray(), log, ae);
}
}

View File

@ -39,16 +39,8 @@
#include "threadedjobmixin.h"
#ifdef BUILDING_QGPGME
# include "decryptionresult.h"
#else
#include <gpgme++/decryptionresult.h>
#endif
#ifdef BUILDING_QGPGME
# include "verificationresult.h"
#else
#include <gpgme++/verificationresult.h>
#endif
namespace QGpgME
{

View File

@ -38,8 +38,8 @@
#include "qgpgmedeletejob.h"
#include "context.h"
#include "key.h"
#include <gpgme++/context.h>
#include <gpgme++/key.h>
#include <cassert>

View File

@ -40,8 +40,8 @@
#include "dataprovider.h"
#include "context.h"
#include "data.h"
#include <gpgme++/context.h>
#include <gpgme++/data.h>
#include <QStringList>

View File

@ -48,7 +48,7 @@
#include <QFile>
#include <data.h>
#include <gpgme++/data.h>
using namespace QGpgME;
using namespace GpgME;

View File

@ -38,7 +38,7 @@
#include "threadedjobmixin.h"
#include <encryptionresult.h>
#include <gpgme++/encryptionresult.h>
namespace QGpgME
{

View File

@ -44,9 +44,9 @@
#include "encryptjob_p.h"
#include "util.h"
#include <context.h>
#include <data.h>
#include <encryptionresult.h>
#include <gpgme++/context.h>
#include <gpgme++/data.h>
#include <gpgme++/encryptionresult.h>
#include <QBuffer>
#include <QFileInfo>

View File

@ -39,16 +39,8 @@
#include "threadedjobmixin.h"
#ifdef BUILDING_QGPGME
# include "encryptionresult.h"
#else
#include <gpgme++/encryptionresult.h>
#endif
#ifdef BUILDING_QGPGME
# include "key.h"
#else
#include <gpgme++/key.h>
#endif
namespace QGpgME
{

View File

@ -42,9 +42,9 @@
#include "dataprovider.h"
#include "context.h"
#include "data.h"
#include "key.h"
#include <gpgme++/context.h>
#include <gpgme++/data.h>
#include <gpgme++/key.h>
#include <QStringList>

View File

@ -40,9 +40,9 @@
#include "dataprovider.h"
#include "context.h"
#include "data.h"
#include "key.h"
#include <gpgme++/context.h>
#include <gpgme++/data.h>
#include <gpgme++/key.h>
#include <cassert>

View File

@ -39,11 +39,7 @@
#include "threadedjobmixin.h"
#ifdef BUILDING_QGPGME
# include "importresult.h"
#else
#include <gpgme++/importresult.h>
#endif
namespace QGpgME
{

View File

@ -44,9 +44,9 @@
#include "dataprovider.h"
#include <context.h>
#include <data.h>
#include <key.h>
#include <gpgme++/context.h>
#include <gpgme++/data.h>
#include <gpgme++/key.h>
using namespace QGpgME;
using namespace GpgME;
@ -106,11 +106,15 @@ static const char *originToString(Key::Origin origin)
}
static QGpgMEImportJob::result_type import_qba(Context *ctx, const QByteArray &certData, const QString &importFilter,
Key::Origin keyOrigin, const QString &keyOriginUrl)
const QStringList &importOptions, Key::Origin keyOrigin,
const QString &keyOriginUrl)
{
if (!importFilter.isEmpty()) {
ctx->setFlag("import-filter", importFilter.toStdString().c_str());
}
if (!importOptions.empty()) {
ctx->setFlag("import-options", importOptions.join(QLatin1Char{','}).toStdString().c_str());
}
if (keyOrigin != Key::OriginUnknown) {
if (const auto origin = originToString(keyOrigin)) {
std::string value{origin};
@ -149,19 +153,19 @@ static QGpgMEImportJob::result_type import_qba(Context *ctx, const QByteArray &c
Error QGpgMEImportJob::start(const QByteArray &certData)
{
run(std::bind(&import_qba, std::placeholders::_1, certData, importFilter(), keyOrigin(), keyOriginUrl()));
run(std::bind(&import_qba, std::placeholders::_1, certData, importFilter(), importOptions(), keyOrigin(), keyOriginUrl()));
return Error();
}
GpgME::ImportResult QGpgME::QGpgMEImportJob::exec(const QByteArray &keyData)
{
const result_type r = import_qba(context(), keyData, importFilter(), keyOrigin(), keyOriginUrl());
const result_type r = import_qba(context(), keyData, importFilter(), importOptions(), keyOrigin(), keyOriginUrl());
return std::get<0>(r);
}
Error QGpgMEImportJob::startLater(const QByteArray &certData)
{
setWorkerFunction(std::bind(&import_qba, std::placeholders::_1, certData, importFilter(), keyOrigin(), keyOriginUrl()));
setWorkerFunction(std::bind(&import_qba, std::placeholders::_1, certData, importFilter(), importOptions(), keyOrigin(), keyOriginUrl()));
return {};
}

View File

@ -41,11 +41,7 @@
#include "threadedjobmixin.h"
#ifdef BUILDING_QGPGME
# include "importresult.h"
#else
#include <gpgme++/importresult.h>
#endif
namespace QGpgME
{

View File

@ -39,13 +39,8 @@
#include "threadedjobmixin.h"
#ifdef BUILDING_QGPGME
# include "keylistresult.h"
# include "key.h"
#else
# include <gpgme++/keylistresult.h>
# include <gpgme++/key.h>
#endif
#include <gpgme++/keylistresult.h>
#include <gpgme++/key.h>
namespace QGpgME
{

View File

@ -40,8 +40,8 @@
#include "dataprovider.h"
#include "context.h"
#include "data.h"
#include <gpgme++/context.h>
#include <gpgme++/data.h>
#include <cassert>

View File

@ -39,11 +39,7 @@
#include "threadedjobmixin.h"
#ifdef BUILDING_QGPGME
# include "keygenerationresult.h"
#else
#include <gpgme++/keygenerationresult.h>
#endif
namespace QGpgME
{

View File

@ -38,9 +38,9 @@
#include "qgpgmekeylistjob.h"
#include "key.h"
#include "context.h"
#include "keylistresult.h"
#include <gpgme++/key.h>
#include <gpgme++/context.h>
#include <gpgme++/keylistresult.h>
#include <gpg-error.h>
#include <QStringList>

View File

@ -39,16 +39,8 @@
#include "threadedjobmixin.h"
#ifdef BUILDING_QGPGME
# include "keylistresult.h"
#else
#include <gpgme++/keylistresult.h>
#endif
#ifdef BUILDING_QGPGME
# include "key.h"
#else
#include <gpgme++/key.h>
#endif
namespace QGpgME
{

View File

@ -43,11 +43,11 @@
#include "listallkeysjob_p.h"
#include "debug.h"
#include "key.h"
#include "context.h"
#include "engineinfo.h"
#include "global.h"
#include "keylistresult.h"
#include <gpgme++/key.h>
#include <gpgme++/context.h>
#include <gpgme++/engineinfo.h>
#include <gpgme++/global.h>
#include <gpgme++/keylistresult.h>
#include "qgpgme_debug.h"
#include <gpg-error.h>

View File

@ -39,16 +39,8 @@
#include "threadedjobmixin.h"
#ifdef BUILDING_QGPGME
# include "keylistresult.h"
#else
#include <gpgme++/keylistresult.h>
#endif
#ifdef BUILDING_QGPGME
# include "key.h"
#else
#include <gpgme++/key.h>
#endif
namespace QGpgME
{

View File

@ -45,8 +45,8 @@
#include <QDir>
#include <QList>
#include "global.h"
#include "error.h"
#include <gpgme++/global.h>
#include <gpgme++/error.h>
#include "debug.h"
#include <sstream>
@ -211,7 +211,7 @@ void QGpgMENewCryptoConfigComponent::sync(bool runtime)
if (const Error err = m_component.save()) {
qCWarning(QGPGME_LOG) << ":"
<< "Error from gpgconf while saving configuration: %1"
<< QString::fromLocal8Bit(err.asString());
<< err;
}
}

View File

@ -42,12 +42,7 @@
#include <QStringList>
#include <QVariant>
#ifdef BUILDING_QGPGME
# include "configuration.h"
#else
# include <gpgme++/configuration.h>
#endif
#include <gpgme++/configuration.h>
#include <vector>
#include <utility>

View File

@ -37,8 +37,9 @@
#include "qgpgmequickjob.h"
#include "context.h"
#include "key.h"
#include <gpgme++/context.h>
#include <gpgme++/key.h>
#include "util.h"
using namespace QGpgME;
@ -109,6 +110,12 @@ static QGpgMEQuickJob::result_type revokeSignatureWorker(Context *ctx,
return std::make_tuple(err, QString(), Error());
}
static QGpgMEQuickJob::result_type addAdskWorker(Context *ctx, const Key &key, const char *adsk)
{
const auto err = ctx->addAdsk(key, adsk);
return std::make_tuple(err, QString(), Error());
}
void QGpgMEQuickJob::startCreate(const QString &uid,
const char *algo,
const QDateTime &expires,
@ -142,4 +149,9 @@ void QGpgMEQuickJob::startRevokeSignature(const Key &key, const Key &signingKey,
run(std::bind(&revokeSignatureWorker, std::placeholders::_1, key, signingKey, userIds));
}
void QGpgMEQuickJob::startAddAdsk(const GpgME::Key &key, const char *adsk)
{
run(std::bind(&addAdskWorker, std::placeholders::_1, key, adsk));
}
#include "qgpgmequickjob.moc"

View File

@ -71,6 +71,7 @@ public:
unsigned int flags = 0) override;
void startRevokeSignature(const GpgME::Key &key, const GpgME::Key &signingKey,
const std::vector<GpgME::UserID> &userIds = std::vector<GpgME::UserID>()) override;
void startAddAdsk(const GpgME::Key &key, const char *adsk) override;
};
}

View File

@ -38,11 +38,7 @@
#include "threadedjobmixin.h"
#ifdef BUILDING_QGPGME
# include "importresult.h"
#else
# include <gpgme++/importresult.h>
#endif
#include <gpgme++/importresult.h>
namespace QGpgME
{

View File

@ -44,8 +44,8 @@
#include <QDebug>
#include "qgpgme_debug.h"
#include "context.h"
#include <key.h>
#include <gpgme++/context.h>
#include <gpgme++/key.h>
#include <QByteArray>
#include <QMetaObject>

Some files were not shown because too many files have changed in this diff Show More