aboutsummaryrefslogtreecommitdiffstats
path: root/lang/qt/src
diff options
context:
space:
mode:
Diffstat (limited to 'lang/qt/src')
-rw-r--r--lang/qt/src/Makefile.am509
-rw-r--r--lang/qt/src/QGpgmeConfig-w32.cmake.in.in109
-rw-r--r--lang/qt/src/QGpgmeConfig.cmake.in.in101
-rw-r--r--lang/qt/src/QGpgmeConfigVersion.cmake.in31
-rw-r--r--lang/qt/src/QGpgmeQt6Config-w32.cmake.in.in109
-rw-r--r--lang/qt/src/QGpgmeQt6Config.cmake.in.in101
-rw-r--r--lang/qt/src/QGpgmeQt6ConfigVersion.cmake.in31
-rw-r--r--lang/qt/src/abstractimportjob.h65
-rw-r--r--lang/qt/src/addexistingsubkeyjob.h79
-rw-r--r--lang/qt/src/adduseridjob.h85
-rw-r--r--lang/qt/src/changeexpiryjob.cpp62
-rw-r--r--lang/qt/src/changeexpiryjob.h111
-rw-r--r--lang/qt/src/changeexpiryjob_p.h51
-rw-r--r--lang/qt/src/changeownertrustjob.h78
-rw-r--r--lang/qt/src/changepasswdjob.h83
-rw-r--r--lang/qt/src/cleaner.cpp99
-rw-r--r--lang/qt/src/cleaner.h60
-rw-r--r--lang/qt/src/cryptoconfig.cpp75
-rw-r--r--lang/qt/src/cryptoconfig.h424
-rw-r--r--lang/qt/src/dataprovider.cpp301
-rw-r--r--lang/qt/src/dataprovider.h98
-rw-r--r--lang/qt/src/debug.cpp55
-rw-r--r--lang/qt/src/debug.h64
-rw-r--r--lang/qt/src/decryptjob.h99
-rw-r--r--lang/qt/src/decryptverifyarchivejob.cpp95
-rw-r--r--lang/qt/src/decryptverifyarchivejob.h130
-rw-r--r--lang/qt/src/decryptverifyarchivejob_p.h51
-rw-r--r--lang/qt/src/decryptverifyjob.cpp86
-rw-r--r--lang/qt/src/decryptverifyjob.h146
-rw-r--r--lang/qt/src/decryptverifyjob_p.h51
-rw-r--r--lang/qt/src/defaultkeygenerationjob.cpp134
-rw-r--r--lang/qt/src/defaultkeygenerationjob.h80
-rw-r--r--lang/qt/src/deletejob.h84
-rw-r--r--lang/qt/src/dn.cpp497
-rw-r--r--lang/qt/src/dn.h137
-rw-r--r--lang/qt/src/downloadjob.h104
-rw-r--r--lang/qt/src/encryptarchivejob.cpp119
-rw-r--r--lang/qt/src/encryptarchivejob.h151
-rw-r--r--lang/qt/src/encryptarchivejob_p.h53
-rw-r--r--lang/qt/src/encryptjob.cpp122
-rw-r--r--lang/qt/src/encryptjob.h198
-rw-r--r--lang/qt/src/encryptjob_p.h60
-rw-r--r--lang/qt/src/exportjob.h95
-rw-r--r--lang/qt/src/filelistdataprovider.cpp98
-rw-r--r--lang/qt/src/filelistdataprovider.h75
-rw-r--r--lang/qt/src/gpgcardjob.h74
-rw-r--r--lang/qt/src/hierarchicalkeylistjob.h122
-rw-r--r--lang/qt/src/importfromkeyserverjob.h85
-rw-r--r--lang/qt/src/importjob.cpp87
-rw-r--r--lang/qt/src/importjob.h98
-rw-r--r--lang/qt/src/importjob_p.h54
-rw-r--r--lang/qt/src/job.cpp214
-rw-r--r--lang/qt/src/job.h152
-rw-r--r--lang/qt/src/job_p.h98
-rw-r--r--lang/qt/src/keyformailboxjob.h99
-rw-r--r--lang/qt/src/keygenerationjob.h86
-rw-r--r--lang/qt/src/keylistjob.h106
-rw-r--r--lang/qt/src/listallkeysjob.cpp53
-rw-r--r--lang/qt/src/listallkeysjob.h116
-rw-r--r--lang/qt/src/listallkeysjob_p.h51
-rw-r--r--lang/qt/src/multideletejob.cpp123
-rw-r--r--lang/qt/src/multideletejob.h108
-rw-r--r--lang/qt/src/protocol.h235
-rw-r--r--lang/qt/src/protocol_p.h575
-rw-r--r--lang/qt/src/qgpgme_debug.cpp14
-rw-r--r--lang/qt/src/qgpgme_debug.h10
-rw-r--r--lang/qt/src/qgpgme_export.h84
-rw-r--r--lang/qt/src/qgpgme_version.h.in42
-rw-r--r--lang/qt/src/qgpgmeaddexistingsubkeyjob.cpp96
-rw-r--r--lang/qt/src/qgpgmeaddexistingsubkeyjob.h68
-rw-r--r--lang/qt/src/qgpgmeadduseridjob.cpp85
-rw-r--r--lang/qt/src/qgpgmeadduseridjob.h66
-rw-r--r--lang/qt/src/qgpgmebackend.cpp222
-rw-r--r--lang/qt/src/qgpgmebackend.h95
-rw-r--r--lang/qt/src/qgpgmechangeexpiryjob.cpp133
-rw-r--r--lang/qt/src/qgpgmechangeexpiryjob.h72
-rw-r--r--lang/qt/src/qgpgmechangeownertrustjob.cpp96
-rw-r--r--lang/qt/src/qgpgmechangeownertrustjob.h66
-rw-r--r--lang/qt/src/qgpgmechangepasswdjob.cpp84
-rw-r--r--lang/qt/src/qgpgmechangepasswdjob.h67
-rw-r--r--lang/qt/src/qgpgmedecryptjob.cpp128
-rw-r--r--lang/qt/src/qgpgmedecryptjob.h75
-rw-r--r--lang/qt/src/qgpgmedecryptverifyarchivejob.cpp169
-rw-r--r--lang/qt/src/qgpgmedecryptverifyarchivejob.h68
-rw-r--r--lang/qt/src/qgpgmedecryptverifyjob.cpp228
-rw-r--r--lang/qt/src/qgpgmedecryptverifyjob.h76
-rw-r--r--lang/qt/src/qgpgmedeletejob.cpp70
-rw-r--r--lang/qt/src/qgpgmedeletejob.h72
-rw-r--r--lang/qt/src/qgpgmedownloadjob.cpp105
-rw-r--r--lang/qt/src/qgpgmedownloadjob.h70
-rw-r--r--lang/qt/src/qgpgmeencryptarchivejob.cpp192
-rw-r--r--lang/qt/src/qgpgmeencryptarchivejob.h70
-rw-r--r--lang/qt/src/qgpgmeencryptjob.cpp257
-rw-r--r--lang/qt/src/qgpgmeencryptjob.h98
-rw-r--r--lang/qt/src/qgpgmeexportjob.cpp115
-rw-r--r--lang/qt/src/qgpgmeexportjob.h81
-rw-r--r--lang/qt/src/qgpgmegpgcardjob.cpp131
-rw-r--r--lang/qt/src/qgpgmegpgcardjob.h63
-rw-r--r--lang/qt/src/qgpgmeimportfromkeyserverjob.cpp80
-rw-r--r--lang/qt/src/qgpgmeimportfromkeyserverjob.h72
-rw-r--r--lang/qt/src/qgpgmeimportjob.cpp172
-rw-r--r--lang/qt/src/qgpgmeimportjob.h76
-rw-r--r--lang/qt/src/qgpgmekeyformailboxjob.cpp142
-rw-r--r--lang/qt/src/qgpgmekeyformailboxjob.h80
-rw-r--r--lang/qt/src/qgpgmekeygenerationjob.cpp76
-rw-r--r--lang/qt/src/qgpgmekeygenerationjob.h69
-rw-r--r--lang/qt/src/qgpgmekeylistjob.cpp164
-rw-r--r--lang/qt/src/qgpgmekeylistjob.h80
-rw-r--r--lang/qt/src/qgpgmelistallkeysjob.cpp241
-rw-r--r--lang/qt/src/qgpgmelistallkeysjob.h73
-rw-r--r--lang/qt/src/qgpgmenewcryptoconfig.cpp819
-rw-r--r--lang/qt/src/qgpgmenewcryptoconfig.h188
-rw-r--r--lang/qt/src/qgpgmequickjob.cpp211
-rw-r--r--lang/qt/src/qgpgmequickjob.h78
-rw-r--r--lang/qt/src/qgpgmereceivekeysjob.cpp73
-rw-r--r--lang/qt/src/qgpgmereceivekeysjob.h69
-rw-r--r--lang/qt/src/qgpgmerefreshsmimekeysjob.cpp256
-rw-r--r--lang/qt/src/qgpgmerefreshsmimekeysjob.h78
-rw-r--r--lang/qt/src/qgpgmerevokekeyjob.cpp127
-rw-r--r--lang/qt/src/qgpgmerevokekeyjob.h70
-rw-r--r--lang/qt/src/qgpgmesetprimaryuseridjob.cpp75
-rw-r--r--lang/qt/src/qgpgmesetprimaryuseridjob.h64
-rw-r--r--lang/qt/src/qgpgmesignarchivejob.cpp196
-rw-r--r--lang/qt/src/qgpgmesignarchivejob.h69
-rw-r--r--lang/qt/src/qgpgmesignencryptarchivejob.cpp212
-rw-r--r--lang/qt/src/qgpgmesignencryptarchivejob.h72
-rw-r--r--lang/qt/src/qgpgmesignencryptjob.cpp266
-rw-r--r--lang/qt/src/qgpgmesignencryptjob.h106
-rw-r--r--lang/qt/src/qgpgmesignjob.cpp280
-rw-r--r--lang/qt/src/qgpgmesignjob.h90
-rw-r--r--lang/qt/src/qgpgmesignkeyjob.cpp242
-rw-r--r--lang/qt/src/qgpgmesignkeyjob.h98
-rw-r--r--lang/qt/src/qgpgmetofupolicyjob.cpp70
-rw-r--r--lang/qt/src/qgpgmetofupolicyjob.h66
-rw-r--r--lang/qt/src/qgpgmeverifydetachedjob.cpp201
-rw-r--r--lang/qt/src/qgpgmeverifydetachedjob.h76
-rw-r--r--lang/qt/src/qgpgmeverifyopaquejob.cpp216
-rw-r--r--lang/qt/src/qgpgmeverifyopaquejob.h75
-rw-r--r--lang/qt/src/qgpgmewkdlookupjob.cpp185
-rw-r--r--lang/qt/src/qgpgmewkdlookupjob.h70
-rw-r--r--lang/qt/src/qgpgmewkdrefreshjob.cpp159
-rw-r--r--lang/qt/src/qgpgmewkdrefreshjob.h64
-rw-r--r--lang/qt/src/qgpgmewkspublishjob.cpp195
-rw-r--r--lang/qt/src/qgpgmewkspublishjob.h71
-rw-r--r--lang/qt/src/quickjob.cpp52
-rw-r--r--lang/qt/src/quickjob.h101
-rw-r--r--lang/qt/src/quickjob_p.h51
-rw-r--r--lang/qt/src/receivekeysjob.h66
-rw-r--r--lang/qt/src/refreshkeysjob.h96
-rw-r--r--lang/qt/src/revokekeyjob.h86
-rw-r--r--lang/qt/src/setprimaryuseridjob.h69
-rw-r--r--lang/qt/src/signarchivejob.cpp107
-rw-r--r--lang/qt/src/signarchivejob.h141
-rw-r--r--lang/qt/src/signarchivejob_p.h52
-rw-r--r--lang/qt/src/signencryptarchivejob.cpp131
-rw-r--r--lang/qt/src/signencryptarchivejob.h165
-rw-r--r--lang/qt/src/signencryptarchivejob_p.h54
-rw-r--r--lang/qt/src/signencryptjob.cpp122
-rw-r--r--lang/qt/src/signencryptjob.h213
-rw-r--r--lang/qt/src/signencryptjob_p.h59
-rw-r--r--lang/qt/src/signjob.cpp110
-rw-r--r--lang/qt/src/signjob.h176
-rw-r--r--lang/qt/src/signjob_p.h56
-rw-r--r--lang/qt/src/signkeyjob.h164
-rw-r--r--lang/qt/src/specialjob.h92
-rw-r--r--lang/qt/src/threadedjobmixin.cpp152
-rw-r--r--lang/qt/src/threadedjobmixin.h302
-rw-r--r--lang/qt/src/tofupolicyjob.h77
-rw-r--r--lang/qt/src/util.cpp173
-rw-r--r--lang/qt/src/util.h91
-rw-r--r--lang/qt/src/verifydetachedjob.cpp86
-rw-r--r--lang/qt/src/verifydetachedjob.h130
-rw-r--r--lang/qt/src/verifydetachedjob_p.h51
-rw-r--r--lang/qt/src/verifyopaquejob.cpp86
-rw-r--r--lang/qt/src/verifyopaquejob.h142
-rw-r--r--lang/qt/src/verifyopaquejob_p.h51
-rw-r--r--lang/qt/src/wkdlookupjob.h78
-rw-r--r--lang/qt/src/wkdlookupresult.cpp117
-rw-r--r--lang/qt/src/wkdlookupresult.h84
-rw-r--r--lang/qt/src/wkdrefreshjob.cpp64
-rw-r--r--lang/qt/src/wkdrefreshjob.h80
-rw-r--r--lang/qt/src/wkdrefreshjob_p.h52
-rw-r--r--lang/qt/src/wkspublishjob.h108
183 files changed, 0 insertions, 21949 deletions
diff --git a/lang/qt/src/Makefile.am b/lang/qt/src/Makefile.am
deleted file mode 100644
index 9b904e2d..00000000
--- a/lang/qt/src/Makefile.am
+++ /dev/null
@@ -1,509 +0,0 @@
-# Makefile.am for QGpgME.
-# Copyright (C) 2016 Bundesamt für Sicherheit in der Informationstechnik
-# Software engineering by Intevation GmbH
-#
-# This file is part of QGpgME, the Qt API binding for GpgME.
-#
-# QGpgME is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# QGpgME is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA
-
-if WANT_QT5
-libqgpgme_la = libqgpgme.la
-endif
-if WANT_QT6
-libqgpgmeqt6_la = libqgpgmeqt6.la
-endif
-lib_LTLIBRARIES = $(libqgpgme_la) $(libqgpgmeqt6_la)
-
-EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \
- qgpgme_debug.h qgpgme_version.h.in \
- QGpgmeConfig-w32.cmake.in.in QGpgmeQt6Config.cmake.in.in \
- QGpgmeQt6Config-w32.cmake.in.in QGpgmeQt6ConfigVersion.cmake.in
-
-qgpgme_sources = \
- cleaner.cpp \
- dataprovider.cpp \
- debug.cpp \
- decryptverifyarchivejob.cpp \
- decryptverifyjob.cpp \
- encryptarchivejob.cpp \
- filelistdataprovider.cpp \
- job.cpp multideletejob.cpp qgpgmeadduseridjob.cpp \
- qgpgmeaddexistingsubkeyjob.cpp \
- qgpgmebackend.cpp qgpgmechangeexpiryjob.cpp qgpgmechangeownertrustjob.cpp \
- qgpgmechangepasswdjob.cpp qgpgmedecryptjob.cpp \
- qgpgmedecryptverifyarchivejob.cpp \
- qgpgmedecryptverifyjob.cpp qgpgmedeletejob.cpp qgpgmedownloadjob.cpp \
- qgpgmeencryptarchivejob.cpp \
- qgpgmeencryptjob.cpp qgpgmeexportjob.cpp qgpgmeimportfromkeyserverjob.cpp \
- qgpgmeimportjob.cpp qgpgmekeygenerationjob.cpp qgpgmekeylistjob.cpp \
- listallkeysjob.cpp qgpgmelistallkeysjob.cpp qgpgmenewcryptoconfig.cpp \
- qgpgmereceivekeysjob.cpp \
- qgpgmerefreshsmimekeysjob.cpp \
- qgpgmerevokekeyjob.cpp \
- qgpgmesetprimaryuseridjob.cpp \
- qgpgmesignarchivejob.cpp \
- qgpgmesignencryptjob.cpp \
- qgpgmesignencryptarchivejob.cpp \
- qgpgmesignjob.cpp qgpgmesignkeyjob.cpp qgpgmeverifydetachedjob.cpp \
- qgpgmeverifyopaquejob.cpp qgpgmewkdlookupjob.cpp threadedjobmixin.cpp \
- qgpgmewkdrefreshjob.cpp \
- qgpgmekeyformailboxjob.cpp qgpgme_debug.cpp \
- qgpgmetofupolicyjob.cpp qgpgmequickjob.cpp \
- defaultkeygenerationjob.cpp qgpgmewkspublishjob.cpp \
- qgpgmegpgcardjob.cpp changeexpiryjob.cpp encryptjob.cpp importjob.cpp \
- quickjob.cpp \
- signarchivejob.cpp \
- signencryptjob.cpp \
- signencryptarchivejob.cpp \
- signjob.cpp \
- dn.cpp cryptoconfig.cpp wkdlookupresult.cpp \
- util.cpp \
- verifydetachedjob.cpp \
- verifyopaquejob.cpp \
- wkdrefreshjob.cpp
-
-# If you add one here make sure that you also add one in camelcase
-qgpgme_headers= \
- abstractimportjob.h \
- addexistingsubkeyjob.h \
- adduseridjob.h \
- changeexpiryjob.h \
- changeownertrustjob.h \
- changepasswdjob.h \
- dataprovider.h \
- debug.h \
- decryptjob.h \
- decryptverifyarchivejob.h \
- decryptverifyjob.h \
- downloadjob.h \
- encryptarchivejob.h \
- encryptjob.h \
- exportjob.h \
- filelistdataprovider.h \
- hierarchicalkeylistjob.h \
- job.h \
- keyformailboxjob.h \
- multideletejob.h \
- protocol.h \
- qgpgme_export.h \
- qgpgmenewcryptoconfig.h \
- quickjob.h \
- receivekeysjob.h \
- revokekeyjob.h \
- setprimaryuseridjob.h \
- specialjob.h \
- signarchivejob.h \
- signjob.h \
- signkeyjob.h \
- signencryptjob.h \
- signencryptarchivejob.h \
- verifyopaquejob.h \
- refreshkeysjob.h \
- cryptoconfig.h \
- deletejob.h \
- importfromkeyserverjob.h \
- importjob.h \
- keygenerationjob.h \
- keylistjob.h \
- listallkeysjob.h \
- verifydetachedjob.h \
- defaultkeygenerationjob.h \
- tofupolicyjob.h \
- wkdlookupjob.h \
- wkdlookupresult.h \
- wkdrefreshjob.h \
- wkspublishjob.h \
- gpgcardjob.h \
- dn.h
-
-camelcase_headers= \
- AddExistingSubkeyJob \
- AddUserIDJob \
- AbstractImportJob \
- ChangeExpiryJob \
- ChangeOwnerTrustJob \
- ChangePasswdJob \
- DataProvider \
- Debug \
- DecryptJob \
- DecryptVerifyArchiveJob \
- DecryptVerifyJob \
- DN \
- DownloadJob \
- EncryptArchiveJob \
- EncryptJob \
- ExportJob \
- FileListDataProvider \
- HierarchicalKeyListJob \
- Job \
- MultiDeleteJob \
- Protocol \
- QGpgMENewCryptoConfig \
- QuickJob \
- ReceiveKeysJob \
- RevokeKeyJob \
- SetPrimaryUserIDJob \
- SpecialJob \
- SignArchiveJob \
- SignJob \
- SignKeyJob \
- SignEncryptArchiveJob \
- SignEncryptJob \
- VerifyOpaqueJob \
- RefreshKeysJob \
- CryptoConfig \
- DeleteJob \
- ImportFromKeyserverJob \
- ImportJob \
- KeyGenerationJob \
- KeyListJob \
- ListAllKeysJob \
- VerifyDetachedJob \
- KeyForMailboxJob \
- DefaultKeyGenerationJob \
- WKDLookupJob \
- WKDLookupResult \
- WKDRefreshJob \
- WKSPublishJob \
- TofuPolicyJob \
- GpgCardJob
-
-private_qgpgme_headers = \
- changeexpiryjob_p.h \
- cleaner.h \
- decryptverifyarchivejob_p.h \
- decryptverifyjob_p.h \
- encryptarchivejob_p.h \
- encryptjob_p.h \
- importjob_p.h \
- listallkeysjob_p.h \
- qgpgme_export.h \
- protocol_p.h \
- job_p.h \
- qgpgmeaddexistingsubkeyjob.h \
- qgpgmeadduseridjob.h \
- qgpgmebackend.h \
- qgpgmechangeexpiryjob.h \
- qgpgmechangeownertrustjob.h \
- qgpgmechangepasswdjob.h \
- qgpgmedecryptjob.h \
- qgpgmedecryptverifyarchivejob.h \
- qgpgmedecryptverifyjob.h \
- qgpgmedeletejob.h \
- qgpgmedownloadjob.h \
- qgpgmeencryptarchivejob.h \
- qgpgmeencryptjob.h \
- qgpgmeexportjob.h \
- qgpgmeimportfromkeyserverjob.h \
- qgpgmeimportjob.h \
- qgpgmekeygenerationjob.h \
- qgpgmekeylistjob.h \
- qgpgmelistallkeysjob.h \
- qgpgmereceivekeysjob.h \
- qgpgmerefreshsmimekeysjob.h \
- qgpgmerevokekeyjob.h \
- qgpgmesetprimaryuseridjob.h \
- qgpgmesignarchivejob.h \
- qgpgmesignencryptjob.h \
- qgpgmesignencryptarchivejob.h \
- qgpgmesignjob.h \
- qgpgmesignkeyjob.h \
- qgpgmeverifydetachedjob.h \
- qgpgmeverifyopaquejob.h \
- qgpgmewkdlookupjob.h \
- qgpgmewkdrefreshjob.h \
- qgpgmekeyformailboxjob.h \
- qgpgmewkspublishjob.h \
- qgpgmetofupolicyjob.h \
- qgpgmegpgcardjob.h \
- qgpgmequickjob.h \
- quickjob_p.h \
- signarchivejob_p.h \
- signencryptjob_p.h \
- signencryptarchivejob_p.h \
- signjob_p.h \
- threadedjobmixin.h \
- util.h \
- verifydetachedjob_p.h \
- verifyopaquejob_p.h \
- wkdrefreshjob_p.h
-
-qgpgme_moc_sources = \
- abstractimportjob.moc \
- addexistingsubkeyjob.moc \
- adduseridjob.moc \
- changeexpiryjob.moc \
- changeownertrustjob.moc \
- changepasswdjob.moc \
- cleaner.moc \
- decryptjob.moc \
- decryptverifyarchivejob.moc \
- decryptverifyjob.moc \
- deletejob.moc \
- downloadjob.moc \
- encryptarchivejob.moc \
- encryptjob.moc \
- exportjob.moc \
- hierarchicalkeylistjob.moc \
- importfromkeyserverjob.moc \
- importjob.moc \
- job.moc \
- keygenerationjob.moc \
- keylistjob.moc \
- listallkeysjob.moc \
- multideletejob.moc \
- qgpgmeaddexistingsubkeyjob.moc \
- qgpgmeadduseridjob.moc \
- qgpgmechangeexpiryjob.moc \
- qgpgmechangeownertrustjob.moc \
- qgpgmechangepasswdjob.moc \
- qgpgmedecryptjob.moc \
- qgpgmedecryptverifyarchivejob.moc \
- qgpgmedecryptverifyjob.moc \
- qgpgmedeletejob.moc \
- qgpgmedownloadjob.moc \
- qgpgmeencryptarchivejob.moc \
- qgpgmeencryptjob.moc \
- qgpgmeexportjob.moc \
- qgpgmeimportfromkeyserverjob.moc \
- qgpgmeimportjob.moc \
- qgpgmekeygenerationjob.moc \
- qgpgmekeylistjob.moc \
- qgpgmelistallkeysjob.moc \
- qgpgmereceivekeysjob.moc \
- qgpgmerefreshsmimekeysjob.moc \
- qgpgmerevokekeyjob.moc \
- qgpgmesetprimaryuseridjob.moc \
- qgpgmesignarchivejob.moc \
- qgpgmesignencryptjob.moc \
- qgpgmesignencryptarchivejob.moc \
- qgpgmesignjob.moc \
- qgpgmesignkeyjob.moc \
- qgpgmeverifydetachedjob.moc \
- qgpgmeverifyopaquejob.moc \
- qgpgmewkdlookupjob.moc \
- qgpgmewkdrefreshjob.moc \
- qgpgmewkspublishjob.moc \
- tofupolicyjob.moc \
- qgpgmetofupolicyjob.moc \
- receivekeysjob.moc \
- refreshkeysjob.moc \
- revokekeyjob.moc \
- setprimaryuseridjob.moc \
- signarchivejob.moc \
- signencryptjob.moc \
- signencryptarchivejob.moc \
- signjob.moc \
- signkeyjob.moc \
- specialjob.moc \
- verifydetachedjob.moc \
- verifyopaquejob.moc \
- wkdlookupjob.moc \
- wkdrefreshjob.moc \
- keyformailboxjob.moc \
- wkspublishjob.moc \
- qgpgmekeyformailboxjob.moc \
- defaultkeygenerationjob.moc \
- quickjob.moc \
- qgpgmequickjob.moc \
- gpgcardjob.moc \
- qgpgmegpgcardjob.moc
-
-if WANT_QT5
-includeprefix5 = qgpgme-qt5
-qgpgme5includedir = $(includedir)/$(includeprefix5)/qgpgme
-qgpgme5include_HEADERS = $(qgpgme_headers)
-nodist_qgpgme5include_HEADERS = qgpgme_version.h
-camelcase5includedir = $(includedir)/$(includeprefix5)/QGpgME
-nodist_camelcase5include_HEADERS = $(camelcase_headers)
-endif
-if WANT_QT6
-includeprefix6 = qgpgme-qt6
-qgpgme6includedir = $(includedir)/$(includeprefix6)/qgpgme
-qgpgme6include_HEADERS = $(qgpgme_headers)
-nodist_qgpgme6include_HEADERS = qgpgme_version.h
-camelcase6includedir = $(includedir)/$(includeprefix6)/QGpgME
-nodist_camelcase6include_HEADERS = $(camelcase_headers)
-endif
-
-# generate the moc files in two steps:
-# 1. generate Qt 5/6-specific moc files in builddir with extension .moc5/.moc6;
-# this ensures correct dependencies on the source files
-# 2. generate forwarding headers in subfolders moc5/moc6 with extension .moc;
-# this ensures that the "foo.moc" includes in the source files work and
-# include the correct version of the generated moc files for Qt 5/6
-# GNU make's pattern rules would make this easier, but we don't want to use them
-if WANT_QT5
-moc5_dir = moc5
-qgpgme_moc5_sources = $(qgpgme_moc_sources:%.moc=%.moc5)
-qgpgme_moc5_forward_headers = $(qgpgme_moc_sources:%=$(moc5_dir)/%)
-
-.h.moc5:
- $(MOC5) `test -f '$<' || echo '$(srcdir)/'`$< -o $@
-
-$(moc5_dir):
- mkdir $(moc5_dir)
-
-$(qgpgme_moc5_forward_headers): Makefile.am | $(moc5_dir)
- echo "#include \"../$(notdir $@)5\"" > "$@"
-endif
-if WANT_QT6
-moc6_dir = moc6
-qgpgme_moc6_sources = $(qgpgme_moc_sources:%.moc=%.moc6)
-qgpgme_moc6_forward_headers = $(qgpgme_moc_sources:%=$(moc6_dir)/%)
-
-.h.moc6:
- $(MOC6) `test -f '$<' || echo '$(srcdir)/'`$< -o $@
-
-$(moc6_dir):
- mkdir $(moc6_dir)
-
-$(qgpgme_moc6_forward_headers): Makefile.am | $(moc6_dir)
- echo "#include \"../$(notdir $@)6\"" > "$@"
-endif
-
-if WANT_QT5
-libqgpgme_la_CPPFLAGS = -I./moc5 -I$(top_builddir)/lang/cpp/src -I$(top_builddir)/src \
- @GPGME_QT5_CFLAGS@ @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \
- -DBUILDING_QGPGME -Wsuggest-override \
- -Wzero-as-null-pointer-constant
-
-libqgpgme_la_SOURCES = $(qgpgme_sources) $(qgpgme_headers) $(private_qgpgme_headers)
-
-nodist_libqgpgme_la_SOURCES = $(qgpgme_moc5_sources) $(qgpgme_moc5_forward_headers)
-
-libqgpgme_la_LIBADD = ../../cpp/src/libgpgmepp.la ../../../src/libgpgme.la \
- @LIBASSUAN_LIBS@ @GPG_ERROR_LIBS@ @GPGME_QT5_LIBS@
-libqgpgme_la_LDFLAGS = -no-undefined -version-info \
- @LIBQGPGME_LT_CURRENT@:@LIBQGPGME_LT_REVISION@:@LIBQGPGME_LT_AGE@
-endif
-if WANT_QT6
-libqgpgmeqt6_la_CPPFLAGS = -I./moc6 -I$(top_builddir)/lang/cpp/src -I$(top_builddir)/src \
- @GPGME_QT6_CFLAGS@ @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \
- -DBUILDING_QGPGME -Wsuggest-override \
- -Wzero-as-null-pointer-constant
-
-libqgpgmeqt6_la_SOURCES = $(qgpgme_sources) $(qgpgme_headers) $(private_qgpgme_headers)
-
-nodist_libqgpgmeqt6_la_SOURCES = $(qgpgme_moc6_sources) $(qgpgme_moc6_forward_headers)
-
-libqgpgmeqt6_la_LIBADD = ../../cpp/src/libgpgmepp.la ../../../src/libgpgme.la \
- @LIBASSUAN_LIBS@ @GPG_ERROR_LIBS@ @GPGME_QT6_LIBS@
-libqgpgmeqt6_la_LDFLAGS = -no-undefined -version-info \
- @LIBQGPGME_LT_CURRENT@:@LIBQGPGME_LT_REVISION@:@LIBQGPGME_LT_AGE@
-endif
-
-if HAVE_MACOS_SYSTEM
-libsuffix=.dylib
-else
-libsuffix=.so
-endif
-
-if WANT_QT5
-if HAVE_W32_SYSTEM
-QGpgmeConfig.cmake: QGpgmeConfig-w32.cmake.in
- sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \
- sed -e 's|[@]resolved_libdir@|$(libdir)|g' | \
- sed -e 's|[@]resolved_includedir@|$(includedir)/$(includeprefix5)|g' > $@
-else
-QGpgmeConfig.cmake: QGpgmeConfig.cmake.in
- sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
- sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
- sed -e 's|[@]resolved_includedir@|$(includedir)/$(includeprefix5)|g' > $@
-endif
-endif
-if WANT_QT6
-if HAVE_W32_SYSTEM
-QGpgmeQt6Config.cmake: QGpgmeQt6Config-w32.cmake.in
- sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \
- sed -e 's|[@]resolved_libdir@|$(libdir)|g' | \
- sed -e 's|[@]resolved_includedir@|$(includedir)/$(includeprefix6)|g' > $@
-else
-QGpgmeQt6Config.cmake: QGpgmeQt6Config.cmake.in
- sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
- sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
- sed -e 's|[@]resolved_includedir@|$(includedir)/$(includeprefix6)|g' > $@
-endif
-endif
-
-$(camelcase_headers): Makefile.am
- echo -n "#include \"qgpgme/" > "$@"
- echo -n "$@" | tr '[:upper:]' '[:lower:]' >> "$@"
- echo ".h\"" >> "$@"
-
-if WANT_QT5
-install-cmake-files-qt5: QGpgmeConfig.cmake QGpgmeConfigVersion.cmake
- -$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/QGpgme
- $(INSTALL) -m 644 QGpgmeConfig.cmake \
- $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake
- $(INSTALL) -m 644 QGpgmeConfigVersion.cmake \
- $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake
-install_cmake_files_qt5 = install-cmake-files-qt5
-
-uninstall-cmake-files-qt5:
- -rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake
- -rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake
- -rmdir $(DESTDIR)$(libdir)/cmake/QGpgme/
-uninstall_cmake_files_qt5 = uninstall-cmake-files-qt5
-
-uninstall-include-dirs-qt5:
- -rmdir $(DESTDIR)$(qgpgme5includedir)
- -rmdir $(DESTDIR)$(camelcase5includedir)
- -rmdir $(DESTDIR)$(includedir)/$(includeprefix5)
-uninstall_include_dirs_qt5 = uninstall-include-dirs-qt5
-endif
-if WANT_QT6
-install-cmake-files-qt6: QGpgmeQt6Config.cmake QGpgmeQt6ConfigVersion.cmake
- -$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/QGpgmeQt6
- $(INSTALL) -m 644 QGpgmeQt6Config.cmake \
- $(DESTDIR)$(libdir)/cmake/QGpgmeQt6/QGpgmeQt6Config.cmake
- $(INSTALL) -m 644 QGpgmeQt6ConfigVersion.cmake \
- $(DESTDIR)$(libdir)/cmake/QGpgmeQt6/QGpgmeQt6ConfigVersion.cmake
-install_cmake_files_qt6 = install-cmake-files-qt6
-
-uninstall-cmake-files-qt6:
- -rm $(DESTDIR)$(libdir)/cmake/QGpgmeQt6/QGpgmeQt6ConfigVersion.cmake
- -rm $(DESTDIR)$(libdir)/cmake/QGpgmeQt6/QGpgmeQt6Config.cmake
- -rmdir $(DESTDIR)$(libdir)/cmake/QGpgmeQt6/
-uninstall_cmake_files_qt6 = uninstall-cmake-files-qt6
-
-uninstall-include-dirs-qt6:
- -rmdir $(DESTDIR)$(qgpgme6includedir)
- -rmdir $(DESTDIR)$(camelcase6includedir)
- -rmdir $(DESTDIR)$(includedir)/$(includeprefix6)
-uninstall_include_dirs_qt6 = uninstall-include-dirs-qt6
-endif
-
-install-data-local: $(install_cmake_files_qt5) $(install_cmake_files_qt6)
-
-uninstall-hook: $(uninstall_cmake_files_qt5) $(uninstall_cmake_files_qt6) \
- $(uninstall_include_dirs_qt5) $(uninstall_include_dirs_qt6)
-
-BUILT_SOURCES = $(qgpgme_moc5_sources) $(qgpgme_moc5_forward_headers) \
- $(qgpgme_moc6_sources) $(qgpgme_moc6_forward_headers) \
- $(camelcase_headers)
-
-CLEANFILES = $(qgpgme_moc5_sources) $(qgpgme_moc5_forward_headers) \
- $(qgpgme_moc6_sources) $(qgpgme_moc6_forward_headers) \
- $(camelcase_headers) QGpgmeConfig.cmake \
- qgpgme_version.h QGpgmeConfig.cmake.in \
- QGpgmeConfig-w32.cmake.in QGpgmeConfigVersion.cmake \
- QGpgmeQt6Config.cmake.in QGpgmeQt6Config-w32.cmake.in \
- QGpgmeQt6Config.cmake QGpgmeQt6ConfigVersion.cmake
-
-clean-local:
- -test -z "$(moc5_dir)" || rm -rf $(moc5_dir)
- -test -z "$(moc6_dir)" || rm -rf $(moc6_dir)
diff --git a/lang/qt/src/QGpgmeConfig-w32.cmake.in.in b/lang/qt/src/QGpgmeConfig-w32.cmake.in.in
deleted file mode 100644
index 709f5fc3..00000000
--- a/lang/qt/src/QGpgmeConfig-w32.cmake.in.in
+++ /dev/null
@@ -1,109 +0,0 @@
-# CMake Config file for QGPGME.
-# Copyright (C) 2016 Intevation GmbH
-#
-# This file is part of QGpgME.
-#
-# QGpgME is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# QGpgME is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA
-
-# based on a generated file from cmake.
-# Generated by CMake 3.0.2
-
-if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
- message(FATAL_ERROR "CMake >= 2.6.0 required")
-endif()
-cmake_policy(PUSH)
-cmake_policy(VERSION 2.6)
-#----------------------------------------------------------------
-# Generated CMake target import file.
-#----------------------------------------------------------------
-
-# Commands may need to know the format version.
-set(CMAKE_IMPORT_FILE_VERSION 1)
-
-# Protect against multiple inclusion, which would fail when already imported targets are added once more.
-set(_targetsDefined)
-set(_targetsNotDefined)
-set(_expectedTargets)
-foreach(_expectedTarget QGpgme)
- list(APPEND _expectedTargets ${_expectedTarget})
- if(NOT TARGET ${_expectedTarget})
- list(APPEND _targetsNotDefined ${_expectedTarget})
- endif()
- if(TARGET ${_expectedTarget})
- list(APPEND _targetsDefined ${_expectedTarget})
- endif()
-endforeach()
-if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
- set(CMAKE_IMPORT_FILE_VERSION)
- cmake_policy(POP)
- return()
-endif()
-if(NOT "${_targetsDefined}" STREQUAL "")
- message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
-endif()
-unset(_targetsDefined)
-unset(_targetsNotDefined)
-unset(_expectedTargets)
-
-# Create imported target QGpgme
-add_library(QGpgme SHARED IMPORTED)
-
-set_target_properties(QGpgme PROPERTIES
- IMPORTED_IMPLIB_RELEASE "@resolved_libdir@/libqgpgme.dll.a"
- INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/qgpgme;@resolved_includedir@"
- INTERFACE_LINK_LIBRARIES "Gpgmepp;Qt5::Core"
- IMPORTED_LOCATION "@resolved_bindir@/libqgpgme-15.dll"
-)
-get_target_property(_libpath QGpgme IMPORTED_IMPLIB_RELEASE)
-get_target_property(_dllpath QGpgme IMPORTED_LOCATION)
-
-list(APPEND _IMPORT_CHECK_TARGETS QGpgme )
-list(APPEND _IMPORT_CHECK_FILES_FOR_QGpgme "${_libpath}" "${_dllpath}" )
-
-if(CMAKE_VERSION VERSION_LESS 2.8.12)
- message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.")
-endif()
-
-# Loop over all imported files and verify that they actually exist
-foreach(target ${_IMPORT_CHECK_TARGETS} )
- foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
- if(NOT EXISTS "${file}" )
- message(FATAL_ERROR "The imported target \"${target}\" references the file
- \"${file}\"
-but this file does not exist. Possible reasons include:
-* The file was deleted, renamed, or moved to another location.
-* An install or uninstall procedure did not complete successfully.
-* The installation package was faulty and contained
- \"${CMAKE_CURRENT_LIST_FILE}\"
-but not all the files it references.
-")
- endif()
- endforeach()
- unset(_IMPORT_CHECK_FILES_FOR_${target})
-endforeach()
-unset(_IMPORT_CHECK_TARGETS)
-unset(_dllpath)
-unset(_libpath)
-
-# This file does not depend on other imported targets which have
-# been exported from the same project but in a separate export set.
-
-# Commands beyond this point should not need to know the version.
-set(CMAKE_IMPORT_FILE_VERSION)
-cmake_policy(POP)
-
-# Gpgmepp is a requirement for qgpgme
-find_package(Gpgmepp CONFIG REQUIRED)
diff --git a/lang/qt/src/QGpgmeConfig.cmake.in.in b/lang/qt/src/QGpgmeConfig.cmake.in.in
deleted file mode 100644
index fc13bfb7..00000000
--- a/lang/qt/src/QGpgmeConfig.cmake.in.in
+++ /dev/null
@@ -1,101 +0,0 @@
-# CMake Config file for QGPGME.
-# Copyright (C) 2016 Intevation GmbH
-#
-# This file is part of QGpgME.
-#
-# QGpgME is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# QGpgME is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA
-
-# based on a generated file from cmake.
-# Generated by CMake 3.0.2
-
-if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
- message(FATAL_ERROR "CMake >= 2.6.0 required")
-endif()
-cmake_policy(PUSH)
-cmake_policy(VERSION 2.6)
-#----------------------------------------------------------------
-# Generated CMake target import file.
-#----------------------------------------------------------------
-
-# Commands may need to know the format version.
-set(CMAKE_IMPORT_FILE_VERSION 1)
-
-# Protect against multiple inclusion, which would fail when already imported targets are added once more.
-set(_targetsDefined)
-set(_targetsNotDefined)
-set(_expectedTargets)
-foreach(_expectedTarget QGpgme)
- list(APPEND _expectedTargets ${_expectedTarget})
- if(NOT TARGET ${_expectedTarget})
- list(APPEND _targetsNotDefined ${_expectedTarget})
- endif()
- if(TARGET ${_expectedTarget})
- list(APPEND _targetsDefined ${_expectedTarget})
- endif()
-endforeach()
-if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
- set(CMAKE_IMPORT_FILE_VERSION)
- cmake_policy(POP)
- return()
-endif()
-if(NOT "${_targetsDefined}" STREQUAL "")
- message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
-endif()
-unset(_targetsDefined)
-unset(_targetsNotDefined)
-unset(_expectedTargets)
-
-# Create imported target QGpgme
-add_library(QGpgme SHARED IMPORTED)
-
-set_target_properties(QGpgme PROPERTIES
- INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/qgpgme;@resolved_includedir@"
- INTERFACE_LINK_LIBRARIES "Gpgmepp;Qt5::Core"
- IMPORTED_LOCATION "@resolved_libdir@/libqgpgme@libsuffix@"
-)
-
-if(CMAKE_VERSION VERSION_LESS 2.8.12)
- message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.")
-endif()
-
-# Loop over all imported files and verify that they actually exist
-foreach(target ${_IMPORT_CHECK_TARGETS} )
- foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
- if(NOT EXISTS "${file}" )
- message(FATAL_ERROR "The imported target \"${target}\" references the file
- \"${file}\"
-but this file does not exist. Possible reasons include:
-* The file was deleted, renamed, or moved to another location.
-* An install or uninstall procedure did not complete successfully.
-* The installation package was faulty and contained
- \"${CMAKE_CURRENT_LIST_FILE}\"
-but not all the files it references.
-")
- endif()
- endforeach()
- unset(_IMPORT_CHECK_FILES_FOR_${target})
-endforeach()
-unset(_IMPORT_CHECK_TARGETS)
-
-# This file does not depend on other imported targets which have
-# been exported from the same project but in a separate export set.
-
-# Commands beyond this point should not need to know the version.
-set(CMAKE_IMPORT_FILE_VERSION)
-cmake_policy(POP)
-
-# Gpgmepp is a requirement for qgpgme
-find_package(Gpgmepp CONFIG REQUIRED)
diff --git a/lang/qt/src/QGpgmeConfigVersion.cmake.in b/lang/qt/src/QGpgmeConfigVersion.cmake.in
deleted file mode 100644
index cbc21856..00000000
--- a/lang/qt/src/QGpgmeConfigVersion.cmake.in
+++ /dev/null
@@ -1,31 +0,0 @@
-# CMake Version file for QGPGME.
-# Copyright (C) 2016 Intevation GmbH
-#
-# This file is part of QGpgME.
-#
-# QGpgME is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# QGpgME is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA
-
-# based on a generated file from cmake.
-set(PACKAGE_VERSION "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_MICRO@")
-
-if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
- set(PACKAGE_VERSION_COMPATIBLE FALSE)
-else()
- set(PACKAGE_VERSION_COMPATIBLE TRUE)
- if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
- set(PACKAGE_VERSION_EXACT TRUE)
- endif()
-endif()
diff --git a/lang/qt/src/QGpgmeQt6Config-w32.cmake.in.in b/lang/qt/src/QGpgmeQt6Config-w32.cmake.in.in
deleted file mode 100644
index 520ce62d..00000000
--- a/lang/qt/src/QGpgmeQt6Config-w32.cmake.in.in
+++ /dev/null
@@ -1,109 +0,0 @@
-# CMake Config file for QGpgME for Qt 6
-# Copyright (C) 2016 Intevation GmbH
-#
-# This file is part of QGpgME.
-#
-# QGpgME is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# QGpgME is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA
-
-# based on a generated file from cmake.
-# Generated by CMake 3.0.2
-
-if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
- message(FATAL_ERROR "CMake >= 2.6.0 required")
-endif()
-cmake_policy(PUSH)
-cmake_policy(VERSION 2.6)
-#----------------------------------------------------------------
-# Generated CMake target import file.
-#----------------------------------------------------------------
-
-# Commands may need to know the format version.
-set(CMAKE_IMPORT_FILE_VERSION 1)
-
-# Protect against multiple inclusion, which would fail when already imported targets are added once more.
-set(_targetsDefined)
-set(_targetsNotDefined)
-set(_expectedTargets)
-foreach(_expectedTarget QGpgmeQt6)
- list(APPEND _expectedTargets ${_expectedTarget})
- if(NOT TARGET ${_expectedTarget})
- list(APPEND _targetsNotDefined ${_expectedTarget})
- endif()
- if(TARGET ${_expectedTarget})
- list(APPEND _targetsDefined ${_expectedTarget})
- endif()
-endforeach()
-if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
- set(CMAKE_IMPORT_FILE_VERSION)
- cmake_policy(POP)
- return()
-endif()
-if(NOT "${_targetsDefined}" STREQUAL "")
- message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
-endif()
-unset(_targetsDefined)
-unset(_targetsNotDefined)
-unset(_expectedTargets)
-
-# Create imported target QGpgmeQt6
-add_library(QGpgmeQt6 SHARED IMPORTED)
-
-set_target_properties(QGpgmeQt6 PROPERTIES
- IMPORTED_IMPLIB_RELEASE "@resolved_libdir@/libqgpgmeqt6.dll.a"
- INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/qgpgme;@resolved_includedir@"
- INTERFACE_LINK_LIBRARIES "Gpgmepp;Qt6::Core"
- IMPORTED_LOCATION "@resolved_bindir@/libqgpgmeqt6-15.dll"
-)
-get_target_property(_libpath QGpgmeQt6 IMPORTED_IMPLIB_RELEASE)
-get_target_property(_dllpath QGpgmeQt6 IMPORTED_LOCATION)
-
-list(APPEND _IMPORT_CHECK_TARGETS QGpgmeQt6 )
-list(APPEND _IMPORT_CHECK_FILES_FOR_QGpgmeQt6 "${_libpath}" "${_dllpath}" )
-
-if(CMAKE_VERSION VERSION_LESS 2.8.12)
- message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.")
-endif()
-
-# Loop over all imported files and verify that they actually exist
-foreach(target ${_IMPORT_CHECK_TARGETS} )
- foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
- if(NOT EXISTS "${file}" )
- message(FATAL_ERROR "The imported target \"${target}\" references the file
- \"${file}\"
-but this file does not exist. Possible reasons include:
-* The file was deleted, renamed, or moved to another location.
-* An install or uninstall procedure did not complete successfully.
-* The installation package was faulty and contained
- \"${CMAKE_CURRENT_LIST_FILE}\"
-but not all the files it references.
-")
- endif()
- endforeach()
- unset(_IMPORT_CHECK_FILES_FOR_${target})
-endforeach()
-unset(_IMPORT_CHECK_TARGETS)
-unset(_dllpath)
-unset(_libpath)
-
-# This file does not depend on other imported targets which have
-# been exported from the same project but in a separate export set.
-
-# Commands beyond this point should not need to know the version.
-set(CMAKE_IMPORT_FILE_VERSION)
-cmake_policy(POP)
-
-# Gpgmepp is a requirement for QGpgME
-find_package(Gpgmepp CONFIG REQUIRED)
diff --git a/lang/qt/src/QGpgmeQt6Config.cmake.in.in b/lang/qt/src/QGpgmeQt6Config.cmake.in.in
deleted file mode 100644
index 14fa54e1..00000000
--- a/lang/qt/src/QGpgmeQt6Config.cmake.in.in
+++ /dev/null
@@ -1,101 +0,0 @@
-# CMake Config file for QGpgME for Qt 6
-# Copyright (C) 2016 Intevation GmbH
-#
-# This file is part of QGpgME.
-#
-# QGpgME is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# QGpgME is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA
-
-# based on a generated file from cmake.
-# Generated by CMake 3.0.2
-
-if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
- message(FATAL_ERROR "CMake >= 2.6.0 required")
-endif()
-cmake_policy(PUSH)
-cmake_policy(VERSION 2.6)
-#----------------------------------------------------------------
-# Generated CMake target import file.
-#----------------------------------------------------------------
-
-# Commands may need to know the format version.
-set(CMAKE_IMPORT_FILE_VERSION 1)
-
-# Protect against multiple inclusion, which would fail when already imported targets are added once more.
-set(_targetsDefined)
-set(_targetsNotDefined)
-set(_expectedTargets)
-foreach(_expectedTarget QGpgmeQt6)
- list(APPEND _expectedTargets ${_expectedTarget})
- if(NOT TARGET ${_expectedTarget})
- list(APPEND _targetsNotDefined ${_expectedTarget})
- endif()
- if(TARGET ${_expectedTarget})
- list(APPEND _targetsDefined ${_expectedTarget})
- endif()
-endforeach()
-if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
- set(CMAKE_IMPORT_FILE_VERSION)
- cmake_policy(POP)
- return()
-endif()
-if(NOT "${_targetsDefined}" STREQUAL "")
- message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
-endif()
-unset(_targetsDefined)
-unset(_targetsNotDefined)
-unset(_expectedTargets)
-
-# Create imported target QGpgmeQt6
-add_library(QGpgmeQt6 SHARED IMPORTED)
-
-set_target_properties(QGpgmeQt6 PROPERTIES
- INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/qgpgme;@resolved_includedir@"
- INTERFACE_LINK_LIBRARIES "Gpgmepp;Qt6::Core"
- IMPORTED_LOCATION "@resolved_libdir@/libqgpgmeqt6@libsuffix@"
-)
-
-if(CMAKE_VERSION VERSION_LESS 2.8.12)
- message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.")
-endif()
-
-# Loop over all imported files and verify that they actually exist
-foreach(target ${_IMPORT_CHECK_TARGETS} )
- foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
- if(NOT EXISTS "${file}" )
- message(FATAL_ERROR "The imported target \"${target}\" references the file
- \"${file}\"
-but this file does not exist. Possible reasons include:
-* The file was deleted, renamed, or moved to another location.
-* An install or uninstall procedure did not complete successfully.
-* The installation package was faulty and contained
- \"${CMAKE_CURRENT_LIST_FILE}\"
-but not all the files it references.
-")
- endif()
- endforeach()
- unset(_IMPORT_CHECK_FILES_FOR_${target})
-endforeach()
-unset(_IMPORT_CHECK_TARGETS)
-
-# This file does not depend on other imported targets which have
-# been exported from the same project but in a separate export set.
-
-# Commands beyond this point should not need to know the version.
-set(CMAKE_IMPORT_FILE_VERSION)
-cmake_policy(POP)
-
-# Gpgmepp is a requirement for QGpgME
-find_package(Gpgmepp CONFIG REQUIRED)
diff --git a/lang/qt/src/QGpgmeQt6ConfigVersion.cmake.in b/lang/qt/src/QGpgmeQt6ConfigVersion.cmake.in
deleted file mode 100644
index a0ba9505..00000000
--- a/lang/qt/src/QGpgmeQt6ConfigVersion.cmake.in
+++ /dev/null
@@ -1,31 +0,0 @@
-# CMake Version file for QGpgME for Qt 6
-# Copyright (C) 2016 Intevation GmbH
-#
-# This file is part of QGpgME.
-#
-# QGpgME is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# QGpgME is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA
-
-# based on a generated file from cmake.
-set(PACKAGE_VERSION "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_MICRO@")
-
-if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
- set(PACKAGE_VERSION_COMPATIBLE FALSE)
-else()
- set(PACKAGE_VERSION_COMPATIBLE TRUE)
- if("${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
- set(PACKAGE_VERSION_EXACT TRUE)
- endif()
-endif()
diff --git a/lang/qt/src/abstractimportjob.h b/lang/qt/src/abstractimportjob.h
deleted file mode 100644
index ab6b530d..00000000
--- a/lang/qt/src/abstractimportjob.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- abstractimportjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2009 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_ABSTRACTIMPORTJOB_H__
-#define __KLEO_ABSTRACTIMPORTJOB_H__
-
-#include "job.h"
-
-#include "qgpgme_export.h"
-
-namespace GpgME
-{
-class Error;
-class ImportResult;
-}
-
-namespace QGpgME
-{
-
-class QGPGME_EXPORT AbstractImportJob : public Job
-{
- Q_OBJECT
-protected:
- explicit AbstractImportJob(QObject *parent);
-public:
- ~AbstractImportJob();
-
-Q_SIGNALS:
- void result(const GpgME::ImportResult &result, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_IMPORTJOB_H__
diff --git a/lang/qt/src/addexistingsubkeyjob.h b/lang/qt/src/addexistingsubkeyjob.h
deleted file mode 100644
index 5465778c..00000000
--- a/lang/qt/src/addexistingsubkeyjob.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- addexistingsubkeyjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_ADDEXISTINGSUBKEYJOB_H__
-#define __QGPGME_ADDEXISTINGSUBKEYJOB_H__
-
-#include "job.h"
-#include "qgpgme_export.h"
-
-class QString;
-
-namespace GpgME
-{
-class Error;
-class Key;
-class Subkey;
-}
-
-namespace QGpgME
-{
-
-class QGPGME_EXPORT AddExistingSubkeyJob : public Job
-{
- Q_OBJECT
-protected:
- explicit AddExistingSubkeyJob(QObject *parent);
-
-public:
- ~AddExistingSubkeyJob();
-
- /**
- Starts the operation. \a key is the key to add the subkey \a subkey to.
-
- The job deletes itself after it has completed the operation.
- */
- virtual GpgME::Error start(const GpgME::Key &key, const GpgME::Subkey &subkey) = 0;
-
- /**
- Runs the operation. \a key is the key to add the subkey \a subkey to.
- */
- virtual GpgME::Error exec(const GpgME::Key &key, const GpgME::Subkey &subkey) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::Error &result, const QString &auditLogAsHtml = {}, const GpgME::Error &auditLogError = {});
-};
-
-}
-
-#endif // __QGPGME_ADDEXISTINGSUBKEYJOB_H__
diff --git a/lang/qt/src/adduseridjob.h b/lang/qt/src/adduseridjob.h
deleted file mode 100644
index cc3963c9..00000000
--- a/lang/qt/src/adduseridjob.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- adduseridjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_ADDUSERIDJOB_H__
-#define __KLEO_ADDUSERIDJOB_H__
-
-#include "job.h"
-
-#include <QtCore/QString>
-
-namespace GpgME
-{
-class Error;
-class Key;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class to asynchronously add UIDs to OpenPGP keys
-
- To use a AddUserIDJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the job with a call
- to start(). This call might fail, in which case the AddUserIDJob
- instance will have scheduled it's own destruction with a call to
- QObject::deleteLater().
-
- After result() is emitted, the AddUserIDJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT AddUserIDJob : public Job
-{
- Q_OBJECT
-protected:
- explicit AddUserIDJob(QObject *parent);
-public:
- ~AddUserIDJob();
-
- /**
- Starts the operation. \a key is the key to add the UID to. \a
- name, \a email and \a comment are the components of the user id.
- */
- virtual GpgME::Error start(const GpgME::Key &key, const QString &name,
- const QString &email, const QString &comment = QString()) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::Error &result, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_ADDUSERIDJOB_H__
diff --git a/lang/qt/src/changeexpiryjob.cpp b/lang/qt/src/changeexpiryjob.cpp
deleted file mode 100644
index 333fbabe..00000000
--- a/lang/qt/src/changeexpiryjob.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- changeexpiryjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "changeexpiryjob.h"
-#include "changeexpiryjob_p.h"
-
-#include <gpgme++/context.h>
-
-using namespace GpgME;
-using namespace QGpgME;
-
-void ChangeExpiryJob::setOptions(ChangeExpiryJob::Options options)
-{
- auto d = jobPrivate<ChangeExpiryJobPrivate>(this);
- d->m_options = options;
-}
-
-ChangeExpiryJob::Options ChangeExpiryJob::options() const
-{
- auto d = jobPrivate<ChangeExpiryJobPrivate>(this);
- return d->m_options;
-}
-
-/* For ABI compat not pure virtual. */
-Error ChangeExpiryJob::start(const Key &, const QDateTime &, const std::vector<Subkey> &)
-{
- return {};
-}
diff --git a/lang/qt/src/changeexpiryjob.h b/lang/qt/src/changeexpiryjob.h
deleted file mode 100644
index abec51ea..00000000
--- a/lang/qt/src/changeexpiryjob.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- changeexpiryjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_CHANGEEXPIRYJOB_H__
-#define __KLEO_CHANGEEXPIRYJOB_H__
-
-#include "job.h"
-
-#include <gpgme++/key.h>
-
-#include <vector>
-
-namespace GpgME
-{
-class Error;
-}
-
-class QDateTime;
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class to change expiry asynchronously
-
- To use a ChangeExpiryJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the job with a call
- to start(). This call might fail, in which case the ChangeExpiryJob
- instance will have scheduled it's own destruction with a call to
- QObject::deleteLater().
-
- After result() is emitted, the ChangeExpiryJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT ChangeExpiryJob : public Job
-{
- Q_OBJECT
-public:
- enum Option {
- Default = 0x00,
- UpdatePrimaryKey = 0x01,
- UpdateAllSubkeys = 0x02,
- };
- Q_DECLARE_FLAGS(Options, Option)
-
-protected:
- explicit ChangeExpiryJob(QObject *parent);
-public:
- ~ChangeExpiryJob();
-
- void setOptions(Options options);
- Options options() const;
-
- /**
- Starts the change-expiry operation. \a key is the key to change
- the expiry of. \a expiry is the new expiry time. If \a expiry
- is not valid, \a key is set to never expire.
- */
- virtual GpgME::Error start(const GpgME::Key &key, const QDateTime &expiry) = 0;
-
- /**
- Starts the change-expiry operation. \a key is the key to change,
- \a subkeys is a list of subkeys of the key, and \a expiry is the
- new expiry time. If \a subkeys is empty, then the expiry of \a key
- is changed. Otherwise, the expiry of \a subkeys is changed. If
- \a expiry is not valid, then \a key or \a subkeys are set to never expire.
- */
- virtual GpgME::Error start(const GpgME::Key &key, const QDateTime &expiry,
- const std::vector<GpgME::Subkey> &subkeys);
-
-Q_SIGNALS:
- void result(const GpgME::Error &result, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(ChangeExpiryJob::Options)
-
-}
-
-#endif // __KLEO_CHANGEEXPIRYJOB_H__
diff --git a/lang/qt/src/changeexpiryjob_p.h b/lang/qt/src/changeexpiryjob_p.h
deleted file mode 100644
index c6c91c25..00000000
--- a/lang/qt/src/changeexpiryjob_p.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- changeexpiryjob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_CHANGEEXPIRYJOB_P_H__
-#define __QGPGME_CHANGEEXPIRYJOB_P_H__
-
-#include "job_p.h"
-
-#include "changeexpiryjob.h"
-
-namespace QGpgME
-{
-
-struct ChangeExpiryJobPrivate : public JobPrivate
-{
- ChangeExpiryJob::Options m_options = ChangeExpiryJob::Default;
-};
-
-}
-
-#endif // __QGPGME_CHANGEEXPIRYJOB_P_H__
diff --git a/lang/qt/src/changeownertrustjob.h b/lang/qt/src/changeownertrustjob.h
deleted file mode 100644
index 6e4613ee..00000000
--- a/lang/qt/src/changeownertrustjob.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- changeownertrustjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_CHANGEOWNERTRUST_H__
-#define __KLEO_CHANGEOWNERTRUST_H__
-
-#include "job.h"
-
-#include <gpgme++/key.h>
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class to change owner trust asynchronously
-
- To use a ChangeOwnerTrustJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the job with a call
- to start(). This call might fail, in which case the ChangeOwnerTrustJob
- instance will have scheduled it's own destruction with a call to
- QObject::deleteLater().
-
- After result() is emitted, the ChangeOwnerTrustJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT ChangeOwnerTrustJob : public Job
-{
- Q_OBJECT
-protected:
- explicit ChangeOwnerTrustJob(QObject *parent);
-public:
- ~ChangeOwnerTrustJob();
-
- /**
- Starts the change-owner trust operation. \a key is the key to change
- the owner trust of . \a trust is the new trust level.
- */
- virtual GpgME::Error start(const GpgME::Key &key, GpgME::Key::OwnerTrust trust) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::Error &result, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_CHANGEOWNERTRUSTJOB_H__
diff --git a/lang/qt/src/changepasswdjob.h b/lang/qt/src/changepasswdjob.h
deleted file mode 100644
index 44de77c4..00000000
--- a/lang/qt/src/changepasswdjob.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- changepasswdjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2010 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_CHANGEPASSWDJOB_H__
-#define __KLEO_CHANGEPASSWDJOB_H__
-
-#include "job.h"
-
-namespace GpgME
-{
-class Error;
-class Key;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class to change a key's passphrase asynchronously
-
- To use a ChangePasswdJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the job with a call
- to start(). This call might fail, in which case the ChangePasswdJob
- instance will have scheduled it's own destruction with a call to
- QObject::deleteLater().
-
- After result() is emitted, the ChangePasswdJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT ChangePasswdJob : public Job
-{
- Q_OBJECT
-protected:
- explicit ChangePasswdJob(QObject *parent);
-public:
- ~ChangePasswdJob();
-
- /**
- Starts the passphrase-change operation. \a key is the key to
- change the passphrase of. The passphrase is queried by the
- backend directly, you cannot give it to the job beforehand.
- */
- virtual GpgME::Error start(const GpgME::Key &key) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::Error &result, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_CHANGEPASSWDJOB_H__
diff --git a/lang/qt/src/cleaner.cpp b/lang/qt/src/cleaner.cpp
deleted file mode 100644
index b46d1a23..00000000
--- a/lang/qt/src/cleaner.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- cleaner.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#include "cleaner.h"
-
-#include <qgpgme_debug.h>
-
-#include <QCoreApplication>
-#include <QFile>
-
-#include <chrono>
-
-static const auto timeout = std::chrono::seconds{10};
-
-static bool remove_file(const QString &filePath)
-{
- if (filePath.isEmpty()) {
- qCWarning(QGPGME_LOG) << __func__ << "- called with empty file path";
- return true;
- }
- if (QFile::exists(filePath)) {
- qCDebug(QGPGME_LOG) << __func__ << "- Removing file" << filePath;
- if (!QFile::remove(filePath)) {
- qCDebug(QGPGME_LOG) << __func__ << "- Removing file" << filePath << "failed";
- return false;
- }
- } else {
- qCDebug(QGPGME_LOG) << __func__ << "- File" << filePath << "doesn't exist";
- }
- return true;
-}
-
-void Cleaner::removeFile(const QString &filePath)
-{
- if (!remove_file(filePath)) {
- // use invokeMethod because we might not be called from the GUI thread
- // but we want to delegate the Cleaner's clean-up to the application instance
- QMetaObject::invokeMethod(qApp, [filePath]() {
- new Cleaner{filePath, qApp};
- }, Qt::QueuedConnection);
- }
-}
-
-Cleaner::Cleaner(const QString &filePath, QObject *parent)
- : QObject{parent}
- , mFilePath{filePath}
-{
- qCDebug(QGPGME_LOG) << this << __func__ << filePath;
- mTimer.setSingleShot(true);
- mTimer.callOnTimeout([this]() {
- if (remove_file(mFilePath)) {
- mFilePath.clear();
- deleteLater();
- } else {
- mTimer.start(timeout);
- }
- });
- mTimer.start(timeout);
-}
-
-Cleaner::~Cleaner()
-{
- qCDebug(QGPGME_LOG) << this << __func__;
- if (!mFilePath.isEmpty()) {
- remove_file(mFilePath);
- }
-}
-
-#include "cleaner.moc"
diff --git a/lang/qt/src/cleaner.h b/lang/qt/src/cleaner.h
deleted file mode 100644
index 2307c34e..00000000
--- a/lang/qt/src/cleaner.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- cleaner.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_CLEANER_H__
-#define __QGPGME_CLEANER_H__
-
-#include <QObject>
-#include <QString>
-#include <QTimer>
-
-/** Helper class that tries to remove files at regular intervals and on destruction. */
-class Cleaner : public QObject
-{
- Q_OBJECT
-public:
- /** Tries to remove the file. If this fails it creates a Cleaner for the file. */
- static void removeFile(const QString &filePath);
-
-private:
- explicit Cleaner(const QString &filePath, QObject *parent=nullptr);
- ~Cleaner() override;
-
- Q_DISABLE_COPY_MOVE(Cleaner)
-
-private:
- QString mFilePath;
- QTimer mTimer;
-};
-
-#endif // __QGPGME_CLEANER_H__
diff --git a/lang/qt/src/cryptoconfig.cpp b/lang/qt/src/cryptoconfig.cpp
deleted file mode 100644
index fe808827..00000000
--- a/lang/qt/src/cryptoconfig.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- cryptoconfig.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2017 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-#include "cryptoconfig.h"
-#include "qgpgmenewcryptoconfig.h"
-
-using namespace QGpgME;
-
-QStringList CryptoConfigEntry::stringValueList() const
-{
- const QGpgMENewCryptoConfigEntry *entry = dynamic_cast <const QGpgMENewCryptoConfigEntry*> (this);
- if (!entry) {
- return QStringList();
- }
- return entry->stringValueList();
-}
-
-QVariant CryptoConfigEntry::defaultValue() const
-{
- const QGpgMENewCryptoConfigEntry *entry = dynamic_cast <const QGpgMENewCryptoConfigEntry*>(this);
- if (!entry) {
- return {};
- }
- return entry->defaultValue();
-}
-
-QGpgME::CryptoConfigEntry *CryptoConfig::entry(const QString &componentName, const QString &entryName) const
-{
- const CryptoConfigComponent *comp = component(componentName);
- const QStringList groupNames = comp ? comp->groupList() : QStringList();
- for (const auto &groupName : groupNames) {
- const CryptoConfigGroup *group = comp->group(groupName);
- CryptoConfigEntry *entry = group ? group->entry(entryName) : nullptr;
- if (entry) {
- return entry;
- }
- }
- return nullptr;
-}
-
-QGpgME::CryptoConfigEntry *CryptoConfig::entry(const QString &componentName, const QString &groupName, const QString &entryName) const
-{
- const CryptoConfigComponent *comp = component(componentName);
- const CryptoConfigGroup *group = comp ? comp->group(groupName) : nullptr;
- return group ? group->entry(entryName) : nullptr;
-}
diff --git a/lang/qt/src/cryptoconfig.h b/lang/qt/src/cryptoconfig.h
deleted file mode 100644
index d87f7d46..00000000
--- a/lang/qt/src/cryptoconfig.h
+++ /dev/null
@@ -1,424 +0,0 @@
-/*
- cryptoconfig.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef CRYPTOCONFIG_H
-#define CRYPTOCONFIG_H
-
-#include "qgpgme_export.h"
-#ifdef __cplusplus
-/* we read this file from a C compiler, and are only interested in the
- * enums... */
-
-#include <QUrl>
-
-#include <vector>
-
-class QVariant;
-
-/* Start reading this file from the bottom up :) */
-
-namespace QGpgME
-{
-
-/**
- * Description of a single option
- */
-class QGPGME_EXPORT CryptoConfigEntry
-{
-
-public:
-#endif /* __cplusplus */
- /**
- @li basic This option should always be offered to the user.
- @li advanced This option may be offered to advanced users.
- @li expert This option should only be offered to expert users.
- */
- enum Level { Level_Basic = 0,
- Level_Advanced = 1,
- Level_Expert = 2
- };
-
- /**
- Type of the argument
- @li ArgType_None The option is set or not set, but no argument.
- @li ArgType_String An unformatted string.
- @li ArgType_Int A signed integer number.
- @li ArgType_UInt An unsigned integer number.
- @li ArgType_Path A string that describes the pathname of a file.
- The file does not necessarily need to exist.
- Separated from string so that e.g. a FileDialog can be used.
- @li ArgType_DirPath A string that describes the pathname of a directory.
- The directory does not necessarily need to exist.
- Separated from path so that e.g. a FileDialog can be used which only
- allows directories to be selected.
- @li ArgType_LDAPURL A LDAP URL
- Separated from URL so that a more specific widget can be shown, hiding the url syntax
- */
- enum ArgType { ArgType_None = 0,
- ArgType_String = 1,
- ArgType_Int = 2,
- ArgType_UInt = 3,
- ArgType_Path = 4,
- /* Nr. 5 was URL historically. */
- ArgType_LDAPURL = 6,
- ArgType_DirPath = 7,
-
- NumArgType
- };
-
-#ifdef __cplusplus
- virtual ~CryptoConfigEntry() {}
-
- /**
- * Return the internal name of this entry
- */
- virtual QString name() const = 0;
-
- /**
- * @return user-visible description of this entry
- */
- virtual QString description() const = 0;
-
- /**
- * @return "component/group/name"
- */
- virtual QString path() const = 0;
-
- /**
- * @return true if the argument is optional
- */
- virtual bool isOptional() const = 0;
-
- /**
- * @return true if the entry is readonly
- */
- virtual bool isReadOnly() const = 0;
-
- /**
- * @return true if the argument can be given multiple times
- */
- virtual bool isList() const = 0;
-
- /**
- * @return true if the argument can be changed at runtime
- */
- virtual bool isRuntime() const = 0;
-
- /**
- * User level
- */
- virtual Level level() const = 0;
-
- /**
- * Argument type
- */
- virtual ArgType argType() const = 0;
-
- /**
- * Return true if the option is set, i.e. different from default
- */
- virtual bool isSet() const = 0;
-
- /**
- * Return value as a bool (only allowed for ArgType_None)
- */
- virtual bool boolValue() const = 0;
-
- /**
- * Return value as a string (available for all argtypes)
- * The returned string can be empty (explicitly set to empty) or null (not set).
- */
- virtual QString stringValue() const = 0;
-
- /**
- * Return value as a signed int
- */
- virtual int intValue() const = 0;
-
- /**
- * Return value as an unsigned int
- */
- virtual unsigned int uintValue() const = 0;
-
- /**
- * Return value as a URL (only meaningful for Path and URL argtypes)
- */
- virtual QUrl urlValue() const = 0;
-
- /**
- * Return number of times the option is set (only valid for ArgType_None, if isList())
- */
- virtual unsigned int numberOfTimesSet() const = 0;
-
- /**
- * Return value as a list of signed ints
- */
- virtual std::vector<int> intValueList() const = 0;
-
- /**
- * Return value as a list of unsigned ints
- */
- virtual std::vector<unsigned int> uintValueList() const = 0;
-
- /**
- * Return value as a list of URLs (only meaningful for Path and URL argtypes, if isList())
- */
- virtual QList<QUrl> urlValueList() const = 0;
-
- /**
- * Reset an option to its default value
- */
- virtual void resetToDefault() = 0;
-
- /**
- * Define whether the option is set or not (only allowed for ArgType_None)
- * #### TODO: and for options with optional args
- */
- virtual void setBoolValue(bool) = 0;
-
- /**
- * Set string value (allowed for all argtypes)
- */
- virtual void setStringValue(const QString &) = 0;
-
- /**
- * Set a new signed int value
- */
- virtual void setIntValue(int) = 0;
-
- /**
- * Set a new unsigned int value
- */
- virtual void setUIntValue(unsigned int) = 0;
-
- /**
- * Set value as a URL (only meaningful for Path (if local) and URL argtypes)
- */
- virtual void setURLValue(const QUrl &) = 0;
-
- /**
- * Set the number of times the option is set (only valid for ArgType_None, if isList())
- */
- virtual void setNumberOfTimesSet(unsigned int) = 0;
-
- /**
- * Set a new list of signed int values
- */
- virtual void setIntValueList(const std::vector<int> &) = 0;
-
- /**
- * Set a new list of unsigned int values
- */
- virtual void setUIntValueList(const std::vector<unsigned int> &) = 0;
-
- /**
- * Set value as a URL list (only meaningful for Path (if all URLs are local) and URL argtypes, if isList())
- */
- virtual void setURLValueList(const QList<QUrl> &) = 0;
-
- /**
- * @return true if the value was changed
- */
- virtual bool isDirty() const = 0;
-
- // Design change from here on we are closely bound to one implementation
- // of cryptoconfig. To avoid ABI breaks with every new function we
- // add real functions from now on.
-
- /**
- * @return a stringValueList.
- */
- QStringList stringValueList() const;
-
- /**
- * Return the default value as a variant (available for all argtypes).
- */
- QVariant defaultValue() const;
-};
-
-/**
- * Group containing a set of config options
- */
-class QGPGME_EXPORT CryptoConfigGroup
-{
-
-public:
- virtual ~CryptoConfigGroup() {}
-
- /**
- * Return the internal name of this group
- */
- virtual QString name() const = 0;
-
- /**
- * Return the name of the icon for this group
- */
- virtual QString iconName() const = 0;
-
- /**
- * @return user-visible description of this group
- */
- virtual QString description() const = 0;
-
- /**
- * @return "component/group"
- */
- virtual QString path() const = 0;
-
- /**
- * User level
- */
- virtual CryptoConfigEntry::Level level() const = 0;
-
- /**
- * Returns the list of entries that are known by this group.
- *
- * @return list of group entry names.
- **/
- virtual QStringList entryList() const = 0;
-
- /**
- * @return the configuration object for a given entry in this group
- * The object is owned by CryptoConfigGroup, don't delete it.
- * Groups cannot be nested, so all entries returned here are pure entries, no groups.
- */
- virtual CryptoConfigEntry *entry(const QString &name) const = 0;
-};
-
-/**
- * Crypto config for one component (e.g. gpg-agent, dirmngr etc.)
- */
-class QGPGME_EXPORT CryptoConfigComponent
-{
-
-public:
- virtual ~CryptoConfigComponent() {}
-
- /**
- * Return the internal name of this component
- */
- virtual QString name() const = 0;
-
- /**
- * Return the name of the icon for this component
- */
- virtual QString iconName() const = 0;
-
- /**
- * Return user-visible description of this component
- */
- virtual QString description() const = 0;
-
- /**
- * Returns the list of groups that are known about.
- *
- * @return list of group names. One of them can be "<nogroup>", which is the group where all
- * "toplevel" options (belonging to no group) are.
- */
- virtual QStringList groupList() const = 0;
-
- /**
- * @return the configuration object for a given group
- * The object is owned by CryptoConfigComponent, don't delete it.
- */
- virtual CryptoConfigGroup *group(const QString &name) const = 0;
-
-};
-
-/**
- * Main interface to crypto configuration.
- */
-class QGPGME_EXPORT CryptoConfig
-{
-
-public:
- virtual ~CryptoConfig() {}
-
- /**
- * Returns the list of known components (e.g. "gpg-agent", "dirmngr" etc.).
- * Use @ref component() to retrieve more information about each one.
- * @return list of component names.
- **/
- virtual QStringList componentList() const = 0;
-
- /**
- * @return the configuration object for a given component
- * The object is owned by CryptoConfig, don't delete it.
- */
- virtual CryptoConfigComponent *component(const QString &name) const = 0;
-
- /**
- * Convenience method to get hold of a single configuration entry when
- * its component and name are known. This can be used to read
- * the value and/or to set a value to it.
- *
- * @return the configuration object for a single configuration entry, 0 if not found.
- * The object is owned by CryptoConfig, don't delete it.
- */
- CryptoConfigEntry *entry(const QString &componentName, const QString &entryName) const;
-
- /**
- * This function is obsolete. It is provided to keep old source code working.
- * We strongly advise against using it in new code.
- *
- * This function overloads @ref entry().
- *
- * Use the entry overload that does not require a group name instead. The group name
- * is not needed to identify a configuration entry because it only provides logical
- * grouping for user interfaces. Sometimes configuration entries are moved to different
- * groups to improve usability.
- */
- QGPGME_DEPRECATED CryptoConfigEntry *entry(const QString &componentName, const QString &groupName, const QString &entryName) const;
-
- /**
- * Write back changes
- *
- * @param runtime this parameter is ignored. Changes will always
- * be made with --runtime set.
- */
- virtual void sync(bool runtime) = 0;
-
- /**
- * Tells the CryptoConfig to discard any cached information, including
- * all components, groups and entries.
- * Call this to free some memory when you won't be using the object
- * for some time.
- * DON'T call this if you're holding pointers to components, groups or entries.
- */
- virtual void clear() = 0;
-};
-
-}
-#endif /* __cplusplus */
-#endif /* CRYPTOCONFIG_H */
diff --git a/lang/qt/src/dataprovider.cpp b/lang/qt/src/dataprovider.cpp
deleted file mode 100644
index e376ca8d..00000000
--- a/lang/qt/src/dataprovider.cpp
+++ /dev/null
@@ -1,301 +0,0 @@
-/* dataprovider.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (C) 2004 Klarävdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-// -*- c++ -*-
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include <dataprovider.h>
-
-#include <gpgme++/error.h>
-
-#include <QIODevice>
-#include <QProcess>
-
-#include <cstdio>
-#include <cstring>
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-//
-//
-// QByteArrayDataProvider
-//
-//
-
-static bool resizeAndInit(QByteArray &ba, size_t newSize)
-{
- const size_t oldSize = ba.size();
- ba.resize(newSize);
- const bool ok = (newSize == static_cast<size_t>(ba.size()));
- if (ok) {
- memset(ba.data() + oldSize, 0, newSize - oldSize);
- }
- return ok;
-}
-
-QByteArrayDataProvider::QByteArrayDataProvider()
- : GpgME::DataProvider(), mOff(0) {}
-
-QByteArrayDataProvider::QByteArrayDataProvider(const QByteArray &initialData)
- : GpgME::DataProvider(), mArray(initialData), mOff(0) {}
-
-QByteArrayDataProvider::~QByteArrayDataProvider() {}
-
-ssize_t QByteArrayDataProvider::read(void *buffer, size_t bufSize)
-{
-#ifndef NDEBUG
- //qDebug( "QByteArrayDataProvider::read( %p, %d )", buffer, bufSize );
-#endif
- if (bufSize == 0) {
- return 0;
- }
- if (!buffer) {
- Error::setSystemError(GPG_ERR_EINVAL);
- return -1;
- }
- if (mOff >= mArray.size()) {
- return 0; // EOF
- }
- size_t amount = qMin(bufSize, static_cast<size_t>(mArray.size() - mOff));
- assert(amount > 0);
- memcpy(buffer, mArray.data() + mOff, amount);
- mOff += amount;
- return amount;
-}
-
-ssize_t QByteArrayDataProvider::write(const void *buffer, size_t bufSize)
-{
-#ifndef NDEBUG
- //qDebug( "QByteArrayDataProvider::write( %p, %lu )", buffer, static_cast<unsigned long>( bufSize ) );
-#endif
- if (bufSize == 0) {
- return 0;
- }
- if (!buffer) {
- Error::setSystemError(GPG_ERR_EINVAL);
- return -1;
- }
- if (mOff >= mArray.size()) {
- resizeAndInit(mArray, mOff + bufSize);
- }
- if (mOff >= mArray.size()) {
- Error::setSystemError(GPG_ERR_EIO);
- return -1;
- }
- assert(bufSize <= static_cast<size_t>(mArray.size()) - mOff);
- memcpy(mArray.data() + mOff, buffer, bufSize);
- mOff += bufSize;
- return bufSize;
-}
-
-off_t QByteArrayDataProvider::seek(off_t offset, int whence)
-{
-#ifndef NDEBUG
- //qDebug( "QByteArrayDataProvider::seek( %d, %d )", int(offset), whence );
-#endif
- int newOffset = mOff;
- switch (whence) {
- case SEEK_SET:
- newOffset = offset;
- break;
- case SEEK_CUR:
- newOffset += offset;
- break;
- case SEEK_END:
- newOffset = mArray.size() + offset;
- break;
- default:
- Error::setSystemError(GPG_ERR_EINVAL);
- return (off_t) - 1;
- }
- return mOff = newOffset;
-}
-
-void QByteArrayDataProvider::release()
-{
-#ifndef NDEBUG
- //qDebug( "QByteArrayDataProvider::release()" );
-#endif
- mArray = QByteArray();
-}
-
-//
-//
-// QIODeviceDataProvider
-//
-//
-
-QIODeviceDataProvider::QIODeviceDataProvider(const std::shared_ptr<QIODevice> &io)
- : GpgME::DataProvider(),
- mIO(io),
- mErrorOccurred(false),
- mHaveQProcess(qobject_cast<QProcess *>(io.get()))
-{
- assert(mIO);
-}
-
-QIODeviceDataProvider::~QIODeviceDataProvider() {}
-
-bool QIODeviceDataProvider::isSupported(Operation op) const
-{
- const QProcess *const proc = qobject_cast<QProcess *>(mIO.get());
- bool canRead = true;
- if (proc) {
- canRead = proc->readChannel() == QProcess::StandardOutput;
- }
-
- switch (op) {
- case Read: return mIO->isReadable() && canRead;
- case Write: return mIO->isWritable();
- case Seek: return !mIO->isSequential();
- case Release: return true;
- default: return false;
- }
-}
-
-static qint64 blocking_read(const std::shared_ptr<QIODevice> &io, char *buffer, qint64 maxSize)
-{
- while (!io->bytesAvailable()) {
- if (!io->waitForReadyRead(-1)) {
- if (const QProcess *const p = qobject_cast<QProcess *>(io.get())) {
- if (p->error() == QProcess::UnknownError &&
- p->exitStatus() == QProcess::NormalExit &&
- p->exitCode() == 0) {
- if (io->atEnd()) {
- // EOF
- return 0;
- } // continue reading even if process ended to ensure
- // everything is read.
- } else {
- Error::setSystemError(GPG_ERR_EIO);
- return -1;
- }
- } else {
- return 0; // assume EOF (loses error cases :/ )
- }
- }
- }
- return io->read(buffer, maxSize);
-}
-
-ssize_t QIODeviceDataProvider::read(void *buffer, size_t bufSize)
-{
-#ifndef NDEBUG
- //qDebug( "QIODeviceDataProvider::read( %p, %lu )", buffer, bufSize );
-#endif
- if (bufSize == 0) {
- return 0;
- }
- if (!buffer) {
- Error::setSystemError(GPG_ERR_EINVAL);
- return -1;
- }
- const qint64 numRead = mHaveQProcess
- ? blocking_read(mIO, static_cast<char *>(buffer), bufSize)
- : mIO->read(static_cast<char *>(buffer), bufSize);
-
- //workaround: some QIODevices (known example: QProcess) might not return 0 (EOF), but immediately -1 when finished. If no
- //errno is set, gpgme doesn't detect the error and loops forever. So return 0 on the very first -1 in case errno is 0
-
- ssize_t rc = numRead;
- if (numRead < 0 && !Error::hasSystemError()) {
- if (mErrorOccurred) {
- Error::setSystemError(GPG_ERR_EIO);
- } else {
- rc = 0;
- }
- }
- if (numRead < 0) {
- mErrorOccurred = true;
- }
- return rc;
-}
-
-ssize_t QIODeviceDataProvider::write(const void *buffer, size_t bufSize)
-{
-#ifndef NDEBUG
- //qDebug( "QIODeviceDataProvider::write( %p, %lu )", buffer, static_cast<unsigned long>( bufSize ) );
-#endif
- if (bufSize == 0) {
- return 0;
- }
- if (!buffer) {
- Error::setSystemError(GPG_ERR_EINVAL);
- return -1;
- }
-
- ssize_t ret = mIO->write(static_cast<const char *>(buffer), bufSize);
- if (mHaveQProcess) {
- /* XXX: With at least Qt 5.12 we have the problem that the acutal write
- * would be triggered by an event / slot. So as we have moved the io
- * device to our thread this is never triggered until the job is finished
- * calling waitForBytesWritten internally triggers a _q_canWrite which will
- * actually write. This is what we want as we want to stream and not to
- * buffer endlessly. */
- qobject_cast<QProcess *>(mIO.get())->waitForBytesWritten(0);
- }
- return ret;
-}
-
-off_t QIODeviceDataProvider::seek(off_t offset, int whence)
-{
-#ifndef NDEBUG
- //qDebug( "QIODeviceDataProvider::seek( %d, %d )", int(offset), whence );
-#endif
- if (mIO->isSequential()) {
- Error::setSystemError(GPG_ERR_ESPIPE);
- return (off_t) - 1;
- }
- qint64 newOffset = mIO->pos();
- switch (whence) {
- case SEEK_SET:
- newOffset = offset;
- break;
- case SEEK_CUR:
- newOffset += offset;
- break;
- case SEEK_END:
- newOffset = mIO->size() + offset;
- break;
- default:
- Error::setSystemError(GPG_ERR_EINVAL);
- return (off_t) - 1;
- }
- if (!mIO->seek(newOffset)) {
- Error::setSystemError(GPG_ERR_EINVAL);
- return (off_t) - 1;
- }
- return newOffset;
-}
-
-void QIODeviceDataProvider::release()
-{
-#ifndef NDEBUG
- //qDebug( "QIODeviceDataProvider::release()" );
-#endif
- mIO->close();
-}
diff --git a/lang/qt/src/dataprovider.h b/lang/qt/src/dataprovider.h
deleted file mode 100644
index c0bd361b..00000000
--- a/lang/qt/src/dataprovider.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* dataprovider.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-// -*- c++ -*-
-#ifndef __QGPGME_DATAPROVIDER_H__
-#define __QGPGME_DATAPROVIDER_H__
-
-#include "qgpgme_export.h"
-
-#include <gpgme++/interfaces/dataprovider.h>
-
-#include <memory>
-
-#include <QtCore/QByteArray>
-
-
-class QIODevice;
-
-namespace QGpgME
-{
-
-class QGPGME_EXPORT QByteArrayDataProvider : public GpgME::DataProvider
-{
-public:
- QByteArrayDataProvider();
- explicit QByteArrayDataProvider(const QByteArray &initialData);
- ~QByteArrayDataProvider();
-
- const QByteArray &data() const
- {
- return mArray;
- }
-
-private:
- // these shall only be accessed through the dataprovider
- // interface, where they're public:
- bool isSupported(Operation) const override
- {
- return true;
- }
- ssize_t read(void *buffer, size_t bufSize) override;
- ssize_t write(const void *buffer, size_t bufSize) override;
- off_t seek(off_t offset, int whence) override;
- void release() override;
-
-private:
- QByteArray mArray;
- off_t mOff;
-};
-
-class QGPGME_EXPORT QIODeviceDataProvider : public GpgME::DataProvider
-{
-public:
- explicit QIODeviceDataProvider(const std::shared_ptr<QIODevice> &initialData);
- ~QIODeviceDataProvider();
-
- const std::shared_ptr<QIODevice> &ioDevice() const
- {
- return mIO;
- }
-
-private:
- // these shall only be accessed through the dataprovider
- // interface, where they're public:
- bool isSupported(Operation) const override;
- ssize_t read(void *buffer, size_t bufSize) override;
- ssize_t write(const void *buffer, size_t bufSize) override;
- off_t seek(off_t offset, int whence) override;
- void release() override;
-
-private:
- const std::shared_ptr<QIODevice> mIO;
- bool mErrorOccurred : 1;
- bool mHaveQProcess : 1;
-};
-
-} // namespace QGpgME
-
-#endif
diff --git a/lang/qt/src/debug.cpp b/lang/qt/src/debug.cpp
deleted file mode 100644
index acde9d42..00000000
--- a/lang/qt/src/debug.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- debug.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2020 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include <gpgme++/error.h>
-#include "debug.h"
-
-#include <QDebug>
-
-QDebug operator<<(QDebug debug, const GpgME::Error &err)
-{
-#ifdef Q_OS_WIN
- // On Windows, we tell libgpg-error to return (translated) error messages as UTF-8
- const auto errAsString = QString::fromStdString(err.asStdString());
-#else
- const auto errAsString = QString::fromLocal8Bit(err.asStdString().c_str());
-#endif
- const bool oldSetting = debug.autoInsertSpaces();
- debug.nospace() << errAsString << " (code: " << err.code() << ", source: " << err.source() << ")";
- debug.setAutoInsertSpaces(oldSetting);
- return debug.maybeSpace();
-}
diff --git a/lang/qt/src/debug.h b/lang/qt/src/debug.h
deleted file mode 100644
index 03894768..00000000
--- a/lang/qt/src/debug.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- debug.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2020 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef QGPGME_DEBUG_H
-#define QGPGME_DEBUG_H
-
-#include "qgpgme_export.h"
-
-#include <sstream>
-
-namespace GpgME
-{
-class Error;
-}
-
-class QDebug;
-
-QGPGME_EXPORT QDebug operator<<(QDebug debug, const GpgME::Error &err);
-
-namespace QGpgME
-{
-/**
- * Helper to log GpgME objects which provide the output stream operator.
- */
-template<class GpgMEClass>
-std::string toLogString(const GpgMEClass &object)
-{
- std::stringstream stream;
- stream << object;
- return stream.str();
-}
-}
-
-#endif // QGPGME_DEBUG_H
diff --git a/lang/qt/src/decryptjob.h b/lang/qt/src/decryptjob.h
deleted file mode 100644
index 51954074..00000000
--- a/lang/qt/src/decryptjob.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- decryptjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004, 2007 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_DECRYPTJOB_H__
-#define __KLEO_DECRYPTJOB_H__
-
-#include "job.h"
-
-#include <memory>
-
-class QByteArray;
-class QIODevice;
-
-namespace GpgME
-{
-class Error;
-class DecryptionResult;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous decrypters
-
- To use a DecryptJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the decryption with a
- call to start(). This call might fail, in which case the
- DecryptJob instance will have scheduled it's own destruction with
- a call to QObject::deleteLater().
-
- After result() is emitted, the DecryptJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT DecryptJob : public Job
-{
- Q_OBJECT
-protected:
- explicit DecryptJob(QObject *parent);
-public:
- ~DecryptJob();
-
- /**
- Starts the decryption operation. \a cipherText is the data to
- decrypt.
- */
- virtual GpgME::Error start(const QByteArray &cipherText) = 0;
-
- /*!
- \overload
-
- If \a plainText is non-null, the plaintext is written
- there. Otherwise, it will be delivered in the second argument
- of result().
- */
- virtual void start(const std::shared_ptr<QIODevice> &cipherText, const std::shared_ptr<QIODevice> &plainText = std::shared_ptr<QIODevice>()) = 0;
-
- virtual GpgME::DecryptionResult exec(const QByteArray &cipherText,
- QByteArray &plainText) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::DecryptionResult &result, const QByteArray &plainText, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_DECRYPTJOB_H__
diff --git a/lang/qt/src/decryptverifyarchivejob.cpp b/lang/qt/src/decryptverifyarchivejob.cpp
deleted file mode 100644
index d427e1fd..00000000
--- a/lang/qt/src/decryptverifyarchivejob.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- decryptverifyarchivejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "decryptverifyarchivejob.h"
-#include "decryptverifyarchivejob_p.h"
-
-#include <gpgme++/engineinfo.h>
-
-using namespace QGpgME;
-
-DecryptVerifyArchiveJob::DecryptVerifyArchiveJob(QObject *parent)
- : Job{parent}
-{
-}
-
-DecryptVerifyArchiveJob::~DecryptVerifyArchiveJob() = default;
-
-// static
-bool DecryptVerifyArchiveJob::isSupported()
-{
- static const auto gpgVersion = GpgME::engineInfo(GpgME::GpgEngine).engineVersion();
- return (gpgVersion >= "2.4.1") || (gpgVersion >= "2.2.42" && gpgVersion < "2.3.0");
-}
-
-void DecryptVerifyArchiveJob::setProcessAllSignatures (bool processAll)
-{
- auto d = jobPrivate<DecryptVerifyArchiveJobPrivate>(this);
- d->m_processAllSignatures = processAll;
-}
-
-bool DecryptVerifyArchiveJob::processAllSignatures() const
-{
- auto d = jobPrivate<DecryptVerifyArchiveJobPrivate>(this);
- return d->m_processAllSignatures;
-}
-
-void DecryptVerifyArchiveJob::setInputFile(const QString &path)
-{
- auto d = jobPrivate<DecryptVerifyArchiveJobPrivate>(this);
- d->m_inputFilePath = path;
-}
-
-QString DecryptVerifyArchiveJob::inputFile() const
-{
- auto d = jobPrivate<DecryptVerifyArchiveJobPrivate>(this);
- return d->m_inputFilePath;
-}
-
-void DecryptVerifyArchiveJob::setOutputDirectory(const QString &outputDirectory)
-{
- auto d = jobPrivate<DecryptVerifyArchiveJobPrivate>(this);
- d->m_outputDirectory = outputDirectory;
-}
-
-QString DecryptVerifyArchiveJob::outputDirectory() const
-{
- auto d = jobPrivate<DecryptVerifyArchiveJobPrivate>(this);
- return d->m_outputDirectory;
-}
-
-#include "decryptverifyarchivejob.moc"
diff --git a/lang/qt/src/decryptverifyarchivejob.h b/lang/qt/src/decryptverifyarchivejob.h
deleted file mode 100644
index 3139ae66..00000000
--- a/lang/qt/src/decryptverifyarchivejob.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- decryptverifyarchivejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_DECRYPTVERIFYARCHIVEJOB_H__
-#define __QGPGME_DECRYPTVERIFYARCHIVEJOB_H__
-
-#include "job.h"
-
-#include <gpgme++/context.h>
-
-namespace GpgME
-{
-class Key;
-}
-
-namespace QGpgME
-{
-
-/**
- * Abstract base class for job for decrypting encrypted (signed) archives
- */
-class QGPGME_EXPORT DecryptVerifyArchiveJob : public Job
-{
- Q_OBJECT
-protected:
- explicit DecryptVerifyArchiveJob(QObject *parent);
-public:
- ~DecryptVerifyArchiveJob() override;
-
- static bool isSupported();
-
- /**
- * Enables processing of all signatures if \a processAll is true.
- *
- * By default, gpg (in batch mode used by GpgME) stops the verification of
- * data signatures when a bad signature is encountered. This can be changed
- * by setting this flag. It's equivalent to setting the context flag
- * "proc-all-sigs".
- *
- * This is only supported for OpenPGP and requires GnuPG 2.2.45, 2.4.6, or
- * 2.5.1.
- */
- void setProcessAllSignatures(bool processAll);
- bool processAllSignatures() const;
-
- /**
- * Sets the path of the file to read the archive from.
- *
- * Used if the job is started with startIt().
- */
- void setInputFile(const QString &path);
- QString inputFile() const;
-
- /**
- * Sets the directory the content of the decrypted archive shall be
- * written to.
- */
- void setOutputDirectory(const QString &outputDirectory);
- QString outputDirectory() const;
-
- /**
- * Starts the decryption of an encrypted (and signed) archive.
- *
- * Decrypts and extracts the encrypted archive in \a cipherText. If the
- * archive is signed, then the signature is verified.
- * If a non-empty output directory was set, then the content of the archive
- * is extracted into this directory. Otherwise, it is extracted into a
- * directory named \c GPGARCH_n_ (where \c n is a number).
- *
- * Emits result() when the job has finished.
- */
- virtual GpgME::Error start(const std::shared_ptr<QIODevice> &cipherText) = 0;
-
-Q_SIGNALS:
- /**
- * This signal is emitted whenever gpgtar sends a progress status update for
- * the number of files. In the scanning phase (i.e. while gpgtar checks
- * which files to put into the archive), \a current is the current number of
- * files and \a total is 0. In the writing phase, \a current is the number
- * of processed files and \a total is the total number of files.
- */
- void fileProgress(int current, int total);
-
- /**
- * This signal is emitted whenever gpgtar sends a progress status update for
- * the amount of processed data. It is only emitted in the writing phase.
- * \a current is the processed amount data and \a total is the total amount
- * of data to process. Both values never exceed 2^20.
- */
- void dataProgress(int current, int total);
-
- void result(const GpgME::DecryptionResult &decryptionResult,
- const GpgME::VerificationResult &verificationResult,
- const QString &auditLogAsHtml = {},
- const GpgME::Error &auditLogError = {});
-};
-
-}
-
-#endif // __QGPGME_DECRYPTVERIFYARCHIVEJOB_H__
diff --git a/lang/qt/src/decryptverifyarchivejob_p.h b/lang/qt/src/decryptverifyarchivejob_p.h
deleted file mode 100644
index bce093db..00000000
--- a/lang/qt/src/decryptverifyarchivejob_p.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- decryptverifyarchivejob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_DECRYPTVERIFYARCHIVEJOB_P_H__
-#define __QGPGME_DECRYPTVERIFYARCHIVEJOB_P_H__
-
-#include "job_p.h"
-
-namespace QGpgME
-{
-
-struct DecryptVerifyArchiveJobPrivate : public JobPrivate
-{
- QString m_inputFilePath;
- QString m_outputDirectory;
- bool m_processAllSignatures = false;
-};
-
-}
-
-#endif // __QGPGME_DECRYPTVERIFYARCHIVEJOB_P_H__
diff --git a/lang/qt/src/decryptverifyjob.cpp b/lang/qt/src/decryptverifyjob.cpp
deleted file mode 100644
index f96305b9..00000000
--- a/lang/qt/src/decryptverifyjob.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- decryptverifyjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "decryptverifyjob.h"
-#include "decryptverifyjob_p.h"
-
-using namespace QGpgME;
-
-DecryptVerifyJob::DecryptVerifyJob(QObject *parent)
- : Job{parent}
-{
-}
-
-DecryptVerifyJob::~DecryptVerifyJob() = default;
-
-void DecryptVerifyJob::setProcessAllSignatures (bool processAll)
-{
- auto d = jobPrivate<DecryptVerifyJobPrivate>(this);
- d->m_processAllSignatures = processAll;
-}
-
-bool DecryptVerifyJob::processAllSignatures() const
-{
- auto d = jobPrivate<DecryptVerifyJobPrivate>(this);
- return d->m_processAllSignatures;
-}
-
-void DecryptVerifyJob::setInputFile(const QString &path)
-{
- auto d = jobPrivate<DecryptVerifyJobPrivate>(this);
- d->m_inputFilePath = path;
-}
-
-QString DecryptVerifyJob::inputFile() const
-{
- auto d = jobPrivate<DecryptVerifyJobPrivate>(this);
- return d->m_inputFilePath;
-}
-
-void DecryptVerifyJob::setOutputFile(const QString &path)
-{
- auto d = jobPrivate<DecryptVerifyJobPrivate>(this);
- d->m_outputFilePath = path;
-}
-
-QString DecryptVerifyJob::outputFile() const
-{
- auto d = jobPrivate<DecryptVerifyJobPrivate>(this);
- return d->m_outputFilePath;
-}
-
-#include "decryptverifyjob.moc"
diff --git a/lang/qt/src/decryptverifyjob.h b/lang/qt/src/decryptverifyjob.h
deleted file mode 100644
index 73dbea15..00000000
--- a/lang/qt/src/decryptverifyjob.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- decryptverifyjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004, 2007 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_DECRYPTVERIFYJOB_H__
-#define __KLEO_DECRYPTVERIFYJOB_H__
-
-#include "job.h"
-
-#include <memory>
-
-class QByteArray;
-class QIODevice;
-
-namespace GpgME
-{
-class Error;
-class DecryptionResult;
-class VerificationResult;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous combined decrypters and verifiers
-
- To use a DecryptVerifyJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the operation with a
- call to start(). This call might fail, in which case the
- DecryptVerifyJob instance will have scheduled it's own destruction with
- a call to QObject::deleteLater().
-
- Alternatively, the job can be started with startIt() after setting
- an input file and an output file. If the job is started this way then
- the backend reads the input and writes the output directly from/to the
- specified input file and output file. In this case the plainText value of
- the result signal will always be empty. This direct IO mode is currently
- only supported for OpenPGP. Note that startIt() does not schedule the job's
- destruction if starting the job failed.
-
- After result() is emitted, the DecryptVerifyJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT DecryptVerifyJob : public Job
-{
- Q_OBJECT
-protected:
- explicit DecryptVerifyJob(QObject *parent);
-public:
- ~DecryptVerifyJob() override;
-
- /**
- * Enables processing of all signatures if \a processAll is true.
- *
- * By default, gpg (in batch mode used by GpgME) stops the verification of
- * data signatures when a bad signature is encountered. This can be changed
- * by setting this flag. It's equivalent to setting the context flag
- * "proc-all-sigs".
- *
- * This is only supported for OpenPGP and requires GnuPG 2.2.45, 2.4.6, or
- * 2.5.1.
- */
- void setProcessAllSignatures(bool processAll);
- bool processAllSignatures() const;
-
- /**
- * Sets the path of the file to decrypt (and verify).
- *
- * Used if the job is started with startIt().
- */
- void setInputFile(const QString &path);
- QString inputFile() const;
-
- /**
- * Sets the path of the file to write the result to.
- *
- * Used if the job is started with startIt().
- *
- * \note If a file with this path exists, then the job will fail, i.e. you
- * need to delete an existing file that shall be overwritten before you
- * start the job.
- */
- void setOutputFile(const QString &path);
- QString outputFile() const;
-
- /**
- Starts the combined decryption and verification operation.
- \a cipherText is the data to decrypt and later verify.
- */
- virtual GpgME::Error start(const QByteArray &cipherText) = 0;
-
- /*!
- \overload
-
- If \a plainText is non-null, the plaintext is written
- there. Otherwise, it will be delivered in the third argument
- of result().
- */
- virtual void start(const std::shared_ptr<QIODevice> &cipherText, const std::shared_ptr<QIODevice> &plainText = std::shared_ptr<QIODevice>()) = 0;
-
- /** Synchronous equivalent of start() */
- virtual std::pair<GpgME::DecryptionResult, GpgME::VerificationResult>
- exec(const QByteArray &cipherText, QByteArray &plainText) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::DecryptionResult &decryptionresult,
- const GpgME::VerificationResult &verificationresult,
- const QByteArray &plainText, const QString &auditLogAsHtml = QString(),
- const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_DECRYPTVERIFYJOB_H__
diff --git a/lang/qt/src/decryptverifyjob_p.h b/lang/qt/src/decryptverifyjob_p.h
deleted file mode 100644
index 10701da1..00000000
--- a/lang/qt/src/decryptverifyjob_p.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- decryptverifyjob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_DECRYPTVERIFYJOB_P_H__
-#define __QGPGME_DECRYPTVERIFYJOB_P_H__
-
-#include "job_p.h"
-
-namespace QGpgME
-{
-
-struct DecryptVerifyJobPrivate : public JobPrivate
-{
- QString m_inputFilePath;
- QString m_outputFilePath;
- bool m_processAllSignatures = false;
-};
-
-}
-
-#endif // __QGPGME_DECRYPTVERIFYJOB_P_H__
diff --git a/lang/qt/src/defaultkeygenerationjob.cpp b/lang/qt/src/defaultkeygenerationjob.cpp
deleted file mode 100644
index f589384e..00000000
--- a/lang/qt/src/defaultkeygenerationjob.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/* defaultkeygenerationjob.cpp
-
- Copyright (c) 2016 Klarälvdalens Datakonsult AB
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "defaultkeygenerationjob.h"
-#include "protocol.h"
-#include "keygenerationjob.h"
-
-#include <QPointer>
-#include <QEvent>
-
-using namespace QGpgME;
-
-namespace QGpgME {
-
-class DefaultKeyGenerationJob::Private
-{
-public:
- Private()
- {}
-
- ~Private()
- {
- if (job) {
- job->deleteLater();
- }
- }
-
- QPointer<KeyGenerationJob> job;
-};
-}
-
-
-DefaultKeyGenerationJob::DefaultKeyGenerationJob(QObject* parent)
- : Job(parent)
- , d(new DefaultKeyGenerationJob::Private())
-{
-}
-
-DefaultKeyGenerationJob::~DefaultKeyGenerationJob()
-{
- delete d;
-}
-
-QString DefaultKeyGenerationJob::auditLogAsHtml() const
-{
- return d->job ? d->job->auditLogAsHtml() : QString();
-}
-
-GpgME::Error DefaultKeyGenerationJob::auditLogError() const
-{
- return d->job ? d->job->auditLogError() : GpgME::Error();
-}
-
-void DefaultKeyGenerationJob::slotCancel()
-{
- if (d->job) {
- d->job->slotCancel();
- }
-}
-
-GpgME::Error DefaultKeyGenerationJob::start(const QString &email, const QString &name)
-{
- const QString namePart = name.isEmpty() ? QString() :
- QStringLiteral("name-real: %1\n").arg(name);
- const QString mailPart = email.isEmpty() ? QString() :
- QStringLiteral("name-email: %1\n").arg(email);
-
- const QString args = QStringLiteral("<GnupgKeyParms format=\"internal\">\n"
- "%ask-passphrase\n"
- "key-type: RSA\n"
- "key-length: 2048\n"
- "key-usage: sign\n"
- "subkey-type: RSA\n"
- "subkey-length: 2048\n"
- "subkey-usage: encrypt\n"
- "%1"
- "%2"
- "</GnupgKeyParms>").arg(mailPart, namePart);
-
- d->job = openpgp()->keyGenerationJob();
- d->job->installEventFilter(this);
- connect(d->job.data(), &KeyGenerationJob::result,
- this, &DefaultKeyGenerationJob::result);
- connect(d->job.data(), &KeyGenerationJob::done,
- this, &DefaultKeyGenerationJob::done);
- connect(d->job.data(), &KeyGenerationJob::done,
- this, &QObject::deleteLater);
- return d->job->start(args);
-}
-
-bool DefaultKeyGenerationJob::eventFilter(QObject *watched, QEvent *event)
-{
- // Intercept the KeyGenerationJob's deferred delete event. We want the job
- // to live at least as long as we do so we can delegate calls to it. We will
- // delete the job manually afterwards.
- if (watched == d->job && event->type() == QEvent::DeferredDelete) {
- return true;
- }
-
- return Job::eventFilter(watched, event);
-}
-
-#include "defaultkeygenerationjob.moc"
diff --git a/lang/qt/src/defaultkeygenerationjob.h b/lang/qt/src/defaultkeygenerationjob.h
deleted file mode 100644
index c59e0c6d..00000000
--- a/lang/qt/src/defaultkeygenerationjob.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* defaultkeygenerationjob.h
-
- Copyright (c) 2016 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-#ifndef QGPGME_DEFAULTKEYGENERATION_H
-#define QGPGME_DEFAULTKEYGENERATION_H
-
-#include "job.h"
-
-#include "qgpgme_export.h"
-
-namespace GpgME {
-class KeyGenerationResult;
-}
-
-namespace QGpgME{
-
-/**
- * Generates a PGP RSA/2048 bit key pair for given name and email address.
- *
- * This job is deprecated. Use QuickJob::startCreate instead.
- */
-class QGPGME_DEPRECATED_EXPORT DefaultKeyGenerationJob : public Job
-{
- Q_OBJECT
-public:
- explicit DefaultKeyGenerationJob(QObject *parent = nullptr);
- ~DefaultKeyGenerationJob();
-
- GpgME::Error start(const QString &email, const QString &name);
-
- QString auditLogAsHtml() const override;
- GpgME::Error auditLogError() const override;
-
-
-public Q_SLOTS:
- void slotCancel() override;
-
-Q_SIGNALS:
- void result(const GpgME::KeyGenerationResult &result, const QByteArray &pubkeyData,
- const QString &auditLogAsHtml, const GpgME::Error &auditLogError);
-
-protected:
- bool eventFilter(QObject *watched, QEvent *event) override;
-
-private:
- class Private;
- Private * const d;
-};
-
-}
-
-#endif
diff --git a/lang/qt/src/deletejob.h b/lang/qt/src/deletejob.h
deleted file mode 100644
index 7ab0dd05..00000000
--- a/lang/qt/src/deletejob.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- deletejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_DELETEJOB_H__
-#define __KLEO_DELETEJOB_H__
-
-#include "qgpgme_export.h"
-#include "job.h"
-
-namespace GpgME
-{
-class Error;
-class Key;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous deleters
-
- To use a DeleteJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the delete with a call
- to start(). This call might fail, in which case the DeleteJob
- instance will have scheduled it's own destruction with a call to
- QObject::deleteLater().
-
- After result() is emitted, the DeleteJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT DeleteJob : public Job
-{
- Q_OBJECT
-protected:
- explicit DeleteJob(QObject *parent);
-public:
- ~DeleteJob();
-
- /**
- Starts the delete operation. \a key represents the key to
- delete, \a allowSecretKeyDeletion specifies if a key may also
- be deleted if the secret key part is available, too.
- */
- virtual GpgME::Error start(const GpgME::Key &key, bool allowSecretKeyDeletion = false) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::Error &result, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_DELETEJOB_H__
diff --git a/lang/qt/src/dn.cpp b/lang/qt/src/dn.cpp
deleted file mode 100644
index 836158b0..00000000
--- a/lang/qt/src/dn.cpp
+++ /dev/null
@@ -1,497 +0,0 @@
-/*
- dn.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "dn.h"
-
-#include <gpg-error.h>
-
-static const struct {
- const char *name;
- const char *oid;
-} oidmap[] = {
- // keep them ordered by oid:
- { "SP", "ST" }, // hack to show the Sphinx-required/desired SP for
- // StateOrProvince, otherwise known as ST or even S
- { "NameDistinguisher", "0.2.262.1.10.7.20" },
- { "EMAIL", "1.2.840.113549.1.9.1" },
- { "SN", "2.5.4.4" },
- { "SerialNumber", "2.5.4.5" },
- { "T", "2.5.4.12" },
- { "D", "2.5.4.13" },
- { "BC", "2.5.4.15" },
- { "ADDR", "2.5.4.16" },
- { "PC", "2.5.4.17" },
- { "GN", "2.5.4.42" },
- { "Pseudo", "2.5.4.65" },
-};
-static const unsigned int numOidMaps = sizeof oidmap / sizeof * oidmap;
-
-class QGpgME::DN::Private
-{
-public:
- Private() : mRefCount(0) {}
- Private(const Private &other)
- : attributes(other.attributes),
- reorderedAttributes(other.reorderedAttributes),
- order{"CN", "L", "_X_", "OU", "O", "C"},
- mRefCount(0)
- {
- }
-
- int ref()
- {
- return ++mRefCount;
- }
-
- int unref()
- {
- if (--mRefCount <= 0) {
- delete this;
- return 0;
- } else {
- return mRefCount;
- }
- }
-
- int refCount() const
- {
- return mRefCount;
- }
-
- DN::Attribute::List attributes;
- DN::Attribute::List reorderedAttributes;
- QStringList order;
-private:
- int mRefCount;
-};
-
-namespace
-{
-struct DnPair {
- char *key;
- char *value;
-};
-}
-
-// copied from CryptPlug and adapted to work on DN::Attribute::List:
-
-#define digitp(p) (*(p) >= '0' && *(p) <= '9')
-#define hexdigitp(a) (digitp (a) \
- || (*(a) >= 'A' && *(a) <= 'F') \
- || (*(a) >= 'a' && *(a) <= 'f'))
-#define xtoi_1(p) (*(p) <= '9'? (*(p)- '0'): \
- *(p) <= 'F'? (*(p)-'A'+10):(*(p)-'a'+10))
-#define xtoi_2(p) ((xtoi_1(p) * 16) + xtoi_1((p)+1))
-
-static char *
-trim_trailing_spaces(char *string)
-{
- char *p, *mark;
-
- for (mark = NULL, p = string; *p; p++) {
- if (isspace(*p)) {
- if (!mark) {
- mark = p;
- }
- } else {
- mark = NULL;
- }
- }
- if (mark) {
- *mark = '\0';
- }
-
- return string;
-}
-
-/* Parse a DN and return an array-ized one. This is not a validating
- parser and it does not support any old-stylish syntax; gpgme is
- expected to return only rfc2253 compatible strings. */
-static const unsigned char *
-parse_dn_part(DnPair *array, const unsigned char *string)
-{
- const unsigned char *s, *s1;
- size_t n;
- char *p;
-
- /* parse attributeType */
- for (s = string + 1; *s && *s != '='; s++)
- ;
- if (!*s) {
- return NULL; /* error */
- }
- n = s - string;
- if (!n) {
- return NULL; /* empty key */
- }
- p = (char *)malloc(n + 1);
-
- memcpy(p, string, n);
- p[n] = 0;
- trim_trailing_spaces((char *)p);
- // map OIDs to their names:
- for (unsigned int i = 0; i < numOidMaps; ++i)
- if (!strcasecmp((char *)p, oidmap[i].oid)) {
- free(p);
- gpgrt_asprintf(&p, "%s", oidmap[i].name);
- break;
- }
- array->key = p;
- string = s + 1;
-
- if (*string == '#') {
- /* hexstring */
- string++;
- for (s = string; hexdigitp(s); s++)
- ;
- n = s - string;
- if (!n || (n & 1)) {
- return NULL; /* empty or odd number of digits */
- }
- n /= 2;
- array->value = p = (char *)malloc(n + 1);
-
- for (s1 = string; n; s1 += 2, n--) {
- *p++ = xtoi_2(s1);
- }
- *p = 0;
- } else {
- /* regular v3 quoted string */
- for (n = 0, s = string; *s; s++) {
- if (*s == '\\') {
- /* pair */
- s++;
- if (*s == ',' || *s == '=' || *s == '+'
- || *s == '<' || *s == '>' || *s == '#' || *s == ';'
- || *s == '\\' || *s == '\"' || *s == ' ') {
- n++;
- } else if (hexdigitp(s) && hexdigitp(s + 1)) {
- s++;
- n++;
- } else {
- return NULL; /* invalid escape sequence */
- }
- } else if (*s == '\"') {
- return NULL; /* invalid encoding */
- } else if (*s == ',' || *s == '=' || *s == '+'
- || *s == '<' || *s == '>' || *s == '#' || *s == ';') {
- break;
- } else {
- n++;
- }
- }
-
- array->value = p = (char *)malloc(n + 1);
-
- for (s = string; n; s++, n--) {
- if (*s == '\\') {
- s++;
- if (hexdigitp(s)) {
- *p++ = xtoi_2(s);
- s++;
- } else {
- *p++ = *s;
- }
- } else {
- *p++ = *s;
- }
- }
- *p = 0;
- }
- return s;
-}
-
-/* Parse a DN and return an array-ized one. This is not a validating
- parser and it does not support any old-stylish syntax; gpgme is
- expected to return only rfc2253 compatible strings. */
-static QGpgME::DN::Attribute::List
-parse_dn(const unsigned char *string)
-{
- if (!string) {
- return QVector<QGpgME::DN::Attribute>();
- }
-
- QVector<QGpgME::DN::Attribute> result;
- while (*string) {
- while (*string == ' ') {
- string++;
- }
- if (!*string) {
- break; /* ready */
- }
-
- DnPair pair = { nullptr, nullptr };
- string = parse_dn_part(&pair, string);
- if (!string) {
- goto failure;
- }
- if (pair.key && pair.value)
- result.push_back(QGpgME::DN::Attribute(QString::fromUtf8(pair.key),
- QString::fromUtf8(pair.value)));
- free(pair.key);
- free(pair.value);
-
- while (*string == ' ') {
- string++;
- }
- if (*string && *string != ',' && *string != ';' && *string != '+') {
- goto failure; /* invalid delimiter */
- }
- if (*string) {
- string++;
- }
- }
- return result;
-
-failure:
- return QVector<QGpgME::DN::Attribute>();
-}
-
-static QVector<QGpgME::DN::Attribute>
-parse_dn(const QString &dn)
-{
- return parse_dn((const unsigned char *)dn.toUtf8().data());
-}
-
-static QString dn_escape(const QString &s)
-{
- QString result;
- for (unsigned int i = 0, end = s.length(); i != end; ++i) {
- const QChar ch = s[i];
- switch (ch.unicode()) {
- case ',':
- case '+':
- case '"':
- case '\\':
- case '<':
- case '>':
- case ';':
- result += QLatin1Char('\\');
- // fall through
- default:
- result += ch;
- }
- }
- return result;
-}
-
-static QString
-serialise(const QVector<QGpgME::DN::Attribute> &dn, const QString &sep)
-{
- QStringList result;
- for (QVector<QGpgME::DN::Attribute>::const_iterator it = dn.begin(); it != dn.end(); ++it)
- if (!(*it).name().isEmpty() && !(*it).value().isEmpty()) {
- result.push_back((*it).name().trimmed() + QLatin1Char('=') + dn_escape((*it).value().trimmed()));
- }
- return result.join(sep);
-}
-
-static QGpgME::DN::Attribute::List
-reorder_dn(const QGpgME::DN::Attribute::List &dn, const QStringList &attrOrder)
-{
- QGpgME::DN::Attribute::List unknownEntries;
- QGpgME::DN::Attribute::List result;
- unknownEntries.reserve(dn.size());
- result.reserve(dn.size());
-
- // find all unknown entries in their order of appearance
- for (QGpgME::DN::const_iterator it = dn.begin(); it != dn.end(); ++it)
- if (!attrOrder.contains((*it).name())) {
- unknownEntries.push_back(*it);
- }
-
- // process the known attrs in the desired order
- for (QStringList::const_iterator oit = attrOrder.begin(); oit != attrOrder.end(); ++oit)
- if (*oit == QLatin1String("_X_")) {
- // insert the unknown attrs
- std::copy(unknownEntries.begin(), unknownEntries.end(),
- std::back_inserter(result));
- unknownEntries.clear(); // don't produce dup's
- } else {
- for (QGpgME::DN::const_iterator dnit = dn.begin(); dnit != dn.end(); ++dnit)
- if ((*dnit).name() == *oit) {
- result.push_back(*dnit);
- }
- }
-
- return result;
-}
-
-//
-//
-// class DN
-//
-//
-
-QGpgME::DN::DN()
-{
- d = new Private();
- d->ref();
-}
-
-QGpgME::DN::DN(const QString &dn)
-{
- d = new Private();
- d->ref();
- d->attributes = parse_dn(dn);
-}
-
-QGpgME::DN::DN(const char *utf8DN)
-{
- d = new Private();
- d->ref();
- if (utf8DN) {
- d->attributes = parse_dn((const unsigned char *)utf8DN);
- }
-}
-
-QGpgME::DN::DN(const DN &other)
- : d(other.d)
-{
- if (d) {
- d->ref();
- }
-}
-
-QGpgME::DN::~DN()
-{
- if (d) {
- d->unref();
- }
-}
-
-const QGpgME::DN &QGpgME::DN::operator=(const DN &that)
-{
- if (this->d == that.d) {
- return *this;
- }
-
- if (that.d) {
- that.d->ref();
- }
- if (this->d) {
- this->d->unref();
- }
-
- this->d = that.d;
-
- return *this;
-}
-
-QString QGpgME::DN::prettyDN() const
-{
- if (!d) {
- return QString();
- }
- if (d->reorderedAttributes.empty()) {
- d->reorderedAttributes = reorder_dn(d->attributes, d->order);
- }
- return serialise(d->reorderedAttributes, QStringLiteral(","));
-}
-
-QString QGpgME::DN::dn() const
-{
- return d ? serialise(d->attributes, QStringLiteral(",")) : QString();
-}
-
-QString QGpgME::DN::dn(const QString &sep) const
-{
- return d ? serialise(d->attributes, sep) : QString();
-}
-
-// static
-QString QGpgME::DN::escape(const QString &value)
-{
- return dn_escape(value);
-}
-
-void QGpgME::DN::detach()
-{
- if (!d) {
- d = new QGpgME::DN::Private();
- d->ref();
- } else if (d->refCount() > 1) {
- QGpgME::DN::Private *d_save = d;
- d = new QGpgME::DN::Private(*d);
- d->ref();
- d_save->unref();
- }
-}
-
-void QGpgME::DN::append(const Attribute &attr)
-{
- detach();
- d->attributes.push_back(attr);
- d->reorderedAttributes.clear();
-}
-
-QString QGpgME::DN::operator[](const QString &attr) const
-{
- if (!d) {
- return QString();
- }
- const QString attrUpper = attr.toUpper();
- for (QVector<Attribute>::const_iterator it = d->attributes.constBegin();
- it != d->attributes.constEnd(); ++it)
- if ((*it).name() == attrUpper) {
- return (*it).value();
- }
- return QString();
-}
-
-static QVector<QGpgME::DN::Attribute> empty;
-
-QGpgME::DN::const_iterator QGpgME::DN::begin() const
-{
- return d ? d->attributes.constBegin() : empty.constBegin();
-}
-
-QGpgME::DN::const_iterator QGpgME::DN::end() const
-{
- return d ? d->attributes.constEnd() : empty.constEnd();
-}
-
-void QGpgME::DN::setAttributeOrder (const QStringList &order) const
-{
- d->order = order;
-}
-
-const QStringList & QGpgME::DN::attributeOrder () const
-{
- return d->order;
-}
diff --git a/lang/qt/src/dn.h b/lang/qt/src/dn.h
deleted file mode 100644
index 2d655c55..00000000
--- a/lang/qt/src/dn.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- dn.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-#ifndef QGPGME_DN_H
-#define QGPGME_DN_H
-
-#include "qgpgme_export.h"
-
-#include <QString>
-#include <QStringList>
-
-#include <QVector>
-
-namespace QGpgME
-{
-
-/**
- @short DN parser and reorderer
-*/
-class QGPGME_EXPORT DN
-{
-public:
- class Attribute;
- typedef QVector<Attribute> AttributeList;
- typedef AttributeList::const_iterator const_iterator;
-
- DN();
- explicit DN(const QString &dn);
- explicit DN(const char *utf8DN);
- DN(const DN &other);
- ~DN();
-
- const DN &operator=(const DN &other);
-
- /** @return the value in rfc-2253-escaped form */
- static QString escape(const QString &value);
-
- /** @return the DN in a reordered form, according to the settings in
- the [DN] group of the application's config file */
- QString prettyDN() const;
- /** @return the DN in the original form */
- QString dn() const;
- /**
- \overload
- Uses \a sep as separator (default: ,)
- */
- QString dn(const QString &sep) const;
-
- QString operator[](const QString &attr) const;
-
- void append(const Attribute &attr);
-
- const_iterator begin() const;
- const_iterator end() const;
-
- /** Set the order in which prettyDN will reorder the Attributes. */
- void setAttributeOrder(const QStringList &order) const;
-
- /** Get the used attribute order. */
- const QStringList & attributeOrder() const;
-
-private:
- void detach();
-private:
- class Private;
- Private *d;
-};
-
-class QGPGME_EXPORT DN::Attribute
-{
-public:
- typedef DN::AttributeList List;
-
- explicit Attribute(const QString &name = QString(), const QString &value = QString())
- : mName(name.toUpper()), mValue(value) {}
- Attribute(const Attribute &other)
- : mName(other.name()), mValue(other.value()) {}
-
- const Attribute &operator=(const Attribute &other)
- {
- if (this != &other) {
- mName = other.name();
- mValue = other.value();
- }
- return *this;
- }
-
- const QString &name() const
- {
- return mName;
- }
- const QString &value() const
- {
- return mValue;
- }
-
- void setValue(const QString &value)
- {
- mValue = value;
- }
-
-private:
- QString mName;
- QString mValue;
-};
-} // namespace QGpgME
-#endif // QGPGME_DN_H
diff --git a/lang/qt/src/downloadjob.h b/lang/qt/src/downloadjob.h
deleted file mode 100644
index dc1201ee..00000000
--- a/lang/qt/src/downloadjob.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- downloadjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_DOWNLOADJOB_H__
-#define __KLEO_DOWNLOADJOB_H__
-
-#include "job.h"
-
-#include <QtCore/QByteArray>
-#include <QtCore/QStringList>
-
-#include <memory>
-
-namespace GpgME
-{
-class Error;
-}
-
-class QIODevice;
-class QByteArray;
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous downloaders
-
- To use a DownloadJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the download with a call
- to start(). This call might fail, in which case the DownloadJob
- instance will have scheduled it's own destruction with a call to
- QObject::deleteLater().
-
- After result() is emitted, the DownloadJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT DownloadJob : public Job
-{
- Q_OBJECT
-protected:
- explicit DownloadJob(QObject *parent);
-public:
- ~DownloadJob();
-
- /**
- Starts the download operation. \a fingerprint is the
- fingerprint of the key to download. If \a fingerprint is empty,
- contains only whitespace or anything other than a fingerprint,
- the result is undefined.
-
- Output is written to \a keyData, if given. Otherwise, it is
- passed as the second argument of result().
- */
- virtual GpgME::Error start(const QByteArray &fingerprint,
- const std::shared_ptr<QIODevice> &keyData) = 0;
-
- /**
- Starts the download operation. \a fingerprints is a list of
- fingerprints used to specify the list of keys downloaded. Empty
- patterns are ignored. If \a fingerprints is empty, contains
- only empty strings or anything other than fingerprints, the
- result is undefined.
- */
- QGPGME_DEPRECATED virtual GpgME::Error start(const QStringList &fingerprints) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::Error &result, const QByteArray &keyData, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_DOWNLOADJOB_H__
diff --git a/lang/qt/src/encryptarchivejob.cpp b/lang/qt/src/encryptarchivejob.cpp
deleted file mode 100644
index f4cf288f..00000000
--- a/lang/qt/src/encryptarchivejob.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- encryptarchivejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "encryptarchivejob.h"
-#include "encryptarchivejob_p.h"
-
-#include <gpgme++/engineinfo.h>
-
-using namespace QGpgME;
-
-EncryptArchiveJob::EncryptArchiveJob(QObject *parent)
- : Job{parent}
-{
-}
-
-EncryptArchiveJob::~EncryptArchiveJob() = default;
-
-// static
-bool EncryptArchiveJob::isSupported()
-{
- static const auto gpgVersion = GpgME::engineInfo(GpgME::GpgEngine).engineVersion();
- return (gpgVersion >= "2.4.1") || (gpgVersion >= "2.2.42" && gpgVersion < "2.3.0");
-}
-
-void EncryptArchiveJob::setRecipients(const std::vector<GpgME::Key> &recipients)
-{
- auto d = jobPrivate<EncryptArchiveJobPrivate>(this);
- d->m_recipients = recipients;
-}
-
-std::vector<GpgME::Key> EncryptArchiveJob::recipients() const
-{
- auto d = jobPrivate<EncryptArchiveJobPrivate>(this);
- return d->m_recipients;
-}
-
-void EncryptArchiveJob::setInputPaths(const std::vector<QString> &paths)
-{
- auto d = jobPrivate<EncryptArchiveJobPrivate>(this);
- d->m_inputPaths = paths;
-}
-
-std::vector<QString> EncryptArchiveJob::inputPaths() const
-{
- auto d = jobPrivate<EncryptArchiveJobPrivate>(this);
- return d->m_inputPaths;
-}
-
-void EncryptArchiveJob::setOutputFile(const QString &path)
-{
- auto d = jobPrivate<EncryptArchiveJobPrivate>(this);
- d->m_outputFilePath = path;
-}
-
-QString EncryptArchiveJob::outputFile() const
-{
- auto d = jobPrivate<EncryptArchiveJobPrivate>(this);
- return d->m_outputFilePath;
-}
-
-void EncryptArchiveJob::setEncryptionFlags(GpgME::Context::EncryptionFlags flags)
-{
- auto d = jobPrivate<EncryptArchiveJobPrivate>(this);
- d->m_encryptionFlags = static_cast<GpgME::Context::EncryptionFlags>(flags | GpgME::Context::EncryptArchive);
-}
-
-GpgME::Context::EncryptionFlags EncryptArchiveJob::encryptionFlags() const
-{
- auto d = jobPrivate<EncryptArchiveJobPrivate>(this);
- return d->m_encryptionFlags;
-}
-
-void EncryptArchiveJob::setBaseDirectory(const QString &baseDirectory)
-{
- auto d = jobPrivate<EncryptArchiveJobPrivate>(this);
- d->m_baseDirectory = baseDirectory;
-}
-
-QString EncryptArchiveJob::baseDirectory() const
-{
- auto d = jobPrivate<EncryptArchiveJobPrivate>(this);
- return d->m_baseDirectory;
-}
-
-#include "encryptarchivejob.moc"
diff --git a/lang/qt/src/encryptarchivejob.h b/lang/qt/src/encryptarchivejob.h
deleted file mode 100644
index bba8acb6..00000000
--- a/lang/qt/src/encryptarchivejob.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- encryptarchivejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_ENCRYPTARCHIVEJOB_H__
-#define __QGPGME_ENCRYPTARCHIVEJOB_H__
-
-#include "job.h"
-
-#include <gpgme++/context.h>
-
-namespace GpgME
-{
-class Key;
-}
-
-namespace QGpgME
-{
-
-/**
- * Abstract base class for job for creating encrypted archives
- */
-class QGPGME_EXPORT EncryptArchiveJob : public Job
-{
- Q_OBJECT
-protected:
- explicit EncryptArchiveJob(QObject *parent);
-public:
- ~EncryptArchiveJob() override;
-
- static bool isSupported();
-
- /**
- * Sets the keys to use for encrypting the archive.
- *
- * Used if the job is started with startIt().
- */
- void setRecipients(const std::vector<GpgME::Key> &recipients);
- std::vector<GpgME::Key> recipients() const;
-
- /**
- * Sets the paths of the files and folders to put into the archive.
- *
- * If base directory is set, then the paths must be relative to the
- * base directory.
- *
- * Used if the job is started with startIt().
- */
- void setInputPaths(const std::vector<QString> &paths);
- std::vector<QString> inputPaths() const;
-
- /**
- * Sets the path of the file to write the created archive to.
- *
- * If \a path is a relative path and base directory is set, then the
- * path is interpreted relative to the base directory.
- *
- * Used if the job is started with startIt().
- *
- * \note If a file with this path exists, then the job will fail, i.e. you
- * need to delete an existing file that shall be overwritten before you
- * start the job.
- */
- void setOutputFile(const QString &path);
- QString outputFile() const;
-
- /**
- * Sets the flags to use for encryption. Defaults to \c EncryptArchive.
- * The \c EncryptArchive flag is always assumed set for this job.
- *
- * Used if the job is started with startIt().
- */
- void setEncryptionFlags(GpgME::Context::EncryptionFlags flags);
- GpgME::Context::EncryptionFlags encryptionFlags() const;
-
- /**
- * Sets the base directory for the relative paths of the input files and
- * the output file.
- */
- void setBaseDirectory(const QString &baseDirectory);
- QString baseDirectory() const;
-
- /**
- * Starts the creation of an encrypted archive.
- *
- * Encrypts the files and directories in \a paths into an archive for the
- * keys in \a recipients. If \a recipients is empty, then symmetric
- * encryption is performed. The encrypted archive is written to \a cipherText.
- *
- * Emits result() when the job has finished.
- */
- virtual GpgME::Error start(const std::vector<GpgME::Key> &recipients,
- const std::vector<QString> &paths,
- const std::shared_ptr<QIODevice> &cipherText,
- const GpgME::Context::EncryptionFlags flags) = 0;
-
-Q_SIGNALS:
- /**
- * This signal is emitted whenever gpgtar sends a progress status update for
- * the number of files. In the scanning phase (i.e. while gpgtar checks
- * which files to put into the archive), \a current is the current number of
- * files and \a total is 0. In the writing phase, \a current is the number
- * of processed files and \a total is the total number of files.
- */
- void fileProgress(int current, int total);
-
- /**
- * This signal is emitted whenever gpgtar sends a progress status update for
- * the amount of processed data. It is only emitted in the writing phase.
- * \a current is the processed amount data and \a total is the total amount
- * of data to process. Both values never exceed 2^20.
- */
- void dataProgress(int current, int total);
-
- void result(const GpgME::EncryptionResult &result,
- const QString &auditLogAsHtml = {},
- const GpgME::Error &auditLogError = {});
-};
-
-}
-
-#endif // __QGPGME_ENCRYPTARCHIVEJOB_H__
diff --git a/lang/qt/src/encryptarchivejob_p.h b/lang/qt/src/encryptarchivejob_p.h
deleted file mode 100644
index f2d5eea9..00000000
--- a/lang/qt/src/encryptarchivejob_p.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- encryptarchivejob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_ENCRYPTARCHIVEJOB_P_H__
-#define __QGPGME_ENCRYPTARCHIVEJOB_P_H__
-
-#include "job_p.h"
-
-namespace QGpgME
-{
-
-struct EncryptArchiveJobPrivate : public JobPrivate
-{
- std::vector<GpgME::Key> m_recipients;
- std::vector<QString> m_inputPaths;
- QString m_outputFilePath;
- QString m_baseDirectory;
- GpgME::Context::EncryptionFlags m_encryptionFlags = GpgME::Context::EncryptArchive;
-};
-
-}
-
-#endif // __QGPGME_ENCRYPTARCHIVEJOB_P_H__
diff --git a/lang/qt/src/encryptjob.cpp b/lang/qt/src/encryptjob.cpp
deleted file mode 100644
index d4337bad..00000000
--- a/lang/qt/src/encryptjob.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- encryptjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "encryptjob.h"
-#include "encryptjob_p.h"
-
-using namespace QGpgME;
-
-EncryptJob::EncryptJob(QObject *parent)
- : Job{parent}
-{
-}
-
-EncryptJob::~EncryptJob() = default;
-
-void EncryptJob::setFileName(const QString &fileName)
-{
- auto d = jobPrivate<EncryptJobPrivate>(this);
- d->m_fileName = fileName;
-}
-
-QString EncryptJob::fileName() const
-{
- auto d = jobPrivate<EncryptJobPrivate>(this);
- return d->m_fileName;
-}
-
-void EncryptJob::setInputEncoding(GpgME::Data::Encoding inputEncoding)
-{
- auto d = jobPrivate<EncryptJobPrivate>(this);
- d->m_inputEncoding = inputEncoding;
-}
-
-GpgME::Data::Encoding EncryptJob::inputEncoding() const
-{
- auto d = jobPrivate<EncryptJobPrivate>(this);
- return d->m_inputEncoding;
-}
-
-void EncryptJob::setRecipients(const std::vector<GpgME::Key> &recipients)
-{
- auto d = jobPrivate<EncryptJobPrivate>(this);
- d->m_recipients = recipients;
-}
-
-std::vector<GpgME::Key> EncryptJob::recipients() const
-{
- auto d = jobPrivate<EncryptJobPrivate>(this);
- return d->m_recipients;
-}
-
-void EncryptJob::setInputFile(const QString &path)
-{
- auto d = jobPrivate<EncryptJobPrivate>(this);
- d->m_inputFilePath = path;
-}
-
-QString EncryptJob::inputFile() const
-{
- auto d = jobPrivate<EncryptJobPrivate>(this);
- return d->m_inputFilePath;
-}
-
-void EncryptJob::setOutputFile(const QString &path)
-{
- auto d = jobPrivate<EncryptJobPrivate>(this);
- d->m_outputFilePath = path;
-}
-
-QString EncryptJob::outputFile() const
-{
- auto d = jobPrivate<EncryptJobPrivate>(this);
- return d->m_outputFilePath;
-}
-
-void EncryptJob::setEncryptionFlags(GpgME::Context::EncryptionFlags flags)
-{
- auto d = jobPrivate<EncryptJobPrivate>(this);
- d->m_encryptionFlags = static_cast<GpgME::Context::EncryptionFlags>(flags | GpgME::Context::EncryptFile);
-}
-
-GpgME::Context::EncryptionFlags EncryptJob::encryptionFlags() const
-{
- auto d = jobPrivate<EncryptJobPrivate>(this);
- return d->m_encryptionFlags;
-}
-
-#include "encryptjob.moc"
diff --git a/lang/qt/src/encryptjob.h b/lang/qt/src/encryptjob.h
deleted file mode 100644
index dde9d6e8..00000000
--- a/lang/qt/src/encryptjob.h
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- encryptjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004, 2007 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_ENCRYPTJOB_H__
-#define __KLEO_ENCRYPTJOB_H__
-
-#include "job.h"
-#include <gpgme++/data.h>
-
-#include <memory>
-#include <vector>
-
-#include <gpgme++/context.h>
-
-class QByteArray;
-class QIODevice;
-
-namespace GpgME
-{
-class Error;
-class Key;
-class EncryptionResult;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous encrypters
-
- To use a EncryptJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the encryption with a
- call to start(). This call might fail, in which case the
- EncryptJob instance will have scheduled it's own destruction with
- a call to QObject::deleteLater().
-
- Alternatively, the job can be started with startIt() after setting
- an input file and an output file and, optionally, recipients or flags.
- If the job is started this way then the backend reads the input and
- writes the output directly from/to the specified input file and output
- file. In this case the cipherText value of the result signal will always
- be empty. This direct IO mode is currently only supported for OpenPGP.
- Note that startIt() does not schedule the job's destruction if starting
- the job failed.
-
- After result() is emitted, the EncryptJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT EncryptJob : public Job
-{
- Q_OBJECT
-protected:
- explicit EncryptJob(QObject *parent);
-public:
- ~EncryptJob() override;
-
- /**
- * Sets the file name to embed in the encryption result.
- *
- * This is only used if one of the start() functions is used.
- */
- void setFileName(const QString &fileName);
- QString fileName() const;
-
- /**
- * Sets the encoding of the plaintext.
- *
- * This is only used if one of the start() functions is used.
- */
- void setInputEncoding(GpgME::Data::Encoding);
- GpgME::Data::Encoding inputEncoding() const;
-
- /**
- * Sets the keys to use for encryption.
- *
- * Used if the job is started with startIt().
- */
- void setRecipients(const std::vector<GpgME::Key> &recipients);
- std::vector<GpgME::Key> recipients() const;
-
- /**
- * Sets the path of the file to encrypt.
- *
- * Used if the job is started with startIt().
- */
- void setInputFile(const QString &path);
- QString inputFile() const;
-
- /**
- * Sets the path of the file to write the encryption result to.
- *
- * Used if the job is started with startIt().
- *
- * \note If a file with this path exists, then the job will fail, i.e. you
- * need to delete an existing file that shall be overwritten before you
- * start the job.
- */
- void setOutputFile(const QString &path);
- QString outputFile() const;
-
- /**
- * Sets the flags to use for encryption.
- *
- * Defaults to \c EncryptFile.
- *
- * Used if the job is started with startIt(). The \c EncryptFile flag is
- * always assumed set.
- */
- void setEncryptionFlags(GpgME::Context::EncryptionFlags flags);
- GpgME::Context::EncryptionFlags encryptionFlags() const;
-
- /**
- Starts the encryption operation. \a recipients is the a list of
- keys to encrypt \a plainText to. Empty (null) keys are
- ignored. If \a recipients is empty, performs symmetric
- (passphrase) encryption.
-
- If \a alwaysTrust is true, validity checking for the keys will
- not be performed, but full validity assumed for all keys
- without further checks.
- */
- virtual GpgME::Error start(const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText, bool alwaysTrust = false) = 0;
-
- /*!
- \overload
-
- If \a cipherText is non-null, the ciphertext is written
- there. Otherwise, it will be delivered in the second argument of
- result().
- */
- virtual void start(const std::vector<GpgME::Key> &recipients,
- const std::shared_ptr<QIODevice> &plainText,
- const std::shared_ptr<QIODevice> &cipherText = std::shared_ptr<QIODevice>(),
- bool alwaysTrust = false) = 0;
-
- virtual GpgME::EncryptionResult exec(const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText,
- bool alwaysTrust, QByteArray &cipherText) = 0;
- /*!
- This is a hack to request BASE64 output (instead of whatever
- comes out normally).
- */
- virtual void setOutputIsBase64Encoded(bool) = 0;
-
- /** Like start but with an additional argument for EncryptionFlags for
- * more flexibility. */
- virtual void start(const std::vector<GpgME::Key> &recipients,
- const std::shared_ptr<QIODevice> &plainText,
- const std::shared_ptr<QIODevice> &cipherText = std::shared_ptr<QIODevice>(),
- const GpgME::Context::EncryptionFlags flags = GpgME::Context::None) = 0;
-
- /** Like exec but with an additional argument for EncryptionFlags for
- * more flexibility. */
- virtual GpgME::EncryptionResult exec(const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText,
- const GpgME::Context::EncryptionFlags flags, QByteArray &cipherText) = 0;
-Q_SIGNALS:
- void result(const GpgME::EncryptionResult &result, const QByteArray &cipherText, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_ENCRYPTJOB_H__
diff --git a/lang/qt/src/encryptjob_p.h b/lang/qt/src/encryptjob_p.h
deleted file mode 100644
index 95126e13..00000000
--- a/lang/qt/src/encryptjob_p.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- encryptjob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_ENCRYPTJOB_P_H__
-#define __QGPGME_ENCRYPTJOB_P_H__
-
-#include "job_p.h"
-
-#include <gpgme++/data.h>
-#include <gpgme++/key.h>
-
-namespace QGpgME
-{
-
-struct EncryptJobPrivate : public JobPrivate
-{
- // used by start() functions
- QString m_fileName;
- GpgME::Data::Encoding m_inputEncoding;
-
- // used by startIt()
- std::vector<GpgME::Key> m_recipients;
- QString m_inputFilePath;
- QString m_outputFilePath;
- GpgME::Context::EncryptionFlags m_encryptionFlags = GpgME::Context::EncryptFile;
-};
-
-}
-
-#endif // __QGPGME_ENCRYPTJOB_P_H__
diff --git a/lang/qt/src/exportjob.h b/lang/qt/src/exportjob.h
deleted file mode 100644
index 91b5c90e..00000000
--- a/lang/qt/src/exportjob.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- exportjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_EXPORTJOB_H__
-#define __QGPGME_EXPORTJOB_H__
-
-#include "qgpgme_export.h"
-#include "job.h"
-
-#include <QtCore/QByteArray>
-#include <QtCore/QStringList>
-
-namespace GpgME
-{
-class Error;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous exporters
-
- To use a ExportJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the export with a call
- to start(). This call might fail, in which case the ExportJob
- instance will have scheduled it's own destruction with a call to
- QObject::deleteLater().
-
- After result() is emitted, the ExportJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT ExportJob : public Job
-{
- Q_OBJECT
-protected:
- explicit ExportJob(QObject *parent);
-public:
- ~ExportJob();
-
- /**
- Starts the export operation. \a patterns is a list of patterns
- used to restrict the list of keys exported. Empty patterns are
- ignored. If \a patterns is empty or contains only empty
- strings, all available keys are exported.
- */
- virtual GpgME::Error start(const QStringList &patterns) = 0;
-
- virtual void setExportFlags (unsigned int flags);
-
- /**
- * Starts the export operation synchronously, otherwise behaves identical to
- * ExportJob::start
- */
- virtual GpgME::Error exec(const QStringList &patterns, QByteArray &data);
-
-Q_SIGNALS:
- void result(const GpgME::Error &result, const QByteArray &keyData, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __QGPGME_EXPORTJOB_H__
diff --git a/lang/qt/src/filelistdataprovider.cpp b/lang/qt/src/filelistdataprovider.cpp
deleted file mode 100644
index 004854ef..00000000
--- a/lang/qt/src/filelistdataprovider.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- filelistdataprovider.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "filelistdataprovider.h"
-
-#include "dataprovider.h"
-
-#include <QString>
-
-#include <gpgme++/error.h>
-
-#include <numeric>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-static QByteArray encodeFilenames(const std::vector<QString> &filenames)
-{
- QByteArray ret;
- if (filenames.empty()) {
- return ret;
- }
- // calculate and reserve the needed minimum size of the result
- const auto addSize = [](unsigned int n, const QString &s) { return n + s.size(); };
- const unsigned int minSize = filenames.size()
- + std::accumulate(filenames.cbegin(), filenames.cend(), 0u, addSize);
- ret.reserve(minSize);
- // pack the filenames into the byte array
- for (const auto &f : filenames) {
- if (!f.isEmpty()) {
- ret += f.toUtf8() + '\0';
- }
- }
- ret.chop(1); // remove the trailing nul
- return ret;
-}
-
-FileListDataProvider::FileListDataProvider(const std::vector<QString> &filenames)
- : mProvider{new QByteArrayDataProvider{encodeFilenames(filenames)}}
-{
-}
-
-FileListDataProvider::~FileListDataProvider() = default;
-
-ssize_t FileListDataProvider::read(void* buffer, size_t bufSize)
-{
- return mProvider->read(buffer, bufSize);
-}
-
-ssize_t FileListDataProvider::write(const void *, size_t)
-{
- Error::setSystemError(GPG_ERR_EBADF);
- return -1;
-}
-
-off_t FileListDataProvider::seek(off_t offset, int whence)
-{
- return mProvider->seek(offset, whence);
-}
-
-void FileListDataProvider::release()
-{
- mProvider->release();
-}
diff --git a/lang/qt/src/filelistdataprovider.h b/lang/qt/src/filelistdataprovider.h
deleted file mode 100644
index 60bb0548..00000000
--- a/lang/qt/src/filelistdataprovider.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- filelistdataprovider.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_FILELISTDATAPROVIDER_H__
-#define __QGPGME_FILELISTDATAPROVIDER_H__
-
-#include "qgpgme_export.h"
-
-#include <gpgme++/interfaces/dataprovider.h>
-
-#include <memory>
-#include <vector>
-
-class QString;
-
-namespace QGpgME
-{
-
-/**
- * This read-only data provider simplifies providing a nul-separated list of
- * UTF-8-encoded filenames, e.g. for creating signed or encrypted archives.
- */
-class QGPGME_EXPORT FileListDataProvider : public GpgME::DataProvider
-{
-public:
- explicit FileListDataProvider(const std::vector<QString> &filenames);
- ~FileListDataProvider() override;
-
-private:
- bool isSupported(Operation op) const override
- {
- return op != Operation::Write;
- }
- ssize_t read(void *buffer, size_t bufSize) override;
- ssize_t write(const void *buffer, size_t bufSize) override;
- off_t seek(off_t offset, int whence) override;
- void release() override;
-
-private:
- std::unique_ptr<GpgME::DataProvider> mProvider;
-};
-
-}
-
-#endif // __QGPGME_FILELISTDATAPROVIDER_H__
diff --git a/lang/qt/src/gpgcardjob.h b/lang/qt/src/gpgcardjob.h
deleted file mode 100644
index 3f1b2391..00000000
--- a/lang/qt/src/gpgcardjob.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- gpgcardjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2020 g10 Code GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-#ifndef __KLEO_GPGCARDJOB_H__
-#define __KLEO_GPGCARDJOB_H__
-
-#include <QStringList>
-
-#include "job.h"
-
-namespace GpgME
-{
-class Error;
-}
-
-namespace QGpgME
-{
-
-class QGPGME_EXPORT GpgCardJob: public Job
-{
- Q_OBJECT
-protected:
- explicit GpgCardJob(QObject *parent);
-
-public:
- ~GpgCardJob();
-
- /**
- Starts the operation. \a cmds are the commands to
- execute.
- */
- virtual GpgME::Error start(const QStringList &cmds) = 0;
-
- virtual GpgME::Error exec(const QStringList &cmds, QString &std_out, QString &std_err, int &exitCode) = 0;
-
-Q_SIGNALS:
- /** The resulting stdout and stderr of gpgcard and the exitCode
- *
- * The auditlog params are always null / empty.
- */
- void result(const QString &std_out, const QString &std_err, int exitCode,
- const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-#endif
diff --git a/lang/qt/src/hierarchicalkeylistjob.h b/lang/qt/src/hierarchicalkeylistjob.h
deleted file mode 100644
index 431ff712..00000000
--- a/lang/qt/src/hierarchicalkeylistjob.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- hierarchicalkeylistjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_HIERARCHICALKEYLISTJOB_H__
-#define __KLEO_HIERARCHICALKEYLISTJOB_H__
-
-#include "qgpgme_export.h"
-#include "keylistjob.h"
-#include "cryptobackend.h"
-
-#include <gpgme++/keylistresult.h>
-
-#include <QPointer>
-
-#include <set>
-
-namespace GpgME
-{
-class Error;
-class Key;
-}
-
-namespace QGpgME
-{
-class KeyListJob;
-}
-
-namespace QGpgME
-{
-
-/**
- @short A convenience job that additionally fetches all available issuers.
-
- To use a HierarchicalKeyListJob, pass it a CryptoBackend
- implementation, connect the progress() and result() signals to
- suitable slots and then start the keylisting with a call to
- start(). This call might fail, in which case the
- HierarchicalKeyListJob instance will have scheduled it's own
- destruction with a call to QObject::deleteLater().
-
- After result() is emitted, the HierarchicalKeyListJob will
- schedule its own destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT HierarchicalKeyListJob : public KeyListJob
-{
- Q_OBJECT
-public:
- explicit HierarchicalKeyListJob(const Protocol *protocol,
- bool remote = false, bool includeSigs = false,
- bool validating = false);
- ~HierarchicalKeyListJob();
-
- /**
- Starts the keylist operation. \a patterns is a list of patterns
- used to restrict the list of keys returned. Empty patterns are
- ignored. \a patterns must not be empty or contain only empty
- patterns; use the normal KeyListJob for a full listing.
-
- The \a secretOnly parameter is ignored by
- HierarchicalKeyListJob and must be set to false.
- */
- GpgME::Error start(const QStringList &patterns, bool secretOnly = false) override;
-
- GpgME::KeyListResult exec(const QStringList &patterns, bool secretOnly,
- std::vector<GpgME::Key> &keys) override;
-
-private Q_SLOTS:
- void slotResult(const GpgME::KeyListResult &);
- void slotNextKey(const GpgME::Key &key);
- /* from Job */
- void slotCancel() override;
-
-private:
- GpgME::Error startAJob();
-
-private:
- const Protocol *const mProtocol;
- const bool mRemote;
- const bool mIncludeSigs;
- const bool mValidating;
- bool mTruncated;
- std::set<QString> mSentSet; // keys already sent (prevent duplicates even if the backend should return them)
- std::set<QString> mScheduledSet; // keys already scheduled (by starting a job for them)
- std::set<QString> mNextSet; // keys to schedule for the next iteraton
- GpgME::KeyListResult mIntermediateResult;
- QPointer<KeyListJob> mJob;
-};
-
-}
-
-#endif // __KLEO_HIERARCHICALKEYLISTJOB_H__
diff --git a/lang/qt/src/importfromkeyserverjob.h b/lang/qt/src/importfromkeyserverjob.h
deleted file mode 100644
index cc4a22da..00000000
--- a/lang/qt/src/importfromkeyserverjob.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- importfromkeyserverjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_IMPORTFROMKEYSERVERJOB_H__
-#define __KLEO_IMPORTFROMKEYSERVERJOB_H__
-
-#include "abstractimportjob.h"
-#include "qgpgme_export.h"
-
-namespace GpgME
-{
-class Key;
-class Error;
-class ImportResult;
-}
-
-#include <vector>
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous keyserver-importers
-
- To use a ImportJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the import with a call
- to start(). This call might fail, in which case the ImportJob
- instance will have scheduled it's own destruction with a call to
- QObject::deleteLater().
-
- After result() is emitted, the ImportJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT ImportFromKeyserverJob : public AbstractImportJob
-{
- Q_OBJECT
-protected:
- explicit ImportFromKeyserverJob(QObject *parent);
-public:
- ~ImportFromKeyserverJob();
-
- /**
- Starts the importing operation. \a keyData contains the data to
- import from.
- */
- virtual GpgME::Error start(const std::vector<GpgME::Key> &keys) = 0;
-
- virtual GpgME::ImportResult exec(const std::vector<GpgME::Key> &keys) = 0;
-};
-
-}
-
-#endif // __KLEO_IMPORTFROMKEYSERVERJOB_H__
diff --git a/lang/qt/src/importjob.cpp b/lang/qt/src/importjob.cpp
deleted file mode 100644
index f0ec63ca..00000000
--- a/lang/qt/src/importjob.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- importjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "importjob.h"
-#include "importjob_p.h"
-
-#include <gpgme++/context.h>
-
-using namespace GpgME;
-using namespace QGpgME;
-
-void QGpgME::ImportJob::setImportFilter(const QString &filter)
-{
- const auto d = jobPrivate<ImportJobPrivate>(this);
- d->m_importFilter = filter;
-}
-
-QString QGpgME::ImportJob::importFilter() const
-{
- const auto d = jobPrivate<ImportJobPrivate>(this);
- return d->m_importFilter;
-}
-
-void QGpgME::ImportJob::setImportOptions(const QStringList &options)
-{
- const auto d = jobPrivate<ImportJobPrivate>(this);
- d->m_importOptions = options;
-}
-
-QStringList QGpgME::ImportJob::importOptions() const
-{
- const auto d = jobPrivate<ImportJobPrivate>(this);
- return d->m_importOptions;
-}
-
-void ImportJob::setKeyOrigin(GpgME::Key::Origin origin, const QString &url)
-{
- const auto d = jobPrivate<ImportJobPrivate>(this);
- d->m_keyOrigin = origin;
- d->m_keyOriginUrl = url;
-}
-
-GpgME::Key::Origin ImportJob::keyOrigin() const
-{
- const auto d = jobPrivate<ImportJobPrivate>(this);
- return d->m_keyOrigin;
-}
-
-QString ImportJob::keyOriginUrl() const
-{
- const auto d = jobPrivate<ImportJobPrivate>(this);
- return d->m_keyOriginUrl;
-}
diff --git a/lang/qt/src/importjob.h b/lang/qt/src/importjob.h
deleted file mode 100644
index e92f7415..00000000
--- a/lang/qt/src/importjob.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- importjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_IMPORTJOB_H__
-#define __KLEO_IMPORTJOB_H__
-
-#include "abstractimportjob.h"
-#include "qgpgme_export.h"
-
-#include <gpgme++/key.h>
-
-namespace GpgME
-{
-class Error;
-class ImportResult;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous importers
-
- To use a ImportJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the import with a call
- to start(). This call might fail, in which case the ImportJob
- instance will have scheduled it's own destruction with a call to
- QObject::deleteLater().
-
- After result() is emitted, the ImportJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT ImportJob : public AbstractImportJob
-{
- Q_OBJECT
-protected:
- explicit ImportJob(QObject *parent);
-public:
- ~ImportJob() override;
-
- void setImportFilter(const QString &filter);
- QString importFilter() const;
-
- void setImportOptions(const QStringList &options);
- QStringList importOptions() const;
-
- void setKeyOrigin(GpgME::Key::Origin origin, const QString &url = {});
- GpgME::Key::Origin keyOrigin() const;
- QString keyOriginUrl() const;
-
- /**
- Starts the importing operation. \a keyData contains the data to
- import from.
- */
- virtual GpgME::Error start(const QByteArray &keyData) = 0;
-
- virtual GpgME::ImportResult exec(const QByteArray &keyData) = 0;
-
- virtual GpgME::Error startLater(const QByteArray &keyData) = 0;
-};
-
-}
-
-#endif // __KLEO_IMPORTJOB_H__
diff --git a/lang/qt/src/importjob_p.h b/lang/qt/src/importjob_p.h
deleted file mode 100644
index 7ee8f914..00000000
--- a/lang/qt/src/importjob_p.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- importjob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_IMPORTJOB_P_H__
-#define __QGPGME_IMPORTJOB_P_H__
-
-#include "job_p.h"
-
-#include <gpgme++/key.h>
-
-namespace QGpgME
-{
-
-struct ImportJobPrivate : public JobPrivate
-{
- QString m_importFilter;
- QStringList m_importOptions;
- GpgME::Key::Origin m_keyOrigin = GpgME::Key::OriginUnknown;
- QString m_keyOriginUrl;
-};
-
-}
-
-#endif // __QGPGME_IMPORTJOB_P_H__
diff --git a/lang/qt/src/job.cpp b/lang/qt/src/job.cpp
deleted file mode 100644
index bbbca293..00000000
--- a/lang/qt/src/job.cpp
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- job.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2005 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2021 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "job.h"
-#include "job_p.h"
-
-#include "keylistjob.h"
-#include "listallkeysjob.h"
-#include "decryptjob.h"
-#include "signkeyjob.h"
-#include "keygenerationjob.h"
-#include "importjob.h"
-#include "importfromkeyserverjob.h"
-#include "exportjob.h"
-#include "changeexpiryjob.h"
-#include "changeownertrustjob.h"
-#include "changepasswdjob.h"
-#include "downloadjob.h"
-#include "deletejob.h"
-#include "refreshkeysjob.h"
-#include "addexistingsubkeyjob.h"
-#include "adduseridjob.h"
-#include "specialjob.h"
-#include "keyformailboxjob.h"
-#include "wkdlookupjob.h"
-#include "wkspublishjob.h"
-#include "tofupolicyjob.h"
-#include "threadedjobmixin.h"
-#include "gpgcardjob.h"
-#include "receivekeysjob.h"
-#include "revokekeyjob.h"
-#include "setprimaryuseridjob.h"
-
-#include <QCoreApplication>
-#include <QDebug>
-
-#include <gpg-error.h>
-
-#include <unordered_map>
-
-namespace
-{
-typedef std::unordered_map<const QGpgME::Job*, std::unique_ptr<QGpgME::JobPrivate>> JobPrivateHash;
-Q_GLOBAL_STATIC(JobPrivateHash, d_func)
-}
-
-void QGpgME::setJobPrivate(const Job *job, std::unique_ptr<JobPrivate> d)
-{
- auto &ref = d_func()->operator[](job);
- ref = std::move(d);
-}
-
-const QGpgME::JobPrivate *QGpgME::getJobPrivate(const Job *job)
-{
- return d_func()->operator[](job).get();
-}
-
-QGpgME::JobPrivate *QGpgME::getJobPrivate(Job *job)
-{
- return d_func()->operator[](job).get();
-}
-
-QGpgME::Job::Job(QObject *parent)
- : QObject(parent)
-{
- if (QCoreApplication *app = QCoreApplication::instance()) {
- connect(app, &QCoreApplication::aboutToQuit, this, &Job::slotCancel);
- }
-}
-
-QGpgME::Job::~Job()
-{
- ::d_func()->erase(this);
-}
-
-QString QGpgME::Job::auditLogAsHtml() const
-{
- qDebug() << "QGpgME::Job::auditLogAsHtml() should be reimplemented in Kleo::Job subclasses!";
- return QString();
-}
-
-GpgME::Error QGpgME::Job::auditLogError() const
-{
- qDebug() << "QGpgME::Job::auditLogError() should be reimplemented in Kleo::Job subclasses!";
- return GpgME::Error::fromCode(GPG_ERR_NOT_IMPLEMENTED);
-}
-
-bool QGpgME::Job::isAuditLogSupported() const
-{
- return auditLogError().code() != GPG_ERR_NOT_IMPLEMENTED;
-}
-
-QMap <QGpgME::Job *, GpgME::Context *> QGpgME::g_context_map;
-
-/* static */
-GpgME::Context *QGpgME::Job::context(QGpgME::Job *job)
-{
- return QGpgME::g_context_map.value (job, nullptr);
-}
-
-GpgME::Error QGpgME::Job::startIt()
-{
- auto d = getJobPrivate(this);
- Q_ASSERT(d && "This Job class has no JobPrivate class");
- return d->startIt();
-}
-
-void QGpgME::Job::startNow()
-{
- auto d = getJobPrivate(this);
- Q_ASSERT(d && "This Job class has no JobPrivate class");
- d->startNow();
-}
-
-#define make_job_subclass_ext(x,y) \
- QGpgME::x::x( QObject * parent ) : y( parent ) {} \
- QGpgME::x::~x() {}
-
-#define make_job_subclass(x) make_job_subclass_ext(x,Job)
-
-make_job_subclass(KeyListJob)
-make_job_subclass(ListAllKeysJob)
-make_job_subclass(DecryptJob)
-make_job_subclass(SignKeyJob)
-make_job_subclass(KeyGenerationJob)
-make_job_subclass(AbstractImportJob)
-make_job_subclass_ext(ImportJob, AbstractImportJob)
-make_job_subclass_ext(ImportFromKeyserverJob, AbstractImportJob)
-make_job_subclass_ext(ReceiveKeysJob, AbstractImportJob)
-make_job_subclass(ExportJob)
-make_job_subclass(ChangeExpiryJob)
-make_job_subclass(ChangeOwnerTrustJob)
-make_job_subclass(ChangePasswdJob)
-make_job_subclass(DownloadJob)
-make_job_subclass(DeleteJob)
-make_job_subclass(RefreshKeysJob)
-make_job_subclass(AddExistingSubkeyJob)
-make_job_subclass(AddUserIDJob)
-make_job_subclass(SpecialJob)
-make_job_subclass(KeyForMailboxJob)
-make_job_subclass(WKDLookupJob)
-make_job_subclass(WKSPublishJob)
-make_job_subclass(TofuPolicyJob)
-make_job_subclass(GpgCardJob)
-make_job_subclass(RevokeKeyJob)
-make_job_subclass(SetPrimaryUserIDJob)
-
-#undef make_job_subclass
-
-#include "job.moc"
-
-#include "keylistjob.moc"
-#include "listallkeysjob.moc"
-#include "decryptjob.moc"
-#include "signkeyjob.moc"
-#include "keygenerationjob.moc"
-#include "abstractimportjob.moc"
-#include "importjob.moc"
-#include "importfromkeyserverjob.moc"
-#include "exportjob.moc"
-#include "changeexpiryjob.moc"
-#include "changeownertrustjob.moc"
-#include "changepasswdjob.moc"
-#include "downloadjob.moc"
-#include "deletejob.moc"
-#include "refreshkeysjob.moc"
-#include "addexistingsubkeyjob.moc"
-#include "adduseridjob.moc"
-#include "specialjob.moc"
-#include "keyformailboxjob.moc"
-#include "wkdlookupjob.moc"
-#include "wkspublishjob.moc"
-#include "tofupolicyjob.moc"
-#include "gpgcardjob.moc"
-#include "receivekeysjob.moc"
-#include "revokekeyjob.moc"
-#include "setprimaryuseridjob.moc"
diff --git a/lang/qt/src/job.h b/lang/qt/src/job.h
deleted file mode 100644
index 56da33d7..00000000
--- a/lang/qt/src/job.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- job.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_JOB_H__
-#define __KLEO_JOB_H__
-
-#include "qgpgme_export.h"
-
-#include <QObject>
-#include <QString>
-#include <QMap>
-
-#include <gpgme++/error.h>
-
-class QWidget;
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous crypto operations
-
- During the operation, you might receive progress updates through
- the progress() signal as they arrive, but an implementation is
- free to not send progress information. You should show a busy
- progressbar until the first progress() signal is received.
-
- The done() signal is emitted _before_ the result() signals of
- subclasses and should be used to hide and/or reset progress bars,
- not to learn of the end of the operation. Use the result()
- signals for that.
-
- To cancel the operation, simply call slotCancel(). The result()
- signal of subclasses will still be emitted, though, and will
- carry the information that the operation was canceled.
-*/
-class QGPGME_EXPORT Job : public QObject
-{
- Q_OBJECT
-protected:
- explicit Job(QObject *parent);
-public:
- ~Job();
-
- virtual QString auditLogAsHtml() const;
- virtual GpgME::Error auditLogError() const;
- bool isAuditLogSupported() const;
-
- /** Get the underlying context to set some additional options for a job.
- *
- * This is intended to provide more flexibility on configuring jobs before
- * they are started.
- * The context is still owned by the thread, do not delete it.
- *
- * This is a static method that takes the job as argument.
- *
- * This function may not be called for running jobs.
- *
- * @returns the context used by the job job or null.
- */
- static GpgME::Context *context(Job *job);
-
- /** Starts the job.
- *
- * Starts the job with the values set for the concrete job. If starting
- * the job failed then you are responsible for destroying it. Therefore,
- * it's recommended to store the job in a std::unique_ptr until it has
- * been started successfully.
- */
- GpgME::Error startIt();
-
- /** Starts a deferred job.
- *
- * The job needs to have been prepared for a deferred start by calling the
- * startLater() function instead of the start() function of a leaf class.
- */
- void startNow();
-
-public Q_SLOTS:
- virtual void slotCancel() = 0;
-
-Q_SIGNALS:
- /**
- * This signal is emitted whenever the backend sends a progress status
- * message. For most jobs, \a current is the amount of processed data
- * (or files) and \a total is the total amount of data (of files). If
- * \a total is 0, then the total amount is unknown or not yet known.
- * For GnuPG 2.1.13 and later, \a current and \a total do not exceed
- * 2^20, i.e. for larger values they are scaled down and you should not
- * assume that they represent absolute values.
- *
- * Check the documentation on progress in the GpgME manual for details.
- *
- * Note: Some jobs provide special progress signals, e.g. for file-count-
- * or data-based progress.
- */
- void jobProgress(int current, int total);
-
- /**
- * This signal is emitted whenever the backend sends a progress status
- * message. Compared to the jobProgress signal this signal also provides the
- * what value and the type value reported by the backend. Usually, these
- * values can safely be ignored, so that you are better off using the
- * simpler jobProgress signal.
- * Check the documentation on progress in the GpgME manual for details
- * on what and type.
- *
- * Note: Some jobs provide special progress signals, so that you do not
- * have to deal with what and type yourself.
- */
- void rawProgress(const QString &what, int type, int current, int total);
-
- QGPGME_DEPRECATED void progress(const QString &what, int current, int total);
-
- void done();
-};
-
-extern QMap <Job *, GpgME::Context *> g_context_map;
-}
-
-#endif // __KLEO_JOB_H__
diff --git a/lang/qt/src/job_p.h b/lang/qt/src/job_p.h
deleted file mode 100644
index 597b1a17..00000000
--- a/lang/qt/src/job_p.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- job_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_JOB_P_H__
-#define __QGPGME_JOB_P_H__
-
-#include "job.h"
-
-#include "qgpgme_debug.h"
-
-#include <memory>
-
-namespace QGpgME
-{
-
-// Base class for pimpl classes for Job subclasses
-class JobPrivate
-{
-public:
- virtual ~JobPrivate() {}
-
- virtual GpgME::Error startIt() = 0;
-
- virtual void startNow() = 0;
-};
-
-// Setter and getters for the externally stored pimpl instances of jobs
-// BCI: Add a real d-pointer to Job
-void setJobPrivate(const Job *job, std::unique_ptr<JobPrivate> d);
-
-const JobPrivate *getJobPrivate(const Job *job);
-
-JobPrivate *getJobPrivate(Job *job);
-
-template <typename T>
-static const T *jobPrivate(const Job *job) {
- auto d = getJobPrivate(job);
- return dynamic_cast<const T *>(d);
-}
-
-template <typename T>
-static T *jobPrivate(Job *job) {
- auto d = getJobPrivate(job);
- return dynamic_cast<T *>(d);
-}
-
-// Helper for the archive job classes
-template<class JobClass>
-void emitArchiveProgressSignals(JobClass *job, const QString &what, int type, int current, int total)
-{
- if (what != QLatin1String{"gpgtar"}) {
- return;
- }
- switch (type) {
- case 'c':
- Q_EMIT job->fileProgress(current, total);
- break;
- case 's':
- Q_EMIT job->dataProgress(current, total);
- break;
- default:
- qCDebug(QGPGME_LOG) << job << __func__ << "Received progress for gpgtar with unknown type" << char(type);
- };
-}
-
-}
-
-#endif // __QGPGME_JOB_P_H__
diff --git a/lang/qt/src/keyformailboxjob.h b/lang/qt/src/keyformailboxjob.h
deleted file mode 100644
index 33027c0c..00000000
--- a/lang/qt/src/keyformailboxjob.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- keyformailboxjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-#ifndef __KLEO_KEYFORMAILBOX_H__
-#define __KLEO_KEYFORMAILBOX_H__
-
-#include <QString>
-
-#include "job.h"
-
-#include <gpgme++/key.h>
-
-namespace GpgME
-{
-class Error;
-class KeyListResult;
-}
-
-namespace QGpgME
-{
-
-/**
- @short Get the best key to use for a Mailbox
-
- To use the keyformailboxjob, first obtain an instance from the
- CryptoBackend and either exec it or start and
- connect the result() signal to a suitable slot.
-
- The best key is defined as the key with a UID that has an
- E-Mail that matches the mailbox provided. If multiple
- keys are found the one with the highest validity is returned.
-
- After result() is emitted, the job will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT KeyForMailboxJob: public Job
-{
- Q_OBJECT
-protected:
- explicit KeyForMailboxJob(QObject *parent);
-
-public:
- ~KeyForMailboxJob();
-
- /**
- Starts the operation. \a mailbox is the mailbox to
- look for.
-
- The result is the same as for the LocateKeysJob.
-
- If \a canEncrypt is true, only keys that have a subkey for encryption
- usage are returned. Use this if you need to select a
- key for signing.
- */
- virtual GpgME::Error start(const QString &mailbox, bool canEncrypt = true) = 0;
-
- virtual GpgME::KeyListResult exec(const QString &mailbox, bool canEncrypt, GpgME::Key &key, GpgME::UserID &uid) = 0;
-
-Q_SIGNALS:
- /** The result. \a Key is the key found or a Null key.
- *
- * The userid is the uid where the mailbox matches.
- *
- * The auditlog params are always null / empty.
- */
- void result(const GpgME::KeyListResult &result, const GpgME::Key &key, const GpgME::UserID &uid, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-#endif
diff --git a/lang/qt/src/keygenerationjob.h b/lang/qt/src/keygenerationjob.h
deleted file mode 100644
index 04b97d9f..00000000
--- a/lang/qt/src/keygenerationjob.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- keygenerationjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_KEYGENERATIONJOB_H__
-#define __KLEO_KEYGENERATIONJOB_H__
-
-#include "job.h"
-#include "qgpgme_export.h"
-
-#include <QtCore/QByteArray>
-
-namespace GpgME
-{
-class Error;
-class KeyGenerationResult;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous key generation
-
- To use a KeyGenerationJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the key generation with
- a call to start(). This call might fail, in which case the
- KeyGenerationJob instance will have scheduled it's own
- destruction with a call to QObject::deleteLater().
-
- After result() is emitted, the KeyGenerationJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT KeyGenerationJob : public Job
-{
- Q_OBJECT
-protected:
- explicit KeyGenerationJob(QObject *parent);
-public:
- ~KeyGenerationJob();
-
- /**
- Starts the key generation operation. \a parameters is a
- backend-specific string containing the parameters of the key to
- create (length, capabilities, etc).
- */
- virtual GpgME::Error start(const QString &parameters) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::KeyGenerationResult &result, const QByteArray &pubKeyData, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_KEYGENERATIONJOB_H__
diff --git a/lang/qt/src/keylistjob.h b/lang/qt/src/keylistjob.h
deleted file mode 100644
index 7a4bd712..00000000
--- a/lang/qt/src/keylistjob.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- keylistjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_KEYLISTJOB_H__
-#define __KLEO_KEYLISTJOB_H__
-
-#include "job.h"
-#include "qgpgme_export.h"
-
-#include <gpgme++/key.h>
-
-#include <QtCore/QStringList>
-
-#include <vector>
-
-namespace GpgME
-{
-class Error;
-class KeyListResult;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous key listers
-
- To use a KeyListJob, first obtain an instance from the
- CryptoBackend implementation, connect the nextKey(), progress()
- and result() signals to suitable slots and then start the key
- listing with a call to start(). This call might fail, in which
- case the KeylistJob instance will have scheduled it's own
- destruction with a call to QObject::deleteLater().
-
- During keylisting, you will receive new key objects through the
- nextKey() signal as they arrive. After result() is emitted, the
- KeyListJob will schedule it's own destruction by calling
- QObject::deleteLater().
-*/
-class QGPGME_EXPORT KeyListJob : public Job
-{
- Q_OBJECT
-protected:
- explicit KeyListJob(QObject *parent);
-
-public:
- ~KeyListJob();
-
- /**
- Starts the keylist operation. \a pattern is a list of patterns
- used to restrict the list of keys returned. Empty patterns are
- ignored. If \a pattern is empty or contains only empty strings,
- all keys are returned (however, the backend is free to truncate
- the result and should do so; when this happens, it will be
- reported by the reult object).
-
- If \a secretOnly is true, only keys for which the secret key is
- also available are returned. Use this if you need to select a
- key for signing.
- */
- virtual GpgME::Error start(const QStringList &patterns, bool secretOnly = false) = 0;
-
- virtual GpgME::KeyListResult exec(const QStringList &patterns, bool secretOnly, std::vector<GpgME::Key> &keys) = 0;
-
- /** Add a flag to the keylistmode used. */
- virtual void addMode(GpgME::KeyListMode mode) = 0;
-
-Q_SIGNALS:
- void nextKey(const GpgME::Key &key);
- void result(const GpgME::KeyListResult &result, const std::vector<GpgME::Key> &keys = std::vector<GpgME::Key>(), const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_KEYLISTJOB_H__
diff --git a/lang/qt/src/listallkeysjob.cpp b/lang/qt/src/listallkeysjob.cpp
deleted file mode 100644
index 1dce75bf..00000000
--- a/lang/qt/src/listallkeysjob.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- listallkeysjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "listallkeysjob.h"
-#include "listallkeysjob_p.h"
-
-using namespace QGpgME;
-
-void ListAllKeysJob::setOptions(ListAllKeysJob::Options options)
-{
- auto d = jobPrivate<ListAllKeysJobPrivate>(this);
- d->m_options = options;
-}
-
-ListAllKeysJob::Options ListAllKeysJob::options() const
-{
- auto d = jobPrivate<ListAllKeysJobPrivate>(this);
- return d->m_options;
-}
diff --git a/lang/qt/src/listallkeysjob.h b/lang/qt/src/listallkeysjob.h
deleted file mode 100644
index fa2f53a9..00000000
--- a/lang/qt/src/listallkeysjob.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- listallkeysjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_LISTALLKEYSJOB_H__
-#define __KLEO_LISTALLKEYSJOB_H__
-
-#include "job.h"
-#include "qgpgme_export.h"
-
-#include <gpgme++/key.h>
-
-#include <vector>
-
-namespace GpgME
-{
-class Error;
-class KeyListResult;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronously listing all keys
-
- To use a ListAllKeysJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress()
- and result() signals to suitable slots and then start the key
- listing with a call to start(). This call might fail, in which
- case the ListAllKeysJob instance will have schedules it's own
- destruction with a call to QObject::deleteLater().
-
- After result() is emitted, the ListAllKeysJob will schedule it's
- own destruction by calling QObject::deleteLater().
-
- This is potentially much faster than a KeyListJob with empty
- pattern.
-*/
-class QGPGME_EXPORT ListAllKeysJob : public Job
-{
- Q_OBJECT
-public:
- enum Option {
- Default = 0x00,
- DisableAutomaticTrustDatabaseCheck = 0x01,
- };
- Q_DECLARE_FLAGS(Options, Option)
-
-protected:
- explicit ListAllKeysJob(QObject *parent);
-
-public:
- ~ListAllKeysJob();
-
- void setOptions(Options options);
- Options options() const;
-
- /**
- Starts the listallkeys operation. In general, all keys are
- returned (however, the backend is free to truncate the result
- and should do so; when this happens, it will be reported by the
- result object).
-
- If GnuPG 2.1 or later is used, then \a mergeKeys is ignored. Otherwise,
- if \a mergeKeys is true, then some (but not all) information of the
- secret keys is merged into public keys.
- */
- virtual GpgME::Error start(bool mergeKeys = false) = 0;
-
- /**
- Synchronous version of start().
- */
- virtual GpgME::KeyListResult exec(std::vector<GpgME::Key> &pub, std::vector<GpgME::Key> &sec, bool mergeKeys = false) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::KeyListResult &result, const std::vector<GpgME::Key> &pub = std::vector<GpgME::Key>(), const std::vector<GpgME::Key> &sec = std::vector<GpgME::Key>(), const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(ListAllKeysJob::Options)
-
-}
-
-#endif // __KLEO_LISTALLKEYSJOB_H__
diff --git a/lang/qt/src/listallkeysjob_p.h b/lang/qt/src/listallkeysjob_p.h
deleted file mode 100644
index 582f028b..00000000
--- a/lang/qt/src/listallkeysjob_p.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- listallkeysjob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_LISTALLKEYSJOB_P_H__
-#define __QGPGME_LISTALLKEYSJOB_P_H__
-
-#include "job_p.h"
-
-#include "listallkeysjob.h"
-
-namespace QGpgME
-{
-
-struct ListAllKeysJobPrivate : public JobPrivate
-{
- ListAllKeysJob::Options m_options = ListAllKeysJob::Default;
-};
-
-}
-
-#endif // __QGPGME_LISTALLKEYSJOB_P_H__
diff --git a/lang/qt/src/multideletejob.cpp b/lang/qt/src/multideletejob.cpp
deleted file mode 100644
index 1c1e15d0..00000000
--- a/lang/qt/src/multideletejob.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- multideletejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "multideletejob.h"
-#include "protocol.h"
-#include "deletejob.h"
-
-#include <gpgme++/key.h>
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-
-#include <iterator>
-
-#include <assert.h>
-
-QGpgME::MultiDeleteJob::MultiDeleteJob(const Protocol *protocol)
- : Job(nullptr),
- mProtocol(protocol),
- mJob(nullptr)
-{
- assert(protocol);
-}
-
-QGpgME::MultiDeleteJob::~MultiDeleteJob()
-{
-
-}
-
-GpgME::Error QGpgME::MultiDeleteJob::start(const std::vector<GpgME::Key> &keys, bool allowSecretKeyDeletion)
-{
- mKeys = keys;
- mAllowSecretKeyDeletion = allowSecretKeyDeletion;
- mIt = mKeys.begin();
-
- const GpgME::Error err = startAJob();
-
- if (err) {
- deleteLater();
- }
- return err;
-}
-
-void QGpgME::MultiDeleteJob::slotCancel()
-{
- if (mJob) {
- mJob->slotCancel();
- }
- mIt = mKeys.end();
-}
-
-void QGpgME::MultiDeleteJob::slotResult(const GpgME::Error &err)
-{
- mJob = nullptr;
- GpgME::Error error = err;
- if (error || // error in last op
- mIt == mKeys.end() || // (shouldn't happen)
- ++mIt == mKeys.end() || // was the last key
- (error = startAJob())) { // error starting the job for the new key
- Q_EMIT done();
- Q_EMIT result(error, error && mIt != mKeys.end() ? *mIt : GpgME::Key::null);
- deleteLater();
- return;
- }
-
- const int current = mIt - mKeys.begin();
- const int total = mKeys.size();
- const QString what = QStringLiteral("%1/%2").arg(current).arg(total);
- Q_EMIT jobProgress(current, total);
- Q_EMIT rawProgress(what, '?', current, total);
- QT_WARNING_PUSH
- QT_WARNING_DISABLE_DEPRECATED
- Q_EMIT progress(what, current, total);
- QT_WARNING_POP
-}
-
-GpgME::Error QGpgME::MultiDeleteJob::startAJob()
-{
- if (mIt == mKeys.end()) {
- return GpgME::Error(0);
- }
- mJob = mProtocol->deleteJob();
- assert(mJob); // FIXME: we need a way to generate errors ourselves,
- // but I don't like the dependency on gpg-error :/
-
- connect(mJob.data(), &DeleteJob::result, this, &MultiDeleteJob::slotResult);
-
- return mJob->start(*mIt, mAllowSecretKeyDeletion);
-}
-
-#include "multideletejob.moc"
diff --git a/lang/qt/src/multideletejob.h b/lang/qt/src/multideletejob.h
deleted file mode 100644
index 308490fa..00000000
--- a/lang/qt/src/multideletejob.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- multideletejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_MULTIDELETEJOB_H__
-#define __KLEO_MULTIDELETEJOB_H__
-
-#include "qgpgme_export.h"
-#include "job.h"
-#include "protocol.h"
-
-#include <QPointer>
-
-#include <vector>
-
-namespace GpgME
-{
-class Error;
-class Key;
-}
-
-namespace QGpgME
-{
-class DeleteJob;
-}
-
-namespace QGpgME
-{
-
-/**
- @short A convenience class bundling together multiple DeleteJobs.
-
- To use a MultiDeleteJob, pass it a CryptoBackend implementation,
- connect the progress() and result() signals to suitable slots and
- then start the delete with a call to start(). This call might
- fail, in which case the MultiDeleteJob instance will have scheduled
- it's own destruction with a call to QObject::deleteLater().
-
- After result() is emitted, the MultiDeleteJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT MultiDeleteJob : public Job
-{
- Q_OBJECT
-public:
- explicit MultiDeleteJob(const Protocol *protocol);
- ~MultiDeleteJob();
-
- /**
- Starts the delete operation. \a keys is the list of keys to
- delete, \a allowSecretKeyDeletion specifies if a key may also
- be deleted if the secret key part is available, too.
- */
- GpgME::Error start(const std::vector<GpgME::Key> &keys, bool allowSecretKeyDeletion = false);
-
- /* from Job */
- void slotCancel() override;
-
-Q_SIGNALS:
- void result(const GpgME::Error &result, const GpgME::Key &errorKey);
-
-private Q_SLOTS:
- void slotResult(const GpgME::Error &);
-
-private:
- GpgME::Error startAJob();
-
-private:
- const Protocol *mProtocol;
- QPointer<DeleteJob> mJob;
- std::vector<GpgME::Key> mKeys;
- std::vector<GpgME::Key>::const_iterator mIt;
- bool mAllowSecretKeyDeletion;
-};
-
-}
-
-#endif // __KLEO_MULTIDELETEJOB_H__
diff --git a/lang/qt/src/protocol.h b/lang/qt/src/protocol.h
deleted file mode 100644
index 74fb921d..00000000
--- a/lang/qt/src/protocol.h
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- protocol.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2005 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-#ifndef __QGPGME_PROTOCOL_H__
-#define __QGPGME_PROTOCOL_H__
-
-#include <QString>
-#include <QVariant>
-
-#include "qgpgme_export.h"
-
-namespace QGpgME {
-class AddExistingSubkeyJob;
-class CryptoConfig;
-class KeyListJob;
-class ListAllKeysJob;
-class KeyGenerationJob;
-class ImportJob;
-class ImportFromKeyserverJob;
-class ExportJob;
-class DownloadJob;
-class DeleteJob;
-class EncryptArchiveJob;
-class EncryptJob;
-class DecryptJob;
-class SignArchiveJob;
-class SignEncryptArchiveJob;
-class SignJob;
-class SignKeyJob;
-class VerifyDetachedJob;
-class VerifyOpaqueJob;
-class SignEncryptJob;
-class DecryptVerifyArchiveJob;
-class DecryptVerifyJob;
-class RefreshKeysJob;
-class ChangeExpiryJob;
-class ChangeOwnerTrustJob;
-class ChangePasswdJob;
-class AddUserIDJob;
-class SpecialJob;
-class KeyForMailboxJob;
-class WKDLookupJob;
-class WKSPublishJob;
-class TofuPolicyJob;
-class QuickJob;
-class GpgCardJob;
-class ReceiveKeysJob;
-class RevokeKeyJob;
-class SetPrimaryUserIDJob;
-class WKDRefreshJob;
-
-/** The main entry point for QGpgME Comes in OpenPGP and SMIME(CMS) flavors.
- *
- * Use the proctocol class to obtain an instance of a job. Jobs
- * provide async API for GnuPG that can be connected to signals / slots.
- *
- * A job is usually started with start() and emits a result signal.
- * The parameters of the result signal depend on the job but the last
- * two are always a QString for the auditlog and an GpgME::Error for
- * an eventual error.
- *
- * In case async API is used and the result signal is emitted a
- * job schedules its own deletion.
- *
- * Most jobs also provide a synchronous call exec in which case
- * you have to explicitly delete the job if you don't need it anymore.
- *
- * \code
- * // Async example:
- * KeyListJob *job = openpgp()->keyListJob();
- * connect(job, &KeyListJob::result, job, [this, job](KeyListResult, std::vector<Key> keys, QString, Error)
- * {
- * // keys and resuls can now be used.
- * });
- * job->start({QStringLiteral("[email protected]")}, false);
- * \endcode
- *
- * \code
- * // Sync eaxmple:
- * KeyListJob *job = openpgp()->keyListJob(false, false, false);
- * std::vector<GpgME::Key> keys;
- * GpgME::KeyListResult result = job->exec(QStringList() <<
- * QStringLiteral("[email protected]"),
- * false, keys);
- * delete job;
- * \endcode
- */
-class QGPGME_EXPORT Protocol
-{
-public:
- virtual ~Protocol() {}
-
- virtual QString name() const = 0;
-
- virtual QString displayName() const = 0;
-
- virtual KeyListJob *keyListJob(bool remote = false, bool includeSigs = false, bool validate = false) const = 0;
- virtual ListAllKeysJob *listAllKeysJob(bool includeSigs = false, bool validate = false) const = 0;
- virtual EncryptJob *encryptJob(bool armor = false, bool textmode = false) const = 0;
- virtual DecryptJob *decryptJob() const = 0;
- virtual SignJob *signJob(bool armor = false, bool textMode = false) const = 0;
- virtual VerifyDetachedJob *verifyDetachedJob(bool textmode = false) const = 0;
- virtual VerifyOpaqueJob *verifyOpaqueJob(bool textmode = false) const = 0;
- virtual KeyGenerationJob *keyGenerationJob() const = 0;
- virtual ImportJob *importJob() const = 0;
- virtual ImportFromKeyserverJob *importFromKeyserverJob() const = 0;
- virtual ExportJob *publicKeyExportJob(bool armor = false) const = 0;
- // the second parameter is ignored; the passphrase in the exported file is always utf-8 encoded
- virtual ExportJob *secretKeyExportJob(bool armor = false, const QString & = QString()) const = 0;
- virtual DownloadJob *downloadJob(bool armor = false) const = 0;
- virtual DeleteJob *deleteJob() const = 0;
- virtual SignEncryptJob *signEncryptJob(bool armor = false, bool textMode = false) const = 0;
- virtual DecryptVerifyJob *decryptVerifyJob(bool textmode = false) const = 0;
-
- /**
- * For S/MIME keys this job performs a full validation check of the keys
- * with updated CRLs.
- * For OpenPGP keys, use receiveKeysJob.
- */
- virtual RefreshKeysJob *refreshKeysJob() const = 0;
- virtual ChangeExpiryJob *changeExpiryJob() const = 0;
- virtual SignKeyJob *signKeyJob() const = 0;
- virtual ChangePasswdJob *changePasswdJob() const = 0;
- virtual ChangeOwnerTrustJob *changeOwnerTrustJob() const = 0;
- virtual AddUserIDJob *addUserIDJob() const = 0;
- virtual SpecialJob *specialJob(const char *type, const QMap<QString, QVariant> &args) const = 0;
-
- /** A key locate job.
- *
- * This tries to find a key in local
- * and remote sources, if the key was remote it is imported
- * by GnuPG. Same as KeyListJob but intended to be used
- * to locate keys automatically. This ends up calling --locate-keys.
- *
- * Only available for OpenPGP
- *
- * Results are validated. As if keyListJob was called
- * with both includeSigs and validate options.
- */
- virtual KeyListJob *locateKeysJob() const = 0;
- /** Find the best key to use for a mailbox. */
- virtual KeyForMailboxJob *keyForMailboxJob() const = 0;
-
- /** A Job for interacting with gnupg's wks tools. */
- virtual WKSPublishJob *wksPublishJob() const = 0;
-
- /** A Job to set tofu policy */
- virtual TofuPolicyJob *tofuPolicyJob() const = 0;
-
- /** A Job for the quick commands */
- virtual QuickJob *quickJob() const = 0;
-
- /** This job looks up a key via WKD without importing it. */
- virtual WKDLookupJob *wkdLookupJob() const = 0;
-
- virtual ExportJob *secretSubkeyExportJob(bool armor = false) const = 0;
- virtual AddExistingSubkeyJob *addExistingSubkeyJob() const = 0;
- virtual ReceiveKeysJob *receiveKeysJob() const = 0;
-
- virtual RevokeKeyJob *revokeKeyJob() const = 0;
-
- /**
- * Returns a job for flagging a user ID as the primary user ID of an
- * OpenPGP key.
- */
- virtual SetPrimaryUserIDJob *setPrimaryUserIDJob() const = 0;
-
- virtual EncryptArchiveJob *encryptArchiveJob(bool armor = false) const = 0;
- virtual SignArchiveJob *signArchiveJob(bool armor = false) const = 0;
- virtual SignEncryptArchiveJob *signEncryptArchiveJob(bool armor = false) const = 0;
- virtual DecryptVerifyArchiveJob *decryptVerifyArchiveJob() const = 0;
-
- virtual WKDRefreshJob *wkdRefreshJob() const = 0;
-};
-
-/** Obtain a reference to the OpenPGP Protocol.
- *
- * The reference is to a static object.
- * @returns Reference to the OpenPGP Protocol.
- */
-QGPGME_EXPORT Protocol *openpgp();
-
-/** Obtain a reference to the smime Protocol.
- *
- * The reference is to a static object.
- * @returns Reference to the smime Protocol.
- */
-QGPGME_EXPORT Protocol *smime();
-
-/** Obtain a reference to a cryptoConfig object.
- *
- * The reference is to a static object.
- * @returns reference to cryptoConfig object.
- */
-QGPGME_EXPORT CryptoConfig *cryptoConfig();
-
-/** Obtain a reference to a protocol agnostic GpgCardJob.
- *
- * The reference is to a static object.
- * @returns reference to a GpgCardJob following the job pattern.
- */
-QGPGME_EXPORT GpgCardJob *gpgCardJob();
-
-}
-#endif
diff --git a/lang/qt/src/protocol_p.h b/lang/qt/src/protocol_p.h
deleted file mode 100644
index b34b7a37..00000000
--- a/lang/qt/src/protocol_p.h
+++ /dev/null
@@ -1,575 +0,0 @@
-/*
- protocol_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2005 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2022 by g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-#ifndef __QGPGME_PROTOCOL_P_H__
-#define __QGPGME_PROTOCOL_P_H__
-#include "qgpgmenewcryptoconfig.h"
-
-#include "qgpgmekeygenerationjob.h"
-#include "qgpgmekeylistjob.h"
-#include "qgpgmelistallkeysjob.h"
-#include "qgpgmedecryptjob.h"
-#include "qgpgmedecryptverifyarchivejob.h"
-#include "qgpgmedecryptverifyjob.h"
-#include "qgpgmerefreshsmimekeysjob.h"
-#include "qgpgmedeletejob.h"
-#include "qgpgmedownloadjob.h"
-#include "qgpgmesignencryptjob.h"
-#include "qgpgmeencryptarchivejob.h"
-#include "qgpgmeencryptjob.h"
-#include "qgpgmesignarchivejob.h"
-#include "qgpgmesignencryptarchivejob.h"
-#include "qgpgmesignjob.h"
-#include "qgpgmesignkeyjob.h"
-#include "qgpgmeexportjob.h"
-#include "qgpgmeverifydetachedjob.h"
-#include "qgpgmeimportjob.h"
-#include "qgpgmeimportfromkeyserverjob.h"
-#include "qgpgmeverifyopaquejob.h"
-#include "qgpgmechangeexpiryjob.h"
-#include "qgpgmechangeownertrustjob.h"
-#include "qgpgmechangepasswdjob.h"
-#include "qgpgmeaddexistingsubkeyjob.h"
-#include "qgpgmeadduseridjob.h"
-#include "qgpgmekeyformailboxjob.h"
-#include "qgpgmewkdlookupjob.h"
-#include "qgpgmewkspublishjob.h"
-#include "qgpgmetofupolicyjob.h"
-#include "qgpgmequickjob.h"
-#include "qgpgmereceivekeysjob.h"
-#include "qgpgmerevokekeyjob.h"
-#include "qgpgmesetprimaryuseridjob.h"
-#include "qgpgmewkdrefreshjob.h"
-
-namespace
-{
-
-class Protocol : public QGpgME::Protocol
-{
- GpgME::Protocol mProtocol;
-public:
- explicit Protocol(GpgME::Protocol proto) : mProtocol(proto) {}
-
- QString name() const override
- {
- switch (mProtocol) {
- case GpgME::OpenPGP: return QStringLiteral("OpenPGP");
- case GpgME::CMS: return QStringLiteral("SMIME");
- default: return QString();
- }
- }
-
- QString displayName() const override
- {
- // ah (2.4.16): Where is this used and isn't this inverted
- // with name
- switch (mProtocol) {
- case GpgME::OpenPGP: return QStringLiteral("gpg");
- case GpgME::CMS: return QStringLiteral("gpgsm");
- default: return QStringLiteral("unknown");
- }
- }
-
- QGpgME::SpecialJob *specialJob(const char *, const QMap<QString, QVariant> &) const override
- {
- return nullptr;
- }
-
- QGpgME::KeyListJob *keyListJob(bool remote, bool includeSigs, bool validate) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- unsigned int mode = context->keyListMode();
- if (remote) {
- mode |= GpgME::Extern;
- mode &= ~GpgME::Local;
- } else {
- mode |= GpgME::Local;
- mode &= ~GpgME::Extern;
- }
- if (includeSigs) {
- mode |= GpgME::Signatures;
- }
- if (validate) {
- mode |= GpgME::Validate;
- }
- context->setKeyListMode(mode);
- return new QGpgME::QGpgMEKeyListJob(context);
- }
-
- QGpgME::ListAllKeysJob *listAllKeysJob(bool includeSigs, bool validate) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- unsigned int mode = context->keyListMode();
- mode |= GpgME::Local;
- mode &= ~GpgME::Extern;
- if (includeSigs) {
- mode |= GpgME::Signatures;
- }
- if (validate) {
- mode |= GpgME::Validate;
- /* Setting the context to offline mode disables CRL / OCSP checks in
- this Job. Otherwise we would try to fetch the CRL's for all CMS
- keys in the users keyring because GpgME::Validate includes remote
- resources by default in the validity check.
- This setting only has any effect if gpgsm >= 2.1.6 is used.
- */
- context->setOffline(true);
- }
- context->setKeyListMode(mode);
- return new QGpgME::QGpgMEListAllKeysJob(context);
- }
-
- QGpgME::EncryptJob *encryptJob(bool armor, bool textmode) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- context->setArmor(armor);
- context->setTextMode(textmode);
- return new QGpgME::QGpgMEEncryptJob(context);
- }
-
- QGpgME::DecryptJob *decryptJob() const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEDecryptJob(context);
- }
-
- QGpgME::SignJob *signJob(bool armor, bool textMode) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- context->setArmor(armor);
- context->setTextMode(textMode);
- return new QGpgME::QGpgMESignJob(context);
- }
-
- QGpgME::VerifyDetachedJob *verifyDetachedJob(bool textMode) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- context->setTextMode(textMode);
- return new QGpgME::QGpgMEVerifyDetachedJob(context);
- }
-
- QGpgME::VerifyOpaqueJob *verifyOpaqueJob(bool textMode) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- context->setTextMode(textMode);
- return new QGpgME::QGpgMEVerifyOpaqueJob(context);
- }
-
- QGpgME::KeyGenerationJob *keyGenerationJob() const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEKeyGenerationJob(context);
- }
-
- QGpgME::ImportJob *importJob() const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEImportJob(context);
- }
-
- QGpgME::ImportFromKeyserverJob *importFromKeyserverJob() const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEImportFromKeyserverJob(context);
- }
-
- QGpgME::ReceiveKeysJob *receiveKeysJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
-
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEReceiveKeysJob{context};
- }
-
- QGpgME::ExportJob *publicKeyExportJob(bool armor) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- context->setArmor(armor);
- return new QGpgME::QGpgMEExportJob(context);
- }
-
- QGpgME::ExportJob *secretKeyExportJob(bool armor, const QString &) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- context->setArmor(armor);
- return new QGpgME::QGpgMEExportJob(context, GpgME::Context::ExportSecret);
- }
-
- QGpgME::ExportJob *secretSubkeyExportJob(bool armor) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- context->setArmor(armor);
- return new QGpgME::QGpgMEExportJob(context, GpgME::Context::ExportSecretSubkey);
- }
-
- QGpgME::RefreshKeysJob *refreshKeysJob() const override
- {
- if (mProtocol != GpgME::CMS) {
- return nullptr;
- }
-
- return new QGpgME::QGpgMERefreshSMIMEKeysJob;
- }
-
- QGpgME::DownloadJob *downloadJob(bool armor) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- context->setArmor(armor);
- // this is the hackish interface for downloading from keyserers currently:
- context->setKeyListMode(GpgME::Extern);
- return new QGpgME::QGpgMEDownloadJob(context);
- }
-
- QGpgME::DeleteJob *deleteJob() const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEDeleteJob(context);
- }
-
- QGpgME::SignEncryptJob *signEncryptJob(bool armor, bool textMode) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- context->setArmor(armor);
- context->setTextMode(textMode);
- return new QGpgME::QGpgMESignEncryptJob(context);
- }
-
- QGpgME::DecryptVerifyJob *decryptVerifyJob(bool textMode) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- context->setTextMode(textMode);
- return new QGpgME::QGpgMEDecryptVerifyJob(context);
- }
-
- QGpgME::ChangeExpiryJob *changeExpiryJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr; // only supported by gpg
- }
-
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEChangeExpiryJob(context);
- }
-
- QGpgME::ChangePasswdJob *changePasswdJob() const override
- {
- if (!GpgME::hasFeature(GpgME::PasswdFeature, 0)) {
- return nullptr;
- }
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEChangePasswdJob(context);
- }
-
- QGpgME::SignKeyJob *signKeyJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr; // only supported by gpg
- }
-
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMESignKeyJob(context);
- }
-
- QGpgME::ChangeOwnerTrustJob *changeOwnerTrustJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr; // only supported by gpg
- }
-
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEChangeOwnerTrustJob(context);
- }
-
- QGpgME:: AddExistingSubkeyJob *addExistingSubkeyJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr; // only supported by gpg
- }
-
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEAddExistingSubkeyJob{context};
- }
-
- QGpgME::AddUserIDJob *addUserIDJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr; // only supported by gpg
- }
-
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEAddUserIDJob(context);
- }
-
- QGpgME::KeyListJob *locateKeysJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- context->setKeyListMode(GpgME::Locate | GpgME::Signatures | GpgME::Validate);
- return new QGpgME::QGpgMEKeyListJob(context);
- }
-
- QGpgME::KeyForMailboxJob *keyForMailboxJob() const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEKeyForMailboxJob(context);
- }
-
- QGpgME::WKDLookupJob *wkdLookupJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
- auto context = GpgME::Context::createForEngine(GpgME::AssuanEngine);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEWKDLookupJob(context.release());
- }
-
- QGpgME::WKSPublishJob *wksPublishJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
- auto context = GpgME::Context::createForEngine(GpgME::SpawnEngine);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEWKSPublishJob(context.release());
- }
-
- QGpgME::TofuPolicyJob *tofuPolicyJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMETofuPolicyJob(context);
- }
-
- QGpgME::QuickJob *quickJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEQuickJob(context);
- }
-
- QGpgME::RevokeKeyJob *revokeKeyJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMERevokeKeyJob(context);
- }
-
- QGpgME::SetPrimaryUserIDJob *setPrimaryUserIDJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMESetPrimaryUserIDJob{context};
- }
-
- QGpgME::EncryptArchiveJob *encryptArchiveJob(bool armor) const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
- if (auto context = GpgME::Context::createForProtocol(mProtocol)) {
- context->setArmor(armor);
- return new QGpgME::QGpgMEEncryptArchiveJob{context};
- }
- return nullptr;
- }
-
- QGpgME::SignArchiveJob *signArchiveJob(bool armor) const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
- if (auto context = GpgME::Context::createForProtocol(mProtocol)) {
- context->setArmor(armor);
- return new QGpgME::QGpgMESignArchiveJob{context};
- }
- return nullptr;
- }
-
- QGpgME::SignEncryptArchiveJob *signEncryptArchiveJob(bool armor) const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
- if (auto context = GpgME::Context::createForProtocol(mProtocol)) {
- context->setArmor(armor);
- return new QGpgME::QGpgMESignEncryptArchiveJob{context};
- }
- return nullptr;
- }
-
- QGpgME::DecryptVerifyArchiveJob *decryptVerifyArchiveJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
- if (auto context = GpgME::Context::createForProtocol(mProtocol)) {
- return new QGpgME::QGpgMEDecryptVerifyArchiveJob{context};
- }
- return nullptr;
- }
-
- QGpgME::WKDRefreshJob *wkdRefreshJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
- if (auto context = GpgME::Context::createForProtocol(mProtocol)) {
- return new QGpgME::QGpgMEWKDRefreshJob{context};
- }
- return nullptr;
- }
-};
-
-}
-#endif
diff --git a/lang/qt/src/qgpgme_debug.cpp b/lang/qt/src/qgpgme_debug.cpp
deleted file mode 100644
index 513a9b08..00000000
--- a/lang/qt/src/qgpgme_debug.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgme_debug.h"
-
-
-#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
-Q_LOGGING_CATEGORY(QGPGME_LOG, "gpg.qgpgme", QtWarningMsg)
-Q_LOGGING_CATEGORY(QGPGME_CONFIG_LOADING_LOG, "gpg.qgpgme.config_loading", QtInfoMsg)
-#else
-Q_LOGGING_CATEGORY(QGPGME_LOG, "gpg.qgpgme")
-Q_LOGGING_CATEGORY(QGPGME_CONFIG_LOADING_LOG, "gpg.qgpgme.config_loading")
-#endif
diff --git a/lang/qt/src/qgpgme_debug.h b/lang/qt/src/qgpgme_debug.h
deleted file mode 100644
index 9cdd1a8c..00000000
--- a/lang/qt/src/qgpgme_debug.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef QGPGME_QGPGME_DEBUG_H
-#define QGPGME_QGPGME_DEBUG_H
-
-#include <QLoggingCategory>
-
-Q_DECLARE_LOGGING_CATEGORY(QGPGME_LOG)
-Q_DECLARE_LOGGING_CATEGORY(QGPGME_CONFIG_LOADING_LOG)
-
-
-#endif
diff --git a/lang/qt/src/qgpgme_export.h b/lang/qt/src/qgpgme_export.h
deleted file mode 100644
index 72927fe3..00000000
--- a/lang/qt/src/qgpgme_export.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* qgpgme_export.h - Export macros for qgpgme
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef QGPGME_EXPORT_H
-#define QGPGME_EXPORT_H
-
-#ifdef QGPGME_STATIC_DEFINE
-# define QGPGME_EXPORT
-# define QGPGME_NO_EXPORT
-#else
-# ifndef QGPGME_EXPORT
-# ifdef BUILDING_QGPGME
- /* We are building this library */
-# ifdef WIN32
-# define QGPGME_EXPORT __declspec(dllexport)
-# else
-# define QGPGME_EXPORT __attribute__((visibility("default")))
-# endif
-# else
- /* We are using this library */
-# ifdef WIN32
-# define QGPGME_EXPORT __declspec(dllimport)
-# else
-# define QGPGME_EXPORT __attribute__((visibility("default")))
-# endif
-# endif
-# endif
-
-# ifndef QGPGME_NO_EXPORT
-# ifdef WIN32
-# define QGPGME_NO_EXPORT
-# else
-# define QGPGME_NO_EXPORT __attribute__((visibility("hidden")))
-# endif
-# endif
-#endif
-
-#ifndef QGPGME_DEPRECATED
-# define QGPGME_DEPRECATED __attribute__ ((__deprecated__))
-#endif
-
-#ifndef QGPGME_DEPRECATED_EXPORT
-# define QGPGME_DEPRECATED_EXPORT QGPGME_EXPORT QGPGME_DEPRECATED
-#endif
-
-#ifndef QGPGME_DEPRECATED_NO_EXPORT
-# define QGPGME_DEPRECATED_NO_EXPORT QGPGME_NO_EXPORT QGPGME_DEPRECATED
-#endif
-
-#define DEFINE_NO_DEPRECATED 0
-#if DEFINE_NO_DEPRECATED
-# define QGPGME_NO_DEPRECATED
-#endif
-
-#endif
diff --git a/lang/qt/src/qgpgme_version.h.in b/lang/qt/src/qgpgme_version.h.in
deleted file mode 100644
index 1bc56949..00000000
--- a/lang/qt/src/qgpgme_version.h.in
+++ /dev/null
@@ -1,42 +0,0 @@
-/* qgpgme_version.h - Version macros for qgpgme
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2016 Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-
-#ifndef QGPGME_VERSION_H
-#define QGPGME_VERSION_H
-
-#define QGPGME_VERSION_STRING "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_MICRO@"
-#define QGPGME_VERSION_MAJOR @VERSION_MAJOR@
-#define QGPGME_VERSION_MINOR @VERSION_MINOR@
-#define QGPGME_VERSION_PATCH @VERSION_MICRO@
-#define QGPGME_VERSION ((@VERSION_MAJOR@<<16)|(@VERSION_MINOR@<<8)|(@VERSION_MICRO@))
-
-#endif
diff --git a/lang/qt/src/qgpgmeaddexistingsubkeyjob.cpp b/lang/qt/src/qgpgmeaddexistingsubkeyjob.cpp
deleted file mode 100644
index 7750d36b..00000000
--- a/lang/qt/src/qgpgmeaddexistingsubkeyjob.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- qgpgmeaddexistingsubkeyjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmeaddexistingsubkeyjob.h"
-
-#include "dataprovider.h"
-
-#include <QDateTime>
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/gpgaddexistingsubkeyeditinteractor.h>
-#include <gpgme++/key.h>
-
-#include <gpg-error.h>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEAddExistingSubkeyJob::QGpgMEAddExistingSubkeyJob(Context *context)
- : mixin_type{context}
-{
- lateInitialization();
-}
-
-QGpgMEAddExistingSubkeyJob::~QGpgMEAddExistingSubkeyJob() = default;
-
-static QGpgMEAddExistingSubkeyJob::result_type add_subkey(Context *ctx, const Key &key, const Subkey &subkey)
-{
- std::unique_ptr<GpgAddExistingSubkeyEditInteractor> interactor{new GpgAddExistingSubkeyEditInteractor{subkey.keyGrip()}};
-
- if (!subkey.neverExpires()) {
- const auto expiry = QDateTime::fromSecsSinceEpoch(uint_least32_t(subkey.expirationTime()),
- Qt::UTC).toString(u"yyyyMMdd'T'hhmmss").toStdString();
- interactor->setExpiry(expiry);
- }
-
- QGpgME::QByteArrayDataProvider dp;
- Data data(&dp);
- assert(!data.isNull());
-
- ctx->setFlag("extended-edit", "1");
-
- const Error err = ctx->edit(key, std::unique_ptr<EditInteractor>(interactor.release()), data);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(err, log, ae);
-}
-
-Error QGpgMEAddExistingSubkeyJob::start(const GpgME::Key &key, const GpgME::Subkey &subkey)
-{
- run(std::bind(&add_subkey, std::placeholders::_1, key, subkey));
- return {};
-}
-
-Error QGpgMEAddExistingSubkeyJob::exec(const GpgME::Key &key, const GpgME::Subkey &subkey)
-{
- const result_type r = add_subkey(context(), key, subkey);
- return std::get<0>(r);
-}
-
-#include "qgpgmeaddexistingsubkeyjob.moc"
diff --git a/lang/qt/src/qgpgmeaddexistingsubkeyjob.h b/lang/qt/src/qgpgmeaddexistingsubkeyjob.h
deleted file mode 100644
index 15727552..00000000
--- a/lang/qt/src/qgpgmeaddexistingsubkeyjob.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- qgpgmeaddexistingsubkeyjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMEADDEXISTINGSUBKEYJOB_H__
-#define __QGPGME_QGPGMEADDEXISTINGSUBKEYJOB_H__
-
-#include "threadedjobmixin.h"
-#include "addexistingsubkeyjob.h"
-
-namespace QGpgME
-{
-
-class QGpgMEAddExistingSubkeyJob
-#ifdef Q_MOC_RUN
- : public AddExistingSubkeyJob
-#else
- : public _detail::ThreadedJobMixin<AddExistingSubkeyJob>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEAddExistingSubkeyJob(GpgME::Context *context);
- ~QGpgMEAddExistingSubkeyJob();
-
- /* from AddExistingSubkeyJob */
- GpgME::Error start(const GpgME::Key &key, const GpgME::Subkey &subkey) override;
-
- /* from AddExistingSubkeyJob */
- GpgME::Error exec(const GpgME::Key &key, const GpgME::Subkey &subkey) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEADDEXISTINGSUBKEYJOB_H__
diff --git a/lang/qt/src/qgpgmeadduseridjob.cpp b/lang/qt/src/qgpgmeadduseridjob.cpp
deleted file mode 100644
index 3dec6581..00000000
--- a/lang/qt/src/qgpgmeadduseridjob.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- qgpgmeadduseridjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmeadduseridjob.h"
-
-#include "dataprovider.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/gpgadduserideditinteractor.h>
-#include <gpgme++/key.h>
-
-#include <cassert>
-#include <memory>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEAddUserIDJob::QGpgMEAddUserIDJob(Context *context)
- : mixin_type(context)
-{
- lateInitialization();
-}
-
-QGpgMEAddUserIDJob::~QGpgMEAddUserIDJob() {}
-
-static QGpgMEAddUserIDJob::result_type add_user_id(Context *ctx, const Key &key, const QString &name, const QString &email, const QString &comment)
-{
-
- GpgAddUserIDEditInteractor *gau = new GpgAddUserIDEditInteractor;
-
- gau->setNameUtf8(name.toUtf8().constData());
- gau->setEmailUtf8(email.toUtf8().constData());
- gau->setCommentUtf8(comment.toUtf8().constData());
-
- QGpgME::QByteArrayDataProvider dp;
- Data data(&dp);
- assert(!data.isNull());
- const Error err = ctx->edit(key, std::unique_ptr<EditInteractor> (gau), data);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(err, log, ae);
-}
-
-Error QGpgMEAddUserIDJob::start(const Key &key, const QString &name, const QString &email, const QString &comment)
-{
- run(std::bind(&add_user_id, std::placeholders::_1, key, name, email, comment));
- return Error();
-}
-#include "qgpgmeadduseridjob.moc"
diff --git a/lang/qt/src/qgpgmeadduseridjob.h b/lang/qt/src/qgpgmeadduseridjob.h
deleted file mode 100644
index 26395ba5..00000000
--- a/lang/qt/src/qgpgmeadduseridjob.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- qgpgmeadduseridjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMEADDUSERIDJOB_H__
-#define __QGPGME_QGPGMEADDUSERIDJOB_H__
-
-#include "adduseridjob.h"
-
-#include "threadedjobmixin.h"
-
-namespace QGpgME
-{
-
-class QGpgMEAddUserIDJob
-#ifdef Q_MOC_RUN
- : public AddUserIDJob
-#else
- : public _detail::ThreadedJobMixin<AddUserIDJob>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-private Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEAddUserIDJob(GpgME::Context *context);
- ~QGpgMEAddUserIDJob();
-
- /* from AddUserIDJob */
- GpgME::Error start(const GpgME::Key &key, const QString &name, const QString &email, const QString &comment) override;
-};
-}
-
-#endif // __QGPGME_QGPGMEADDUSERIDJOB_H__
diff --git a/lang/qt/src/qgpgmebackend.cpp b/lang/qt/src/qgpgmebackend.cpp
deleted file mode 100644
index 9cd34006..00000000
--- a/lang/qt/src/qgpgmebackend.cpp
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- qgpgmebackend.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2005 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmebackend.h"
-
-#include "qgpgmegpgcardjob.h"
-
-#include <gpgme++/error.h>
-#include <gpgme++/engineinfo.h>
-
-#include "protocol_p.h"
-
-#include <QFile>
-#include <QString>
-
-const char QGpgME::QGpgMEBackend::OpenPGP[] = "OpenPGP";
-const char QGpgME::QGpgMEBackend::SMIME[] = "SMIME";
-
-
-QGpgME::QGpgMEBackend::QGpgMEBackend()
- : mCryptoConfig(nullptr),
- mOpenPGPProtocol(nullptr),
- mSMIMEProtocol(nullptr)
-{
- GpgME::initializeLibrary();
-}
-
-QGpgME::QGpgMEBackend::~QGpgMEBackend()
-{
- delete mCryptoConfig; mCryptoConfig = nullptr;
- delete mOpenPGPProtocol; mOpenPGPProtocol = nullptr;
- delete mSMIMEProtocol; mSMIMEProtocol = nullptr;
-}
-
-QString QGpgME::QGpgMEBackend::name() const
-{
- return QStringLiteral("gpgme");
-}
-
-QString QGpgME::QGpgMEBackend::displayName() const
-{
- return QStringLiteral("GpgME");
-}
-
-QGpgME::CryptoConfig *QGpgME::QGpgMEBackend::config() const
-{
- if (!mCryptoConfig) {
- if (GpgME::hasFeature(GpgME::GpgConfEngineFeature, 0)) {
- mCryptoConfig = new QGpgMENewCryptoConfig;
- }
- }
- return mCryptoConfig;
-}
-
-QGpgME::GpgCardJob *QGpgME::QGpgMEBackend::gpgCardJob() const
-{
- return new QGpgME::QGpgMEGpgCardJob();
-}
-
-static bool check(GpgME::Protocol proto, QString *reason)
-{
- if (!GpgME::checkEngine(proto)) {
- return true;
- }
- if (!reason) {
- return false;
- }
- // error, check why:
-#if 0
-Port away from localised string or delete.
- const GpgME::EngineInfo ei = GpgME::engineInfo(proto);
- if (ei.isNull()) {
- *reason = i18n("GPGME was compiled without support for %1.", proto == GpgME::CMS ? QLatin1String("S/MIME") : QLatin1String("OpenPGP"));
- } else if (ei.fileName() && !ei.version()) {
- *reason = i18n("Engine %1 is not installed properly.", QFile::decodeName(ei.fileName()));
- } else if (ei.fileName() && ei.version() && ei.requiredVersion())
- *reason = i18n("Engine %1 version %2 installed, "
- "but at least version %3 is required.",
- QFile::decodeName(ei.fileName()), QLatin1String(ei.version()), QLatin1String(ei.requiredVersion()));
- else {
- *reason = i18n("Unknown problem with engine for protocol %1.", proto == GpgME::CMS ? QLatin1String("S/MIME") : QLatin1String("OpenPGP"));
- }
-#endif
- return false;
-}
-
-bool QGpgME::QGpgMEBackend::checkForOpenPGP(QString *reason) const
-{
- return check(GpgME::OpenPGP, reason);
-}
-
-bool QGpgME::QGpgMEBackend::checkForSMIME(QString *reason) const
-{
- return check(GpgME::CMS, reason);
-}
-
-bool QGpgME::QGpgMEBackend::checkForProtocol(const char *name, QString *reason) const
-{
- if (qstricmp(name, OpenPGP) == 0) {
- return check(GpgME::OpenPGP, reason);
- }
- if (qstricmp(name, SMIME) == 0) {
- return check(GpgME::CMS, reason);
- }
- if (reason) {
- *reason = QStringLiteral("Unsupported protocol \"%1\"").arg(QLatin1String(name));
- }
- return false;
-}
-
-QGpgME::Protocol *QGpgME::QGpgMEBackend::openpgp() const
-{
- if (!mOpenPGPProtocol)
- if (checkForOpenPGP()) {
- mOpenPGPProtocol = new ::Protocol(GpgME::OpenPGP);
- }
- return mOpenPGPProtocol;
-}
-
-QGpgME::Protocol *QGpgME::QGpgMEBackend::smime() const
-{
- if (!mSMIMEProtocol)
- if (checkForSMIME()) {
- mSMIMEProtocol = new ::Protocol(GpgME::CMS);
- }
- return mSMIMEProtocol;
-}
-
-QGpgME::Protocol *QGpgME::QGpgMEBackend::protocol(const char *name) const
-{
- if (qstricmp(name, OpenPGP) == 0) {
- return openpgp();
- }
- if (qstricmp(name, SMIME) == 0) {
- return smime();
- }
- return nullptr;
-}
-
-bool QGpgME::QGpgMEBackend::supportsProtocol(const char *name) const
-{
- return qstricmp(name, OpenPGP) == 0 || qstricmp(name, SMIME) == 0;
-}
-
-const char *QGpgME::QGpgMEBackend::enumerateProtocols(int i) const
-{
- switch (i) {
- case 0: return OpenPGP;
- case 1: return SMIME;
- default: return nullptr;
- }
-}
-
-static QGpgME::QGpgMEBackend *gpgmeBackend;
-
-QGpgME::CryptoConfig *QGpgME::cryptoConfig()
-{
- if (!gpgmeBackend) {
- gpgmeBackend = new QGpgME::QGpgMEBackend();
- }
- return gpgmeBackend->config();
-
-}
-
-QGpgME::Protocol *QGpgME::openpgp()
-{
- if (!gpgmeBackend) {
- gpgmeBackend = new QGpgME::QGpgMEBackend();
- }
- return gpgmeBackend->openpgp();
-}
-
-QGpgME::Protocol *QGpgME::smime()
-{
- if (!gpgmeBackend) {
- gpgmeBackend = new QGpgME::QGpgMEBackend();
- }
- return gpgmeBackend->smime();
-}
-
-QGpgME::GpgCardJob *QGpgME::gpgCardJob ()
-{
- if (!gpgmeBackend) {
- gpgmeBackend = new QGpgME::QGpgMEBackend();
- }
- return gpgmeBackend->gpgCardJob();
-}
diff --git a/lang/qt/src/qgpgmebackend.h b/lang/qt/src/qgpgmebackend.h
deleted file mode 100644
index 2e26d4a3..00000000
--- a/lang/qt/src/qgpgmebackend.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- qgpgmebackend.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2005 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMEBACKEND_H__
-#define __QGPGME_QGPGMEBACKEND_H__
-
-#include <QString>
-
-#include "protocol.h"
-
-class QString;
-template <typename T_Key, typename T_Value> class QMap;
-
-namespace QGpgME
-{
-class CryptoConfig;
-class Protocol;
-class GpgCardJob;
-
-
-class QGpgMEBackend
-{
-public:
- QGpgMEBackend();
- ~QGpgMEBackend();
-
- QString name() const;
- QString displayName() const;
-
- CryptoConfig *config() const;
- GpgCardJob *gpgCardJob() const;
-
- Protocol *openpgp() const;
- Protocol *smime() const;
- Protocol *protocol(const char *name) const;
-
- static const char OpenPGP[];
- static const char SMIME[];
-
- bool checkForOpenPGP(QString *reason = nullptr) const;
- bool checkForSMIME(QString *reason = nullptr) const;
- bool checkForProtocol(const char *name, QString *reason) const;
-
- bool supportsOpenPGP() const
- {
- return true;
- }
- bool supportsSMIME() const
- {
- return true;
- }
- bool supportsProtocol(const char *name) const;
-
- const char *enumerateProtocols(int i) const;
-
-private:
- mutable QGpgME::CryptoConfig *mCryptoConfig;
- mutable Protocol *mOpenPGPProtocol;
- mutable Protocol *mSMIMEProtocol;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEBACKEND_H__
diff --git a/lang/qt/src/qgpgmechangeexpiryjob.cpp b/lang/qt/src/qgpgmechangeexpiryjob.cpp
deleted file mode 100644
index 7f98a943..00000000
--- a/lang/qt/src/qgpgmechangeexpiryjob.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- qgpgmechangeexpiryjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2021,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmechangeexpiryjob.h"
-
-#include "changeexpiryjob_p.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/key.h>
-
-#include <QDateTime>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMEChangeExpiryJobPrivate : public ChangeExpiryJobPrivate
-{
- QGpgMEChangeExpiryJob *q = nullptr;
-
-public:
- QGpgMEChangeExpiryJobPrivate(QGpgMEChangeExpiryJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMEChangeExpiryJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override
- {
- Q_ASSERT(!"Not supported by this Job class.");
- return Error::fromCode(GPG_ERR_NOT_SUPPORTED);
- }
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMEChangeExpiryJob::QGpgMEChangeExpiryJob(Context *context)
- : mixin_type(context)
-{
- setJobPrivate(this, std::unique_ptr<QGpgMEChangeExpiryJobPrivate>{new QGpgMEChangeExpiryJobPrivate{this}});
- lateInitialization();
-}
-
-QGpgMEChangeExpiryJob::~QGpgMEChangeExpiryJob() {}
-
-static QGpgMEChangeExpiryJob::result_type change_expiry(Context *ctx, const Key &key, const QDateTime &expiry,
- const std::vector<Subkey> &subkeys, ChangeExpiryJob::Options options)
-{
- // convert expiry to "seconds from now"; use 1 second from now if expiry is before the current datetime
- const unsigned long expires = expiry.isValid()
- ? std::max<qint64>(QDateTime::currentDateTime().secsTo(expiry), 1)
- : 0;
-
- // updating the expiration date of the primary key and the subkeys needs to be done in two steps
- // because --quick-set-expire does not support updating the expiration date of both at the same time
-
- if (subkeys.empty() || (options & ChangeExpiryJob::UpdatePrimaryKey)) {
- // update the expiration date of the primary key
- auto err = ctx->setExpire(key, expires);
- if (err || err.isCanceled()) {
- return std::make_tuple(err, QString(), Error());
- }
- }
-
- GpgME::Error err;
- if (!subkeys.empty()) {
- // update the expiration date of the specified subkeys
- err = ctx->setExpire(key, expires, subkeys);
- } else if (options & ChangeExpiryJob::UpdateAllSubkeys) {
- // update the expiration date of all subkeys
- err = ctx->setExpire(key, expires, {}, Context::SetExpireAllSubkeys);
- }
- return std::make_tuple(err, QString(), Error());
-}
-
-Error QGpgMEChangeExpiryJob::start(const Key &key, const QDateTime &expiry)
-{
- return start(key, expiry, std::vector<Subkey>());
-}
-
-Error QGpgMEChangeExpiryJob::start(const Key &key, const QDateTime &expiry, const std::vector<Subkey> &subkeys)
-{
- run(std::bind(&change_expiry, std::placeholders::_1, key, expiry, subkeys, options()));
- return Error();
-}
-
-#include "qgpgmechangeexpiryjob.moc"
diff --git a/lang/qt/src/qgpgmechangeexpiryjob.h b/lang/qt/src/qgpgmechangeexpiryjob.h
deleted file mode 100644
index ac66e4f7..00000000
--- a/lang/qt/src/qgpgmechangeexpiryjob.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- qgpgmechangeexpiryjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMECHANGEEXPIRYJOB_H__
-#define __QGPGME_QGPGMECHANGEEXPIRYJOB_H__
-
-#include "changeexpiryjob.h"
-
-#include "threadedjobmixin.h"
-
-namespace QGpgME
-{
-
-class QGpgMEChangeExpiryJob
-#ifdef Q_MOC_RUN
- : public ChangeExpiryJob
-#else
- : public _detail::ThreadedJobMixin<ChangeExpiryJob>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-private Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEChangeExpiryJob(GpgME::Context *context);
- ~QGpgMEChangeExpiryJob();
-
- /* from ChangeExpiryJob */
- GpgME::Error start(const GpgME::Key &key, const QDateTime &expiry) override;
-
- /* from ChangeExpiryJob */
- GpgME::Error start(const GpgME::Key &key, const QDateTime &expiry,
- const std::vector<GpgME::Subkey> &subkeys) override;
-
-};
-
-}
-
-#endif // __QGPGME_QGPGMECHANGEEXPIRYJOB_H__
diff --git a/lang/qt/src/qgpgmechangeownertrustjob.cpp b/lang/qt/src/qgpgmechangeownertrustjob.cpp
deleted file mode 100644
index 2c8c4e53..00000000
--- a/lang/qt/src/qgpgmechangeownertrustjob.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- qgpgmechangeownertrustjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2024 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmechangeownertrustjob.h"
-
-#include "dataprovider.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/engineinfo.h>
-#include <gpgme++/gpgsetownertrusteditinteractor.h>
-#include <gpgme++/key.h>
-
-#include <cassert>
-#include <memory>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEChangeOwnerTrustJob::QGpgMEChangeOwnerTrustJob(Context *context)
- : mixin_type(context)
-{
- lateInitialization();
-}
-
-QGpgMEChangeOwnerTrustJob::~QGpgMEChangeOwnerTrustJob() {}
-
-static QGpgMEChangeOwnerTrustJob::result_type set_owner_trust(Context *ctx, const Key &key, Key::OwnerTrust trust)
-{
- const Error err = ctx->setOwnerTrust(key, trust);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(err, log, ae);
-}
-
-static QGpgMEChangeOwnerTrustJob::result_type change_ownertrust(Context *ctx, const Key &key, Key::OwnerTrust trust)
-{
- EditInteractor *ei = new GpgSetOwnerTrustEditInteractor(trust);
-
- QGpgME::QByteArrayDataProvider dp;
- Data data(&dp);
- assert(!data.isNull());
-
- const Error err = ctx->edit(key, std::unique_ptr<EditInteractor>(ei), data);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(err, log, ae);
-}
-
-Error QGpgMEChangeOwnerTrustJob::start(const Key &key, Key::OwnerTrust trust)
-{
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.4.6") {
- run(std::bind(&change_ownertrust, std::placeholders::_1, key, trust));
- } else {
- run(std::bind(&set_owner_trust, std::placeholders::_1, key, trust));
- }
- return Error();
-}
-#include "qgpgmechangeownertrustjob.moc"
diff --git a/lang/qt/src/qgpgmechangeownertrustjob.h b/lang/qt/src/qgpgmechangeownertrustjob.h
deleted file mode 100644
index 387166e2..00000000
--- a/lang/qt/src/qgpgmechangeownertrustjob.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- qgpgmechangeownertrustjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMECHANGEOWNERTRUSTJOB_H__
-#define __QGPGME_QGPGMECHANGEOWNERTRUSTJOB_H__
-
-#include "changeownertrustjob.h"
-
-#include "threadedjobmixin.h"
-
-namespace QGpgME
-{
-
-class QGpgMEChangeOwnerTrustJob
-#ifdef Q_MOC_RUN
- : public ChangeOwnerTrustJob
-#else
- : public _detail::ThreadedJobMixin<ChangeOwnerTrustJob>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-private Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEChangeOwnerTrustJob(GpgME::Context *context);
- ~QGpgMEChangeOwnerTrustJob();
-
- /* from ChangeOwnerTrustJob */
- GpgME::Error start(const GpgME::Key &key, GpgME::Key::OwnerTrust trust) override;
-};
-}
-
-#endif // __QGPGME_QGPGMECHANGEOWNERTRUSTJOB_H__
diff --git a/lang/qt/src/qgpgmechangepasswdjob.cpp b/lang/qt/src/qgpgmechangepasswdjob.cpp
deleted file mode 100644
index 0607b6d3..00000000
--- a/lang/qt/src/qgpgmechangepasswdjob.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- qgpgmechangepasswdjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2010 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmechangepasswdjob.h"
-
-#include "dataprovider.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/key.h>
-
-#include <cassert>
-#include <memory>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEChangePasswdJob::QGpgMEChangePasswdJob(Context *context)
- : mixin_type(context)
-{
- lateInitialization();
-}
-
-QGpgMEChangePasswdJob::~QGpgMEChangePasswdJob() {}
-
-static QGpgMEChangePasswdJob::result_type change_passwd(Context *ctx, const Key &key)
-{
-#if 0 // in case we want to fall back to edit interactor for gpg...
- std::unique_ptr<EditInteractor> ei(new GpgChangePasswdEditInteractor);
-
- QGpgME::QByteArrayDataProvider dp;
- Data data(&dp);
- assert(!data.isNull());
- const Error err = ctx->edit(key, ei, data);
-#else
- const Error err = ctx->passwd(key);
-#endif
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(err, log, ae);
-}
-
-Error QGpgMEChangePasswdJob::start(const Key &key)
-{
- run(std::bind(&change_passwd, std::placeholders::_1, key));
- return Error();
-}
-
-#include "qgpgmechangepasswdjob.moc"
diff --git a/lang/qt/src/qgpgmechangepasswdjob.h b/lang/qt/src/qgpgmechangepasswdjob.h
deleted file mode 100644
index fbd9caa5..00000000
--- a/lang/qt/src/qgpgmechangepasswdjob.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- qgpgmechangepasswdjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2010 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMECHANGEPASSWDJOB_H__
-#define __QGPGME_QGPGMECHANGEPASSWDJOB_H__
-
-#include "changepasswdjob.h"
-
-#include "threadedjobmixin.h"
-
-namespace QGpgME
-{
-
-class QGpgMEChangePasswdJob
-#ifdef Q_MOC_RUN
- : public ChangePasswdJob
-#else
- : public _detail::ThreadedJobMixin<ChangePasswdJob>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-private Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEChangePasswdJob(GpgME::Context *context);
- ~QGpgMEChangePasswdJob();
-
- /* from ChangePasswdJob */
- GpgME::Error start(const GpgME::Key &key) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMECHANGEPASSWDJOB_H__
diff --git a/lang/qt/src/qgpgmedecryptjob.cpp b/lang/qt/src/qgpgmedecryptjob.cpp
deleted file mode 100644
index 95240a49..00000000
--- a/lang/qt/src/qgpgmedecryptjob.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- qgpgmedecryptjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmedecryptjob.h"
-
-#include "dataprovider.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/decryptionresult.h>
-#include <gpgme++/data.h>
-
-#include <QBuffer>
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEDecryptJob::QGpgMEDecryptJob(Context *context)
- : mixin_type(context)
-{
- lateInitialization();
-}
-
-QGpgMEDecryptJob::~QGpgMEDecryptJob() {}
-
-static QGpgMEDecryptJob::result_type decrypt(Context *ctx, QThread *thread,
- const std::weak_ptr<QIODevice> &cipherText_,
- const std::weak_ptr<QIODevice> &plainText_)
-{
-
- const std::shared_ptr<QIODevice> cipherText = cipherText_.lock();
- const std::shared_ptr<QIODevice> plainText = plainText_.lock();
-
- const _detail::ToThreadMover ctMover(cipherText, thread);
- const _detail::ToThreadMover ptMover(plainText, thread);
-
- QGpgME::QIODeviceDataProvider in(cipherText);
- Data indata(&in);
- if (!cipherText->isSequential()) {
- indata.setSizeHint(cipherText->size());
- }
-
- if (!plainText) {
- QGpgME::QByteArrayDataProvider out;
- Data outdata(&out);
-
- const DecryptionResult res = ctx->decrypt(indata, outdata);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, out.data(), log, ae);
- } else {
- QGpgME::QIODeviceDataProvider out(plainText);
- Data outdata(&out);
-
- const DecryptionResult res = ctx->decrypt(indata, outdata);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, QByteArray(), log, ae);
- }
-
-}
-
-static QGpgMEDecryptJob::result_type decrypt_qba(Context *ctx, const QByteArray &cipherText)
-{
- const std::shared_ptr<QBuffer> buffer(new QBuffer);
- buffer->setData(cipherText);
- if (!buffer->open(QIODevice::ReadOnly)) {
- assert(!"This should never happen: QBuffer::open() failed");
- }
- return decrypt(ctx, nullptr, buffer, std::shared_ptr<QIODevice>());
-}
-
-Error QGpgMEDecryptJob::start(const QByteArray &cipherText)
-{
- run(std::bind(&decrypt_qba, std::placeholders::_1, cipherText));
- return Error();
-}
-
-void QGpgMEDecryptJob::start(const std::shared_ptr<QIODevice> &cipherText, const std::shared_ptr<QIODevice> &plainText)
-{
- run(std::bind(&decrypt, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4), cipherText, plainText);
-}
-
-GpgME::DecryptionResult QGpgME::QGpgMEDecryptJob::exec(const QByteArray &cipherText,
- QByteArray &plainText)
-{
- const result_type r = decrypt_qba(context(), cipherText);
- plainText = std::get<1>(r);
- return std::get<0>(r);
-}
-
-#include "qgpgmedecryptjob.moc"
diff --git a/lang/qt/src/qgpgmedecryptjob.h b/lang/qt/src/qgpgmedecryptjob.h
deleted file mode 100644
index ae489734..00000000
--- a/lang/qt/src/qgpgmedecryptjob.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- qgpgmedecryptjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMEDECRYPTJOB_H__
-#define __QGPGME_QGPGMEDECRYPTJOB_H__
-
-#include "decryptjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/decryptionresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMEDecryptJob
-#ifdef Q_MOC_RUN
- : public DecryptJob
-#else
- : public _detail::ThreadedJobMixin<DecryptJob, std::tuple<GpgME::DecryptionResult, QByteArray, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-private Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEDecryptJob(GpgME::Context *context);
- ~QGpgMEDecryptJob();
-
- /* from DecryptJob */
- GpgME::Error start(const QByteArray &cipherText) override;
-
- /* from DecryptJob */
- void start(const std::shared_ptr<QIODevice> &cipherText, const std::shared_ptr<QIODevice> &plainText) override;
-
- /* from DecryptJob */
- GpgME::DecryptionResult exec(const QByteArray &cipherText,
- QByteArray &plainText) override;
-};
-
-}
-#endif // __QGPGME_QGPGMEDECRYPTJOB_H__
diff --git a/lang/qt/src/qgpgmedecryptverifyarchivejob.cpp b/lang/qt/src/qgpgmedecryptverifyarchivejob.cpp
deleted file mode 100644
index 10f07e53..00000000
--- a/lang/qt/src/qgpgmedecryptverifyarchivejob.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- qgpgmedecryptverifyarchivejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmedecryptverifyarchivejob.h"
-
-#include "dataprovider.h"
-#include "decryptverifyarchivejob_p.h"
-
-#include <QFile>
-
-#include <gpgme++/data.h>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMEDecryptVerifyArchiveJobPrivate : public DecryptVerifyArchiveJobPrivate
-{
- QGpgMEDecryptVerifyArchiveJob *q = nullptr;
-
-public:
- QGpgMEDecryptVerifyArchiveJobPrivate(QGpgMEDecryptVerifyArchiveJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMEDecryptVerifyArchiveJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override;
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMEDecryptVerifyArchiveJob::QGpgMEDecryptVerifyArchiveJob(Context *context)
- : mixin_type{context}
-{
- setJobPrivate(this, std::unique_ptr<QGpgMEDecryptVerifyArchiveJobPrivate>{new QGpgMEDecryptVerifyArchiveJobPrivate{this}});
- lateInitialization();
- connect(this, &Job::rawProgress, this, [this](const QString &what, int type, int current, int total) {
- emitArchiveProgressSignals(this, what, type, current, total);
- });
-}
-
-static QGpgMEDecryptVerifyArchiveJob::result_type decrypt_verify(Context *ctx,
- const GpgME::Data &indata,
- const QString &outputDirectory)
-{
- Data outdata;
- if (!outputDirectory.isEmpty()) {
- outdata.setFileName(outputDirectory.toStdString());
- }
-
- const auto res = ctx->decryptAndVerify(indata, outdata, Context::DecryptArchive);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res.first, res.second, log, ae);
-}
-
-static QGpgMEDecryptVerifyArchiveJob::result_type decrypt_verify_from_io_device(Context *ctx,
- QThread *thread,
- const std::weak_ptr<QIODevice> &cipherText_,
- const QString &outputDirectory)
-{
- const std::shared_ptr<QIODevice> cipherText = cipherText_.lock();
- const _detail::ToThreadMover ctMover(cipherText, thread);
- QGpgME::QIODeviceDataProvider in{cipherText};
- Data indata(&in);
- if (!cipherText->isSequential()) {
- indata.setSizeHint(cipherText->size());
- }
-
- return decrypt_verify(ctx, indata, outputDirectory);
-}
-
-static QGpgMEDecryptVerifyArchiveJob::result_type decrypt_verify_from_file_name(Context *ctx,
- const QString &inputFile,
- const QString &outputDirectory,
- bool processAllSignatures)
-{
- Data indata;
-#ifdef Q_OS_WIN
- indata.setFileName(inputFile.toUtf8().constData());
-#else
- indata.setFileName(QFile::encodeName(inputFile).constData());
-#endif
-
- if (processAllSignatures) {
- ctx->setFlag("proc-all-sigs", "1");
- }
- return decrypt_verify(ctx, indata, outputDirectory);
-}
-
-GpgME::Error QGpgMEDecryptVerifyArchiveJob::start(const std::shared_ptr<QIODevice> &cipherText)
-{
- if (!cipherText) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- if (processAllSignatures()) {
- context()->setFlag("proc-all-sigs", "1");
- }
- run(std::bind(&decrypt_verify_from_io_device,
- std::placeholders::_1,
- std::placeholders::_2,
- std::placeholders::_3,
- outputDirectory()),
- cipherText);
- return {};
-}
-
-GpgME::Error QGpgMEDecryptVerifyArchiveJobPrivate::startIt()
-{
- if (m_inputFilePath.isEmpty()) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- q->run([=](Context *ctx) {
- return decrypt_verify_from_file_name(ctx, m_inputFilePath, m_outputDirectory, m_processAllSignatures);
- });
-
- return {};
-}
-
-#include "qgpgmedecryptverifyarchivejob.moc"
diff --git a/lang/qt/src/qgpgmedecryptverifyarchivejob.h b/lang/qt/src/qgpgmedecryptverifyarchivejob.h
deleted file mode 100644
index 50ca0839..00000000
--- a/lang/qt/src/qgpgmedecryptverifyarchivejob.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- qgpgmedecryptverifyarchivejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMEDECRYPTVERIFYARCHIVEJOB_H__
-#define __QGPGME_QGPGMEDECRYPTVERIFYARCHIVEJOB_H__
-
-#include "decryptverifyarchivejob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/decryptionresult.h>
-#include <gpgme++/verificationresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMEDecryptVerifyArchiveJob
-#ifdef Q_MOC_RUN
- : public DecryptVerifyArchiveJob
-#else
- : public _detail::ThreadedJobMixin<DecryptVerifyArchiveJob, std::tuple<GpgME::DecryptionResult, GpgME::VerificationResult, QString, GpgME::Error>>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEDecryptVerifyArchiveJob(GpgME::Context *context);
- ~QGpgMEDecryptVerifyArchiveJob() = default;
-
- GpgME::Error start(const std::shared_ptr<QIODevice> &cipherText) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEDECRYPTVERIFYARCHIVEJOB_H__
diff --git a/lang/qt/src/qgpgmedecryptverifyjob.cpp b/lang/qt/src/qgpgmedecryptverifyjob.cpp
deleted file mode 100644
index e8d2ad4e..00000000
--- a/lang/qt/src/qgpgmedecryptverifyjob.cpp
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- qgpgmedecryptverifyjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmedecryptverifyjob.h"
-
-#include "dataprovider.h"
-#include "debug.h"
-#include "decryptverifyjob_p.h"
-#include "util.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/decryptionresult.h>
-#include <gpgme++/verificationresult.h>
-#include <gpgme++/data.h>
-
-#include <QDebug>
-#include "qgpgme_debug.h"
-
-#include <QBuffer>
-#include <QFile>
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMEDecryptVerifyJobPrivate : public DecryptVerifyJobPrivate
-{
- QGpgMEDecryptVerifyJob *q = nullptr;
-
-public:
- QGpgMEDecryptVerifyJobPrivate(QGpgMEDecryptVerifyJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMEDecryptVerifyJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override;
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMEDecryptVerifyJob::QGpgMEDecryptVerifyJob(Context *context)
- : mixin_type(context)
-{
- setJobPrivate(this, std::unique_ptr<QGpgMEDecryptVerifyJobPrivate>{new QGpgMEDecryptVerifyJobPrivate{this}});
- lateInitialization();
-}
-
-QGpgMEDecryptVerifyJob::~QGpgMEDecryptVerifyJob() {}
-
-static QGpgMEDecryptVerifyJob::result_type decrypt_verify(Context *ctx, QThread *thread,
- const std::weak_ptr<QIODevice> &cipherText_,
- const std::weak_ptr<QIODevice> &plainText_)
-{
- qCDebug(QGPGME_LOG) << __func__;
-
- const std::shared_ptr<QIODevice> cipherText = cipherText_.lock();
- const std::shared_ptr<QIODevice> plainText = plainText_.lock();
-
- const _detail::ToThreadMover ctMover(cipherText, thread);
- const _detail::ToThreadMover ptMover(plainText, thread);
-
- QGpgME::QIODeviceDataProvider in(cipherText);
- Data indata(&in);
- if (!cipherText->isSequential()) {
- indata.setSizeHint(cipherText->size());
- }
-
- if (!plainText) {
- QGpgME::QByteArrayDataProvider out;
- Data outdata(&out);
-
- const std::pair<DecryptionResult, VerificationResult> res = ctx->decryptAndVerify(indata, outdata);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- qCDebug(QGPGME_LOG) << __func__ << "- End no plainText. Error:" << ae;
- return std::make_tuple(res.first, res.second, out.data(), log, ae);
- } else {
- QGpgME::QIODeviceDataProvider out(plainText);
- Data outdata(&out);
-
- const std::pair<DecryptionResult, VerificationResult> res = ctx->decryptAndVerify(indata, outdata);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- qCDebug(QGPGME_LOG) << __func__ << "- End plainText. Error:" << ae;
- return std::make_tuple(res.first, res.second, QByteArray(), log, ae);
- }
-}
-
-static QGpgMEDecryptVerifyJob::result_type decrypt_verify_qba(Context *ctx, const QByteArray &cipherText)
-{
- const std::shared_ptr<QBuffer> buffer(new QBuffer);
- buffer->setData(cipherText);
- if (!buffer->open(QIODevice::ReadOnly)) {
- assert(!"This should never happen: QBuffer::open() failed");
- }
- return decrypt_verify(ctx, nullptr, buffer, std::shared_ptr<QIODevice>());
-}
-
-static QGpgMEDecryptVerifyJob::result_type decrypt_verify_from_filename(Context *ctx,
- const QString &inputFilePath,
- const QString &outputFilePath,
- bool processAllSignatures)
-{
- Data indata;
-#ifdef Q_OS_WIN
- indata.setFileName(inputFilePath.toUtf8().constData());
-#else
- indata.setFileName(QFile::encodeName(inputFilePath).constData());
-#endif
-
- PartialFileGuard partFileGuard{outputFilePath};
- if (partFileGuard.tempFileName().isEmpty()) {
- return std::make_tuple(DecryptionResult{Error::fromCode(GPG_ERR_EEXIST)}, VerificationResult{Error::fromCode(GPG_ERR_EEXIST)}, QByteArray{}, QString{}, Error{});
- }
-
- Data outdata;
-#ifdef Q_OS_WIN
- outdata.setFileName(partFileGuard.tempFileName().toUtf8().constData());
-#else
- outdata.setFileName(QFile::encodeName(partFileGuard.tempFileName()).constData());
-#endif
-
- if (processAllSignatures) {
- ctx->setFlag("proc-all-sigs", "1");
- }
- const auto results = ctx->decryptAndVerify(indata, outdata);
- const auto &decryptionResult = results.first;
- const auto &verificationResult = results.second;
-
- if (!decryptionResult.error().code() && !verificationResult.error().code()) {
- // the operation succeeded -> save the result under the requested file name
- partFileGuard.commit();
- }
-
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(decryptionResult, verificationResult, QByteArray{}, log, ae);
-}
-
-Error QGpgMEDecryptVerifyJob::start(const QByteArray &cipherText)
-{
- if (processAllSignatures()) {
- context()->setFlag("proc-all-sigs", "1");
- }
- run(std::bind(&decrypt_verify_qba, std::placeholders::_1, cipherText));
- return Error();
-}
-
-void QGpgMEDecryptVerifyJob::start(const std::shared_ptr<QIODevice> &cipherText, const std::shared_ptr<QIODevice> &plainText)
-{
- if (processAllSignatures()) {
- context()->setFlag("proc-all-sigs", "1");
- }
- run(std::bind(&decrypt_verify, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4), cipherText, plainText);
-}
-
-std::pair<GpgME::DecryptionResult, GpgME::VerificationResult>
-QGpgME::QGpgMEDecryptVerifyJob::exec(const QByteArray &cipherText, QByteArray &plainText)
-{
- if (processAllSignatures()) {
- context()->setFlag("proc-all-sigs", "1");
- }
- const result_type r = decrypt_verify_qba(context(), cipherText);
- plainText = std::get<2>(r);
- return std::make_pair(std::get<0>(r), std::get<1>(r));
-}
-
-GpgME::Error QGpgMEDecryptVerifyJobPrivate::startIt()
-{
- if (m_inputFilePath.isEmpty() || m_outputFilePath.isEmpty()) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- q->run([=](Context *ctx) {
- return decrypt_verify_from_filename(ctx, m_inputFilePath, m_outputFilePath, m_processAllSignatures);
- });
-
- return {};
-}
-
-#include "qgpgmedecryptverifyjob.moc"
diff --git a/lang/qt/src/qgpgmedecryptverifyjob.h b/lang/qt/src/qgpgmedecryptverifyjob.h
deleted file mode 100644
index 1a1721df..00000000
--- a/lang/qt/src/qgpgmedecryptverifyjob.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- qgpgmedecryptverifyjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMEDECRYPTVERIFYJOB_H__
-#define __QGPGME_QGPGMEDECRYPTVERIFYJOB_H__
-
-#include "decryptverifyjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/decryptionresult.h>
-#include <gpgme++/verificationresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMEDecryptVerifyJob
-#ifdef Q_MOC_RUN
- : public DecryptVerifyJob
-#else
- : public _detail::ThreadedJobMixin<DecryptVerifyJob, std::tuple<GpgME::DecryptionResult, GpgME::VerificationResult, QByteArray, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-private Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEDecryptVerifyJob(GpgME::Context *context);
- ~QGpgMEDecryptVerifyJob();
-
- /* from DecryptVerifyJob */
- GpgME::Error start(const QByteArray &cipherText) override;
-
- /* from DecryptVerifyJob */
- void start(const std::shared_ptr<QIODevice> &cipherText, const std::shared_ptr<QIODevice> &plainText) override;
-
- /* from DecryptVerifyJob */
- std::pair<GpgME::DecryptionResult, GpgME::VerificationResult>
- exec(const QByteArray &cipherText, QByteArray &plainText) override;
-};
-
-}
-#endif // __QGPGME_QGPGMEDECRYPTVERIFYJOB_H__
diff --git a/lang/qt/src/qgpgmedeletejob.cpp b/lang/qt/src/qgpgmedeletejob.cpp
deleted file mode 100644
index 16f822b5..00000000
--- a/lang/qt/src/qgpgmedeletejob.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- qgpgmedeletejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmedeletejob.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/key.h>
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEDeleteJob::QGpgMEDeleteJob(Context *context)
- : mixin_type(context)
-{
- lateInitialization();
-}
-
-QGpgMEDeleteJob::~QGpgMEDeleteJob() {}
-
-static QGpgMEDeleteJob::result_type delete_key(Context *ctx, const Key &key, bool allowSecretKeyDeletion)
-{
- const Error err = ctx->deleteKey(key, allowSecretKeyDeletion);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(err, log, ae);
-}
-
-Error QGpgMEDeleteJob::start(const Key &key, bool allowSecretKeyDeletion)
-{
- run(std::bind(&delete_key, std::placeholders::_1, key, allowSecretKeyDeletion));
- return Error();
-}
-#include "qgpgmedeletejob.moc"
diff --git a/lang/qt/src/qgpgmedeletejob.h b/lang/qt/src/qgpgmedeletejob.h
deleted file mode 100644
index 6228a50c..00000000
--- a/lang/qt/src/qgpgmedeletejob.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- qgpgmedeletejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMEDELETEJOB_H__
-#define __QGPGME_QGPGMEDELETEJOB_H__
-
-#include "deletejob.h"
-
-#include "threadedjobmixin.h"
-
-namespace GpgME
-{
-class Key;
-}
-
-namespace QGpgME
-{
-
-class QGpgMEDeleteJob
-#ifdef Q_MOC_RUN
- : public DeleteJob
-#else
- : public _detail::ThreadedJobMixin<DeleteJob>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEDeleteJob(GpgME::Context *context);
- ~QGpgMEDeleteJob();
-
- /* from DeleteJob */
- GpgME::Error start(const GpgME::Key &key, bool allowSecretKeyDeletion) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEDELETEJOB_H__
diff --git a/lang/qt/src/qgpgmedownloadjob.cpp b/lang/qt/src/qgpgmedownloadjob.cpp
deleted file mode 100644
index d7c608f4..00000000
--- a/lang/qt/src/qgpgmedownloadjob.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- qgpgmedownloadjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmedownloadjob.h"
-
-#include "dataprovider.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-
-#include <QStringList>
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEDownloadJob::QGpgMEDownloadJob(Context *context)
- : mixin_type(context)
-{
- lateInitialization();
-}
-
-QGpgMEDownloadJob::~QGpgMEDownloadJob() {}
-
-static QGpgMEDownloadJob::result_type download_qsl(Context *ctx, const QStringList &pats)
-{
- QGpgME::QByteArrayDataProvider dp;
- Data data(&dp);
-
- const _detail::PatternConverter pc(pats);
-
- const Error err = ctx->exportPublicKeys(pc.patterns(), data);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(err, dp.data(), log, ae);
-}
-
-static QGpgMEDownloadJob::result_type download(Context *ctx, QThread *thread, const QByteArray &fpr, const std::weak_ptr<QIODevice> &keyData_)
-{
- const std::shared_ptr<QIODevice> keyData = keyData_.lock();
- if (!keyData) {
- return download_qsl(ctx, QStringList(QString::fromUtf8(fpr)));
- }
-
- const _detail::ToThreadMover kdMover(keyData, thread);
-
- QGpgME::QIODeviceDataProvider dp(keyData);
- Data data(&dp);
-
- const _detail::PatternConverter pc(fpr);
-
- const Error err = ctx->exportPublicKeys(pc.patterns(), data);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(err, QByteArray(), log, ae);
-}
-
-Error QGpgMEDownloadJob::start(const QStringList &pats)
-{
- run(std::bind(&download_qsl, std::placeholders::_1, pats));
- return Error();
-}
-
-Error QGpgMEDownloadJob::start(const QByteArray &fpr, const std::shared_ptr<QIODevice> &keyData)
-{
- run(std::bind(&download, std::placeholders::_1, std::placeholders::_2, fpr, std::placeholders::_3), keyData);
- return Error();
-}
-#include "qgpgmedownloadjob.moc"
diff --git a/lang/qt/src/qgpgmedownloadjob.h b/lang/qt/src/qgpgmedownloadjob.h
deleted file mode 100644
index 8aab7479..00000000
--- a/lang/qt/src/qgpgmedownloadjob.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- qgpgmedownloadjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMEDOWNLOADJOB_H__
-#define __QGPGME_QGPGMEDOWNLOADJOB_H__
-
-#include "downloadjob.h"
-
-#include "threadedjobmixin.h"
-
-namespace QGpgME
-{
-
-class QGpgMEDownloadJob
-#ifdef Q_MOC_RUN
- : public DownloadJob
-#else
- : public _detail::ThreadedJobMixin<DownloadJob, std::tuple<GpgME::Error, QByteArray, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEDownloadJob(GpgME::Context *context);
- ~QGpgMEDownloadJob();
-
- /* from DownloadJob */
- GpgME::Error start(const QStringList &fingerprints) override;
-
- /* from DownloadJob */
- GpgME::Error start(const QByteArray &fingerprint, const std::shared_ptr<QIODevice> &keyData) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEDOWNLOADJOB_H__
diff --git a/lang/qt/src/qgpgmeencryptarchivejob.cpp b/lang/qt/src/qgpgmeencryptarchivejob.cpp
deleted file mode 100644
index 02b9e587..00000000
--- a/lang/qt/src/qgpgmeencryptarchivejob.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- qgpgmeencryptarchivejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2007,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2022,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmeencryptarchivejob.h"
-
-#include "dataprovider.h"
-#include "encryptarchivejob_p.h"
-#include "filelistdataprovider.h"
-#include "qgpgme_debug.h"
-#include "util.h"
-
-#include <QFile>
-
-#include <gpgme++/data.h>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMEEncryptArchiveJobPrivate : public EncryptArchiveJobPrivate
-{
- QGpgMEEncryptArchiveJob *q = nullptr;
-
-public:
- QGpgMEEncryptArchiveJobPrivate(QGpgMEEncryptArchiveJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMEEncryptArchiveJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override;
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMEEncryptArchiveJob::QGpgMEEncryptArchiveJob(Context *context)
- : mixin_type{context}
-{
- setJobPrivate(this, std::unique_ptr<QGpgMEEncryptArchiveJobPrivate>{new QGpgMEEncryptArchiveJobPrivate{this}});
- lateInitialization();
- connect(this, &Job::rawProgress, this, [this](const QString &what, int type, int current, int total) {
- emitArchiveProgressSignals(this, what, type, current, total);
- });
-}
-
-static QGpgMEEncryptArchiveJob::result_type encrypt(Context *ctx,
- const std::vector<Key> &recipients,
- const std::vector<QString> &paths,
- GpgME::Data &outdata,
- Context::EncryptionFlags flags,
- const QString &baseDirectory)
-{
- QGpgME::FileListDataProvider in{paths};
- Data indata(&in);
- if (!baseDirectory.isEmpty()) {
- indata.setFileName(baseDirectory.toStdString());
- }
-
- flags = static_cast<Context::EncryptionFlags>(flags | Context::EncryptArchive);
- const auto encryptionResult = ctx->encrypt(recipients, indata, outdata, flags);
-
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(encryptionResult, log, ae);
-}
-
-static QGpgMEEncryptArchiveJob::result_type encrypt_to_io_device(Context *ctx,
- QThread *thread,
- const std::vector<Key> &recipients,
- const std::vector<QString> &paths,
- const std::weak_ptr<QIODevice> &cipherText_,
- Context::EncryptionFlags flags,
- const QString &baseDirectory)
-{
- const std::shared_ptr<QIODevice> cipherText = cipherText_.lock();
- const _detail::ToThreadMover ctMover(cipherText, thread);
- QGpgME::QIODeviceDataProvider out{cipherText};
- Data outdata(&out);
-
- return encrypt(ctx, recipients, paths, outdata, flags, baseDirectory);
-}
-
-static QGpgMEEncryptArchiveJob::result_type encrypt_to_filename(Context *ctx,
- const std::vector<Key> &recipients,
- const std::vector<QString> &paths,
- const QString &outputFileName,
- Context::EncryptionFlags flags,
- const QString &baseDirectory)
-{
- PartialFileGuard partFileGuard{outputFileName};
- if (partFileGuard.tempFileName().isEmpty()) {
- return std::make_tuple(EncryptionResult{Error::fromCode(GPG_ERR_EEXIST)}, QString{}, Error{});
- }
-
- Data outdata;
-#ifdef Q_OS_WIN
- outdata.setFileName(partFileGuard.tempFileName().toUtf8().constData());
-#else
- outdata.setFileName(QFile::encodeName(partFileGuard.tempFileName()).constData());
-#endif
-
- const auto result = encrypt(ctx, recipients, paths, outdata, flags, baseDirectory);
- const auto &encryptionResult = std::get<0>(result);
- if (!encryptionResult.error().code()) {
- // the operation succeeded -> save the result under the requested file name
- partFileGuard.commit();
- }
-
- return result;
-}
-
-GpgME::Error QGpgMEEncryptArchiveJob::start(const std::vector<GpgME::Key> &recipients,
- const std::vector<QString> &paths,
- const std::shared_ptr<QIODevice> &cipherText,
- const GpgME::Context::EncryptionFlags flags)
-{
- if (!cipherText) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- run(std::bind(&encrypt_to_io_device,
- std::placeholders::_1,
- std::placeholders::_2,
- recipients,
- paths,
- std::placeholders::_3,
- flags,
- baseDirectory()),
- cipherText);
- return {};
-}
-
-GpgME::Error QGpgMEEncryptArchiveJobPrivate::startIt()
-{
- if (m_outputFilePath.isEmpty()) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- q->run([=](Context *ctx) {
- return encrypt_to_filename(ctx, m_recipients, m_inputPaths, m_outputFilePath, m_encryptionFlags, m_baseDirectory);
- });
-
- return {};
-}
-
-#include "qgpgmeencryptarchivejob.moc"
diff --git a/lang/qt/src/qgpgmeencryptarchivejob.h b/lang/qt/src/qgpgmeencryptarchivejob.h
deleted file mode 100644
index 6b818f20..00000000
--- a/lang/qt/src/qgpgmeencryptarchivejob.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- qgpgmeencryptarchivejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMEENCRYPTARCHIVEJOB_H__
-#define __QGPGME_QGPGMEENCRYPTARCHIVEJOB_H__
-
-#include "encryptarchivejob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/encryptionresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMEEncryptArchiveJob
-#ifdef Q_MOC_RUN
- : public EncryptArchiveJob
-#else
- : public _detail::ThreadedJobMixin<EncryptArchiveJob, std::tuple<GpgME::EncryptionResult, QString, GpgME::Error>>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEEncryptArchiveJob(GpgME::Context *context);
- ~QGpgMEEncryptArchiveJob() = default;
-
- GpgME::Error start(const std::vector<GpgME::Key> &recipients,
- const std::vector<QString> &paths,
- const std::shared_ptr<QIODevice> &cipherText,
- const GpgME::Context::EncryptionFlags flags) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEENCRYPTARCHIVEJOB_H__
diff --git a/lang/qt/src/qgpgmeencryptjob.cpp b/lang/qt/src/qgpgmeencryptjob.cpp
deleted file mode 100644
index c8dd5f1b..00000000
--- a/lang/qt/src/qgpgmeencryptjob.cpp
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- qgpgmeencryptjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2007,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2022,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmeencryptjob.h"
-
-#include "dataprovider.h"
-#include "encryptjob_p.h"
-#include "util.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/encryptionresult.h>
-
-#include <QBuffer>
-#include <QFileInfo>
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMEEncryptJobPrivate : public EncryptJobPrivate
-{
- QGpgMEEncryptJob *q = nullptr;
-
-public:
- QGpgMEEncryptJobPrivate(QGpgMEEncryptJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMEEncryptJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override;
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMEEncryptJob::QGpgMEEncryptJob(Context *context)
- : mixin_type(context),
- mOutputIsBase64Encoded(false)
-{
- setJobPrivate(this, std::unique_ptr<QGpgMEEncryptJobPrivate>{new QGpgMEEncryptJobPrivate{this}});
- lateInitialization();
-}
-
-QGpgMEEncryptJob::~QGpgMEEncryptJob() {}
-
-void QGpgMEEncryptJob::setOutputIsBase64Encoded(bool on)
-{
- mOutputIsBase64Encoded = on;
-}
-
-static QGpgMEEncryptJob::result_type encrypt(Context *ctx, QThread *thread,
- const std::vector<Key> &recipients,
- const std::weak_ptr<QIODevice> &plainText_,
- const std::weak_ptr<QIODevice> &cipherText_,
- const Context::EncryptionFlags eflags,
- bool outputIsBsse64Encoded,
- Data::Encoding inputEncoding,
- const QString &fileName)
-{
-
- const std::shared_ptr<QIODevice> plainText = plainText_.lock();
- const std::shared_ptr<QIODevice> cipherText = cipherText_.lock();
-
- const _detail::ToThreadMover ctMover(cipherText, thread);
- const _detail::ToThreadMover ptMover(plainText, thread);
-
- QGpgME::QIODeviceDataProvider in(plainText);
- Data indata(&in);
- indata.setEncoding(inputEncoding);
-
- if (!plainText->isSequential()) {
- indata.setSizeHint(plainText->size());
- }
-
- const auto pureFileName = QFileInfo{fileName}.fileName().toStdString();
- if (!pureFileName.empty()) {
- indata.setFileName(pureFileName.c_str());
- }
-
- if (!cipherText) {
- QGpgME::QByteArrayDataProvider out;
- Data outdata(&out);
-
- if (outputIsBsse64Encoded) {
- outdata.setEncoding(Data::Base64Encoding);
- }
-
- const EncryptionResult res = ctx->encrypt(recipients, indata, outdata, eflags);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, out.data(), log, ae);
- } else {
- QGpgME::QIODeviceDataProvider out(cipherText);
- Data outdata(&out);
-
- if (outputIsBsse64Encoded) {
- outdata.setEncoding(Data::Base64Encoding);
- }
-
- const EncryptionResult res = ctx->encrypt(recipients, indata, outdata, eflags);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, QByteArray(), log, ae);
- }
-
-}
-
-static QGpgMEEncryptJob::result_type encrypt_qba(Context *ctx, const std::vector<Key> &recipients, const QByteArray &plainText, const Context::EncryptionFlags eflags, bool outputIsBsse64Encoded, Data::Encoding inputEncoding, const QString &fileName)
-{
- const std::shared_ptr<QBuffer> buffer(new QBuffer);
- buffer->setData(plainText);
- if (!buffer->open(QIODevice::ReadOnly)) {
- assert(!"This should never happen: QBuffer::open() failed");
- }
- return encrypt(ctx, nullptr, recipients, buffer, std::shared_ptr<QIODevice>(), eflags, outputIsBsse64Encoded, inputEncoding, fileName);
-}
-
-static QGpgMEEncryptJob::result_type encrypt_to_filename(Context *ctx,
- const std::vector<Key> &recipients,
- const QString &inputFilePath,
- const QString &outputFilePath,
- Context::EncryptionFlags flags)
-{
- Data indata;
-#ifdef Q_OS_WIN
- indata.setFileName(inputFilePath.toUtf8().constData());
-#else
- indata.setFileName(QFile::encodeName(inputFilePath).constData());
-#endif
-
- PartialFileGuard partFileGuard{outputFilePath};
- if (partFileGuard.tempFileName().isEmpty()) {
- return std::make_tuple(EncryptionResult{Error::fromCode(GPG_ERR_EEXIST)}, QByteArray{}, QString{}, Error{});
- }
-
- Data outdata;
-#ifdef Q_OS_WIN
- outdata.setFileName(partFileGuard.tempFileName().toUtf8().constData());
-#else
- outdata.setFileName(QFile::encodeName(partFileGuard.tempFileName()).constData());
-#endif
-
- flags = static_cast<Context::EncryptionFlags>(flags | Context::EncryptFile);
- const auto encryptionResult = ctx->encrypt(recipients, indata, outdata, flags);
-
- if (!encryptionResult.error().code()) {
- // the operation succeeded -> save the result under the requested file name
- partFileGuard.commit();
- }
-
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(encryptionResult, QByteArray{}, log, ae);
-}
-
-Error QGpgMEEncryptJob::start(const std::vector<Key> &recipients, const QByteArray &plainText, bool alwaysTrust)
-{
- run(std::bind(&encrypt_qba, std::placeholders::_1, recipients, plainText,
- alwaysTrust ? Context::AlwaysTrust : Context::None, mOutputIsBase64Encoded, inputEncoding(), fileName()));
- return Error();
-}
-
-void QGpgMEEncryptJob::start(const std::vector<Key> &recipients, const std::shared_ptr<QIODevice> &plainText,
- const std::shared_ptr<QIODevice> &cipherText, const Context::EncryptionFlags eflags)
-{
- run(std::bind(&encrypt,
- std::placeholders::_1, std::placeholders::_2,
- recipients,
- std::placeholders::_3, std::placeholders::_4,
- eflags,
- mOutputIsBase64Encoded,
- inputEncoding(),
- fileName()),
- plainText, cipherText);
-}
-
-EncryptionResult QGpgMEEncryptJob::exec(const std::vector<Key> &recipients, const QByteArray &plainText,
- const Context::EncryptionFlags eflags, QByteArray &cipherText)
-{
- const result_type r = encrypt_qba(context(), recipients, plainText, eflags, mOutputIsBase64Encoded, inputEncoding(), fileName());
- cipherText = std::get<1>(r);
- return std::get<0>(r);
-}
-
-void QGpgMEEncryptJob::start(const std::vector<Key> &recipients, const std::shared_ptr<QIODevice> &plainText, const std::shared_ptr<QIODevice> &cipherText, bool alwaysTrust)
-{
- return start(recipients, plainText, cipherText, alwaysTrust ? Context::AlwaysTrust : Context::None);
-}
-
-EncryptionResult QGpgMEEncryptJob::exec(const std::vector<Key> &recipients, const QByteArray &plainText, bool alwaysTrust, QByteArray &cipherText)
-{
- return exec(recipients, plainText, alwaysTrust ? Context::AlwaysTrust : Context::None, cipherText);
-}
-
-GpgME::Error QGpgMEEncryptJobPrivate::startIt()
-{
- if (m_inputFilePath.isEmpty() || m_outputFilePath.isEmpty()) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- q->run([=](Context *ctx) {
- return encrypt_to_filename(ctx, m_recipients, m_inputFilePath, m_outputFilePath, m_encryptionFlags);
- });
-
- return {};
-}
-
-#include "qgpgmeencryptjob.moc"
diff --git a/lang/qt/src/qgpgmeencryptjob.h b/lang/qt/src/qgpgmeencryptjob.h
deleted file mode 100644
index 4fcb0c69..00000000
--- a/lang/qt/src/qgpgmeencryptjob.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- qgpgmeencryptjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2007,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMEENCRYPTJOB_H__
-#define __QGPGME_QGPGMEENCRYPTJOB_H__
-
-#include "encryptjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/encryptionresult.h>
-#include <gpgme++/key.h>
-
-namespace QGpgME
-{
-
-class QGpgMEEncryptJob
-#ifdef Q_MOC_RUN
- : public EncryptJob
-#else
- : public _detail::ThreadedJobMixin<EncryptJob, std::tuple<GpgME::EncryptionResult, QByteArray, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEEncryptJob(GpgME::Context *context);
- ~QGpgMEEncryptJob();
-
- /* from EncryptJob */
- GpgME::Error start(const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText, bool alwaysTrust) override;
-
- /* from EncryptJob */
- void start(const std::vector<GpgME::Key> &recipients,
- const std::shared_ptr<QIODevice> &plainText,
- const std::shared_ptr<QIODevice> &cipherText,
- bool alwaysTrust) override;
-
- /* from EncryptJob */
- GpgME::EncryptionResult exec(const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText, bool alwaysTrust,
- QByteArray &cipherText) override;
- /* from EncryptJob */
- void start(const std::vector<GpgME::Key> &recipients,
- const std::shared_ptr<QIODevice> &plainText,
- const std::shared_ptr<QIODevice> &cipherText,
- const GpgME::Context::EncryptionFlags flags) override;
-
- /* from EncryptJob */
- GpgME::EncryptionResult exec(const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText, const GpgME::Context::EncryptionFlags flags,
- QByteArray &cipherText) override;
-
- /* from EncryptJob */
- void setOutputIsBase64Encoded(bool on) override;
-
-private:
- bool mOutputIsBase64Encoded;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEENCRYPTJOB_H__
diff --git a/lang/qt/src/qgpgmeexportjob.cpp b/lang/qt/src/qgpgmeexportjob.cpp
deleted file mode 100644
index 239b46b0..00000000
--- a/lang/qt/src/qgpgmeexportjob.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- qgpgmeexportjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2022 by g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmeexportjob.h"
-
-#include "dataprovider.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/key.h>
-
-#include <QStringList>
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEExportJob::QGpgMEExportJob(Context *context)
- : QGpgMEExportJob{context, 0}
-{
-}
-
-QGpgMEExportJob::QGpgMEExportJob(Context *context, unsigned int forcedMode)
- : mixin_type{context}
- , m_exportMode{forcedMode}
- , m_additionalExportModeFlags{0}
-{
- lateInitialization();
-}
-
-QGpgMEExportJob::~QGpgMEExportJob() = default;
-
-static QGpgMEExportJob::result_type export_qba(Context *ctx, const QStringList &patterns, unsigned int mode)
-{
- const _detail::PatternConverter pc(patterns);
-
- QGpgME::QByteArrayDataProvider dp;
- Data data(&dp);
-
- const Error err = ctx->exportKeys(pc.patterns(), data, mode);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(err, dp.data(), log, ae);
-}
-
-Error QGpgMEExportJob::start(const QStringList &patterns)
-{
- auto mode = m_exportMode | m_additionalExportModeFlags;
- run(std::bind(&export_qba, std::placeholders::_1, patterns, mode));
- return Error();
-}
-
-Error QGpgMEExportJob::exec(const QStringList &patterns, QByteArray &data)
-{
- auto mode = m_exportMode | m_additionalExportModeFlags;
- const result_type r = export_qba(context(), patterns, mode);
- data = std::get<1>(r);
- return std::get<0>(r);
-}
-
-void QGpgMEExportJob::setExportFlags(unsigned int flags)
-{
- m_additionalExportModeFlags = flags;
-}
-
-/* For ABI compat not pure virtual. */
-void ExportJob::setExportFlags(unsigned int)
-{
-}
-
-/* For ABI compat not pure virtual. */
-GpgME::Error ExportJob::exec(const QStringList &, QByteArray &)
-{
- return Error();
-}
-
-#include "qgpgmeexportjob.moc"
diff --git a/lang/qt/src/qgpgmeexportjob.h b/lang/qt/src/qgpgmeexportjob.h
deleted file mode 100644
index b60b95f2..00000000
--- a/lang/qt/src/qgpgmeexportjob.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- qgpgmeexportjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2022 by g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMEEXPORTJOB_H__
-#define __QGPGME_QGPGMEEXPORTJOB_H__
-
-#include "exportjob.h"
-
-#include "threadedjobmixin.h"
-
-namespace QGpgME
-{
-
-class QGpgMEExportJob
-#ifdef Q_MOC_RUN
- : public ExportJob
-#else
- : public _detail::ThreadedJobMixin<ExportJob, std::tuple<GpgME::Error, QByteArray, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEExportJob(GpgME::Context *context);
- // Creates an export job with forced export mode @p exportMode. The
- // export mode flags set with @p exportMode cannot be overridden with
- // setExportFlags.
- explicit QGpgMEExportJob(GpgME::Context *context, unsigned int exportMode);
- ~QGpgMEExportJob() override;
-
- /* from ExportJob */
- void setExportFlags(unsigned int flags) override;
-
- /* from ExportJob */
- GpgME::Error start(const QStringList &patterns) override;
- GpgME::Error exec(const QStringList &patterns, QByteArray &data) override;
-
-private:
- unsigned int m_exportMode;
- unsigned int m_additionalExportModeFlags;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEEXPORTJOB_H__
diff --git a/lang/qt/src/qgpgmegpgcardjob.cpp b/lang/qt/src/qgpgmegpgcardjob.cpp
deleted file mode 100644
index 2bed23c2..00000000
--- a/lang/qt/src/qgpgmegpgcardjob.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- qgpgmegpgcardjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2020 g10 Code GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmegpgcardjob.h"
-
-#include <QStringList>
-#include <QFileInfo>
-#include <QDir>
-#include <QProcess>
-#include "util.h"
-#include "qgpgme_debug.h"
-
-/* We cannot have a timeout because key generation can
- * take ages. Well maybe 10 minutes. */
-#define TIMEOUT_VALUE (600000)
-
-#include <tuple>
-
-using namespace GpgME;
-using namespace QGpgME;
-
-QGpgMEGpgCardJob::QGpgMEGpgCardJob()
- : mixin_type(/* needed for the mixer */
- Context::createForEngine(GpgME::SpawnEngine).release())
-{
- lateInitialization();
-}
-
-QGpgMEGpgCardJob::~QGpgMEGpgCardJob() {}
-
-static QString getGpgCardPath()
-{
- auto bindir = QString::fromLocal8Bit(dirInfo("bindir"));
- if (bindir.isEmpty()) {
- return QString();
- }
-
- const QFileInfo fi(QDir(bindir).absoluteFilePath(QStringLiteral("gpg-card")));
- if (fi.exists() && fi.isExecutable()) {
- return fi.absoluteFilePath();
- }
- return QString();
-}
-
-static QGpgMEGpgCardJob::result_type do_work(const QStringList &cmds, const QString &path)
-{
- QStringList args;
- args << QStringLiteral("--with-colons");
- args += cmds;
-
- QProcess proc;
-
- proc.setProgram(path);
- proc.setArguments(args);
-
- qCDebug(QGPGME_LOG) << "Executing:" << path << args;
- proc.start();
- if (!proc.waitForStarted()) {
- return std::make_tuple (QString(), QString(), 1, QString(), Error());
- }
-
- if (!proc.waitForFinished(TIMEOUT_VALUE)) {
- return std::make_tuple (QString(), QString(), 1, QString(), Error());
- }
- if (proc.exitStatus() == QProcess::NormalExit) {
- return std::make_tuple (QString::fromUtf8(proc.readAllStandardOutput()),
- QString::fromUtf8(proc.readAllStandardError()), proc.exitCode(),
- QString(), Error());
- }
- return std::make_tuple (QString::fromUtf8(proc.readAllStandardOutput()),
- QString::fromUtf8(proc.readAllStandardError()), 1,
- QString(), Error());
-}
-
-Error QGpgMEGpgCardJob::start(const QStringList &cmds)
-{
- const auto cardpath = getGpgCardPath ();
- if (cardpath.isEmpty()) {
- return Error(make_error(GPG_ERR_NOT_SUPPORTED));
- }
- run(std::bind(&do_work, cmds, cardpath));
- return Error();
-}
-
-Error QGpgMEGpgCardJob::exec(const QStringList &cmds, QString &std_out, QString &std_err, int &exitCode)
-{
- const auto cardpath = getGpgCardPath ();
- if (cardpath.isEmpty()) {
- return Error(make_error(GPG_ERR_NOT_SUPPORTED));
- }
- const result_type r = do_work(cmds, cardpath);
- std_out = std::get<0>(r);
- std_err = std::get<1>(r);
- exitCode = std::get<2>(r);
- return exitCode == 0 ? Error() : Error(make_error(GPG_ERR_GENERAL));
-}
-
-#include "qgpgmegpgcardjob.moc"
diff --git a/lang/qt/src/qgpgmegpgcardjob.h b/lang/qt/src/qgpgmegpgcardjob.h
deleted file mode 100644
index c78c0ee5..00000000
--- a/lang/qt/src/qgpgmegpgcardjob.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* qgpgmegpgcardjob.h
-
- This file is part of libkleopatra, the KDE keymanagement library
- Copyright (c) 2020 g10 Code GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMEGPGCARDJOB_H__
-#define __QGPGME_QGPGMEGPGCARDJOB_H__
-#include "gpgcardjob.h"
-
-#include "threadedjobmixin.h"
-
-namespace QGpgME
-{
-
-class QGpgMEGpgCardJob
-#ifdef Q_MOC_RUN
- : public GpgCardJob
-#else
- : public _detail::ThreadedJobMixin<GpgCardJob, std::tuple<QString, QString, int, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEGpgCardJob();
- ~QGpgMEGpgCardJob();
-
- GpgME::Error start(const QStringList &cmds) override;
-
- GpgME::Error exec(const QStringList &cmds, QString &std_out, QString &std_err, int &exitCode) override;
-};
-
-}
-#endif
diff --git a/lang/qt/src/qgpgmeimportfromkeyserverjob.cpp b/lang/qt/src/qgpgmeimportfromkeyserverjob.cpp
deleted file mode 100644
index e5e06b23..00000000
--- a/lang/qt/src/qgpgmeimportfromkeyserverjob.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- qgpgmeimportfromkeyserverjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmeimportfromkeyserverjob.h"
-
-#include "dataprovider.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/key.h>
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEImportFromKeyserverJob::QGpgMEImportFromKeyserverJob(Context *context)
- : mixin_type(context)
-{
- lateInitialization();
-}
-
-QGpgMEImportFromKeyserverJob::~QGpgMEImportFromKeyserverJob() {}
-
-static QGpgMEImportFromKeyserverJob::result_type importfromkeyserver(Context *ctx, const std::vector<Key> &keys)
-{
- const ImportResult res = ctx->importKeys(keys);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, log, ae);
-}
-
-Error QGpgMEImportFromKeyserverJob::start(const std::vector<Key> &keys)
-{
- run(std::bind(&importfromkeyserver, std::placeholders::_1, keys));
- return Error();
-}
-
-GpgME::ImportResult QGpgME::QGpgMEImportFromKeyserverJob::exec(const std::vector<Key> &keys)
-{
- const result_type r = importfromkeyserver(context(), keys);
- return std::get<0>(r);
-}
-
-#include "qgpgmeimportfromkeyserverjob.moc"
diff --git a/lang/qt/src/qgpgmeimportfromkeyserverjob.h b/lang/qt/src/qgpgmeimportfromkeyserverjob.h
deleted file mode 100644
index 917863ed..00000000
--- a/lang/qt/src/qgpgmeimportfromkeyserverjob.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- qgpgmeimportfromkeyserverjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMEIMPORTFROMKEYSERVERJOB_H__
-#define __QGPGME_QGPGMEIMPORTFROMKEYSERVERJOB_H__
-
-#include "importfromkeyserverjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/importresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMEImportFromKeyserverJob
-#ifdef Q_MOC_RUN
- : public ImportFromKeyserverJob
-#else
- : public _detail::ThreadedJobMixin<ImportFromKeyserverJob, std::tuple<GpgME::ImportResult, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEImportFromKeyserverJob(GpgME::Context *context);
- ~QGpgMEImportFromKeyserverJob();
-
- /* from ImportFromKeyserverJob */
- GpgME::Error start(const std::vector<GpgME::Key> &keys) override;
-
- /* from ImportFromKeyserverJob */
- GpgME::ImportResult exec(const std::vector<GpgME::Key> &keys) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEIMPORTFROMKEYSERVERJOB_H__
diff --git a/lang/qt/src/qgpgmeimportjob.cpp b/lang/qt/src/qgpgmeimportjob.cpp
deleted file mode 100644
index 7c33288d..00000000
--- a/lang/qt/src/qgpgmeimportjob.cpp
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- qgpgmeimportjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmeimportjob.h"
-
-#include "importjob_p.h"
-
-#include "dataprovider.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/key.h>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMEImportJobPrivate : public ImportJobPrivate
-{
- QGpgMEImportJob *q = nullptr;
-
-public:
- QGpgMEImportJobPrivate(QGpgMEImportJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMEImportJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override
- {
- Q_ASSERT(!"Not supported by this Job class.");
- return Error::fromCode(GPG_ERR_NOT_SUPPORTED);
- }
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMEImportJob::QGpgMEImportJob(Context *context)
- : mixin_type(context)
-{
- setJobPrivate(this, std::unique_ptr<QGpgMEImportJobPrivate>{new QGpgMEImportJobPrivate{this}});
- lateInitialization();
-}
-
-QGpgMEImportJob::~QGpgMEImportJob() = default;
-
-static const char *originToString(Key::Origin origin)
-{
- static const std::map<Key::Origin, const char *> mapping = {
- { Key::OriginUnknown, "unknown" },
- { Key::OriginKS, "ks" },
- { Key::OriginDane, "dane" },
- { Key::OriginWKD, "wkd" },
- { Key::OriginURL, "url" },
- { Key::OriginFile, "file" },
- { Key::OriginSelf, "self" },
- };
- const auto it = mapping.find(origin);
- return (it != std::end(mapping)) ? it->second : nullptr;
-}
-
-static QGpgMEImportJob::result_type import_qba(Context *ctx, const QByteArray &certData, const QString &importFilter,
- const QStringList &importOptions, Key::Origin keyOrigin,
- const QString &keyOriginUrl)
-{
- if (!importFilter.isEmpty()) {
- ctx->setFlag("import-filter", importFilter.toStdString().c_str());
- }
- if (!importOptions.empty()) {
- ctx->setFlag("import-options", importOptions.join(QLatin1Char{','}).toStdString().c_str());
- }
- if (keyOrigin != Key::OriginUnknown) {
- if (const auto origin = originToString(keyOrigin)) {
- std::string value{origin};
- if (!keyOriginUrl.isEmpty()) {
- value += ",";
- value += keyOriginUrl.toStdString();
- }
- ctx->setFlag("key-origin", value.c_str());
- }
- }
-
- QGpgME::QByteArrayDataProvider dp(certData);
- Data data(&dp);
-
- ImportResult res = ctx->importKeys(data);
- // HACK: If the import failed with an error, then check if res.imports()
- // contains only import statuses with "bad passphrase" error; if yes, this
- // means that the user probably entered a wrong password to decrypt an
- // encrypted key for import. In this case, return a result with "bad
- // passphrase" error instead of the original error.
- // We check if all import statuses instead of any import status has a
- // "bad passphrase" error to avoid breaking imports that partially worked.
- // See https://dev.gnupg.org/T5713.
- const auto imports = res.imports();
- if (res.error() && !imports.empty()
- && std::all_of(std::begin(imports), std::end(imports),
- [](const Import &import) {
- return import.error().code() == GPG_ERR_BAD_PASSPHRASE;
- })) {
- res = ImportResult{Error{GPG_ERR_BAD_PASSPHRASE}};
- }
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, log, ae);
-}
-
-Error QGpgMEImportJob::start(const QByteArray &certData)
-{
- run(std::bind(&import_qba, std::placeholders::_1, certData, importFilter(), importOptions(), keyOrigin(), keyOriginUrl()));
- return Error();
-}
-
-GpgME::ImportResult QGpgME::QGpgMEImportJob::exec(const QByteArray &keyData)
-{
- const result_type r = import_qba(context(), keyData, importFilter(), importOptions(), keyOrigin(), keyOriginUrl());
- return std::get<0>(r);
-}
-
-Error QGpgMEImportJob::startLater(const QByteArray &certData)
-{
- setWorkerFunction(std::bind(&import_qba, std::placeholders::_1, certData, importFilter(), importOptions(), keyOrigin(), keyOriginUrl()));
- return {};
-}
-
-#include "qgpgmeimportjob.moc"
diff --git a/lang/qt/src/qgpgmeimportjob.h b/lang/qt/src/qgpgmeimportjob.h
deleted file mode 100644
index d36fc359..00000000
--- a/lang/qt/src/qgpgmeimportjob.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- qgpgmeimportjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMEIMPORTJOB_H__
-#define __QGPGME_QGPGMEIMPORTJOB_H__
-
-#include "importjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/importresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMEImportJob
-#ifdef Q_MOC_RUN
- : public ImportJob
-#else
- : public _detail::ThreadedJobMixin<ImportJob, std::tuple<GpgME::ImportResult, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEImportJob(GpgME::Context *context);
- ~QGpgMEImportJob();
-
- /* from ImportJob */
- GpgME::Error start(const QByteArray &keyData) override;
-
- /* from ImportJob */
- GpgME::ImportResult exec(const QByteArray &keyData) override;
-
- GpgME::Error startLater(const QByteArray &keyData) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEIMPORTJOB_H__
diff --git a/lang/qt/src/qgpgmekeyformailboxjob.cpp b/lang/qt/src/qgpgmekeyformailboxjob.cpp
deleted file mode 100644
index dca22426..00000000
--- a/lang/qt/src/qgpgmekeyformailboxjob.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- qgpgmekeyformailboxjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmekeyformailboxjob.h"
-#include "qgpgmekeylistjob.h"
-
-#include <QStringList>
-
-#include <tuple>
-
-using namespace GpgME;
-using namespace QGpgME;
-
-QGpgMEKeyForMailboxJob::QGpgMEKeyForMailboxJob(Context *context)
- : mixin_type(context)
-{
- lateInitialization();
-}
-
-QGpgMEKeyForMailboxJob::~QGpgMEKeyForMailboxJob() {}
-
-static bool keyIsOk(const Key k)
-{
- return !k.isExpired() && !k.isRevoked() && !k.isInvalid() && !k.isDisabled();
-}
-
-static bool uidIsOk(const UserID uid)
-{
- return keyIsOk(uid.parent()) && !uid.isRevoked() && !uid.isInvalid();
-}
-
-static bool subkeyIsOk(const Subkey s)
-{
- return !s.isRevoked() && !s.isInvalid() && !s.isDisabled();
-}
-
-static QGpgMEKeyForMailboxJob::result_type do_work(Context *ctx, const QString &mailbox, bool canEncrypt)
-{
- /* Do a Keylisting. */
- ctx->setKeyListMode(GpgME::Locate | GpgME::Signatures | GpgME::Validate);
- std::vector<Key> keys;
- QGpgMEKeyListJob *keylist = new QGpgMEKeyListJob(ctx);
-
- KeyListResult result = keylist->exec(QStringList() << mailbox, false, keys);
-
- if (result.error()) {
- return std::make_tuple(result, Key(), UserID(), QString(), Error());
- }
-
- // This should ideally be decided by GnuPG and this Job changed
- // to just call the according API in GpgME
- // See: https://bugs.gnupg.org/gnupg/issue2359
- Key keyC;
- UserID uidC;
- for (const Key &k : keys) {
- if (canEncrypt && !k.canEncrypt()) {
- continue;
- }
- /* First get the uid that matches the mailbox */
- for (const UserID &u : k.userIDs()) {
- if (QString::fromUtf8(u.email()).toLower() == mailbox.toLower()) {
- if (uidC.isNull()) {
- keyC = k;
- uidC = u;
- } else if ((!uidIsOk(uidC) && uidIsOk(u)) || uidC.validity() < u.validity()) {
- /* Validity of the new key is better. */
- uidC = u;
- keyC = k;
- } else if (uidC.validity() == u.validity() && uidIsOk(u)) {
- /* Both are the same check which one is newer. */
- time_t oldTime = 0;
- for (const Subkey &s : keyC.subkeys()) {
- if ((canEncrypt && s.canEncrypt()) && subkeyIsOk(s)) {
- oldTime = s.creationTime();
- }
- }
- time_t newTime = 0;
- for (const Subkey &s : k.subkeys()) {
- if ((canEncrypt && s.canEncrypt()) && subkeyIsOk(s)) {
- newTime = s.creationTime();
- }
- }
- if (newTime > oldTime) {
- uidC = u;
- keyC = k;
- }
- }
- }
- }
- }
- return std::make_tuple(result, keyC, uidC, QString(), Error());
-}
-
-Error QGpgMEKeyForMailboxJob::start(const QString &mailbox, bool canEncrypt)
-{
- run(std::bind(&do_work, std::placeholders::_1, mailbox, canEncrypt));
- return Error();
-}
-
-KeyListResult QGpgMEKeyForMailboxJob::exec(const QString &mailbox, bool canEncrypt, Key &key, UserID &uid)
-{
- const result_type r = do_work(context(), mailbox, canEncrypt);
- key = std::get<1>(r);
- uid = std::get<2>(r);
- return std::get<0>(r);
-}
-
-#include "qgpgmekeyformailboxjob.moc"
diff --git a/lang/qt/src/qgpgmekeyformailboxjob.h b/lang/qt/src/qgpgmekeyformailboxjob.h
deleted file mode 100644
index 0e8cc1dc..00000000
--- a/lang/qt/src/qgpgmekeyformailboxjob.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- qgpgmekeyformailboxjob.h
-
- This file is part of libkleopatra, the KDE keymanagement library
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMEKEYFORMAILBOXJOB_H__
-#define __QGPGME_QGPGMEKEYFORMAILBOXJOB_H__
-#include "keyformailboxjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/keylistresult.h>
-#include <gpgme++/key.h>
-
-namespace QGpgME
-{
-
-class QGpgMEKeyForMailboxJob
-#ifdef Q_MOC_RUN
- : public KeyForMailboxJob
-#else
- : public _detail::ThreadedJobMixin<KeyForMailboxJob, std::tuple<GpgME::KeyListResult, GpgME::Key, GpgME::UserID, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEKeyForMailboxJob(GpgME::Context *context);
- ~QGpgMEKeyForMailboxJob();
-
- /**
- Starts the operation. \a mailbox is the mailbox to
- look for.
-
- The result is the same as for the LocateKeysJob.
-
- If \a canEncrypt is true, only keys that have a subkey for encryption
- usage are returned. Use this if you need to select a
- key for signing.
- */
- GpgME::Error start(const QString &mailbox, bool canEncrypt = true) override;
-
- GpgME::KeyListResult exec(const QString &mailbox, bool canEncrypt, GpgME::Key &key, GpgME::UserID &uid) override;
-};
-
-}
-#endif
diff --git a/lang/qt/src/qgpgmekeygenerationjob.cpp b/lang/qt/src/qgpgmekeygenerationjob.cpp
deleted file mode 100644
index ce0b4d40..00000000
--- a/lang/qt/src/qgpgmekeygenerationjob.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- qgpgmekeygenerationjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmekeygenerationjob.h"
-
-#include "dataprovider.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEKeyGenerationJob::QGpgMEKeyGenerationJob(Context *context)
- : mixin_type(context)
-{
- lateInitialization();
-}
-
-QGpgMEKeyGenerationJob::~QGpgMEKeyGenerationJob() {}
-
-static QGpgMEKeyGenerationJob::result_type generate_key(Context *ctx, const QString &parameters)
-{
- QGpgME::QByteArrayDataProvider dp;
- Data data = ctx->protocol() == CMS ? Data(&dp) : Data(Data::null);
- assert(data.isNull() == (ctx->protocol() != CMS));
-
- const KeyGenerationResult res = ctx->generateKey(parameters.toUtf8().constData(), data);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, dp.data(), log, ae);
-}
-
-Error QGpgMEKeyGenerationJob::start(const QString &parameters)
-{
- run(std::bind(&generate_key, std::placeholders::_1, parameters));
- return Error();
-}
-#include "qgpgmekeygenerationjob.moc"
diff --git a/lang/qt/src/qgpgmekeygenerationjob.h b/lang/qt/src/qgpgmekeygenerationjob.h
deleted file mode 100644
index 35d5c2f4..00000000
--- a/lang/qt/src/qgpgmekeygenerationjob.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- qgpgmekeygenerationjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMEKEYGENERATIONJOB_H__
-#define __QGPGME_QGPGMEKEYGENERATIONJOB_H__
-
-#include "keygenerationjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/keygenerationresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMEKeyGenerationJob
-#ifdef Q_MOC_RUN
- : public KeyGenerationJob
-#else
- : public _detail::ThreadedJobMixin<KeyGenerationJob, std::tuple<GpgME::KeyGenerationResult, QByteArray, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-private Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEKeyGenerationJob(GpgME::Context *context);
- ~QGpgMEKeyGenerationJob();
-
- /* from KeygenerationJob */
- GpgME::Error start(const QString &parameters) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEKEYGENERATIONJOB_H__
diff --git a/lang/qt/src/qgpgmekeylistjob.cpp b/lang/qt/src/qgpgmekeylistjob.cpp
deleted file mode 100644
index 633cff5b..00000000
--- a/lang/qt/src/qgpgmekeylistjob.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- qgpgmekeylistjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmekeylistjob.h"
-
-#include <gpgme++/key.h>
-#include <gpgme++/context.h>
-#include <gpgme++/keylistresult.h>
-#include <gpg-error.h>
-
-#include <QStringList>
-
-#include <algorithm>
-
-#include <cstdlib>
-#include <cstring>
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEKeyListJob::QGpgMEKeyListJob(Context *context)
- : mixin_type(context)
- , mSecretOnly(false)
-{
- lateInitialization();
-}
-
-QGpgMEKeyListJob::~QGpgMEKeyListJob() {}
-
-static KeyListResult do_list_keys(Context *ctx, const QStringList &pats, std::vector<Key> &keys, bool secretOnly)
-{
-
- const _detail::PatternConverter pc(pats);
-
- if (const Error err = ctx->startKeyListing(pc.patterns(), secretOnly)) {
- return KeyListResult(nullptr, err);
- }
-
- Error err;
- do {
- keys.push_back(ctx->nextKey(err));
- } while (!err);
-
- keys.pop_back();
-
- const KeyListResult result = ctx->endKeyListing();
- ctx->cancelPendingOperation();
- return result;
-}
-
-static QGpgMEKeyListJob::result_type list_keys(Context *ctx, QStringList pats, bool secretOnly)
-{
- if (pats.size() < 2) {
- std::vector<Key> keys;
- const KeyListResult r = do_list_keys(ctx, pats, keys, secretOnly);
- return std::make_tuple(r, keys, QString(), Error());
- }
-
- // The communication channel between gpgme and gpgsm is limited in
- // the number of patterns that can be transported, but they won't
- // say to how much, so we need to find out ourselves if we get a
- // LINE_TOO_LONG error back...
-
- // We could of course just feed them single patterns, and that would
- // probably be easier, but the performance penalty would currently
- // be noticeable.
-
- unsigned int chunkSize = pats.size();
-retry:
- std::vector<Key> keys;
- keys.reserve(pats.size());
- KeyListResult result;
- do {
- const KeyListResult this_result = do_list_keys(ctx, pats.mid(0, chunkSize), keys, secretOnly);
- if (this_result.error().code() == GPG_ERR_LINE_TOO_LONG) {
- // got LINE_TOO_LONG, try a smaller chunksize:
- chunkSize /= 2;
- if (chunkSize < 1)
- // chunks smaller than one can't be -> return the error.
- {
- return std::make_tuple(this_result, keys, QString(), Error());
- } else {
- goto retry;
- }
- } else if (this_result.error().code() == GPG_ERR_EOF) {
- // early end of keylisting (can happen when ~/.gnupg doesn't
- // exist). Fakeing an empty result:
- return std::make_tuple(KeyListResult(), std::vector<Key>(), QString(), Error());
- }
- // ok, that seemed to work...
- result.mergeWith(this_result);
- if (result.error().code()) {
- break;
- }
- pats = pats.mid(chunkSize);
- } while (!pats.empty());
- return std::make_tuple(result, keys, QString(), Error());
-}
-
-Error QGpgMEKeyListJob::start(const QStringList &patterns, bool secretOnly)
-{
- mSecretOnly = secretOnly;
- run(std::bind(&list_keys, std::placeholders::_1, patterns, secretOnly));
- return Error();
-}
-
-KeyListResult QGpgMEKeyListJob::exec(const QStringList &patterns, bool secretOnly, std::vector<Key> &keys)
-{
- mSecretOnly = secretOnly;
- const result_type r = list_keys(context(), patterns, secretOnly);
- resultHook(r);
- keys = std::get<1>(r);
- return std::get<0>(r);
-}
-
-void QGpgMEKeyListJob::resultHook(const result_type &tuple)
-{
- for (const Key &key : std::get<1>(tuple)) {
- Q_EMIT nextKey(key);
- }
-}
-
-void QGpgMEKeyListJob::addMode(KeyListMode mode)
-{
- context()->addKeyListMode(mode);
-}
-
-#include "qgpgmekeylistjob.moc"
diff --git a/lang/qt/src/qgpgmekeylistjob.h b/lang/qt/src/qgpgmekeylistjob.h
deleted file mode 100644
index c1199768..00000000
--- a/lang/qt/src/qgpgmekeylistjob.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- qgpgmekeylistjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMEKEYLISTJOB_H__
-#define __QGPGME_QGPGMEKEYLISTJOB_H__
-
-#include "keylistjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/keylistresult.h>
-#include <gpgme++/key.h>
-
-namespace QGpgME
-{
-
-class QGpgMEKeyListJob
-#ifdef Q_MOC_RUN
- : public KeyListJob
-#else
- : public _detail::ThreadedJobMixin<KeyListJob, std::tuple<GpgME::KeyListResult, std::vector<GpgME::Key>, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEKeyListJob(GpgME::Context *context);
- ~QGpgMEKeyListJob();
-
- /* from KeyListJob */
- GpgME::Error start(const QStringList &patterns, bool secretOnly) override;
-
- /* from KeyListJob */
- GpgME::KeyListResult exec(const QStringList &patterns, bool secretOnly, std::vector<GpgME::Key> &keys) override;
-
- void addMode(GpgME::KeyListMode mode) override;
-
- /* from ThreadedJobMixin */
- void resultHook(const result_type &result) override;
-private:
- bool mSecretOnly;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEKEYLISTJOB_H__
diff --git a/lang/qt/src/qgpgmelistallkeysjob.cpp b/lang/qt/src/qgpgmelistallkeysjob.cpp
deleted file mode 100644
index ab9f1f42..00000000
--- a/lang/qt/src/qgpgmelistallkeysjob.cpp
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- qgpgmelistallkeysjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2022,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmelistallkeysjob.h"
-
-#include "listallkeysjob_p.h"
-
-#include "debug.h"
-#include <gpgme++/key.h>
-#include <gpgme++/context.h>
-#include <gpgme++/engineinfo.h>
-#include <gpgme++/global.h>
-#include <gpgme++/keylistresult.h>
-#include "qgpgme_debug.h"
-
-#include <gpg-error.h>
-
-#include <algorithm>
-
-#include <cstdlib>
-#include <cstring>
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMEListAllKeysJobPrivate : public ListAllKeysJobPrivate
-{
- QGpgMEListAllKeysJob *q = nullptr;
-
-public:
- QGpgMEListAllKeysJobPrivate(QGpgMEListAllKeysJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMEListAllKeysJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override
- {
- Q_ASSERT(!"Not supported by this Job class.");
- return Error::fromCode(GPG_ERR_NOT_SUPPORTED);
- }
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMEListAllKeysJob::QGpgMEListAllKeysJob(Context *context)
- : mixin_type(context)
-{
- setJobPrivate(this, std::unique_ptr<QGpgMEListAllKeysJobPrivate>{new QGpgMEListAllKeysJobPrivate{this}});
- lateInitialization();
-}
-
-QGpgMEListAllKeysJob::~QGpgMEListAllKeysJob() {}
-
-namespace {
-
-static KeyListResult do_list_keys_legacy(Context *ctx, std::vector<Key> &keys, bool secretOnly)
-{
-
- const char **pat = nullptr;
- if (const Error err = ctx->startKeyListing(pat, secretOnly)) {
- return KeyListResult(nullptr, err);
- }
-
- Error err;
- do {
- keys.push_back(ctx->nextKey(err));
- } while (!err);
-
- keys.pop_back();
-
- const KeyListResult result = ctx->endKeyListing();
- ctx->cancelPendingOperation();
- return result;
-}
-
-template <typename ForwardIterator, typename BinaryPredicate>
-ForwardIterator unique_by_merge(ForwardIterator first, ForwardIterator last, BinaryPredicate pred)
-{
- first = std::adjacent_find(first, last, pred);
- if (first == last) {
- return last;
- }
-
- ForwardIterator dest = first;
- dest->mergeWith(*++first);
- while (++first != last)
- if (pred(*dest, *first)) {
- dest->mergeWith(*first);
- } else {
- *++dest = *first;
- }
- return ++dest;
-}
-
-static void merge_keys(std::vector<Key> &merged, std::vector<Key> &pub, std::vector<Key> &sec)
-{
- merged.reserve(pub.size() + sec.size());
-
- std::merge(pub.begin(), pub.end(),
- sec.begin(), sec.end(),
- std::back_inserter(merged),
- ByFingerprint<std::less>());
-
- merged.erase(unique_by_merge(merged.begin(), merged.end(), ByFingerprint<std::equal_to>()),
- merged.end());
-}
-
-static QGpgMEListAllKeysJob::result_type list_keys_legacy(Context *ctx, bool mergeKeys)
-{
- std::vector<Key> pub, sec, merged;
- KeyListResult r;
-
- r.mergeWith(do_list_keys_legacy(ctx, pub, false));
- std::sort(pub.begin(), pub.end(), ByFingerprint<std::less>());
-
- r.mergeWith(do_list_keys_legacy(ctx, sec, true));
- std::sort(sec.begin(), sec.end(), ByFingerprint<std::less>());
-
- if (mergeKeys) {
- merge_keys(merged, pub, sec);
- } else {
- merged.swap(pub);
- }
- return std::make_tuple(r, merged, sec, QString(), Error());
-}
-
-static KeyListResult do_list_keys(Context *ctx, std::vector<Key> &keys)
-{
- const unsigned int keyListMode = ctx->keyListMode();
- ctx->addKeyListMode(KeyListMode::WithSecret);
-
- const char **pat = nullptr;
- if (const Error err = ctx->startKeyListing(pat)) {
- ctx->setKeyListMode(keyListMode);
- return KeyListResult(nullptr, err);
- }
-
- Error err;
- do {
- keys.push_back(ctx->nextKey(err));
- } while (!err);
-
- keys.pop_back();
-
- const KeyListResult result = ctx->endKeyListing();
- ctx->setKeyListMode(keyListMode);
-
- ctx->cancelPendingOperation();
- return result;
-}
-
-static QGpgMEListAllKeysJob::result_type list_keys(Context *ctx, bool mergeKeys, ListAllKeysJob::Options options)
-{
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.0") {
- return list_keys_legacy(ctx, mergeKeys);
- }
-
- if (options & ListAllKeysJob::DisableAutomaticTrustDatabaseCheck) {
- auto err = ctx->setFlag("no-auto-check-trustdb", "1");
- if (err) {
- // ignore error, but log a warning
- qCWarning(QGPGME_LOG) << "Setting context flag no-auto-check-trustdb failed:" << err;
- }
- }
-
- std::vector<Key> keys;
- KeyListResult r = do_list_keys(ctx, keys);
- std::sort(keys.begin(), keys.end(), ByFingerprint<std::less>());
-
- std::vector<Key> sec;
- std::copy_if(keys.begin(), keys.end(), std::back_inserter(sec), [](const Key &key) { return key.hasSecret(); });
-
- return std::make_tuple(r, keys, sec, QString(), Error());
-}
-
-}
-
-Error QGpgMEListAllKeysJob::start(bool mergeKeys)
-{
- run(std::bind(&list_keys, std::placeholders::_1, mergeKeys, options()));
- return Error();
-}
-
-KeyListResult QGpgMEListAllKeysJob::exec(std::vector<Key> &pub, std::vector<Key> &sec, bool mergeKeys)
-{
- const result_type r = list_keys(context(), mergeKeys, options());
- pub = std::get<1>(r);
- sec = std::get<2>(r);
- return std::get<0>(r);
-}
-
-#include "qgpgmelistallkeysjob.moc"
diff --git a/lang/qt/src/qgpgmelistallkeysjob.h b/lang/qt/src/qgpgmelistallkeysjob.h
deleted file mode 100644
index 93686a4b..00000000
--- a/lang/qt/src/qgpgmelistallkeysjob.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- qgpgmelistallkeysjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMELISTALLKEYSJOB_H__
-#define __QGPGME_QGPGMELISTALLKEYSJOB_H__
-
-#include "listallkeysjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/keylistresult.h>
-#include <gpgme++/key.h>
-
-namespace QGpgME
-{
-
-class QGpgMEListAllKeysJob
-#ifdef Q_MOC_RUN
- : public ListAllKeysJob
-#else
- : public _detail::ThreadedJobMixin<ListAllKeysJob, std::tuple<GpgME::KeyListResult, std::vector<GpgME::Key>, std::vector<GpgME::Key>, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEListAllKeysJob(GpgME::Context *context);
- ~QGpgMEListAllKeysJob();
-
- /* from ListAllKeysJob */
- GpgME::Error start(bool mergeKeys) override;
-
- /* from ListAllKeysJob */
- GpgME::KeyListResult exec(std::vector<GpgME::Key> &pub, std::vector<GpgME::Key> &sec, bool mergeKeys) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMELISTALLKEYSJOB_H__
diff --git a/lang/qt/src/qgpgmenewcryptoconfig.cpp b/lang/qt/src/qgpgmenewcryptoconfig.cpp
deleted file mode 100644
index a4782d2f..00000000
--- a/lang/qt/src/qgpgmenewcryptoconfig.cpp
+++ /dev/null
@@ -1,819 +0,0 @@
-/*
- qgpgmenewcryptoconfig.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2010 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmenewcryptoconfig.h"
-
-#include <QDebug>
-#include "qgpgme_debug.h"
-
-#include <QFile>
-#include <QDir>
-#include <QList>
-
-#include <gpgme++/global.h>
-#include <gpgme++/error.h>
-#include "debug.h"
-
-#include <sstream>
-#include <string>
-#include <functional>
-#include <cassert>
-#include <functional>
-
-using namespace QGpgME;
-using namespace GpgME;
-using namespace GpgME::Configuration;
-
-// Just for the Q_ASSERT in the dtor. Not thread-safe, but who would
-// have 2 threads talking to gpgconf anyway? :)
-static bool s_duringClear = false;
-
-QGpgMENewCryptoConfig::QGpgMENewCryptoConfig()
- : m_parsed(false)
-{
-}
-
-QGpgMENewCryptoConfig::~QGpgMENewCryptoConfig()
-{
- clear();
-}
-
-void QGpgMENewCryptoConfig::reloadConfiguration(bool)
-{
- clear();
-
- Error error;
- const std::vector<Component> components = Component::load(error);
-#ifndef NDEBUG
- {
- std::stringstream ss;
- ss << "error: " << error
- << "components:\n";
- std::copy(components.begin(), components.end(),
- std::ostream_iterator<Component>(ss, "\n"));
- qCDebug(QGPGME_CONFIG_LOADING_LOG) << ss.str().c_str();
- }
-#endif
-#if 0
- TODO port?
- if (error && showErrors) {
- const QString wmsg = i18n("<qt>Failed to execute gpgconf:<p>%1</p></qt>", QString::fromLocal8Bit(error.asString()));
- qCWarning(QGPGME_LOG) << wmsg; // to see it from test_cryptoconfig.cpp
- KMessageBox::error(0, wmsg);
- }
-#endif
- for (const Component &c : components) {
- const std::shared_ptr<QGpgMENewCryptoConfigComponent> comp(new QGpgMENewCryptoConfigComponent);
- comp->setComponent(c);
- m_componentsByName[ comp->name() ] = comp;
- }
- m_parsed = true;
-}
-
-QStringList QGpgMENewCryptoConfig::componentList() const
-{
- if (!m_parsed) {
- const_cast<QGpgMENewCryptoConfig *>(this)->reloadConfiguration(true);
- }
- QStringList result;
- std::transform(m_componentsByName.begin(), m_componentsByName.end(),
- std::back_inserter(result),
- mem_fn(&QGpgMENewCryptoConfigComponent::name));
- return result;
-}
-
-QGpgMENewCryptoConfigComponent *QGpgMENewCryptoConfig::component(const QString &name) const
-{
- if (!m_parsed) {
- const_cast<QGpgMENewCryptoConfig *>(this)->reloadConfiguration(false);
- }
- return m_componentsByName.value(name).get();
-}
-
-void QGpgMENewCryptoConfig::sync(bool runtime)
-{
- for (const std::shared_ptr<QGpgMENewCryptoConfigComponent> &c : qAsConst(m_componentsByName)) {
- c->sync(runtime);
- }
-}
-
-void QGpgMENewCryptoConfig::clear()
-{
- s_duringClear = true;
- m_componentsByName.clear();
- s_duringClear = false;
- m_parsed = false; // next call to componentList/component will need to run gpgconf again
-}
-
-////
-
-QGpgMENewCryptoConfigComponent::QGpgMENewCryptoConfigComponent()
- : CryptoConfigComponent(),
- m_component()
-{
-
-}
-
-void QGpgMENewCryptoConfigComponent::setComponent(const Component &component)
-{
- m_component = component;
- m_groupsByName.clear();
-
- std::shared_ptr<QGpgMENewCryptoConfigGroup> group;
-
- const std::vector<Option> options = m_component.options();
- for (const Option &o : options) {
- if (o.flags() & Group) {
- if (group) {
- m_groupsByName[group->name()] = group;
- }
- group.reset(new QGpgMENewCryptoConfigGroup(shared_from_this(), o));
- } else if (group) {
- const std::shared_ptr<QGpgMENewCryptoConfigEntry> entry(new QGpgMENewCryptoConfigEntry(group, o));
- const QString name = entry->name();
- group->m_entryNames.push_back(name);
- group->m_entriesByName[name] = entry;
- } else {
- qCWarning(QGPGME_LOG) << "found no group for entry" << o.name() << "of component" << name();
- }
- }
- if (group) {
- m_groupsByName[group->name()] = group;
- }
-
-}
-
-QGpgMENewCryptoConfigComponent::~QGpgMENewCryptoConfigComponent() {}
-
-QString QGpgMENewCryptoConfigComponent::name() const
-{
- return QString::fromUtf8(m_component.name());
-}
-
-QString QGpgMENewCryptoConfigComponent::description() const
-{
- return QString::fromUtf8(m_component.description());
-}
-
-QStringList QGpgMENewCryptoConfigComponent::groupList() const
-{
- QStringList result;
- result.reserve(m_groupsByName.size());
- std::transform(m_groupsByName.begin(), m_groupsByName.end(),
- std::back_inserter(result),
- std::mem_fn(&QGpgMENewCryptoConfigGroup::name));
- return result;
-}
-
-QGpgMENewCryptoConfigGroup *QGpgMENewCryptoConfigComponent::group(const QString &name) const
-{
- return m_groupsByName.value(name).get();
-}
-
-void QGpgMENewCryptoConfigComponent::sync(bool runtime)
-{
- Q_UNUSED(runtime) // runtime is always set by engine_gpgconf
- if (const Error err = m_component.save()) {
- qCWarning(QGPGME_LOG) << ":"
- << "Error from gpgconf while saving configuration: %1"
- << err;
- }
-}
-
-////
-
-QGpgMENewCryptoConfigGroup::QGpgMENewCryptoConfigGroup(const std::shared_ptr<QGpgMENewCryptoConfigComponent> &comp, const Option &option)
- : CryptoConfigGroup(),
- m_component(comp),
- m_option(option)
-{
-}
-
-QGpgMENewCryptoConfigGroup::~QGpgMENewCryptoConfigGroup() {}
-
-QString QGpgMENewCryptoConfigGroup::name() const
-{
- return QString::fromUtf8(m_option.name());
-}
-
-QString QGpgMENewCryptoConfigGroup::description() const
-{
- return QString::fromUtf8(m_option.description());
-}
-
-QString QGpgMENewCryptoConfigGroup::path() const
-{
- if (const std::shared_ptr<QGpgMENewCryptoConfigComponent> c = m_component.lock()) {
- return c->name() + QLatin1Char('/') + name();
- } else {
- return QString();
- }
-}
-
-CryptoConfigEntry::Level QGpgMENewCryptoConfigGroup::level() const
-{
- // two casts to make SunCC happy:
- return static_cast<CryptoConfigEntry::Level>(static_cast<unsigned int>(m_option.level()));
-}
-
-QStringList QGpgMENewCryptoConfigGroup::entryList() const
-{
- return m_entryNames;
-}
-
-QGpgMENewCryptoConfigEntry *QGpgMENewCryptoConfigGroup::entry(const QString &name) const
-{
- return m_entriesByName.value(name).get();
-}
-
-static QString urlpart_encode(const QString &str)
-{
- QString enc(str);
- enc.replace(QLatin1Char('%'), QStringLiteral("%25")); // first!
- enc.replace(QLatin1Char(':'), QStringLiteral("%3a"));
- //qCDebug(QGPGME_LOG) <<" urlpart_encode:" << str <<" ->" << enc;
- return enc;
-}
-
-static QString urlpart_decode(const QString &str)
-{
- return QUrl::fromPercentEncoding(str.toLatin1());
-}
-
-// gpgconf arg type number -> NewCryptoConfigEntry arg type enum mapping
-static QGpgME::CryptoConfigEntry::ArgType knownArgType(int argType, bool &ok)
-{
- ok = true;
- switch (argType) {
- case 0: // none
- return QGpgME::CryptoConfigEntry::ArgType_None;
- case 1: // string
- return QGpgME::CryptoConfigEntry::ArgType_String;
- case 2: // int32
- return QGpgME::CryptoConfigEntry::ArgType_Int;
- case 3: // uint32
- return QGpgME::CryptoConfigEntry::ArgType_UInt;
- case 32: // pathname
- return QGpgME::CryptoConfigEntry::ArgType_Path;
- case 33: // ldap server
- return QGpgME::CryptoConfigEntry::ArgType_LDAPURL;
- default:
- ok = false;
- return QGpgME::CryptoConfigEntry::ArgType_None;
- }
-}
-
-QGpgMENewCryptoConfigEntry::QGpgMENewCryptoConfigEntry(const std::shared_ptr<QGpgMENewCryptoConfigGroup> &group, const Option &option)
- : m_group(group), m_option(option)
-{
-}
-
-#if 0
-QVariant QGpgMENewCryptoConfigEntry::stringToValue(const QString &str, bool unescape) const
-{
- const bool isString = isStringType();
-
- if (isList()) {
- if (argType() == ArgType_None) {
- bool ok = true;
- const QVariant v = str.isEmpty() ? 0U : str.toUInt(&ok);
- if (!ok) {
- qCWarning(QGPGME_LOG) << "list-of-none should have an unsigned int as value:" << str;
- }
- return v;
- }
- QList<QVariant> lst;
- QStringList items = str.split(',', QString::SkipEmptyParts);
- for (QStringList::const_iterator valit = items.constBegin(); valit != items.constEnd(); ++valit) {
- QString val = *valit;
- if (isString) {
- if (val.isEmpty()) {
- lst << QVariant(QString());
- continue;
- } else if (unescape) {
- if (val[0] != '"') { // see README.gpgconf
- qCWarning(QGPGME_LOG) << "String value should start with '\"' :" << val;
- }
- val = val.mid(1);
- }
- }
- lst << QVariant(unescape ? gpgconf_unescape(val) : val);
- }
- return lst;
- } else { // not a list
- QString val(str);
- if (isString) {
- if (val.isEmpty()) {
- return QVariant(QString()); // not set [ok with lists too?]
- } else if (unescape) {
- if (val[0] != '"') { // see README.gpgconf
- qCWarning(QGPGME_LOG) << "String value should start with '\"' :" << val;
- }
- val = val.mid(1);
- }
- }
- return QVariant(unescape ? gpgconf_unescape(val) : val);
- }
-}
-#endif
-
-QGpgMENewCryptoConfigEntry::~QGpgMENewCryptoConfigEntry()
-{
-#ifndef NDEBUG
- if (!s_duringClear && m_option.dirty())
- qCWarning(QGPGME_LOG) << "Deleting a QGpgMENewCryptoConfigEntry that was modified (" << m_option.description() << ")"
- << "You forgot to call sync() (to commit) or clear() (to discard)";
-#endif
-}
-
-QString QGpgMENewCryptoConfigEntry::name() const
-{
- return QString::fromUtf8(m_option.name());
-}
-
-QString QGpgMENewCryptoConfigEntry::description() const
-{
- return QString::fromUtf8(m_option.description());
-}
-
-QString QGpgMENewCryptoConfigEntry::path() const
-{
- if (const std::shared_ptr<QGpgMENewCryptoConfigGroup> g = m_group.lock()) {
- return g->path() + QLatin1Char('/') + name();
- } else {
- return QString();
- }
-}
-
-bool QGpgMENewCryptoConfigEntry::isOptional() const
-{
- return m_option.flags() & Optional;
-}
-
-bool QGpgMENewCryptoConfigEntry::isReadOnly() const
-{
- return m_option.flags() & NoChange;
-}
-
-bool QGpgMENewCryptoConfigEntry::isList() const
-{
- return m_option.flags() & List;
-}
-
-bool QGpgMENewCryptoConfigEntry::isRuntime() const
-{
- return m_option.flags() & Runtime;
-}
-
-CryptoConfigEntry::Level QGpgMENewCryptoConfigEntry::level() const
-{
- // two casts to make SunCC happy:
- return static_cast<Level>(static_cast<unsigned int>(m_option.level()));
-}
-
-CryptoConfigEntry::ArgType QGpgMENewCryptoConfigEntry::argType() const
-{
- bool ok = false;
- const ArgType type = knownArgType(m_option.type(), ok);
- if (ok) {
- return type;
- } else {
- return knownArgType(m_option.alternateType(), ok);
- }
-}
-
-bool QGpgMENewCryptoConfigEntry::isSet() const
-{
- return m_option.set();
-}
-
-bool QGpgMENewCryptoConfigEntry::boolValue() const
-{
- Q_ASSERT(m_option.alternateType() == NoType);
- Q_ASSERT(!isList());
- return m_option.currentValue().boolValue();
-}
-
-QString QGpgMENewCryptoConfigEntry::stringValue() const
-{
- //return toString( false );
- Q_ASSERT(m_option.alternateType() == StringType);
- Q_ASSERT(!isList());
- return QString::fromUtf8(m_option.currentValue().stringValue());
-}
-
-int QGpgMENewCryptoConfigEntry::intValue() const
-{
- Q_ASSERT(m_option.alternateType() == IntegerType);
- Q_ASSERT(!isList());
- return m_option.currentValue().intValue();
-}
-
-unsigned int QGpgMENewCryptoConfigEntry::uintValue() const
-{
- Q_ASSERT(m_option.alternateType() == UnsignedIntegerType);
- Q_ASSERT(!isList());
- return m_option.currentValue().uintValue();
-}
-
-static QUrl parseURL(int mRealArgType, const QString &str)
-{
- if (mRealArgType == 33) { // LDAP server
- // The format is HOSTNAME:PORT:USERNAME:PASSWORD:BASE_DN
- // or, since gpg 2.2.18, e.g. for dirmngr/ldapserver: [ldap:]hostname:port:username:password:base_dn:flags[:]
- const bool isLdapUrl = str.startsWith(QLatin1String("ldap://")) || str.startsWith(QLatin1String("ldaps://"));
- if (!isLdapUrl) {
- const bool hasOptionalPrefix = str.startsWith(QLatin1String("ldap:"));
- const QStringList items = hasOptionalPrefix ? str.mid(5).split(QLatin1Char(':')) : str.split(QLatin1Char(':'));
- if (items.size() >= 5) {
- QUrl url;
- url.setScheme(QStringLiteral("ldap"));
- url.setHost(urlpart_decode(items[0]), QUrl::DecodedMode);
-
- const auto portString = items[1];
- if (!portString.isEmpty()) {
- bool ok;
- const int port = portString.toInt(&ok);
- if (ok) {
- url.setPort(port);
- } else {
- qCWarning(QGPGME_LOG) << "parseURL: malformed LDAP server port, ignoring:" << portString;
- }
- }
-
- const QString userName = urlpart_decode(items[2]);
- if (!userName.isEmpty()) {
- url.setUserName(userName, QUrl::DecodedMode);
- }
- const QString passWord = urlpart_decode(items[3]);
- if (!passWord.isEmpty()) {
- url.setPassword(passWord, QUrl::DecodedMode);
- }
- const auto baseDn = urlpart_decode(items[4]);
- if (!baseDn.isEmpty()) {
- url.setQuery(baseDn, QUrl::DecodedMode);
- }
- if (items.size() >= 6) {
- const auto flags = urlpart_decode(items[5]);
- if (!flags.isEmpty()) {
- url.setFragment(flags, QUrl::DecodedMode);
- }
- }
- return url;
- } else {
- qCWarning(QGPGME_LOG) << "parseURL: malformed LDAP server:" << str;
- }
- }
- }
- // other URLs : assume wellformed URL syntax.
- return QUrl(str);
-}
-
-static QString portToString(int port)
-{
- // -1 is used for default ports => empty string
- return port != -1 ? QString::number(port) : QString();
-}
-
-// The opposite of parseURL
-static QString splitURL(int mRealArgType, const QUrl &url)
-{
- if (mRealArgType == 33) { // LDAP server
- // The format is HOSTNAME:PORT:USERNAME:PASSWORD:BASE_DN
- // or, since gpg 2.2.18, e.g. for dirmngr/ldapserver: [ldap:]hostname:port:username:password:base_dn:flags[:]
- Q_ASSERT(url.scheme() == QLatin1String("ldap"));
- return urlpart_encode(url.host()) + QLatin1Char(':') +
- portToString(url.port()) + QLatin1Char(':') +
- urlpart_encode(url.userName()) + QLatin1Char(':') +
- urlpart_encode(url.password()) + QLatin1Char(':') +
- urlpart_encode(url.query()) + QLatin1Char(':') +
- urlpart_encode(url.fragment());
- }
- return url.path();
-}
-
-QUrl QGpgMENewCryptoConfigEntry::urlValue() const
-{
- const Type type = m_option.type();
- Q_ASSERT(type == FilenameType || type == LdapServerType);
- Q_ASSERT(!isList());
- if (type == FilenameType) {
- QUrl url = QUrl::fromLocalFile(m_option.currentValue().stringValue());
- return url;
- }
- return parseURL(type, stringValue());
-}
-
-unsigned int QGpgMENewCryptoConfigEntry::numberOfTimesSet() const
-{
- Q_ASSERT(m_option.alternateType() == NoType);
- Q_ASSERT(isList());
- return m_option.currentValue().uintValue();
-}
-
-std::vector<int> QGpgMENewCryptoConfigEntry::intValueList() const
-{
- Q_ASSERT(m_option.alternateType() == IntegerType);
- Q_ASSERT(isList());
- return m_option.currentValue().intValues();
-}
-
-std::vector<unsigned int> QGpgMENewCryptoConfigEntry::uintValueList() const
-{
- Q_ASSERT(m_option.alternateType() == UnsignedIntegerType);
- Q_ASSERT(isList());
- return m_option.currentValue().uintValues();
-}
-
-QStringList QGpgMENewCryptoConfigEntry::stringValueList() const
-{
- Q_ASSERT(isList());
- const Argument arg = m_option.currentValue();
- const std::vector<const char *> values = arg.stringValues();
- QStringList ret;
- for(const char *value: values) {
- ret << QString::fromUtf8(value);
- }
- return ret;
-}
-
-QList<QUrl> QGpgMENewCryptoConfigEntry::urlValueList() const
-{
- const Type type = m_option.type();
- Q_ASSERT(type == FilenameType || type == LdapServerType);
- Q_ASSERT(isList());
- const Argument arg = m_option.currentValue();
- const std::vector<const char *> values = arg.stringValues();
- QList<QUrl> ret;
- for (const char *value : values) {
- if (type == FilenameType) {
- QUrl url;
- url.setPath(QFile::decodeName(value));
- ret << url;
- } else {
- ret << parseURL(type, QString::fromUtf8(value));
- }
- }
- return ret;
-}
-
-void QGpgMENewCryptoConfigEntry::resetToDefault()
-{
- m_option.resetToDefaultValue();
-}
-
-void QGpgMENewCryptoConfigEntry::setBoolValue(bool b)
-{
- Q_ASSERT(m_option.alternateType() == NoType);
- Q_ASSERT(!isList());
- // A "no arg" option is either set or not set.
- // Being set means createNoneArgument(), being unset means resetToDefault()
- m_option.setNewValue(m_option.createNoneArgument(b));
-}
-
-void QGpgMENewCryptoConfigEntry::setStringValue(const QString &str)
-{
- Q_ASSERT(m_option.alternateType() == StringType);
- Q_ASSERT(!isList());
- const Type type = m_option.type();
- // When setting a string to empty (and there's no default), we need to act like resetToDefault
- // Otherwise we try e.g. "ocsp-responder:0:" and gpgconf answers:
- // "gpgconf: argument required for option ocsp-responder"
- if (str.isEmpty() && !isOptional()) {
- m_option.resetToDefaultValue();
- } else if (type == FilenameType) {
- m_option.setNewValue(m_option.createStringArgument(QFile::encodeName(str).constData()));
- } else {
- m_option.setNewValue(m_option.createStringArgument(str.toUtf8().constData()));
- }
-}
-
-void QGpgMENewCryptoConfigEntry::setIntValue(int i)
-{
- Q_ASSERT(m_option.alternateType() == IntegerType);
- Q_ASSERT(!isList());
- m_option.setNewValue(m_option.createIntArgument(i));
-}
-
-void QGpgMENewCryptoConfigEntry::setUIntValue(unsigned int i)
-{
- Q_ASSERT(m_option.alternateType() == UnsignedIntegerType);
- Q_ASSERT(!isList());
- m_option.setNewValue(m_option.createUIntArgument(i));
-}
-
-void QGpgMENewCryptoConfigEntry::setURLValue(const QUrl &url)
-{
- const Type type = m_option.type();
- Q_ASSERT(type == FilenameType || type == LdapServerType);
- Q_ASSERT(!isList());
- const QString str = splitURL(type, url);
- // cf. setStringValue()
- if (str.isEmpty() && !isOptional()) {
- m_option.resetToDefaultValue();
- } else if (type == FilenameType) {
- m_option.setNewValue(m_option.createStringArgument(url.toLocalFile().toUtf8().constData()));
- } else {
- m_option.setNewValue(m_option.createStringArgument(str.toUtf8().constData()));
- }
-}
-
-void QGpgMENewCryptoConfigEntry::setNumberOfTimesSet(unsigned int i)
-{
- Q_ASSERT(m_option.alternateType() == NoType);
- Q_ASSERT(isList());
- m_option.setNewValue(m_option.createNoneListArgument(i));
-}
-
-void QGpgMENewCryptoConfigEntry::setIntValueList(const std::vector<int> &lst)
-{
- Q_ASSERT(m_option.alternateType() == IntegerType);
- Q_ASSERT(isList());
- m_option.setNewValue(m_option.createIntListArgument(lst));
-}
-
-void QGpgMENewCryptoConfigEntry::setUIntValueList(const std::vector<unsigned int> &lst)
-{
- Q_ASSERT(m_option.alternateType() == UnsignedIntegerType);
- Q_ASSERT(isList());
- m_option.setNewValue(m_option.createUIntListArgument(lst));
-}
-
-void QGpgMENewCryptoConfigEntry::setURLValueList(const QList<QUrl> &urls)
-{
- const Type type = m_option.type();
- Q_ASSERT(m_option.alternateType() == StringType);
- Q_ASSERT(isList());
- std::vector<std::string> values;
- values.reserve(urls.size());
- for (const QUrl &url : urls) {
- if (type == FilenameType) {
- values.push_back(QFile::encodeName(url.path()).constData());
- } else {
- values.push_back(splitURL(type, url).toUtf8().constData());
- }
- }
- const auto err = m_option.setNewValue(m_option.createStringListArgument(values));
- if (err) {
- qCWarning(QGPGME_LOG) << "setURLValueList: failed to set new value:" << err;
- }
-}
-
-bool QGpgMENewCryptoConfigEntry::isDirty() const
-{
- return m_option.dirty();
-}
-
-QVariant QGpgMENewCryptoConfigEntry::defaultValue() const
-{
- const auto defaultValue = m_option.defaultValue();
- if (defaultValue.isNull() || defaultValue.numElements() == 0) {
- return {};
- }
- if (defaultValue.numElements() == 1) {
- switch (m_option.alternateType()) {
- case NoType:
- return QVariant{defaultValue.boolValue()};
- case StringType:
- return QVariant{QString::fromUtf8(defaultValue.stringValue())};
- case IntegerType:
- return QVariant{defaultValue.intValue()};
- case UnsignedIntegerType:
- return QVariant{defaultValue.uintValue()};
- default:
- // alternateType should always be one of the above four types
- qCWarning(QGPGME_LOG) << __func__ << ": unsupported alternateType" << m_option.alternateType();
- }
- } else {
- QList<QVariant> list;
- switch (m_option.alternateType()) {
- case StringType: {
- const auto values = defaultValue.stringValues();
- std::transform(std::begin(values), std::end(values), std::back_inserter(list),
- [] (const char *value) { return QVariant{QString::fromUtf8(value)}; });
- break;
- }
- case IntegerType: {
- const auto values = defaultValue.intValues();
- std::transform(std::begin(values), std::end(values), std::back_inserter(list),
- [] (int value) { return QVariant{value}; });
- break;
- }
- case UnsignedIntegerType: {
- const auto values = defaultValue.uintValues();
- std::transform(std::begin(values), std::end(values), std::back_inserter(list),
- [] (unsigned int value) { return QVariant{value}; });
- break;
- }
- default:
- // alternateType should always be one of the above four types
- qCWarning(QGPGME_LOG) << __func__ << ": unsupported alternateType" << m_option.alternateType() << "for list";
- }
- return QVariant{list};
- }
-
- return {};
-}
-
-#if 0
-QString QGpgMENewCryptoConfigEntry::toString(bool escape) const
-{
- // Basically the opposite of stringToValue
- if (isStringType()) {
- if (mValue.isNull()) {
- return QString();
- } else if (isList()) { // string list
- QStringList lst = mValue.toStringList();
- if (escape) {
- for (QStringList::iterator it = lst.begin(); it != lst.end(); ++it) {
- if (!(*it).isNull()) {
- *it = gpgconf_escape(*it).prepend("\"");
- }
- }
- }
- QString res = lst.join(",");
- //qCDebug(QGPGME_LOG) <<"toString:" << res;
- return res;
- } else { // normal string
- QString res = mValue.toString();
- if (escape) {
- res = gpgconf_escape(res).prepend("\"");
- }
- return res;
- }
- }
- if (!isList()) { // non-list non-string
- if (mArgType == ArgType_None) {
- return mValue.toBool() ? QString::fromLatin1("1") : QString();
- } else { // some int
- Q_ASSERT(mArgType == ArgType_Int || mArgType == ArgType_UInt);
- return mValue.toString(); // int to string conversion
- }
- }
-
- // Lists (of other types than strings)
- if (mArgType == ArgType_None) {
- return QString::number(numberOfTimesSet());
- }
- QStringList ret;
- QList<QVariant> lst = mValue.toList();
- for (QList<QVariant>::const_iterator it = lst.constBegin(); it != lst.constEnd(); ++it) {
- ret << (*it).toString(); // QVariant does the conversion
- }
- return ret.join(",");
-}
-
-QString QGpgMENewCryptoConfigEntry::outputString() const
-{
- Q_ASSERT(mSet);
- return toString(true);
-}
-
-bool QGpgMENewCryptoConfigEntry::isStringType() const
-{
- return (mArgType == QGpgME::NewCryptoConfigEntry::ArgType_String
- || mArgType == QGpgME::NewCryptoConfigEntry::ArgType_Path
- || mArgType == QGpgME::NewCryptoConfigEntry::ArgType_URL
- || mArgType == QGpgME::NewCryptoConfigEntry::ArgType_LDAPURL);
-}
-
-void QGpgMENewCryptoConfigEntry::setDirty(bool b)
-{
- mDirty = b;
-}
-#endif
diff --git a/lang/qt/src/qgpgmenewcryptoconfig.h b/lang/qt/src/qgpgmenewcryptoconfig.h
deleted file mode 100644
index 05726e37..00000000
--- a/lang/qt/src/qgpgmenewcryptoconfig.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- qgpgmenewcryptoconfig.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2010 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef QGPGME_QGPGMENEWCRYPTOCONFIG_H
-#define QGPGME_QGPGMENEWCRYPTOCONFIG_H
-
-#include "qgpgme_export.h"
-#include "cryptoconfig.h"
-
-#include <QHash>
-#include <QStringList>
-#include <QVariant>
-
-#include <gpgme++/configuration.h>
-
-#include <vector>
-#include <utility>
-
-class QGpgMENewCryptoConfig;
-class QGpgMENewCryptoConfigComponent;
-class QGpgMENewCryptoConfigGroup;
-class QGpgMENewCryptoConfigEntry;
-
-class QGpgMENewCryptoConfigEntry : public QGpgME::CryptoConfigEntry
-{
-public:
- QGpgMENewCryptoConfigEntry(const std::shared_ptr<QGpgMENewCryptoConfigGroup> &group, const GpgME::Configuration::Option &option);
- ~QGpgMENewCryptoConfigEntry();
-
- QString name() const override;
- QString description() const override;
- QString path() const override;
- bool isOptional() const override;
- bool isReadOnly() const override;
- bool isList() const override;
- bool isRuntime() const override;
- Level level() const override;
- ArgType argType() const override;
- bool isSet() const override;
- bool boolValue() const override;
- QString stringValue() const override;
- int intValue() const override;
- unsigned int uintValue() const override;
- QUrl urlValue() const override;
- unsigned int numberOfTimesSet() const override;
- std::vector<int> intValueList() const override;
- std::vector<unsigned int> uintValueList() const override;
- QList<QUrl> urlValueList() const override;
- void resetToDefault() override;
- void setBoolValue(bool) override;
- void setStringValue(const QString &) override;
- void setIntValue(int) override;
- void setUIntValue(unsigned int) override;
- void setURLValue(const QUrl &) override;
- void setNumberOfTimesSet(unsigned int) override;
- void setIntValueList(const std::vector<int> &) override;
- void setUIntValueList(const std::vector<unsigned int> &) override;
- void setURLValueList(const QList<QUrl> &) override;
- bool isDirty() const override;
-
- QStringList stringValueList() const;
- QVariant defaultValue() const;
-
-#if 0
- void setDirty(bool b);
- QString outputString() const;
-
-protected:
- bool isStringType() const;
- QVariant stringToValue(const QString &value, bool unescape) const;
- QString toString(bool escape) const;
-#endif
-private:
- std::weak_ptr<QGpgMENewCryptoConfigGroup> m_group;
- GpgME::Configuration::Option m_option;
-};
-
-class QGpgMENewCryptoConfigGroup : public QGpgME::CryptoConfigGroup
-{
-public:
- QGpgMENewCryptoConfigGroup(const std::shared_ptr<QGpgMENewCryptoConfigComponent> &parent, const GpgME::Configuration::Option &option);
- ~QGpgMENewCryptoConfigGroup();
-
- QString name() const override;
- QString iconName() const override
- {
- return QString();
- }
- QString description() const override;
- QString path() const override;
- QGpgME::CryptoConfigEntry::Level level() const override;
- QStringList entryList() const override;
- QGpgMENewCryptoConfigEntry *entry(const QString &name) const override;
-
-private:
- friend class QGpgMENewCryptoConfigComponent; // it adds the entries
- std::weak_ptr<QGpgMENewCryptoConfigComponent> m_component;
- GpgME::Configuration::Option m_option;
- QStringList m_entryNames;
- QHash< QString, std::shared_ptr<QGpgMENewCryptoConfigEntry> > m_entriesByName;
-};
-
-/// For docu, see kleo/cryptoconfig.h
-class QGpgMENewCryptoConfigComponent : public QGpgME::CryptoConfigComponent, public std::enable_shared_from_this<QGpgMENewCryptoConfigComponent>
-{
-public:
- QGpgMENewCryptoConfigComponent();
- ~QGpgMENewCryptoConfigComponent();
-
- void setComponent(const GpgME::Configuration::Component &component);
-
- QString name() const override;
- QString iconName() const override
- {
- return name();
- }
- QString description() const override;
- QStringList groupList() const override;
- QGpgMENewCryptoConfigGroup *group(const QString &name) const override;
-
- void sync(bool runtime);
-
-private:
- GpgME::Configuration::Component m_component;
- QHash< QString, std::shared_ptr<QGpgMENewCryptoConfigGroup> > m_groupsByName;
-};
-
-/**
- * CryptoConfig implementation around the gpgconf command-line tool
- * For method docu, see kleo/cryptoconfig.h
- */
-class QGPGME_EXPORT QGpgMENewCryptoConfig : public QGpgME::CryptoConfig
-{
-public:
- /**
- * Constructor
- */
- QGpgMENewCryptoConfig();
- ~QGpgMENewCryptoConfig();
-
- QStringList componentList() const override;
-
- QGpgMENewCryptoConfigComponent *component(const QString &name) const override;
-
- void clear() override;
- void sync(bool runtime) override;
-
-private:
- /// @param showErrors if true, a messagebox will be shown if e.g. gpgconf wasn't found
- void reloadConfiguration(bool showErrors);
-
-private:
- QHash< QString, std::shared_ptr<QGpgMENewCryptoConfigComponent> > m_componentsByName;
- bool m_parsed;
-};
-
-#endif /* QGPGME_QGPGMENEWCRYPTOCONFIG_H */
diff --git a/lang/qt/src/qgpgmequickjob.cpp b/lang/qt/src/qgpgmequickjob.cpp
deleted file mode 100644
index d65afd7d..00000000
--- a/lang/qt/src/qgpgmequickjob.cpp
+++ /dev/null
@@ -1,211 +0,0 @@
-/* qgpgmequickjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2017 Intevation GmbH
- Copyright (c) 2020 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmequickjob.h"
-
-#include "qgpgme_debug.h"
-#include "quickjob_p.h"
-#include "util.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/key.h>
-
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMEQuickJobPrivate : public QuickJobPrivate
-{
- QGpgMEQuickJob *q = nullptr;
-
-public:
- QGpgMEQuickJobPrivate(QGpgMEQuickJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMEQuickJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override
- {
- Q_ASSERT(!"Not supported by this Job class.");
- return Error::fromCode(GPG_ERR_NOT_SUPPORTED);
- }
-
- void startNow() override
- {
- Q_ASSERT(!"Not supported by this Job class.");
- q->run();
- }
-
- GpgME::Error startSetKeyEnabled(const GpgME::Key &key, bool enable) override;
-};
-
-}
-
-QGpgMEQuickJob::QGpgMEQuickJob(Context *context)
- : mixin_type(context)
-{
- setJobPrivate(this, std::unique_ptr<QGpgMEQuickJobPrivate>{new QGpgMEQuickJobPrivate{this}});
- lateInitialization();
-}
-
-QGpgMEQuickJob::~QGpgMEQuickJob() = default;
-
-static QGpgMEQuickJob::result_type createWorker(GpgME::Context *ctx,
- const QString &uid,
- const char *algo,
- const QDateTime &expires,
- const GpgME::Key &key,
- unsigned int flags)
-{
- auto err = ctx->createKey(uid.toUtf8().constData(),
- algo,
- 0,
- expires.isValid() ? (unsigned long) (expires.toMSecsSinceEpoch() / 1000
- - QDateTime::currentSecsSinceEpoch()) : 0,
- key,
- flags);
- return std::make_tuple(err, QString(), Error());
-}
-
-static QGpgMEQuickJob::result_type addSubkeyWorker(GpgME::Context *ctx,
- const GpgME::Key &key,
- const char *algo,
- const QDateTime &expires,
- unsigned int flags)
-{
- auto err = ctx->createSubkey(key, algo, 0,
- expires.isValid() ? (unsigned long) (expires.toMSecsSinceEpoch() / 1000
- - QDateTime::currentSecsSinceEpoch()): 0,
- flags);
- return std::make_tuple(err, QString(), Error());
-}
-
-static QGpgMEQuickJob::result_type addUidWorker(GpgME::Context *ctx,
- const GpgME::Key &key,
- const QString &uid)
-{
- auto err = ctx->addUid(key, uid.toUtf8().constData());
- return std::make_tuple(err, QString(), Error());
-}
-
-static QGpgMEQuickJob::result_type revUidWorker(GpgME::Context *ctx,
- const GpgME::Key &key,
- const QString &uid)
-{
- auto err = ctx->revUid(key, uid.toUtf8().constData());
- return std::make_tuple(err, QString(), Error());
-}
-
-static QGpgMEQuickJob::result_type revokeSignatureWorker(Context *ctx,
- const Key &key,
- const Key &signingKey,
- const std::vector<UserID> &userIds)
-{
- const auto err = ctx->revokeSignature(key, signingKey, userIds);
- return std::make_tuple(err, QString(), Error());
-}
-
-static QGpgMEQuickJob::result_type addAdskWorker(Context *ctx, const Key &key, const char *adsk)
-{
- const auto err = ctx->addAdsk(key, adsk);
- return std::make_tuple(err, QString(), Error());
-}
-
-void QGpgMEQuickJob::startCreate(const QString &uid,
- const char *algo,
- const QDateTime &expires,
- const GpgME::Key &key,
- unsigned int flags)
-{
- run(std::bind(&createWorker, std::placeholders::_1, uid, algo,
- expires, key, flags));
-}
-
-void QGpgMEQuickJob::startAddUid(const GpgME::Key &key, const QString &uid)
-{
- run(std::bind(&addUidWorker, std::placeholders::_1, key, uid));
-}
-
-void QGpgMEQuickJob::startRevUid(const GpgME::Key &key, const QString &uid)
-{
- run(std::bind(&revUidWorker, std::placeholders::_1, key, uid));
-}
-
-void QGpgMEQuickJob::startAddSubkey(const GpgME::Key &key, const char *algo,
- const QDateTime &expires,
- unsigned int flags)
-{
- run(std::bind(&addSubkeyWorker, std::placeholders::_1, key, algo,
- expires, flags));
-}
-
-void QGpgMEQuickJob::startRevokeSignature(const Key &key, const Key &signingKey, const std::vector<UserID> &userIds)
-{
- run(std::bind(&revokeSignatureWorker, std::placeholders::_1, key, signingKey, userIds));
-}
-
-void QGpgMEQuickJob::startAddAdsk(const GpgME::Key &key, const char *adsk)
-{
- run(std::bind(&addAdskWorker, std::placeholders::_1, key, adsk));
-}
-
-static QGpgMEQuickJob::result_type set_key_enabled(Context *ctx, const Key &key, bool enabled)
-{
- const auto err = ctx->setKeyEnabled(key, enabled);
- return std::make_tuple(err, QString(), Error());
-}
-
-Error QGpgMEQuickJobPrivate::startSetKeyEnabled(const Key &key, bool enabled)
-{
- if (key.isNull()) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- q->run([=](Context *ctx) {
- return set_key_enabled(ctx, key, enabled);
- });
-
- return {};
-}
-
-#include "qgpgmequickjob.moc"
diff --git a/lang/qt/src/qgpgmequickjob.h b/lang/qt/src/qgpgmequickjob.h
deleted file mode 100644
index 07b89e18..00000000
--- a/lang/qt/src/qgpgmequickjob.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* qgpgmequickjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2017 Intevation GmbH
- Copyright (c) 2020 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-#ifndef QGPGME_QGPGMEQUICKJOB_H
-#define QGPGME_QGPGMEQUICKJOB_H
-
-#include "quickjob.h"
-
-#include "threadedjobmixin.h"
-
-namespace QGpgME
-{
-
-/**
- * Interface to the modern key manipulation functions.
- */
-class QGpgMEQuickJob
-#ifdef Q_MOC_RUN
- : public QuickJob
-#else
- : public _detail::ThreadedJobMixin<QuickJob>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEQuickJob(GpgME::Context *context);
- ~QGpgMEQuickJob();
-
- void startCreate(const QString &uid,
- const char *algo,
- const QDateTime &expires = QDateTime(),
- const GpgME::Key &key = GpgME::Key(),
- unsigned int flags = 0) override;
- void startAddUid(const GpgME::Key &key, const QString &uid) override;
- void startRevUid(const GpgME::Key &key, const QString &uid) override;
- void startAddSubkey(const GpgME::Key &key, const char *algo,
- const QDateTime &expires = QDateTime(),
- unsigned int flags = 0) override;
- void startRevokeSignature(const GpgME::Key &key, const GpgME::Key &signingKey,
- const std::vector<GpgME::UserID> &userIds = std::vector<GpgME::UserID>()) override;
- void startAddAdsk(const GpgME::Key &key, const char *adsk) override;
-};
-
-}
-#endif
diff --git a/lang/qt/src/qgpgmereceivekeysjob.cpp b/lang/qt/src/qgpgmereceivekeysjob.cpp
deleted file mode 100644
index 6bfc6b56..00000000
--- a/lang/qt/src/qgpgmereceivekeysjob.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- qgpgmereceivekeysjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "qgpgmereceivekeysjob.h"
-
-#include "util.h"
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEReceiveKeysJob::QGpgMEReceiveKeysJob(Context *context)
- : mixin_type{context}
-{
- lateInitialization();
-}
-
-QGpgMEReceiveKeysJob::~QGpgMEReceiveKeysJob() = default;
-
-static QGpgMEReceiveKeysJob::result_type importfromkeyserver(Context *ctx, const QStringList &keyIds)
-{
- const ImportResult res = ctx->importKeys(toStrings(keyIds));
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, log, ae);
-}
-
-Error QGpgMEReceiveKeysJob::start(const QStringList &keyIds)
-{
- run(std::bind(&importfromkeyserver, std::placeholders::_1, keyIds));
- return Error();
-}
-
-GpgME::ImportResult QGpgME::QGpgMEReceiveKeysJob::exec(const QStringList &keyIds)
-{
- const result_type r = importfromkeyserver(context(), keyIds);
- return std::get<0>(r);
-}
-
-#include "qgpgmereceivekeysjob.moc"
diff --git a/lang/qt/src/qgpgmereceivekeysjob.h b/lang/qt/src/qgpgmereceivekeysjob.h
deleted file mode 100644
index 4c6a24be..00000000
--- a/lang/qt/src/qgpgmereceivekeysjob.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- qgpgmereceivekeysjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMERECEIVEKEYSJOB_H__
-#define __QGPGME_QGPGMERECEIVEKEYSJOB_H__
-
-#include "receivekeysjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/importresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMEReceiveKeysJob
-#ifdef Q_MOC_RUN
- : public ReceiveKeysJob
-#else
- : public _detail::ThreadedJobMixin<ReceiveKeysJob, std::tuple<GpgME::ImportResult, QString, GpgME::Error>>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEReceiveKeysJob(GpgME::Context *context);
- ~QGpgMEReceiveKeysJob() override;
-
- GpgME::Error start(const QStringList &keyIds) override;
-
- GpgME::ImportResult exec(const QStringList &keyIds) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMERECEIVEKEYSJOB_H__
diff --git a/lang/qt/src/qgpgmerefreshsmimekeysjob.cpp b/lang/qt/src/qgpgmerefreshsmimekeysjob.cpp
deleted file mode 100644
index 730cef80..00000000
--- a/lang/qt/src/qgpgmerefreshsmimekeysjob.cpp
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- qgpgmerefreshsmimekeysjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarävdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#define MAX_CMD_LENGTH 32768
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmerefreshsmimekeysjob.h"
-#include "util.h"
-
-#include <QDebug>
-#include "qgpgme_debug.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/key.h>
-
-#include <QByteArray>
-#include <QMetaObject>
-#include <QProcess>
-#include <QStringList>
-
-#include <gpg-error.h>
-
-#include <assert.h>
-
-using namespace QGpgME;
-
-QGpgMERefreshSMIMEKeysJob::QGpgMERefreshSMIMEKeysJob()
- : RefreshKeysJob(nullptr),
- mProcess(nullptr),
- mError(0)
-{
-
-}
-
-QGpgMERefreshSMIMEKeysJob::~QGpgMERefreshSMIMEKeysJob()
-{
-
-}
-
-GpgME::Error QGpgMERefreshSMIMEKeysJob::start(const QStringList &patterns)
-{
- assert(mPatternsToDo.empty());
-
- mPatternsToDo = patterns;
- if (mPatternsToDo.empty()) {
- mPatternsToDo.push_back(QStringLiteral(" ")); // empty list means all -> mae
- }
- // sure to fail the first
- // startAProcess() guard clause
-
- return startAProcess();
-}
-
-GpgME::Error QGpgMERefreshSMIMEKeysJob::start(const std::vector<GpgME::Key> &keys)
-{
- if (keys.empty()) {
- QMetaObject::invokeMethod(this, [this]() {
- Q_EMIT slotProcessExited(0, QProcess::NormalExit);
- }, Qt::QueuedConnection);
- return {};
- }
-
- const bool gotWrongKeys = std::any_of(std::begin(keys), std::end(keys), [](const GpgME::Key &k) {
- return k.protocol() != GpgME::CMS;
- });
- if (gotWrongKeys) {
- qCDebug(QGPGME_LOG) << "Error: At least one of the keys is not an S/MIME key";
- return GpgME::Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- return start(toFingerprints(keys));
-}
-
-#if MAX_CMD_LENGTH < 65 + 128
-#error MAX_CMD_LENGTH is too low
-#endif
-
-GpgME::Error QGpgMERefreshSMIMEKeysJob::startAProcess()
-{
- if (mPatternsToDo.empty()) {
- return GpgME::Error();
- }
- // create and start gpgsm process:
- mProcess = new QProcess(this);
- mProcess->setObjectName(QStringLiteral("gpgsm -k --with-validation --force-crl-refresh --enable-crl-checks"));
-
- // FIXME: obbtain the path to gpgsm from gpgme, so we use the same instance.
- mProcess->setProgram(QStringLiteral("gpgsm"));
- QStringList arguments;
- arguments << QStringLiteral("-k")
- << QStringLiteral("--with-validation")
- << QStringLiteral("--force-crl-refresh")
- << QStringLiteral("--enable-crl-checks");
- unsigned int commandLineLength = MAX_CMD_LENGTH;
- commandLineLength -=
- strlen("gpgsm") + 1 + strlen("-k") + 1 +
- strlen("--with-validation") + 1 + strlen("--force-crl-refresh") + 1 +
- strlen("--enable-crl-checks") + 1;
- while (!mPatternsToDo.empty()) {
- const QByteArray pat = mPatternsToDo.front().toUtf8().trimmed();
- const unsigned int patLength = pat.length();
- if (patLength >= commandLineLength) {
- break;
- }
- mPatternsToDo.pop_front();
- if (pat.isEmpty()) {
- continue;
- }
- arguments << QLatin1String(pat);
- commandLineLength -= patLength + 1;
- }
-
- mProcess->setArguments(arguments);
-
- connect(mProcess, SIGNAL(finished(int,QProcess::ExitStatus)),
- SLOT(slotProcessExited(int,QProcess::ExitStatus)));
- connect(mProcess, &QProcess::readyReadStandardOutput, this, [this]() {
- qCDebug(QGPGME_LOG) << "stdout:" << mProcess->readAllStandardOutput();
- });
- connect(mProcess, &QProcess::readyReadStandardError, this, [this]() {
- qCDebug(QGPGME_LOG) << "stderr:" << mProcess->readAllStandardError();
- });
-
- mProcess->start();
- if (!mProcess->waitForStarted()) {
- mError = GpgME::Error::fromCode(GPG_ERR_ENOENT, GPG_ERR_SOURCE_GPGSM); // what else?
- deleteLater();
- return mError;
- } else {
- return GpgME::Error();
- }
-}
-
-void QGpgMERefreshSMIMEKeysJob::slotCancel()
-{
- if (mProcess) {
- mProcess->kill();
- }
- mProcess = nullptr;
- mError = GpgME::Error::fromCode(GPG_ERR_CANCELED, GPG_ERR_SOURCE_GPGSM);
-}
-
-void QGpgMERefreshSMIMEKeysJob::slotStatus(QProcess *proc, const QString &type, const QStringList &args)
-{
- if (proc != mProcess) {
- return;
- }
- QStringList::const_iterator it = args.begin();
- bool ok = false;
-
- if (type == QLatin1String("ERROR")) {
-
- if (args.size() < 2) {
- qCDebug(QGPGME_LOG) << "not recognising ERROR with < 2 args!";
- return;
- }
- const int source = (*++it).toInt(&ok);
- if (!ok) {
- qCDebug(QGPGME_LOG) << "expected number for first ERROR arg, got something else";
- return;
- }
- ok = false;
- const int code = (*++it).toInt(&ok);
- if (!ok) {
- qCDebug(QGPGME_LOG) << "expected number for second ERROR arg, got something else";
- return;
- }
- mError = GpgME::Error::fromCode(code, source);
-
- } else if (type == QLatin1String("PROGRESS")) {
-
- if (args.size() < 4) {
- qCDebug(QGPGME_LOG) << "not recognising PROGRESS with < 4 args!";
- return;
- }
- const QString what = *++it;
- ok = false;
- const int type = (*++it).toInt(&ok);
- if (!ok) {
- qCDebug(QGPGME_LOG) << "expected number for \"type\", got something else";
- return;
- }
- ok = false;
- const int cur = (*++it).toInt(&ok);
- if (!ok) {
- qCDebug(QGPGME_LOG) << "expected number for \"cur\", got something else";
- return;
- }
- ok = false;
- const int total = (*++it).toInt(&ok);
- if (!ok) {
- qCDebug(QGPGME_LOG) << "expected number for \"total\", got something else";
- return;
- }
- Q_EMIT jobProgress(cur, total);
- Q_EMIT rawProgress(what, type, cur, total);
- QT_WARNING_PUSH
- QT_WARNING_DISABLE_DEPRECATED
- Q_EMIT progress(what, cur, total);
- QT_WARNING_POP
- }
-}
-
-void QGpgMERefreshSMIMEKeysJob::slotProcessExited(int exitCode, QProcess::ExitStatus exitStatus)
-{
- if (!mError && !mPatternsToDo.empty()) {
- if (const GpgME::Error err = startAProcess()) {
- mError = err;
- } else {
- return;
- }
- }
-
- Q_EMIT done();
- if (!mError &&
- (exitStatus != QProcess::NormalExit || exitCode != 0)) {
- mError = GpgME::Error::fromCode(GPG_ERR_GENERAL, GPG_ERR_SOURCE_GPGSM);
- }
- Q_EMIT result(mError);
- deleteLater();
-}
-#include "qgpgmerefreshsmimekeysjob.moc"
diff --git a/lang/qt/src/qgpgmerefreshsmimekeysjob.h b/lang/qt/src/qgpgmerefreshsmimekeysjob.h
deleted file mode 100644
index f2324581..00000000
--- a/lang/qt/src/qgpgmerefreshsmimekeysjob.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- qgpgmerefreshsmimekeysjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMEREFRESHSMIMEKEYSJOB_H__
-#define __QGPGME_QGPGMEREFRESHSMIMEKEYSJOB_H__
-
-#include "refreshkeysjob.h"
-
-#include <gpgme++/context.h>
-
-#include <QStringList>
-#include <QProcess>
-
-namespace QGpgME
-{
-
-class QGpgMERefreshSMIMEKeysJob : public RefreshKeysJob
-{
- Q_OBJECT
-public:
- QGpgMERefreshSMIMEKeysJob();
- ~QGpgMERefreshSMIMEKeysJob();
-
- /* from RefreshKeysJob */
- GpgME::Error start(const QStringList &patterns) override;
-
- GpgME::Error start(const std::vector<GpgME::Key> &keys) override;
-
-private Q_SLOTS:
- /* from Job */
- void slotCancel() override;
-
- void slotStatus(QProcess *, const QString &, const QStringList &);
- void slotProcessExited(int exitCode, QProcess::ExitStatus exitStatus);
-
-private:
- GpgME::Error startAProcess();
-
-private:
- QProcess *mProcess;
- GpgME::Error mError;
- QStringList mPatternsToDo;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEREFRESHSMIMEKEYSJOB_H__
diff --git a/lang/qt/src/qgpgmerevokekeyjob.cpp b/lang/qt/src/qgpgmerevokekeyjob.cpp
deleted file mode 100644
index bf51144d..00000000
--- a/lang/qt/src/qgpgmerevokekeyjob.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- qgpgmerevokekeyjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmerevokekeyjob.h"
-
-#include "dataprovider.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/gpgrevokekeyeditinteractor.h>
-#include <gpgme++/key.h>
-
-#include <gpg-error.h>
-
-#include "qgpgme_debug.h"
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMERevokeKeyJob::QGpgMERevokeKeyJob(Context *context)
- : mixin_type{context}
-{
- lateInitialization();
-}
-
-QGpgMERevokeKeyJob::~QGpgMERevokeKeyJob() = default;
-
-
-static Error check_arguments(const Key &key,
- RevocationReason reason,
- const std::vector<std::string> &description)
-{
- if (key.isNull()) {
- qWarning(QGPGME_LOG) << "Error: Key is null key";
- return Error::fromCode(GPG_ERR_INV_ARG);
- }
- if (reason < RevocationReason::Unspecified || reason > RevocationReason::NoLongerUsed) {
- qWarning(QGPGME_LOG) << "Error: Invalid revocation reason" << static_cast<int>(reason);
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
- if (std::any_of(std::begin(description), std::end(description),
- [](const std::string &line) {
- return line.empty() || line.find('\n') != std::string::npos;
- })) {
- qWarning(QGPGME_LOG) << "Error: Revocation description contains empty lines or lines with endline characters";
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
- return {};
-}
-
-static QGpgMERevokeKeyJob::result_type revoke_key(Context *ctx, const Key &key,
- RevocationReason reason,
- const std::vector<std::string> &description)
-{
- std::unique_ptr<GpgRevokeKeyEditInteractor> interactor{new GpgRevokeKeyEditInteractor};
- interactor->setReason(reason, description);
-
- QGpgME::QByteArrayDataProvider dp;
- Data outData(&dp);
- assert(!outData.isNull());
-
- ctx->setFlag("extended-edit", "1");
-
- const Error err = ctx->edit(key, std::unique_ptr<EditInteractor>(interactor.release()), outData);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(err, log, ae);
-}
-
-Error QGpgMERevokeKeyJob::start(const GpgME::Key &key,
- GpgME::RevocationReason reason,
- const std::vector<std::string> &description)
-{
- Error err = check_arguments(key, reason, description);
- if (!err) {
- run(std::bind(&revoke_key, std::placeholders::_1, key, reason, description));
- }
- return err;
-}
-
-Error QGpgMERevokeKeyJob::exec(const GpgME::Key &key,
- GpgME::RevocationReason reason,
- const std::vector<std::string> &description)
-{
- Error err = check_arguments(key, reason, description);
- if (!err) {
- const result_type r = revoke_key(context(), key, reason, description);
- err = std::get<0>(r);
- }
- return err;
-}
-
-#include "qgpgmerevokekeyjob.moc"
diff --git a/lang/qt/src/qgpgmerevokekeyjob.h b/lang/qt/src/qgpgmerevokekeyjob.h
deleted file mode 100644
index 0eba5cb7..00000000
--- a/lang/qt/src/qgpgmerevokekeyjob.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- qgpgmerevokekeyjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMEREVOKEKEYJOB_H__
-#define __QGPGME_QGPGMEREVOKEKEYJOB_H__
-
-#include "threadedjobmixin.h"
-#include "revokekeyjob.h"
-
-namespace QGpgME
-{
-
-class QGpgMERevokeKeyJob
-#ifdef Q_MOC_RUN
- : public RevokeKeyJob
-#else
- : public _detail::ThreadedJobMixin<RevokeKeyJob>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMERevokeKeyJob(GpgME::Context *context);
- ~QGpgMERevokeKeyJob() override;
-
- GpgME::Error start(const GpgME::Key &key,
- GpgME::RevocationReason reason = GpgME::RevocationReason::Unspecified,
- const std::vector<std::string> &description = {}) override;
-
- GpgME::Error exec(const GpgME::Key &key,
- GpgME::RevocationReason reason = GpgME::RevocationReason::Unspecified,
- const std::vector<std::string> &description = {}) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEREVOKEKEYJOB_H__
diff --git a/lang/qt/src/qgpgmesetprimaryuseridjob.cpp b/lang/qt/src/qgpgmesetprimaryuseridjob.cpp
deleted file mode 100644
index a7d603d5..00000000
--- a/lang/qt/src/qgpgmesetprimaryuseridjob.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- qgpgmesetprimaryuseridjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmesetprimaryuseridjob.h"
-
-#include "util.h"
-
-#include <gpgme++/engineinfo.h>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-static bool quickSetPrimayUidSupportsUidHash()
-{
- return GpgME::engineInfo(GpgME::GpgEngine).engineVersion() >= "2.3.8";
-}
-
-static QGpgMESetPrimaryUserIDJob::result_type set_primary_userid(Context *ctx, const GpgME::UserID &userId)
-{
- auto err = ctx->setPrimaryUid(userId.parent(), quickSetPrimayUidSupportsUidHash() ? userId.uidhash() : userId.id());
- return std::make_tuple(err, QString(), Error());
-}
-
-QGpgMESetPrimaryUserIDJob::QGpgMESetPrimaryUserIDJob(Context *context)
- : mixin_type{context}
-{
- lateInitialization();
-}
-
-QGpgMESetPrimaryUserIDJob::~QGpgMESetPrimaryUserIDJob() = default;
-
-GpgME::Error QGpgMESetPrimaryUserIDJob::start(const GpgME::UserID &userId)
-{
- if (userId.isNull()) {
- return Error{make_error(GPG_ERR_INV_ARG)};
- }
- run([userId](Context *ctx) { return set_primary_userid(ctx, userId); });
- return {};
-}
-
-#include "qgpgmesetprimaryuseridjob.moc"
diff --git a/lang/qt/src/qgpgmesetprimaryuseridjob.h b/lang/qt/src/qgpgmesetprimaryuseridjob.h
deleted file mode 100644
index 4ee967ae..00000000
--- a/lang/qt/src/qgpgmesetprimaryuseridjob.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- qgpgmesetprimaryuseridjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMESETPRIMARYUSERIDJOB_H__
-#define __QGPGME_QGPGMESETPRIMARYUSERIDJOB_H__
-
-#include "setprimaryuseridjob.h"
-#include "threadedjobmixin.h"
-
-namespace QGpgME
-{
-
-class QGpgMESetPrimaryUserIDJob
-#ifdef Q_MOC_RUN
- : public SetPrimaryUserIDJob
-#else
- : public _detail::ThreadedJobMixin<SetPrimaryUserIDJob>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMESetPrimaryUserIDJob(GpgME::Context *context);
- ~QGpgMESetPrimaryUserIDJob() override;
-
- GpgME::Error start(const GpgME::UserID &userId) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMESETPRIMARYUSERIDJOB_H__
diff --git a/lang/qt/src/qgpgmesignarchivejob.cpp b/lang/qt/src/qgpgmesignarchivejob.cpp
deleted file mode 100644
index 4d257284..00000000
--- a/lang/qt/src/qgpgmesignarchivejob.cpp
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- qgpgmesignarchivejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2007,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2022,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmesignarchivejob.h"
-
-#include "dataprovider.h"
-#include "signarchivejob_p.h"
-#include "filelistdataprovider.h"
-#include "qgpgme_debug.h"
-#include "util.h"
-
-#include <QFile>
-
-#include <gpgme++/data.h>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMESignArchiveJobPrivate : public SignArchiveJobPrivate
-{
- QGpgMESignArchiveJob *q = nullptr;
-
-public:
- QGpgMESignArchiveJobPrivate(QGpgMESignArchiveJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMESignArchiveJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override;
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMESignArchiveJob::QGpgMESignArchiveJob(Context *context)
- : mixin_type{context}
-{
- setJobPrivate(this, std::unique_ptr<QGpgMESignArchiveJobPrivate>{new QGpgMESignArchiveJobPrivate{this}});
- lateInitialization();
- connect(this, &Job::rawProgress, this, [this](const QString &what, int type, int current, int total) {
- emitArchiveProgressSignals(this, what, type, current, total);
- });
-}
-
-static QGpgMESignArchiveJob::result_type sign(Context *ctx,
- const std::vector<Key> &signers,
- const std::vector<QString> &paths,
- GpgME::Data &outdata,
- const QString &baseDirectory)
-{
- QGpgME::FileListDataProvider in{paths};
- Data indata(&in);
- if (!baseDirectory.isEmpty()) {
- indata.setFileName(baseDirectory.toStdString());
- }
-
- ctx->clearSigningKeys();
- for (const Key &signer : signers) {
- if (!signer.isNull()) {
- if (const Error err = ctx->addSigningKey(signer)) {
- return std::make_tuple(SigningResult{err}, QString{}, Error{});
- }
- }
- }
-
- const auto signingResult = ctx->sign(indata, outdata, GpgME::SignArchive);
-
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(signingResult, log, ae);
-}
-
-static QGpgMESignArchiveJob::result_type sign_to_io_device(Context *ctx,
- QThread *thread,
- const std::vector<Key> &signers,
- const std::vector<QString> &paths,
- const std::weak_ptr<QIODevice> &output_,
- const QString &baseDirectory)
-{
- const std::shared_ptr<QIODevice> output = output_.lock();
- const _detail::ToThreadMover ctMover(output, thread);
- QGpgME::QIODeviceDataProvider out{output};
- Data outdata(&out);
-
- return sign(ctx, signers, paths, outdata, baseDirectory);
-}
-
-static QGpgMESignArchiveJob::result_type sign_to_filename(Context *ctx,
- const std::vector<Key> &signers,
- const std::vector<QString> &paths,
- const QString &outputFileName,
- const QString &baseDirectory)
-{
- PartialFileGuard partFileGuard{outputFileName};
- if (partFileGuard.tempFileName().isEmpty()) {
- return std::make_tuple(SigningResult{Error::fromCode(GPG_ERR_EEXIST)}, QString{}, Error{});
- }
-
- Data outdata;
-#ifdef Q_OS_WIN
- outdata.setFileName(partFileGuard.tempFileName().toUtf8().constData());
-#else
- outdata.setFileName(QFile::encodeName(partFileGuard.tempFileName()).constData());
-#endif
-
- const auto result = sign(ctx, signers, paths, outdata, baseDirectory);
- const auto &signingResult = std::get<0>(result);
- if (!signingResult.error().code()) {
- // the operation succeeded -> save the result under the requested file name
- partFileGuard.commit();
- }
-
- return result;
-}
-
-GpgME::Error QGpgMESignArchiveJob::start(const std::vector<GpgME::Key> &signers,
- const std::vector<QString> &paths,
- const std::shared_ptr<QIODevice> &output)
-{
- if (!output) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- run(std::bind(&sign_to_io_device,
- std::placeholders::_1,
- std::placeholders::_2,
- signers,
- paths,
- std::placeholders::_3,
- baseDirectory()),
- output);
- return {};
-}
-
-
-GpgME::Error QGpgMESignArchiveJobPrivate::startIt()
-{
- if (m_outputFilePath.isEmpty()) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- q->run([=](Context *ctx) {
- return sign_to_filename(ctx, m_signers, m_inputPaths, m_outputFilePath, m_baseDirectory);
- });
-
- return {};
-}
-
-#include "qgpgmesignarchivejob.moc"
diff --git a/lang/qt/src/qgpgmesignarchivejob.h b/lang/qt/src/qgpgmesignarchivejob.h
deleted file mode 100644
index 5755a91c..00000000
--- a/lang/qt/src/qgpgmesignarchivejob.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- qgpgmesignarchivejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMESIGNARCHIVEJOB_H__
-#define __QGPGME_QGPGMESIGNARCHIVEJOB_H__
-
-#include "signarchivejob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/signingresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMESignArchiveJob
-#ifdef Q_MOC_RUN
- : public SignArchiveJob
-#else
- : public _detail::ThreadedJobMixin<SignArchiveJob, std::tuple<GpgME::SigningResult, QString, GpgME::Error>>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMESignArchiveJob(GpgME::Context *context);
- ~QGpgMESignArchiveJob() = default;
-
- GpgME::Error start(const std::vector<GpgME::Key> &signers,
- const std::vector<QString> &paths,
- const std::shared_ptr<QIODevice> &output) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMESIGNARCHIVEJOB_H__
diff --git a/lang/qt/src/qgpgmesignencryptarchivejob.cpp b/lang/qt/src/qgpgmesignencryptarchivejob.cpp
deleted file mode 100644
index c3e23b43..00000000
--- a/lang/qt/src/qgpgmesignencryptarchivejob.cpp
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- qgpgmesignencryptarchivejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2007,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2022,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmesignencryptarchivejob.h"
-
-#include "dataprovider.h"
-#include "signencryptarchivejob_p.h"
-#include "filelistdataprovider.h"
-#include "qgpgme_debug.h"
-#include "util.h"
-
-#include <QFile>
-
-#include <gpgme++/data.h>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMESignEncryptArchiveJobPrivate : public SignEncryptArchiveJobPrivate
-{
- QGpgMESignEncryptArchiveJob *q = nullptr;
-
-public:
- QGpgMESignEncryptArchiveJobPrivate(QGpgMESignEncryptArchiveJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMESignEncryptArchiveJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override;
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMESignEncryptArchiveJob::QGpgMESignEncryptArchiveJob(Context *context)
- : mixin_type{context}
-{
- setJobPrivate(this, std::unique_ptr<QGpgMESignEncryptArchiveJobPrivate>{new QGpgMESignEncryptArchiveJobPrivate{this}});
- lateInitialization();
- connect(this, &Job::rawProgress, this, [this](const QString &what, int type, int current, int total) {
- emitArchiveProgressSignals(this, what, type, current, total);
- });
-}
-
-static QGpgMESignEncryptArchiveJob::result_type sign_encrypt(Context *ctx,
- const std::vector<GpgME::Key> &signers,
- const std::vector<Key> &recipients,
- const std::vector<QString> &paths,
- GpgME::Data &outdata,
- Context::EncryptionFlags encryptionFlags,
- const QString &baseDirectory)
-{
- QGpgME::FileListDataProvider in{paths};
- Data indata(&in);
- if (!baseDirectory.isEmpty()) {
- indata.setFileName(baseDirectory.toStdString());
- }
-
- ctx->clearSigningKeys();
- for (const Key &signer : signers) {
- if (!signer.isNull()) {
- if (const Error err = ctx->addSigningKey(signer)) {
- return std::make_tuple(SigningResult{err}, EncryptionResult{}, QString{}, Error{});
- }
- }
- }
-
- encryptionFlags = static_cast<Context::EncryptionFlags>(encryptionFlags | Context::EncryptArchive);
- const auto res = ctx->signAndEncrypt(recipients, indata, outdata, encryptionFlags);
- const auto &signingResult = res.first;
- const auto &encryptionResult = res.second;
-
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(signingResult, encryptionResult, log, ae);
-}
-
-static QGpgMESignEncryptArchiveJob::result_type sign_encrypt_to_io_device(Context *ctx,
- QThread *thread,
- const std::vector<GpgME::Key> &signers,
- const std::vector<Key> &recipients,
- const std::vector<QString> &paths,
- const std::weak_ptr<QIODevice> &cipherText_,
- Context::EncryptionFlags encryptionFlags,
- const QString &baseDirectory)
-{
- const std::shared_ptr<QIODevice> cipherText = cipherText_.lock();
- const _detail::ToThreadMover ctMover(cipherText, thread);
- QGpgME::QIODeviceDataProvider out{cipherText};
- Data outdata(&out);
-
- return sign_encrypt(ctx, signers, recipients, paths, outdata, encryptionFlags, baseDirectory);
-}
-
-static QGpgMESignEncryptArchiveJob::result_type sign_encrypt_to_filename(Context *ctx,
- const std::vector<GpgME::Key> &signers,
- const std::vector<Key> &recipients,
- const std::vector<QString> &paths,
- const QString &outputFileName,
- Context::EncryptionFlags encryptionFlags,
- const QString &baseDirectory)
-{
- PartialFileGuard partFileGuard{outputFileName};
- if (partFileGuard.tempFileName().isEmpty()) {
- return std::make_tuple(SigningResult{Error::fromCode(GPG_ERR_EEXIST)},
- EncryptionResult{Error::fromCode(GPG_ERR_EEXIST)},
- QString{},
- Error{});
- }
-
- Data outdata;
-#ifdef Q_OS_WIN
- outdata.setFileName(partFileGuard.tempFileName().toUtf8().constData());
-#else
- outdata.setFileName(QFile::encodeName(partFileGuard.tempFileName()).constData());
-#endif
-
- const auto result = sign_encrypt(ctx, signers, recipients, paths, outdata, encryptionFlags, baseDirectory);
- const auto &signingResult = std::get<0>(result);
- const auto &encryptionResult = std::get<1>(result);
- if (!signingResult.error().code() && !encryptionResult.error().code()) {
- // the operation succeeded -> save the result under the requested file name
- partFileGuard.commit();
- }
-
- return result;
-}
-
-GpgME::Error QGpgMESignEncryptArchiveJob::start(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const std::vector<QString> &paths,
- const std::shared_ptr<QIODevice> &cipherText,
- const GpgME::Context::EncryptionFlags encryptionFlags)
-{
- if (!cipherText) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- run(std::bind(&sign_encrypt_to_io_device,
- std::placeholders::_1,
- std::placeholders::_2,
- signers,
- recipients,
- paths,
- std::placeholders::_3,
- encryptionFlags,
- baseDirectory()),
- cipherText);
- return {};
-}
-
-GpgME::Error QGpgMESignEncryptArchiveJobPrivate::startIt()
-{
- if (m_outputFilePath.isEmpty()) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- q->run([=](Context *ctx) {
- return sign_encrypt_to_filename(ctx, m_signers, m_recipients, m_inputPaths, m_outputFilePath, m_encryptionFlags, m_baseDirectory);
- });
-
- return {};
-}
-
-#include "qgpgmesignencryptarchivejob.moc"
diff --git a/lang/qt/src/qgpgmesignencryptarchivejob.h b/lang/qt/src/qgpgmesignencryptarchivejob.h
deleted file mode 100644
index 2675b28a..00000000
--- a/lang/qt/src/qgpgmesignencryptarchivejob.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- qgpgmesignencryptarchivejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMESIGNENCRYPTARCHIVEJOB_H__
-#define __QGPGME_QGPGMESIGNENCRYPTARCHIVEJOB_H__
-
-#include "signencryptarchivejob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/encryptionresult.h>
-#include <gpgme++/signingresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMESignEncryptArchiveJob
-#ifdef Q_MOC_RUN
- : public SignEncryptArchiveJob
-#else
- : public _detail::ThreadedJobMixin<SignEncryptArchiveJob, std::tuple<GpgME::SigningResult, GpgME::EncryptionResult, QString, GpgME::Error>>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMESignEncryptArchiveJob(GpgME::Context *context);
- ~QGpgMESignEncryptArchiveJob() = default;
-
- GpgME::Error start(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const std::vector<QString> &paths,
- const std::shared_ptr<QIODevice> &cipherText,
- const GpgME::Context::EncryptionFlags flags) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMESIGNENCRYPTARCHIVEJOB_H__
diff --git a/lang/qt/src/qgpgmesignencryptjob.cpp b/lang/qt/src/qgpgmesignencryptjob.cpp
deleted file mode 100644
index 8634d91d..00000000
--- a/lang/qt/src/qgpgmesignencryptjob.cpp
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- qgpgmesignencryptjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004, 2007 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2022,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmesignencryptjob.h"
-
-#include "dataprovider.h"
-#include "signencryptjob_p.h"
-#include "util.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/exception.h>
-#include <gpgme++/key.h>
-
-#include <QBuffer>
-#include <QFileInfo>
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMESignEncryptJobPrivate : public SignEncryptJobPrivate
-{
- QGpgMESignEncryptJob *q = nullptr;
-
-public:
- QGpgMESignEncryptJobPrivate(QGpgMESignEncryptJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMESignEncryptJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override;
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMESignEncryptJob::QGpgMESignEncryptJob(Context *context)
- : mixin_type(context),
- mOutputIsBase64Encoded(false)
-{
- setJobPrivate(this, std::unique_ptr<QGpgMESignEncryptJobPrivate>{new QGpgMESignEncryptJobPrivate{this}});
- lateInitialization();
-}
-
-QGpgMESignEncryptJob::~QGpgMESignEncryptJob() {}
-
-void QGpgMESignEncryptJob::setOutputIsBase64Encoded(bool on)
-{
- mOutputIsBase64Encoded = on;
-}
-
-static QGpgMESignEncryptJob::result_type sign_encrypt(Context *ctx, QThread *thread, const std::vector<Key> &signers,
- const std::vector<Key> &recipients, const std::weak_ptr<QIODevice> &plainText_,
- const std::weak_ptr<QIODevice> &cipherText_, const Context::EncryptionFlags eflags, bool outputIsBsse64Encoded, const QString &fileName)
-{
- const std::shared_ptr<QIODevice> &plainText = plainText_.lock();
- const std::shared_ptr<QIODevice> &cipherText = cipherText_.lock();
-
- const _detail::ToThreadMover ctMover(cipherText, thread);
- const _detail::ToThreadMover ptMover(plainText, thread);
-
- QGpgME::QIODeviceDataProvider in(plainText);
- Data indata(&in);
- if (!plainText->isSequential()) {
- indata.setSizeHint(plainText->size());
- }
-
- const auto pureFileName = QFileInfo{fileName}.fileName().toStdString();
- if (!pureFileName.empty()) {
- indata.setFileName(pureFileName.c_str());
- }
-
- ctx->clearSigningKeys();
- for (const Key &signer : signers) {
- if (!signer.isNull()) {
- if (const Error err = ctx->addSigningKey(signer)) {
- return std::make_tuple(SigningResult(err), EncryptionResult(), QByteArray(), QString(), Error());
- }
- }
- }
-
- if (!cipherText) {
- QGpgME::QByteArrayDataProvider out;
- Data outdata(&out);
-
- if (outputIsBsse64Encoded) {
- outdata.setEncoding(Data::Base64Encoding);
- }
-
- const std::pair<SigningResult, EncryptionResult> res = ctx->signAndEncrypt(recipients, indata, outdata, eflags);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res.first, res.second, out.data(), log, ae);
- } else {
- QGpgME::QIODeviceDataProvider out(cipherText);
- Data outdata(&out);
-
- if (outputIsBsse64Encoded) {
- outdata.setEncoding(Data::Base64Encoding);
- }
-
- const std::pair<SigningResult, EncryptionResult> res = ctx->signAndEncrypt(recipients, indata, outdata, eflags);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res.first, res.second, QByteArray(), log, ae);
- }
-
-}
-
-static QGpgMESignEncryptJob::result_type sign_encrypt_qba(Context *ctx, const std::vector<Key> &signers,
- const std::vector<Key> &recipients, const QByteArray &plainText, const Context::EncryptionFlags eflags, bool outputIsBsse64Encoded, const QString &fileName)
-{
- const std::shared_ptr<QBuffer> buffer(new QBuffer);
- buffer->setData(plainText);
- if (!buffer->open(QIODevice::ReadOnly)) {
- assert(!"This should never happen: QBuffer::open() failed");
- }
- return sign_encrypt(ctx, nullptr, signers, recipients, buffer, std::shared_ptr<QIODevice>(), eflags, outputIsBsse64Encoded, fileName);
-}
-
-static QGpgMESignEncryptJob::result_type sign_encrypt_to_filename(Context *ctx,
- const std::vector<Key> &signers,
- const std::vector<Key> &recipients,
- const QString &inputFilePath,
- const QString &outputFilePath,
- Context::EncryptionFlags flags)
-{
- Data indata;
-#ifdef Q_OS_WIN
- indata.setFileName(inputFilePath.toUtf8().constData());
-#else
- indata.setFileName(QFile::encodeName(inputFilePath).constData());
-#endif
-
- PartialFileGuard partFileGuard{outputFilePath};
- if (partFileGuard.tempFileName().isEmpty()) {
- return std::make_tuple(SigningResult{Error::fromCode(GPG_ERR_EEXIST)},
- EncryptionResult{Error::fromCode(GPG_ERR_EEXIST)},
- QByteArray{},
- QString{},
- Error{});
- }
-
- Data outdata;
-#ifdef Q_OS_WIN
- outdata.setFileName(partFileGuard.tempFileName().toUtf8().constData());
-#else
- outdata.setFileName(QFile::encodeName(partFileGuard.tempFileName()).constData());
-#endif
-
- ctx->clearSigningKeys();
- for (const Key &signer : signers) {
- if (!signer.isNull()) {
- if (const Error err = ctx->addSigningKey(signer)) {
- return std::make_tuple(SigningResult{err}, EncryptionResult{}, QByteArray{}, QString{}, Error{});
- }
- }
- }
-
- flags = static_cast<Context::EncryptionFlags>(flags | Context::EncryptFile);
- const auto results = ctx->signAndEncrypt(recipients, indata, outdata, flags);
- const auto &signingResult = results.first;
- const auto &encryptionResult = results.second;
-
- if (!signingResult.error().code() && !encryptionResult.error().code()) {
- // the operation succeeded -> save the result under the requested file name
- partFileGuard.commit();
- }
-
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(signingResult, encryptionResult, QByteArray{}, log, ae);
-}
-
-Error QGpgMESignEncryptJob::start(const std::vector<Key> &signers, const std::vector<Key> &recipients, const QByteArray &plainText, bool alwaysTrust)
-{
- run(std::bind(&sign_encrypt_qba, std::placeholders::_1, signers, recipients, plainText, alwaysTrust ? Context::AlwaysTrust : Context::None, mOutputIsBase64Encoded, fileName()));
- return Error();
-}
-
-void QGpgMESignEncryptJob::start(const std::vector<Key> &signers, const std::vector<Key> &recipients,
- const std::shared_ptr<QIODevice> &plainText, const std::shared_ptr<QIODevice> &cipherText, const Context::EncryptionFlags eflags)
-{
- run(std::bind(&sign_encrypt, std::placeholders::_1, std::placeholders::_2, signers, recipients, std::placeholders::_3, std::placeholders::_4, eflags, mOutputIsBase64Encoded, fileName()), plainText, cipherText);
-}
-
-void QGpgMESignEncryptJob::start(const std::vector<Key> &signers, const std::vector<Key> &recipients, const std::shared_ptr<QIODevice> &plainText, const std::shared_ptr<QIODevice> &cipherText, bool alwaysTrust)
-{
- return start(signers, recipients, plainText, cipherText, alwaysTrust ? Context::AlwaysTrust : Context::None);
-}
-
-std::pair<SigningResult, EncryptionResult> QGpgMESignEncryptJob::exec(const std::vector<Key> &signers, const std::vector<Key> &recipients, const QByteArray &plainText, const Context::EncryptionFlags eflags, QByteArray &cipherText)
-{
- const result_type r = sign_encrypt_qba(context(), signers, recipients, plainText, eflags, mOutputIsBase64Encoded, fileName());
- cipherText = std::get<2>(r);
- return std::make_pair(std::get<0>(r), std::get<1>(r));
-}
-
-std::pair<SigningResult, EncryptionResult> QGpgMESignEncryptJob::exec(const std::vector<Key> &signers, const std::vector<Key> &recipients, const QByteArray &plainText, bool alwaysTrust, QByteArray &cipherText)
-{
- return exec(signers, recipients, plainText, alwaysTrust ? Context::AlwaysTrust : Context::None, cipherText);
-}
-
-GpgME::Error QGpgMESignEncryptJobPrivate::startIt()
-{
- if (m_inputFilePath.isEmpty() || m_outputFilePath.isEmpty()) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- q->run([=](Context *ctx) {
- return sign_encrypt_to_filename(ctx, m_signers, m_recipients, m_inputFilePath, m_outputFilePath, m_encryptionFlags);
- });
-
- return {};
-}
-
-#include "qgpgmesignencryptjob.moc"
diff --git a/lang/qt/src/qgpgmesignencryptjob.h b/lang/qt/src/qgpgmesignencryptjob.h
deleted file mode 100644
index a0014d2b..00000000
--- a/lang/qt/src/qgpgmesignencryptjob.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- qgpgmesignencryptjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2007,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMESIGNENCRYPTJOB_H__
-#define __QGPGME_QGPGMESIGNENCRYPTJOB_H__
-
-#include "signencryptjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/signingresult.h>
-#include <gpgme++/encryptionresult.h>
-#include <gpgme++/key.h>
-
-#include <utility>
-
-namespace QGpgME
-{
-
-class QGpgMESignEncryptJob
-#ifdef Q_MOC_RUN
- : public SignEncryptJob
-#else
- : public _detail::ThreadedJobMixin<SignEncryptJob, std::tuple<GpgME::SigningResult, GpgME::EncryptionResult, QByteArray, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMESignEncryptJob(GpgME::Context *context);
- ~QGpgMESignEncryptJob();
-
- /* from SignEncryptJob */
- GpgME::Error start(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText, bool alwaysTrust) override;
-
- /* from SignEncryptJob */
- void start(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const std::shared_ptr<QIODevice> &plainText,
- const std::shared_ptr<QIODevice> &cipherText,
- bool alwaysTrust) override;
-
- void start(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const std::shared_ptr<QIODevice> &plainText,
- const std::shared_ptr<QIODevice> &cipherText,
- const GpgME::Context::EncryptionFlags flags) override;
-
- std::pair<GpgME::SigningResult, GpgME::EncryptionResult>
- exec(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText, bool alwaysTrust,
- QByteArray &cipherText) override;
-
- std::pair<GpgME::SigningResult, GpgME::EncryptionResult>
- exec(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText, const GpgME::Context::EncryptionFlags flags,
- QByteArray &cipherText) override;
-
- /* from SignEncryptJob */
- void setOutputIsBase64Encoded(bool on) override;
-
-private:
- bool mOutputIsBase64Encoded;
-};
-
-}
-
-#endif // __QGPGME_QGPGMESIGNENCRYPTJOB_H__
diff --git a/lang/qt/src/qgpgmesignjob.cpp b/lang/qt/src/qgpgmesignjob.cpp
deleted file mode 100644
index 79077f4a..00000000
--- a/lang/qt/src/qgpgmesignjob.cpp
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- qgpgmesignjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2007,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmesignjob.h"
-
-#include "dataprovider.h"
-#include "signjob_p.h"
-#include "util.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/signingresult.h>
-
-#include <QBuffer>
-#include <QFile>
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMESignJobPrivate : public SignJobPrivate
-{
- QGpgMESignJob *q = nullptr;
-
-public:
- QGpgMESignJobPrivate(QGpgMESignJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMESignJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override;
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMESignJob::QGpgMESignJob(Context *context)
- : mixin_type(context),
- mOutputIsBase64Encoded(false)
-{
- setJobPrivate(this, std::unique_ptr<QGpgMESignJobPrivate>{new QGpgMESignJobPrivate{this}});
- lateInitialization();
-}
-
-QGpgMESignJob::~QGpgMESignJob() {}
-
-void QGpgMESignJob::setOutputIsBase64Encoded(bool on)
-{
- mOutputIsBase64Encoded = on;
-}
-
-static QGpgMESignJob::result_type sign(Context *ctx, QThread *thread,
- const std::vector<Key> &signers,
- const std::weak_ptr<QIODevice> &plainText_,
- const std::weak_ptr<QIODevice> &signature_,
- SignatureMode mode,
- bool outputIsBsse64Encoded)
-{
-
- const std::shared_ptr<QIODevice> plainText = plainText_.lock();
- const std::shared_ptr<QIODevice> signature = signature_.lock();
-
- const _detail::ToThreadMover ptMover(plainText, thread);
- const _detail::ToThreadMover sgMover(signature, thread);
-
- QGpgME::QIODeviceDataProvider in(plainText);
- Data indata(&in);
- if (!plainText->isSequential()) {
- indata.setSizeHint(plainText->size());
- }
-
- ctx->clearSigningKeys();
- for (const Key &signer : signers) {
- if (!signer.isNull()) {
- if (const Error err = ctx->addSigningKey(signer)) {
- return std::make_tuple(SigningResult(err), QByteArray(), QString(), Error());
- }
- }
- }
-
- if (!signature) {
- QGpgME::QByteArrayDataProvider out;
- Data outdata(&out);
-
- if (outputIsBsse64Encoded) {
- outdata.setEncoding(Data::Base64Encoding);
- }
-
- const SigningResult res = ctx->sign(indata, outdata, mode);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, out.data(), log, ae);
- } else {
- QGpgME::QIODeviceDataProvider out(signature);
- Data outdata(&out);
-
- if (outputIsBsse64Encoded) {
- outdata.setEncoding(Data::Base64Encoding);
- }
-
- const SigningResult res = ctx->sign(indata, outdata, mode);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, QByteArray(), log, ae);
- }
-
-}
-
-static QGpgMESignJob::result_type sign_qba(Context *ctx,
- const std::vector<Key> &signers,
- const QByteArray &plainText,
- SignatureMode mode,
- bool outputIsBsse64Encoded)
-{
- const std::shared_ptr<QBuffer> buffer(new QBuffer);
- buffer->setData(plainText);
- if (!buffer->open(QIODevice::ReadOnly)) {
- assert(!"This should never happen: QBuffer::open() failed");
- }
- return sign(ctx, nullptr, signers, buffer, std::shared_ptr<QIODevice>(), mode, outputIsBsse64Encoded);
-}
-
-static QGpgMESignJob::result_type sign_to_filename(Context *ctx,
- const std::vector<Key> &signers,
- const QString &inputFilePath,
- const QString &outputFilePath,
- SignatureMode flags,
- bool appendSignature)
-{
- Data indata;
-#ifdef Q_OS_WIN
- indata.setFileName(inputFilePath.toUtf8().constData());
-#else
- indata.setFileName(QFile::encodeName(inputFilePath).constData());
-#endif
-
- PartialFileGuard partFileGuard{outputFilePath};
- if (partFileGuard.tempFileName().isEmpty()) {
- return std::make_tuple(SigningResult{Error::fromCode(GPG_ERR_EEXIST)},
- QByteArray{},
- QString{},
- Error{});
- }
-
- Data outdata;
-#ifdef Q_OS_WIN
- outdata.setFileName(partFileGuard.tempFileName().toUtf8().constData());
-#else
- outdata.setFileName(QFile::encodeName(partFileGuard.tempFileName()).constData());
-#endif
-
- ctx->clearSigningKeys();
- for (const Key &signer : signers) {
- if (!signer.isNull()) {
- if (const Error err = ctx->addSigningKey(signer)) {
- return std::make_tuple(SigningResult{err}, QByteArray{}, QString{}, Error{});
- }
- }
- }
-
- flags = static_cast<SignatureMode>(flags | SignFile);
- const auto signingResult = ctx->sign(indata, outdata, flags);
-
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
-
- if (!signingResult.error().code()) {
- // the operation succeeded
- const bool appendSignatureToExistingFile = appendSignature && (flags & Detached) && QFile::exists(outputFilePath);
- if (appendSignatureToExistingFile) {
- // append the result to the existing file
- QFile newSignatureFile{partFileGuard.tempFileName()};
- if (!newSignatureFile.open(QIODevice::ReadOnly)) {
- qCDebug(QGPGME_LOG) << "Failed to open detached signature file" << newSignatureFile.fileName() << "(" << newSignatureFile.errorString() << ")";
- return std::make_tuple(SigningResult{Error::fromCode(GPG_ERR_GENERAL)}, QByteArray{}, log, ae);
- }
- const QByteArray newSigData = newSignatureFile.readAll();
- if (newSigData.isEmpty()) {
- qCDebug(QGPGME_LOG) << "Failed to read detached signature from file" << newSignatureFile.fileName() << "(" << newSignatureFile.errorString() << ")";
- return std::make_tuple(SigningResult{Error::fromCode(GPG_ERR_GENERAL)}, QByteArray{}, log, ae);
- }
- newSignatureFile.close();
-
- QFile existingSignatureFile{outputFilePath};
- if (!existingSignatureFile.open(QIODevice::WriteOnly | QIODevice::Append)) {
- qCDebug(QGPGME_LOG) << "Failed to open existing detached signature file for appending" << existingSignatureFile.fileName() << "(" << existingSignatureFile.errorString() << ")";
- return std::make_tuple(SigningResult{Error::fromCode(GPG_ERR_GENERAL)}, QByteArray{}, log, ae);
- }
- const auto bytesWritten = existingSignatureFile.write(newSigData);
- if (bytesWritten != newSigData.size()) {
- qCDebug(QGPGME_LOG) << "Failed to write new signature to existing detached signature file" << existingSignatureFile.fileName() << "(" << existingSignatureFile.errorString() << ")";
- return std::make_tuple(SigningResult{Error::fromCode(GPG_ERR_GENERAL)}, QByteArray{}, log, ae);
- }
- } else {
- // save the result under the requested file name
- partFileGuard.commit();
- }
- }
-
- return std::make_tuple(signingResult, QByteArray{}, log, ae);
-}
-
-Error QGpgMESignJob::start(const std::vector<Key> &signers, const QByteArray &plainText, SignatureMode mode)
-{
- run(std::bind(&sign_qba, std::placeholders::_1, signers, plainText, mode, mOutputIsBase64Encoded));
- return Error();
-}
-
-void QGpgMESignJob::start(const std::vector<Key> &signers, const std::shared_ptr<QIODevice> &plainText, const std::shared_ptr<QIODevice> &signature, SignatureMode mode)
-{
- run(std::bind(&sign, std::placeholders::_1, std::placeholders::_2, signers, std::placeholders::_3, std::placeholders::_4, mode, mOutputIsBase64Encoded), plainText, signature);
-}
-
-SigningResult QGpgMESignJob::exec(const std::vector<Key> &signers, const QByteArray &plainText, SignatureMode mode, QByteArray &signature)
-{
- const result_type r = sign_qba(context(), signers, plainText, mode, mOutputIsBase64Encoded);
- signature = std::get<1>(r);
- return std::get<0>(r);
-}
-
-GpgME::Error QGpgMESignJobPrivate::startIt()
-{
- if (m_inputFilePath.isEmpty() || m_outputFilePath.isEmpty()) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- q->run([=](Context *ctx) {
- return sign_to_filename(ctx, m_signers, m_inputFilePath, m_outputFilePath, m_signingFlags, m_appendSignature);
- });
-
- return {};
-}
-
-#include "qgpgmesignjob.moc"
diff --git a/lang/qt/src/qgpgmesignjob.h b/lang/qt/src/qgpgmesignjob.h
deleted file mode 100644
index 27d352d0..00000000
--- a/lang/qt/src/qgpgmesignjob.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- qgpgmesignjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2007,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMESIGNJOB_H__
-#define __QGPGME_QGPGMESIGNJOB_H__
-
-#include "signjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/signingresult.h>
-#include <gpgme++/key.h>
-
-namespace QGpgME
-{
-
-class QGpgMESignJob
-#ifdef Q_MOC_RUN
- : public SignJob
-#else
- : public _detail::ThreadedJobMixin<SignJob, std::tuple<GpgME::SigningResult, QByteArray, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMESignJob(GpgME::Context *context);
- ~QGpgMESignJob();
-
- /* from SignJob */
- GpgME::Error start(const std::vector<GpgME::Key> &signers,
- const QByteArray &plainText,
- GpgME::SignatureMode mode) override;
-
- /* from SignJob */
- void start(const std::vector<GpgME::Key> &signers,
- const std::shared_ptr<QIODevice> &plainText,
- const std::shared_ptr<QIODevice> &signature,
- GpgME::SignatureMode mode) override;
-
- /* from SignJob */
- GpgME::SigningResult exec(const std::vector<GpgME::Key> &signers,
- const QByteArray &plainText,
- GpgME::SignatureMode mode,
- QByteArray &signature) override;
-
- /* from SignJob */
- void setOutputIsBase64Encoded(bool on) override;
-
-private:
- bool mOutputIsBase64Encoded;
-};
-
-}
-
-#endif // __QGPGME_QGPGMESIGNJOB_H__
diff --git a/lang/qt/src/qgpgmesignkeyjob.cpp b/lang/qt/src/qgpgmesignkeyjob.cpp
deleted file mode 100644
index 0fdab165..00000000
--- a/lang/qt/src/qgpgmesignkeyjob.cpp
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- qgpgmesignkeyjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmesignkeyjob.h"
-
-#include <QDate>
-#include <QString>
-
-#include "dataprovider.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/gpgsignkeyeditinteractor.h>
-
-#include "qgpgme_debug.h"
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-struct TrustSignatureProperties {
- TrustSignatureProperties() = default;
- // needed for C++11 because until C++14 "aggregate initialization requires
- // class type, that has no default member initializers"
- TrustSignatureProperties(TrustSignatureTrust trust_, unsigned int depth_, const QString &scope_)
- : trust{trust_}
- , depth{depth_}
- , scope{scope_}
- {}
-
- TrustSignatureTrust trust = TrustSignatureTrust::None;
- unsigned int depth = 0;
- QString scope;
-};
-}
-
-class QGpgMESignKeyJob::Private
-{
-public:
- Private() = default;
-
- std::vector<unsigned int> m_userIDsToSign;
- GpgME::Key m_signingKey;
- unsigned int m_checkLevel = 0;
- bool m_exportable = false;
- bool m_nonRevocable = false;
- bool m_started = false;
- bool m_dupeOk = false;
- QString m_remark;
- TrustSignatureProperties m_trustSignature;
- QDate m_expiration;
-};
-
-QGpgMESignKeyJob::QGpgMESignKeyJob(Context *context)
- : mixin_type(context)
- , d{std::unique_ptr<Private>(new Private())}
-{
- lateInitialization();
-}
-
-QGpgMESignKeyJob::~QGpgMESignKeyJob() {}
-
-static QGpgMESignKeyJob::result_type sign_key(Context *ctx, const Key &key, const std::vector<unsigned int> &uids,
- unsigned int checkLevel, const Key &signer, unsigned int opts,
- bool dupeOk, const QString &remark,
- const TrustSignatureProperties &trustSignature,
- const QDate &expirationDate)
-{
- QGpgME::QByteArrayDataProvider dp;
- Data data(&dp);
-
- GpgSignKeyEditInteractor *skei(new GpgSignKeyEditInteractor);
- skei->setUserIDsToSign(uids);
- skei->setCheckLevel(checkLevel);
- skei->setSigningOptions(opts);
- skei->setKey(key);
-
- if (dupeOk) {
- ctx->setFlag("extended-edit", "1");
- skei->setDupeOk(true);
- }
-
- if (!remark.isEmpty()) {
- ctx->addSignatureNotation("[email protected]", remark.toUtf8().constData());
- }
-
- if (opts & GpgSignKeyEditInteractor::Trust) {
- skei->setTrustSignatureTrust(trustSignature.trust);
- skei->setTrustSignatureDepth(trustSignature.depth);
- skei->setTrustSignatureScope(trustSignature.scope.toUtf8().toStdString());
- }
-
- if (!signer.isNull()) {
- if (const Error err = ctx->addSigningKey(signer)) {
- return std::make_tuple(err, QString(), Error());
- }
- }
-
- if (expirationDate.isValid()) {
- // on 2106-02-07, the Unix time will reach 0xFFFFFFFF; since gpg uses uint32 internally
- // for the expiration date clip it at 2106-02-05 to avoid problems with negative time zones
- static const QDate maxAllowedDate{2106, 2, 5};
- const auto clippedExpirationDate = expirationDate <= maxAllowedDate ? expirationDate : maxAllowedDate;
- if (clippedExpirationDate != expirationDate) {
- qCDebug(QGPGME_LOG) << "Expiration of certification has been changed to" << clippedExpirationDate;
- }
- // use the "days from now" format to specify the expiration date of the certification;
- // this format is the most appropriate regardless of the local timezone
- const auto daysFromNow = QDate::currentDate().daysTo(clippedExpirationDate);
- if (daysFromNow > 0) {
- const auto certExpire = std::to_string(daysFromNow) + "d";
- ctx->setFlag("cert-expire", certExpire.c_str());
- }
- } else {
- // explicitly set "cert-expire" to "0" (no expiration) to override default-cert-expire set in gpg.conf
- ctx->setFlag("cert-expire", "0");
- }
-
- const Error err = ctx->edit(key, std::unique_ptr<EditInteractor> (skei), data);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(err, log, ae);
-}
-
-Error QGpgMESignKeyJob::start(const Key &key)
-{
- unsigned int opts = 0;
- if (d->m_nonRevocable) {
- opts |= GpgSignKeyEditInteractor::NonRevocable;
- }
- if (d->m_exportable) {
- opts |= GpgSignKeyEditInteractor::Exportable;
- }
- switch (d->m_trustSignature.trust) {
- case TrustSignatureTrust::Partial:
- case TrustSignatureTrust::Complete:
- opts |= GpgSignKeyEditInteractor::Trust;
- break;
- default:
- opts &= ~GpgSignKeyEditInteractor::Trust;
- break;
- }
- run(std::bind(&sign_key, std::placeholders::_1, key, d->m_userIDsToSign, d->m_checkLevel, d->m_signingKey,
- opts, d->m_dupeOk, d->m_remark, d->m_trustSignature, d->m_expiration));
- d->m_started = true;
- return Error();
-}
-
-void QGpgMESignKeyJob::setUserIDsToSign(const std::vector<unsigned int> &idsToSign)
-{
- assert(!d->m_started);
- d->m_userIDsToSign = idsToSign;
-}
-
-void QGpgMESignKeyJob::setCheckLevel(unsigned int checkLevel)
-{
- assert(!d->m_started);
- d->m_checkLevel = checkLevel;
-}
-
-void QGpgMESignKeyJob::setExportable(bool exportable)
-{
- assert(!d->m_started);
- d->m_exportable = exportable;
-}
-
-void QGpgMESignKeyJob::setSigningKey(const Key &key)
-{
- assert(!d->m_started);
- d->m_signingKey = key;
-}
-
-void QGpgMESignKeyJob::setNonRevocable(bool nonRevocable)
-{
- assert(!d->m_started);
- d->m_nonRevocable = nonRevocable;
-}
-
-void QGpgMESignKeyJob::setRemark(const QString &remark)
-{
- assert(!d->m_started);
- d->m_remark = remark;
-}
-
-void QGpgMESignKeyJob::setDupeOk(bool value)
-{
- assert(!d->m_started);
- d->m_dupeOk = value;
-}
-
-void QGpgMESignKeyJob::setTrustSignature(GpgME::TrustSignatureTrust trust, unsigned short depth, const QString &scope)
-{
- assert(!d->m_started);
- assert(depth <= 255);
- d->m_trustSignature = {trust, depth, scope};
-}
-
-void QGpgMESignKeyJob::setExpirationDate(const QDate &expiration)
-{
- assert(!d->m_started);
- d->m_expiration = expiration;
-}
-
-#include "qgpgmesignkeyjob.moc"
diff --git a/lang/qt/src/qgpgmesignkeyjob.h b/lang/qt/src/qgpgmesignkeyjob.h
deleted file mode 100644
index 0316beb6..00000000
--- a/lang/qt/src/qgpgmesignkeyjob.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- qgpgmesignkeyjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMESIGNKEYJOB_H__
-#define __QGPGME_QGPGMESIGNKEYJOB_H__
-
-#include "signkeyjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <memory>
-
-namespace QGpgME
-{
-
-class QGpgMESignKeyJob
-#ifdef Q_MOC_RUN
- : public SignKeyJob
-#else
- : public _detail::ThreadedJobMixin<SignKeyJob>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMESignKeyJob(GpgME::Context *context);
- ~QGpgMESignKeyJob();
-
- /* from SignKeyJob */
- GpgME::Error start(const GpgME::Key &key) override;
-
- /* from SignKeyJob */
- void setUserIDsToSign(const std::vector<unsigned int> &idsToSign) override;
-
- /* from SignKeyJob */
- void setCheckLevel(unsigned int checkLevel) override;
-
- /* from SignKeyJob */
- void setExportable(bool exportable) override;
-
- /* from SignKeyJob */
- void setSigningKey(const GpgME::Key &key) override;
-
- /* from SignKeyJob */
- void setNonRevocable(bool nonRevocable) override;
-
- /* from SignKeyJob */
- void setRemark(const QString &remark) override;
-
- /* from SignKeyJob */
- void setDupeOk(bool value) override;
-
- /* from SignKeyJob */
- void setTrustSignature(GpgME::TrustSignatureTrust trust, unsigned short depth, const QString &scope) override;
-
- void setExpirationDate(const QDate &expiration) override;
-
-private:
- class Private;
- std::unique_ptr<Private> d;
-};
-}
-
-#endif // __QGPGME_QGPGMESIGNKEYJOB_H__
diff --git a/lang/qt/src/qgpgmetofupolicyjob.cpp b/lang/qt/src/qgpgmetofupolicyjob.cpp
deleted file mode 100644
index f5d43fa1..00000000
--- a/lang/qt/src/qgpgmetofupolicyjob.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/* qgpgmetofupolicyjob.cpp
-
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmetofupolicyjob.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/key.h>
-#include <gpgme++/tofuinfo.h>
-
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMETofuPolicyJob::QGpgMETofuPolicyJob(Context *context)
- : mixin_type(context)
-{
- lateInitialization();
-}
-
-QGpgMETofuPolicyJob::~QGpgMETofuPolicyJob() {}
-
-static QGpgMETofuPolicyJob::result_type policy_worker(Context *ctx, const Key &key, TofuInfo::Policy policy)
-{
- return std::make_tuple (ctx->setTofuPolicy(key, policy),
- QString(), Error());
-}
-
-void QGpgMETofuPolicyJob::start(const Key &key, TofuInfo::Policy policy)
-{
- run(std::bind(&policy_worker, std::placeholders::_1, key, policy));
-}
-
-Error QGpgMETofuPolicyJob::exec(const Key &key, TofuInfo::Policy policy)
-{
- return std::get<0>(policy_worker(context(), key, policy));
-}
-
-#include "qgpgmetofupolicyjob.moc"
diff --git a/lang/qt/src/qgpgmetofupolicyjob.h b/lang/qt/src/qgpgmetofupolicyjob.h
deleted file mode 100644
index ad09045d..00000000
--- a/lang/qt/src/qgpgmetofupolicyjob.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* qgpgmetofupolicyjob.h
-
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-#ifndef QGPGME_QGPGMETOFUPOLICYJOB_H
-#define QGPGME_QGPGMETOFUPOLICYJOB_H
-
-#include "tofupolicyjob.h"
-
-#include "threadedjobmixin.h"
-namespace GpgME
-{
- class Key;
-} // namespace GpgME
-
-namespace QGpgME {
-
-class QGpgMETofuPolicyJob
-#ifdef Q_MOC_RUN
- : public TofuPolicyJob
-#else
- : public _detail::ThreadedJobMixin<TofuPolicyJob, std::tuple<GpgME::Error, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMETofuPolicyJob(GpgME::Context *context);
- ~QGpgMETofuPolicyJob();
-
- void start(const GpgME::Key &key, GpgME::TofuInfo::Policy policy) override;
- GpgME::Error exec(const GpgME::Key &key, GpgME::TofuInfo::Policy policy) override;
-};
-
-}
-
-#endif
diff --git a/lang/qt/src/qgpgmeverifydetachedjob.cpp b/lang/qt/src/qgpgmeverifydetachedjob.cpp
deleted file mode 100644
index 91d89f96..00000000
--- a/lang/qt/src/qgpgmeverifydetachedjob.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- qgpgmeverifydetachedjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2007,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmeverifydetachedjob.h"
-
-#include "dataprovider.h"
-#include "util.h"
-#include "verifydetachedjob_p.h"
-
-#include <QFile>
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/verificationresult.h>
-
-#include <cassert>
-
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMEVerifyDetachedJobPrivate : public VerifyDetachedJobPrivate
-{
- QGpgMEVerifyDetachedJob *q = nullptr;
-
-public:
- QGpgMEVerifyDetachedJobPrivate(QGpgMEVerifyDetachedJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMEVerifyDetachedJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override;
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMEVerifyDetachedJob::QGpgMEVerifyDetachedJob(Context *context)
- : mixin_type(context)
-{
- setJobPrivate(this, std::unique_ptr<QGpgMEVerifyDetachedJobPrivate>{new QGpgMEVerifyDetachedJobPrivate{this}});
- lateInitialization();
-}
-
-QGpgMEVerifyDetachedJob::~QGpgMEVerifyDetachedJob() {}
-
-static QGpgMEVerifyDetachedJob::result_type verify_detached(Context *ctx, QThread *thread, const std::weak_ptr<QIODevice> &signature_, const std::weak_ptr<QIODevice> &signedData_)
-{
- const std::shared_ptr<QIODevice> signature = signature_.lock();
- const std::shared_ptr<QIODevice> signedData = signedData_.lock();
-
- const _detail::ToThreadMover sgMover(signature, thread);
- const _detail::ToThreadMover sdMover(signedData, thread);
-
- QGpgME::QIODeviceDataProvider sigDP(signature);
- Data sig(&sigDP);
-
- QGpgME::QIODeviceDataProvider dataDP(signedData);
- Data data(&dataDP);
- if (!signedData->isSequential()) {
- data.setSizeHint(signedData->size());
- }
-
- const VerificationResult res = ctx->verifyDetachedSignature(sig, data);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
-
- return std::make_tuple(res, log, ae);
-}
-
-static QGpgMEVerifyDetachedJob::result_type verify_detached_qba(Context *ctx, const QByteArray &signature, const QByteArray &signedData)
-{
- QGpgME::QByteArrayDataProvider sigDP(signature);
- Data sig(&sigDP);
-
- QGpgME::QByteArrayDataProvider dataDP(signedData);
- Data data(&dataDP);
-
- const VerificationResult res = ctx->verifyDetachedSignature(sig, data);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
-
- return std::make_tuple(res, log, ae);
-
-}
-
-static QGpgMEVerifyDetachedJob::result_type verify_from_filename(Context *ctx,
- const QString &signatureFilePath,
- const QString &signedFilePath,
- bool processAllSignatures)
-{
- Data signatureData;
-#ifdef Q_OS_WIN
- signatureData.setFileName(signatureFilePath.toUtf8().constData());
-#else
- signatureData.setFileName(QFile::encodeName(signatureFilePath).constData());
-#endif
-
- Data signedData;
-#ifdef Q_OS_WIN
- signedData.setFileName(signedFilePath.toUtf8().constData());
-#else
- signedData.setFileName(QFile::encodeName(signedFilePath).constData());
-#endif
-
- if (processAllSignatures) {
- ctx->setFlag("proc-all-sigs", "1");
- }
- const auto verificationResult = ctx->verifyDetachedSignature(signatureData, signedData);
-
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(verificationResult, log, ae);
-}
-
-Error QGpgMEVerifyDetachedJob::start(const QByteArray &signature, const QByteArray &signedData)
-{
- if (processAllSignatures()) {
- context()->setFlag("proc-all-sigs", "1");
- }
- run(std::bind(&verify_detached_qba, std::placeholders::_1, signature, signedData));
- return Error();
-}
-
-void QGpgMEVerifyDetachedJob::start(const std::shared_ptr<QIODevice> &signature, const std::shared_ptr<QIODevice> &signedData)
-{
- if (processAllSignatures()) {
- context()->setFlag("proc-all-sigs", "1");
- }
- run(std::bind(&verify_detached, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4), signature, signedData);
-}
-
-GpgME::VerificationResult QGpgME::QGpgMEVerifyDetachedJob::exec(const QByteArray &signature,
- const QByteArray &signedData)
-{
- if (processAllSignatures()) {
- context()->setFlag("proc-all-sigs", "1");
- }
- const result_type r = verify_detached_qba(context(), signature, signedData);
- return std::get<0>(r);
-}
-
-GpgME::Error QGpgMEVerifyDetachedJobPrivate::startIt()
-{
- if (m_signatureFilePath.isEmpty() || m_signedFilePath.isEmpty()) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- q->run([=](Context *ctx) {
- return verify_from_filename(ctx, m_signatureFilePath, m_signedFilePath, m_processAllSignatures);
- });
-
- return {};
-}
-
-#include "qgpgmeverifydetachedjob.moc"
diff --git a/lang/qt/src/qgpgmeverifydetachedjob.h b/lang/qt/src/qgpgmeverifydetachedjob.h
deleted file mode 100644
index 36350254..00000000
--- a/lang/qt/src/qgpgmeverifydetachedjob.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- qgpgmeverifydetachedjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2007,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMEVERIFYDETACHEDJOB_H__
-#define __QGPGME_QGPGMEVERIFYDETACHEDJOB_H__
-
-#include "verifydetachedjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/verificationresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMEVerifyDetachedJob
-#ifdef Q_MOC_RUN
- : public VerifyDetachedJob
-#else
- : public _detail::ThreadedJobMixin<VerifyDetachedJob, std::tuple<GpgME::VerificationResult, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEVerifyDetachedJob(GpgME::Context *context);
- ~QGpgMEVerifyDetachedJob();
-
- /* from VerifyDetachedJob */
- GpgME::Error start(const QByteArray &signature, const QByteArray &signedData) override;
-
- /* from VerifyDetachedJob */
- void start(const std::shared_ptr<QIODevice> &signature, const std::shared_ptr<QIODevice> &signedData) override;
-
- /* from VerifyDetachedJob */
- GpgME::VerificationResult exec(const QByteArray &signature,
- const QByteArray &signedData) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEVERIFYDETACHEDJOB_H__
diff --git a/lang/qt/src/qgpgmeverifyopaquejob.cpp b/lang/qt/src/qgpgmeverifyopaquejob.cpp
deleted file mode 100644
index 0cca9f72..00000000
--- a/lang/qt/src/qgpgmeverifyopaquejob.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- qgpgmeverifyopaquejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2007,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmeverifyopaquejob.h"
-
-#include "dataprovider.h"
-#include "util.h"
-#include "verifyopaquejob_p.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/verificationresult.h>
-
-#include <QBuffer>
-#include <QFile>
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMEVerifyOpaqueJobPrivate : public VerifyOpaqueJobPrivate
-{
- QGpgMEVerifyOpaqueJob *q = nullptr;
-
-public:
- QGpgMEVerifyOpaqueJobPrivate(QGpgMEVerifyOpaqueJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMEVerifyOpaqueJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override;
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMEVerifyOpaqueJob::QGpgMEVerifyOpaqueJob(Context *context)
- : mixin_type(context)
-{
- setJobPrivate(this, std::unique_ptr<QGpgMEVerifyOpaqueJobPrivate>{new QGpgMEVerifyOpaqueJobPrivate{this}});
- lateInitialization();
-}
-
-QGpgMEVerifyOpaqueJob::~QGpgMEVerifyOpaqueJob() {}
-
-static QGpgMEVerifyOpaqueJob::result_type verify_opaque(Context *ctx, QThread *thread, const std::weak_ptr<QIODevice> &signedData_, const std::weak_ptr<QIODevice> &plainText_)
-{
-
- const std::shared_ptr<QIODevice> plainText = plainText_.lock();
- const std::shared_ptr<QIODevice> signedData = signedData_.lock();
-
- const _detail::ToThreadMover ptMover(plainText, thread);
- const _detail::ToThreadMover sdMover(signedData, thread);
-
- QGpgME::QIODeviceDataProvider in(signedData);
- Data indata(&in);
- if (!signedData->isSequential()) {
- indata.setSizeHint(signedData->size());
- }
-
- if (!plainText) {
- QGpgME::QByteArrayDataProvider out;
- Data outdata(&out);
-
- const VerificationResult res = ctx->verifyOpaqueSignature(indata, outdata);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, out.data(), log, ae);
- } else {
- QGpgME::QIODeviceDataProvider out(plainText);
- Data outdata(&out);
-
- const VerificationResult res = ctx->verifyOpaqueSignature(indata, outdata);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, QByteArray(), log, ae);
- }
-
-}
-
-static QGpgMEVerifyOpaqueJob::result_type verify_opaque_qba(Context *ctx, const QByteArray &signedData)
-{
- const std::shared_ptr<QBuffer> buffer(new QBuffer);
- buffer->setData(signedData);
- if (!buffer->open(QIODevice::ReadOnly)) {
- assert(!"This should never happen: QBuffer::open() failed");
- }
- return verify_opaque(ctx, nullptr, buffer, std::shared_ptr<QIODevice>());
-}
-
-static QGpgMEVerifyOpaqueJob::result_type verify_from_filename(Context *ctx,
- const QString &inputFilePath,
- const QString &outputFilePath,
- bool processAllSignatures)
-{
- Data indata;
-#ifdef Q_OS_WIN
- indata.setFileName(inputFilePath.toUtf8().constData());
-#else
- indata.setFileName(QFile::encodeName(inputFilePath).constData());
-#endif
-
- PartialFileGuard partFileGuard{outputFilePath};
- if (partFileGuard.tempFileName().isEmpty()) {
- return std::make_tuple(VerificationResult{Error::fromCode(GPG_ERR_EEXIST)}, QByteArray{}, QString{}, Error{});
- }
-
- Data outdata;
-#ifdef Q_OS_WIN
- outdata.setFileName(partFileGuard.tempFileName().toUtf8().constData());
-#else
- outdata.setFileName(QFile::encodeName(partFileGuard.tempFileName()).constData());
-#endif
-
- if (processAllSignatures) {
- ctx->setFlag("proc-all-sigs", "1");
- }
- const auto verificationResult = ctx->verifyOpaqueSignature(indata, outdata);
-
- if (!verificationResult.error().code()) {
- // the operation succeeded -> save the result under the requested file name
- partFileGuard.commit();
- }
-
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(verificationResult, QByteArray{}, log, ae);
-}
-
-Error QGpgMEVerifyOpaqueJob::start(const QByteArray &signedData)
-{
- if (processAllSignatures()) {
- context()->setFlag("proc-all-sigs", "1");
- }
- run(std::bind(&verify_opaque_qba, std::placeholders::_1, signedData));
- return Error();
-}
-
-void QGpgMEVerifyOpaqueJob::start(const std::shared_ptr<QIODevice> &signedData, const std::shared_ptr<QIODevice> &plainText)
-{
- if (processAllSignatures()) {
- context()->setFlag("proc-all-sigs", "1");
- }
- run(std::bind(&verify_opaque, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4), signedData, plainText);
-}
-
-GpgME::VerificationResult QGpgME::QGpgMEVerifyOpaqueJob::exec(const QByteArray &signedData, QByteArray &plainText)
-{
- if (processAllSignatures()) {
- context()->setFlag("proc-all-sigs", "1");
- }
- const result_type r = verify_opaque_qba(context(), signedData);
- plainText = std::get<1>(r);
- return std::get<0>(r);
-}
-
-GpgME::Error QGpgMEVerifyOpaqueJobPrivate::startIt()
-{
- if (m_inputFilePath.isEmpty() || m_outputFilePath.isEmpty()) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- q->run([=](Context *ctx) {
- return verify_from_filename(ctx, m_inputFilePath, m_outputFilePath, m_processAllSignatures);
- });
-
- return {};
-}
-
-#include "qgpgmeverifyopaquejob.moc"
diff --git a/lang/qt/src/qgpgmeverifyopaquejob.h b/lang/qt/src/qgpgmeverifyopaquejob.h
deleted file mode 100644
index b46de8f8..00000000
--- a/lang/qt/src/qgpgmeverifyopaquejob.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- qgpgmeverifyopaquejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2007,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMEVERIFYOPAQUEJOB_H__
-#define __QGPGME_QGPGMEVERIFYOPAQUEJOB_H__
-
-#include "verifyopaquejob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/verificationresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMEVerifyOpaqueJob
-#ifdef Q_MOC_RUN
- : public VerifyOpaqueJob
-#else
- : public _detail::ThreadedJobMixin<VerifyOpaqueJob, std::tuple<GpgME::VerificationResult, QByteArray, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEVerifyOpaqueJob(GpgME::Context *context);
- ~QGpgMEVerifyOpaqueJob();
-
- /* from VerifyOpaqueJob */
- GpgME::Error start(const QByteArray &signedData) override;
-
- /* from VerifyOpaqueJob */
- void start(const std::shared_ptr<QIODevice> &signedData, const std::shared_ptr<QIODevice> &plainText) override;
-
- /* form VerifyOpaqueJob */
- GpgME::VerificationResult exec(const QByteArray &signedData, QByteArray &plainData) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEVERIFYOPAQUEJOB_H__
diff --git a/lang/qt/src/qgpgmewkdlookupjob.cpp b/lang/qt/src/qgpgmewkdlookupjob.cpp
deleted file mode 100644
index 76f5b728..00000000
--- a/lang/qt/src/qgpgmewkdlookupjob.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- qgpgmewkdlookupjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmewkdlookupjob.h"
-
-#include "debug.h"
-#include "qgpgme_debug.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/defaultassuantransaction.h>
-
-#include <gpg-error.h>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEWKDLookupJob::QGpgMEWKDLookupJob(Context *context)
- : mixin_type{context}
-{
- lateInitialization();
-}
-
-QGpgMEWKDLookupJob::~QGpgMEWKDLookupJob() = default;
-
-static GpgME::Error startDirmngr(Context *assuanCtx)
-{
- Error err;
-
- auto spawnCtx = std::unique_ptr<Context>{Context::createForEngine(SpawnEngine, &err)};
- if (err) {
- qCDebug(QGPGME_LOG) << "Error: Failed to get context for spawn engine (" << err << ")";
- }
- const auto gpgconfProgram = GpgME::dirInfo("gpgconf-name");
- // replace backslashes with forward slashes in homedir to work around bug T6833
- std::string homedir{GpgME::dirInfo("homedir")};
- std::replace(homedir.begin(), homedir.end(), '\\', '/');
- const char *argv[] = {
- gpgconfProgram,
- "--homedir",
- homedir.c_str(),
- "--launch",
- "dirmngr",
- NULL
- };
- auto ignoreIO = Data{Data::null};
- if (!err) {
- qCDebug(QGPGME_LOG) << "Starting dirmngr ...";
- err = spawnCtx->spawn(gpgconfProgram, argv,
- ignoreIO, ignoreIO, ignoreIO,
- Context::SpawnDetached);
- }
-
- if (!err) {
- // wait for socket to become available
- int cnt = 0;
- do {
- ++cnt;
- qCDebug(QGPGME_LOG) << "Waiting for dirmngr to start ...";
- QThread::msleep(250 * cnt);
- err = assuanCtx->assuanTransact("GETINFO version");
- } while (err.code() == GPG_ERR_ASS_CONNECT_FAILED && cnt < 5);
- }
-
- return err;
-}
-
-static GpgME::Error setUpDirmngrAssuanConnection(Context *ctx)
-{
- Error err;
-
- const std::string dirmngrSocket = GpgME::dirInfo("dirmngr-socket");
- err = ctx->setEngineFileName(dirmngrSocket.c_str());
-
- if (!err) {
- err = ctx->setEngineHomeDirectory("");
- }
-
- if (!err) {
- // try do connect to dirmngr
- err = ctx->assuanTransact("GETINFO version");
- if (err.code() == GPG_ERR_ASS_CONNECT_FAILED) {
- err = startDirmngr(ctx);
- }
- }
-
- return err;
-}
-
-static GpgME::Error run_wkd_get(Context *ctx, const std::string &email)
-{
- Error err;
-
- const auto cmd = std::string{"WKD_GET "} + email;
- err = ctx->assuanTransact(cmd.c_str());
- if (err.code() == GPG_ERR_NO_NAME || err.code() == GPG_ERR_NO_DATA) {
- // ignore those benign errors; GPG_ERR_NO_NAME indicates that the domain
- // doesn't exist (on first request); GPG_ERR_NO_DATA indicates that
- // no key for email is available via WKD or that the domain doesn't
- // support WKD or that the domain doesn't exist (on subsequent requests
- // using dirmngr's internal cache)
- qCDebug(QGPGME_LOG) << "WKD_GET returned" << err << "; ignoring...";
- err = {};
- }
- if (err) {
- qCDebug(QGPGME_LOG) << "WKD_GET failed with" << err;
- }
-
- return err;
-}
-
-static QGpgMEWKDLookupJob::result_type lookup_keys(Context *ctx, const QString &email)
-{
- WKDLookupResult result;
-
- Error err = setUpDirmngrAssuanConnection(ctx);
-
- const auto pattern = email.toUtf8().toStdString();
- if (!err) {
- err = run_wkd_get(ctx, pattern);
- }
-
- if (!err) {
- const auto transaction = std::unique_ptr<DefaultAssuanTransaction>(dynamic_cast<DefaultAssuanTransaction*>(ctx->takeLastAssuanTransaction().release()));
- const auto source = transaction->firstStatusLine("SOURCE");
- const auto rawData = transaction->data();
- if (rawData.size() == 0) {
- qCDebug(QGPGME_LOG) << "No key found for" << email;
- result = WKDLookupResult{pattern, GpgME::Data::null, {}, {}};
- } else {
- qCDebug(QGPGME_LOG) << "Found key for" << email << "at" << source.c_str();
- result = WKDLookupResult{pattern, GpgME::Data{rawData.c_str(), rawData.size()}, source, {}};
- }
- }
-
- return std::make_tuple(err ? WKDLookupResult{pattern, err} : result, QString{}, Error{});
-}
-
-Error QGpgMEWKDLookupJob::start(const QString &email)
-{
- run(std::bind(&lookup_keys, std::placeholders::_1, email));
- return Error();
-}
-
-WKDLookupResult QGpgMEWKDLookupJob::exec(const QString &email)
-{
- const result_type r = lookup_keys(context(), email);
- return std::get<0>(r);
-}
-
-#include "qgpgmewkdlookupjob.moc"
diff --git a/lang/qt/src/qgpgmewkdlookupjob.h b/lang/qt/src/qgpgmewkdlookupjob.h
deleted file mode 100644
index 9a206d25..00000000
--- a/lang/qt/src/qgpgmewkdlookupjob.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- qgpgmewkdlookupjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMEWKDLOOKUPJOB_H__
-#define __QGPGME_QGPGMEWKDLOOKUPJOB_H__
-
-#include "threadedjobmixin.h"
-#include "wkdlookupjob.h"
-#include "wkdlookupresult.h"
-
-namespace QGpgME
-{
-class WKDLookupResult;
-
-class QGpgMEWKDLookupJob
-#ifdef Q_MOC_RUN
- : public WKDLookupJob
-#else
- : public _detail::ThreadedJobMixin<WKDLookupJob, std::tuple<WKDLookupResult, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEWKDLookupJob(GpgME::Context *context);
- ~QGpgMEWKDLookupJob();
-
- /* from WKDLookupJob */
- GpgME::Error start(const QString &email) override;
-
- /* from WKDLookupJob */
- WKDLookupResult exec(const QString &email) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEWKDLOOKUPJOB_H__
diff --git a/lang/qt/src/qgpgmewkdrefreshjob.cpp b/lang/qt/src/qgpgmewkdrefreshjob.cpp
deleted file mode 100644
index 264d9f21..00000000
--- a/lang/qt/src/qgpgmewkdrefreshjob.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- qgpgmewkdrefreshjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmewkdrefreshjob.h"
-
-#include "debug.h"
-#include "qgpgme_debug.h"
-#include "qgpgmekeylistjob.h"
-#include "wkdrefreshjob_p.h"
-
-#include <gpgme++/context.h>
-
-#include <memory>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMEWKDRefreshJobPrivate : public WKDRefreshJobPrivate
-{
- QGpgMEWKDRefreshJob *q = nullptr;
-
-public:
- QGpgMEWKDRefreshJobPrivate(QGpgMEWKDRefreshJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMEWKDRefreshJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override;
-
- void startNow() override
- {
- q->run();
- }
-};
-
-static QStringList toEmailAddressesOriginatingFromWKD(const std::vector<GpgME::Key> &keys)
-{
- const QStringList emails = std::accumulate(keys.begin(), keys.end(), QStringList{}, [](QStringList &emails, const Key &key) {
- const auto userIDs = key.userIDs();
- emails = std::accumulate(std::begin(userIDs), std::end(userIDs), emails, [](QStringList &emails, const UserID &userID) {
- if (!userID.isRevoked() && !userID.addrSpec().empty() && userID.origin() == Key::OriginWKD) {
- emails.push_back(QString::fromStdString(userID.addrSpec()));
- }
- return emails;
- });
- return emails;
- });
- return emails;
-}
-
-static QStringList toEmailAddresses(const std::vector<GpgME::UserID> &userIds)
-{
- const QStringList emails = std::accumulate(
- std::begin(userIds),
- std::end(userIds),
- QStringList{},
- [](QStringList &emails, const UserID &userId) {
- if (!userId.isRevoked() && !userId.addrSpec().empty()) {
- emails.push_back(QString::fromStdString(userId.addrSpec()));
- }
- return emails;
- });
- return emails;
-}
-
-}
-
-QGpgMEWKDRefreshJob::QGpgMEWKDRefreshJob(Context *context)
- : mixin_type{context}
-{
- setJobPrivate(this, std::unique_ptr<QGpgMEWKDRefreshJobPrivate>{new QGpgMEWKDRefreshJobPrivate{this}});
- lateInitialization();
-}
-
-QGpgMEWKDRefreshJob::~QGpgMEWKDRefreshJob() = default;
-
-static QGpgMEWKDRefreshJob::result_type locate_external_keys(Context *ctx, const QStringList &emails)
-{
- qCDebug(QGPGME_LOG) << __func__ << "locating external keys for" << emails;
- if (emails.empty()) {
- return std::make_tuple(ImportResult{}, QString{}, Error{});
- }
-
- Context::KeyListModeSaver saver{ctx};
- ctx->setKeyListMode(GpgME::LocateExternal);
- ctx->setFlag("auto-key-locate", "clear,wkd");
- std::vector<Key> dummy;
- auto job = std::unique_ptr<KeyListJob>{new QGpgMEKeyListJob{ctx}};
- (void) job->exec(emails, false, dummy);
- qCDebug(QGPGME_LOG) << __func__ << "number of keys:" << dummy.size();
- std::for_each(dummy.cbegin(), dummy.cend(), [](const Key &k) {
- qCDebug(QGPGME_LOG) << __func__ << toLogString(k).c_str();
- });
- const auto result = ctx->importResult();
- qCDebug(QGPGME_LOG) << __func__ << "result:" << toLogString(result).c_str();
- job.release();
-
- return std::make_tuple(result, QString{}, Error{});
-}
-
-GpgME::Error QGpgMEWKDRefreshJobPrivate::startIt()
-{
- QStringList emails;
- if (!m_keys.empty()) {
- emails = toEmailAddressesOriginatingFromWKD(m_keys);
- } else {
- emails = toEmailAddresses(m_userIds);
- }
- std::sort(emails.begin(), emails.end());
- emails.erase(std::unique(emails.begin(), emails.end()), emails.end());
-
- q->run([emails](Context *ctx) {
- return locate_external_keys(ctx, emails);
- });
-
- return {};
-}
-
-#include "qgpgmewkdrefreshjob.moc"
diff --git a/lang/qt/src/qgpgmewkdrefreshjob.h b/lang/qt/src/qgpgmewkdrefreshjob.h
deleted file mode 100644
index 2a242d65..00000000
--- a/lang/qt/src/qgpgmewkdrefreshjob.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- qgpgmewkdrefreshjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QGPGMEWKDREFRESHJOB_H__
-#define __QGPGME_QGPGMEWKDREFRESHJOB_H__
-
-#include "threadedjobmixin.h"
-#include "wkdrefreshjob.h"
-
-#include <gpgme++/importresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMEWKDRefreshJob
-#ifdef Q_MOC_RUN
- : public WKDRefreshJob
-#else
- : public _detail::ThreadedJobMixin<WKDRefreshJob, std::tuple<GpgME::ImportResult, QString, GpgME::Error>>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEWKDRefreshJob(GpgME::Context *context);
- ~QGpgMEWKDRefreshJob() override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEWKDREFRESHJOB_H__
diff --git a/lang/qt/src/qgpgmewkspublishjob.cpp b/lang/qt/src/qgpgmewkspublishjob.cpp
deleted file mode 100644
index 74cf25cc..00000000
--- a/lang/qt/src/qgpgmewkspublishjob.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-/* wkspublishjob.cpp
-
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmewkspublishjob.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/key.h>
-
-#include "util.h"
-
-#include <QFileInfo>
-#include <QDir>
-#include <QProcess>
-
-/* Timeout for the WKS Processes will be 5 Minutes as
- * they can involve pinentry questions. */
-#define TIMEOUT_VALUE (5*60*1000)
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEWKSPublishJob::QGpgMEWKSPublishJob(Context *context)
- : mixin_type(context)
-{
- lateInitialization();
-}
-
-QGpgMEWKSPublishJob::~QGpgMEWKSPublishJob() {}
-
-static QString getWKSClient()
-{
- auto libexecdir = QString::fromLocal8Bit(dirInfo("libexecdir"));
- if (libexecdir.isEmpty()) {
- return QString();
- }
-
- const QFileInfo fi(QDir(libexecdir).absoluteFilePath(QStringLiteral("gpg-wks-client")));
- if (fi.exists() && fi.isExecutable()) {
- return fi.absoluteFilePath();
- }
- return QString();
-}
-
-static QGpgMEWKSPublishJob::result_type check_worker(const QString &mail)
-{
- if (mail.isEmpty()) {
- return std::make_tuple (Error(make_error(GPG_ERR_INV_ARG)),
- QByteArray(), QByteArray(), QString(), Error());
- }
-
- const auto wksPath = getWKSClient();
- if (wksPath.isEmpty()) {
- return std::make_tuple (Error(make_error(GPG_ERR_NOT_SUPPORTED)),
- QByteArray(), QByteArray(), QString(), Error());
- }
-
- /* QProcess instead of engine_spawn because engine_spawn does not communicate
- * the return value of the process and we are in qt anyway. */
- QProcess proc;
- proc.setProgram(wksPath);
- proc.setArguments(QStringList() << QStringLiteral("--supported") << mail);
- proc.start();
- if (!proc.waitForStarted()) {
- return std::make_tuple (Error(make_error(GPG_ERR_NOT_SUPPORTED)),
- QByteArray(), QByteArray(), QString(), Error());
- }
- if (!proc.waitForFinished(TIMEOUT_VALUE)) {
- return std::make_tuple (Error(make_error(GPG_ERR_TIMEOUT)),
- QByteArray(), QByteArray(), QString(), Error());
- }
- if (proc.exitStatus() == QProcess::NormalExit && proc.exitCode() == 0) {
- return std::make_tuple (Error(), QByteArray(), QByteArray(), QString(), Error());
- }
- return std::make_tuple (Error(make_error(GPG_ERR_NOT_ENABLED)),
- QByteArray(), QByteArray(), QString(), Error());
-}
-
-static QGpgMEWKSPublishJob::result_type create_worker(const char *fpr, const QString &mail)
-{
- if (mail.isEmpty() || !fpr) {
- return std::make_tuple (Error(make_error(GPG_ERR_INV_ARG)),
- QByteArray(), QByteArray(), QString(), Error());
- }
-
- const auto wksPath = getWKSClient();
- if (wksPath.isEmpty()) {
- return std::make_tuple (Error(make_error(GPG_ERR_NOT_SUPPORTED)),
- QByteArray(), QByteArray(), QString(), Error());
- }
-
- QProcess proc;
- proc.setProgram(wksPath);
- proc.setArguments(QStringList() << QStringLiteral("--create")
- << QLatin1String(fpr)
- << mail);
- proc.start();
- if (!proc.waitForStarted()) {
- return std::make_tuple (Error(make_error(GPG_ERR_NOT_SUPPORTED)),
- QByteArray(), QByteArray(), QString(), Error());
- }
-
- if (!proc.waitForFinished(TIMEOUT_VALUE)) {
- return std::make_tuple (Error(make_error(GPG_ERR_TIMEOUT)),
- QByteArray(), QByteArray(), QString(), Error());
- }
- if (proc.exitStatus() == QProcess::NormalExit && proc.exitCode() == 0) {
- return std::make_tuple (Error(), proc.readAllStandardOutput(),
- proc.readAllStandardError(), QString(), Error());
- }
- return std::make_tuple (Error(make_error(GPG_ERR_GENERAL)),
- proc.readAllStandardOutput(), proc.readAllStandardError(), QString(), Error());
-}
-
-static QGpgMEWKSPublishJob::result_type receive_worker(const QByteArray &response)
-{
- if (response.isEmpty()) {
- return std::make_tuple (Error(make_error(GPG_ERR_INV_ARG)),
- QByteArray(), QByteArray(), QString(), Error());
- }
-
- const auto wksPath = getWKSClient();
- if (wksPath.isEmpty()) {
- return std::make_tuple (Error(make_error(GPG_ERR_NOT_SUPPORTED)),
- QByteArray(), QByteArray(), QString(), Error());
- }
-
- QProcess proc;
- proc.setProgram(wksPath);
- proc.setArguments(QStringList() << QStringLiteral("--receive"));
- proc.start();
- if (!proc.waitForStarted()) {
- return std::make_tuple (Error(make_error(GPG_ERR_NOT_SUPPORTED)),
- QByteArray(), QByteArray(), QString(), Error());
- }
- proc.write(response);
- proc.closeWriteChannel();
- if (!proc.waitForFinished(TIMEOUT_VALUE)) {
- return std::make_tuple (Error(make_error(GPG_ERR_TIMEOUT)),
- QByteArray(), QByteArray(), QString(), Error());
- }
- if (proc.exitStatus() == QProcess::NormalExit && proc.exitCode() == 0) {
- return std::make_tuple (Error(), proc.readAllStandardOutput(),
- proc.readAllStandardError(), QString(), Error());
- }
- return std::make_tuple (Error(make_error(GPG_ERR_GENERAL)),
- proc.readAllStandardOutput(), proc.readAllStandardError(), QString(), Error());
-}
-
-void QGpgMEWKSPublishJob::startCheck(const QString &mailbox)
-{
- run(std::bind(&check_worker, mailbox));
-}
-
-void QGpgMEWKSPublishJob::startCreate(const char *fpr, const QString &mailbox) {
- run(std::bind(&create_worker, fpr, mailbox));
-}
-
-void QGpgMEWKSPublishJob::startReceive(const QByteArray &response)
-{
- run(std::bind(&receive_worker, response));
-}
-
-#include "qgpgmewkspublishjob.moc"
diff --git a/lang/qt/src/qgpgmewkspublishjob.h b/lang/qt/src/qgpgmewkspublishjob.h
deleted file mode 100644
index a8635e16..00000000
--- a/lang/qt/src/qgpgmewkspublishjob.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* qgpgmewkspublishjob.h
-
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-#ifndef QGPGME_QGPGMEWKSPUBLISHJOB_H
-#define QGPGME_QGPGMEWKSPUBLISHJOB_H
-
-#include "wkspublishjob.h"
-
-#include "threadedjobmixin.h"
-namespace GpgME
-{
- class Key;
-} // namespace GpgME
-
-namespace QGpgME {
-
-/**
- * Handles Web Key Service Publishing. Needs WKS tools installed and
- * server support.
- */
-class QGpgMEWKSPublishJob
-#ifdef Q_MOC_RUN
- : public WKSPublishJob
-#else
- : public _detail::ThreadedJobMixin<WKSPublishJob, std::tuple<GpgME::Error, QByteArray, QByteArray, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEWKSPublishJob(GpgME::Context *context);
- ~QGpgMEWKSPublishJob();
-
- void startCheck(const QString &mailbox) override;
- void startCreate(const char *fpr, const QString &mailbox) override;
- void startReceive(const QByteArray &response) override;
-};
-
-}
-
-#endif
diff --git a/lang/qt/src/quickjob.cpp b/lang/qt/src/quickjob.cpp
deleted file mode 100644
index 1c9343da..00000000
--- a/lang/qt/src/quickjob.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- quickjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2024 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#include "quickjob.h"
-#include "quickjob_p.h"
-
-using namespace QGpgME;
-
-QuickJob::QuickJob(QObject *parent)
- : Job{parent}
-{
-}
-
-QuickJob::~QuickJob() = default;
-
-GpgME::Error QuickJob::startSetKeyEnabled(const GpgME::Key &key, bool enabled)
-{
- auto d = jobPrivate<QuickJobPrivate>(this);
- return d->startSetKeyEnabled(key, enabled);
-}
-
-#include "quickjob.moc"
diff --git a/lang/qt/src/quickjob.h b/lang/qt/src/quickjob.h
deleted file mode 100644
index df8ac2b5..00000000
--- a/lang/qt/src/quickjob.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* quickjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2017 Intevation GmbH
- Copyright (c) 2020 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-#ifndef QGPGME_QUICKJOB_H
-#define QGPGME_QUICKJOB_H
-
-#include "job.h"
-
-#include "qgpgme_export.h"
-
-#include <QDateTime>
-
-#include <gpgme++/key.h>
-
-class QString;
-
-namespace QGpgME{
-
-/**
- * Interface to the modern key manipulation functions.
- */
-class QGPGME_EXPORT QuickJob : public Job
-{
- Q_OBJECT
-public:
- explicit QuickJob(QObject *parent = nullptr);
- ~QuickJob();
-
- /** Start --quick-gen-key */
- virtual void startCreate(const QString &uid,
- const char *algo,
- const QDateTime &expires = QDateTime(),
- const GpgME::Key &key = GpgME::Key(),
- unsigned int flags = 0) = 0;
-
- /** Start --quick-adduid */
- virtual void startAddUid(const GpgME::Key &key, const QString &uid) = 0;
-
- /** Start --quick-revuid */
- virtual void startRevUid(const GpgME::Key &key, const QString &uid) = 0;
-
- /** Start --quick-add-key */
- virtual void startAddSubkey(const GpgME::Key &key, const char *algo,
- const QDateTime &expires = QDateTime(),
- unsigned int flags = 0) = 0;
-
- /**
- Starts the operation to revoke the signatures made with the key \a signingKey on the
- user IDs \a userIds of the key \a key. If \a userIds is an empty list, then all
- signatures made with \a signingKey on the user IDs of \a key will be revoked.
- */
- virtual void startRevokeSignature(const GpgME::Key &key, const GpgME::Key &signingKey,
- const std::vector<GpgME::UserID> &userIds = std::vector<GpgME::UserID>()) = 0;
-
- /** Start --quick-add-adsk */
- virtual void startAddAdsk(const GpgME::Key &key, const char *adsk) = 0;
-
- /**
- * Starts the operation to enable or disable the OpenPGP key \a key.
- * If \a enabled is \c true then the key is enabled. Otherwise, the key is disabled.
- *
- * \note Requires gpg 2.4.6.
- */
- GpgME::Error startSetKeyEnabled(const GpgME::Key &key, bool enabled);
-
-Q_SIGNALS:
- void result(const GpgME::Error &error,
- const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-#endif
diff --git a/lang/qt/src/quickjob_p.h b/lang/qt/src/quickjob_p.h
deleted file mode 100644
index a8c993a2..00000000
--- a/lang/qt/src/quickjob_p.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- quickjob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2024 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_QUICKJOB_P_H__
-#define __QGPGME_QUICKJOB_P_H__
-
-#include "job_p.h"
-
-#include "quickjob.h"
-
-namespace QGpgME
-{
-
-struct QuickJobPrivate : public JobPrivate
-{
- virtual GpgME::Error startSetKeyEnabled(const GpgME::Key &key, bool enabled) = 0;
-};
-
-}
-
-#endif // __QGPGME_QUICKJOB_P_H__
diff --git a/lang/qt/src/receivekeysjob.h b/lang/qt/src/receivekeysjob.h
deleted file mode 100644
index 3f85792f..00000000
--- a/lang/qt/src/receivekeysjob.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- receivekeysjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_RECEIVEKEYSJOB_H__
-#define __QGPGME_RECEIVEKEYSJOB_H__
-
-#include "abstractimportjob.h"
-#include "qgpgme_export.h"
-
-namespace QGpgME
-{
-
-class QGPGME_EXPORT ReceiveKeysJob : public AbstractImportJob
-{
- Q_OBJECT
-protected:
- explicit ReceiveKeysJob(QObject *parent);
-public:
- ~ReceiveKeysJob() override;
-
- /**
- Starts the import of keys from a keyserver. \a keyIds is a list of
- key ids and/or fingerprints specifying the keys to import.
- */
- virtual GpgME::Error start(const QStringList &keyIds) = 0;
-
- /**
- Runs the import of keys from a keyserver. \a keyIds is a list of
- key ids and/or fingerprints specifying the keys to import.
- */
- virtual GpgME::ImportResult exec(const QStringList &keyIds) = 0;
-};
-
-}
-
-#endif // __QGPGME_RECEIVEKEYSJOB_H__
diff --git a/lang/qt/src/refreshkeysjob.h b/lang/qt/src/refreshkeysjob.h
deleted file mode 100644
index 67774c2f..00000000
--- a/lang/qt/src/refreshkeysjob.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- refreshkeysjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_REFRESHKEYSJOB_H__
-#define __KLEO_REFRESHKEYSJOB_H__
-
-#include "job.h"
-#include "qgpgme_export.h"
-
-#include <QtCore/QStringList>
-
-#include <vector>
-
-namespace GpgME
-{
-class Error;
-class Key;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous key refreshers.
-
- To use a RefreshKeysJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the key refresh with a
- call to start(). This call might fail, in which case the
- RefreshKeysJob instance will have scheduled its own destruction
- with a call to QObject::deleteLater().
-
- After result() is emitted, the job will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT RefreshKeysJob : public Job
-{
- Q_OBJECT
-protected:
- explicit RefreshKeysJob(QObject *parent);
-public:
- ~RefreshKeysJob();
-
- /**
- Starts the refresh operation. \a pattern is a list of patterns
- used to restrict the list of keys returned. Empty patterns are
- ignored. If \a pattern is empty or contains only empty strings,
- all keys are refreshed.
-
- Only implemented for S/MIME.
- */
- virtual GpgME::Error start(const QStringList &patterns) = 0;
-
- /**
- Starts a refresh of the \a keys.
- */
- virtual GpgME::Error start(const std::vector<GpgME::Key> &keys) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::Error &result);
-};
-
-}
-
-#endif // __KLEO_REFRESHKEYSJOB_H__
diff --git a/lang/qt/src/revokekeyjob.h b/lang/qt/src/revokekeyjob.h
deleted file mode 100644
index 69aef062..00000000
--- a/lang/qt/src/revokekeyjob.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- revokekeyjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_REVOKEKEYJOB_H__
-#define __QGPGME_REVOKEKEYJOB_H__
-
-#include "job.h"
-#include "qgpgme_export.h"
-
-class QString;
-
-namespace GpgME
-{
-class Error;
-class Key;
-}
-
-namespace QGpgME
-{
-
-class QGPGME_EXPORT RevokeKeyJob : public Job
-{
- Q_OBJECT
-protected:
- explicit RevokeKeyJob(QObject *parent);
-
-public:
- ~RevokeKeyJob();
-
- /**
- Starts the operation. \a key is the key to revoke with reason \a reason and
- optional description \a description. The individual elements of \a description
- must be non-empty strings and they must not contain any endline characters.
-
- The job deletes itself after it has completed the operation.
- */
- virtual GpgME::Error start(const GpgME::Key &key,
- GpgME::RevocationReason reason = GpgME::RevocationReason::Unspecified,
- const std::vector<std::string> &description = {}) = 0;
-
- /**
- Runs the operation. \a key is the key to revoke with reason \a reason and
- optional description \a description. The individual elements of \a description
- must be non-empty strings and they must not contain any endline characters.
- */
- virtual GpgME::Error exec(const GpgME::Key &key,
- GpgME::RevocationReason reason = GpgME::RevocationReason::Unspecified,
- const std::vector<std::string> &description = {}) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::Error &result, const QString &auditLogAsHtml = {}, const GpgME::Error &auditLogError = {});
-};
-
-}
-
-#endif // __QGPGME_REVOKEKEYJOB_H__
diff --git a/lang/qt/src/setprimaryuseridjob.h b/lang/qt/src/setprimaryuseridjob.h
deleted file mode 100644
index fa76199c..00000000
--- a/lang/qt/src/setprimaryuseridjob.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- setprimaryuseridjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_SETPRIMARYUSERIDJOB_H__
-#define __QGPGME_SETPRIMARYUSERIDJOB_H__
-
-#include "job.h"
-
-#include "qgpgme_export.h"
-
-namespace GpgME
-{
-class Error;
-class UserID;
-}
-
-namespace QGpgME
-{
-
-class QGPGME_EXPORT SetPrimaryUserIDJob : public Job
-{
- Q_OBJECT
-public:
- explicit SetPrimaryUserIDJob(QObject *parent);
- ~SetPrimaryUserIDJob() override;
-
- /**
- * Starts setting user ID \a userId as the primary user ID.
- */
- virtual GpgME::Error start(const GpgME::UserID &userId) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::Error &error,
- const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __QGPGME_SETPRIMARYUSERIDJOB_H__
diff --git a/lang/qt/src/signarchivejob.cpp b/lang/qt/src/signarchivejob.cpp
deleted file mode 100644
index 0d898b25..00000000
--- a/lang/qt/src/signarchivejob.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- signarchivejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "signarchivejob.h"
-#include "signarchivejob_p.h"
-
-#include <gpgme++/engineinfo.h>
-
-using namespace QGpgME;
-
-SignArchiveJob::SignArchiveJob(QObject *parent)
- : Job{parent}
-{
-}
-
-SignArchiveJob::~SignArchiveJob() = default;
-
-// static
-bool SignArchiveJob::isSupported()
-{
- static const auto gpgVersion = GpgME::engineInfo(GpgME::GpgEngine).engineVersion();
- return (gpgVersion >= "2.4.1") || (gpgVersion >= "2.2.42" && gpgVersion < "2.3.0");
-}
-
-void SignArchiveJob::setSigners(const std::vector<GpgME::Key> &signers)
-{
- auto d = jobPrivate<SignArchiveJobPrivate>(this);
- d->m_signers = signers;
-}
-
-std::vector<GpgME::Key> SignArchiveJob::signers() const
-{
- auto d = jobPrivate<SignArchiveJobPrivate>(this);
- return d->m_signers;
-}
-
-void SignArchiveJob::setInputPaths(const std::vector<QString> &paths)
-{
- auto d = jobPrivate<SignArchiveJobPrivate>(this);
- d->m_inputPaths = paths;
-}
-
-std::vector<QString> SignArchiveJob::inputPaths() const
-{
- auto d = jobPrivate<SignArchiveJobPrivate>(this);
- return d->m_inputPaths;
-}
-
-void SignArchiveJob::setOutputFile(const QString &path)
-{
- auto d = jobPrivate<SignArchiveJobPrivate>(this);
- d->m_outputFilePath = path;
-}
-
-QString SignArchiveJob::outputFile() const
-{
- auto d = jobPrivate<SignArchiveJobPrivate>(this);
- return d->m_outputFilePath;
-}
-
-void SignArchiveJob::setBaseDirectory(const QString &baseDirectory)
-{
- auto d = jobPrivate<SignArchiveJobPrivate>(this);
- d->m_baseDirectory = baseDirectory;
-}
-
-QString SignArchiveJob::baseDirectory() const
-{
- auto d = jobPrivate<SignArchiveJobPrivate>(this);
- return d->m_baseDirectory;
-}
-
-#include "signarchivejob.moc"
diff --git a/lang/qt/src/signarchivejob.h b/lang/qt/src/signarchivejob.h
deleted file mode 100644
index 0b4cdeb4..00000000
--- a/lang/qt/src/signarchivejob.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- signarchivejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_SIGNARCHIVEJOB_H__
-#define __QGPGME_SIGNARCHIVEJOB_H__
-
-#include "job.h"
-
-#include <gpgme++/context.h>
-
-namespace GpgME
-{
-class Key;
-}
-
-namespace QGpgME
-{
-
-/**
- * Abstract base class for job for creating signed archives
- */
-class QGPGME_EXPORT SignArchiveJob : public Job
-{
- Q_OBJECT
-protected:
- explicit SignArchiveJob(QObject *parent);
-public:
- ~SignArchiveJob() override;
-
- static bool isSupported();
-
- /**
- * Sets the keys to use for signing the archive.
- *
- * Used if the job is started with startIt().
- */
- void setSigners(const std::vector<GpgME::Key> &signers);
- std::vector<GpgME::Key> signers() const;
-
- /**
- * Sets the paths of the files and folders to put into the archive.
- *
- * If base directory is set, then the paths must be relative to the
- * base directory.
- *
- * Used if the job is started with startIt().
- */
- void setInputPaths(const std::vector<QString> &paths);
- std::vector<QString> inputPaths() const;
-
- /**
- * Sets the path of the file to write the created archive to.
- *
- * If \a path is a relative path and base directory is set, then the
- * path is interpreted relative to the base directory.
- *
- * Used if the job is started with startIt().
- *
- * \note If a file with this path exists, then the job will fail, i.e. you
- * need to delete an existing file that shall be overwritten before you
- * start the job.
- */
- void setOutputFile(const QString &path);
- QString outputFile() const;
-
- /**
- * Sets the base directory for the relative paths of the input files and
- * the output file.
- */
- void setBaseDirectory(const QString &baseDirectory);
- QString baseDirectory() const;
-
- /**
- * Starts the creation of a signed archive.
- *
- * Creates a signed archive with the files and directories in \a paths.
- * The archive is signed with the keys in \a signers or with the default
- * key, if \a signers is empty. The signed archive is written to \a output.
- *
- * Emits result() when the job has finished.
- */
- virtual GpgME::Error start(const std::vector<GpgME::Key> &signers,
- const std::vector<QString> &paths,
- const std::shared_ptr<QIODevice> &output) = 0;
-
-Q_SIGNALS:
- /**
- * This signal is emitted whenever gpgtar sends a progress status update for
- * the number of files. In the scanning phase (i.e. while gpgtar checks
- * which files to put into the archive), \a current is the current number of
- * files and \a total is 0. In the writing phase, \a current is the number
- * of processed files and \a total is the total number of files.
- */
- void fileProgress(int current, int total);
-
- /**
- * This signal is emitted whenever gpgtar sends a progress status update for
- * the amount of processed data. It is only emitted in the writing phase.
- * \a current is the processed amount data and \a total is the total amount
- * of data to process. Both values never exceed 2^20.
- */
- void dataProgress(int current, int total);
-
- void result(const GpgME::SigningResult &result,
- const QString &auditLogAsHtml = {},
- const GpgME::Error &auditLogError = {});
-};
-
-}
-
-#endif // __QGPGME_SIGNARCHIVEJOB_H__
diff --git a/lang/qt/src/signarchivejob_p.h b/lang/qt/src/signarchivejob_p.h
deleted file mode 100644
index 9ec921bb..00000000
--- a/lang/qt/src/signarchivejob_p.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- signarchivejob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_SIGNARCHIVEJOB_P_H__
-#define __QGPGME_SIGNARCHIVEJOB_P_H__
-
-#include "job_p.h"
-
-namespace QGpgME
-{
-
-struct SignArchiveJobPrivate : public JobPrivate
-{
- std::vector<GpgME::Key> m_signers;
- std::vector<QString> m_inputPaths;
- QString m_outputFilePath;
- QString m_baseDirectory;
-};
-
-}
-
-#endif // __QGPGME_SIGNARCHIVEJOB_P_H__
diff --git a/lang/qt/src/signencryptarchivejob.cpp b/lang/qt/src/signencryptarchivejob.cpp
deleted file mode 100644
index 114d6f33..00000000
--- a/lang/qt/src/signencryptarchivejob.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- signencryptarchivejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "signencryptarchivejob.h"
-#include "signencryptarchivejob_p.h"
-
-#include <gpgme++/engineinfo.h>
-
-using namespace QGpgME;
-
-SignEncryptArchiveJob::SignEncryptArchiveJob(QObject *parent)
- : Job{parent}
-{
-}
-
-SignEncryptArchiveJob::~SignEncryptArchiveJob() = default;
-
-// static
-bool SignEncryptArchiveJob::isSupported()
-{
- static const auto gpgVersion = GpgME::engineInfo(GpgME::GpgEngine).engineVersion();
- return (gpgVersion >= "2.4.1") || (gpgVersion >= "2.2.42" && gpgVersion < "2.3.0");
-}
-
-void SignEncryptArchiveJob::setSigners(const std::vector<GpgME::Key> &signers)
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- d->m_signers = signers;
-}
-
-std::vector<GpgME::Key> SignEncryptArchiveJob::signers() const
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- return d->m_signers;
-}
-
-void SignEncryptArchiveJob::setRecipients(const std::vector<GpgME::Key> &recipients)
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- d->m_recipients = recipients;
-}
-
-std::vector<GpgME::Key> SignEncryptArchiveJob::recipients() const
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- return d->m_recipients;
-}
-
-void SignEncryptArchiveJob::setInputPaths(const std::vector<QString> &paths)
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- d->m_inputPaths = paths;
-}
-
-std::vector<QString> SignEncryptArchiveJob::inputPaths() const
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- return d->m_inputPaths;
-}
-
-void SignEncryptArchiveJob::setOutputFile(const QString &path)
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- d->m_outputFilePath = path;
-}
-
-QString SignEncryptArchiveJob::outputFile() const
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- return d->m_outputFilePath;
-}
-
-void SignEncryptArchiveJob::setEncryptionFlags(GpgME::Context::EncryptionFlags flags)
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- d->m_encryptionFlags = static_cast<GpgME::Context::EncryptionFlags>(flags | GpgME::Context::EncryptArchive);
-}
-
-GpgME::Context::EncryptionFlags SignEncryptArchiveJob::encryptionFlags() const
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- return d->m_encryptionFlags;
-}
-
-void SignEncryptArchiveJob::setBaseDirectory(const QString &baseDirectory)
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- d->m_baseDirectory = baseDirectory;
-}
-
-QString SignEncryptArchiveJob::baseDirectory() const
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- return d->m_baseDirectory;
-}
-
-#include "signencryptarchivejob.moc"
diff --git a/lang/qt/src/signencryptarchivejob.h b/lang/qt/src/signencryptarchivejob.h
deleted file mode 100644
index c8742aec..00000000
--- a/lang/qt/src/signencryptarchivejob.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- signencryptarchivejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_SIGNENCRYPTARCHIVEJOB_H__
-#define __QGPGME_SIGNENCRYPTARCHIVEJOB_H__
-
-#include "job.h"
-
-#include <gpgme++/context.h>
-
-namespace GpgME
-{
-class Key;
-}
-
-namespace QGpgME
-{
-
-/**
- * Abstract base class for job for creating encrypted signed archives
- */
-class QGPGME_EXPORT SignEncryptArchiveJob : public Job
-{
- Q_OBJECT
-protected:
- explicit SignEncryptArchiveJob(QObject *parent);
-public:
- ~SignEncryptArchiveJob() override;
-
- static bool isSupported();
-
- /**
- * Sets the keys to use for signing the archive.
- *
- * Used if the job is started with startIt().
- */
- void setSigners(const std::vector<GpgME::Key> &signers);
- std::vector<GpgME::Key> signers() const;
-
- /**
- * Sets the keys to use for encrypting the archive.
- *
- * Used if the job is started with startIt().
- */
- void setRecipients(const std::vector<GpgME::Key> &recipients);
- std::vector<GpgME::Key> recipients() const;
-
- /**
- * Sets the paths of the files and folders to put into the archive.
- *
- * If base directory is set, then the paths must be relative to the
- * base directory.
- *
- * Used if the job is started with startIt().
- */
- void setInputPaths(const std::vector<QString> &paths);
- std::vector<QString> inputPaths() const;
-
- /**
- * Sets the path of the file to write the created archive to.
- *
- * If \a path is a relative path and base directory is set, then the
- * path is interpreted relative to the base directory.
- *
- * Used if the job is started with startIt().
- *
- * \note If a file with this path exists, then the job will fail, i.e. you
- * need to delete an existing file that shall be overwritten before you
- * start the job.
- */
- void setOutputFile(const QString &path);
- QString outputFile() const;
-
- /**
- * Sets the flags to use for encryption. Defaults to \c EncryptArchive.
- * The \c EncryptArchive flag is always assumed set for this job.
- *
- * Used if the job is started with startIt().
- */
- void setEncryptionFlags(GpgME::Context::EncryptionFlags flags);
- GpgME::Context::EncryptionFlags encryptionFlags() const;
-
- /**
- * Sets the base directory for the relative paths of the input files and
- * the output file.
- */
- void setBaseDirectory(const QString &baseDirectory);
- QString baseDirectory() const;
-
- /**
- * Starts the creation of an encrypted signed archive.
- *
- * Creates an encrypted signed archive with the files and directories in
- * \a paths.
- * The archive is signed with the keys in \a signers or with the default
- * key, if \a signers is empty. Then the archive is encrypted for the
- * keys in \a recipients. If \a recipients is empty, then symmetric
- * encryption is performed. The encrypted signed archive is written to
- * \a cipherText.
- *
- * Emits result() when the job has finished.
- */
- virtual GpgME::Error start(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const std::vector<QString> &paths,
- const std::shared_ptr<QIODevice> &cipherText,
- const GpgME::Context::EncryptionFlags flags) = 0;
-
-Q_SIGNALS:
- /**
- * This signal is emitted whenever gpgtar sends a progress status update for
- * the number of files. In the scanning phase (i.e. while gpgtar checks
- * which files to put into the archive), \a current is the current number of
- * files and \a total is 0. In the writing phase, \a current is the number
- * of processed files and \a total is the total number of files.
- */
- void fileProgress(int current, int total);
-
- /**
- * This signal is emitted whenever gpgtar sends a progress status update for
- * the amount of processed data. It is only emitted in the writing phase.
- * \a current is the processed amount data and \a total is the total amount
- * of data to process. Both values never exceed 2^20.
- */
- void dataProgress(int current, int total);
-
- void result(const GpgME::SigningResult &signingResult,
- const GpgME::EncryptionResult &encryptionResult,
- const QString &auditLogAsHtml = {},
- const GpgME::Error &auditLogError = {});
-};
-
-}
-
-#endif // __QGPGME_SIGNENCRYPTARCHIVEJOB_H__
diff --git a/lang/qt/src/signencryptarchivejob_p.h b/lang/qt/src/signencryptarchivejob_p.h
deleted file mode 100644
index 3ae7a4c1..00000000
--- a/lang/qt/src/signencryptarchivejob_p.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- signencryptarchivejob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_SIGNENCRYPTARCHIVEJOB_P_H__
-#define __QGPGME_SIGNENCRYPTARCHIVEJOB_P_H__
-
-#include "job_p.h"
-
-namespace QGpgME
-{
-
-struct SignEncryptArchiveJobPrivate : public JobPrivate
-{
- std::vector<GpgME::Key> m_signers;
- std::vector<GpgME::Key> m_recipients;
- std::vector<QString> m_inputPaths;
- QString m_outputFilePath;
- QString m_baseDirectory;
- GpgME::Context::EncryptionFlags m_encryptionFlags = GpgME::Context::EncryptArchive;
-};
-
-}
-
-#endif // __QGPGME_SIGNENCRYPTARCHIVEJOB_P_H__
diff --git a/lang/qt/src/signencryptjob.cpp b/lang/qt/src/signencryptjob.cpp
deleted file mode 100644
index e82730e6..00000000
--- a/lang/qt/src/signencryptjob.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- signencryptjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "signencryptjob.h"
-#include "signencryptjob_p.h"
-
-using namespace QGpgME;
-
-SignEncryptJob::SignEncryptJob(QObject *parent)
- : Job{parent}
-{
-}
-
-SignEncryptJob::~SignEncryptJob() = default;
-
-void SignEncryptJob::setFileName(const QString &fileName)
-{
- auto d = jobPrivate<SignEncryptJobPrivate>(this);
- d->m_fileName = fileName;
-}
-
-QString SignEncryptJob::fileName() const
-{
- auto d = jobPrivate<SignEncryptJobPrivate>(this);
- return d->m_fileName;
-}
-
-void SignEncryptJob::setSigners(const std::vector<GpgME::Key> &signers)
-{
- auto d = jobPrivate<SignEncryptJobPrivate>(this);
- d->m_signers = signers;
-}
-
-std::vector<GpgME::Key> SignEncryptJob::signers() const
-{
- auto d = jobPrivate<SignEncryptJobPrivate>(this);
- return d->m_signers;
-}
-
-void SignEncryptJob::setRecipients(const std::vector<GpgME::Key> &recipients)
-{
- auto d = jobPrivate<SignEncryptJobPrivate>(this);
- d->m_recipients = recipients;
-}
-
-std::vector<GpgME::Key> SignEncryptJob::recipients() const
-{
- auto d = jobPrivate<SignEncryptJobPrivate>(this);
- return d->m_recipients;
-}
-
-void SignEncryptJob::setInputFile(const QString &path)
-{
- auto d = jobPrivate<SignEncryptJobPrivate>(this);
- d->m_inputFilePath = path;
-}
-
-QString SignEncryptJob::inputFile() const
-{
- auto d = jobPrivate<SignEncryptJobPrivate>(this);
- return d->m_inputFilePath;
-}
-
-void SignEncryptJob::setOutputFile(const QString &path)
-{
- auto d = jobPrivate<SignEncryptJobPrivate>(this);
- d->m_outputFilePath = path;
-}
-
-QString SignEncryptJob::outputFile() const
-{
- auto d = jobPrivate<SignEncryptJobPrivate>(this);
- return d->m_outputFilePath;
-}
-
-void SignEncryptJob::setEncryptionFlags(GpgME::Context::EncryptionFlags flags)
-{
- auto d = jobPrivate<SignEncryptJobPrivate>(this);
- d->m_encryptionFlags = static_cast<GpgME::Context::EncryptionFlags>(flags | GpgME::Context::EncryptFile);
-}
-
-GpgME::Context::EncryptionFlags SignEncryptJob::encryptionFlags() const
-{
- auto d = jobPrivate<SignEncryptJobPrivate>(this);
- return d->m_encryptionFlags;
-}
-
-#include "signencryptjob.moc"
diff --git a/lang/qt/src/signencryptjob.h b/lang/qt/src/signencryptjob.h
deleted file mode 100644
index 73b8c227..00000000
--- a/lang/qt/src/signencryptjob.h
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- signencryptjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004, 2007 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_SIGNENCRYPTJOB_H__
-#define __KLEO_SIGNENCRYPTJOB_H__
-
-#include "job.h"
-#include "qgpgme_export.h"
-
-#include <gpgme++/global.h>
-#include <gpgme++/context.h>
-
-#include <memory>
-#include <vector>
-#include <utility>
-
-class QByteArray;
-class QIODevice;
-
-namespace GpgME
-{
-class Error;
-class Key;
-class SigningResult;
-class EncryptionResult;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous combined signing and encrypting
-
- To use a SignEncryptJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the operation with a
- call to start(). This call might fail, in which case the
- SignEncryptJob instance will have scheduled it's own destruction
- with a call to QObject::deleteLater().
-
- Alternatively, the job can be started with startIt() after setting
- an input file and an output file and, optionally, signers, recipients or flags.
- If the job is started this way then the backend reads the input and
- writes the output directly from/to the specified input file and output
- file. In this case the cipherText value of the result signal will always
- be empty. This direct IO mode is currently only supported for OpenPGP.
- Note that startIt() does not schedule the job's destruction if starting
- the job failed.
-
- After result() is emitted, the SignEncryptJob will schedule it's
- own destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT SignEncryptJob : public Job
-{
- Q_OBJECT
-protected:
- explicit SignEncryptJob(QObject *parent);
-public:
- ~SignEncryptJob() override;
-
- /**
- * Sets the file name to embed in the encryption result.
- *
- * This is only used if one of the start() functions is used.
- */
- void setFileName(const QString &fileName);
- QString fileName() const;
-
- /**
- * Sets the keys to use for signing.
- *
- * Used if the job is started with startIt().
- */
- void setSigners(const std::vector<GpgME::Key> &signers);
- std::vector<GpgME::Key> signers() const;
-
- /**
- * Sets the keys to use for encryption.
- *
- * Used if the job is started with startIt().
- */
- void setRecipients(const std::vector<GpgME::Key> &recipients);
- std::vector<GpgME::Key> recipients() const;
-
- /**
- * Sets the path of the file to encrypt.
- *
- * Used if the job is started with startIt().
- */
- void setInputFile(const QString &path);
- QString inputFile() const;
-
- /**
- * Sets the path of the file to write the encryption result to.
- *
- * Used if the job is started with startIt().
- *
- * \note If a file with this path exists, then the job will fail, i.e. you
- * need to delete an existing file that shall be overwritten before you
- * start the job.
- */
- void setOutputFile(const QString &path);
- QString outputFile() const;
-
- /**
- * Sets the flags to use for encryption.
- *
- * Defaults to \c EncryptFile.
- *
- * Used if the job is started with startIt(). The \c EncryptFile flag is
- * always assumed set.
- */
- void setEncryptionFlags(GpgME::Context::EncryptionFlags flags);
- GpgME::Context::EncryptionFlags encryptionFlags() const;
-
- /**
- Starts the combined signing and encrypting operation. \a signers
- is the list of keys to sign \a plainText with. \a recipients is
- a list of keys to encrypt the signed \a plainText to. In both
- lists, empty (null) keys are ignored.
-
- If \a alwaysTrust is true, validity checking for the
- \em recipient keys will not be performed, but full validity
- assumed for all \em recipient keys without further checks.
- */
- virtual GpgME::Error start(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText,
- bool alwaysTrust = false) = 0;
-
- /*!
- \overload
-
- If \a cipherText is non-null, the ciphertext is written
- there. Otherwise, it will be delivered in the third argument of
- result().
- */
- virtual void start(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const std::shared_ptr<QIODevice> &plainText,
- const std::shared_ptr<QIODevice> &cipherText = std::shared_ptr<QIODevice>(),
- bool alwaysTrust = false) = 0;
-
- virtual std::pair<GpgME::SigningResult, GpgME::EncryptionResult>
- exec(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText,
- bool alwaysTrust, QByteArray &cipherText) = 0;
-
- /*!
- This is a hack to request BASE64 output (instead of whatever
- comes out normally).
- */
- virtual void setOutputIsBase64Encoded(bool) = 0;
-
- /** Like start but with an additional argument for EncryptionFlags for
- * more flexibility. */
- virtual void start(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const std::shared_ptr<QIODevice> &plainText,
- const std::shared_ptr<QIODevice> &cipherText = std::shared_ptr<QIODevice>(),
- const GpgME::Context::EncryptionFlags flags = GpgME::Context::None) = 0;
-
- /** Like exec but with an additional argument for EncryptionFlags for
- * more flexibility. */
- virtual std::pair<GpgME::SigningResult, GpgME::EncryptionResult>
- exec(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText,
- const GpgME::Context::EncryptionFlags flags, QByteArray &cipherText) = 0;
-Q_SIGNALS:
- void result(const GpgME::SigningResult &signingresult,
- const GpgME::EncryptionResult &encryptionresult,
- const QByteArray &cipherText, const QString &auditLogAsHtml = QString(),
- const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_SIGNENCRYPTJOB_H__
diff --git a/lang/qt/src/signencryptjob_p.h b/lang/qt/src/signencryptjob_p.h
deleted file mode 100644
index 8f5c91ec..00000000
--- a/lang/qt/src/signencryptjob_p.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- signencryptjob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_SIGNENCRYPTJOB_P_H__
-#define __QGPGME_SIGNENCRYPTJOB_P_H__
-
-#include "job_p.h"
-
-#include <gpgme++/key.h>
-
-namespace QGpgME
-{
-
-struct SignEncryptJobPrivate : public JobPrivate
-{
- // used by start() functions
- QString m_fileName;
-
- // used by startIt()
- std::vector<GpgME::Key> m_signers;
- std::vector<GpgME::Key> m_recipients;
- QString m_inputFilePath;
- QString m_outputFilePath;
- GpgME::Context::EncryptionFlags m_encryptionFlags = GpgME::Context::EncryptFile;
-};
-
-}
-
-#endif // __QGPGME_SIGNENCRYPTJOB_P_H__
diff --git a/lang/qt/src/signjob.cpp b/lang/qt/src/signjob.cpp
deleted file mode 100644
index be15051b..00000000
--- a/lang/qt/src/signjob.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- signjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "signjob.h"
-#include "signjob_p.h"
-
-using namespace QGpgME;
-
-SignJob::SignJob(QObject *parent)
- : Job{parent}
-{
-}
-
-SignJob::~SignJob() = default;
-
-void SignJob::setSigners(const std::vector<GpgME::Key> &signers)
-{
- auto d = jobPrivate<SignJobPrivate>(this);
- d->m_signers = signers;
-}
-
-std::vector<GpgME::Key> SignJob::signers() const
-{
- auto d = jobPrivate<SignJobPrivate>(this);
- return d->m_signers;
-}
-
-void SignJob::setInputFile(const QString &path)
-{
- auto d = jobPrivate<SignJobPrivate>(this);
- d->m_inputFilePath = path;
-}
-
-QString SignJob::inputFile() const
-{
- auto d = jobPrivate<SignJobPrivate>(this);
- return d->m_inputFilePath;
-}
-
-void SignJob::setOutputFile(const QString &path)
-{
- auto d = jobPrivate<SignJobPrivate>(this);
- d->m_outputFilePath = path;
-}
-
-QString SignJob::outputFile() const
-{
- auto d = jobPrivate<SignJobPrivate>(this);
- return d->m_outputFilePath;
-}
-
-void SignJob::setSigningFlags(GpgME::SignatureMode flags)
-{
- auto d = jobPrivate<SignJobPrivate>(this);
- d->m_signingFlags = static_cast<GpgME::SignatureMode>(flags | GpgME::SignFile);
-}
-
-GpgME::SignatureMode SignJob::signingFlags() const
-{
- auto d = jobPrivate<SignJobPrivate>(this);
- return d->m_signingFlags;
-}
-
-void SignJob::setAppendSignature(bool append)
-{
- auto d = jobPrivate<SignJobPrivate>(this);
- d->m_appendSignature = append;
-}
-
-bool SignJob::appendSignatureEnabled() const
-{
- auto d = jobPrivate<SignJobPrivate>(this);
- return d->m_appendSignature;
-}
-
-#include "signjob.moc"
diff --git a/lang/qt/src/signjob.h b/lang/qt/src/signjob.h
deleted file mode 100644
index be29f4d8..00000000
--- a/lang/qt/src/signjob.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- signjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004, 2007 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_SIGNJOB_H__
-#define __KLEO_SIGNJOB_H__
-
-#include "job.h"
-
-#include <gpgme++/global.h>
-
-#include <vector>
-#include <memory>
-
-class QByteArray;
-class QIODevice;
-
-namespace GpgME
-{
-class Error;
-class Key;
-class SigningResult;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous signing
-
- To use a SignJob, first obtain an instance from the CryptoBackend
- implementation, connect the progress() and result() signals to
- suitable slots and then start the signing with a call to
- start(). This call might fail, in which case the SignJob instance
- will have scheduled it's own destruction with a call to
- QObject::deleteLater().
-
- Alternatively, the job can be started with startIt() after setting
- an input file and an output file and, optionally, signers or flags.
- If the job is started this way then the backend reads the input and
- writes the output directly from/to the specified input file and output
- file. In this case the signature value of the result signal will always
- be empty. This direct IO mode is currently only supported for OpenPGP.
- Note that startIt() does not schedule the job's destruction if starting
- the job failed.
-
- After result() is emitted, the SignJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT SignJob : public Job
-{
- Q_OBJECT
-protected:
- explicit SignJob(QObject *parent);
-public:
- ~SignJob() override;
-
- /**
- * Sets the keys to use for signing.
- *
- * Used if the job is started with startIt().
- */
- void setSigners(const std::vector<GpgME::Key> &signers);
- std::vector<GpgME::Key> signers() const;
-
- /**
- * Sets the path of the file to sign.
- *
- * Used if the job is started with startIt().
- */
- void setInputFile(const QString &path);
- QString inputFile() const;
-
- /**
- * Sets the path of the file to write the signing result to.
- *
- * Used if the job is started with startIt().
- *
- * \note If a file with this path exists, then the job will fail, i.e. you
- * need to delete an existing file that shall be overwritten before you
- * start the job. If you create a detached signature then you can tell
- * the job to append the new detached signature to an existing file.
- */
- void setOutputFile(const QString &path);
- QString outputFile() const;
-
- /**
- * Sets the flags to use for signing.
- *
- * Defaults to \c SignFile.
- *
- * Used if the job is started with startIt(). The \c SignFile flag is
- * always assumed set.
- */
- void setSigningFlags(GpgME::SignatureMode flags);
- GpgME::SignatureMode signingFlags() const;
-
- /**
- * If @c true then a new detached signature is appended to an already
- * existing detached signature.
- *
- * Defaults to \c false.
- *
- * Used if the job is started with startIt().
- */
- void setAppendSignature(bool append);
- bool appendSignatureEnabled() const;
-
- /**
- Starts the signing operation. \a signers is the list of keys to
- sign \a plainText with. Empty (null) keys are ignored.
- */
- virtual GpgME::Error start(const std::vector<GpgME::Key> &signers,
- const QByteArray &plainText,
- GpgME::SignatureMode mode) = 0;
-
- /*!
- \overload
-
- If \a signature is non-null the signature is written
- there. Otherwise, it will be delivered in the second argument of
- result().
- */
- virtual void start(const std::vector<GpgME::Key> &signers,
- const std::shared_ptr<QIODevice> &plainText,
- const std::shared_ptr<QIODevice> &signature,
- GpgME::SignatureMode mode) = 0;
-
- virtual GpgME::SigningResult exec(const std::vector<GpgME::Key> &signers,
- const QByteArray &plainText,
- GpgME::SignatureMode mode,
- QByteArray &signature) = 0;
-
- /*!
- This is a hack to request BASE64 output (instead of whatever
- comes out normally).
- */
- virtual void setOutputIsBase64Encoded(bool) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::SigningResult &result, const QByteArray &signature, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_SIGNJOB_H__
diff --git a/lang/qt/src/signjob_p.h b/lang/qt/src/signjob_p.h
deleted file mode 100644
index ec974332..00000000
--- a/lang/qt/src/signjob_p.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- signjob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_SIGNJOB_P_H__
-#define __QGPGME_SIGNJOB_P_H__
-
-#include "job_p.h"
-
-#include <gpgme++/key.h>
-
-namespace QGpgME
-{
-
-struct SignJobPrivate : public JobPrivate
-{
- // used by startIt()
- std::vector<GpgME::Key> m_signers;
- QString m_inputFilePath;
- QString m_outputFilePath;
- GpgME::SignatureMode m_signingFlags = GpgME::SignFile;
- bool m_appendSignature = false;
-};
-
-}
-
-#endif // __QGPGME_SIGNJOB_P_H__
diff --git a/lang/qt/src/signkeyjob.h b/lang/qt/src/signkeyjob.h
deleted file mode 100644
index d0e90c22..00000000
--- a/lang/qt/src/signkeyjob.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- signkeyjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_SIGNKEYJOB_H__
-#define __KLEO_SIGNKEYJOB_H__
-
-#include "job.h"
-
-#include <vector>
-
-namespace GpgME
-{
-class Error;
-class Key;
-enum class TrustSignatureTrust : char;
-}
-
-class QDate;
-class QString;
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class to sign keys asynchronously
-
- To use a SignKeyJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the job with a call
- to start(). This call might fail, in which case the ChangeExpiryJob
- instance will have scheduled it's own destruction with a call to
- QObject::deleteLater().
-
- After result() is emitted, the SignKeyJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT SignKeyJob : public Job
-{
- Q_OBJECT
-protected:
- explicit SignKeyJob(QObject *parent);
-public:
- ~SignKeyJob();
-
- /**
- Starts the key signing operation. \a key is the key to sign.
- @param keyToSign the key to be signed
- */
- virtual GpgME::Error start(const GpgME::Key &keyToSign) = 0;
-
- /**
- * If explicitly specified, only the listed user IDs will be signed. Otherwise all user IDs
- * are signed.
- * @param idsToSign list of user ID indexes (of the key to be signed).
- */
- virtual void setUserIDsToSign(const std::vector<unsigned int> &idsToSign) = 0;
-
- /**
- * sets the check level
- * @param checkLevel the check level, ranges from 0 (no claim) and 3 (extensively checked),
- * default is 0
- */
- virtual void setCheckLevel(unsigned int checkLevel) = 0;
-
- /**
- * sets whether the signature should be exportable, or local only.
- * default is local.
- */
- virtual void setExportable(bool exportable) = 0;
-
- /**
- * sets an alternate signing key
- */
- virtual void setSigningKey(const GpgME::Key &key) = 0;
-
- /**
- * if set, the created signature won't be revocable. By default signatures
- * can be revoked.
- */
- virtual void setNonRevocable(bool nonRevocable) = 0;
-
- /**
- * Set this if it is ok to overwrite an existing signature. In that
- * case the context has to have the flag "extended-edit" set to 1 through
- * Context::setFlag before calling edit.
- *
- * Not pure virtual for ABI compatibility.
- **/
- virtual void setDupeOk(bool) {}
-
- /**
- * Add a remark to the signature. This uses [email protected] as a notation.
- *
- * Not pure virtual for ABI compatibility.
- **/
- virtual void setRemark(const QString &) {}
-
- /**
- * If set, then the created signature will be a trust signature. By default,
- * no trust signatures are created.
- *
- * @a trust is the amount of trust to put into the signed key, either
- * @c TrustSignatureTrust::Partial or @c TrustSignatureTrust::Complete.
- * @a depth is the level of the trust signature. Values between 0 and 255 are
- * allowed. Level 0 has the same meaning as an ordinary validity signature.
- * Level 1 means that the signed key is asserted to be a valid trusted
- * introducer. Level n >= 2 means that the signed key is asserted to be
- * trusted to issue level n-1 trust signatures, i.e., that it is a "meta
- * introducer".
- * @a scope is a domain name that limits the scope of trust of the signed key
- * to user IDs with email addresses matching the domain (or a subdomain).
- *
- * Not pure virtual for ABI compatibility.
- **/
- virtual void setTrustSignature(GpgME::TrustSignatureTrust trust, unsigned short depth, const QString &scope) { Q_UNUSED(trust); Q_UNUSED(depth); Q_UNUSED(scope); }
-
- /**
- * Sets the expiration date of the key signature to @a expiration. By default,
- * key signatures do not expire.
- *
- * Note: Expiration dates after 2106-02-05 will be set to 2106-02-05.
- *
- * Not pure virtual for ABI compatibility.
- **/
- virtual void setExpirationDate(const QDate &expiration) { Q_UNUSED(expiration); }
-
-Q_SIGNALS:
- void result(const GpgME::Error &result, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_SIGNKEYJOB_H__
diff --git a/lang/qt/src/specialjob.h b/lang/qt/src/specialjob.h
deleted file mode 100644
index 5690d2e0..00000000
--- a/lang/qt/src/specialjob.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- specialjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_SPECIALJOB_H__
-#define __KLEO_SPECIALJOB_H__
-
-#include "job.h"
-#include "qgpgme_export.h"
-
-namespace GpgME
-{
-class Error;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for protocol-specific jobs
-
- To use a SpecialJob, first obtain an instance from the
- CryptoBackend implementation, connect progress() and result()
- signals to suitable slots and then start the job with a call to
- start(). This call might fail, in which case the SpecialJob
- instance will have schedules its own destruction with a call to
- QObject::deleteLater().
-
- After result() is emitted, the SpecialJob will schedule its own
- destruction by calling QObject::deleteLater().
-
- Parameters are set using the Qt property system. More general, or
- constructor parameters are given in the call to
- QGpgME::Protocol::specialJob().
-
- The result is made available through the result signal, and
- through the read-only result property, the latter of which needs
- to be defined in each SpecialJob subclass.
-*/
-class QGPGME_EXPORT SpecialJob : public Job
-{
- Q_OBJECT
-protected:
- explicit SpecialJob(QObject *parent);
-
-public:
- ~SpecialJob();
-
- /**
- Starts the special operation.
- */
- virtual GpgME::Error start() = 0;
-
- virtual GpgME::Error exec() = 0;
-
-Q_SIGNALS:
- void result(const GpgME::Error &result, const QVariant &data);
-};
-
-}
-
-#endif // __KLEO_SPECIALJOB_H__
diff --git a/lang/qt/src/threadedjobmixin.cpp b/lang/qt/src/threadedjobmixin.cpp
deleted file mode 100644
index c0485325..00000000
--- a/lang/qt/src/threadedjobmixin.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- threadedjobmixin.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "threadedjobmixin.h"
-
-#include "dataprovider.h"
-#include "util.h"
-
-#include <gpgme++/data.h>
-
-#include <QString>
-#include <QStringList>
-#include <QByteArray>
-
-
-#include <algorithm>
-#include <iterator>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-static QString stringFromGpgOutput(const QByteArray &ba)
-{
-#ifdef Q_OS_WIN
- return QString::fromUtf8(ba);
-#else
- return QString::fromLocal8Bit(ba);
-#endif
-}
-
-static QString markupDiagnostics(const QString &data)
-{
- // First ensure that we don't have html in the diag.
- QString ret = QStringLiteral("<pre>%1</pre>").arg(data.toHtmlEscaped());
-
- return ret;
-}
-
-static const unsigned int CMSAuditLogFlags = Context::AuditLogWithHelp | Context::HtmlAuditLog;
-static const unsigned int OpenPGPAuditLogFlags = Context::DiagnosticAuditLog;
-
-QString _detail::audit_log_as_html(Context *ctx, GpgME::Error &err)
-{
- assert(ctx);
- QGpgME::QByteArrayDataProvider dp;
- Data data(&dp);
- assert(!data.isNull());
-
- if (ctx->protocol() == OpenPGP) {
- if ((err = ctx->getAuditLog(data, OpenPGPAuditLogFlags))) {
- return errorAsString(err);
- }
- const QByteArray ba = dp.data();
- return markupDiagnostics(stringFromGpgOutput(ba));
- }
-
- if (ctx->protocol() == CMS) {
- if ((err = ctx->lastError())) {
- if ((err = ctx->getAuditLog(data, Context::DiagnosticAuditLog))) {
- return errorAsString(err);
- }
- const QByteArray ba = dp.data();
- return markupDiagnostics(stringFromGpgOutput(ba));
- } else if ((err = ctx->getAuditLog(data, CMSAuditLogFlags))) {
- return errorAsString(err);
- }
- return QString::fromUtf8(dp.data());
- }
-
- return QStringLiteral("Unsupported protocol for Audit Log");
-}
-
-static QList<QByteArray> from_sl(const QStringList &sl)
-{
- QList<QByteArray> result;
- for (const QString &str : sl) {
- result.append(str.toUtf8());
- }
-
-#if 0
- std::transform(sl.begin(), sl.end(), std::back_inserter(result),
- mem_fn(static_cast<QByteArray()const>(&QString::toUtf8)));
-#endif
- return result;
-}
-
-static QList<QByteArray> single(const QByteArray &ba)
-{
- QList<QByteArray> result;
- result.push_back(ba);
- return result;
-}
-
-_detail::PatternConverter::PatternConverter(const QByteArray &ba)
- : m_list(single(ba)), m_patterns(nullptr) {}
-_detail::PatternConverter::PatternConverter(const QString &s)
- : m_list(single(s.toUtf8())), m_patterns(nullptr) {}
-_detail::PatternConverter::PatternConverter(const QList<QByteArray> &lba)
- : m_list(lba), m_patterns(nullptr) {}
-_detail::PatternConverter::PatternConverter(const QStringList &sl)
- : m_list(from_sl(sl)), m_patterns(nullptr) {}
-
-const char **_detail::PatternConverter::patterns() const
-{
- if (!m_patterns) {
- m_patterns = new const char *[ m_list.size() + 1 ];
- const char **end = std::transform(m_list.begin(), m_list.end(), m_patterns,
- std::mem_fn(&QByteArray::constData));
- *end = nullptr;
- }
- return m_patterns;
-}
-
-_detail::PatternConverter::~PatternConverter()
-{
- delete [] m_patterns;
-}
diff --git a/lang/qt/src/threadedjobmixin.h b/lang/qt/src/threadedjobmixin.h
deleted file mode 100644
index 7a18aa4d..00000000
--- a/lang/qt/src/threadedjobmixin.h
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- threadedjobmixin.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_THREADEDJOBMIXING_H__
-#define __QGPGME_THREADEDJOBMIXING_H__
-
-#include <QMutex>
-#include <QMutexLocker>
-#include <QThread>
-#include <QString>
-#include <QIODevice>
-
-#include <gpgme++/context.h>
-#include <gpgme++/interfaces/progressprovider.h>
-
-#include "job.h"
-
-#include <cassert>
-#include <functional>
-
-namespace QGpgME
-{
-namespace _detail
-{
-
-QString audit_log_as_html(GpgME::Context *ctx, GpgME::Error &err);
-
-class PatternConverter
-{
- const QList<QByteArray> m_list;
- mutable const char **m_patterns;
-public:
- explicit PatternConverter(const QByteArray &ba);
- explicit PatternConverter(const QString &s);
- explicit PatternConverter(const QList<QByteArray> &lba);
- explicit PatternConverter(const QStringList &sl);
- ~PatternConverter();
-
- const char **patterns() const;
-};
-
-class ToThreadMover
-{
- QObject *const m_object;
- QThread *const m_thread;
-public:
- ToThreadMover(QObject *o, QThread *t) : m_object(o), m_thread(t) {}
- ToThreadMover(QObject &o, QThread *t) : m_object(&o), m_thread(t) {}
- ToThreadMover(const std::shared_ptr<QObject> &o, QThread *t) : m_object(o.get()), m_thread(t) {}
- ~ToThreadMover()
- {
- if (m_object && m_thread) {
- m_object->moveToThread(m_thread);
- }
- }
-};
-
-template <typename T_result>
-class Thread : public QThread
-{
-public:
- explicit Thread(QObject *parent = nullptr) : QThread(parent) {}
-
- void setFunction(const std::function<T_result()> &function)
- {
- const QMutexLocker locker(&m_mutex);
- m_function = function;
- }
-
- bool hasFunction()
- {
- const QMutexLocker locker(&m_mutex);
- return static_cast<bool>(m_function);
- }
-
- T_result result() const
- {
- const QMutexLocker locker(&m_mutex);
- return m_result;
- }
-
-private:
- void run() override {
- const QMutexLocker locker(&m_mutex);
- m_result = m_function();
- }
-private:
- mutable QMutex m_mutex;
- std::function<T_result()> m_function;
- T_result m_result;
-};
-
-template <typename T_base, typename T_result = std::tuple<GpgME::Error, QString, GpgME::Error> >
-class ThreadedJobMixin : public T_base, public GpgME::ProgressProvider
-{
-public:
- typedef ThreadedJobMixin<T_base, T_result> mixin_type;
- typedef T_result result_type;
-
- void run()
- {
- Q_ASSERT(m_thread.hasFunction() && "Call setWorkerFunction() before run()");
- m_thread.start();
- }
-
-protected:
- static_assert(std::tuple_size<T_result>::value > 2,
- "Result tuple too small");
- static_assert(std::is_same <
- typename std::tuple_element <
- std::tuple_size<T_result>::value - 2,
- T_result
- >::type,
- QString
- >::value,
- "Second to last result type not a QString");
- static_assert(std::is_same <
- typename std::tuple_element <
- std::tuple_size<T_result>::value - 1,
- T_result
- >::type,
- GpgME::Error
- >::value,
- "Last result type not a GpgME::Error");
-
- explicit ThreadedJobMixin(GpgME::Context *ctx)
- : T_base(nullptr), m_ctx(ctx), m_thread(), m_auditLog(), m_auditLogError()
- {
- }
-
- void lateInitialization()
- {
- assert(m_ctx);
- QObject::connect(&m_thread, &QThread::finished, this,
- &mixin_type::slotFinished);
- m_ctx->setProgressProvider(this);
- QGpgME::g_context_map.insert(this, m_ctx.get());
- }
-
- ~ThreadedJobMixin()
- {
- QGpgME::g_context_map.remove(this);
- }
-
- template <typename T_binder>
- void setWorkerFunction(const T_binder &func)
- {
- m_thread.setFunction([this, func]() { return func(this->context()); });
- }
-
-public:
- template <typename T_binder>
- void run(const T_binder &func)
- {
- m_thread.setFunction(std::bind(func, this->context()));
- m_thread.start();
- }
- template <typename T_binder>
- void run(const T_binder &func, const std::shared_ptr<QIODevice> &io)
- {
- if (io) {
- io->moveToThread(&m_thread);
- }
- // the arguments passed here to the functor are stored in a QThread, and are not
- // necessarily destroyed (living outside the UI thread) at the time the result signal
- // is emitted and the signal receiver wants to clean up IO devices.
- // To avoid such races, we pass std::weak_ptr's to the functor.
- m_thread.setFunction(std::bind(func, this->context(), this->thread(), std::weak_ptr<QIODevice>(io)));
- m_thread.start();
- }
- template <typename T_binder>
- void run(const T_binder &func, const std::shared_ptr<QIODevice> &io1, const std::shared_ptr<QIODevice> &io2)
- {
- if (io1) {
- io1->moveToThread(&m_thread);
- }
- if (io2) {
- io2->moveToThread(&m_thread);
- }
- // the arguments passed here to the functor are stored in a QThread, and are not
- // necessarily destroyed (living outside the UI thread) at the time the result signal
- // is emitted and the signal receiver wants to clean up IO devices.
- // To avoid such races, we pass std::weak_ptr's to the functor.
- m_thread.setFunction(std::bind(func, this->context(), this->thread(), std::weak_ptr<QIODevice>(io1), std::weak_ptr<QIODevice>(io2)));
- m_thread.start();
- }
-
-protected:
- GpgME::Context *context() const
- {
- return m_ctx.get();
- }
-
- virtual void resultHook(const result_type &) {}
-
- void slotFinished()
- {
- const T_result r = m_thread.result();
- m_auditLog = std::get < std::tuple_size<T_result>::value - 2 > (r);
- m_auditLogError = std::get < std::tuple_size<T_result>::value - 1 > (r);
- resultHook(r);
- Q_EMIT this->done();
- doEmitResult(r);
- this->deleteLater();
- }
- void slotCancel() override {
- if (m_ctx)
- {
- m_ctx->cancelPendingOperation();
- }
- }
- QString auditLogAsHtml() const override
- {
- return m_auditLog;
- }
- GpgME::Error auditLogError() const override
- {
- return m_auditLogError;
- }
- void showProgress(const char *what,
- int type, int current, int total) override {
- QMetaObject::invokeMethod(this, [this, current, total]() {
- Q_EMIT this->jobProgress(current, total);
- }, Qt::QueuedConnection);
- const QString what_ = QString::fromUtf8(what);
- QMetaObject::invokeMethod(this, [this, what_, type, current, total]() {
- Q_EMIT this->rawProgress(what_, type, current, total);
- }, Qt::QueuedConnection);
- QMetaObject::invokeMethod(this, [this, what_, current, total]() {
- QT_WARNING_PUSH
- QT_WARNING_DISABLE_DEPRECATED
- Q_EMIT this->progress(what_, current, total);
- QT_WARNING_POP
- }, Qt::QueuedConnection);
- }
-private:
- template <typename T1, typename T2>
- void doEmitResult(const std::tuple<T1, T2> &tuple)
- {
- Q_EMIT this->result(std::get<0>(tuple), std::get<1>(tuple));
- }
-
- template <typename T1, typename T2, typename T3>
- void doEmitResult(const std::tuple<T1, T2, T3> &tuple)
- {
- Q_EMIT this->result(std::get<0>(tuple), std::get<1>(tuple), std::get<2>(tuple));
- }
-
- template <typename T1, typename T2, typename T3, typename T4>
- void doEmitResult(const std::tuple<T1, T2, T3, T4> &tuple)
- {
- Q_EMIT this->result(std::get<0>(tuple), std::get<1>(tuple), std::get<2>(tuple), std::get<3>(tuple));
- }
-
- template <typename T1, typename T2, typename T3, typename T4, typename T5>
- void doEmitResult(const std::tuple<T1, T2, T3, T4, T5> &tuple)
- {
- Q_EMIT this->result(std::get<0>(tuple), std::get<1>(tuple), std::get<2>(tuple), std::get<3>(tuple), std::get<4>(tuple));
- }
-
-private:
- std::shared_ptr<GpgME::Context> m_ctx;
- Thread<T_result> m_thread;
- QString m_auditLog;
- GpgME::Error m_auditLogError;
-};
-
-}
-}
-
-#endif /* __QGPGME_THREADEDJOBMIXING_H__ */
diff --git a/lang/qt/src/tofupolicyjob.h b/lang/qt/src/tofupolicyjob.h
deleted file mode 100644
index 90debaef..00000000
--- a/lang/qt/src/tofupolicyjob.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* tofupolicyjob.h
-
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-#ifndef QGPGME_TOFUPOLICYJOB_H
-#define QGPGME_TOFUPOLICYJOB_H
-
-#include "job.h"
-
-#include "qgpgme_export.h"
-
-#include <gpgme++/tofuinfo.h>
-
-namespace GpgME
-{
- class Key;
-} // namespace GpgME
-
-namespace QGpgME {
-
-/**
- * Set the TOFU Policy for a key
- */
-class QGPGME_EXPORT TofuPolicyJob: public Job
-{
- Q_OBJECT
-protected:
- explicit TofuPolicyJob(QObject *parent);
-public:
- ~TofuPolicyJob();
-
-
- /* Set the policy to \a policy see the gpgme manual for
- * policy explanations. */
- virtual void start(const GpgME::Key &key, GpgME::TofuInfo::Policy policy) = 0;
-
- virtual GpgME::Error exec(const GpgME::Key &key, GpgME::TofuInfo::Policy policy) = 0;
-
-Q_SIGNALS:
- /* Result of the operation
- *
- * As usual auditLogAsHtml and auditLogError can be ignored.
- **/
- void result(const GpgME::Error &error,
- const QString &auditLogAsHtml = QString(),
- const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif
diff --git a/lang/qt/src/util.cpp b/lang/qt/src/util.cpp
deleted file mode 100644
index 51ae9589..00000000
--- a/lang/qt/src/util.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- util.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "util.h"
-
-#include "cleaner.h"
-#include "qgpgme_debug.h"
-
-#include <QFile>
-#include <QFileInfo>
-#include <QRandomGenerator>
-
-#include <gpgme++/key.h>
-
-#include <algorithm>
-#include <functional>
-
-std::vector<std::string> toStrings(const QStringList &l)
-{
- std::vector<std::string> v;
- v.reserve(l.size());
- std::transform(std::begin(l), std::end(l),
- std::back_inserter(v),
- std::mem_fn(&QString::toStdString));
- return v;
-}
-
-QStringList toFingerprints(const std::vector<GpgME::Key> &keys)
-{
- QStringList fprs;
- fprs.reserve(keys.size());
- std::transform(std::begin(keys), std::end(keys), std::back_inserter(fprs), [](const GpgME::Key &k) {
- return QString::fromLatin1(k.primaryFingerprint());
- });
- return fprs;
-}
-
-/**
- * Generates a string of random characters for the file names of temporary files.
- * Never use this for generating passwords or similar use cases requiring highly
- * secure random data.
- */
-static QString getRandomCharacters(const int count)
-{
- if (count < 0) {
- return {};
- }
-
- QString randomChars;
- randomChars.reserve(count);
-
- do {
- // get a 32-bit random number to generate up to 5 random characters from
- // the set {A-Z, a-z, 0-9}; set the highest bit for the break condition
- for (quint32 rnd = QRandomGenerator::global()->generate() | (1 << 31); rnd > 3; rnd = rnd >> 6)
- {
- // take the last 6 bits; ignore 62 and 63
- const char ch = rnd & ((1 << 6) - 1);
- if (ch < 26) {
- randomChars += QLatin1Char(ch + 'A');
- } else if (ch < 26 + 26) {
- randomChars += QLatin1Char(ch - 26 + 'a');
- } else if (ch < 26 + 26 + 10) {
- randomChars += QLatin1Char(ch - 26 - 26 + '0');
- }
- if (randomChars.size() >= count) {
- break;
- }
- }
- } while (randomChars.size() < count);
-
- return randomChars;
-}
-
-/**
- * Creates a temporary file name with extension \c .part for the given file name
- * \a fileName. The function makes sure that the created file name is not in use
- * at the time the file name is chosen.
- *
- * Example: For the file name "this.is.an.archive.tar.gpg" the temporary file name
- * "this.YHgf2tEl.is.an.archive.tar.gpg.part" could be returned.
- */
-static QString createPartFileName(const QString &fileName)
-{
- static const int maxAttempts = 10;
-
- const QFileInfo fi{fileName};
- const QString path = fi.path(); // path without trailing '/'
- const QString baseName = fi.baseName();
- const QString suffix = fi.completeSuffix();
- for (int attempt = 0; attempt < maxAttempts; ++attempt) {
- const QString candidate = (path + QLatin1Char('/')
- + baseName + QLatin1Char('.')
- + getRandomCharacters(8) + QLatin1Char('.')
- + suffix
- + QLatin1String(".part"));
- if (!QFile::exists(candidate)) {
- return candidate;
- }
- }
-
- qCWarning(QGPGME_LOG) << __func__ << "- Failed to create temporary file name for" << fileName;
- return {};
-}
-
-PartialFileGuard::PartialFileGuard(const QString &fileName)
- : mFileName{fileName}
- , mTempFileName{createPartFileName(fileName)}
-{
- qCDebug(QGPGME_LOG) << __func__ << "- Using temporary file name" << mTempFileName;
-}
-
-PartialFileGuard::~PartialFileGuard()
-{
- if (!mTempFileName.isEmpty()) {
- Cleaner::removeFile(mTempFileName);
- }
-}
-
-QString PartialFileGuard::tempFileName() const
-{
- return mTempFileName;
-}
-
-bool PartialFileGuard::commit()
-{
- if (mTempFileName.isEmpty()) {
- qCWarning(QGPGME_LOG) << "PartialFileGuard::commit: Called more than once";
- return false;
- }
- const bool success = QFile::rename(mTempFileName, mFileName);
- if (success) {
- qCDebug(QGPGME_LOG) << __func__ << "- Renamed" << mTempFileName << "to" << mFileName;
- mTempFileName.clear();
- } else {
- qCDebug(QGPGME_LOG) << __func__ << "- Renaming" << mTempFileName << "to" << mFileName << "failed";
- }
- return success;
-}
diff --git a/lang/qt/src/util.h b/lang/qt/src/util.h
deleted file mode 100644
index fcd1187e..00000000
--- a/lang/qt/src/util.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- util.h - some internal helpers
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_UTIL_H__
-#define __QGPGME_UTIL_H__
-
-#include <QStringList>
-
-#include <gpgme++/error.h>
-
-#include <gpgme.h>
-
-#include <string>
-#include <vector>
-
-namespace GpgME
-{
-class Key;
-}
-
-static inline gpgme_error_t make_error(gpgme_err_code_t code)
-{
- return gpgme_err_make((gpgme_err_source_t)22, code);
-}
-
-static inline QString errorAsString(const GpgME::Error &error)
-{
-#ifdef Q_OS_WIN
- return QString::fromStdString(error.asStdString());
-#else
- return QString::fromLocal8Bit(error.asStdString().c_str());
-#endif
-}
-
-std::vector<std::string> toStrings(const QStringList &l);
-
-QStringList toFingerprints(const std::vector<GpgME::Key> &keys);
-
-/**
- * Helper for using a temporary "part" file for writing a result to, similar
- * to what browsers do when downloading files.
- * On success, you commit() which renames the temporary file to the
- * final file name. Otherwise, you do nothing and let the helper remove the
- * temporary file on destruction.
- */
-class PartialFileGuard
-{
-public:
- explicit PartialFileGuard(const QString &fileName);
- ~PartialFileGuard();
-
- QString tempFileName() const;
-
- bool commit();
-
-private:
- QString mFileName;
- QString mTempFileName;
-};
-
-#endif // __QGPGME_UTIL_H__
diff --git a/lang/qt/src/verifydetachedjob.cpp b/lang/qt/src/verifydetachedjob.cpp
deleted file mode 100644
index 68fe7f21..00000000
--- a/lang/qt/src/verifydetachedjob.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- verifydetachedjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2024 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "verifydetachedjob.h"
-#include "verifydetachedjob_p.h"
-
-using namespace QGpgME;
-
-VerifyDetachedJob::VerifyDetachedJob(QObject *parent)
- : Job{parent}
-{
-}
-
-VerifyDetachedJob::~VerifyDetachedJob() = default;
-
-void VerifyDetachedJob::setProcessAllSignatures (bool processAll)
-{
- auto d = jobPrivate<VerifyDetachedJobPrivate>(this);
- d->m_processAllSignatures = processAll;
-}
-
-bool VerifyDetachedJob::processAllSignatures() const
-{
- auto d = jobPrivate<VerifyDetachedJobPrivate>(this);
- return d->m_processAllSignatures;
-}
-
-void VerifyDetachedJob::setSignatureFile(const QString &path)
-{
- auto d = jobPrivate<VerifyDetachedJobPrivate>(this);
- d->m_signatureFilePath = path;
-}
-
-QString VerifyDetachedJob::signatureFile() const
-{
- auto d = jobPrivate<VerifyDetachedJobPrivate>(this);
- return d->m_signatureFilePath;
-}
-
-void VerifyDetachedJob::setSignedFile(const QString &path)
-{
- auto d = jobPrivate<VerifyDetachedJobPrivate>(this);
- d->m_signedFilePath = path;
-}
-
-QString VerifyDetachedJob::signedFile() const
-{
- auto d = jobPrivate<VerifyDetachedJobPrivate>(this);
- return d->m_signedFilePath;
-}
-
-#include "verifydetachedjob.moc"
diff --git a/lang/qt/src/verifydetachedjob.h b/lang/qt/src/verifydetachedjob.h
deleted file mode 100644
index b5b668e3..00000000
--- a/lang/qt/src/verifydetachedjob.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- verifydetachedjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004, 2007 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_VERIFYDETACHEDJOB_H__
-#define __KLEO_VERIFYDETACHEDJOB_H__
-
-#include "job.h"
-
-#include <memory>
-
-class QByteArray;
-class QIODevice;
-
-namespace GpgME
-{
-class Error;
-class VerificationResult;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous verification of detached signatures
-
- To use a VerifyDetachedJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the verification with a
- call to start(). This call might fail, in which case the
- VerifyDetachedJob instance will have scheduled it's own
- destruction with a call to QObject::deleteLater().
-
- Alternatively, the job can be started with startIt() after setting
- the input files. If the job is started this way then the backend reads the
- input directly from the specified input files. This direct IO mode is
- currently only supported for OpenPGP. Note that startIt() does not schedule
- the job's destruction if starting the job failed.
-
- After result() is emitted, the VerifyDetachedJob will schedule
- it's own destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT VerifyDetachedJob : public Job
-{
- Q_OBJECT
-protected:
- explicit VerifyDetachedJob(QObject *parent);
-public:
- ~VerifyDetachedJob() override;
-
- /**
- * Enables processing of all signatures if \a processAll is true.
- *
- * By default, gpg (in batch mode used by GpgME) stops the verification of
- * data signatures when a bad signature is encountered. This can be changed
- * by setting this flag. It's equivalent to setting the context flag
- * "proc-all-sigs".
- *
- * This is only supported for OpenPGP and requires GnuPG 2.2.45, 2.4.6, or
- * 2.5.1.
- */
- void setProcessAllSignatures(bool processAll);
- bool processAllSignatures() const;
-
- /**
- * Sets the path of the file containing the signature to verify.
- *
- * Used if the job is started with startIt().
- */
- void setSignatureFile(const QString &path);
- QString signatureFile() const;
-
- /**
- * Sets the path of the file containing the signed data to verify.
- *
- * Used if the job is started with startIt().
- */
- void setSignedFile(const QString &path);
- QString signedFile() const;
-
- /**
- Starts the verification operation. \a signature contains the
- signature data, while \a signedData contains the data over
- which the signature was made.
- */
- virtual GpgME::Error start(const QByteArray &signature,
- const QByteArray &signedData) = 0;
-
- virtual void start(const std::shared_ptr<QIODevice> &signature, const std::shared_ptr<QIODevice> &signedData) = 0;
-
- virtual GpgME::VerificationResult exec(const QByteArray &signature,
- const QByteArray &signedData) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::VerificationResult &result, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_VERIFYDETACHEDJOB_H__
diff --git a/lang/qt/src/verifydetachedjob_p.h b/lang/qt/src/verifydetachedjob_p.h
deleted file mode 100644
index cc594210..00000000
--- a/lang/qt/src/verifydetachedjob_p.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- verifydetachedjob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2024 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_VERIFYDETACHEDJOB_P_H__
-#define __QGPGME_VERIFYDETACHEDJOB_P_H__
-
-#include "job_p.h"
-
-namespace QGpgME
-{
-
-struct VerifyDetachedJobPrivate : public JobPrivate
-{
- QString m_signatureFilePath;
- QString m_signedFilePath;
- bool m_processAllSignatures = false;
-};
-
-}
-
-#endif // __QGPGME_VERIFYDETACHEDJOB_P_H__
diff --git a/lang/qt/src/verifyopaquejob.cpp b/lang/qt/src/verifyopaquejob.cpp
deleted file mode 100644
index dced4595..00000000
--- a/lang/qt/src/verifyopaquejob.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- verifyopaquejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "verifyopaquejob.h"
-#include "verifyopaquejob_p.h"
-
-using namespace QGpgME;
-
-VerifyOpaqueJob::VerifyOpaqueJob(QObject *parent)
- : Job{parent}
-{
-}
-
-VerifyOpaqueJob::~VerifyOpaqueJob() = default;
-
-void VerifyOpaqueJob::setProcessAllSignatures (bool processAll)
-{
- auto d = jobPrivate<VerifyOpaqueJobPrivate>(this);
- d->m_processAllSignatures = processAll;
-}
-
-bool VerifyOpaqueJob::processAllSignatures() const
-{
- auto d = jobPrivate<VerifyOpaqueJobPrivate>(this);
- return d->m_processAllSignatures;
-}
-
-void VerifyOpaqueJob::setInputFile(const QString &path)
-{
- auto d = jobPrivate<VerifyOpaqueJobPrivate>(this);
- d->m_inputFilePath = path;
-}
-
-QString VerifyOpaqueJob::inputFile() const
-{
- auto d = jobPrivate<VerifyOpaqueJobPrivate>(this);
- return d->m_inputFilePath;
-}
-
-void VerifyOpaqueJob::setOutputFile(const QString &path)
-{
- auto d = jobPrivate<VerifyOpaqueJobPrivate>(this);
- d->m_outputFilePath = path;
-}
-
-QString VerifyOpaqueJob::outputFile() const
-{
- auto d = jobPrivate<VerifyOpaqueJobPrivate>(this);
- return d->m_outputFilePath;
-}
-
-#include "verifyopaquejob.moc"
diff --git a/lang/qt/src/verifyopaquejob.h b/lang/qt/src/verifyopaquejob.h
deleted file mode 100644
index e006886b..00000000
--- a/lang/qt/src/verifyopaquejob.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- verifyopaquejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004, 2007 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __KLEO_VERIFYOPAQUEJOB_H__
-#define __KLEO_VERIFYOPAQUEJOB_H__
-
-#include "job.h"
-
-#include <memory>
-
-class QByteArray;
-class QIODevice;
-
-namespace GpgME
-{
-class Error;
-class VerificationResult;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous verification of opaque signatures
-
- To use a VerifyOpaqueJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the verification with a
- call to start(). This call might fail, in which case the
- VerifyOpaqueJob instance will have scheduled it's own
- destruction with a call to QObject::deleteLater().
-
- Alternatively, the job can be started with startIt() after setting
- an input file and an output file. If the job is started this way then
- the backend reads the input and writes the output directly from/to the
- specified input file and output file. In this case the plainText value of
- the result signal will always be empty. This direct IO mode is currently
- only supported for OpenPGP. Note that startIt() does not schedule the job's
- destruction if starting the job failed.
-
- After result() is emitted, the VerifyOpaqueJob will schedule
- it's own destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT VerifyOpaqueJob : public Job
-{
- Q_OBJECT
-protected:
- explicit VerifyOpaqueJob(QObject *parent);
-public:
- ~VerifyOpaqueJob() override;
-
- /**
- * Enables processing of all signatures if \a processAll is true.
- *
- * By default, gpg (in batch mode used by GpgME) stops the verification of
- * data signatures when a bad signature is encountered. This can be changed
- * by setting this flag. It's equivalent to setting the context flag
- * "proc-all-sigs".
- *
- * This is only supported for OpenPGP and requires GnuPG 2.2.45, 2.4.6, or
- * 2.5.1.
- */
- void setProcessAllSignatures(bool processAll);
- bool processAllSignatures() const;
-
- /**
- * Sets the path of the file to verify.
- *
- * Used if the job is started with startIt().
- */
- void setInputFile(const QString &path);
- QString inputFile() const;
-
- /**
- * Sets the path of the file to write the result to.
- *
- * Used if the job is started with startIt().
- *
- * \note If a file with this path exists, then the job will fail, i.e. you
- * need to delete an existing file that shall be overwritten before you
- * start the job.
- */
- void setOutputFile(const QString &path);
- QString outputFile() const;
-
- /**
- Starts the verification operation. \a signature contains the
- signature data, while \a signedData contains the data over
- which the signature was made.
- */
- virtual GpgME::Error start(const QByteArray &signedData) = 0;
-
- /*!
- \overload
-
- If \a plainText is non-null, the plaintext is written
- there. Otherwise, it will be delivered in the second argument
- of result().
- */
- virtual void start(const std::shared_ptr<QIODevice> &signedData, const std::shared_ptr<QIODevice> &plainText = std::shared_ptr<QIODevice>()) = 0;
-
- /** Synchronous version of @ref start */
- virtual GpgME::VerificationResult exec(const QByteArray &signedData, QByteArray &plainText) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::VerificationResult &result, const QByteArray &plainText, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_VERIFYOPAQUEJOB_H__
diff --git a/lang/qt/src/verifyopaquejob_p.h b/lang/qt/src/verifyopaquejob_p.h
deleted file mode 100644
index 9686f01c..00000000
--- a/lang/qt/src/verifyopaquejob_p.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- verifyopaquejob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_VERIFYOPAQUEJOB_P_H__
-#define __QGPGME_VERIFYOPAQUEJOB_P_H__
-
-#include "job_p.h"
-
-namespace QGpgME
-{
-
-struct VerifyOpaqueJobPrivate : public JobPrivate
-{
- QString m_inputFilePath;
- QString m_outputFilePath;
- bool m_processAllSignatures = false;
-};
-
-}
-
-#endif // __QGPGME_VERIFYOPAQUEJOB_P_H__
diff --git a/lang/qt/src/wkdlookupjob.h b/lang/qt/src/wkdlookupjob.h
deleted file mode 100644
index ae228744..00000000
--- a/lang/qt/src/wkdlookupjob.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- wkdlookupjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_WKDLOOKUPJOB_H__
-#define __QGPGME_WKDLOOKUPJOB_H__
-
-#include "job.h"
-#include "qgpgme_export.h"
-
-class QString;
-
-namespace GpgME
-{
-class Data;
-class Error;
-}
-
-namespace QGpgME
-{
-
-class WKDLookupResult;
-
-class QGPGME_EXPORT WKDLookupJob : public Job
-{
- Q_OBJECT
-protected:
- explicit WKDLookupJob(QObject *parent);
-
-public:
- ~WKDLookupJob();
-
- /**
- Starts a key lookup operation for the email address \a email via WKD.
- */
- virtual GpgME::Error start(const QString &email) = 0;
-
- /**
- Runs a key lookup operation for the email address \a email via WKD.
- */
- virtual WKDLookupResult exec(const QString &email) = 0;
-
-Q_SIGNALS:
- void result(const WKDLookupResult &result, const QString &auditLogAsHtml = {}, const GpgME::Error &auditLogError = {});
-};
-
-}
-
-#endif // __QGPGME_WKDLOOKUPJOB_H__
diff --git a/lang/qt/src/wkdlookupresult.cpp b/lang/qt/src/wkdlookupresult.cpp
deleted file mode 100644
index ac1a89e9..00000000
--- a/lang/qt/src/wkdlookupresult.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- wkdlookupresult.cpp - wraps the result of a WKDLookupJob
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "wkdlookupresult.h"
-
-#include <gpgme++/data.h>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-class WKDLookupResult::Private
-{
-public:
- std::string pattern;
- GpgME::Data keyData;
- std::string source;
-};
-
-WKDLookupResult::WKDLookupResult() = default;
-
-WKDLookupResult::~WKDLookupResult() = default;
-
-WKDLookupResult::WKDLookupResult(const std::string &pattern, const Error &error)
- : Result{error}
- , d{new Private{pattern, {}, {}}}
-{
-}
-
-WKDLookupResult::WKDLookupResult(const std::string &pattern, const Data &keyData, const std::string &source, const Error &error)
- : Result{error}
- , d{new Private{pattern, keyData, source}}
-{
-}
-
-WKDLookupResult::WKDLookupResult(const WKDLookupResult &other)
- : Result{other}
-{
- if (other.d) {
- d.reset(new Private{*other.d});
- }
-}
-
-WKDLookupResult &WKDLookupResult::operator=(const WKDLookupResult &other)
-{
- auto tmp = other;
- swap(tmp);
- return *this;
-}
-
-WKDLookupResult::WKDLookupResult(WKDLookupResult &&other) = default;
-
-WKDLookupResult &WKDLookupResult::operator=(WKDLookupResult &&other) = default;
-
-void WKDLookupResult::swap(WKDLookupResult &other) noexcept
-{
- Result::swap(other);
- std::swap(this->d, other.d);
-}
-
-bool WKDLookupResult::isNull() const
-{
- return !d && !bool(error());
-}
-
-std::string WKDLookupResult::pattern() const
-{
- return d ? d->pattern : std::string{};
-}
-
-Data WKDLookupResult::keyData() const
-{
- return d ? d->keyData : Data{};
-}
-
-std::string WKDLookupResult::source() const
-{
- return d ? d->source : std::string{};
-}
-
-void QGpgME::swap(WKDLookupResult &a, WKDLookupResult &b)
-{
- a.swap(b);
-}
diff --git a/lang/qt/src/wkdlookupresult.h b/lang/qt/src/wkdlookupresult.h
deleted file mode 100644
index 5696fb6d..00000000
--- a/lang/qt/src/wkdlookupresult.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- wkdlookupresult.h - wraps the result of a WKDLookupJob
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_WKDLOOKUPRESULT_H__
-#define __QGPGME_WKDLOOKUPRESULT_H__
-
-#include "qgpgme_export.h"
-
-#include <gpgme++/result.h>
-
-#include <memory>
-
-namespace GpgME
-{
-class Data;
-class Error;
-}
-
-namespace QGpgME
-{
-
-class QGPGME_EXPORT WKDLookupResult : public GpgME::Result
-{
-public:
- WKDLookupResult();
- ~WKDLookupResult();
-
- explicit WKDLookupResult(const std::string &pattern, const GpgME::Error &err);
- explicit WKDLookupResult(const std::string &pattern, const GpgME::Data &keyData, const std::string &source, const GpgME::Error &err);
-
- WKDLookupResult(const WKDLookupResult &other);
- WKDLookupResult &operator=(const WKDLookupResult &other);
-
- WKDLookupResult(WKDLookupResult &&other);
- WKDLookupResult &operator=(WKDLookupResult &&other);
-
- void swap(WKDLookupResult &other) noexcept;
-
- bool isNull() const;
-
- std::string pattern() const;
- GpgME::Data keyData() const;
- std::string source() const;
-
-private:
- class Private;
- std::unique_ptr<Private> d;
-};
-
-QGPGME_EXPORT void swap(WKDLookupResult &a, WKDLookupResult &b);
-
-}
-
-#endif // __QGPGME_WKDLOOKUPRESULT_H__
diff --git a/lang/qt/src/wkdrefreshjob.cpp b/lang/qt/src/wkdrefreshjob.cpp
deleted file mode 100644
index f79df2c5..00000000
--- a/lang/qt/src/wkdrefreshjob.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- wkdrefreshjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "wkdrefreshjob.h"
-#include "wkdrefreshjob_p.h"
-
-using namespace QGpgME;
-
-WKDRefreshJob::WKDRefreshJob(QObject *parent)
- : AbstractImportJob{parent}
-{
-}
-
-WKDRefreshJob::~WKDRefreshJob() = default;
-
-GpgME::Error WKDRefreshJob::start(const std::vector<GpgME::Key> &keys)
-{
- auto d = jobPrivate<WKDRefreshJobPrivate>(this);
- d->m_keys = keys;
- return d->startIt();
-}
-
-GpgME::Error WKDRefreshJob::start(const std::vector<GpgME::UserID> &userIDs)
-{
- auto d = jobPrivate<WKDRefreshJobPrivate>(this);
- d->m_userIds = userIDs;
- return d->startIt();
-}
-
-#include "wkdrefreshjob.moc"
diff --git a/lang/qt/src/wkdrefreshjob.h b/lang/qt/src/wkdrefreshjob.h
deleted file mode 100644
index cbaaf6b0..00000000
--- a/lang/qt/src/wkdrefreshjob.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- wkdrefreshjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_WKDREFRESHJOB_H__
-#define __QGPGME_WKDREFRESHJOB_H__
-
-#include "abstractimportjob.h"
-#include "qgpgme_export.h"
-
-#include <vector>
-
-namespace GpgME
-{
-class Error;
-class Key;
-class UserID;
-}
-
-namespace QGpgME
-{
-
-/**
- * This job refreshes OpenPGP keys via WKD.
- */
-class QGPGME_EXPORT WKDRefreshJob : public AbstractImportJob
-{
- Q_OBJECT
-protected:
- explicit WKDRefreshJob(QObject *parent);
-public:
- ~WKDRefreshJob() override;
-
- /**
- * Starts a refresh of the \a keys. Only user IDs that have WKD set as
- * origin are used for the WKD lookup. Revoked user IDs are ignored.
- *
- * Use the other start overload to use all user IDs for the WKD lookup.
- */
- GpgME::Error start(const std::vector<GpgME::Key> &keys);
-
- /**
- * Starts a refresh of the keys belonging to the user IDs \a userIDs.
- * All user IDs are used for the WKD lookup. Revoked user IDs are ignored.
- */
- GpgME::Error start(const std::vector<GpgME::UserID> &userIDs);
-};
-
-}
-
-#endif // __QGPGME_WKDREFRESHJOB_H__
diff --git a/lang/qt/src/wkdrefreshjob_p.h b/lang/qt/src/wkdrefreshjob_p.h
deleted file mode 100644
index 8e729936..00000000
--- a/lang/qt/src/wkdrefreshjob_p.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- wkdrefreshjob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifndef __QGPGME_WKDREFRESHJOB_P_H__
-#define __QGPGME_WKDREFRESHJOB_P_H__
-
-#include "job_p.h"
-
-#include <gpgme++/key.h>
-
-namespace QGpgME
-{
-
-struct WKDRefreshJobPrivate : public JobPrivate
-{
- std::vector<GpgME::Key> m_keys;
- std::vector<GpgME::UserID> m_userIds;
-};
-
-}
-
-#endif // __QGPGME_WKDREFRESHJOB_P_H__
diff --git a/lang/qt/src/wkspublishjob.h b/lang/qt/src/wkspublishjob.h
deleted file mode 100644
index 2b4daf51..00000000
--- a/lang/qt/src/wkspublishjob.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* wkspublishjob.h
-
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-#ifndef QGPGME_WKSPUBLISHJOB_H
-#define QGPGME_WKSPUBLISHJOB_H
-
-#include "job.h"
-
-#include "qgpgme_export.h"
-
-namespace GpgME
-{
- class Key;
-} // namespace GpgME
-
-namespace QGpgME {
-
-/**
- * Handles Web Key Service Publishing. Needs WKS tools installed and
- * server support.
- *
- * Remember that after a result is emitted the job is auto deleted
- * so you can only use it for a single action.
- *
- * The workflow is to call startCreate, check for errors and then
- * send the RFC822 mail returned in returnedData.
- *
- * When the response is received call startReceive with the
- * RFC822 mail received as parameter response. Check for errors
- * and then send the result from returnedData back to the server.
- */
-class QGPGME_EXPORT WKSPublishJob: public Job
-{
- Q_OBJECT
-protected:
- explicit WKSPublishJob(QObject *parent);
-public:
- ~WKSPublishJob();
-
- /** Start a check if WKS Publishing is supported. As this involves
- * an HTTP Query it might take a while. Returns GPG_ERR_NOT_SUPPORED
- * result if GnuPG is too old or the required tools are not installed.
- *
- * The error GPG_ERR_NOT_ENABLED indicates that wks-tools failed to
- * detect a working wks service for this.
- *
- * @param the mailbox to check for.
- **/
- virtual void startCheck(const QString &mailbox) = 0;
-
- /** Create a publish request.
- * The returnedData from the result signal will contain
- * the full Request as returned by gpg-wks-client --create
- *
- * @param fpr the fingerprint of the key to create the request for.
- * @param mailbox A simple mail address without a Name.
- */
- virtual void startCreate(const char *fpr, const QString &mailbox) = 0;
-
- /** Handle a submission response. The returnedData in the result singnal
- * will contain the confirmation response as returned by gpg-wks-client --receive
- *
- * @param response The response of the server.
- **/
- virtual void startReceive(const QByteArray &response) = 0;
-
-Q_SIGNALS:
- /* Result of the operation returned Data and returned Error are
- * the results from gpg-wks-client's stdout or stderr respectively.
- *
- * As usual auditLogAsHtml and auditLogError can be ignored.
- **/
- void result(const GpgME::Error &error, const QByteArray &returnedData,
- const QByteArray &returnedError,
- const QString &auditLogAsHtml = QString(),
- const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif