Commit Graph

358 Commits

Author SHA1 Message Date
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
Andre Heinecke
b2c07bd47b qt, cpp: Add cmake config files for w32
* lang/cpp/src/GpgmeppConfig-w32.cmake.in.in
lang/qt/src/QGpgmeConfig-w32.cmake.in.in: New.
* lang/cpp/src/GpgmeppConfig.cmake.in.in,
lang/qt/src/QGpgmeConfig.cmake.in.in: Remove libsuffix handling.
* lang/cpp/src/Makefile.am,
lang/qt/src/Makefile.am: Create / install w32 config files.
* configure.ac: Configure them.

--
To work with DLL's cmake needs to know about the implib and
the final DLL. So the config files look different enough
that it's better to use alternative files.
2016-11-15 14:33:31 +01:00
Andre Heinecke
45abe6d142 qt: Use new style connect in th..mixin
* lang/qt/src/threadedjobmixin.h
(ThreadedJobMixin::lateInitialization): Use new style connect.
2016-11-15 12:30:56 +01:00
Andre Heinecke
9451faa2ee qt: Add API to get the context for a Job
* lang/qt/src/job.cpp,
lang/qt/src/job.h (Job::context): New.
* lang/qt/src/threadedjobmixin.cpp
(ThreadedJobMixin::~ThreadedJobMixin): New. Unregister context.
(ThreadedJobMixin::lateInitialization): Register context.
* NEWS: Update for cpp and qt.

--
The global map hack is necessary because the job class does
not know about the context which is held in threadedjobmixin.
Adding a virtual function in Job would be an ABI break which
I'd like to avoid at this point. Although QGpgME's API will
need a big ABI break to make it ABI maintainable. The virtual
jobs -> implementation classes are nearly unmaintainable ABI wise.

The context is exposed to provide more flexibility to users, e.g.
to add a passphrase callback or to set the sender in a context.
2016-11-14 20:48:20 +01:00
Andre Heinecke
f3790ddf56 qt, cpp: Enable dll build for windows
* lang/cpp/src/Makefile.am,
lang/qt/src/Makefile.am: Add -no-undefined to LDFLAGS.
2016-11-14 19:39:12 +01:00
Andre Heinecke
34a4e8017b qt: Change license of export / version header
* lang/qt/src/qgpgme_export.h,
lang/qt/src/qgpgme_version.h: Change license to GPLv2+

--
These files were based on copies from the cpp version/export
headers. This change is meant to clarify the licensing by
bringing it in line with the overall licesense of the
qgpgme library.
2016-11-03 10:09:04 +01:00
Andras Mantia
b4658f6a11 qt: Fix build with g++ 4.8.x
* lang/qt/src/defaultkeygenerationjob.cpp
(DefaultKeyGenerationJob::start): Explicitly connect pointer
in the QPointer.

--
Commit message written by Andre Heinecke <aheinecke@intevation.de>
2016-11-02 14:53:14 +01:00
Andre Heinecke
bf9aa0ccf7 qt, cpp: Fix versioning in cmake config and header
* configure.ac (VERSION_MAJOR, VERSION_MINOR, VERSION_MICRO): New
subst variables for the version header.
* lang/cpp/src/GpgmeppConfigVersion.cmake.in,
lang/cpp/src/gpgmepp_version.h.in,
lang/qt/src/QGpgmeConfigVersion.cmake.in,
lang/qt/src/qgpgme_version.h.in: Use new variables.

--
Using the LT_* variables was just wrong. Reporting the
package version also makes more sense then the library version.
Having different versions might make ABI breaks more visible
by increasing the major version number, but to have different
versions in the same package is too confusing imo and gpgme
uses a versioning that is unrelated to the library version number.
2016-11-02 14:43:44 +01:00
Andre Heinecke
b5c4d56cfd qt: Install cmake config into qgpgme subdir
* lang/qt/src/Makefile.am: Install cmake config file in qgpgme subdir.

--
Putting it together with Gpgmepp was done for historic reasons
but the proper way is for each library to have its own subdir.
2016-11-02 14:36:56 +01:00
Andre Heinecke
4149194d2e qt: Require gpgmepp from cmake config script
* lang/qt/src/QGpgmeConfig.cmake.in.in: Require cpp.

--
This fixes an error if a user only does find_package(QGpgme)
2016-11-02 14:31:35 +01:00
Andre Heinecke
8486f21342 qt, cpp: Add all generated files to cleanfiles
* cpp/src/Makefile.am (CLEANFILES),
qt/src/Makefile.am (CLEANFILES): Add all generated files
to cleanfiles.
2016-11-02 12:24:42 +01:00
Andre Heinecke
627c5deed8 qt: Add Distinguished Name parser from libkleo
* lang/qt/src/dn.cpp (DN, DN::Attribute): New public API.
* lang/qt/src/dn.h: New.
* lang/qt/src/Makefile.am: Update accordingly.

--
This is a general useful API to work with X509 distinguished
names and is useful when doing CMS with GpgME.

Adding this class from libkleo allows kmails messagelib to
avoid any KDE UI Frameworks and so can be used more versatile
in the future.

This class can be combined with libkleos DNAttributeMapper
to have the same bevavior as before in libkleo when using
DN::prettyDN calls can be converted from:

    Kleo::DN(uid).prettyDN();

to:
    QGpgME::DN dn(uid);
    uid.setAttributeOrder(
        Kleo::DNAttributeMapper::instance()->attributeOrder());
    dn.prettyDN();
2016-11-01 18:28:20 +01:00
Andre Heinecke
567123de21 qt, cpp: Install version headers in subdirs
* lang/cpp/src/Makefile.am,
lang/qt/src/Makefile.am: Install version headers in include
subdirs.

--
This change was requested on the gnupg-devel mailing list to
avoid placing these headers into the top level include directories.
There is currently no known user of these headers so changing it
now should not break things downstream.
2016-11-01 10:18:02 +01:00
Andre Heinecke
26cbba3c9c qt: Improve WKSPublishJob apidoc
* lang/qt/src/wkspublishjob.h: Improve doc.
2016-10-19 15:17:57 +02:00
Andre Heinecke
a274c7590a qt, cpp: Fix permissions of Config files
* lang/cpp/src/Makefile.am,
lang/qt/src/Makefile.am: Do not install config files as executable.
2016-10-13 09:35:30 +02:00
Andre Heinecke
2538c12fa0 qt: Install SpecialJob
* lang/qt/src/Makefile.am: Install SpecialJob
* NEWS: mention it.

--
SpecialJob was and is public API. So it needs to be installed.
2016-10-13 09:13:50 +02:00
Andre Heinecke
a3cf30f894 qt, cpp: Fix expected targets in Config files
* lang/cpp/src/GpgmeppConfig.cmake.in.in,
lang/qt/src/QGpgmeConfig.cmake.in.in: Remove KF5 variants.
2016-10-13 09:13:40 +02:00
Daniel Vrátil
e5a35af557 qt: Add missing implementation of MultiDeleteJob
* lang/qt/src/multideletejob.h: Fix include, cryptobackend.h is now
called protocol.h
* lang/qt/src/multideletejob.cpp: New file.
* lang/qt/src/Makefile.am: Add multideletejob.cpp.
2016-10-11 19:56:55 +02:00
Daniel Vrátil
ce7385caab qt: Install abstractimportjob.h
* lang/cpp/src/Makefile.am: Install abstractimportjob.h since it's
included from importjob.h

--
Fixes build when someone inclues importjob.h in their code.
2016-10-11 19:43:37 +02:00
Andre Heinecke
f131a5e72b qt: Add simple verify test
* lang/qt/tests/t-verify.cpp: New. Small test if a signature
returns a key with fingerprint.
* lang/qt/tests/Makefile.am: Add new test.
2016-10-10 17:34:52 +02:00
Andre Heinecke
88c7e84ede qt: Fix spelling error in WKSPublishJob
* src/qgpgmewkspublishjob.cpp,
src/qgpgmewkspublishjob.h,
src/wkspublishjob.h,
tests/t-wkspublish.cpp: Fix spelling of received.
* src/configure.ac (LIBQGPGME_LT_CURRENT): Bump
accordingly.

--
While this is an API break I've decided to fix this now
instead of deprecating / keeping it around forever in the API.

The only known users of QGpgME are KDE Applications and
there it is not yet used.
2016-10-05 17:36:17 +02:00
Andre Heinecke
24779c9e23 qt: Disable tests that require a password for 2.0
* lang/qt/tests/t-encrypt.cpp: Disable tests that require
a password for 2.0.

--
The passphrase_cb apparently does not work with 2.0 so we would
need a fake pinentry to get this to work. We just disable the
test instead as this is a rarely used feature and works with
1.4 and 2.1.
2016-10-05 17:19:20 +02:00
Andre Heinecke
9d1df99038 qt: Fix unused variable warnings
* qt/src/qgpgmenewcryptoconfig.cpp,
qt/src/threadedjobmixin.h,
qt/tests/t-encrypt.cpp,
qt/tests/t-support.h,
qt/tests/t-wkspublish.cpp: Mark additional variables as unused.
2016-10-05 16:44:53 +02:00
Andre Heinecke
52a91ccc6a qt: Disable t-wkspublish test
* lang/qt/tests/Makefile.am (TESTS): Remove t-wkspublish.

--
Even the only enabled test did a connection to localhost this
might fail if it is stalled and is an outside factor. It also might
be disturbing other services locally.
2016-10-05 16:01:20 +02:00
Andre Heinecke
7302791c0d cpp, qt: Handle modified includedir installation
* lang/cpp/src/Makefile.am,
lang/qt/src/Makefile.am: Replace resolved_includedir.
* lang/cpp/src/GpgmeppConfig.cmake.in.in,
lang/qt/src/QGpgmeConfig.cmake.in.in: Use resolved_includedir
instead of relying on a common installation prefix.

--
This fixes usage of the config files in case gpgme
is configured with a custom --includedir.
We have to do the replacement manually like for libdir
because configure would include variables in the replacement.
2016-09-29 12:46:18 +02:00
Daniel Kahn Gillmor
95f38652f6 Fix spelling
* lang/cpp/src/context.h, lang/qt/src/protocol.h,
   lang/qt/src/wkspublishjob.h, src/data-identify.c, src/engine-gpg.c:
   minor spelling cleanup.
--

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2016-09-23 16:09:27 +02:00
Daniel Kahn Gillmor
a11450eb04 move some file encodings to UTF-8
* THANKS, doc/ChangeLog-2011, tests/ChangeLog-2011,
  tests/gpg/geheim.txt: convert from iso 8859-1 to utf-8.
* lang/qt/src/dataprovider.cpp, lang/qt/src/qgpgmerefreshkeysjob.cpp,
  lang/qt/src/qgpgmesecretkeyexportjob.cpp: replace U+FFFD REPLACEMENT
  CHARACTER with proper U+00E4 LATIN SMALL LETTER A WITH DIAERESIS.

--
Note that src/versioninfo.rc.in is still ISO-8859-1.  I don't know
whether Windows will properly handle UTF-8 in this file or not, so i
have not touched it.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2016-09-23 16:08:33 +02:00
Andre Heinecke
a142f187b7 cpp, qt: Include config.h
lang/cpp/src/callbacks.cpp,
lang/cpp/src/configuration.cpp,
lang/cpp/src/context.cpp,
lang/cpp/src/context_glib.cpp,
lang/cpp/src/context_qt.cpp,
lang/cpp/src/context_vanilla.cpp,
lang/cpp/src/data.cpp,
lang/cpp/src/decryptionresult.cpp,
lang/cpp/src/defaultassuantransaction.cpp,
lang/cpp/src/editinteractor.cpp,
lang/cpp/src/encryptionresult.cpp,
lang/cpp/src/engineinfo.cpp,
lang/cpp/src/eventloopinteractor.cpp,
lang/cpp/src/exception.cpp,
lang/cpp/src/gpgadduserideditinteractor.cpp,
lang/cpp/src/gpgagentgetinfoassuantransaction.cpp,
lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp,
lang/cpp/src/gpgsetownertrusteditinteractor.cpp,
lang/cpp/src/gpgsignkeyeditinteractor.cpp,
lang/cpp/src/importresult.cpp,
lang/cpp/src/key.cpp,
lang/cpp/src/keygenerationresult.cpp,
lang/cpp/src/keylistresult.cpp,
lang/cpp/src/scdgetinfoassuantransaction.cpp,
lang/cpp/src/signingresult.cpp,
lang/cpp/src/tofuinfo.cpp,
lang/cpp/src/trustitem.cpp,
lang/cpp/src/verificationresult.cpp,
lang/cpp/src/vfsmountresult.cpp,
lang/qt/src/dataprovider.cpp,
lang/qt/src/defaultkeygenerationjob.cpp,
lang/qt/src/gpgme_backend_debug.cpp,
lang/qt/src/job.cpp,
lang/qt/src/qgpgmeadduseridjob.cpp,
lang/qt/src/qgpgmebackend.cpp,
lang/qt/src/qgpgmechangeexpiryjob.cpp,
lang/qt/src/qgpgmechangeownertrustjob.cpp,
lang/qt/src/qgpgmechangepasswdjob.cpp,
lang/qt/src/qgpgmedecryptjob.cpp,
lang/qt/src/qgpgmedecryptverifyjob.cpp,
lang/qt/src/qgpgmedeletejob.cpp,
lang/qt/src/qgpgmedownloadjob.cpp,
lang/qt/src/qgpgmeencryptjob.cpp,
lang/qt/src/qgpgmeexportjob.cpp,
lang/qt/src/qgpgmeimportfromkeyserverjob.cpp,
lang/qt/src/qgpgmeimportjob.cpp,
lang/qt/src/qgpgmekeyformailboxjob.cpp,
lang/qt/src/qgpgmekeygenerationjob.cpp,
lang/qt/src/qgpgmekeylistjob.cpp,
lang/qt/src/qgpgmelistallkeysjob.cpp,
lang/qt/src/qgpgmenewcryptoconfig.cpp,
lang/qt/src/qgpgmerefreshkeysjob.cpp,
lang/qt/src/qgpgmesecretkeyexportjob.cpp,
lang/qt/src/qgpgmesignencryptjob.cpp,
lang/qt/src/qgpgmesignjob.cpp,
lang/qt/src/qgpgmesignkeyjob.cpp,
lang/qt/src/qgpgmetofupolicyjob.cpp,
lang/qt/src/qgpgmeverifydetachedjob.cpp,
lang/qt/src/qgpgmeverifyopaquejob.cpp,
lang/qt/src/qgpgmewkspublishjob.cpp,
lang/qt/src/threadedjobmixin.cpp,
lang/qt/tests/run-keyformailboxjob.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-tofuinfo.cpp,
lang/qt/tests/t-wkspublish.cpp: Include config.h

--
This fixes problems with mismatching definitions. Most
notably _FILE_OFFSET_BITS is now always set correctly.
2016-09-23 15:25:51 +02:00
Werner Koch
29207bcd3b
tests: Improve portability.
* lang/qt/tests/Makefile.am (clean-local): Avoid non-portable "--"
* lang/python/Makefile.am (copystamp): Use well defined cp -R instead
of cp -r.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-09-20 19:46:04 +02:00
Andre Heinecke
3f92253e0e qt: Improve README
* lang/qt/README: Add more content. Clearly note license difference.
2016-09-19 14:09:44 +02:00
Andre Heinecke
d438cb59a0 qt: Add debug output for testTofuPolicy
* lang/qt/tests/t-tofuinfo.cpp (testTofuPolicy): Add
debug output.

--
The debug output is only emitted before a failure of the
test in case a keylisting of bravo@example.net fails which
it should never do.
2016-09-19 10:01:19 +02:00
Andre Heinecke
a8ff34fc30 qt: Add test for setting tofu policy
* lang/qt/tests/t-tofuinfo.cpp (testTofuPolicy): New.
2016-09-16 16:58:39 +02:00
Andre Heinecke
77aecfb5c9 qt: Add job for tofupolicy
* lang/qt/src/job.cpp, lang/qt/src/protocol.h,
lang/qt/src/protocol_p.h: Register job.
* lang/qt/src/qgpgmetofupolicyjob.cpp,
lang/qt/src/qgpgmetofupolicyjob.h,
lang/qt/src/tofupolicyjob.h: New.
* lang/qt/src/Makefile.am: Update accordingly.
2016-09-16 16:58:39 +02:00
Andre Heinecke
d480f6b701 qt: Fix some includes
* lang/qt/src/qgpgmekeyformailboxjob.cpp: Explicitly include
QStringList.
* lang/qt/tests/t-support.h, lang/qt/tests/t-support.cpp: Move
includes into impl. Explicitly include QDir.

--
This fixes build against Qt versions where the includes are less
implicit.
2016-09-12 10:52:10 +02:00
Justus Winter
7b9e6ea376 qt: Fix tofu test.
* lang/qt/tests/t-tofuinfo.cpp: Adjust member names.

Fixes-commit: 120b1478
Signed-off-by: Justus Winter <justus@g10code.com>
2016-09-12 10:11:44 +02:00
Andre Heinecke
ab3fbdbd05 qt: Clarify comment and strings in tofuinfo test
* lang/qt/tests/t-tofuinfo.cpp (testTofuSignCount)
(testTofuKeyList): Ensure distinct messages. Clarify comment.
2016-09-05 16:54:50 +02:00
Andre Heinecke
965b842fad qt: Enable signcount checks in tofuinfo test
* lang/qt/tests/t-tofuinfo.cpp: Enable checks for signcount.

--
Signcount for userIDs works now as expected with gnupg 2.1.16.
2016-09-05 12:58:35 +02:00
Andre Heinecke
8a39a595eb qt: Add missing header redirection
* lang/qt/src/keyformailboxjob.h,
lang/qt/src/qgpgmekeyformailboxjob.h: Fix includes.

--
This ensures that when building qgpgme you do not need an installed
gpgme++.
2016-09-05 10:44:41 +02:00
Andre Heinecke
e3a4697894 qt: Include cpp before core directory
* lang/qt/src/Makefile.am (AM_CPPFLAGS): Include cpp before core.

--
Both core and cpp have headers that have the same names, this
can lead to the wrong headers beeing included when qt bindings
are built.
2016-09-05 10:42:02 +02:00
Andre Heinecke
05570bd3d0 qt: Fix 2.1 t-support copy
* lang/qt/src/t-support.cpp (copyKeyring): Fix seckey copy.
2016-08-25 17:16:25 +02:00
Andre Heinecke
9fc72e928b qt: Fix and extend TofuInfo test.
* lang/qt/tests/t-tofuinfo.cpp: Delete executed jobs.
(testTofuKeyList): New.
(testSupported): Activate for 2.1.16
(signAndVerify): Disable sigcount tests.
2016-08-25 16:25:49 +02:00
Andre Heinecke
c875f07e55 qt: Fix keyring copy in tests
* lang/qt/test/t-encrypt.cpp,
lang/qt/test/t-tofuinfo.cpp: Assert on copy failure.
* lang/qt/test/t-support.cpp (copyKeyrings): Fix path.
2016-08-25 16:23:58 +02:00
Andre Heinecke
4e37d0bb12 qt: Add generic flag support for keylistjobs
* lang/qt/src/keylistjob.h (addMode): New.
* lang/qt/src/qgpgmekeylistjob.h (addMode): New.
* lang/qt/src/qgpgmekeylistjob.cpp (addMode: New.

--
Instead of new API for each new thing lets be a bit more
generic / open.
2016-08-25 16:22:12 +02:00
Andre Heinecke
5a92cc96da qt: Ensure that current src dir is included first
* lang/qt/src/Makefile.am: Reorder include directives.

--
This fixes the problem that QGpgME would pick up gpgme or
gpgme++ headers from an installed version.
2016-08-25 16:20:42 +02:00
Andre Heinecke
053e6e0a7b qt: Fix tofuinfo test when gpg is gpg2
* lang/qt/tests/t-support.cpp (QGpgMETest::copyKeyrings): New helper.
* lang/qt/tests/t-support.h: Declare.
* lang/qt/tests/t-encrypt.cpp: use it
* lang/qt/tests/t-tofuinbo.cpp: ditto.

--
New helper takes care of copying the correct files for either
keybox or keyring.
2016-08-25 15:20:02 +02:00
Andre Heinecke
f08904b810 qt: Remove unused variable in test
* t-wkspublish.cpp (testWKSPublishCreate): Remove context.
2016-08-25 15:02:11 +02:00
Andre Heinecke
df04b232b8 qt: Add test for wkspublishjob
* lang/qt/tests/t-wkspublish.cpp: New.
* lang/qt/tests/Makefile.am: Update accordingly.

--
Most tests are disabled by default as tey require
an online connection.
Define DO_ONLINE_TESTS to enable the tests.
2016-08-25 14:40:26 +02:00
Andre Heinecke
94420b0577 qt: Add WKSPublishJob
* lang/qt/src/Makefile.am: Add new files.
* lang/qt/src/job.cpp: Include moc / subclass stub.
* lang/qt/src/protocol.h: Add virtual for new job.
* lang/qt/src/protocol_p.h: Add job.
* lang/qt/src/wkspublishjob.h: Interface for WKSPublishJob.
* lang/qt/src/qgpgmewkspublishjob.cpp,
lang/qt/src/qgpgmewkspublishjob.h: New.

--
The Job was originally intended to be used with a SpawnEngine
Context but QProcess was a better fit for the job.

Usage is similar to the client tool. check, create, recieve.
2016-08-25 14:29:41 +02:00
Andre Heinecke
d2e40fb7ad Qt: Adapt (disabled) tofuinfo test to new API
* lang/qt/tests/t-tofuinfo.cpp: Switch to UID based API.

--
Test is still disabled as GnuPG still returns unexpected
results.
2016-08-24 14:00:41 +02:00
Andre Heinecke
799b168243 Cpp: Move tofuinfo from signature to userid
* lang/cpp/src/key.cpp (UserID::tofuInfo): New.
* lang/cpp/src/key.h: Update accordingly.
* lang/cpp/src/tofuinfo.cpp: Remove dropped fields.
* lang/cpp/src/tofuinfo.h: Update accordingly.
* lang/cpp/src/verificationresult.cpp,
lang/cpp/src/verificationresult.h: Remove tofu info.
* lang/qt/tests/t-tofuinfo.cpp: Disable for now.

--
With be4ff75d7 Tofu info now lives with a UserID
Object. While this breaks API it was not yet released.
2016-08-23 16:44:17 +02:00
Andre Heinecke
391e55411c Qt: Add test for progress signal of encryptjob
* lang/qt/tests/t-encrypt.cpp (testProgress): New.

--
This tests that a ByteArray IODevice now gives proper progress
signals.
2016-08-12 16:55:51 +02:00
Andre Heinecke
75c974c4e0 Qt: Fix defaultkeygenerationjob build
* lang/qt/src/defaultkeygenerationjob.cpp: Include moc.
2016-08-12 08:17:18 +02:00
Andre Heinecke
105f5446e6 Qt: Add DefaultKeyGenerationJob
* lang/qt/src/defaultkeygenerationjob.cpp,
lang/qt/src/defaultkeygenerationjob.h: New.
* lang/qt/src/Makefile.am: Update accordingly.

--
The defaultkeygenerationjob makes it easier to just generate a key
in the future this should probably use quick-gen key but since this
is not exposed in gpgme we hardcode the defaults and do it with
the params file.

This is also the first job that uses a new and better architecture
without backend abstraction and the pimpl pattern instead of
a specialized subclass.

This is an adoption of kde's libkleo commit f49b7157
Thanks dvratil@kde.org
2016-08-11 18:00:14 +02:00
Andre Heinecke
59e2251a08 Qt: Ensure all public classes are exported
* src/abstractimportjob.h,
src/cryptoconfig.h,
src/deletejob.h,
src/exportjob.h,
src/importfromkeyserverjob.h,
src/importjob.h,
src/keygenerationjob.h,
src/keylistjob.h,
src/listallkeysjob.h,
src/refreshkeysjob.h,
src/signencryptjob.h,
src/specialjob.h,
src/verifydetachedjob.h: Export classes.

--
This is an adoption of kde's libkleo commit: d6a71a4e
Thanks dvratil@kde.org
2016-08-11 18:00:14 +02:00
Andre Heinecke
8c5abc8d93 Qt: Add KeyForMailboxJob
* lang/qt/src/job.cpp: Include moc and make subclass.
* lang/qt/src/keyformailboxjob.h,
lang/qt/src/qgpgmekeyformailboxjob.cpp,
lang/qt/src/qgpgmekeyformailboxjob.h: New.
* lang/qt/tests/run-keyformailboxjob.cpp: New manual test.
* lang/qt/tests/Makefile.am: Add run-keyformailboxjob.
* lang/qt/src/Makefile.am: Update accordingly.
* lang/qt/src/protocol.h, lang/qt/src/protocol_p.h: Add
keyformailboxjob.

--
The KeyForMailboxjob can be used to determine the best key to
use to encrypt something to a given mail address.
2016-08-11 18:00:14 +02:00
Andre Heinecke
d467018ce3 Qt: Remove unused variable
* lang/qt/src/qgpgmerefreshkeysjob.cpp (slotStatus): Remove
unused variable typ.
2016-08-10 12:07:56 +02:00
Andre Heinecke
a27d7755d0 Qt: Create TestPassphraseProvider on stack
* lang/qt/tests/t-encrypt.cpp, lang/qt/tests/t-tofuinfo.cpp: Create
TestPassphraseProvider on stack.

--
Context does not delete the provider. This fixes ASAN errors.
2016-08-10 12:07:56 +02:00
Andre Heinecke
0c222e1b3c Qt: Fix t-keylist moc include
* lang/qt/tests/t-keylist.cpp: Don't include t-support.moc

--
Accidental leftover from trying to generate t-support moc from
another cpp file. This was solved instead by a new rule to generate
moc files from the header.
2016-08-10 09:50:26 +02:00
Andre Heinecke
969f223d8d Qt: Clean up debug output in tests
* lang/qt/tests/t-support.cpp: Remove accidentally commited
debug output.
2016-08-09 18:39:56 +02:00
Andre Heinecke
f209ec8f58 Qt: Add encryption test and refactor testsuite
* lang/qt/tests/Makefile.am: Add t-encrypt and t-support.
* lang/qt/tests/t-support.cpp, lang/qt/tests/t-support.c (QGpgMETest):
New. Class to handle common cleanup / init.
* lang/qt/tests/t-keylist.cpp,
lang/qt/tests/t-keylocate.cpp,
lang/qt/tests/t-ownertrust.cpp,
lang/qt/tests/t-tofuinfo.cpp: Inherit QGpgMETest.
* lang/qt/tests/t-encrypt.cpp: New. Test Symetric and Asymectric
encryption. Mixed encryption test is disabled.
2016-08-09 14:23:51 +02:00
Andre Heinecke
34b456c3fb Qt: Add support for EncryptJobs with generic flags
* lang/qt/src/encryptjob.h, lang/qt/src/signencryptjob.h,
lang/qt/src/qgpgmeencryptjob.h, lang/qt/src/qgpgmeencryptjob.cpp,
lang/qt/src/qgpgmesignencryptjob.cpp,
lang/qt/src/qgpgmeencryptjob.cpp: Add start and exec overloads
that accept generic EncryptFlags.

--
While this technically is an ABI break (vtable change) there
are no known classes outside qgpgme that inherit encryptjob
or signencryptjob. And the new functions should be added
to the bottom of the vtable.
2016-08-09 14:23:51 +02:00
Andre Heinecke
d2f2cbd297 Qt: Disable keylocate test for gnupg < 2.0.10
* lang/qt/tests/t-keylocate.cpp: Disable test for gnupg < 2.0.10
2016-07-14 17:03:05 +02:00
Andre Heinecke
e7f4c36473 Qt: Fix usage of ignore-invalid-option in tests
* Makefile.am (pubring-stamp): Fix config.
2016-07-14 16:32:56 +02:00
Andre Heinecke
e4c0645c1e Qt: Fix tests if gpg2 is gpg
* lang/qt/tests/Makefile.am (pubring-stamp): Loopback and provide
passphrase on command line when importing.
2016-07-14 15:33:16 +02:00
Andre Heinecke
fd87c4679c Qt: Install CamelCase forward includes
* lang/qt/src/Makefile.am (camelcase_headers): New. Create and install
CamelCase headers.

--
For Qt Libraries it is a common pattern that headers are installed
additionally under their Namespace / Class Name so that automated
inclusion works once a class is used in code. This was also
done for QGpgME headers when they lived in Libkleo so this increases
compatibility.
2016-07-12 11:47:33 +02:00
Andre Heinecke
86ab2ee2d6 Qt: Export VerifyDetachedJob
* lang/qt/src/verifydetachedjob.h (VerifyDetachedJob): Export it.
2016-07-12 11:47:04 +02:00
Andre Heinecke
b03c48cfb0 Qt/Cpp: Add version headers
* lang/cpp/src/gpgmepp_version.h.in,
lang/qt/src/qgpgme_version.h.in: New. Version information.
* lang/qt/src/Makefile.am, lang/cpp/src/Makefile.am: Add them.
* configure.ac: Configure them.

--
The version headers are common practice in KDE Frameworks and
were installed for KF5Gpgmepp and Libkleo respectively.
2016-07-12 11:35:39 +02:00
Andre Heinecke
362b8cdf4e Qt/Cpp: Add license blurb to export headers
* lang/cpp/src/gpgmepp_export.h,
lang/qt/src/qgpgme_export.h: Add license blurb.
2016-07-12 11:35:39 +02:00
Andre Heinecke
bfa8ac7e02 Qt: Fix memleaks in tests
* lang/qt/tests/t-keylist.cpp(cleanupTestCase): Ensure that
posted events are handled for autodeletion.
(testSingleKeylistSync): delete job.
* lang/qt/tests/t-ownertrust.cpp(cleanupTestCase): Ditto
* lang/qt/tests/t-ownertrust.cpp(testChangeOwnerTrust): Delete
keylistjobs.
* lang/qt/tests/t-keylocate.cpp(cleanupTestCase): Ditto
2016-07-11 16:51:58 +02:00
Andre Heinecke
b1f42e8f25 Qt: Add some general Protocol documentation
* lang/qt/src/protocol.h (Protocol): Add doc.

--
This explicitly documents that syncs run with exec need deletion.
2016-07-11 16:47:07 +02:00
Andre Heinecke
02babb2961 Qt: Disable t-tofuinfo tests
* lang/qt/tests/t-tofuinfo.cpp: Disable tests.

--
Even with the wait this test could fail and anyway the delay
was not nice. So we remove the wait hack and just wait for
the bug (2405) to be fixed in GnuPG or GpgME core.
2016-07-11 12:03:16 +02:00
Justus Winter
38c408560c qt: Fix distcheck.
* lang/qt/src/Makefile.am (qgpgme_headers): Add missing file.
(CLEANFILES): Add generated file.
* lang/qt/tests/Makefile.am (clean-local): Remove private keys.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-07-07 13:56:37 +02:00
Andre Heinecke
fc02672332 Qt: Add test for publicKeyAlgorithmAsString
* lang/qt/tests/t-keylist.cpp (testPubkeyAlgoAsString): New.
2016-07-06 15:09:16 +02:00
Andre Heinecke
9f93346d21 Qt: Add check for pubkeyAlgo in t-keylist
* lang/qt/tests/t-keylist.cpp (testSingleKeyListSync): Check
pubkeyAlgo.
2016-07-06 13:39:43 +02:00
Andre Heinecke
4934893e27 Qt: Fix include order when buildin test
* lang/qt/tests/Makefile.am (AM_CPPFLAGS): Include cpp before
gpgme src directory.

--
This fixes a problem where context.h would be picked up from gpgme/src
instead of including the context.h from gpgme++.
2016-07-06 11:28:11 +02:00
Andre Heinecke
7a8c04f66d Revert "Qt: More robust lookup of Cpp's context.h"
* lang/qt/src/threadedjobmixin.h: Revert using full path
for context.h

--
This reverts commit 47bfbc9026 as
it causes problems depending on the include path. The proper
fix will be to ensure that cpp/src is included before gpgme/src.
2016-07-06 11:22:10 +02:00
Andre Heinecke
49a6ee5058 Qt: Fix test build with Qt < 5.4.0
* lang/qt/tests/t-keylist.cpp,
lang/qt/tests/t-keylocate.cpp,
lang/qt/tests/t-ownertrust.cpp: Use old style SIGNAl syntax for
QSignalSpy
2016-07-05 22:11:42 +02:00
Andre Heinecke
47bfbc9026 Qt: More robust lookup of Cpp's context.h
* lang/qt/src/threadedjobmixin.h: When building qgpgme look for
context.h in the full cpp subdirectory.

--
Gpgme core also contains a context.h that can lead to confusion
otherwise.
2016-07-05 22:10:18 +02:00
Andre Heinecke
8fa9b5696c Qt: Add testTofuSignCount
* src/lang/qt/tests/t-tofuinfo.cpp(testTofuSignCount): New.
(initTestCase): Set gpg-agent loopback pinentry config.
(signAndVerify): Helper for tofuTestSignCount.

--
Also needs the wait code because of GnuPG-Bug-Id: 2405
2016-07-04 11:44:39 +02:00
Andre Heinecke
efb5059b9b Qt: Add test passphrase provider
* lang/qt/tests/t-support.h (TestPassphraseProvider): New.
* lang/qt/tests/Makefile.am (t_tofuinfo_SOURCES): Add t-support.h
2016-07-04 11:44:39 +02:00
Andre Heinecke
fbd6ac4655 Qt: Add test for TofuInfo
* lang/qt/tests/t-tofuinfo.cpp: New.
* lang/qt/tests/Makefile.am: Update accordingly.

--
The test currently contains a workaround for GnuPG-Bug-Id 2405
2016-07-01 16:55:14 +02:00
Andre Heinecke
9d6f85bd25 Qt: Fix debug output in t-ownertrust
* lang/qt/tests/t-ownertrust.cpp (testChangeOwnerTrust): Remove
general debug of trust level. Add debug output for error.
2016-06-01 13:48:28 +02:00
Andre Heinecke
00e93b2cae Qt: Fix test build with clang
* lang/qt/tests/Makefile.am (LDADD): Explicitly add -lstdc++

--
g++ does not need that but clang does need it explicitly
2016-05-24 16:00:42 +02:00
Andre Heinecke
eaf2d018e6 Qt: Add test for changeownertrust
* lang/qt/tests/t-ownertrust.cpp: New test.
* lang/qt/tests/Makefile.am: Add test.

--
This test would have catched the issue created by not handling
GPGME_STATUS_KEY_CONSIDERED.
2016-05-20 16:04:50 +02:00
Andre Heinecke
2f748b5a2d Qt: Check for graphviz and set HAVE_DOT correctly
* configure.ac: Check for graphviz and define HAVE_DOT.
* lang/qt/doc/Doxyfile.in (HAVE_DOT): Use variable.
2016-05-19 11:16:15 +02:00
Andre Heinecke
375523ead3 Qt: Fix compilation of unit tests
* lang/qt/tests/Makefile.am (AM_CPPFLAGS): Add -DBUILDING_QGPGME.

--
Without building QGpgME the headers of gpgme++ are not included
corretly and taken from an already installed gpgme++.
2016-05-19 10:56:49 +02:00
Andre Heinecke
9b36ebf37a Qt / Cpp: Port auto_ptr to unique_ptr
* lang/cpp/src/context.cpp,
lang/cpp/src/context.h,
lang/cpp/src/context_p.h (Context::createForEngine),
(Context::edit, Context::startEditing),
(Context::takeLastEditInteractor, Context::cardEdit),
(Context::startCardEditing, Context::takeLastCardEditInteractor),
(Context::assuanTransact, Context::startAssuanTransaction),
(Context::takeLastAssuanTransaction): Port to unique_ptr.
* lang/qt/src/qgpgmeadduseridjob.cpp,
lang/qt/src/qgpgmechangeexpiryjob.cpp,
lang/qt/src/qgpgmechangeownertrustjob.cpp,
lang/qt/src/qgpgmechangepasswdjob.cpp,
lang/qt/src/qgpgmesignkeyjob.cpp: Update accordingly.

--
This is another API break but as we already broke API with GpgME++
and QGpgME from KDE Frameworks this is a good time to do this
to avoid using a deprected C++ class in the API.
2016-05-17 17:54:53 +02:00
Andre Heinecke
52f2295d52 Qt: Add keyLocateJob and test for it
* configure.ac (LIBQGPGME_LT_REVISION): Bump.
* lang/qt/src/protocol.h (locateKeysJob): Add Job.
* lang/qt/src/protocol_p.h (locateKeysJob): Implement.
* lang/qt/tests/Makefile.am: Add t-keylocate.
* lang/qt/tests/t-keylocate.cpp: New.
2016-05-13 13:16:12 +02:00
Andre Heinecke
66ded1a5ce Qt: Add missing copyright header in test
* lang/qt/tests/t-keylist.cpp: Add copyright header.
2016-05-13 12:52:52 +02:00
Andre Heinecke
c303292aca Qt / Cpp: Fix make dist
* lang/cpp/src/Makefile.am (EXTRA_DIST): Fix typo.
(private_gpgmepp_headers): New. Private headers.
(libgpgmepp_la_SOURCES): Add private headers.
* lang/qt/src/Makefile.am (t_keylist_SOURCES): Remove non existent
header.
2016-05-10 15:09:12 +02:00
Andre Heinecke
b7d5c2cced Qt: Fix unkonwn doxygen keyword warnings
--
Reimp is not a keqword and we inherit documentation anyway.
2016-05-10 14:32:22 +02:00
Andre Heinecke
56c4d9ea95 Qt: Make Protocol class public API
* lang/qt/src/Makefile.am (qgpgme_headers): Add protocol.h
(private_qgpgme_headers): Add protocol_p.h
* lang/qt/src/protocol.h: New. From QGpgMEBackend.
* lang/qt/src/protocol_p.h: New. From QGpgMEBackend.
* lang/qt/src/qgpgmebackend.h,
lang/qt/src/qgpgmebackend.cpp (Protocol): Removed.

--
The backend class does not make much sense anymore as we
only have the GpgME backend obviously. It's purpose was
for Libkleo's Backend abstraction.
2016-05-10 14:05:10 +02:00
Andre Heinecke
97225bb01c Qt: Make doxygen quieter
* lang/qt/doc/Doxyfile.in: Quiet and no undocumented warnings.
2016-05-10 14:02:27 +02:00
Andre Heinecke
740f92a7b8 Qt: Only install public headers
* lang/qt/src/Makefile.am: Do not install all headers.
--
The qgpgme classes hide the implementation and thus make it
easier to change it without ABI breaks. They should not
be installed.
2016-05-10 14:02:27 +02:00
Andre Heinecke
0e3195948d Qt: Add test for async keylisting
* src/lang/qt/tests/t-keylist.cpp(KeyListTest::testKeyListAsync): New.
2016-05-10 12:51:45 +02:00
Andre Heinecke
11ff8d5964 Qt: Fix license mentioned in README
* lang/qt/README: License is GPLv2+ and not LGPL.
--
The only part under lgpl is the QByteArray dataprovider.
2016-05-06 14:41:22 +02:00
Andre Heinecke
20b02a7dd4 Qt: Fix library name in Copyright headers
--
Files are not part of libkleopatra anymore.
2016-05-06 14:20:45 +02:00
Andre Heinecke
d2b5510119 Qt / Cpp: Mention coding style in READMES
* src/lang/cpp/README, src/lang/qt/README: Add hacking note.
2016-04-11 18:16:05 +02:00
Andre Heinecke
a1e95f36ce Qt: Add doc generation with doxygen
* configure.ac: Look for doxygen if qt is built.
 Configure new files.
* lang/qt/doc/Doxyfile.in: New.
* lang/qt/doc/Makefile.am: New.
* lang/qt/README: Update.

--
Currently this is a standard doxyfile template without much
customization.
2016-04-11 18:10:54 +02:00
Andre Heinecke
d9f7a18ed8 Qt: Fix unit test by adding initial.test dep
* lang/qt/tests/t-keylist.cpp: Verify that GNUPGHOME is set.
* lang/qt/tests/initial.test: New dummy test.
* lang/qt/tests/Makefile.am: Add dependency to initial.test

--
Feels weird but this follows the pattern in tests/gpg/Makefile.am
and solves the problem that the environment is dirty.
2016-04-11 17:46:03 +02:00
Andre Heinecke
afd8fad6e2 Qt: Remove remaining boost usage
* lang/qt/src/dataprovider.h,
 lang/qt/src/decryptjob.h,
 lang/qt/src/decryptverifyjob.h,
 lang/qt/src/encryptjob.h,
 lang/qt/src/qgpgmeadduseridjob.cpp,
 lang/qt/src/qgpgmechangeexpiryjob.cpp,
 lang/qt/src/qgpgmechangeownertrustjob.cpp,
 lang/qt/src/qgpgmechangepasswdjob.cpp,
 lang/qt/src/qgpgmedecryptjob.cpp,
 lang/qt/src/qgpgmedecryptverifyjob.cpp,
 lang/qt/src/qgpgmedeletejob.cpp,
 lang/qt/src/qgpgmedownloadjob.cpp,
 lang/qt/src/qgpgmeencryptjob.cpp,
 lang/qt/src/qgpgmeexportjob.cpp,
 lang/qt/src/qgpgmeimportfromkeyserverjob.cpp,
 lang/qt/src/qgpgmeimportjob.cpp,
 lang/qt/src/qgpgmekeygenerationjob.cpp,
 lang/qt/src/qgpgmekeylistjob.cpp,
 lang/qt/src/qgpgmenewcryptoconfig.cpp,
 lang/qt/src/qgpgmenewcryptoconfig.h,
 lang/qt/src/qgpgmesignencryptjob.cpp,
 lang/qt/src/qgpgmesignjob.cpp,
 lang/qt/src/qgpgmesignkeyjob.cpp,
 lang/qt/src/qgpgmeverifydetachedjob.cpp,
 lang/qt/src/qgpgmeverifyopaquejob.cpp,
 lang/qt/src/signencryptjob.h,
 lang/qt/src/signjob.h,
 lang/qt/src/threadedjobmixin.cpp,
 lang/qt/src/threadedjobmixin.h,
 lang/qt/src/verifydetachedjob.h,
 lang/qt/src/verifyopaquejob.h: Remove boost usage.

--
Mostly done with search and replace.
2016-04-11 17:15:16 +02:00
Andre Heinecke
e18256fc5f Qt: Remove predicates.h and stl_util.h
* src/lang/qt/predicates.h, src/lang/qt/stl_util.h: Removed.

--
The magic is still better placed in libkleo.
2016-04-11 17:14:09 +02:00
Andre Heinecke
d293bd3229 Qt: Remove usage of stl_util.h and predicates.h
* src/lang/qt/qgpgmelistallkeysjob.cpp: Use comperators from
  gpgmepp instead of detail. Remove boost usage.
2016-04-11 17:06:35 +02:00
Andre Heinecke
f98898ab1a Cpp / Qt: Reduce boost usage (memory and tuple)
* cpp/src/assuanresult.h,
 cpp/src/configuration.cpp,
 cpp/src/configuration.h,
 cpp/src/data.h,
 cpp/src/decryptionresult.h,
 cpp/src/defaultassuantransaction.cpp,
 cpp/src/encryptionresult.cpp,
 cpp/src/encryptionresult.h,
 cpp/src/engineinfo.h,
 cpp/src/gpgagentgetinfoassuantransaction.cpp,
 cpp/src/gpgsignkeyeditinteractor.cpp,
 cpp/src/importresult.cpp,
 cpp/src/importresult.h,
 cpp/src/key.h,
 cpp/src/keygenerationresult.h,
 cpp/src/keylistresult.h,
 cpp/src/notation.h,
 cpp/src/signingresult.cpp,
 cpp/src/signingresult.h,
 cpp/src/verificationresult.cpp,
 cpp/src/verificationresult.h,
 cpp/src/vfsmountresult.h,
 qt/src/dataprovider.cpp,
 qt/src/dataprovider.h,
 qt/src/decryptjob.h,
 qt/src/decryptverifyjob.h,
 qt/src/downloadjob.h,
 qt/src/encryptjob.h,
 qt/src/qgpgmeadduseridjob.cpp,
 qt/src/qgpgmechangeexpiryjob.cpp,
 qt/src/qgpgmechangeownertrustjob.cpp,
 qt/src/qgpgmechangepasswdjob.cpp,
 qt/src/qgpgmedecryptjob.cpp,
 qt/src/qgpgmedecryptjob.h,
 qt/src/qgpgmedecryptverifyjob.cpp,
 qt/src/qgpgmedecryptverifyjob.h,
 qt/src/qgpgmedeletejob.cpp,
 qt/src/qgpgmedownloadjob.cpp,
 qt/src/qgpgmedownloadjob.h,
 qt/src/qgpgmeencryptjob.cpp,
 qt/src/qgpgmeencryptjob.h,
 qt/src/qgpgmeexportjob.cpp,
 qt/src/qgpgmeexportjob.h,
 qt/src/qgpgmeimportfromkeyserverjob.cpp,
 qt/src/qgpgmeimportfromkeyserverjob.h,
 qt/src/qgpgmeimportjob.cpp,
 qt/src/qgpgmeimportjob.h,
 qt/src/qgpgmekeygenerationjob.cpp,
 qt/src/qgpgmekeygenerationjob.h,
 qt/src/qgpgmekeylistjob.cpp,
 qt/src/qgpgmekeylistjob.h,
 qt/src/qgpgmelistallkeysjob.cpp,
 qt/src/qgpgmelistallkeysjob.h,
 qt/src/qgpgmenewcryptoconfig.cpp,
 qt/src/qgpgmenewcryptoconfig.h,
 qt/src/qgpgmesignencryptjob.cpp,
 qt/src/qgpgmesignencryptjob.h,
 qt/src/qgpgmesignjob.cpp,
 qt/src/qgpgmesignjob.h,
 qt/src/qgpgmesignkeyjob.cpp,
 qt/src/qgpgmeverifydetachedjob.cpp,
 qt/src/qgpgmeverifydetachedjob.h,
 qt/src/qgpgmeverifyopaquejob.cpp,
 qt/src/qgpgmeverifyopaquejob.h,
 qt/src/signencryptjob.h,
 qt/src/signjob.h,
 qt/src/threadedjobmixin.h,
 qt/src/verifydetachedjob.h,
 qt/src/verifyopaquejob.h: Reduce boost usage.

--
This was mostly done with search and replace to change the
templates / classes from memory and tuple to their c++11
equivalents.
2016-04-03 04:52:16 -08:00
Andre Heinecke
0991485170 Qt: Add static factor methods for protocol
* lang/qt/src/qgpgmebackend.cpp (QGpgME::openpgp, QGpgME::smime): New.
* lang/qt/src/qgpgmebackend.h: Declare.
* lang/qt/tests/t-keylist.cpp (KeyListTest::testSingleKeyListSync):
  Use new functions.

--
This replaces the cryptobackendfactory functionality from libkleo.
2016-04-03 02:29:14 -08:00
Andre Heinecke
faf987dd62 Qt: Add a unit test for qgpgme
* configure.ac: Configure test Makefile.
* m4/qt.m4: Look up Qt5Test flags.
* lang/qt/tests/t-keylist.cpp: New. Simple keylist check.
* lang/qt/tests/Makefile.am: New. General test framework.

--
This test mostly checks that it basically compiles / works and
adds a test framework.
2016-04-03 01:48:46 -08:00
Andre Heinecke
b7b9e38399 Qt: Add missing MOC includes
* qgpgmeadduseridjob.cpp,
 qgpgmechangeexpiryjob.cpp,
 qgpgmechangeownertrustjob.cpp,
 qgpgmechangepasswdjob.cpp,
 qgpgmedecryptjob.cpp,
 qgpgmedecryptverifyjob.cpp,
 qgpgmedeletejob.cpp,
 qgpgmedownloadjob.cpp,
 qgpgmeencryptjob.cpp,
 qgpgmeexportjob.cpp,
 qgpgmeimportfromkeyserverjob.cpp,
 qgpgmeimportjob.cpp,
 qgpgmekeygenerationjob.cpp,
 qgpgmekeylistjob.cpp,
 qgpgmelistallkeysjob.cpp,
 qgpgmerefreshkeysjob.cpp,
 qgpgmesecretkeyexportjob.cpp,
 qgpgmesignencryptjob.cpp,
 qgpgmesignjob.cpp,
 qgpgmesignkeyjob.cpp,
 qgpgmeverifydetachedjob.cpp,
 qgpgmeverifyopaquejob.cpp: Add missing MOC includes.

--
In the CMake world this was handled by cmake automoc
suppport and not neccessary.
2016-04-03 01:33:52 -08:00