Commit Graph

1197 Commits

Author SHA1 Message Date
Ingo Klöcker
8d672b3b7e
qt: Add job for creating signed archives
* lang/qt/src/signarchivejob.cpp, lang/qt/src/signarchivejob.h,
lang/qt/src/signarchivejob_p.h,
lang/qt/src/qgpgmesignarchivejob.cpp,
lang/qt/src/qgpgmesignarchivejob.h: New.
* lang/qt/src/protocol.h (class Protocol): Add pure virtual member
function signArchiveJob
* lang/qt/src/protocol_p.h (Protocol::signArchiveJob): ... and
implement it.
* lang/qt/src/Makefile.am: Update accordingly.

* lang/qt/tests/run-signarchivejob.cpp: New.
* lang/qt/tests/Makefile.am: Add new test runner.
--

GnuPG-bug-id: 6342
2023-01-30 12:56:54 +01:00
Ingo Klöcker
2faa031af2
cpp: Support new archive signing flag
* lang/cpp/src/global.h (enum SignatureMode): Add constant SignArchive.
* lang/cpp/src/context.cpp (sigmode2sigmode): Rename to
sigflags2sigflags
(sigflags2sigflags): ... and rename argument mode to flags and treat
it as flags. Adjust the callers.
(operator<<): Change local CHECK macro to handle flags. Add new flag
to debug stream.
* lang/cpp/src/signingresult.cpp (CreatedSignature::mode): Handle
new flags (even if it cannot occur currently).
--

GnuPG-bug-id: 6342
2023-01-30 12:49:12 +01:00
Ingo Klöcker
7afd135cce
qt: Add job for creating encrypted archives
* lang/qt/src/encryptarchivejob.cpp, lang/qt/src/encryptarchivejob.h,
lang/qt/src/encryptarchivejob_p.h,
lang/qt/src/qgpgmeencryptarchivejob.cpp,
lang/qt/src/qgpgmeencryptarchivejob.h: New.
* lang/qt/src/protocol.h (class Protocol): Add pure virtual member
function encryptArchiveJob
* lang/qt/src/protocol_p.h (Protocol::encryptArchiveJob): ... and
implement it.
* lang/qt/src/Makefile.am: Update accordingly.

* lang/qt/tests/run-encryptarchivejob.cpp: New.
* lang/qt/tests/Makefile.am: Add new test runner.
--

GnuPG-bug-id: 6342
2023-01-27 12:20:53 +01:00
Ingo Klöcker
275a3a2c16
qt: Add data provider for list of file names
* lang/qt/src/Makefile.am: Add new files and corresponding camel-case
header.
* lang/qt/src/dataprovider.h: Include interface from gpgme++ when
not building.
* lang/qt/src/filelistdataprovider.cpp,
lang/qt/src/filelistdataprovider.h: New.
--

The new data provider simplifies providing a nul-separated list of
UTF-8-encoded filenames, e.g. for creating signed or encrypted
archives. It is a simple read-only proxy for QByteArrayDataProvider.

GnuPG-bug-id: 6342
2023-01-27 12:17:09 +01:00
Ingo Klöcker
d28ea8c6b3
cpp: Support new archive encryption flag
* lang/cpp/src/context.h (EncryptArchive): New flag.
* lang/cpp/src/context.cpp (encryptflags2encryptflags): Convert
EncryptArchive to corresponding gpgme encrypt flags.
(operator<<): Add new flag to debug stream.
--

GnuPG-bug-id: 6342
2023-01-27 12:16:02 +01:00
Ingo Klöcker
261245a2e0
cpp: Add convenience overload to set file name
* lang/cpp/src/data.h, lang/cpp/src/data.cpp (setFileName): Add
overload.
--

GnuPG-bug-id: 6342
2023-01-27 12:14:10 +01:00
Ingo Klöcker
3e31f648e5
cpp: Support all encryption flags
* lang/cpp/src/context.h (WantAddress): New flag.
* lang/cpp/src/context.cpp (encryptflags2encryptflags): Convert
WantAddress to corresponding gpgme encrypt flags.
(operator<<): Add new flag to debug stream.
--

GnuPG-bug-id: 6359
2023-01-26 12:01:28 +01:00
Ingo Klöcker
70aaf05a6a
cpp: Pass ThrowKeyIds and EncryptWrap flags to GpgME
* lang/cpp/src/context.cpp (encryptflags2encryptflags): Convert
ThrowKeyIds and EncryptWrap to corresponding gpgme encrypt flags.
(operator<<): Add flags to debug stream.
--

GnuPG-bug-id: 6359
2023-01-26 12:01:10 +01:00
Ingo Klöcker
1a9dfdfccb
cpp,doc: Update list of allowed values for dirInfo
--

GnuPG-bug-id: 6342
2023-01-18 10:33:54 +01:00
Ingo Klöcker
64da77620a
qt: Fix comparisons of integer expressions of different signedness
* lang/qt/tests/t-import.cpp (ImportTest::testImportWithImportFilter):
Make integer literal unsigned.
--
2023-01-05 20:33:45 +01:00
Ingo Klöcker
2e9d72a0be
cpp: Fix comparisons of integer expressions of different signedness
* lang/cpp/src/gpgrevokekeyeditinteractor.cpp
(GpgRevokeKeyEditInteractor::Private::nextState): Cast signed nextLine
value to std::size_t.
--
2023-01-05 20:29:27 +01:00
Ingo Klöcker
dc9cc9aa07
cpp: Expliticly declare compiler generated copy constructors
* lang/cpp/src/configuration.h (Component, Option),
lang/cpp/src/data.h (Data),
lang/cpp/src/decryptionresult.h (DecryptionResult,
DecryptionResult::Recipient),
lang/cpp/src/encryptionresult.h (EncryptionResult, InvalidRecipient),
lang/cpp/src/engineinfo.h (EngineInfo),
lang/cpp/src/importresult.h (ImportResult, Import),
lang/cpp/src/key.h (Key, Subkey, UserID, UserID::Signature),
lang/cpp/src/keygenerationresult.h (KeyGenerationResult),
lang/cpp/src/keylistresult.h (KeyListResult),
lang/cpp/src/notation.h (Notation),
lang/cpp/src/signingresult.h (SigningResult, InvalidSigningKey,
CreatedSignature),
lang/cpp/src/swdbresult.h (SwdbResult),
lang/cpp/src/tofuinfo.h (TofuInfo),
lang/cpp/src/verificationresult.h (VerificationResult, Signature),
lang/cpp/src/vfsmountresult.h (VfsMountResult): Explitily declare
compiler generated copy constructor.
--

This fixes "implicitly-declared copy constructor is deprecated"
warnings.
2023-01-05 20:17:57 +01:00
Ingo Klöcker
e16c368758
qt: Replace Q_DECL_OVERRIDE with override
* lang/qt/src/defaultkeygenerationjob.h,
lang/qt/src/hierarchicalkeylistjob.h, lang/qt/src/multideletejob.h,
lang/qt/src/protocol_p.h, lang/qt/src/qgpgmeadduseridjob.h,
lang/qt/src/qgpgmechangeexpiryjob.h,
lang/qt/src/qgpgmechangeownertrustjob.h,
lang/qt/src/qgpgmechangepasswdjob.h, lang/qt/src/qgpgmedecryptjob.h,
lang/qt/src/qgpgmedecryptverifyjob.h, lang/qt/src/qgpgmedeletejob.h,
lang/qt/src/qgpgmedownloadjob.h, lang/qt/src/qgpgmeencryptjob.h,
lang/qt/src/qgpgmeexportjob.h, lang/qt/src/qgpgmegpgcardjob.h,
lang/qt/src/qgpgmeimportfromkeyserverjob.h,
lang/qt/src/qgpgmeimportjob.h, lang/qt/src/qgpgmekeyformailboxjob.h,
lang/qt/src/qgpgmekeygenerationjob.h, lang/qt/src/qgpgmekeylistjob.h,
lang/qt/src/qgpgmelistallkeysjob.h, lang/qt/src/qgpgmenewcryptoconfig.h,
lang/qt/src/qgpgmequickjob.h, lang/qt/src/qgpgmerefreshsmimekeysjob.h,
lang/qt/src/qgpgmesignencryptjob.h, lang/qt/src/qgpgmesignjob.h,
lang/qt/src/qgpgmesignkeyjob.h, lang/qt/src/qgpgmetofupolicyjob.h,
lang/qt/src/qgpgmeverifydetachedjob.h,
lang/qt/src/qgpgmeverifyopaquejob.h, lang/qt/src/qgpgmewkdlookupjob.h,
lang/qt/src/qgpgmewkspublishjob.h, lang/qt/src/threadedjobmixin.h,
lang/qt/tests/t-support.h: Replace Q_DECL_OVERRIDE with override
--

We require C++11 since a long time.
2023-01-05 18:03:33 +01:00
Ingo Klöcker
398375a0ab
qt: Allow deferred start of import job
* lang/qt/src/importjob.h (ImportJob::startLater): New pure virtual
method.
* lang/qt/src/qgpgmeimportjob.cpp, lang/qt/src/qgpgmeimportjob.h
(QGpgMEImportJob::startLater): New method.

* lang/qt/tests/t-import.cpp (ImportTest::testDeferredStart): New.
--

This makes it possible to prepare an import job for a deferred start.

GnuPG-bug-id: 6323
2023-01-05 14:24:31 +01:00
Ingo Klöcker
18c2c0b250
qt: Support deferred start of jobs
* lang/qt/src/job.cpp, lang/qt/src/job.h (Job::startNow): New method.
* lang/qt/src/job_p.h (JobPrivate::start): New pure virtual method.
* lang/qt/src/qgpgmechangeexpiryjob.cpp
(QGpgMEChangeExpiryJobPrivate::start): New.
* lang/qt/src/qgpgmeencryptjob.cpp (QGpgMEEncryptJobPrivate::start):
New.
* lang/qt/src/qgpgmeimportjob.cpp (QGpgMEImportJobPrivate::start): New.
* lang/qt/src/qgpgmelistallkeysjob.cpp
(QGpgMEListAllKeysJobPrivate::start): New.
* lang/qt/src/qgpgmesignencryptjob.cpp
(QGpgMESignEncryptJobPrivate::start): New.
* lang/qt/src/threadedjobmixin.h (Thread::hasFunction): New method.
(ThreadedJobMixin::run, ThreadedJobMixin::setWorkerFunction): New
methods.
--

startNow() starts a deferred job for which the worker function has been
set before.

GnuPG-bug-id: 6323
2023-01-04 12:16:04 +01:00
Ingo Klöcker
270d752300
qt: Explicitly instantiate private job classes
* lang/qt/src/Makefile.am: Add new files.
* lang/qt/src/changeexpiryjob_p.h, lang/qt/src/encryptjob_p.h,
lang/qt/src/importjob_p.h, lang/qt/src/listallkeysjob_p.h,
lang/qt/src/signencryptjob_p.h: New.
* lang/qt/src/changeexpiryjob.cpp, lang/qt/src/encryptjob.cpp,
lang/qt/src/importjob.cpp, lang/qt/src/listallkeysjob.cpp,
lang/qt/src/signencryptjob.cpp: Move JobPrivate subclasses to the new
private header files.
* lang/qt/src/job_p.h (jobPrivate): Remove lazy instantiation of private
job classes.
* lang/qt/src/qgpgmechangeexpiryjob.cpp (class
QGpgMEChangeExpiryJobPrivate): New.
(QGpgMEChangeExpiryJob::QGpgMEChangeExpiryJob): Instantiate private job
class.
* lang/qt/src/qgpgmeencryptjob.cpp (class
QGpgMEEncryptJobPrivate): New.
(QGpgMEEncryptJob::QGpgMEEncryptJob): Instantiate private job
class.
* lang/qt/src/qgpgmeimportjob.cpp (class
QGpgMEImportJobPrivate): New.
(QGpgMEImportJob::QGpgMEImportJob): Instantiate private job
class.
* lang/qt/src/qgpgmelistallkeysjob.cpp (class
QGpgMEListAllKeysJobPrivate): New.
(QGpgMEListAllKeysJob::QGpgMEListAllKeysJob): Instantiate private job
class.
* lang/qt/src/qgpgmesignencryptjob.cpp (class
QGpgMESignEncryptJobPrivate): New.
(QGpgMESignEncryptJob::QGpgMESignEncryptJob): Instantiate private job
class.
--

We need private job classes corresponding to the concrete leaf classes.
This makes the lazy instantiation of the private classes by the job
interface classes impossible.

GnuPG-bug-id: 6323
2023-01-04 11:37:11 +01:00
NIIBE Yutaka
2ba11f9bfb
doc:python: Replace gpgme-config to pkg-config.
--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-12-14 15:12:41 +09:00
Ingo Klöcker
e7953dcf13
cpp: Handle status errors in the base edit interactor
* lang/cpp/src/editinteractor.cpp (edit_interactor_callback_impl):
Handle status errors.
* lang/cpp/src/gpgrevokekeyeditinteractor.cpp
(GpgRevokeKeyEditInteractor::Private::nextState): Remove handling of
status errors.
--

With this change status errors are handled for all interactors. In
particular, this makes all edit interactors handle canceled password
prompts correctly.

