Commit Graph

364 Commits

Author SHA1 Message Date
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
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
102024f7e6 qt,doc: Fix typo and grammar in API documentation
--
2022-04-05 10:17:39 +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
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
ec71eb1d7d qt: Remove superfluous include
* lang/qt/src/importjob.h: Remove include of QByteArray.
--

QByteArray is included by other headers already. Besides: Qt headers
shouldn't be included with the package/module prefixes.
2022-01-17 14:44:57 +01:00
Ingo Klöcker
9c03bde06b qt: Fix build without installed GpgME++ headers
* lang/qt/src/importjob.h, lang/qt/src/wkdlookupresult.h: Include
headers of GpgME++ without "gpgme++/" prefix when building QGpgme.
* lang/qt/src/qgpgmeimportjob.cpp, lang/qt/src/qgpgmewkdlookupjob.cpp,
lang/qt/src/wkdlookupresult.cpp, lang/qt/tests/t-import.cpp: Include
headers of GpgME++ without "gpgme++/" prefix.
--
2022-01-17 14:41:17 +01:00
Ingo Klöcker
4d913a8aa5 qt: Add job to add existing subkeys to other keys
* lang/qt/src/addexistingsubkeyjob.h,
lang/qt/src/qgpgmeaddexistingsubkeyjob.cpp,
lang/qt/src/qgpgmeaddexistingsubkeyjob.h: New.
* lang/qt/src/protocol.h (class Protocol): Add pure virtual member
function addExistingSubkeyJob.
* lang/qt/src/protocol_p.h (Protocol::addExistingSubkeyJob): Implement.
* 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_addexistingsubkey_SOURCES): New.
* lang/qt/tests/t-addexistingsubkey.cpp: New.
* lang/qt/tests/t-support.h (VERIFY_OR_RETURN_VALUE,
COMPARE_OR_RETURN_VALUE, VERIFY_OR_OBJECT, COMPARE_OR_OBJECT,
VERIFY_OR_FALSE, COMPARE_OR_FALSE): New.
* lang/qt/tests/t-support.h, lang/qt/tests/t-support.cpp
(class QQGpgMETest): New member function importSecretKeys.
--

The new job allows adding existing subkeys to other keys as with the
"addkey" edit-key command of gpg. The added subkey will have the same
expiration date (+/- 1 second) as the original subkey.

GnuPG-bug-id: 5770
2022-01-13 15:18:12 +01:00
Ingo Klöcker
d308910cdf qt,tests: Add helper to hook up the test passphrase provider
* lang/qt/tests/t-support.h, lang/qt/tests/t-support.cpp
(class QGpgMETest): Add member function hookUpPassphraseProvider.
Add member mPassphraseProvider.
* lang/qt/tests/t-changeexpiryjob.cpp,
lang/qt/tests/t-encrypt.cpp,
lang/qt/tests/t-remarks.cpp,
lang/qt/tests/t-tofuinfo.cpp,
lang/qt/tests/t-trustsignatures.cpp,
lang/qt/tests/t-various.cpp: Use new helper.
--

GnuPG-bug-id: 5770
2022-01-13 12:40:35 +01:00
Ingo Klöcker
a54402fc2d qt,tests: Add asyncDone signal to base class of all tests
* lang/qt/tests/t-support.h (class QGpgMETest): Add signal asyncDone.
* lang/qt/tests/t-changeexpiryjob.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-tofuinfo.cpp,
lang/qt/tests/t-trustsignatures.cpp,
lang/qt/tests/t-various.cpp,
lang/qt/tests/t-wkdlookup.cpp,
lang/qt/tests/t-wkspublish.cpp: Remove signal asyncDone from the test
classes.
--

This reduces duplication and makes it possible to use the signal in
the base class.

GnuPG-bug-id: 5770
2022-01-13 11:36:35 +01:00
Ingo Klöcker
04723a6e96 qt: Add factory function for secret subkey export job
* lang/qt/src/protocol.h (class Protocol): Add member function
secretSubkeyExportJob.
* lang/qt/src/protocol_p.h (Protocol::secretSubkeyExportJob): Implement.

* lang/qt/tests/run-exportjob.cpp (showUsageAndExitWithCode): Print
new option.
(createExportJob): Create secret subkey export job if requested.
(main): New option --secret-subkey.
--

GnuPG-bug-id: 5757
2022-01-04 15:56:34 +01:00
Ingo Klöcker
88ad37ea96 qt: Remove obsolete QGpgMESecretKeyExportJob
* lang/qt/src/Makefile.am: Remove all occurrences of
qgpgmesecretkeyexportjob.*.
* lang/qt/src/qgpgmesecretkeyexportjob.cpp,
lang/qt/src/qgpgmesecretkeyexportjob.h: Remove.
--

QGpgMESecretKeyExportJob is an internal class, so that we can safely
remove it.

GnuPG-bug-id: 5757
2022-01-04 15:45:59 +01:00
Ingo Klöcker
4e80563fab qt: Use QGpgMEExportJob also for export of secret keys
* lang/qt/src/protocol.h (Protocol::secretKeyExportJob): Document
charset argument as ignored.
* lang/qt/src/protocol_p.h (Protocol::secretKeyExportJob): Use
QGpgMEExportJob instead of QGpgMESecretKeyExportJob.
* lang/qt/src/qgpgmeexportjob.h (class QGpgMEExportJob): Add c'tor
taking an export mode. Add member m_exportMode. Rename member m_flags to
m_additionalExportModeFlags.
(QGpgMEExportJob::~QGpgMEExportJob): Mark as override.
* lang/qt/src/qgpgmeexportjob.cpp (QGpgMEExportJob::QGpgMEExportJob):
Delegate to new c'tor. Implement new c'tor.
(QGpgMEExportJob::~QGpgMEExportJob): Use default.
(export_qba): Rename argument flags to mode.
(QGpgMEExportJob::start): Pass combination of export mode and additional
mode flags to export_qba.
(QGpgMEExportJob::setExportFlags): Adapt to renaming of member.

* lang/qt/tests/run-exportjob.cpp: New.
--

This change makes it possible to export secret OpenPGP keys.

GnuPG-bug-id: 5757
2022-01-04 15:44:16 +01:00
Ingo Klöcker
82f43455e9 qt: Detect an import error caused by a wrong password
* lang/qt/src/qgpgmeimportjob.cpp (import_qba): Check import statuses of
import result for bad passphrase errors.
--

To allow users of the import job to handle a failed import caused by
a wrong password more gracefully, check if all import statuses of the
import result have a bad passphrase error and return a bad passphrase
error as import result in this case.

GnuPG-bug-id: 5713
2021-12-22 15:25:42 +01:00
Ingo Klöcker
f99451e20f qt,tests: Add test runner for testing the import job
* lang/qt/tests/Makefile.am (run_importjob_SOURCES): New.
(noinst_PROGRAMS): Add run-importjob.
* lang/qt/tests/run-importjob.cpp: New.
--

GnuPG-bug-id: 5713
2021-12-22 15:25:42 +01:00
Ingo Klöcker
619579bb17 qt: Allow specifying an import filter when importing keys
* lang/qt/src/importjob.cpp (struct ImportJobPrivate): Add member
m_importFilter.
* lang/qt/src/importjob.cpp, lang/qt/src/importjob.h (class ImportJob):
Add member functions setImportFilter and importFilter.
* lang/qt/src/qgpgmeimportjob.cpp (import_qba): Add arg importFilter
and adjust the callers. Set import filter context flag.

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

GnuPG-bug-id: 5739
2021-12-15 15:00:07 +01:00
Ingo Klöcker
3e81a4a336 qt: Avoid test failure when test is run multiple times
* lang/qt/tests/t-import.cpp (ImportTest): Add member tempGpgHome and
member function initTestCase.
(keyFpr, keyData): Move to ImportTest::testImportWithKeyOrigin.
--

Use different temporary GNUPGHOME's when running the test. This ensures
that the import in the test is always done with a new keyring.

GnuPG-bug-id: 5733
2021-12-15 12:21:28 +01:00
Ingo Klöcker
3c770013d7 qt: Fix erroneous reuse of JobPrivate objects
* lang/qt/src/job.cpp (Job::~Job): Destroy JobPrivate object belonging
to destroyed job.
--

In some tests different Job objects reused the same JobPrivate object
because they were created with the same memory address. Obviously, this
shouldn't happen.

