Commit Graph

343 Commits

Author SHA1 Message Date
Tobias Fella
e18c09cbc4
qt: Fix validity for (sub)keys generated using QGpgMEQuickJob
* lang/qt/src/qgpgmequickjob.cpp: Fix expiration calculation
--

The job calculates the validity as the seconds since epoch,
while GPG expects the seconds since the current time.
This leads to the validity being significantly longer than expected.

GnuPG-Bug-Id: 6889
2023-12-13 16:43:22 +01:00
Ingo Klöcker
1bbe2d4b70
qt: Start dirmngr with gpgconf to avoid multiple instances
* lang/qt/src/qgpgmewkdlookupjob.cpp (startDirmngr): Use "gpgconf
--launch dirmngr" to start dirmngr.
--

Using gpgconf to start dirmngr prevents multiple instances to be started
by the concurrently running keyserver lookup and WKD lookup.

GnuPG-bug-id: 6833
2023-11-23 16:13:39 +01:00
Ingo Klöcker
618fea9e20
qt: On Windows, use UTF-8 when logging the error text
* lang/qt/src/debug.cpp (operator<<): On Windows, interpret the error
text as UTF-8 instead of local 8-bit encoding.
--

GnuPG-bug-id: 5960
2023-11-15 11:57:18 +01:00
Ingo Klöcker
278f92b189
qt: Remove left-over partial files more persistently
* lang/qt/src/Makefile.am: Add new files.
* lang/qt/src/cleaner.cpp, lang/qt/src/cleaner.h: New.
* lang/qt/src/util.cpp (PartialFileGuard::~PartialFileGuard): Call
Cleaner::removeFile instead of removeFile.
* lang/qt/src/util.cpp, lang/qt/src/util.h (removeFile): Remove.
--

If the initial attempt to remove the file fails then a Cleaner is
created that tries to remove the file at regular intervals (10 s)
and on destruction (which happens on application shutdown).

GnuPG-bug-id: 6584
2023-11-15 11:57:18 +01:00
Ingo Klöcker
52d59d75ca
qt: Deprecate DefaultKeyGenerationJob
* lang/qt/src/defaultkeygenerationjob.h (class DefaultKeyGenerationJob):
Deprecate.
--

GnuPG generates Ed25519 keys by default and has switched to 3072 bits as
default for RSA keys. DefaultKeyGenerationJob always generates RSA 2048
keys and uses the old parameter file API of GnuPG. It shouldn't be used
anymore.

GnuPG-bug-id: 6805
2023-11-10 08:55:07 +01:00
Ingo Klöcker
46f5d5eeb3
qt: Use temporary .part file names when creating archives
* lang/qt/src/util.h, lang/qt/src/util.cpp (class PartialFileGuard):
New.
* lang/qt/src/util.cpp (getRandomCharacters, createPartFileName): New.
* lang/qt/src/qgpgmeencryptarchivejob.cpp (encrypt_to_filename): Use
PartialFileGuard.
* lang/qt/src/qgpgmesignarchivejob.cpp (sign_to_filename): Ditto.
* lang/qt/src/qgpgmesignencryptarchivejob.cpp
(sign_encrypt_to_filename): Ditto.
--

When creating signed and/or encrypted archives, gpgtar now writes the
result to a temporary file name. On success, the archive is renamed to
the final file name. Otherwise, the (partially written) temporary file
is removed (if possible).

GnuPG-bug-id: 6721
2023-10-27 16:07:34 +02:00
Ingo Klöcker
8d8985bda1
qt: Refactor removal of output file on cancel or error
* lang/qt/src/util.h, lang/qt/src/util.cpp (removeFile): New.
* lang/qt/src/qgpgmeencryptarchivejob.cpp (encrypt): Move removal of
output file from here
(encrypt_to_filename): ... to here and use new function.
* lang/qt/src/qgpgmesignarchivejob.cpp (sign): Move removal of output
file from here
(sign_to_filename): ... to here and use new function.
* lang/qt/src/qgpgmesignencryptarchivejob.cpp (sign_encrypt): Move
removal of output file from here
(sign_encrypt_to_filename): ... to here and use new function.
--

GnuPG-bug-id: 6721
2023-10-27 16:07:34 +02:00
Andre Heinecke
ab25df8328
qt: Handle cancel in changeexpiryjob
* lang/qt/src/qgpgmechangeexpiryjob.cpp (change_expiry): Return
cancel error.

--
The classical "cancel is not an error" problem.
GnuPG-Bug-Id: T6754
2023-10-18 11:13:35 +02:00
Ingo Klöcker
5c7e4d252a
qt,doc: Fix typos in source code comments
--

Anonymous contribution

Signed-off-by: Ingo Klöcker <dev@ingo-kloecker.de>
2023-10-13 09:23:24 +02:00
Ingo Klöcker
d43d787e9a
qt: Use UTF-8 for file names on Windows
* lang/qt/src/qgpgmedecryptverifyarchivejob.cpp
(decrypt_verify_from_file_name): On Windows, convert Unicode file name
to UTF-8.
* lang/qt/src/qgpgmeencryptarchivejob.cpp (encrypt,
encrypt_to_filename): On Windows, convert Unicode file name from/to
UTF-8.
* lang/qt/src/qgpgmesignarchivejob.cpp (sign, sign_to_filename): Ditto.
* lang/qt/src/qgpgmesignencryptarchivejob.cpp (sign_encrypt,
sign_encrypt_to_filename): Ditto.
--

On Windows, GnuPG expects file names to be UTF-8-encoded. This fixes
encrypting and decrypting folders with umlauts in the folder name and
in the file name of the archive. Encrypting and decrypting folders
with kanji still fails.

GnuPG-bug-id: 6728
2023-09-22 10:22:18 +02:00
Ingo Klöcker
3f297387bf
qt: Allow specifying user IDs to use when refreshing keys via WKD
* lang/qt/src/wkdrefreshjob.h, lang/qt/src/wkdrefreshjob.cpp
(WKDRefreshJob::start): New overload.
* lang/qt/src/wkdrefreshjob_p.h (WKDRefreshJobPrivate): Add field
m_userIds.
* lang/qt/src/qgpgmewkdrefreshjob.cpp (toEmailAddresses): New.
(locate_external_keys): Change return type and arguments.
(refresh_keys): Remove.
(QGpgMEWKDRefreshJobPrivate::startIt): Get emails from keys or user IDs.
Remove duplicates. Call locate_external_keys instead of refresh_keys.

* lang/qt/tests/run-wkdrefreshjob.cpp (CommandLineOptions,
parseCommandLine): New.
(main): Support new option --all-userids.
--

The new start() overload allows to specify the user IDs to use for the
WKD lookup explicitly. This allows updating user IDs via WKD which were
originally not retrieved via WKD.

GnuPG-bug-id: 6672
2023-08-23 12:00:26 +02:00
Christian Hesse
aee18a2ab2
qt,tests: Fix build in source directory, part 2
* lang/qt/tests/Makefile.am (AM_CPPFLAGS): Include Qt binding sources
before C++ binding sources and C sources.
--

This fixes the problem that the debug.h in the C sources was found
before the one in the Qt bindings.

Commit d23528cadf fixed it for Qt5, we
need Qt6 as well.

GnuPG-bug-id: 6673
2023-08-22 11:15:01 +02:00
Ingo Klöcker
d23528cadf
qt,tests: Fix build in source directory
* lang/qt/tests/Makefile.am (AM_CPPFLAGS): Include Qt binding sources
before C++ binding sources and C sources.
--

This fixes the problem that the debug.h in the C sources was found
before the one in the Qt bindings.

GnuPG-bug-id: 6673
2023-08-21 21:08:01 +02:00
Ingo Klöcker
2ad36f7114
qt: Add job for refreshing OpenPGP keys via WKD
* lang/qt/src/wkdrefreshjob.cpp, lang/qt/src/wkdrefreshjob.h,
lang/qt/src/wkdrefreshjob_p.h, lang/qt/src/qgpgmewkdrefreshjob.cpp,
lang/qt/src/qgpgmewkdrefreshjob.h: New.
* lang/qt/src/protocol.h (class Protocol): Add pure virtual member
function wkdRefreshJob
* lang/qt/src/protocol_p.h (Protocol::wkdRefreshJob): ... and
implement it.
* lang/qt/src/Makefile.am: Update accordingly.

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

This job allows updating keys via WKD. Only user IDs that were
originally retrieved via WKD (i.e. which have origin WKD) are
considered.

GnuPG-bug-id: 6672
2023-08-21 18:06:52 +02:00
Ingo Klöcker
40ca3d5896
qt: Clean up after failure or cancel of sign/encrypt archive operation
* lang/qt/src/qgpgmeencryptarchivejob.cpp (encrypt): Remove output file
if operation was canceled or failed.
* lang/qt/src/qgpgmesignarchivejob.cpp (sign): Ditto.
* lang/qt/src/qgpgmesignencryptarchivejob.cpp (sign_encrypt): Ditto.

* lang/qt/tests/run-encryptarchivejob.cpp (CommandLineOptions): Add
field cancelTimeout.
(parseCommandLine): Add option --cancel-after. Parse option value.
(main): Check for invalid cancel timeout. Start timer for canceling
the job.
* lang/qt/tests/run-signarchivejob.cpp (CommandLineOptions): Add
field cancelTimeout.
(parseCommandLine): Add option --cancel-after. Parse option value.
(main): Check for invalid cancel timeout. Start timer for canceling
the job.
--

This change ensures that the output file is removed if the creation of
a signed or encrypted archive was canceled or failed. The new option
of the test runners enables testing the cancelation of the jobs.

GnuPG-bug-id: 6584
2023-08-16 14:23:15 +02:00
Ingo Klöcker
c3171d0cf1
qt: Make toLogString helper public
* lang/qt/src/util.h: Move toLogString ...
* lang/qt/src/debug.h: ... here.
* lang/qt/tests/run-importjob.cpp (main): Use toLogString.
--

This allows using the helper in dependent projects without duplicating
it everywhere.

GnuPG-bug-id: 6584
2023-08-15 11:56:40 +02:00
Carl Schwan
d91d037fc1
qt: Add setInputEncoding to QGpgMe::EncryptJob
* lang/qt/src/encryptjob.cpp, lang/qt/src/encryptjob.h,
lang/qt/src/encryptjob_p.h: Add inputEncoding/setInputEncoding
to EncryptJob
* lang/qt/src/qgpgmeencryptjob.cpp: Use newly added inputEncoding
to set encoding hint of the encrypted content
--

This allows applications like KMail to set the input encoding of the
encrypted content, which simplify and improve the performance of
identifying the content type then decrypting it.

GnuPG-bug-id: 6616
Signed-off-by: Carl Schwan <carl.schwan@gnupg.com>
2023-08-03 11:53:06 +02:00
Ingo Klöcker
e3defc0adf
qt: Ensure that we check the correct paths
* lang/qt/src/QGpgmeConfig-w32.cmake.in.in,
lang/qt/src/QGpgmeQt6Config-w32.cmake.in.in: Get paths to check from
the target properties.
--

This avoids the error present in an older version where the files to
check used the correct path, but a wrong path of the DLL was set in the
target properties.
2023-07-08 21:49:12 +02:00
Ingo Klöcker
be0e653ce3
qt: Fix DLL version in cmake config files
* lang/qt/src/QGpgmeConfig-w32.cmake.in.in,
lang/qt/src/QGpgmeQt6Config-w32.cmake.in.in: Fix name and path of DLL.
--

Co-authored-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: Ingo Klöcker <dev@ingo-kloecker.de>
2023-07-08 21:49:12 +02:00
Ingo Klöcker
ad34fcbbec
qt: Fix check for required files
* lang/qt/src/QGpgmeConfig-w32.cmake.in.in: Fix typos in variable names.
--

Because of those typos the loop over the files to check was an empty
loops and therefore the wrong name of the DLL was never noticed.
2023-07-08 21:49:12 +02:00
Ingo Klöcker
1c2459a592
qt: Support reading signed/encrypted archives directly from a file
* lang/qt/src/decryptverifyarchivejob.cpp,
lang/qt/src/decryptverifyarchivejob.h (DecryptVerifyArchiveJob): Add
member functions setInputFile, inputFile.
* lang/qt/src/decryptverifyarchivejob_p.h
(DecryptVerifyArchiveJobPrivate): Add member m_inputFilePath.
* lang/qt/src/qgpgmedecryptverifyarchivejob.cpp (decrypt_verify): Move
creation of indata to decrypt_verify_from_io_device.
(decrypt_verify_from_io_device, decrypt_verify_from_file_name): New.
(QGpgMEDecryptVerifyArchiveJob::start): Use
decrypt_verify_from_io_device instead of decrypt_verify.
(QGpgMEDecryptVerifyArchiveJobPrivate::startIt): Start the job with the
values from member variables.

* lang/qt/tests/run-decryptverifyarchivejob.cpp (createInput): Remove.
(main): Remove creation of input. Make the job read the archive directly
from the given archive name.
--

This makes it possible to tell gpgtar to read the signed/encrypted
archive directly from a specified file bypassing GpgME's Data IO.

GnuPG-bug-id: 6530
2023-06-21 15:25:11 +02:00
Ingo Klöcker
e608315392
qt: Support writing signed/encrypted archives directly to a file
* lang/qt/src/encryptarchivejob.cpp, lang/qt/src/encryptarchivejob.h
(EncryptArchiveJob): Add member functions setRecipients, recipients,
setInputPaths, inputPaths, setOutputFile, outputFile,
setEncryptionFlags, encryptionFlags.
* lang/qt/src/encryptarchivejob_p.h (EncryptArchiveJobPrivate): Add
members m_recipients, m_inputPaths, m_outputFilePath, m_encryptionFlags.
* lang/qt/src/qgpgmeencryptarchivejob.cpp (encrypt): Move creation of
outdata to encrypt_to_io_device.
(encrypt_to_io_device, encrypt_to_filename): New.
(QGpgMEEncryptArchiveJob::start): Use encrypt_to_io_device instead of
encrypt.
(QGpgMEEncryptArchiveJobPrivate::startIt): Start the job with the
values from member variables.
* lang/qt/src/qgpgmesignarchivejob.cpp (sign): Move creation of
outdata to sign_to_io_device.
(sign_to_io_device, sign_to_filename): New.
(QGpgMESignArchiveJob::start): Use sign_to_io_device instead of sign.
(QGpgMESignArchiveJobPrivate::startIt): Start the job with the
values from member variables.
* lang/qt/src/qgpgmesignencryptarchivejob.cpp (sign_encrypt): Move
creation of outdata to sign_encrypt_to_io_device.
(sign_encrypt_to_io_device, sign_encrypt_to_filename): New.
(QGpgMESignEncryptArchiveJob::start): Use sign_encrypt_to_io_device
instead of sign_encrypt.
(QGpgMESignEncryptArchiveJobPrivate::startIt): Start the job with the
values from member variables.
* lang/qt/src/signarchivejob.cpp, lang/qt/src/signarchivejob.h
(SignArchiveJob): Add member functions setSigner, signers,
setInputPaths, inputPaths, setOutputFile, outputFile.
* lang/qt/src/signarchivejob_p.h (SignArchiveJobPrivate): Add
members m_signers, m_inputPaths, m_outputFilePath.
* lang/qt/src/signencryptarchivejob.cpp,
lang/qt/src/signencryptarchivejob.h (SignEncryptArchiveJob): Add
member functions setSigner, signers, setRecipients, recipients,
setInputPaths, inputPaths, setOutputFile, outputFile,
setEncryptionFlags, encryptionFlags.
* lang/qt/src/signencryptarchivejob_p.h (SignEncryptArchiveJobPrivate):
Add members m_signers, m_recipients, m_inputPaths, m_outputFilePath,
m_encryptionFlags.

* lang/qt/tests/run-encryptarchivejob.cpp (createOutput): Remove.
(checkOutputFilePath): New.
(main): Create file output writing to stdout if no archive name (or "-")
is given. Exit if file with given archive name already exists. Make
the jobs write the created archive directly to the given archive name.
* lang/qt/tests/run-signarchivejob.cpp (createOutput): Remove.
(checkOutputFilePath): New.
(main): Create file output writing to stdout if no archive name (or "-")
is given. Exit if file with given archive name already exists. Make
the jobs write the created archive directly to the given archive name.
--

This makes it possible to tell gpgtar to write the created archive
directly to a specified file bypassing GpgME's Data IO.

GnuPG-bug-id: 6530
2023-06-19 18:21:46 +02:00
Ingo Klöcker
8b9fabf5d5
qt: Add a generic hook to start a job
* lang/qt/src/job.cpp, lang/qt/src/job.h (Job::startIt): New method.
* lang/qt/src/job_p.h (JobPrivate::startIt): New pure virtual method.
* lang/qt/src/qgpgmechangeexpiryjob.cpp
(QGpgMEChangeExpiryJobPrivate::startIt): New.
* lang/qt/src/qgpgmedecryptverifyarchivejob.cpp
(QGpgMEDecryptVerifyArchiveJobPrivate::startIt): New.
* lang/qt/src/qgpgmeencryptarchivejob.cpp
(QGpgMEEncryptArchiveJobPrivate::startIt): New.
* lang/qt/src/qgpgmeencryptjob.cpp (QGpgMEEncryptJobPrivate::startIt):
New.
* lang/qt/src/qgpgmeimportjob.cpp (QGpgMEImportJobPrivate::startIt):
New.
* lang/qt/src/qgpgmelistallkeysjob.cpp
(QGpgMEListAllKeysJobPrivate::startIt): New.
* lang/qt/src/qgpgmesignarchivejob.cpp
(QGpgMESignArchiveJobPrivate::startIt): New.
* lang/qt/src/qgpgmesignencryptarchivejob.cpp
(QGpgMESignEncryptArchiveJobPrivate::startIt): New.
* lang/qt/src/qgpgmesignencryptjob.cpp
(QGpgMESignEncryptJobPrivate::startIt): New.
--

startIt() starts a job if the necessary values have been set before.
This makes it possible to extend jobs with additional ways to start them
without having to worry about overloading existing virtual start()
methods. This will be used first for the different archive jobs.

GnuPG-bug-id: 6530
2023-06-19 18:08:47 +02:00
Ingo Klöcker
23526c3ff2
qt: Make the run methods of ThreadedJobMixin public
* lang/qt/src/threadedjobmixin.h (ThreadedJobMixin::run): Make all
overloads public.
--

This allows calling the run() functions from the JobPrivate subclasses.

GnuPG-bug-id: 6530
2023-06-19 17:58:23 +02:00
Ingo Klöcker
4655b2dc6b
qt: Rename JobPrivate::start to JobPrivate::startNow
* lang/qt/src/job_p.h (JobPrivate::start): Rename to startNow.
* lang/qt/src/job.cpp (Job::startNow): Adapt function call.
* lang/qt/src/qgpgmechangeexpiryjob.cpp
(QGpgMEChangeExpiryJobPrivate::start): Rename to startNow.
* lang/qt/src/qgpgmedecryptverifyarchivejob.cpp
(QGpgMEDecryptVerifyArchiveJobPrivate::start): Rename to startNow.
* lang/qt/src/qgpgmeencryptarchivejob.cpp
(QGpgMEEncryptArchiveJobPrivate::start): Rename to startNow.
* lang/qt/src/qgpgmeencryptjob.cpp (QGpgMEEncryptJobPrivate::start):
Rename to startNow.
* lang/qt/src/qgpgmeimportjob.cpp (QGpgMEImportJobPrivate::start):
Rename to startNow.
* lang/qt/src/qgpgmelistallkeysjob.cpp
(QGpgMEListAllKeysJobPrivate::start): Rename to startNow.
* lang/qt/src/qgpgmesignarchivejob.cpp
(QGpgMESignArchiveJobPrivate::start): Rename to startNow.
* lang/qt/src/qgpgmesignencryptarchivejob.cpp
(QGpgMESignEncryptArchiveJobPrivate::start): Rename to startNow.
* lang/qt/src/qgpgmesignencryptjob.cpp
(QGpgMESignEncryptJobPrivate::start): Rename to startNow.
--

Using the same name for the public and the private method avoids
confusion.

GnuPG-bug-id: 6530
2023-06-19 17:58:23 +02:00
Ingo Klöcker
6f6b35df50
qt: Return const pointer to JobPrivate class for const pointer to Job
* lang/qt/src/job.cpp, lang/qt/src/job_p.h (getJobPrivate): Replace with
two overloads for non-const pointer and const pointer to Job.
* lang/qt/src/job_p.h (jobPrivate): Replace with two template functions
for non-const pointer and const pointer to Job.
--

This helps avoid changing values stored in the JobPrivate class in
const functions (e.g. getters) of Job classes.

GnuPG-bug-id: 6530
2023-06-19 17:58:23 +02:00
Andre Heinecke
5811d069d3
qt, cpp: Support larger size-hint on 32 bit builds
* NEWS: Mention this.
* lang/cpp/src/data.h, lang/cpp/src/data.cpp (Data::setSizeHint): New.
* lang/qt/src/qgpgmedecryptjob.cpp,
 lang/qt/src/qgpgmedecryptverifyarchivejob.cpp,
 lang/qt/src/qgpgmedecryptverifyjob.cpp,
 lang/qt/src/qgpgmeencryptjob.cpp,
 lang/qt/src/qgpgmesignencryptjob.cpp,
 lang/qt/src/qgpgmesignjob.cpp,
 lang/qt/src/qgpgmeverifydetachedjob.cpp,
 lang/qt/src/qgpgmeverifyopaquejob.cpp: Set size for input IODevice.

--
This fixes the case where the old detection of the size of QIOdevice
using seek would overflow and instead explicitly uses QIODevice::size
to check for the size and pass it through as an uint64.

GnuPG-Bug-Id: T6534
2023-06-16 14:33:19 +02:00
Ingo Klöcker
73e46b3465
qt: Add signals for file-based and data-based progress
* lang/qt/src/decryptverifyarchivejob.h (DecryptVerifyArchiveJob): Add
signals fileProgress and dataProgress.
* lang/qt/src/encryptarchivejob.h (EncryptArchiveJob): Ditto.
* lang/qt/src/signarchivejob.h (SignArchiveJob): Ditto.
* lang/qt/src/signencryptarchivejob.h (SignEncryptArchiveJob): Ditto.
* lang/qt/src/job_p.h (emitArchiveProgressSignals): New.
* lang/qt/src/qgpgmedecryptverifyarchivejob.cpp
(QGpgMEDecryptVerifyArchiveJob::QGpgMEDecryptVerifyArchiveJob): Emit
appropriate signal when receiving Job::rawProgress signal.
* lang/qt/src/qgpgmeencryptarchivejob.cpp
(QGpgMEEncryptArchiveJob::QGpgMEEncryptArchiveJob): Ditto.
* lang/qt/src/qgpgmesignarchivejob.cpp
(QGpgMESignArchiveJob::QGpgMESignArchiveJob): Ditto.
* lang/qt/src/qgpgmesignencryptarchivejob.cpp
(QGpgMESignEncryptArchiveJob::QGpgMESignEncryptArchiveJob): Ditto.
--

GnuPG-bug-id: 6342
2023-02-14 09:25:21 +01:00
Ingo Klöcker
ccff6a96fc
qt: Remove commented out code
--

GnuPG-bug-id: 6342
2023-02-14 09:25:21 +01:00
Ingo Klöcker
ea6f15ed60
qt: Add simple and extended progress signals replacing old signal
* lang/qt/src/job.h (Job): Add signals jobProgress and rawProgress.
Deprecate signal progress.
* lang/qt/src/multideletejob.cpp (MultiDeleteJob::slotResult): Emit
new progress signals.
* lang/qt/src/qgpgmerefreshsmimekeysjob.cpp
(QGpgMERefreshSMIMEKeysJob::slotStatus): Ditto.
* lang/qt/src/threadedjobmixin.h (ThreadedJobMixin::showProgress): Use
modern overload of QMetaObject::invokeMethod to forward the progress
signal and add the value of what. Add forwarding of progress to the new
signals.

* lang/qt/tests/t-encrypt.cpp (EncryptionTest::testProgress): Test
the new signals instead of the deprecated one.
--

The new signal jobProgress omits the what value which is useless for
most consumers. The new signal rawProgress makes all information
provided by the backend available to consumers. The latter is not
really meant to be used by users of gpgme. It will be used by the
archive jobs to provide more user-friendly signals.

GnuPG-bug-id: 6342
2023-02-14 09:25:21 +01:00
Ingo Klöcker
7098c14b23
tests: Stop daemons after setting up test environment
* lang/python/tests/Makefile.am, lang/qt/tests/Makefile.am,
tests/gpg/Makefile.am, tests/json/Makefile.am (pubring-stamp): Call
`gpgconf --kill all` after importing test keys.
--

This ensures that no gpg-agents or other daemons are running after
"make".
2023-02-09 09:33:07 +01:00
Ingo Klöcker
52fd0bcde4
qt,tests: Add test for the previous commit
* lang/qt/tests/t-decryptverify.cpp: New.
* lang/qt/tests/Makefile.am: Add new test.
--

GnuPG-bug-id: 6342
2023-02-02 12:11:30 +01:00
Ingo Klöcker
c407728064
qt: Add job for extracting encrypted and signed archives
* lang/qt/src/decryptverifyarchivejob.cpp,
lang/qt/src/decryptverifyarchivejob.h,
lang/qt/src/decryptverifyarchivejob_p.h,
lang/qt/src/qgpgmedecryptverifyarchivejob.cpp,
lang/qt/src/qgpgmedecryptverifyarchivejob.h: New.
* lang/qt/src/protocol.h (class Protocol): Add pure virtual member
function decryptVerifyArchiveJob
* lang/qt/src/protocol_p.h (Protocol::decryptVerifyArchiveJob): ... and
implement it.
* lang/qt/src/Makefile.am: Update accordingly.

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

GnuPG-bug-id: 6342
2023-02-02 12:11:29 +01:00
Ingo Klöcker
55c948866f
qt: Allow checking if the sign/encrypt archive jobs are supported
* lang/qt/src/encryptarchivejob.cpp, lang/qt/src/encryptarchivejob.h
(isSupported): New.
* lang/qt/src/signarchivejob.cpp, lang/qt/src/signarchivejob.h
(isSupported): New.
* lang/qt/src/signencryptarchivejob.cpp,
lang/qt/src/signencryptarchivejob.h (isSupported): New.

* lang/qt/tests/run-encryptarchivejob.cpp (main),
lang/qt/tests/run-signarchivejob.cpp (main): Check if jobs are
supported.
--

GnuPG-bug-id: 6342
2023-02-02 09:47:11 +01:00
Ingo Klöcker
343fb33bf0
qt: Fix build without installed gpgme++ headers
* lang/qt/src/filelistdataprovider.cpp: Include error.h without
folder prefix.
--

GnuPG-bug-id: 6342
2023-01-31 21:13:07 +01:00
Ingo Klöcker
d3a8c2c8b6
qt: Remove unused and commented-out code
* lang/qt/src/qgpgmeencryptarchivejob.cpp,
lang/qt/src/qgpgmeencryptarchivejob.h (QGpgMEEncryptArchiveJob):
Remove member function resultHook and member mResult.
* lang/qt/src/qgpgmesignarchivejob.cpp,
lang/qt/src/qgpgmesignarchivejob.h (QGpgMESignArchiveJob):
Remove member function resultHook and member mResult.
--

GnuPG-bug-id: 6342
2023-01-31 12:01:33 +01:00
Ingo Klöcker
8c4436e73a
qt: Add job for creating encrypted signed archives
* lang/qt/src/signencryptarchivejob.cpp,
lang/qt/src/signencryptarchivejob.h,
lang/qt/src/signencryptarchivejob_p.h,
lang/qt/src/qgpgmesignencryptarchivejob.cpp,
lang/qt/src/qgpgmesignencryptarchivejob.h: New.
* lang/qt/src/protocol.h (class Protocol): Add pure virtual member
function signEncryptArchiveJob
* lang/qt/src/protocol_p.h (Protocol::signEncryptArchiveJob): ... and
implement it.
* lang/qt/src/Makefile.am: Update accordingly.