GnuPG-bug-id: 6305
2022-12-08 15:31:37 +01:00
Ingo Klöcker
c419376b85
cpp: Handle statuses that need no response in the base edit interactor
* lang/cpp/src/editinteractor.cpp (edit_interactor_callback_impl): Do
not call nextState() if status needs no response.
* lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp
(GpgAddExistingSubkeyEditInteractor::Private::nextState),
lang/cpp/src/gpgadduserideditinteractor.cpp
(GpgAddUserIDEditInteractor::nextState),
lang/cpp/src/gpggencardkeyinteractor.cpp
(GpgGenCardKeyInteractor::nextState),
lang/cpp/src/gpgrevokekeyeditinteractor.cpp
(GpgRevokeKeyEditInteractor::Private::nextState),
lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp
(GpgSetExpiryTimeEditInteractor::nextState),
lang/cpp/src/gpgsetownertrusteditinteractor.cpp
(GpgSetOwnerTrustEditInteractor::nextState),
lang/cpp/src/gpgsignkeyeditinteractor.cpp
(GpgSignKeyEditInteractor::nextState): Remove handling of statuses that
need no response.
--

This change removes superfluous code duplication.

GnuPG-bug-id: 6305
2022-12-08 15:31:21 +01:00
Ingo Klöcker
d04d7b174f
qt: Write path values with Unix directory separators
* lang/qt/src/qgpgmenewcryptoconfig.cpp
(QGpgMENewCryptoConfigEntry::setURLValue): Remove conversion to native
directory separators.
--

Even on Windows Unix directory separators work with all API calls. And
some path values also allow "URLs" like tcp://1.2.3.4:10001 which must
use '/'.

GnuPG-bug-id: 4518
2022-12-06 08:12:00 +01:00
Ingo Klöcker
b6593bda1f
qt: Allow disabling automatic trust database check on key listing
* lang/qt/src/Makefile.am (qgpgme_sources): Add listallkeysjob.cpp.
* lang/qt/src/listallkeysjob.cpp: New.
* lang/qt/src/listallkeysjob.h (enum ListAllKeysJob::Option,
typedef ListAllKeysJob::Options, ListAllKeysJob::setOptions,
ListAllKeysJob::options): New.
* lang/qt/src/qgpgmelistallkeysjob.cpp (list_keys): Set context flag
"no-auto-check-trustdb" if requested.
(QGpgMEListAllKeysJob::start, QGpgMEListAllKeysJob::exec): Add options
to call of list_keys.
--

GnuPG-bug-id: 6261
2022-11-04 10:44:07 +01:00
NIIBE Yutaka
f1802682c3
python: Fix configure generating setup.py.
* lang/python/setup.py.in: Handle the case, when substitutions
may be empty.

--

Reported-by: Andreas Metzler
Fixes-commit: ae9258fbf3
GnuPG-bug-id: 6204
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-10-26 11:02:36 +09:00
Ingo Klöcker
d9ac138595
cpp: Allow setting the curve to use when generating ECC keys
lang/cpp/src/gpggencardkeyinteractor.h (class GpgGenCardKeyInteractor):
Add enum Curve. Add member function setCurve.
lang/cpp/src/gpggencardkeyinteractor.cpp
(class GpgGenCardKeyInteractor::Private): Initialize simple members
in-class. Add member curve.
(GpgGenCardKeyInteractor::~GpgGenCardKeyInteractor): Use default d'tor.
(GpgGenCardKeyInteractor::setCurve): New.
(GpgGenCardKeyInteractor::action): Return curve defaulting to
Curve25519.
--

This enables users of this interactor to request the generation of
ECC keys with a specific curve as smart card keys. It's up to the user
to specify a curve that is actually supported by the smart card.

GnuPG-bug-id: 4429
2022-10-24 12:22:09 +02:00
Ingo Klöcker
e6a1b241b4
build,qt: Clean up all generated files
* lang/qt/src/Makefile.am (CLEANFILES): Add QGpgmeConfig-w32.cmake.in
and QGpgmeQt6Config-w32.cmake.in.
--
2022-10-11 11:00:15 +02:00
Ingo Klöcker
b2fb26baea
qt,tests: Port test to QRegularExpression.
* lang/qt/tests/t-trustsignatures.cpp: Use QRegularExpression instead of
QRegExp.
--

This allows building with Qt 6 without Core5Compat.
2022-10-11 11:00:15 +02:00
Ingo Klöcker
4938c24a46
qt: Remove obsolete code.
* lang/qt/src/qgpgmenewcryptoconfig.cpp (struct Select1St): Remove.
--

This struct was never used in this implementation of the crypto config
classes and it causes a build error with Qt 6 where QPair is an alias
for std::pair.
2022-10-11 11:00:15 +02:00
Ingo Klöcker
8d019bbb8d
build,qt: Allow building QGpgME for Qt 6
* configure.ac: Look for Qt 5 and/or Qt 6. Require C++17 if Qt 6 binding
is built. Build cmake files QGpgmeConfig* for Qt 5 and QGpgmeQt6Config*
for Qt 6.
(available_languages): Add "qt5" and "qt6".
(WANT_QT5, WANT_QT6): New conditionals.
* lang/qt/src/Makefile.am: Keep building libqgpgme for Qt 5. Build
libqgpgmeqt6 for Qt 6.
* lang/qt/tests/Makefile.am: Build tests for Qt 5 or Qt 6.
* lang/qt/src/QGpgmeQt6Config-w32.cmake.in.in,
lang/qt/src/QGpgmeQt6Config.cmake.in.in,
lang/qt/src/QGpgmeQt6ConfigVersion.cmake.in, m4/qt6.m4: New.
--