GnuPG-bug-id: 5739
2021-12-15 12:00:51 +01:00
Ingo Klöcker
af820811ec qt: Add pattern used for WKD lookup to result
* lang/qt/src/qgpgmewkdlookupjob.cpp (run_wkd_get): Change type of
arg email.
(lookup_keys): Add pattern to result.
* lang/qt/src/wkdlookupresult.h (class WKDLookupResult): Add arg
pattern to c'tors. Add member function pattern.
* lang/qt/src/wkdlookupresult.cpp (class WKDLookupResult::Private):
Add field pattern.
(WKDLookupResult::WKDLookupResult): Pass pattern to pimpl.
(WKDLookupResult::pattern): New.

* lang/qt/tests/t-wkdlookup.cpp (testWKDLookupAsync, testWKDLookupSync,
testLookupWithNoResultAsync): Check pattern.
--

GnuPG-bug-id: 5728
2021-12-14 14:49:39 +01:00
Ingo Klöcker
fd6bec617d qt: Allow setting key origin when importing keys
* lang/qt/src/Makefile.am (qgpgme_sources): Add importjob.cpp.
* lang/qt/src/importjob.cpp: New.
* lang/qt/src/importjob.h (class ImportJob): Add member functions
setKeyOrigin, keyOrigin, keyOriginUrl.
* lang/qt/src/qgpgmeimportjob.cpp (originToString): New.
(import_qba): Set key origin context flag.
(QGpgMEImportJob::start, QGpgMEImportJob::exec): Add options to call
of import_qba.

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

GnuPG-bug-id: 5733
2021-12-14 11:47:09 +01:00
Ingo Klöcker
3a43d9dc67 qt,tests: Skip WKD lookup tests by default
* lang/qt/tests/t-support.cpp, lang/qt/tests/t-support.h
(class QGpgMETest): Add member function doOnlineTests.
* lang/qt/tests/t-wkdlookup.cpp (testWKDLookupAsync, testWKDLookupSync,
testLookupWithNoResultAsync): Skip tests if online tests are not
enabled.
--

GnuPG-bug-id: 5728
2021-12-14 11:04:03 +01:00
Ingo Klöcker
ed7e7df2e1 qt: Support WKD lookup without implicit import
* lang/qt/src/Makefile.am (qgpgme_sources): Add qgpgmewkdlookupjob.cpp,
wkdlookupresult.cpp.
(qgpgme_headers): Add wkdlookupjob.h, wkdlookupresult.h.
(camelcase_headers): Add WKDLookupJob, WKDLookupResult.
(private_qgpgme_headers): Add qgpgmewkdlookupjob.h.
(qgpgme_moc_sources): Add qgpgmewkdlookupjob.moc, wkdlookupjob.moc.
* lang/qt/src/job.cpp: Define c'tor and d'tor of WKDLookupJob.
* lang/qt/src/protocol.h (Protocol::wkdLookupJob): New.
* lang/qt/src/protocol_p.h (Protocol::wkdLookupJob): New.
* lang/qt/src/qgpgmewkdlookupjob.cpp, lang/qt/src/qgpgmewkdlookupjob.h,
lang/qt/src/wkdlookupjob.h, lang/qt/src/wkdlookupresult.cpp,
lang/qt/src/wkdlookupresult.h: New.

* lang/qt/tests/Makefile.am (EXTRA_DIST): Add final.test.
(the_tests): New.
(TESTS): Remove all t-*. Add $(the_tests) and final.test.
(moc_files): Add t-wkdlookup.moc.
(t_wkdlookup_SOURCES): New.
(noinst_PROGRAMS): Add t-wkdlookup.
* lang/qt/tests/final.test: New.
* lang/qt/tests/t-support.h (QTest::toString): New template
specialization for std::string.
* lang/qt/tests/t-wkdlookup.cpp: New.
--

The new WKDLookupJob allows running a WKD lookup without implicit
import of the retrieved key. This makes it possible to do WKD lookups
similar to keyserver lookups (aka external keylistings).

The new final.test pseudo test stops a dirmngr that may have been
started by the tests. The toString() template specialization enables
printing of the actual and expected values in case of failed QCOMPARE.

GnuPG-bug-id: 5728
2021-12-13 10:48:52 +01:00
Ingo Klöcker
0e70a2313a qt: Fix example for using the asynchronous job API
* lang/qt/src/protocol.h (class Protocol): Fix API documentation.
--
2021-12-13 09:24:30 +01:00
Ingo Klöcker
ab9bca09eb qt: Fix build against Qt 5.9
* lang/qt/tests/t-keylist.cpp (KeyListTest::testListAllKeysSync):
Ensure same type for both arguments of QCOMPARE.
* lang/qt/tests/t-various.cpp (TestVarious::testSetExpire):
Ensure same type for both arguments of QCOMPARE.
--

Qt 5.9 does not yet have the generic qCompare helper which supports
arguments of any type that can be compared with ==.

GnuPG-bug-id: 5592
2021-09-13 17:30:49 +02:00
Andre Heinecke
8fe1546282
qt: Expect UTF-8 on stderr on Windows
* lang/qt/src/threadedjobmixin.cpp (stringFromGpgOutput): Expect
UTF-8.

--
In recent versions more and more output was changed to be
UTF-8 on Windows. Werner advised to always expect UTF-8
diagnostics.
2021-08-27 13:01:17 +02:00
Andre Heinecke
bc774104bb
Add missing files for distribution
* lang/qt/src/Makefile.am (private_qgpgme_headers): Add job_p.h
* tests/gpg/Makefile.am (EXTRA_DIST): Add gpg.conf.in
2021-08-27 12:58:27 +02:00
Ingo Klöcker
6a79e90ded Make sure expiration time is interpreted as unsigned number
* lang/qt/tests/t-various.cpp (testSignKeyWithExpiration): Convert
expiration time to uint_least32_t.
--

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

GnuPG-bug-id: 5522
2021-07-08 11:54:06 +02:00
Ingo Klöcker
12006a7829 qt: Allow retrieving the default value of a config entry
* lang/qt/src/cryptoconfig.cpp, lang/qt/src/cryptoconfig.h
(CryptoConfigEntry::defaultValue): New.
* lang/qt/src/qgpgmenewcryptoconfig.cpp,
lang/qt/src/qgpgmenewcryptoconfig.h
(QGpgMENewCryptoConfigEntry::defaultValue): New.
* lang/qt/tests/t-config.cpp (CryptoConfigTest::testDefault()):
Add test of CryptoConfigEntry::defaultValue(). Port away from deprecated
CryptoConfig::entry overload.
--

GnuPG-bug-id: 5515
2021-06-29 12:12:33 +02:00
Ingo Klöcker
9d2b876093 qt: Fix filenames in copyright headers
* lang/qt/src/qgpgmechangeownertrustjob.h,
lang/qt/tests/t-trustsignatures.cpp: Use correct filenames.
2021-06-28 11:56:12 +02:00
Ingo Klöcker
801acd89b2 qt: Add test for ChangeExpiryJob
* lang/qt/tests/Makefile.am (TESTS, moc_files, noinst_PROGRAMS): Add
new test.
(t_changeexpiryjob_SOURCES): New.
* lang/qt/tests/t-changeexpiryjob.cpp: New.
--

GnuPG-bug-id: 4717
2021-06-28 11:56:12 +02:00
Ingo Klöcker
144d580607 qt: Allow changing expiration date of primary key and all subkeys
* lang/qt/src/Makefile.am (qgpgme_sources): Add changeexpiryjob.cpp.
* lang/qt/src/changeexpiryjob.cpp: New.
* lang/qt/src/changeexpiryjob.h (enum ChangeExpiryJob::Option,
typedef ChangeExpiryJob::Options, ChangeExpiryJob::setOptions,
ChangeExpiryJob::options): New.
* lang/qt/src/qgpgmechangeexpiryjob.cpp (change_expiry): Update the
expiration date of primary key and/or some/all subkeys.
(QGpgMEChangeExpiryJob::start): Add options to call of change_expiry.
(ChangeExpiryJob::start): Moved implementation to changeexpiryjob.cpp.
--

Additionally, to the default behavior (update expiration of primary
key if no subkeys are specified resp. update expiration of specified
subkeys) it is now possible to update the expiration of the primary key
_and_ the specified/all subkeys.

GnuPG-bug-id: 4717
2021-06-28 11:56:12 +02:00
Ingo Klöcker
3503816570 qt: Add mechanism for missing d-pointer in Job
* lang/qt/src/job_p.h: New.
* lang/qt/src/job.cpp (typedef JobPrivateHash, d_func, setJobPrivate,
getJobPrivate): New.
--

Because of ABI compatibility requirements we cannot add a d-pointer
to Job. Therefore we store the d-pointers in a global static. This
mechanism will allow Job subclasses to store additional data without
breaking the ABI.

GnuPG-bug-id: 4717
2021-06-28 11:56:12 +02:00
Ingo Klöcker
ade95b25ce qt: Remove superfluous trailing ';'
lang/qt/src/signkeyjob.h (class SignKeyJob): Remove trailing ';' from
inline implemented member functions
2021-06-26 18:03:37 +02:00
Werner Koch
768b7892e3
python: Do not include the full file names in the docs.
--

GnuPG-bug-id: 5299
2021-06-24 18:13:00 +02:00
Ingo Klöcker
ac4536990a qt: Extend SignKeyJob to create signatures with expiration date
* lang/qt/src/signkeyjob.h (SignKeyJob::setExpirationDate): New.
* lang/qt/src/qgpgmesignkeyjob.h, lang/qt/src/qgpgmesignkeyjob.cpp
(QGpgMESignKeyJob::setExpirationDate): New.
* lang/qt/src/qgpgmesignkeyjob.cpp (QGpgMESignKeyJob::Private): Add
member m_expiration.
(sign_key): Handle expiration date.
(QGpgMESignKeyJob::start): Pass expiration date to sign_key.

* lang/qt/tests/t-various.cpp
(TestVarious::testSignKeyWithoutExpiration,
TestVarious::testSignKeyWithExpiration): New.
(TestVarious::initTestCase): Add "allow-weak-key-signatures" to
gpg.conf.
--

This allows Kleopatra (and other users of QGpgme) to create key
signatures with expiration date.

GnuPG-bug-id: 5336, 5506
2021-06-22 18:49:45 +02:00
Ingo Klöcker
5340bb7ccf qt: Add missing }
* lang/qt/src/qgpgmenewcryptoconfig.cpp (parseURL): Add missing }.
--

Fixes-commit: 1dca8c2b3c
GnuPG-bug-id: 5465
2021-06-18 12:33:06 +02:00
Ingo Klöcker
72de06417e qt: Add some error logging
* lang/qt/src/qgpgmenewcryptoconfig.cpp (setURLValueList): Log error
if setting config value failed.
--

GnuPG-bug-id: 5465
2021-06-17 09:41:22 +02:00
Ingo Klöcker
1dca8c2b3c qt: Do not set empty base DN as query of keyserver URL
* lang/qt/src/qgpgmenewcryptoconfig.cpp (parseURL): Only set non-empty
base DN as URL query.
--

This makes it possible to differentiate an unset query from an empty
query.

GnuPG-bug-id: 5465
2021-06-17 09:38:33 +02:00
Ingo Klöcker
0d03f31e07 qt: Fix API documentation
* lang/qt/src/signkeyjob.h (SignKeyJob::start,
SignKeyJob::setUserIDsToSign, SignKeyJob::setCheckLevel): Fix
documentation of parameters.
--

GnuPG-bug-id: 5245
2021-06-17 09:13:59 +02:00
Andre Heinecke
b3b75c37e2
qt: Flush output after write for QProcess output
* lang/qt/src/dataprovider.cpp (QIODeviceDataProvider::write): Call
waitForBytesWritten.

--
The problem here is that QProcess writes into an internal buffer
which is written to stdin of the process triggered by a
signal/slot connection. That connection is broken when we move
the QProcess into our GPGME thread and only restablished when
our Job is finished. This caused Kleopatra to basically keep
everything when decrypting a large archive in memory and
only write it out to the unpack process once the decryption
was finished.

GnuPG-Bug-Id: T5475
2021-06-10 15:36:26 +02:00
Andre Heinecke
e6095e5471
qt: Explicitly link libgpg-error
* lang/qt/src/Makefile.am (libqgpgme_la_LIBADD): Explicitly link
gpg-error.

--
Previously this was implicit from the libassuan flags.
2021-06-09 10:53:28 +02:00
Ingo Klöcker
5bc4e23a57 qt: Add separate logging category for result of config loading
* lang/qt/src/qgpgme_debug.h: Make include guard match file name.
* lang/qt/src/qgpgme_debug.h, lang/qt/src/qgpgme_debug.cpp
(QGPGME_CONFIG_LOADING_LOG): New.
* lang/qt/src/qgpgmenewcryptoconfig.cpp
(QGpgMENewCryptoConfig::reloadConfiguration): Use new logging category.
--

Use a separate logging category for the extremely noisy logging of
the result of config loading to make debug logging more useful.

GnuPG-bug-id: 5217
2021-06-02 10:56:52 +02:00
Ingo Klöcker
27aa7c4a0f qt: Add support for flags in LDAP server options
* lang/qt/src/qgpgmenewcryptoconfig.cpp (parseURL): Handle extended
LDAP server option syntax.
(portToString): New.
(splitURL): Append flags to LDAP server option.
--

This adds support for the extended syntax of LDAP server options
introduced in gpg 2.2.18/2.3. The flags are stored as fragment of a
QUrl.

GnuPG-bug-id: 5217
2021-06-01 15:29:03 +02:00
Ingo Klöcker
f0858e45b0 qt: Extend SignKeyJob to create trust signatures
* lang/qt/src/signkeyjob.h (SignKeyJob::setTrustSignature): New.
* lang/qt/src/qgpgmesignkeyjob.h, lang/qt/src/qgpgmesignkeyjob.cpp
(QGpgMESignKeyJob::setTrustSignature): New.
* lang/qt/src/qgpgmesignkeyjob.cpp (sign_key): Handle trust signatures.
(QGpgMESignKeyJob::start): Pass trust signature attributes to sign_key.
(QGpgMESignKeyJob::setTrustSignature): New.
--

This allows Kleopatra to create trust signatures for trusted
introducers.

GnuPG-bug-id: 5245, 5421
2021-05-05 19:26:33 +02:00
Ingo Klöcker
dae01f8185 qt: Pimpl QGpgMESignKeyJob
* lang/qt/src/qgpgmesignkeyjob.h: Remove unneeded includes. Include
<memory>.
(QGpgMESignKeyJob): Remove all member variables. Add pimpl pointer.
* lang/qt/src/qgpgmesignkeyjob.cpp: Include <QString>. Don't include
<memory>.
(QGpgMESignKeyJob::Private): New.
(QGpgMESignKeyJob::QGpgMESignKeyJob): Remove initialization of removed
members. Initialize d.
(QGpgMESignKeyJob::start, QGpgMESignKeyJob::setUserIDsToSign,
QGpgMESignKeyJob::setCheckLevel, QGpgMESignKeyJob::setExportable,
QGpgMESignKeyJob::setSigningKey, QGpgMESignKeyJob::setNonRevocable,
QGpgMESignKeyJob::setRemark, QGpgMESignKeyJob::setDupeOk): Adapt to move
of member variables to pimpl.
--

GnuPG-bug-id: 5245, 5421
2021-05-05 19:26:19 +02:00
Ingo Klöcker
fe900a41bf qt: Add method for getting config entries for components by entry name
* lang/qt/src/cryptoconfig.h, lang/qt/src/cryptoconfig.cpp
(CryptoConfig::entry): Move implementation to cpp. Add overload not
requiring a group name.
--

The group name is not needed for identifying a config entry because the
groups only provide a logical grouping of config entry for user
interfaces. To improve usability entries are sometimes moved to a
different group, but this shouldn't break existing applications trying
to access those entries. The new group-agnostic overload makes
applications robust against regrouping of config entries.

GnuPG-bug-id: 5217
2021-03-05 09:24:01 +01:00
Andre Heinecke
543e210638
Qt: Undeprecate QByteArray based start functs
* lang/qt/src/encryptjob.h, lang/qt/src/signjob.h (start):
Undeprecate QByteArray based functions.

--
While the QIODevice access might avoid a copy it is more
difficult to manage the data and lifetime of the
QIODevices in calling code. The QByteArray calls are
convienient for small data objects like mails where
an in memory copy is not really expensive anymore.
2021-01-04 13:35:24 +01:00
Andre Heinecke
a5c4b03025
Revert "cpp: Use portable off_t size_t"
This reverts commit 88294023c1.

--
This commit was too early and i needed to test more
this is breaking more then it helps so for now
revert it before we can do a proper solution.
2020-11-20 10:10:32 +01:00
Andre Heinecke
88294023c1
cpp: Use portable off_t size_t
* configure.ac: Configure cpp data.h.in
* lang/cpp/src/Makefile.am: Generate data.h
* lang/cpp/src/data.cpp, lang/cpp/src/data.h: Use portable
types.
* lang/qt/src/Makefile.am: Include build dir.
* lang/qt/tests/makefile.am: Include build dir.

--
These kind of patches have been around for a while, IMO this
should not create an ABI incompatbility for cases where
it already works because the types should be the same
so I think this is not an interface break.

GnuPG-Bug-Id: T3996
2020-11-18 15:14:56 +01:00
Ingo Klöcker
3c185c2159 qt: Avoid empty "rem@gnupg.org" signature notations
* lang/qt/src/qgpgmesignkeyjob.cpp (sign_key): Check remark for being
an empty string instead of a null QString.
--

GnuPG-bug-id: 5142
Co-authored-by: Daniel Kahn Gillmor
2020-11-18 12:43:45 +01:00
Andre Heinecke
df5a89e692
qt: Fix export of qDebug GpgME::Error overload
* lang/qt/src/debug.cpp: Include debug.h to get the export decl.
2020-11-12 16:07:14 +01:00
Andre Heinecke
81f0dc7293
qt: Add export macro for QDebug operator
* lang/qt/src/debug.h: Add export macro.

--
This is public API so it should be exported. This did not
resolve a link issue for Windows that I've experienced
when building. But this might be to some uncleanlyness
in my build environment.
2020-11-11 18:12:20 +01:00
NIIBE Yutaka
276f3390e1 qt: Allow build with older GnuPG (< 2.2.18).
* lang/qt/tests/t-remarks.cpp (initTestCase): Check gpg for
allow-weak-key-signatures option.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2020-11-11 11:58:28 +09:00
Ingo Klöcker
0fee135997 qt: Make audit parameters of result signal optional
lang/qt/src/quickjob.h (QuickJob::result): Make parameters
auditLogAsHtml and audigLogError optional.
--

This aligns the signature of QuickJob's result signal with the result
signals of the other Job subclasses.

GnuPG-bug-id: 5094
2020-11-03 13:50:53 +01:00
Ingo Klöcker
f042739d3a qt: Add support for revoke signature quick command
* lang/qt/src/quickjob.h (QuickJob::startRevokeSignature): New.
* lang/qt/src/qgpgmequickjob.h, lang/qt/src/qgpgmequickjob.cpp
(QGpgMEQuickJob::startRevokeSignature): New.
* lang/qt/src/qgpgmequickjob.cpp (revokeSignatureWorker): New.
--

GnuPG-bug-id: 5094
2020-10-29 12:57:10 +01:00
Ingo Klöcker
60328c4690 qt: Some minor cleanups
* lang/qt/src/qgpgmequickjob.h: (GpgME::Key, QDateTime, QString):
Remove superfluous forward declarations.
(QGpgMEQuickJob): Remove superfluous second template argument. It is
identical to the default.
(QGpgMEQuickJob::result): Remove. It is already defined in the base
class.
2020-10-29 12:57:10 +01:00
Ingo Klöcker
b21cabb311 qt: Add QDebug stream operator for GpgME::Error
* lang/qt/src/Makefile.am: Add new files.
* lang/qt/src/debug.h, lang/qt/src/debug.cpp: New.
* NEWS: Mention it.
--

This was previously implemented in Kleopatra, but it makes sense for
all users of qgpgme.
2020-10-23 13:50:16 +02:00
Ingo Klöcker
c3406462d1 cpp, qt: Add missing comparison operators for version info comparison
* lang/cpp/src/engineinfo.h (EngineInfo::Version::operator<=,
EngineInfo::Version::operator>=, EngineInfo::Version::operator!=):
New.
* lang/qt/tests/t-various.cpp (TestVarious::testVersion): Add tests for
new comparison operators.
* NEWS: Mention added API
2020-10-23 13:50:16 +02:00
Ingo Klöcker
2f53a2f4be cpp, qt: Fix version info comparison
* lang/cpp/src/engineinfo.h
(EngineInfo::Version::operator>(const Version &)): Fix logic.
(EngineInfo::Version::operator>(const char *)): Use Version-overload of
operator>.

* lang/qt/tests/t-various.cpp: Add test.
--

This fixes a logic error that 2.0.0 > 2.0.0 would return true.
2020-10-23 13:50:16 +02:00
Ingo Klöcker
973c8116c8 qt: Update the documentation of ListAllKeysJob
* lang/qt/src/listallkeysjob.h (ListAllKeysJob::start): Document that
the mergeKeys argument is ignored with gpg >= 2.1.
--

GnuPG-bug-id: 4794
2020-09-08 15:38:00 +02:00
Ingo Klöcker
13bcc6680a qt: List keys once with --with-secret instead of twice
* lang/qt/src/qgpgmelistallkeysjob.cpp
(do_list_keys): Rename to do_list_keys_legacy and put into unnamed
namespace.
(merge_keys): Put into unnamed namespace.
(list_keys): Rename to list_keys_legacy and put into unnamed namespace.
(do_list_keys, list_keys): New.
* lang/qt/tests/t-keylist.cpp (testListAllKeysSync): New.
--

With gpg >= 2.1, list keys once with --with-secret instead of listing
public keys and secret keys and then merging (part of) the information
about the keys.

GnuPG-bug-id: 4794
2020-09-07 12:02:29 +02:00
Werner Koch
b088d81cef
qt: Fix an rfc2253 parser flaw
* lang/qt/src/dn.cpp (parse_dn_part): Fix parser.

--

This could in theory result in reading bytes after a after Nul in a
string and thus possible segv on unallocated memory or reading other
parts of the memory.  However, it is harmless because the rfc2253
strings have been received from GnuPG which is expected to emit
correct syntax.

GnuPG-bug-id: 5037
2020-08-28 09:13:35 +02:00
Ingo Klöcker
f66f856c89 core: Add error handling to setexpire
* src/genkey.c (setexpire, gpgme_op_setexpire_start,
gpgme_op_setexpire): Move to ...
* src/setexpire.c: New.
* src/Makefile.am (main_sources): Add that file.
* src/context.h (ctx_op_data_id_t): Add OPDATA_SETEXPIRE.

* lang/qt/tests/t-various.cpp (testSetExpire): Test error handling.
--

Errors (and failures) emitted via status-fd need to be handled
explicitly, i.e. we need to provide an appropriate status handler with
corresponding op_data_t. Additionally, we need to set a passphrase
command handler if a passphrase callback is set in the context, e.g.
during tests.

GnuPG-bug-id: 4395
2020-08-14 11:11:23 +02:00
Ingo Klöcker
4f2cd3a0c6 qt: Support changing expiry of subkeys
* lang/qt/src/changeexpiryjob.h (ChangeExpiryJob::start): New overload
that accepts subkeys (with empty implementation).
* lang/qt/src/qgpgmechangeexpiryjob.h,
lang/qt/src/qgpgmechangeexpiryjob.cpp (QGpgMEChangeExpiryJob::start):
New overload that accepts subkeys.
--

This adds the possibility to change the expiry of subkeys.

GnuPG-bug-id: 4717
2020-08-11 17:02:25 +02:00
Ingo Klöcker
8950150913 qt: Port to new setExpire()
* lang/qt/src/qgpgmechangeexpiryjob.cpp (change_expiry): Use new
setExpire() instead of edit() with GpgSetExpiryTimeEditInteractor
--

Using the new setExpire() (which uses --quick-set-expire) is a lot less
complex than using gpg's edit interface. It also feels faster. Next,
I'll add support for changing the expiration time of subkeys.

GnuPG-bug-id: 5003
2020-08-05 16:49:18 +02:00
Ingo Klöcker
84c6b6e2fe qt: Add test for setExpire
* lang/qt/tests/t-various.cpp (TestVarious::testSetExpire): New.
--

GnuPG-bug-id: 5003
2020-08-04 16:53:57 +02:00
Andre Heinecke
690d967196
qt, cpp: Support export modes
* lang/cpp/context.cpp, lang/cpp/context.h
(Context::startPublicKeyExport, Context::exportPublicKeys): Extend
with flags paramenter.
(Context::ExportMode): New.
* lang/qt/src/exportjob.h (ExportJob::setExportMode): New.
* lang/qt/src/qgpgmeexportjob.cpp, lang/qt/src/qgpgmeexportjob.h:
Update accordingly.

--
This adds the C++ and Qt API for export modes.
2020-07-16 17:00:28 +02:00
NIIBE Yutaka
0cc040e82f tests: Remove/change tests for GnuPG 2.3 with no gpg.keyserver.
* lang/qt/tests/t-config.cpp (testKeyserver): Remove.
* tests/gpg/t-gpgconf.c (main): Test with dirmngr.keyserver.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2020-05-11 14:20:48 +09:00
Andre Heinecke
ec9690cf5c
qt: Change logging category
* lang/qt/src/*: Change logging category to macro to QGPGME_LOG.

--
The old logging category macro had a typo and this way we
are more consistent with other logging rules. For example
you could write gpg.* in the logging conf.
2020-02-19 11:15:54 +01:00
Andre Heinecke
ba08aadfa7
qt: Log execution args of gpg-card
* lang/qt/src/qgpgmegpgcardjob.cpp (do_work): Log call.
2020-02-19 11:15:54 +01:00
Andre Heinecke
9ca679c150
qt: Add dummy context to make mixin happy
* lang/qt/qgpgmegpgcardjob.cpp (QGpgMEGpgCardJob): Add context.
--
Otherwise it fails with an assert.
2020-02-12 15:50:36 +01:00
Andre Heinecke
77feaa4510
qt: Add GpgCardJob following the job pattern
* lang/qt/src/Makefile.am: Add new files.
* lang/qt/src/job.cpp (GpgCardJob): Add impl stuff.
* lang/qt/src/protocol.h (gpgCardJob): Get one.
* lang/qt/src/qgpgmebackend.cpp,
lang/qt/src/qgpgmebackend.h: Add helpers to get the job.
* lang/qt/src/qgpgmegpgcardjob.cpp,
lang/qt/src/gpgcardjob.h,
lang/qt/src/qgpgmegpgcardjob.h: New.

--
This is annoyingly complex to add a simple new job.
In the future we should implement something like this
without the threadedjobmixin stuff. But the idea was
to follow the usual job pattern.

GnuPG-Bug-Id: T4794
2020-02-12 11:57:09 +01:00
Andre Heinecke
194272dbc3
cpp, qt: Use uidhash to select uids for signing
* lang/cpp/src/gpgsignkeyeditinteractor.cpp (action):
Use uidhash instead of number.
(GpgSignKeyEditInteractor::setKey): New.
* lang/cpp/src/gpgsignkeyeditinteractor.h: Update accordingly.
* lang/cpp/src/key.h, lang/cpp/src/key.cpp: Wrap uidhash.
* lang/qt/src/qgpgmesignkeyjob.cpp: Set the key.

--
Using the uidhash avoids problems when the user ids
on --edit-key are different ones then the uids
captured by gpgme when listing keys. Or if
they are in a different order. This can happen
with cached keys or keys with user attributes.
2019-12-13 18:06:00 +01:00
NIIBE Yutaka
c493242007 qt,tests: Take care for old DSA key using deprecated digest algo.
* lang/qt/tests/t-remarks.cpp (initTestCase): Supply
allow-weak-key-signatures flag for GnuPG 2.3, which
normally rejects use of SHA1 digest.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-11-08 08:07:33 +09:00
Andre Heinecke
e7b5c6405d
qt, tests: Add check for supported versions
* lang/qt/tests/t-encrypt.cpp (decryptSupported): Moved to
t-support as loopbackSupported.
* lang/qt/tests/t-remarks.cpp: Check for loopbackSupported.
* lang/qt/tests/t-support.cpp, lang/qt/tests/t-support.h
(loopbackSupported): New.

--
This ensures that the tests do not fail with GnuPG 2.0.x
2019-11-06 09:21:02 +01:00
Andre Heinecke
024edbbd3c
qt, tests: Replace accidentally commited assert
* lang/qt/test/t-remarks.cpp (testRemarkReplaceSingleUIDExportable):
Use QVERIFY instead of assert.

--
An assert causes the temp directory not to be cleaned up. I
use this to analyze test failures.
If you want to see the tests home directory after a failure you
can just change a failing verify to an assert.
2019-11-06 09:12:09 +01:00
Andre Heinecke
a56f6015e9
qt,tests: Add test to add an exportable certify
* lang/qt/test/t-remarks.cpp (testRemarkReplaceSingleUIDExportable):
New.

--
Just checking in case the edit-key offers new states for that.
2019-11-06 09:10:03 +01:00
Andre Heinecke
9cf4db1e52
qt, tests: Add testcase for multiple remarsk
* lang/qt/tests/t-remarks.cpp (testMultipleRemarks): New.
2019-11-04 13:56:14 +01:00
Andre Heinecke
db888b1cc0
qt,tests: Move remarks test out and extend it
* lang/qt/tests/t-various.cpp (testRemarks): Move out.
* lang/qt/tests/t-remarks.cpp: New.
* lang/qt/tests/Makefile.am: Update accordingly.
--
While t-various is nice to add a quick test for more
extensive stuff it is better to move it in its own test.

This also tests with a key that has only a single uid.
2019-11-04 11:18:35 +01:00
Andre Heinecke
d61491dd25
qt: Allow adding empty remarks
* lang/qt/src/qgpgmesignkeyjob.cpp (sign_key): Allow empty
remarks.
2019-11-01 12:05:47 +01:00
Andre Heinecke
1f3ca698f1
qt,tests: Add test for remarks
* lang/qt/tests/t-various.cpp (testRemark): New.
2019-10-29 16:36:45 +01:00
Andre Heinecke
373acd6923
qt: Extend signkeyjob to handle remarks and dups
* lang/qt/src/qgpgmesignkeyjob.cpp: Handle remarks and
dupeOK.
* lang/qt/src/signkeyjob.h (SignKeyJob::setDupeOk),
(SignKeyJob::setRemark): New.

--
This API makes it easy for Kleopatra to add remarks for:
GnuPG-Bug-Id: T4734
2019-10-29 16:33:58 +01:00
Andre Heinecke
47369569e2
qt: Handle diagnostic audit log for CMS
* lang/qt/src/threadedjobmixin.cpp(_detail::audit_log_as_html):
Handle CMS audit log.
2019-03-20 09:56:38 +01:00
NIIBE Yutaka
66bcb8acb2 build: With LD_LIBRARY_PATH defined, use --disable-new-dtags.
* configure.ac (LDADD_FOR_TESTS_KLUDGE): New for --disable-new-dtags.
* tests/Makefile.am (LDADD): Use LDADD_FOR_TESTS_KLUDGE.
* lang/cpp/tests/Makefile.am, lang/qt/tests/Makefile.am: Likewise.
* tests/gpg/Makefile.am, tests/gpgsm/Makefile.am: Likewise.
* tests/json/Makefile.am, tests/opassuan/Makefile.am: Likewise.

--

GnuPG-bug-id: 4298
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-01-16 10:59:25 +09:00
Andre Heinecke
66376f3e20
qt: Use tofu conflict test keys without expiry
* lang/qt/tests/t-tofuinfo.cpp: Use new test keys without
expiry.

--
The old keys expired on 2019-01-06.

GnuPG-Bug-Id: T3815
2019-01-09 08:26:25 +01:00
Andre Heinecke
1d31420650
qt,cpp: Consistently use nullptr and override
* lang/cpp/src/Makefile.am, lang/qt/src/Makefile.am (AM_CPPFLAGS):
Add suggest-override and zero-as-null-pointer-constant warnings.

* lang/cpp/src/*, lang/qt/src/*: Consistenly use nullptr and override.

--
This was especially important for the headers so that downstream
users of GpgME++ or QGpgME do not get flooded by warnings if
they have these warnings enabled.

It also improves compiler errors/warnings in case of accidental
mistakes.
2018-12-03 12:25:00 +01:00
Werner Koch
8d91c0f4cd
Add SPDX identifiers to most source files
--

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-11-16 13:27:33 +01:00
Daniel Kahn Gillmor
2557d0ae6f spelling: fix misspellings
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2018-11-08 12:34:27 +07:00
Daniel Kahn Gillmor
2f12427e41 doc: use https:// for www.gnu.org
--

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2018-10-18 00:28:51 -04:00
Andre Heinecke
bf4aae4512
qt, tests: Add test for single get key
* lang/qt/tests/t-keylist.cpp (testGetKey): New.

--
Added this to check if there was a memleak in that function.
2018-10-09 09:37:28 +02:00
Werner Koch
1aff2512d8
Release 1.12.0
* configure.ac: Bump core LT version to C32/A21/R0.  Bump C++ LT
version to C14/A8/R0.

* lang/qt/tests/Makefile.am (CLEANFILES): Add reader status files.
* Makefile.am (EXTRA_DIST): Add conf/whatisthis.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-10-08 11:17:01 +02:00
Andre Heinecke
d09d19fa9f
Make GNUPGHOME for tests overridable
* lang/python/tests/Makefile.am,
lang/qt/tests/Makefile.am,
tests/Makefile.am,
tests/gpg/Makefile.am,
tests/gpgsm/Makefile.am,
tests/opassuan/Makefile.am (GNUPGHOME): Make variable explict.

--
If the build directory has too long path, gpgme could fail.
This is similar to

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=847206

In order to fix that, this patch extracts the GNUPGHOME variable
to be presented directly in the Makefile and thus overridable by
command line option.

A build system can then create a symlink to the GNUPGHOME directory
in /tmp and use that symlink as the GNUPGHOME directory
thus making the path very short.

GnuPG-Bug-Id: T4091

Patch provided by vlmarek
2018-08-06 09:30:47 +02:00
Andre Heinecke
16462c54b3
qt: Handle encoding for diagnostics
* lang/qt/src/threadedjobmixin.cpp (fromEncoding)
(stringFromGpgOutput): New helpers.
(markupDiagnostics): Use it.

--
The Problem is that on my western windows system GnuPG
gets CP 437 as GetConsoleOutputCP and prints in that codepage.
In a W32 GUI Application we get 0 as GetConsoleOutputCP and 1252
with GetACP.

The only thing that seemed to somehow match was GetOEMCP but
that might just be luck and it might still be broken in
other windows languages.

This code is also used in Kleopatra so it might make sense
to make it public once it is demonstrated that it works on
most systems.
2018-07-18 11:27:46 +02:00
Andre Heinecke
66c2a99422
qt: Handle OpenPGP Diagnostic log
* lang/qt/src/threadedjobmixin.cpp (_detail::audit_log_as_html):
Handle OpenPGP audit log differently.
2018-07-05 11:29:36 +02:00
Andre Heinecke
618aa7f08d
cpp: Add gpgme_data_rewind to cpp API
* lang/cpp/src/data.h, lang/cpp/src/data.cpp (Data::rewind): New.
* lang/qt/tests/t-various.cpp (testDataRewind): Test it.

--
The advantage of this convieniance function in GPGME is that
it avoids the messiness that are declarations with off_t.

GnuPG-Bug-Id: T3996
2018-05-29 09:19:50 +02:00
Andre Heinecke
26820ba629
qt: Respect --disable-gpg-test for tests
* lang/qt/Makefile.am: Respect --disable-gpg-test

--
This is similar to the core switch to disable the tests.
2018-05-04 10:03:42 +02:00
Andre Heinecke
6b267c56fd
qt: Fix filename handling in cryptoconfig
* src/qgpgmenewcryptoconfig.cpp (QGpgMENewCryptoConfigEntry::urlValue):
Build url from local file.
(QGpgMENewCryptoConfigEntry::setURLValue): Set native seperated
path.

--
This fixes setting files through cryptoconfig on Windows.
GnuPG-Bug-Id: T3939
2018-04-26 14:11:19 +02:00
Andre Heinecke
5eb261d602
qt: Add test for resetting config value
* lang/qt/tests/t-config.cpp (CryptoConfigTest::testDefault): New.

--
There is a bug around here somewhere. This test does not show
it :-(
2018-04-04 11:21:53 +02:00
NIIBE Yutaka
b5ec21b9ba tests: Makefile portability.
* tests/gpg/Makefile.am: Don't use "export" directive.
* tests/gpgsm/Makefile.am: Ditto.
* lang/qt/tests/Makefile.am: Ditto.
* lang/python/tests/Makefile.am: Ditto.

--

GnuPG-bug-id: 3056
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2018-02-15 11:14:49 +09:00
Andre Heinecke
b61d0fbb74
qt: Don't use QDateTime::toSecsSinceEpoch
* lang/qt/src/qgpgmequickjob.cpp (addSubkeyWorker)
(createWorker): Use toMSecsSinceEpoch instead toSecsSinceEpoch.

--
toSecsSinceEpoch was only introduced in Qt 5.8.
2017-12-11 17:08:38 +01:00
Andre Heinecke
7b5182f288
Spelling fixes for comments and doc
--
Patch provided by ka7 in dev.gnupg.org

Differential D423
2017-12-08 05:59:11 +01:00
Andre Heinecke
7d1ac5d61d
qt: Add job for quick commands
* lang/qt/src/qgpgmequickjob.cpp,
lang/qt/src/qgpgmequickjob.h,
lang/qt/src/quickjob.h: New.
* lang/qt/src/Makefile.am,
lang/qt/src/protocol.h,
lang/qt/src/protocol_p.h,
lang/qt/src/job.cpp: Update accordingly.

--
Keeping it in line with the Job for everything pattern.
Although it's reduced to one job for four commands as
the commands all behave the same.
2017-12-01 14:35:11 +01:00
Andre Heinecke
56b27b21d5
qt: Fix IODeviceDataProvider with Process
* lang/qt/src/dataprovider.cpp (blocking_read): Keep
reading if process is not atEnd.

--
This fixes a regression in Kleopatra that uses this dataprovider
to chain the gpgtar process to the encryption / signing.
2017-11-14 14:28:32 +01:00
Andre Heinecke
bd5d470cef
qt: Add test for version info
* lang/qt/tests/t-various.cpp (TestVarious::testVersion): New.

--
If it's not tested it does not work ;-)
2017-09-04 11:25:34 +02:00
Justus Winter
a226eca846
tests: Make sure to kill all previously running daemons.
* lang/python/tests/Makefile.am: Kill all previously running daemons
before creating the private key store.
* lang/qt/tests/Makefile.am: Likewise.
* tests/gpg/Makefile.am: Likewise.
* tests/gpgsm/Makefile.am: Likewise.
--

Now that the daemons sockets are no longer created in the GNUPGHOME,
we cannot rely on cleaning the build directory to make sure they are
shut down.  Therefore, we explicitly kill any running daemons when
creating the test environment.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-05-10 15:52:12 +02:00
Justus Winter
093b5497b7
qt: Stop agent on clean.
* lang/qt/tests/Makefile.am (clean-local): Stop agent.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-05-10 15:23:56 +02:00
Andre Heinecke
5e27bf98b4
qt: Add a missing include <functional>
* lang/qt/src/qgpgmenewcryptoconfig.cpp: Include functional.

--
This is intended to fix compilation against the c++ stdlib from
Gentoo / GCC 7.

Patch provided by Martin Väth.
GnuPG-Bug-Id: T3151
2017-05-10 10:24:18 +02:00
Andre Heinecke
cc2ef3d07c
qt: Undeprecate API that I find useful
* lang/qt/src/decryptjob.h,
lang/qt/src/decryptverifyjob.h,
lang/qt/src/signencryptjob.h,
lang/qt/src/verifydetachedjob.h,
lang/qt/src/verifyopaquejob.h: Undeprecate ByteArray based API.

--
While an IODevice may be more performant the ByteArray API is
a very easy way to get started with QGpgME as it allows you
basically to encrypt / decrypt any QString.

This also fixes a ton of deprecation warnings in KDE where this
API is used all over the place.
2017-05-10 10:22:23 +02:00
Andre Heinecke
b56f398eff
qt, tests: Don't use internal API
* lang/qt/tests/t-encrypt.cpp, lang/qt/tests/t-tofuinfo.cpp:
Only use exported API.

--
With the Job::Context hack we no longer need to use internal API.
2017-05-10 10:18:41 +02:00
Andre Heinecke
28734240e2
qt, cpp: Add additional copyright BSI notes
* lang/cpp/Makefile.am,
lang/cpp/src/Makefile.am,
lang/cpp/src/callbacks.cpp,
lang/cpp/src/callbacks.h,
lang/cpp/src/configuration.cpp,
lang/cpp/src/configuration.h,
lang/cpp/src/context_glib.cpp,
lang/cpp/src/context_p.h,
lang/cpp/src/context_qt.cpp,
lang/cpp/src/context_vanilla.cpp,
lang/cpp/src/data_p.h,
lang/cpp/src/decryptionresult.cpp,
lang/cpp/src/decryptionresult.h,
lang/cpp/src/defaultassuantransaction.cpp,
lang/cpp/src/defaultassuantransaction.h,
lang/cpp/src/editinteractor.cpp,
lang/cpp/src/editinteractor.h,
lang/cpp/src/encryptionresult.cpp,
lang/cpp/src/encryptionresult.h,
lang/cpp/src/engineinfo.cpp,
lang/cpp/src/engineinfo.h,
lang/cpp/src/error.h,
lang/cpp/src/eventloopinteractor.cpp,
lang/cpp/src/eventloopinteractor.h,
lang/cpp/src/exception.cpp,
lang/cpp/src/exception.h,
lang/cpp/src/global.h,
lang/cpp/src/gpgadduserideditinteractor.cpp,
lang/cpp/src/gpgadduserideditinteractor.h,
lang/cpp/src/gpgagentgetinfoassuantransaction.cpp,
lang/cpp/src/gpgagentgetinfoassuantransaction.h,
lang/cpp/src/gpgmefw.h,
lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp,
lang/cpp/src/gpgsetexpirytimeeditinteractor.h,
lang/cpp/src/gpgsetownertrusteditinteractor.cpp,
lang/cpp/src/gpgsetownertrusteditinteractor.h,
lang/cpp/src/gpgsignkeyeditinteractor.cpp,
lang/cpp/src/gpgsignkeyeditinteractor.h,
lang/cpp/src/importresult.cpp,
lang/cpp/src/importresult.h,
lang/cpp/src/interfaces/assuantransaction.h,
lang/cpp/src/interfaces/dataprovider.h,
lang/cpp/src/interfaces/passphraseprovider.h,
lang/cpp/src/interfaces/progressprovider.h,
lang/cpp/src/keygenerationresult.cpp,
lang/cpp/src/keygenerationresult.h,
lang/cpp/src/keylistresult.cpp,
lang/cpp/src/keylistresult.h,
lang/cpp/src/notation.h,
lang/cpp/src/result.h,
lang/cpp/src/result_p.h,
lang/cpp/src/scdgetinfoassuantransaction.cpp,
lang/cpp/src/scdgetinfoassuantransaction.h,
lang/cpp/src/signingresult.cpp,
lang/cpp/src/signingresult.h,
lang/cpp/src/trustitem.cpp,
lang/cpp/src/trustitem.h,
lang/cpp/src/util.h,
lang/cpp/src/verificationresult.cpp,
lang/cpp/src/verificationresult.h,
lang/cpp/src/vfsmountresult.cpp,
lang/qt/Makefile.am,
lang/qt/doc/Makefile.am,
lang/qt/src/Makefile.am,
lang/qt/src/defaultkeygenerationjob.h,
lang/qt/tests/Makefile.am: Add missing copyright.

--
Moving the qt / cpp bindings into GPGME contained global
changes that modified nearly every source file. To reflect
that the copyright year / note should also be updated.
2017-04-25 13:03:49 +02:00
Andre Heinecke
7003583432
Change copyright from Intevation to BSI
* lang/cpp/src/gpggencardkeyinteractor.cpp,
lang/cpp/src/gpggencardkeyinteractor.h,
lang/cpp/src/gpgmepp_export.h,
lang/cpp/src/swdbresult.cpp,
lang/cpp/src/swdbresult.h,
lang/cpp/src/tofuinfo.cpp,
lang/cpp/src/tofuinfo.h,
lang/qt/src/abstractimportjob.h,
lang/qt/src/adduseridjob.h,
lang/qt/src/changeexpiryjob.h,
lang/qt/src/changeownertrustjob.h,
lang/qt/src/changepasswdjob.h,
lang/qt/src/cryptoconfig.cpp,
lang/qt/src/cryptoconfig.h,
lang/qt/src/dataprovider.cpp,
lang/qt/src/dataprovider.h,
lang/qt/src/decryptjob.h,
lang/qt/src/decryptverifyjob.h,
lang/qt/src/deletejob.h,
lang/qt/src/dn.cpp,
lang/qt/src/dn.h,
lang/qt/src/downloadjob.h,
lang/qt/src/encryptjob.h,
lang/qt/src/exportjob.h,
lang/qt/src/hierarchicalkeylistjob.h,
lang/qt/src/importfromkeyserverjob.h,
lang/qt/src/importjob.h,
lang/qt/src/job.cpp,
lang/qt/src/job.h,
lang/qt/src/keyformailboxjob.h,
lang/qt/src/keygenerationjob.h,
lang/qt/src/keylistjob.h,
lang/qt/src/listallkeysjob.h,
lang/qt/src/multideletejob.h,
lang/qt/src/protocol.h,
lang/qt/src/protocol_p.h,
lang/qt/src/qgpgme_export.h,
lang/qt/src/qgpgmeadduseridjob.cpp,
lang/qt/src/qgpgmeadduseridjob.h,
lang/qt/src/qgpgmebackend.cpp,
lang/qt/src/qgpgmebackend.h,
lang/qt/src/qgpgmechangeexpiryjob.cpp,
lang/qt/src/qgpgmechangeexpiryjob.h,
lang/qt/src/qgpgmechangeownertrustjob.cpp,
lang/qt/src/qgpgmechangeownertrustjob.h,
lang/qt/src/qgpgmechangepasswdjob.cpp,
lang/qt/src/qgpgmechangepasswdjob.h,
lang/qt/src/qgpgmedecryptjob.cpp,
lang/qt/src/qgpgmedecryptjob.h,
lang/qt/src/qgpgmedecryptverifyjob.cpp,
lang/qt/src/qgpgmedecryptverifyjob.h,
lang/qt/src/qgpgmedeletejob.cpp,
lang/qt/src/qgpgmedeletejob.h,
lang/qt/src/qgpgmedownloadjob.cpp,
lang/qt/src/qgpgmedownloadjob.h,
lang/qt/src/qgpgmeencryptjob.cpp,
lang/qt/src/qgpgmeencryptjob.h,
lang/qt/src/qgpgmeexportjob.cpp,
lang/qt/src/qgpgmeexportjob.h,
lang/qt/src/qgpgmeimportfromkeyserverjob.cpp,
lang/qt/src/qgpgmeimportfromkeyserverjob.h,
lang/qt/src/qgpgmeimportjob.cpp,
lang/qt/src/qgpgmeimportjob.h,
lang/qt/src/qgpgmekeyformailboxjob.cpp,
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/qgpgmerefreshkeysjob.cpp,
lang/qt/src/qgpgmerefreshkeysjob.h,
lang/qt/src/qgpgmesecretkeyexportjob.cpp,
lang/qt/src/qgpgmesecretkeyexportjob.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/qgpgmesignkeyjob.h,
lang/qt/src/qgpgmetofupolicyjob.cpp,
lang/qt/src/qgpgmetofupolicyjob.h,
lang/qt/src/qgpgmeverifydetachedjob.cpp,
lang/qt/src/qgpgmeverifydetachedjob.h,
lang/qt/src/qgpgmeverifyopaquejob.cpp,
lang/qt/src/qgpgmeverifyopaquejob.h,
lang/qt/src/qgpgmewkspublishjob.cpp,
lang/qt/src/qgpgmewkspublishjob.h,
lang/qt/src/refreshkeysjob.h,
lang/qt/src/signencryptjob.h,
lang/qt/src/signjob.h,
lang/qt/src/signkeyjob.h,
lang/qt/src/specialjob.h,
lang/qt/src/threadedjobmixin.cpp,
lang/qt/src/threadedjobmixin.h,
lang/qt/src/tofupolicyjob.h,
lang/qt/src/verifydetachedjob.h,
lang/qt/src/verifyopaquejob.h,
lang/qt/src/wkspublishjob.h,
lang/qt/tests/run-keyformailboxjob.cpp,
lang/qt/tests/t-config.cpp,
lang/qt/tests/t-encrypt.cpp,
lang/qt/tests/t-keylist.cpp,
lang/qt/tests/t-keylocate.cpp,
lang/qt/tests/t-ownertrust.cpp,
lang/qt/tests/t-support.cpp,
lang/qt/tests/t-support.h,
lang/qt/tests/t-tofuinfo.cpp,
lang/qt/tests/t-various.cpp,
lang/qt/tests/t-verify.cpp,
lang/qt/tests/t-wkspublish.cpp,
tests/gpg/t-encrypt-mixed.c,
tests/gpg/t-thread-keylist-verify.c,
tests/gpg/t-thread-keylist.c,
tests/run-decrypt.c: Change Intevation GmbH copyright to BSI.

--
This should make it more transparent where the BSI is the actual
copyright holder as the code was mostly developed as part of a
development contract.
2017-04-25 10:24:11 +02:00
Alon Bar-Lev
ebefc6cbf9
tests: Do not use check-local magic as dependency
* tests/gpg/Makefile.am: Use BUILT_SOURCES instead of check-local
and initial.test.
* lang/qt/tests/Makefile.am: Ditto.

--

This fixes "make dist" failure when source tree is clean:
  git clean -dxf
  autoreconf -ivf
  ./configure
  make dist

BUILT_SOURCES should be used when file as generated without explicit
dependency. The check-local is all-am dependency, this means that it
will be resolved also in "make dist".

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2017-04-10 14:42:10 +02:00
Igor Gnatenko
5d4f977dac
qt: pass fmt to gpgrt_asprintf()
* lang/qt/src/dn.cpp (parse_dn_part): Add fmt argument instead of
using name directly.

GnuPG-Bug-Id: 3023
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
2017-04-03 12:03:48 +02:00
Andre Heinecke
2c063a8d60
qt: Handle if gpg does not support tofu in test
* lang/qt/src/t-tofuinfo.cpp (TestTofuInfo::testSupported): Treat
it as unsupported if secret keylisting already fails.

--
The likely cause of this is that the agent can't be started
because the trust model is unsupported. Other tests check
that keylisting actually works.
2017-03-30 14:44:42 +02:00
Andre Heinecke
a2ccb31728
Revert "qt: Disable testEncryptDecryptNowrap"
This reverts commit 57d60b20f1.
2017-03-28 12:34:28 +02:00
Andre Heinecke
57d60b20f1
qt: Disable testEncryptDecryptNowrap
* lang/qt/tests/t-encrypt.cpp (EncryptTest::testEncryptDecryptNowrap):
Disable test.

--
This test produces failures under CI/ASAN conditions as the
verify after the unwrap returns an error. As we currently
don't have time to look into this more it's disabled for now.
Similar to the testMixedEncryptDecrypt.
2017-03-27 18:11:02 +02:00
Andre Heinecke
5493164f86
qt: Add unittest for decrypt unwrap
* lang/qt/tests/t-encrypt.cpp
(EncryptTest::testEncryptDecryptNowrap): New.
2017-03-24 16:58:58 +01:00
Andre Heinecke
66c334650b
qt: Add test for Data::toKeys
* lang/qt/tests/t-various.cpp (TestVarious::testKeyFromFile): New.
2017-03-22 16:43:33 +01:00
Andre Heinecke
121873b821
qt: Initialize library first in tests
* lang/qt/tests/t-support.cpp (QGpgMETest::initTestCase): Initialize
library.
2017-03-22 16:43:33 +01:00
Andre Heinecke
43aa3eed15
qt: Add test for DN parser
* qt/tests/t-various.cpp (testDN): New.

--
A simple test for the DN parser that would have caught
the new / free mismatch fixed in 9d5048d4.
2017-03-13 11:18:00 +01:00
Andre Heinecke
9d5048d474
qt: Use gpgrt_asprintf instead of qstrdup
* lang/qt/src/dn.cpp (parse_dn_part): Use gpgrt_asprintf instead
of qstrdup.

--
This fixes a new / free mismatch because qstrdup uses new and
the allocated parts are freed with free. Similar to: a09ed3f2
2017-03-13 11:17:47 +01:00
Andre Heinecke
fbafb5474d
qt: Allow creation of default keys without name
* lang/qt/src/defaultkeygenerationjob.cpp
(DefaultKeyGenerationJob::start): Handle empty name and email.
2017-03-01 11:14:07 +01:00
Justus Winter
30a603580e
qt: Make sure to remove the tofu.db on clean.
* lang/qt/tests/Makefile.am (CLEANFILES): Add 'tofu.db'.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-02-14 12:45:15 +01:00
Igor Gnatenko
60064c665e qt: Add missing #include <functional>
* lang/qt/src/qgpgmenewcryptoconfig.cpp,
lang/qt/src/threadedjobmixin.h: Include functional.

--
With GCC 7.0, functional is not included transitively and we get:
In file included from qgpgmedeletejob.h:39:0,
                 from qgpgmedeletejob.cpp:38:
threadedjobmixin.h:98:33: error: 'function' in namespace 'std'
    does not name a template type
     void setFunction(const std::function<T_result()> &function)
                                 ^~~~~~~~

std::{function,bind,placeholders,mem_fn} are defined in functional.

References: https://bugzilla.redhat.com/show_bug.cgi?id=1417383
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>

GnuPG-Bug-Id: 2955

Commit Message amended by Andre Heinecke

Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
2017-02-13 10:37:18 +01:00
Andre Heinecke
903bf16a41 qt: Don't rely on implicit include in t-verify
* lang/qt/tests/t-various.cpp: Include QTemporaryDir

--
This fixes build with some Qt Versions
2017-02-07 10:01:58 +01:00
Andre Heinecke
43160a39f2 qt: Add test for tofu conflict
* lang/qt/tests/t-tofuinfo.cpp (TofuInfoTest::testTofuConflict): New.
2017-02-02 17:16:27 +01:00
Justus Winter
ba594d85e3 qt: Increase timeout when waiting for signals.
* lang/qt/tests/t-support.h (QSIGNALSPY_TIMEOUT): New macro.
* lang/qt/tests/t-encrypt.cpp: Use the new macro as timeout when
waiting for signals.
* lang/qt/tests/t-keylist.cpp: Likewise.
* lang/qt/tests/t-keylocate.cpp: Likewise.
* lang/qt/tests/t-ownertrust.cpp: Likewise.
* lang/qt/tests/t-wkspublish.cpp: Likewise.
--
Increase the timeout when waiting for signals from 5 seconds to 60.
This addresses intermittent test failures on slow machines.

Signed-off-by: Justus Winter <justus@g10code.com>
2017-01-31 10:47:00 +01:00
Andre Heinecke
abfd241d1a qt: Use QVERIFY instead of Q_ASSERT in conf test
* lang/qt/tests/t-config.cpp: Use QVERIFY instead of Q_ASSERT.
2017-01-16 14:16:20 +01:00
Andre Heinecke
8aba08d1d0 qt: Add test for CryptoConfig
* lang/qt/tests/t-config.cpp: New.
* lang/qt/tests/Makefile.am: Update accordingly.
2017-01-16 14:13:39 +01:00
Andre Heinecke
9640dc58e4 qt: Add support for stringValueList in CryptoConf
* lang/qt/src/Makefile.am (qgpgme_sources): Add cryptoconfig.cpp
* lang/qt/src/cryptoconfig.cpp: New.
* lang/qt/src/cryptoconfig.h (CryptoConfigEntry::stringValueList):
New.
* lang/qt/src/qgpgmenewcryptoconfig.cpp
(QGpgMENewCryptoConfigEntry::stringValueList): New.
* lang/qt/src/qgpgmenewcryptoconfig.h: Update accordingly.

--
This is a pardigm change in cryptoconfig.h to avoid ABI breaks
with each new config value we support it now has an implementation
that is directly related to qgpgmenewcryptoconfig, which is now
the only one.
2017-01-12 12:57:00 +01:00
Andre Heinecke
a09ed3f26a qt: Don't use qstrdup in test passphrase cb
* lang/qt/tests/t-support.h (TestPassphraseProvider::getPassphrase):
Use gpgrt_asprintf instead of strdup.

--
To avoid problems on MacOS we want to avoid strdup so that
qgpgme can be built without extensions. But qstrdup allocates
with new and not with malloc, so use gpgrt_asprintf instead.
2017-01-12 11:44:11 +01:00
Andre Heinecke
56926c9b50 qt: Clean up test dirs on failure
* t-encrypt.cpp,
t-keylist.cpp,
t-keylocate.cpp,
t-ownertrust.cpp,
t-tofuinfo.cpp,
t-various.cpp,
t-verify.cpp,
t-wkspublish.cpp: Use QVERIFY instead of Q_ASSERT
2017-01-11 16:20:31 +01:00
Andre Heinecke
9e643ab671 qt: Add test for uid functions
* lang/qt/tests/t-various.cpp: New.
* lang/qt/tests/Makefile.am: Update accordingly.
2017-01-11 16:18:17 +01:00
Andre Heinecke
efe58fe011 Fix Qgpgme build for macos
* lang/qt/src/dn.cpp: Include string.h
(parse_dn_part): Use qstrdup.
* lang/qt/tests/t-support.h (getPassphrase): Use qstrdup.
2017-01-11 15:52:44 +01:00
Andre Heinecke
2e661b9e1a Fix cmake configuration files for MacOS
* configure.ac: Set HAVE_MACOS_SYSTEM conditional.
* lang/qt/src/Makefile.am,
lang/cpp/src/Makefile.am,
lang/qt/src/QGpgmeConfig.cmake.in.in,
lang/cpp/src/GpgmeConfig.cmake.in.in: Use libsuffix again to
distinguish between macos .dylib

--
GnuPG-Bug-Id: 2884
2017-01-11 15:49:00 +01:00
Andre Heinecke
ececfd5de8 qt: Update config sync doc / comment
* lang/qt/src/cryptoconfig.h (CryptoConfig::sync): Document
that runtime option is always set.
* lang/qt/Src/qgpgmenewcryptoconfig.cpp
(QGpgMENewCryptoConfigComponent::sync): Remove outdated comment
and warn on error.
2017-01-02 14:05:06 +01:00