* lang/qt/tests/run-encryptarchivejob.cpp (displayName): Remove.
(CommandLineOptions): Initialize member armor. Add member sign.
(parseCommandLine): Update application description. Add and parse option
-s/--sign.
(main): Use SignEncryptArchiveJob if sign option is set.
--

GnuPG-bug-id: 6342
2023-01-31 12:01:33 +01:00
Ingo Klöcker
2b98585c89
qt,tests: Avoid leaking Context
* lang/qt/tests/t-import.cpp: Wrap Context*s in unique_ptr.
--

This fixes leaks found with -fsanitize=address.
2023-01-31 12:01:33 +01:00
Ingo Klöcker
8d672b3b7e
qt: Add job for creating signed archives
* lang/qt/src/signarchivejob.cpp, lang/qt/src/signarchivejob.h,
lang/qt/src/signarchivejob_p.h,
lang/qt/src/qgpgmesignarchivejob.cpp,
lang/qt/src/qgpgmesignarchivejob.h: New.
* lang/qt/src/protocol.h (class Protocol): Add pure virtual member
function signArchiveJob
* lang/qt/src/protocol_p.h (Protocol::signArchiveJob): ... and
implement it.
* lang/qt/src/Makefile.am: Update accordingly.

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

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

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

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

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

GnuPG-bug-id: 6342
2023-01-27 12:17:09 +01:00
Ingo Klöcker
64da77620a
qt: Fix comparisons of integer expressions of different signedness
* lang/qt/tests/t-import.cpp (ImportTest::testImportWithImportFilter):
Make integer literal unsigned.
--
2023-01-05 20:33:45 +01:00
Ingo Klöcker
e16c368758
qt: Replace Q_DECL_OVERRIDE with override
* lang/qt/src/defaultkeygenerationjob.h,
lang/qt/src/hierarchicalkeylistjob.h, lang/qt/src/multideletejob.h,
lang/qt/src/protocol_p.h, lang/qt/src/qgpgmeadduseridjob.h,
lang/qt/src/qgpgmechangeexpiryjob.h,
lang/qt/src/qgpgmechangeownertrustjob.h,
lang/qt/src/qgpgmechangepasswdjob.h, lang/qt/src/qgpgmedecryptjob.h,
lang/qt/src/qgpgmedecryptverifyjob.h, lang/qt/src/qgpgmedeletejob.h,
lang/qt/src/qgpgmedownloadjob.h, lang/qt/src/qgpgmeencryptjob.h,
lang/qt/src/qgpgmeexportjob.h, lang/qt/src/qgpgmegpgcardjob.h,
lang/qt/src/qgpgmeimportfromkeyserverjob.h,
lang/qt/src/qgpgmeimportjob.h, lang/qt/src/qgpgmekeyformailboxjob.h,
lang/qt/src/qgpgmekeygenerationjob.h, lang/qt/src/qgpgmekeylistjob.h,
lang/qt/src/qgpgmelistallkeysjob.h, lang/qt/src/qgpgmenewcryptoconfig.h,
lang/qt/src/qgpgmequickjob.h, lang/qt/src/qgpgmerefreshsmimekeysjob.h,
lang/qt/src/qgpgmesignencryptjob.h, lang/qt/src/qgpgmesignjob.h,
lang/qt/src/qgpgmesignkeyjob.h, lang/qt/src/qgpgmetofupolicyjob.h,
lang/qt/src/qgpgmeverifydetachedjob.h,
lang/qt/src/qgpgmeverifyopaquejob.h, lang/qt/src/qgpgmewkdlookupjob.h,
lang/qt/src/qgpgmewkspublishjob.h, lang/qt/src/threadedjobmixin.h,
lang/qt/tests/t-support.h: Replace Q_DECL_OVERRIDE with override
--

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

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

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

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

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

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

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

GnuPG-bug-id: 6323
2023-01-04 11:37:11 +01:00
Ingo Klöcker
d04d7b174f
qt: Write path values with Unix directory separators
* lang/qt/src/qgpgmenewcryptoconfig.cpp
(QGpgMENewCryptoConfigEntry::setURLValue): Remove conversion to native
directory separators.
--

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

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

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

This allows building with Qt 6 without Core5Compat.
2022-10-11 11:00:15 +02:00