This makes it possible to build QGpgME optionally for Qt 6.4.0 or later.
By default or if the language "qt" is enabled, then QGpgME is built
either for Qt 5 (if found) or Qt 6. A build for Qt 5 or Qt 6 can be
requested by explicitly enabling the language "qt5" or "qt6". Building
QGpgME for Qt 5 and Qt 6 simultaneously is not supported.
2022-10-11 11:00:14 +02:00
Ingo Klöcker
8e908029ff
build,qt: Explicitly namespace a few Qt variables for Qt5
m4/qt.m4: Rename to
m4/qt5.m4: this.
(FIND_QT): Rename to FIND_QT5.
(GPGME_QT): Change variable prefix to GPGME_QT5.
(GPGME_QTTEST: Change variable prefix to GPGME_QT5TEST.
configure.ac, lang/qt/src/Makefile.am, lang/qt/tests/Makefile.am:
Adjust accordingly.
--

In preparation to adding support for building qgpgme for Qt6, add the
version number to a few variables to avoid confusion.
2022-10-10 14:46:39 +02:00
NIIBE Yutaka
ae9258fbf3
build:python: Don't use gpg-error-config/gpgme-config.
* lang/python/setup.py.in: Use @prefix@, @GPGME_CONFIG_LIBS@,
@GPGME_CONFIG_CFLAGS@, and @GPG_ERROR_CFLAGS@ of configure.

--

GnuPG-bug-id: 6204
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-09-15 13:46:23 +09:00
Ingo Klöcker
eedaaf7016
cpp: Reject signing expired keys
* lang/cpp/src/gpgsignkeyeditinteractor.cpp (enum SignKeyState): Add
new state REJECT_SIGN_EXPIRED.
(makeTable): Add entries for new state to transition map.
(GpgSignKeyEditInteractor::action): Handle new state.
--

With this change the edit interactor aborts the key signing operation
with a "key expired" error instead of with a "general error".

GnuPG-bug-id: 6155
2022-09-14 10:41:38 +02:00
Ingo Klöcker
83176ad7d3 qt: Fix building with C++11
* lang/qt/src/qgpgmerefreshsmimekeysjob.cpp
(QGpgMERefreshSMIMEKeysJob::start): Replace 'auto' in lambda with the
actual type.
* lang/qt/src/qgpgmesignkeyjob.cpp (class TrustSignatureProperties): Add
default c'tor and c'tor initializing all members.
* lang/qt/src/util.cpp (toFingerprints): Replace 'auto' in lambda with
the actual type.
* lang/qt/tests/run-exportjob.cpp (createExportJob): Replace 'auto'
return type with actual type.
--

This fixes compilation with strict C++11.

GnuPG-bug-id: 6141
2022-08-22 14:39:22 +02:00
Ingo Klöcker
0566180684 qt: Fix building with Qt6
* lang/qt/src/util.cpp, lang/qt/src/util.h: Replace forward declaration
with include.
--

Based on patch by Laurent Montel
2022-08-22 09:30:14 +02:00
Ingo Klöcker
f02c20cc9c cpp: Fix building with C++11
* lang/cpp/src/importresult.cpp (ImportResult::mergeWith): Replace
'auto' in lambdas with the actual type.
--

Generic lambdas require C++14.

GnuPG-bug-id: 6141
2022-08-19 11:05:37 +02:00
Ingo Klöcker
2e7a61b898 qt,tests: Make test pass on 32-bit systems
* lang/qt/tests/t-addexistingsubkey.cpp
(AddExistingSubkeyJobTest::testAddExistingSubkeyWithExpiration): Handle
negative expiration date.
--

On 32-bit systems the expiration date of the test key overflows. This
will cause the AddExistingSubkeyJob to fail. We expect it to fail with
an "invalid time" error.

GnuPG-bug-id: 6137
2022-08-18 10:55:09 +02:00
Ingo Klöcker
2fa5c80aeb cpp: Fix handling of "no key" or "invalid time" situations
* lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp
(GpgAddExistingSubkeyEditInteractor::Private::nextState): Fix inverted
logic of string comparisons.
--

This fixes the problem that the interactor didn't return the proper
error code if gpg didn't accept the key grip or the expiration date.

GnuPG-bug-id: 6137
2022-08-18 10:43:19 +02:00
Ingo Klöcker
f2b48de26b qt,tests: Make sure expiration time is interpreted as unsigned number
* lang/qt/tests/t-addexistingsubkey.cpp,
lang/qt/tests/t-changeexpiryjob.cpp: Convert expiration time to
uint_least32_t.
--

This doesn't change the outcome of the tests (they also pass without
this change because of the expiration dates of the test keys), but it's
still good practise to treat the expiration time as an unsigned number
if the assertions check that the expiration time is in some range.

GnuPG-bug-id: 6137
2022-08-17 15:22:29 +02:00
Ingo Klöcker
81d4b7f2d7 qt,tests: Log the actual error code if the assertion fails
* lang/qt/tests/t-addexistingsubkey.cpp (
AddExistingSubkeyJobTest::testAddExistingSubkeyAsync,
AddExistingSubkeyJobTest::testAddExistingSubkeySync,
AddExistingSubkeyJobTest::testAddExistingSubkeyWithExpiration): Use
QCOMPARE instead of QVERIFY for asserting equality.
--

GnuPG-bug-id: 6137
2022-08-17 14:56:13 +02:00
Ingo Klöcker
c977424a1d qt: Make sure expiration time is interpreted as unsigned number
* lang/qt/src/qgpgmeaddexistingsubkeyjob.cpp (add_subkey): Convert
expiration time to uint_least32_t.
--

This fixes the corresponding test on 32-bit systems where time_t (the
return type of expirationTime()) is a signed 32-bit integer type.

GnuPG-bug-id: 6137
2022-08-17 14:52:04 +02:00
Andre Heinecke
586846209b
Qt: Fix working with no gpgconf in CryptoConfig
* lang/qt/src/cryptoconfig.cpp (CryptoConfig::entry): Add nullptr
  checks.

--
This fixes a crash when gpgconf is not found. When every return
value is NULL.

GnuPG-Bug-Id: T6131
2022-08-11 11:39:10 +02:00
Ingo Klöcker
5d91182c95 qt: Add missing include
* lang/qt/tests/t-revokekey.cpp: Include QDebug.
--

Doesn't seem to matter with Qt 5.15.5, but seems to be needed for older
versions of Qt.
2022-08-10 12:00:10 +02:00
Ingo Klöcker
db7d79063f qt: Add job to set the primary user ID of OpenPGP keys
* lang/qt/src/qgpgmesetprimaryuseridjob.cpp,
lang/qt/src/qgpgmesetprimaryuseridjob.h,
lang/qt/src/setprimaryuseridjob.h: New.
* lang/qt/src/protocol.h (class Protocol): Add pure virtual member
function setPrimaryUserIDJob.
* lang/qt/src/protocol_p.h (Protocol::setPrimaryUserIDJob): New.
* lang/qt/src/job.cpp, lang/qt/src/Makefile.am: Update accordingly.

* lang/qt/tests/t-setprimaryuserid.cpp: New.
* lang/qt/tests/Makefile.am: Add new test.
--

GnuPG-bug-id: 5938
2022-08-09 14:52:42 +02:00
Ingo Klöcker
125867f268 cpp: Add support for gpgme_op_set_uid_flag
* lang/cpp/src/context.cpp, lang/cpp/src/context.h
(Context::setPrimaryUid, Context::startSetPrimaryUid): New.
--

GnuPG-bug-id: 5938
2022-08-09 14:52:42 +02:00
NIIBE Yutaka
f8d99bb9e4 python: Don't call __del__ from __exit__ method.
* lang/python/src/core.py (Context, Data): Don't call __del__
from __exit__ method, as the object may be still in use.
* lang/python/tests/t-idiomatic.py: Fix the test.

--

GnuPG-bug-id: 6060
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-08-09 09:57:28 +09:00
NIIBE Yutaka
180899c7c3 python: Don't access gpgme with wrapped=None.
* lang/python/src/core.py (GpgmeWrapper, Context): Check self.wrapped
is valid.

--

GnuPG-bug-id: 6060
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-08-05 14:57:32 +09:00
Jasper Spaans
b2f224a471 python: Reset passphrase callback correctly.
* lang/python/src/core.py (Context(GpgmeWrapper)): Reset passphrase
callback correctly, for encrypt, decrypt, create_key, and
create_subkey methods.

--

Signed-off-by: Jasper Spaans <jasper@startmail.com>
2022-08-05 11:02:44 +09:00
Ingo Klöcker
c3b183831d qt: Remove job for refreshing OpenPGP keys
* lang/qt/src/qgpgmerefreshopenpgpkeysjob.cpp,
lang/qt/src/qgpgmerefreshopenpgpkeysjob.h,
lang/qt/src/refreshopenpgpkeysjob.h: Remove.
* lang/qt/src/Makefile.am, lang/qt/src/job.cpp: Update accordingly.
* lang/qt/src/protocol.h (class Protocol): Remove pure virtual member
function refreshOpenPGPKeysJob.
* lang/qt/src/protocol_p.h (Protocol::refreshOpenPGPKeysJob): Remove.

* lang/qt/tests/run-refreshkeysjob.cpp (main): Use ReceiveKeysJob for
OpenPGP keys.
--

The RefreshOpenPGPKeysJob did more than it was intended to do, e.g. it
imported new keys with the email addresses of the key to be refreshed
via the configured auto-key-locate methods, but only a refresh from the
key servers is wanted. For this we can use the ReceiveKeysJob.

This commit mostly reverts the commits
e12861f18c
c64a8daf50

The changes are source- and binary-compatible to the last release.

GnuPG-bug-id: 5951
2022-08-04 12:06:15 +02:00
Ingo Klöcker
5436b309fe qt: Allow setting the file name of signed and encrypted data
* lang/qt/src/Makefile.am (qgpgme_sources): Add signencryptjob.cpp.
* lang/qt/src/signencryptjob.cpp: New.
* lang/qt/src/signencryptjob.h (class SignEncryptJob): Add member
functions setFileName, fileName.
* lang/qt/src/qgpgmesignencryptjob.cpp (sign_encrypt): Set file name of
input.
(sign_encrypt_qba, QGpgMESignEncryptJob::exec,
QGpgMESignEncryptJob::start): Pass file name to sign_encrypt resp.
sign_encrypt_qba.
--

This makes it possible to store the original name of a signed and
encrypted file in the resulting data.

GnuPG-bug-id: 6056
2022-07-05 18:13:01 +02:00
Ingo Klöcker
bc10169724 qt: Allow setting the file name of encrypted data
* lang/qt/src/Makefile.am (qgpgme_sources): Add encryptjob.cpp.
* lang/qt/src/encryptjob.cpp: New.
* lang/qt/src/encryptjob.h (class EncryptJob): Add member functions
setFileName, fileName.
* lang/qt/src/qgpgmeencryptjob.cpp (encrypt): Set file name of input.
(encrypt_qba, QGpgMEEncryptJob::exec, QGpgMEEncryptJob::start): Pass
file name to encrypt resp. encrypt_qba.
--

This makes it possible to store the original name of an encrypted file
in the encryption result.

GnuPG-bug-id: 6056
2022-07-05 18:10:08 +02:00
Ingo Klöcker
31423945d2 qt: Fix filename of cmake config files for w32
* lang/qt/src/Makefile.am (EXTRA_DIST): Add
QGpgmeConfig-w32.cmake.in.in.
--
2022-07-04 17:10:31 +02:00
Laurent Montel
d42323f902 qt: Add #include <QStringList> needed for building against qt6
* lang/qt/src/downloadjob.h, lang/qt/src/exportjob.h,
lang/qt/src/keylistjob.h lang/qt/src/refreshkeysjob.h: in qt6 we need
to use #include <QStringList>
--

It fixes some compile qt6 compile error.

Signed-off-by: Laurent Montel <montel@kde.org>
2022-07-04 16:58:59 +02:00
Ingo Klöcker
6e45da30ae cpp: Remove obsolete compatibility with KF5 variants
* lang/cpp/src/GpgmeppConfig-w32.cmake.in.in,
lang/cpp/src/GpgmeppConfig.cmake.in.in: Remove find_package() call.
--

The KF5 variants have been removed years ago with revision
a3cf30f894.
2022-06-30 12:30:15 +02:00
Ingo Klöcker
fd813f5c39 qt,tests: Allow 1-day-offset for expiration date
* lang/qt/tests/t-various.cpp (TestVarious::testSignKeyWithExpiration):
Assert that the expiration date is either 2106-02-05 or 2106-02-04.

--

This avoids a test failure if the test is run at 00:xx:xx in a location
that uses DST.

GnuPG-bug-id: 5991
2022-06-10 12:03:39 +02:00
Ingo Klöcker
7870fdbfef qt: Prevent u32 overflow when calculating expiration date
* lang/qt/src/qgpgmesignkeyjob.cpp (sign_key): Change maxAllowedDate to
2106-02-05. Change log-level from warning to debug.
* lang/qt/tests/t-various.cpp (TestVarious::testSignKeyWithExpiration):
Remove check for warning. Adapt assertion.
--

Capping the expiration date at 2106-02-05 prevents a u32 overflow when
adding the number of days until the maximal date to the current time.

GnuPG-bug-id: 5991
2022-06-10 11:54:03 +02:00
Ingo Klöcker
918afc809d Revert "tests: Avoid problems with local time across a day boundary."
This reverts commit 5ba0e454a3.
2022-06-09 15:43:24 +02:00
Werner Koch
5ba0e454a3
tests: Avoid problems with local time across a day boundary.
--

GnuPG-bug-id: 5991
2022-05-23 08:20:04 +02:00
Andre Heinecke
f3011b5a19
cpp: Export KeyListModeSaver
* lang/cpp/src/context.h (Context::KeyListModeSaver): Add Export.

--
This is required for Windows.
2022-05-12 09:34:15 +02:00
Ingo Klöcker
306fd9c915 cpp: Output more properties of a subkey
* lang/cpp/src/key.cpp (ostream operator<< for Subkey): Fix wrong output
of isInvalid and isDisabled flags. Add output of key grip, card serial
number and the flags isSecret, isQualified, isDeVs, and isCardKey.
--

This makes it easier to check those properties for different keys, e.g.
with the run-keylist test program.

GnuPG-bug-id: 5965
2022-05-05 17:25:47 +02:00
Ingo Klöcker
e029fd2735 cpp,tests: Actually parse the --with-secret option
* lang/cpp/tests/run-keylist.cpp (main): Handle --with-secret option.
Print error for unknown option.
--

The --with-secret option was already listed in the help. Now it also
works.

GnuPG-bug-id: 5965
2022-05-05 17:24:59 +02:00
Ingo Klöcker
9e8c8e448e qt: Revert change of result signal of RefreshKeysJob
* lang/qt/src/refreshkeysjob.h (RefreshKeysJob::result): Remove optional
parameters auditLogAsHtml and auditLogError.
* lang/qt/tests/run-refreshkeysjob.cpp (main): Update accordingly.
--

This reverts f4c3560925. The reason for
the previous change does no longer apply.

GnuPG-bug-id: 5951
2022-05-05 10:39:26 +02:00
Ingo Klöcker
15a4940aa7 qt: Use lambda instead of std::bind
* lang/qt/src/qgpgmerefreshopenpgpkeysjob.cpp
(QGpgMERefreshOpenPGPKeysJob::start): Replace std::bind call with a
lambda.
--

GnuPG-bug-id: 5951
2022-05-05 10:32:34 +02:00
Ingo Klöcker
c64a8daf50 qt: Emit import result when refreshing OpenPGP keys
* lang/qt/src/refreshopenpgpkeysjob.h: New.
* lang/qt/src/Makefile.am, lang/qt/src/job.cpp: Update accordingly.
* lang/qt/src/qgpgmerefreshopenpgpkeysjob.h (class
QGpgMERefreshOpenPGPKeysJob): Derive from RefreshOpenPGPKeysJob with
result ImportResult. Remove unused start overload.
* lang/qt/src/qgpgmerefreshopenpgpkeysjob.cpp (locate_external_keys):
Ignore result of KeyListJob. Return import result.
(receive_keys): Return import result.
(refresh_keys): Merge the two import results and return the result.
* lang/qt/src/protocol.h (class Protocol): Add pure virtual member
function refreshOpenPGPKeysJob.
* lang/qt/src/protocol_p.h (Protocol::refreshKeysJob): Return nullptr
for OpenPGP protocol.
(Protocol::refreshOpenPGPKeysJob): New.

* lang/qt/tests/run-refreshkeysjob.cpp (main): Use appropriate job
for the protocol of the key to refresh.
--

This adds RefreshOpenPGPKeysJob complementing RefreshKeysJob (for S/MIME
keys). Changing the result type of RefreshKeysJob would break the ABI.
Therefore we have to introduce a new base class for the refresh job for
OpenPGP. We derive this base class from AbstractImportJob because we
want to return an import result.

GnuPG-bug-id: 5951
2022-05-04 14:51:50 +02:00
Ingo Klöcker
3519d61173 cpp: Allow retrieving import result of key listing with locate mode
* lang/cpp/src/context_p.h (enum Context::Private::Operation): Add
value KeyListWithImport.
* lang/cpp/src/context.cpp (Context::startKeyListing, Context::nextKey):
Set lastop to KeyListWithImport if keylist mode includes Locate.
--

Adding Import to lastop for keylist operations that perform a locate
allows retrieving the import result with Context::importResult.

GnuPG-bug-id: 5951
2022-05-04 14:31:03 +02:00
Ingo Klöcker
d911a15364 cpp: Allow merging the results of two imports
* lang/cpp/src/importresult.h, lang/cpp/src/importresult.cpp (class
ImportResult): Add member function mergeWith.
--

This allows creating a consolidated result of several independent
imports. If the import results to merge considered the same keys, then
not all counts can be consolidated correctly, but the important numbers
like the number of considered keys, the number of imported keys, the
number of unchanged keys and the numbers of new user IDs, subkeys,
signatures and revocations should be correct.

GnuPG-bug-id: 5951
2022-05-04 12:37:47 +02:00
Ingo Klöcker
f1a354fd57 qt: Apply compiler hint
* lang/qt/tests/t-verify.cpp (VerifyTest::testSignatureKey): Use
reference type to prevent copying.
--
2022-05-02 16:04:28 +02:00
Ingo Klöcker
540e7bf3d4 qt: Use GpgME::Locate alias
* lang/qt/src/protocol_p.h (Protocol::locateKeysJob): Use Locate alias
instead of Extern|Local.
* lang/qt/src/qgpgmekeyformailboxjob.cpp (do_work): Ditto.
--
2022-05-02 16:00:43 +02:00
Ingo Klöcker
e12861f18c qt: Add job for refreshing OpenPGP keys
* lang/qt/src/qgpgmerefreshopenpgpkeysjob.h,
lang/qt/src/qgpgmerefreshopenpgpkeysjob.cpp: New.
* lang/qt/src/Makefile.am: Add new files.
* lang/qt/src/protocol_p.h (Protocol::refreshKeysJob): Add support for
OpenPGP protocol.
--

The new job performs a --locate-external-keys for the email addresses
of all not revoked user IDs of the given keys, and it performs a
--recv-keys for the fingerprints of the given keys. The former may
import new keys from WKD or an LDAP server or via some other
(hopefully trusted) auto-key-locate mechanism.

GnuPG-bug-id: 5951
2022-05-02 15:51:44 +02:00
Ingo Klöcker
34786132fe cpp: Add RAII class for saving/restoring the key list mode
* lang/cpp/src/context.h, lang/cpp/src/context.cpp (class Context):
Add nested class KeyListModeSaver.
--

This RAII-style class can be used to save the currently used key list
mode in case it needs to be changed temporarily. On destruction, it
will restore the key list mode that was active at construction time.

GnuPG-bug-id: 5951
2022-05-02 15:51:44 +02:00
Ingo Klöcker
99fd565889 qt: Add debug helper for Result classes with output stream operator
* lang/qt/src/util.h (toLogString): New.
--

GnuPG-bug-id: 5951
2022-05-02 15:06:56 +02:00
Ingo Klöcker
0c304beeaa qt: Factor out helper for getting the fingerprints of some keys
* lang/qt/src/util.h, lang/qt/src/util.cpp (toFingerprints): New.
* lang/qt/src/qgpgmerefreshsmimekeysjob.cpp: Use the helper.
--

GnuPG-bug-id: 5951
2022-05-02 15:04:37 +02:00
Ingo Klöcker
97e09fb964 qt,doc: Fix some API documentation
--

Fix or remove API documentation that has been copied and pasted from
other jobs.
2022-05-02 14:58:21 +02:00
Ingo Klöcker
54c4fd16d1 qt: Fix connection to readyReadStandardOutput signal
* lang/qt/src/qgpgmerefreshsmimekeysjob.h,
lang/qt/src/qgpgmerefreshsmimekeysjob.cpp
(QGpgMERefreshSMIMEKeysJob::slotStderr): Remove.
* lang/qt/src/qgpgmerefreshsmimekeysjob.cpp
(QGpgMERefreshSMIMEKeysJob::startAProcess): Handle
readyReadStandardOutput and readyReadStandardError signals with lambdas.
--

For now output stdout and stderr of gpgsm process as debug log. In
particular, this "adds" the missing slot slotStdout.

GnuPG-bug-id: 5951
2022-04-29 11:55:47 +02:00
Ingo Klöcker
9686258bd1 qt: Add test runner for refresh job
* lang/qt/tests/run-refreshkeysjob.cpp: New.
* lang/qt/tests/Makefile.am (run_refreshkeysjob_SOURCES): New.
(noinst_PROGRAMS): Add new build artifact.
--

GnuPG-bug-id: 5951
2022-04-29 11:44:30 +02:00
Ingo Klöcker
f4c3560925 qt: Make RefreshKeysJob result compatible with standard job result
* lang/qt/src/refreshkeysjob.h (RefreshKeysJob::result): Add optional
parameters auditLogAsHtml and auditLogError.
--

This is necessary for the OpenPGP-implementation of this job.

GnuPG-bug-id: 5951
2022-04-29 11:24:36 +02:00
Ingo Klöcker
fd97cbaa44 qt: Allow refreshing a list of keys
* lang/qt/src/refreshkeysjob.h (class RefreshKeysJob): Add pure virtual
member function start taking a list of keys.
* lang/qt/src/qgpgmerefreshsmimekeysjob.h,
lang/qt/src/qgpgmerefreshsmimekeysjob.cpp (class
QGpgMERefreshSMIMEKeysJob): Implement new member function.
--

The new overload makes it easier to refresh some keys if one does
already have Keys.

GnuPG-bug-id: 5951
2022-04-29 10:50:31 +02:00
Ingo Klöcker
62e7709717 qt: Minor refactoring
* lang/qt/src/qgpgmerefreshsmimekeysjob.cpp: Use namespace QGpgME.
--

GnuPG-bug-id: 5951
2022-04-29 10:46:23 +02:00
Ingo Klöcker
f47bc992ae qt: Rename QGpgMERefreshKeysJob to QGpgMERefreshSMIMEKeysJob
* lang/qt/src/qgpgmerefreshkeysjob.h,
lang/qt/src/qgpgmerefreshkeysjob.cpp: Change name to
* lang/qt/src/qgpgmerefreshsmimekeysjob.h,
lang/qt/src/qgpgmerefreshsmimekeysjob.cpp: ... this, and adapt the
include guard.
(class QGpgMERefreshKeysJob): Rename to QGpgMERefreshSMIMEKeysJob.
* lang/qt/src/Makefile.am: Adapt mentioned file names accordingly.
* lang/qt/src/protocol_p.h (Protocol::refreshKeysJob): Use renamed
class.
--

To avoid confusion with a similar job for OpenPGP keys with a completely
different implementation, we rename this class to make clear that it is
specific for S/MIME keys.

GnuPG-bug-id: 5951
2022-04-29 10:39:38 +02:00
Ingo Klöcker
359906c8bc cpp,tests: Verify that requested keylist mode is used
* lang/cpp/tests/run-getkey.cpp, lang/cpp/tests/run-keylist.cpp (main):
Check used keylist mode.
--

Since Context::setKeyListMode() does not return the error returned by
gpgme, we need to verify explicitly that the keylist mode was set
successfully.

GnuPG-bug-id: 5951
2022-04-28 10:33:23 +02:00
Ingo Klöcker
dea872f21f cpp: Support new keylist modes
* lang/cpp/src/global.h (ForceExtern, LocateExternal, KeyListModeMask):
New.
* lang/cpp/src/context.cpp (operator<<): Add check.
* lang/cpp/src/util.h (gpgme_keylist_mode_t,
convert_from_gpgme_keylist_mode_t): Handle ForceExtern.
* lang/cpp/tests/run-getkey.cpp (show_usage, main): Add arguments
--force-extern and --locate-external.
* lang/cpp/tests/run-keylist.cpp (show_usage, main): Ditto.
--

GnuPG-bug-id: 5951
2022-04-27 17:21:04 +02:00
Ingo Klöcker
512f11b458 qt: Rely on the bad passphrase error reported by gpg
* lang/qt/src/qgpgmedecryptverifyjob.cpp (patch_decryption_result):
Removed.
(decrypt_verify): Remove usage of patch_decryption_result.
--

This reverts most of revision d8e5871dca.

GnuPG-bug-id: 5939
2022-04-25 12:18:17 +02:00
Ingo Klöcker
d8e5871dca qt: Report better error if decryption failed because of bad passphrase
* lang/qt/src/qgpgmedecryptverifyjob.cpp (patch_decryption_result): New.
(decrypt_verify): Call patch_decryption_result.
--

Replace the generic "decryption failed" error with the more specific
"bad passphrase" error if the audit log indicates that a wrong symmetric
password caused the decryption to fail.

GnuPG-bug-id: 5939
2022-04-22 17:34:41 +02:00
Ingo Klöcker
321c8a0254 cpp: Allow changing the error of a result
* lang/cpp/src/result.h (class Result): Add member function setError.
--

This can be used to replace the error of a result with a more suitable
error.

GnuPG-bug-id: 5939
2022-04-22 17:30:59 +02:00
Ingo Klöcker
102024f7e6 qt,doc: Fix typo and grammar in API documentation
--
2022-04-05 10:17:39 +02:00
Ingo Klöcker
28cdbfdccb cpp: Handle canceling of an edit operation
* lang/cpp/src/editinteractor.cpp
(CallbackHelper::edit_interactor_callback_impl): Check for error _or_
canceled state.
--

Without this canceling an edit operation resulted in a "General error".

GnuPG-bug-id: 5904
2022-04-05 10:17:39 +02:00
Ingo Klöcker
db532eca8e cpp: Return actual error if revocation fails
* lang/cpp/src/editinteractor.cpp, lang/cpp/src/editinteractor.h
(EditInteractor::parseStatusError): New.
* lang/cpp/src/gpgrevokekeyeditinteractor.cpp
(GpgRevokeKeyEditInteractor::Private::nextState): Handle status
error.
--

With this change the interactor returns a proper error like "Bad
Passphrase" or "Empty Passphrase" instead of an unspecific "General
Error" if a status error occurred.

GnuPG-bug-id: 5904
2022-04-05 10:15:07 +02:00
Ingo Klöcker
c965b45bcd cpp: Add internal utility function for splitting strings
* lang/cpp/src/util.h (split): New.
--

This function splits a given string using the given delimiter into
several strings.

GnuPG-bug-id: 5904
2022-04-05 10:05:43 +02:00
Ingo Klöcker
4beb6f4199 cpp: Do not export symbols of the Private class
* lang/cpp/src/gpgrevokekeyeditinteractor.h (class
GpgRevokeKeyEditInteractor): Mark nested class Private as hidden.
--

GnuPG-bug-id: 5904
2022-04-05 10:05:43 +02:00
Ingo Klöcker
7f089165e3 qt: Check arguments passed to the revoke key job
* lang/qt/src/qgpgmerevokekeyjob.cpp (check_arguments): New.
(QGpgMERevokeKeyJob::start, QGpgMERevokeKeyJob::exec): Call
check_arguments.
* lang/qt/tests/t-revokekey.cpp (RevokeKeyJobTest): Add member functions
testErrorHandling_nullKey, testErrorHandling_invalidReason,
testErrorHandling_invalidDescription.
--

Check that the key is not a null key, that the reason has a valid
value, and that the description lines do not contain endline characters
and are not empty.

GnuPG-bug-id: 5904
2022-03-31 18:39:19 +02:00
Ingo Klöcker
3856ae8621 qt,tests: Verify reason code and description of revocation
* lang/qt/tests/t-revokekey.cpp (RevokeKeyJobTest::testRevokeKeyAsync,
RevokeKeyJobTest::testRevokeKeySync_noReasonDescription,
RevokeKeyJobTest::testRevokeKeySync_oneLineReasonDescription,
RevokeKeyJobTest::testRevokeKeySync_twoLinesReasonDescription): Call
verifyReason.
(class RevokeKeyJobTest): Add private member function verifyReason.
--

gpgme doesn't parse the information, so we run gpg manually to verify
the revocation reason and the description.

GnuPG-bug-id: 5904
2022-03-30 12:29:28 +02:00
Ingo Klöcker
41297520da qt: Add job to revoke own OpenPGP keys
* lang/qt/src/revokekeyjob.h, lang/qt/src/qgpgmerevokekeyjob.h,
lang/qt/src/qgpgmerevokekeyjob.cpp: New.
* lang/qt/src/protocol.h (class Protocol): Add pure virtual member
function revokeKeyJob.
* lang/qt/src/protocol_p.h (Protocol::revokeKeyJob): New.
* lang/qt/src/job.cpp, lang/qt/src/Makefile.am: Update accordingly.

* lang/qt/tests/Makefile.am (the_tests, moc_files, noinst_PROGRAMS):
Add new test.
(t_revokekey_SOURCES): New.
* lang/qt/tests/t-revokekey.cpp: New.
--

The new job allows revoking own OpenPGP keys as with the "revkey"
edit-key command of gpg.

GnuPG-bug-id: 5904
2022-03-30 12:29:28 +02:00
Ingo Klöcker
d96e8a7a6b cpp: Add interactor to revoke a key
* lang/cpp/src/global.h (enum class RevocationReason): New.
* lang/cpp/src/gpgrevokekeyeditinteractor.cpp,
lang/cpp/src/gpgrevokekeyeditinteractor.h: New.
* lang/cpp/src/Makefile.am: Add new files.
--

GnuPG-bug-id: 5904
2022-03-30 12:05:26 +02:00
Ingo Klöcker
fe588fef09 cpp: Set default visibility of all symbols to hidden
* configure.ac: Add -fvisibility=hidden to GPGME_CPP_CFLAGS if gcc
supports the flag.
* lang/cpp/src/Makefile.am (AM_CPPFLAGS): Add GPGME_CPP_CFLAGS.
* m4/ax_gcc_func_attribute.m4: New.
--

With this change all defined symbols are hidden by default, so that they
are not exported anymore. All symbols that are part of the ABI and that
shall still be exported are already marked as having default visibility.

The m4 macro was taken from the website mentioned in the License header
of the file.

GnuPG-bug-id: 5906
2022-03-28 17:22:48 +02:00
Ingo Klöcker
92139e7b6b cpp: Put local helper function into unnamed namespace
lang/cpp/src/context.cpp (to_auditlog_flags): Wrap in unnamed namespace.
--

GnuPG-bug-id: 5906
2022-03-28 17:22:48 +02:00
Ingo Klöcker
55861ba9cc qt: Add missing include of config.h
* lang/qt/src/util.cpp: Include config.h.
--

GnuPG-bug-id: 5871
2022-03-07 09:28:09 +01:00
Ingo Klöcker
5a5a748e23 qt,doc: Remove comments about throwing exceptions
--

The jobs do not throw GpgME::Exception anymore since a long time.
2022-03-07 09:28:09 +01:00
Ingo Klöcker
ad3aabdd8a qt: Fix ABI compatibility with 1.16.0
* lang/qt/src/protocol.h (class Protocol): Move new virtual methods to
the end of the class.
--

This makes the vtable offsets of the old virtual methods match those
in 1.16.0 again.

GnuPG-bug-id: 5834
2022-02-17 09:54:45 +01:00
Werner Koch
451a42f0d2
qt: Fix build for older Qt versions.
* lang/qt/src/util.cpp: Include <functional>.
2022-02-07 13:10:13 +01:00
Ingo Klöcker
ca1c30b6fa qt: Add job to import keys given by key ids
* lang/qt/src/receivekeysjob.h, lang/qt/src/qgpgmereceivekeysjob.h,
lang/qt/src/qgpgmereceivekeysjob.cpp: New.
* lang/qt/src/protocol.h (class Protocol): Add pure virtual member
function receiveKeysJob.
* lang/qt/src/protocol_p.h (Protocol::receiveKeysJob): Implement it.
* lang/qt/src/job.cpp, lang/qt/src/Makefile.am: Update accordingly.

* lang/qt/tests/run-receivekeysjob.cpp: New.
* lang/qt/tests/Makefile.am: Add new test runner.
--

This job allows importing keys that are given by their key ids (or
fingerprints) from keyservers as with gpg's recv-keys command.

GnuPG-bug-id: 5808
2022-02-03 15:56:30 +01:00
Ingo Klöcker
ec8d1ee13f qt: Add helper for converting QStringList to vector of strings
* lang/qt/src/util.h, lang/qt/src/util.cpp: New.
* lang/qt/src/Makefile.am (qgpgme_sources, private_qgpgme_headers):
Add new files.
--

Additionally to the internal helper function toStrings(), this adds
a copy of the internal make_error helper of GpgME++ which is used
in a few places by QGpgME. We use the same error source id as GpgME++.

GnuPG-bug-id: 5808
2022-02-03 15:56:30 +01:00
Ingo Klöcker
bbaeeb5b9d cpp: Allow import of keys given by key ids
* lang/cpp/src/context.h (class Context): Add overloads of member
functions importKeys and startKeyImport
* lang/cpp/src/context.cpp (class Context): ... and implement them.
--

GnuPG-bug-id: 5808
2022-02-03 15:56:30 +01:00
Ingo Klöcker
3d7810e8d9 cpp: Add internal adapter for passing a vector of strings to gpgme
* lang/cpp/src/util.h (class StringsToCStrings): New.
* lang/cpp/src/util.cpp: New.
* lang/cpp/src/Makefile.am: Add new file.
--

This adapter simplifies passing a vector of strings as NULL-terminated
array of const char* to the C-interface of gpgme.

GnuPG-bug-id: 5808
2022-02-03 15:56:30 +01:00