Compare commits

..

No commits in common. "master" and "ikloecker/t6550" have entirely different histories.

242 changed files with 2030 additions and 4704 deletions

79
NEWS
View File

@ -1,4 +1,4 @@
Noteworthy changes in version 1.24.0 (unrelease) Noteworthy changes in version 1.23.3 (unrelease)
------------------------------------------------- -------------------------------------------------
* Extended gpgme_op_decrypt* and gpgme_op_verify* to allow writing the * Extended gpgme_op_decrypt* and gpgme_op_verify* to allow writing the
@ -7,87 +7,10 @@ Noteworthy changes in version 1.24.0 (unrelease)
* Extended gpgme_op_encrypt*, gpgme_op_encrypt_sign*, and gpgme_op_sign* * Extended gpgme_op_encrypt*, gpgme_op_encrypt_sign*, and gpgme_op_sign*
to allow reading the input data directly from a file. [T6550] to allow reading the input data directly from a file. [T6550]
* Add information about designated revocation keys. [T7118]
* New context flag "import-options". [T7152]
* cpp: Provide information about designated revocation keys for a Key.
[T7118]
* cpp: Add safer member function returning text describing an error.
[T5960]
* qt: Build QGpgME for Qt 5 and Qt 6 simultaneously. [T7205]
* qt: Install headers for Qt 5 and Qt 6 in separate folders. [T7161]
* qt: Allow reading the data to decrypt/encrypt/sign/verify directly from
files. [T6550]
* qt: Allow writing the decrypted/encrypted/signed/verified data directly
to files. [T6550]
* qt: Allow specifying import options when importing keys. [T7152]
* qt: Allow appending a detached signature to an existing file. [T6867]
* Interface changes relative to the 1.23.2 release: * Interface changes relative to the 1.23.2 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GPGME_ENCRYPT_FILE NEW. GPGME_ENCRYPT_FILE NEW.
GPGME_SIG_MODE_FILE NEW. GPGME_SIG_MODE_FILE NEW.
gpgme_key_t EXTENDED: New field 'revkeys'.
gpgme_revocation_key_t NEW.
gpgme_set_ctx_flag EXTENDED: New flag 'import-options'.
cpp: Context::EncryptFile NEW.
cpp: SignatureMode::SignFile NEW.
cpp: RevocationKey NEW.
cpp: Key::revocationKey NEW.
cpp: Key::numRevocationKeys NEW.
cpp: Key::revocationKeys NEW.
cpp: Error::asStdString NEW.
cpp: Error::asString DEPRECATED.
qt: DecryptVerifyJob::setInputFile NEW.
qt: DecryptVerifyJob::inputFile NEW.
qt: DecryptVerifyJob::setOutputFile NEW.
qt: DecryptVerifyJob::outputFile NEW.
qt: EncryptJob::setRecipients NEW.
qt: EncryptJob::recipients NEW.
qt: EncryptJob::setInputFile NEW.
qt: EncryptJob::inputFile NEW.
qt: EncryptJob::setOutputFile NEW.
qt: EncryptJob::outputFile NEW.
qt: EncryptJob::setEncryptionFlags NEW.
qt: EncryptJob::encryptionFlags NEW.
qt: SignEncryptJob::setSigners NEW.
qt: SignEncryptJob::signers NEW.
qt: SignEncryptJob::setRecipients NEW.
qt: SignEncryptJob::recipients NEW.
qt: SignEncryptJob::setInputFile NEW.
qt: SignEncryptJob::inputFile NEW.
qt: SignEncryptJob::setOutputFile NEW.
qt: SignEncryptJob::outputFile NEW.
qt: SignEncryptJob::setEncryptionFlags NEW.
qt: SignEncryptJob::encryptionFlags NEW.
qt: SignJob::setSigners NEW.
qt: SignJob::signers NEW.
qt: SignJob::setInputFile NEW.
qt: SignJob::inputFile NEW.
qt: SignJob::setOutputFile NEW.
qt: SignJob::outputFile NEW.
qt: SignJob::setSigningFlags NEW.
qt: SignJob::signingFlags NEW.
qt: SignJob::setAppendSignature NEW.
qt: SignJob::appendSignatureEnabled NEW.
qt: VerifyDetachedJob::setSignatureFile NEW.
qt: VerifyDetachedJob::signatureFile NEW.
qt: VerifyDetachedJob::setSignedFile NEW.
qt: VerifyDetachedJob::signedFile NEW.
qt: VerifyOpaqueJob::setInputFile NEW.
qt: VerifyOpaqueJob::inputFile NEW.
qt: VerifyOpaqueJob::setOutputFile NEW.
qt: VerifyOpaqueJob::outputFile NEW.
qt: ImportJob::setImportOptions NEW.
qt: ImportJob::importOptions NEW.
Noteworthy changes in version 1.23.2 (2023-11-28) Noteworthy changes in version 1.23.2 (2023-11-28)

View File

@ -31,8 +31,8 @@ min_automake_version="1.14"
# for the LT versions. # for the LT versions.
m4_define([mym4_package],[gpgme]) m4_define([mym4_package],[gpgme])
m4_define([mym4_major], [1]) m4_define([mym4_major], [1])
m4_define([mym4_minor], [24]) m4_define([mym4_minor], [23])
m4_define([mym4_micro], [0]) m4_define([mym4_micro], [3])
# Below is m4 magic to extract and compute the git revision number, # Below is m4 magic to extract and compute the git revision number,
# the decimalized short revision number, a beta version string and a # the decimalized short revision number, a beta version string and a
@ -85,7 +85,7 @@ AC_SUBST(LIBQGPGME_LT_REVISION)
GPGME_CONFIG_API_VERSION=1 GPGME_CONFIG_API_VERSION=1
############################################## ##############################################
NEED_GPG_ERROR_VERSION=1.47 NEED_GPG_ERROR_VERSION=1.36
NEED_LIBASSUAN_API=2 NEED_LIBASSUAN_API=2
NEED_LIBASSUAN_VERSION=2.4.2 NEED_LIBASSUAN_VERSION=2.4.2
@ -257,7 +257,7 @@ have_macos_system=no
build_w32_glib=no build_w32_glib=no
build_w32_qt=no build_w32_qt=no
available_languages="cl cpp python qt qt5 qt6" available_languages="cl cpp python qt qt5 qt6"
default_languages="cl cpp python qt5 qt6" default_languages="cl cpp python qt"
case "${host}" in case "${host}" in
x86_64-*mingw32*) x86_64-*mingw32*)
have_w64_system=yes have_w64_system=yes
@ -375,7 +375,8 @@ AC_ARG_ENABLE([no-direct-extern-access],
AC_ARG_ENABLE([languages], AC_ARG_ENABLE([languages],
AS_HELP_STRING([--enable-languages=languages], AS_HELP_STRING([--enable-languages=languages],
[enable only specific language bindings: [enable only specific language bindings:
cl cpp python qt5 qt6]), cl cpp python qt qt5 qt6 (qt selects qt5 or qt6,
and qt5 and qt6 exclude each other)]),
[enabled_languages=`echo $enableval | \ [enabled_languages=`echo $enableval | \
tr ',:' ' ' | tr '[A-Z]' '[a-z]' | \ tr ',:' ' ' | tr '[A-Z]' '[a-z]' | \
sed 's/c++/cpp/'`], sed 's/c++/cpp/'`],
@ -401,95 +402,76 @@ for language in $enabled_languages; do
fi fi
done done
# Check whether qt5 and/or qt6 are enabled # Check whether Qt5 and/or Qt6 are enabled explicitly
want_qt5="no" want_qt5="no";
LIST_MEMBER("qt5", $enabled_languages) LIST_MEMBER("qt5", $enabled_languages)
if test "$found" = "1"; then if test "$found" = "1"; then
if test "$explicit_languages" = "1"; then want_qt5="yes";
want_qt5="yes"
else
want_qt5="maybe"
fi
# Remove qt5; further down qt will be added # Remove qt5; further down qt will be added
enabled_languages=$(echo $enabled_languages | sed 's/qt5//') enabled_languages=$(echo $enabled_languages | sed 's/qt5//')
fi fi
want_qt6="no" want_qt6="no";
LIST_MEMBER("qt6", $enabled_languages) LIST_MEMBER("qt6", $enabled_languages)
if test "$found" = "1"; then if test "$found" = "1"; then
if test "$explicit_languages" = "1"; then want_qt6="yes";
want_qt6="yes"
else
want_qt6="maybe"
fi
# Remove qt6; further down qt will be added # Remove qt6; further down qt will be added
enabled_languages=$(echo $enabled_languages | sed 's/qt6//') enabled_languages=$(echo $enabled_languages | sed 's/qt6//')
fi fi
if test "$want_qt5" = "yes" -a "$want_qt6" = "yes"; then
# Check whether qt is enabled; if yes then it has been enabled explicitly AC_MSG_ERROR([[
want_qt="no"
LIST_MEMBER("qt", $enabled_languages)
if test "$found" = "1"; then
# Ignore qt if specified together with qt5 or qt6
if test "$want_qt5" = "no" -a "$want_qt6" = "no"; then
want_qt="yes"
fi
# Remove qt
enabled_languages=$(echo $enabled_languages | sed 's/qt//')
AC_MSG_WARN([[
*** ***
*** Language binding "qt" is deprecated and will be removed in a future version. *** The bindings for Qt5 and Qt6 cannot be built simultaneously.
*** Use "qt5" and/or "qt6" instead.
***]]) ***]])
fi fi
# Ensure that pkg-config is available for all calls of FIND_QT5/FIND_QT6 # Ensure that pkg-config is available for all calls of FIND_QT5/FIND_QT6
PKG_PROG_PKG_CONFIG PKG_PROG_PKG_CONFIG
# Check for Qt 5 (if qt5 or qt is enabled) # If the generic qt is enabled, then check for Qt5 or Qt6 (in this order)
if test "$want_qt" = "yes"; then LIST_MEMBER("qt", $enabled_languages)
want_qt5="maybe" if test "$found" = "1"; then
fi # Remove the generic qt (qt5 and qt6 have already been removed)
if test "$want_qt5" != "no"; then enabled_languages=$(echo $enabled_languages | sed 's/qt//')
FIND_QT5 FIND_QT5
if test "$have_qt5_libs" = "yes"; then if test "$have_qt5_libs" = "yes"; then
want_qt5="yes" want_qt5="yes";
else
FIND_QT6
if test "$have_qt6_libs" = "yes"; then
want_qt6="yes";
else
if test "$explicit_languages" = "1"; then
AC_MSG_ERROR([[
***
*** Qt5 (Qt5Core) or Qt6 (Qt6Core) is required for the Qt binding.
***]])
else
AC_MSG_WARN([[
***
*** Qt5 (Qt5Core) and Qt6 (Qt6Core) not found. Qt Binding will be disabled.
***]])
fi
fi
fi
elif test "$want_qt5" = "yes"; then elif test "$want_qt5" = "yes"; then
FIND_QT5
if test "$have_qt5_libs" != "yes"; then
AC_MSG_ERROR([[ AC_MSG_ERROR([[
*** ***
*** Qt5 (Qt5Core) is required for the Qt 5 binding. *** Qt5 (Qt5Core) is required for the Qt 5 binding.
***]]) ***]])
else
want_qt5="no"
fi fi
fi
# Check for Qt 6 (if qt6 is enabled or if qt is enabled and Qt 5 wasn't found)
if test "$want_qt" = "yes" -a "$have_qt5_libs" != "yes"; then
want_qt6="maybe"
fi
if test "$want_qt6" != "no"; then
FIND_QT6
if test "$have_qt6_libs" = "yes"; then
want_qt6="yes";
elif test "$want_qt6" = "yes"; then elif test "$want_qt6" = "yes"; then
FIND_QT6
if test "$have_qt6_libs" != "yes"; then
AC_MSG_ERROR([[ AC_MSG_ERROR([[
*** ***
*** Qt6 (Qt6Core) is required for the Qt 6 binding. *** Qt6 (Qt6Core) is required for the Qt 6 binding.
***]]) ***]])
else
want_qt6="no"
fi fi
fi fi
# Check if any Qt was found (if qt is enabled) # Check that cpp is enabled if qt5 or qt6 is enabled
if test "$want_qt" = "yes" -a "$have_qt5_libs" != "yes" -a "$have_qt6_libs" != "yes"; then
AC_MSG_ERROR([[
***
*** Qt5 (Qt5Core) or Qt6 (Qt6Core) is required for the Qt bindings.
***]])
fi
# Check that cpp is enabled if qt5 or qt6 is enabled and was found
if test "$want_qt5" = "yes" -o "$want_qt6" = "yes"; then if test "$want_qt5" = "yes" -o "$want_qt6" = "yes"; then
LIST_MEMBER("cpp", $enabled_languages) LIST_MEMBER("cpp", $enabled_languages)
if test "$found" = "0"; then if test "$found" = "0"; then
@ -540,7 +522,7 @@ if test "$found" = "1" -a "$HAVE_CXX17" != "1"; then
fi fi
fi fi
# Now append qt to the list of language bindings (to enable the subdir in lang) # Now append qt to the list of language bindings
if test "$want_qt5" = "yes" -o "$want_qt6" = "yes"; then if test "$want_qt5" = "yes" -o "$want_qt6" = "yes"; then
enabled_languages=$(echo $enabled_languages qt) enabled_languages=$(echo $enabled_languages qt)
fi fi
@ -608,7 +590,8 @@ if test "$found_py" = "1"; then
if test "$found_py" = "1" -o "$found_py3" = "1"; then if test "$found_py" = "1" -o "$found_py3" = "1"; then
# Reset everything, so that we can look for another Python. # Reset everything, so that we can look for another Python.
m4_foreach([mym4pythonver], m4_foreach([mym4pythonver],
[[2.7],[3.6],[3.8],[3.9],[3.10],[3.11],[3.12],[all]], [[2.7],[3.4],[3.5],[3.6],[3.7],[3.8],[3.9],[3.10],
[3.11],[3.12],[all]],
[unset PYTHON [unset PYTHON
unset PYTHON_VERSION unset PYTHON_VERSION
unset PYTHON_CPPFLAGS unset PYTHON_CPPFLAGS
@ -624,7 +607,7 @@ if test "$found_py" = "1"; then
unset am_cv_python_pythondir unset am_cv_python_pythondir
unset am_cv_python_pyexecdir unset am_cv_python_pyexecdir
AM_PATH_PYTHON(mym4pythonver, [ AM_PATH_PYTHON(mym4pythonver, [
AX_PYTHON_DEVEL([], [true]) AX_PYTHON_DEVEL
if test "$PYTHON_VERSION"; then if test "$PYTHON_VERSION"; then
PYTHONS="$(echo $PYTHONS $PYTHON)" PYTHONS="$(echo $PYTHONS $PYTHON)"
PYTHON_VERSIONS="$(echo $PYTHON_VERSIONS $PYTHON_VERSION)" PYTHON_VERSIONS="$(echo $PYTHON_VERSIONS $PYTHON_VERSION)"
@ -1163,9 +1146,7 @@ AC_CONFIG_FILES([lang/python/Makefile
AC_CONFIG_FILES([lang/python/setup.py], [chmod a+x lang/python/setup.py]) AC_CONFIG_FILES([lang/python/setup.py], [chmod a+x lang/python/setup.py])
AC_OUTPUT AC_OUTPUT
if test "$want_qt5" = "yes" -a "$want_qt6" = "yes"; then if test "$want_qt5" = "yes"; then
enabled_languages_v=$(echo ${enabled_languages_v:-$enabled_languages} | sed "s/qt/qt (Qt 5, Qt 6)/")
elif test "$want_qt5" = "yes"; then
enabled_languages_v=$(echo ${enabled_languages_v:-$enabled_languages} | sed "s/qt/qt (Qt 5)/") enabled_languages_v=$(echo ${enabled_languages_v:-$enabled_languages} | sed "s/qt/qt (Qt 5)/")
elif test "$want_qt6" = "yes"; then elif test "$want_qt6" = "yes"; then
enabled_languages_v=$(echo ${enabled_languages_v:-$enabled_languages} | sed "s/qt/qt (Qt 6)/") enabled_languages_v=$(echo ${enabled_languages_v:-$enabled_languages} | sed "s/qt/qt (Qt 6)/")

View File

@ -589,16 +589,10 @@ mode (@code{_LARGEFILE64_SOURCE}).
@cindex automake @cindex automake
@cindex autoconf @cindex autoconf
You can simply use @code{PKG_CHECK_MODULES} macro with @command{pkg-config}: It is much easier if you use GNU Automake instead of writing your own
@example Makefiles. If you do that you do not have to worry about finding and
PKG_CHECK_MODULES([GPGME], [gpgme >= 1.23.1]) invoking the @command{pkg-config} script at all. @acronym{GPGME}
@end example provides an extension to Automake that does all the work for you.
Alternatively, instead of using @command{pkg-config}, for building on
an environment with no pkg-config, @acronym{GPGME} provides an
extension to Automake that does all the work for you. Please note
that it is required to have gpgrt-config from libgpg-error installed
in this case.
@c A simple macro for optional variables. @c A simple macro for optional variables.
@macro ovar{varname} @macro ovar{varname}
@ -2607,7 +2601,7 @@ addresses is not supported.
The function @code{gpgme_set_sender} specifies the sender address for The function @code{gpgme_set_sender} specifies the sender address for
use in sign and verify operations. @var{address} is expected to be use in sign and verify operations. @var{address} is expected to be
the ``addr-spec'' part of an address but may also be a complete mailbox the ``addr-spec'' part of an address but my also be a complete mailbox
address, in which case this function extracts the ``addr-spec'' from address, in which case this function extracts the ``addr-spec'' from
it. Using @code{NULL} for @var{address} clears the sender address. it. Using @code{NULL} for @var{address} clears the sender address.
@ -3279,12 +3273,6 @@ The string given in @var{value} is passed to the GnuPG engine to use as
filter when importing keys. Valid values are documented in the GnuPG filter when importing keys. Valid values are documented in the GnuPG
manual and the gpg man page under the option @option{--import-filter}. manual and the gpg man page under the option @option{--import-filter}.
@item "import-options"
@since{1.24.0}
The string given in @var{value} is passed to the GnuPG engine to use as
options when importing keys. Valid values are documented in the GnuPG
manual and the gpg man page under the option @option{--import-options}.
@item "no-auto-check-trustdb" @item "no-auto-check-trustdb"
@since{1.19.0} @since{1.19.0}
Setting the @var{value} to "1" forces the GPG backend to disable the Setting the @var{value} to "1" forces the GPG backend to disable the
@ -3572,10 +3560,6 @@ be missing but this field may be set nevertheless.
Reserved for the time of the last update of this key. Reserved for the time of the last update of this key.
@item gpgme_revocation_key_t revkeys
@since{1.24.0}
This is a linked list with the revocation keys for the key.
@end table @end table
@end deftp @end deftp
@ -3918,37 +3902,6 @@ This is a linked list with the notation data and policy URLs.
@end deftp @end deftp
@deftp {Data type} gpgme_revocation_key_t
@since{1.24.0}
The @code{gpgme_revocation_key_t} type is a pointer to a revocation key
structure. Revocation key structures are one component of a
@code{gpgme_key_t} object. They provide information about the designated
revocation keys for a key.
The revocation key structure has the following members:
@table @code
@item gpgme_revocation_key_t next
This is a pointer to the next revocation key structure in the linked list,
or @code{NULL} if this is the last element.
@item gpgme_pubkey_algo_t pubkey_algo
This is the public key algorithm of the revocation key.
@item char *fpr
This is the fingerprint of the revocation_key in hexadecimal digits.
@item unsigned int key_class
This is the class of the revocation key signature subpacket.
@item unsigned int sensitive : 1
This is true if the revocation key is marked as sensitive.
@end table
@end deftp
@node Listing Keys @node Listing Keys
@subsection Listing Keys @subsection Listing Keys
@ -4396,14 +4349,6 @@ override this check.
Request generation of keys that do not expire. Request generation of keys that do not expire.
@item GPGME_CREATE_ADSK
@since{1.24.0}
Add an ADSK to the key. With this flag @var{algo} is expected to be
the hexified fingerprint of the ADSK to be added; this must be a
subkey. If the string "default" is used for @var{algo} the engine
will add all ADSK as it would do for new keys.
@end table @end table
After the operation completed successfully, information about the After the operation completed successfully, information about the
@ -4479,10 +4424,6 @@ values for timestamps and thus can only encode dates up to the year
@var{flags} takes the same values as described above for @var{flags} takes the same values as described above for
@code{gpgme_op_createkey}. @code{gpgme_op_createkey}.
If the @code{GPGME_CREATE_ADSK} flag is set, the subkey fingerprint
given in the @code{algo} parameter is added as an ADSK
to the key.
After the operation completed successfully, information about the After the operation completed successfully, information about the
created key can be retrieved with @code{gpgme_op_genkey_result}. created key can be retrieved with @code{gpgme_op_genkey_result}.
@ -5436,19 +5377,16 @@ operation was started successfully, and @code{GPG_ERR_INV_VALUE} if
@var{ctx} or @var{key} is not a valid pointer. @var{ctx} or @var{key} is not a valid pointer.
@end deftypefun @end deftypefun
The following functions allow only to use one particular flag. Their The following functions allow only to use one particular flag.
use is thus deprecated.
@deftypefun gpgme_error_t gpgme_op_delete (@w{gpgme_ctx_t @var{ctx}}, @w{const gpgme_key_t @var{key}}, @w{int @var{allow_secret}}) @deftypefun gpgme_error_t gpgme_op_delete (@w{gpgme_ctx_t @var{ctx}}, @w{const gpgme_key_t @var{key}}, @w{int @var{allow_secret}})
Similar to @code{gpgme_op_delete_ext}, but only the flag Similar to @code{gpgme_op_delete_ext}, but only the flag
@code{GPGME_DELETE_ALLOW_SECRET} can be provided. Actually all true @code{GPGME_DELETE_ALLOW_SECRET} can be provided.
values are mapped to this flag.
@end deftypefun @end deftypefun
@deftypefun gpgme_error_t gpgme_op_delete_start (@w{gpgme_ctx_t @var{ctx}}, @w{const gpgme_key_t @var{key}}, @w{int @var{allow_secret}}) @deftypefun gpgme_error_t gpgme_op_delete_start (@w{gpgme_ctx_t @var{ctx}}, @w{const gpgme_key_t @var{key}}, @w{int @var{allow_secret}})
Similar to @code{gpgme_op_delete_ext_start}, but only the flag Similar to @code{gpgme_op_delete_ext_start}, but only the flag
@code{GPGME_DELETE_ALLOW_SECRET} can be provided. Actually all true @code{GPGME_DELETE_ALLOW_SECRET} can be provided.
values are mapped to this flag.
@end deftypefun @end deftypefun

View File

@ -88,14 +88,6 @@ else
libsuffix=.so libsuffix=.so
endif endif
copied_headers = $(gpgmepp_headers:%=gpgme++/%) $(interface_headers:%=gpgme++/%)
$(copied_headers): Makefile.am
mkdir -p $(builddir)/gpgme++/interfaces
echo -n "#include \"$(abs_srcdir)" > "$@"
echo -n "$@" | sed "s/gpgme++//" >> "$@"
echo "\"" >> "$@"
if HAVE_W32_SYSTEM if HAVE_W32_SYSTEM
GpgmeppConfig.cmake: GpgmeppConfig-w32.cmake.in GpgmeppConfig.cmake: GpgmeppConfig-w32.cmake.in
sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \ sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \
@ -123,8 +115,5 @@ install-data-local: install-cmake-files
uninstall-local: uninstall-cmake-files uninstall-local: uninstall-cmake-files
BUILT_SOURCES = $(copied_headers)
CLEANFILES = GpgmeppConfig.cmake GpgmeppConfigVersion.cmake \ CLEANFILES = GpgmeppConfig.cmake GpgmeppConfigVersion.cmake \
gpgmepp_version.h GpgmeppConfig.cmake.in \ gpgmepp_version.h GpgmeppConfig.cmake.in
$(copied_headers)

View File

@ -257,6 +257,158 @@ Type Option::alternateType() const
return isNull() ? NoType : static_cast<Type>(opt->alt_type) ; return isNull() ? NoType : static_cast<Type>(opt->alt_type) ;
} }
#if 0
static Option::Variant argument_to_variant(gpgme_conf_type_t type, bool list, gpgme_conf_arg_t arg)
{
assert(arg);
switch (type) {
case GPGME_CONF_NONE:
if (list) {
// return the count (number of times set):
return arg->value.count;
} else {
return none;
}
case GPGME_CONF_INT32:
if (list) {
std::vector<int> result;
for (gpgme_conf_arg_t a = arg ; a ; a = a->next) {
result.push_back(a->value.int32);
}
return result;
} else {
return arg->value.int32;
}
case GPGME_CONF_UINT32:
if (list) {
std::vector<unsigned int> result;
for (gpgme_conf_arg_t a = arg ; a ; a = a->next) {
result.push_back(a->value.uint32);
}
return result;
} else {
return arg->value.uint32;
}
case GPGME_CONF_FILENAME:
case GPGME_CONF_LDAP_SERVER:
case GPGME_CONF_KEY_FPR:
case GPGME_CONF_PUB_KEY:
case GPGME_CONF_SEC_KEY:
case GPGME_CONF_ALIAS_LIST:
// these should not happen in alt_type, but fall through
case GPGME_CONF_STRING:
if (list) {
std::vector<const char *> result;
for (gpgme_conf_arg_t a = arg ; a ; a = a->next) {
result.push_back(a->value.string);
}
return result;
} else {
return arg->value.string;
}
}
assert(!"Option: unknown alt_type!");
return Option::Variant();
}
namespace
{
inline const void *to_void_star(const char *s)
{
return s;
}
inline const void *to_void_star(const std::string &s)
{
return s.c_str();
}
inline const void *to_void_star(const int &i)
{
return &i; // const-&: sic!
}
inline const void *to_void_star(const unsigned int &i)
{
return &i; // const-&: sic!
}
struct VariantToArgumentVisitor : boost::static_visitor<gpgme_conf_arg_t> {
static gpgme_conf_arg_t make_argument(gpgme_conf_type_t type, const void *value)
{
gpgme_conf_arg_t arg = 0;
#ifdef HAVE_GPGME_CONF_ARG_NEW_WITH_CONST_VALUE
if (const gpgme_error_t err = gpgme_conf_arg_new(&arg, type, value)) {
return 0;
}
#else
if (const gpgme_error_t err = gpgme_conf_arg_new(&arg, type, const_cast<void *>(value))) {
return 0;
}
#endif
else {
return arg;
}
}
gpgme_conf_arg_t operator()(bool v) const
{
return v ? make_argument(0) : 0 ;
}
gpgme_conf_arg_t operator()(const char *s) const
{
return make_argument(s ? s : "");
}
gpgme_conf_arg_t operator()(const std::string &s) const
{
return operator()(s.c_str());
}
gpgme_conf_arg_t operator()(int i) const
{
return make_argument(&i);
}
gpgme_conf_arg_t operator()(unsigned int i) const
{
return make_argument(&i);
}
template <typename T>
gpgme_conf_arg_t operator()(const std::vector<T> &value) const
{
gpgme_conf_arg_t result = 0;
gpgme_conf_arg_t last = 0;
for (typename std::vector<T>::const_iterator it = value.begin(), end = value.end() ; it != end ; ++it) {
if (gpgme_conf_arg_t arg = make_argument(to_void_star(*it))) {
if (last) {
last = last->next = arg;
} else {
result = last = arg;
}
}
}
return result;
}
};
}
static gpgme_conf_arg_t variant_to_argument(const Option::Variant &value)
{
VariantToArgumentVisitor v;
return apply_visitor(v, value);
}
optional<Option::Variant> Option::defaultValue() const
{
if (isNull()) {
return optional<Variant>();
} else {
return argument_to_variant(opt->alt_type, opt->flags & GPGME_CONF_LIST, opt->default_value);
}
}
#endif
Argument Option::defaultValue() const Argument Option::defaultValue() const
{ {
if (isNull()) { if (isNull()) {

View File

@ -130,13 +130,6 @@ const char *Error::asString() const
return mMessage.c_str(); return mMessage.c_str();
} }
std::string Error::asStdString() const
{
std::string message;
format_error(static_cast<gpgme_error_t>(mErr), message);
return message;
}
int Error::code() const int Error::code() const
{ {
return gpgme_err_code(mErr); return gpgme_err_code(mErr);
@ -154,7 +147,11 @@ bool Error::isCanceled() const
int Error::toErrno() const int Error::toErrno() const
{ {
//#ifdef HAVE_GPGME_GPG_ERROR_WRAPPERS
return gpgme_err_code_to_errno(static_cast<gpgme_err_code_t>(code())); return gpgme_err_code_to_errno(static_cast<gpgme_err_code_t>(code()));
//#else
// return gpg_err_code_to_errno( static_cast<gpg_err_code_t>( code() ) );
//#endif
} }
// static // static
@ -195,7 +192,7 @@ Error Error::fromCode(unsigned int err, unsigned int src)
std::ostream &operator<<(std::ostream &os, const Error &err) std::ostream &operator<<(std::ostream &os, const Error &err)
{ {
return os << "GpgME::Error(" << err.encodedError() << " (" << err.asStdString() << "))"; return os << "GpgME::Error(" << err.encodedError() << " (" << err.asString() << "))";
} }
Context::KeyListModeSaver::KeyListModeSaver(Context *ctx) Context::KeyListModeSaver::KeyListModeSaver(Context *ctx)
@ -1304,9 +1301,6 @@ static gpgme_sig_mode_t sigflags2sigflags(SignatureMode flags)
if (flags & SignatureMode::SignArchive) { if (flags & SignatureMode::SignArchive) {
result |= GPGME_SIG_MODE_ARCHIVE; result |= GPGME_SIG_MODE_ARCHIVE;
} }
if (flags & SignatureMode::SignFile) {
result |= GPGME_SIG_MODE_FILE;
}
return static_cast<gpgme_sig_mode_t>(result); return static_cast<gpgme_sig_mode_t>(result);
} }
@ -1369,9 +1363,6 @@ static gpgme_encrypt_flags_t encryptflags2encryptflags(Context::EncryptionFlags
if (flags & Context::EncryptArchive) { if (flags & Context::EncryptArchive) {
result |= GPGME_ENCRYPT_ARCHIVE; result |= GPGME_ENCRYPT_ARCHIVE;
} }
if (flags & Context::EncryptFile) {
result |= GPGME_ENCRYPT_FILE;
}
return static_cast<gpgme_encrypt_flags_t>(result); return static_cast<gpgme_encrypt_flags_t>(result);
} }
@ -1802,16 +1793,6 @@ Error Context::startRevokeSignature(const Key &key, const Key &signingKey,
key.impl(), signingKey.impl(), uids.c_str(), flags)); key.impl(), signingKey.impl(), uids.c_str(), flags));
} }
Error Context::addAdsk(const Key &k, const char *adsk)
{
return Error(d->lasterr = gpgme_op_createsubkey(d->ctx, k.impl(), adsk, 0, 0, GPGME_CREATE_ADSK));
}
Error Context::startAddAdsk(const Key &k, const char *adsk)
{
return Error(d->lasterr = gpgme_op_createsubkey_start(d->ctx, k.impl(), adsk, 0, 0, GPGME_CREATE_ADSK));
}
Error Context::setFlag(const char *name, const char *value) Error Context::setFlag(const char *name, const char *value)
{ {
return Error(d->lasterr = gpgme_set_ctx_flag(d->ctx, name, value)); return Error(d->lasterr = gpgme_set_ctx_flag(d->ctx, name, value));
@ -1946,7 +1927,6 @@ std::ostream &operator<<(std::ostream &os, SignatureMode mode)
} }
#define CHECK( x ) if ( !(mode & (x)) ) {} else do { os << #x " "; } while (0) #define CHECK( x ) if ( !(mode & (x)) ) {} else do { os << #x " "; } while (0)
CHECK(SignArchive); CHECK(SignArchive);
CHECK(SignFile);
#undef CHECK #undef CHECK
return os << ')'; return os << ')';
} }
@ -1965,7 +1945,6 @@ std::ostream &operator<<(std::ostream &os, Context::EncryptionFlags flags)
CHECK(EncryptWrap); CHECK(EncryptWrap);
CHECK(WantAddress); CHECK(WantAddress);
CHECK(EncryptArchive); CHECK(EncryptArchive);
CHECK(EncryptFile);
#undef CHECK #undef CHECK
return os << ')'; return os << ')';
} }

View File

@ -324,9 +324,6 @@ public:
Error startRevokeSignature(const Key &key, const Key &signingKey, Error startRevokeSignature(const Key &key, const Key &signingKey,
const std::vector<UserID> &userIds = std::vector<UserID>()); const std::vector<UserID> &userIds = std::vector<UserID>());
Error addAdsk(const Key &k, const char *adsk);
Error startAddAdsk(const Key &k, const char *adsk);
// using TofuInfo::Policy // using TofuInfo::Policy
Error setTofuPolicy(const Key &k, unsigned int policy); Error setTofuPolicy(const Key &k, unsigned int policy);
Error setTofuPolicyStart(const Key &k, unsigned int policy); Error setTofuPolicyStart(const Key &k, unsigned int policy);
@ -453,8 +450,7 @@ public:
ThrowKeyIds = 64, ThrowKeyIds = 64,
EncryptWrap = 128, EncryptWrap = 128,
WantAddress = 256, WantAddress = 256,
EncryptArchive = 512, EncryptArchive = 512
EncryptFile = 1024
}; };
EncryptionResult encrypt(const std::vector<Key> &recipients, const Data &plainText, Data &cipherText, EncryptionFlags flags); EncryptionResult encrypt(const std::vector<Key> &recipients, const Data &plainText, Data &cipherText, EncryptionFlags flags);
GpgME::Error encryptSymmetrically(const Data &plainText, Data &cipherText); GpgME::Error encryptSymmetrically(const Data &plainText, Data &cipherText);

View File

@ -0,0 +1,41 @@
/*
context_glib.cpp - wraps a gpgme key context, gpgme-glib-specific functions
Copyright (C) 2007 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
GPGME++ is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
GPGME++ 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 Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with GPGME++; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <global.h>
extern "C" GIOChannel *gpgme_get_fdptr(int);
GIOChannel *GpgME::getGIOChannel(int fd)
{
return gpgme_get_fdptr(fd);
}
QIODevice *GpgME::getQIODevice(int fd)
{
return 0;
}

View File

@ -0,0 +1,41 @@
/*
context_qt.cpp - wraps a gpgme key context, gpgme-qt-specific functions
Copyright (C) 2007 Klarälvdalens Datakonsult AB
2016 Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
This file is part of GPGME++.
GPGME++ is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
GPGME++ 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 Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with GPGME++; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <global.h>
extern "C" QIODevice *gpgme_get_fdptr(int);
GIOChannel *GpgME::getGIOChannel(int)
{
return 0;
}
QIODevice *GpgME::getQIODevice(int fd)
{
return gpgme_get_fdptr(fd);
}

View File

@ -25,7 +25,7 @@
#ifndef __GPGMEPP_DEFAULTASSUANTRANSACTION_H__ #ifndef __GPGMEPP_DEFAULTASSUANTRANSACTION_H__
#define __GPGMEPP_DEFAULTASSUANTRANSACTION_H__ #define __GPGMEPP_DEFAULTASSUANTRANSACTION_H__
#include "interfaces/assuantransaction.h" #include <interfaces/assuantransaction.h>
#include <string> #include <string>
#include <vector> #include <vector>

View File

@ -52,7 +52,6 @@ using namespace GpgME;
static const char *status_to_string(unsigned int status); static const char *status_to_string(unsigned int status);
static Error status_to_error(unsigned int status); static Error status_to_error(unsigned int status);
static Error parse_sc_op_failure(const char *args);
class EditInteractor::Private class EditInteractor::Private
{ {
@ -103,9 +102,6 @@ public:
} else if (status == GPGME_STATUS_ERROR) { } else if (status == GPGME_STATUS_ERROR) {
err = ei->q->parseStatusError(args); err = ei->q->parseStatusError(args);
ei->state = EditInteractor::ErrorState; ei->state = EditInteractor::ErrorState;
} else if (status == GPGME_STATUS_SC_OP_FAILURE) {
err = parse_sc_op_failure(args);
ei->state = EditInteractor::ErrorState;
} else { } else {
ei->state = ei->q->nextState(status, args, err); ei->state = ei->q->nextState(status, args, err);
} }
@ -138,7 +134,7 @@ public:
if (writeAll(fd, result, len) != len) { if (writeAll(fd, result, len) != len) {
err = Error::fromSystemError(); err = Error::fromSystemError();
if (ei->debug) { if (ei->debug) {
std::fprintf(ei->debug, "EditInteractor: Could not write to fd %d (%s)\n", fd, err.asStdString().c_str()); std::fprintf(ei->debug, "EditInteractor: Could not write to fd %d (%s)\n", fd, err.asString());
} }
goto error; goto error;
} }
@ -147,7 +143,7 @@ public:
if (writeAll(fd, "\n", 1) != 1) { if (writeAll(fd, "\n", 1) != 1) {
err = Error::fromSystemError(); err = Error::fromSystemError();
if (ei->debug) { if (ei->debug) {
std::fprintf(ei->debug, "EditInteractor: Could not write to fd %d (%s)\n", fd, err.asStdString().c_str()); std::fprintf(ei->debug, "EditInteractor: Could not write to fd %d (%s)\n", fd, err.asString());
} }
goto error; goto error;
} }
@ -284,38 +280,6 @@ GpgME::Error EditInteractor::parseStatusError(const char *args)
return err; return err;
} }
static Error sc_op_failure_to_error(unsigned int status)
{
switch (status) {
case 1:
// GPG_ERR_CANCELED or GPG_ERR_FULLY_CANCELED
return Error::fromCode(GPG_ERR_CANCELED);
case 2:
// GPG_ERR_BAD_PIN or GPG_ERR_BAD_RESET_CODE [sic]
return Error::fromCode(GPG_ERR_BAD_PIN);
case 3:
return Error::fromCode(GPG_ERR_PIN_BLOCKED);
case 4:
return Error::fromCode(GPG_ERR_NO_RESET_CODE);
}
return Error::fromCode(GPG_ERR_CARD);
}
// static
Error parse_sc_op_failure(const char *args)
{
Error err;
const auto fields = split(args, ' ');
if (fields.size() >= 1) {
err = sc_op_failure_to_error(static_cast<unsigned int>(std::stoul(fields[0])));
} else {
err = Error::fromCode(GPG_ERR_CARD);
}
return err;
}
static const char *const status_strings[] = { static const char *const status_strings[] = {
"EOF", "EOF",
/* mkstatus processing starts here */ /* mkstatus processing starts here */

View File

@ -47,11 +47,7 @@ public:
explicit Error(unsigned int e) : mErr(e), mMessage() {} explicit Error(unsigned int e) : mErr(e), mMessage() {}
const char *source() const; const char *source() const;
/* This function is deprecated. Use asStdString() instead. asString() may const char *asString() const;
* return wrongly encoded (i.e. not UTF-8) results on Windows for the main
* thread if the function was first called from a secondary thread. */
GPGMEPP_DEPRECATED const char *asString() const;
std::string asStdString() const;
int code() const; int code() const;
int sourceID() const; int sourceID() const;

View File

@ -79,7 +79,6 @@ enum SignatureMode {
Detached = 1, Detached = 1,
Clearsigned = 2, Clearsigned = 2,
SignArchive = 4, SignArchive = 4,
SignFile = 8,
}; };
enum class RevocationReason { enum class RevocationReason {

View File

@ -25,7 +25,7 @@
#ifndef __GPGMEPP_GPGADDUSERIDEDITINTERACTOR_H__ #ifndef __GPGMEPP_GPGADDUSERIDEDITINTERACTOR_H__
#define __GPGMEPP_GPGADDUSERIDEDITINTERACTOR_H__ #define __GPGMEPP_GPGADDUSERIDEDITINTERACTOR_H__
#include "editinteractor.h" #include <editinteractor.h>
#include <string> #include <string>

View File

@ -25,7 +25,7 @@
#ifndef __GPGMEPP_GPGAGENTGETINFOASSUANTRANSACTION_H__ #ifndef __GPGMEPP_GPGAGENTGETINFOASSUANTRANSACTION_H__
#define __GPGMEPP_GPGAGENTGETINFOASSUANTRANSACTION_H__ #define __GPGMEPP_GPGAGENTGETINFOASSUANTRANSACTION_H__
#include "interfaces/assuantransaction.h" #include <interfaces/assuantransaction.h>
#include <string> #include <string>
#include <vector> #include <vector>

View File

@ -24,7 +24,7 @@
#ifndef __GPGMEPP_GPGGENCARDKEYEDITINTERACTOR_H__ #ifndef __GPGMEPP_GPGGENCARDKEYEDITINTERACTOR_H__
#define __GPGMEPP_GPGGENCARDKEYEDITINTERACTOR_H__ #define __GPGMEPP_GPGGENCARDKEYEDITINTERACTOR_H__
#include "editinteractor.h" #include <editinteractor.h>
#include <string> #include <string>
#include <memory> #include <memory>

View File

@ -75,7 +75,4 @@ typedef struct _gpgme_tofu_info *gpgme_tofu_info_t;
struct _gpgme_op_query_swdb_result; struct _gpgme_op_query_swdb_result;
typedef struct _gpgme_op_query_swdb_result *gpgme_query_swdb_result_t; typedef struct _gpgme_op_query_swdb_result *gpgme_query_swdb_result_t;
struct _gpgme_revocation_key;
typedef struct _gpgme_revocation_key *gpgme_revocation_key_t;
#endif // __GPGMEPP_GPGMEFW_H__ #endif // __GPGMEPP_GPGMEFW_H__

View File

@ -25,7 +25,7 @@
#ifndef __GPGMEPP_GPGSETEXPIRYTIMEEDITINTERACTOR_H__ #ifndef __GPGMEPP_GPGSETEXPIRYTIMEEDITINTERACTOR_H__
#define __GPGMEPP_GPGSETEXPIRYTIMEEDITINTERACTOR_H__ #define __GPGMEPP_GPGSETEXPIRYTIMEEDITINTERACTOR_H__
#include "editinteractor.h" #include <editinteractor.h>
#include <string> #include <string>

View File

@ -25,8 +25,8 @@
#ifndef __GPGMEPP_GPGSETOWNERTRUSTEDITINTERACTOR_H__ #ifndef __GPGMEPP_GPGSETOWNERTRUSTEDITINTERACTOR_H__
#define __GPGMEPP_GPGSETOWNERTRUSTEDITINTERACTOR_H__ #define __GPGMEPP_GPGSETOWNERTRUSTEDITINTERACTOR_H__
#include "editinteractor.h" #include <editinteractor.h>
#include "key.h" #include <key.h>
#include <string> #include <string>

View File

@ -25,7 +25,7 @@
#ifndef __GPGMEPP_GPGSIGNKEYEDITINTERACTOR_H__ #ifndef __GPGMEPP_GPGSIGNKEYEDITINTERACTOR_H__
#define __GPGMEPP_GPGSIGNKEYEDITINTERACTOR_H__ #define __GPGMEPP_GPGSIGNKEYEDITINTERACTOR_H__
#include "editinteractor.h" #include <editinteractor.h>
#include <string> #include <string>
#include <vector> #include <vector>

View File

@ -26,7 +26,7 @@
#ifndef __GPGMEPP_INTERFACES_ASSUANTRANSACTION_H__ #ifndef __GPGMEPP_INTERFACES_ASSUANTRANSACTION_H__
#define __GPGMEPP_INTERFACES_ASSUANTRANSACTION_H__ #define __GPGMEPP_INTERFACES_ASSUANTRANSACTION_H__
#include "../gpgmepp_export.h" #include "gpgmepp_export.h"
#include <stddef.h> #include <stddef.h>

View File

@ -27,7 +27,7 @@
#include <sys/types.h> #include <sys/types.h>
#include "../gpgmepp_export.h" #include "gpgmepp_export.h"
#include <gpg-error.h> #include <gpg-error.h>

View File

@ -24,7 +24,7 @@
#ifndef __GPGMEPP_INTERFACES_STATUSCONSUMER_H__ #ifndef __GPGMEPP_INTERFACES_STATUSCONSUMER_H__
#define __GPGMEPP_INTERFACES_STATUSCONSUMER_H__ #define __GPGMEPP_INTERFACES_STATUSCONSUMER_H__
#include "../gpgmepp_export.h" #include "gpgmepp_export.h"
namespace GpgME namespace GpgME
{ {

View File

@ -122,37 +122,6 @@ std::vector<Subkey> Key::subkeys() const
return v; return v;
} }
RevocationKey Key::revocationKey(unsigned int index) const
{
return RevocationKey(key, index);
}
unsigned int Key::numRevocationKeys() const
{
if (!key) {
return 0;
}
unsigned int count = 0;
for (auto revkey = key->revocation_keys; revkey; revkey = revkey->next) {
++count;
}
return count;
}
std::vector<RevocationKey> Key::revocationKeys() const
{
if (!key) {
return std::vector<RevocationKey>();
}
std::vector<RevocationKey> v;
v.reserve(numRevocationKeys());
for (auto revkey = key->revocation_keys; revkey; revkey = revkey->next) {
v.push_back(RevocationKey(key, revkey));
}
return v;
}
Key::OwnerTrust Key::ownerTrust() const Key::OwnerTrust Key::ownerTrust() const
{ {
if (!key) { if (!key) {
@ -1287,68 +1256,6 @@ bool UserID::Signature::isBad() const
return isNull() || isExpired() || isInvalid(); return isNull() || isExpired() || isInvalid();
} }
//
//
// class RevocationKey
//
//
static gpgme_revocation_key_t find_revkey(const shared_gpgme_key_t &key, unsigned int idx)
{
if (key) {
for (gpgme_revocation_key_t s = key->revocation_keys; s; s = s->next, --idx) {
if (idx == 0) {
return s;
}
}
}
return nullptr;
}
static gpgme_revocation_key_t verify_revkey(const shared_gpgme_key_t &key, gpgme_revocation_key_t revkey)
{
if (key) {
for (gpgme_revocation_key_t s = key->revocation_keys; s; s = s->next) {
if (s == revkey) {
return revkey;
}
}
}
return nullptr;
}
RevocationKey::RevocationKey() : key(), revkey(nullptr) {}
RevocationKey::RevocationKey(const shared_gpgme_key_t &k, unsigned int idx)
: key(k), revkey(find_revkey(k, idx))
{
}
RevocationKey::RevocationKey(const shared_gpgme_key_t &k, gpgme_revocation_key_t sk)
: key(k), revkey(verify_revkey(k, sk))
{
}
Key RevocationKey::parent() const
{
return Key(key);
}
const char *RevocationKey::fingerprint() const
{
return revkey ? revkey->fpr : nullptr;
}
bool RevocationKey::isSensitive() const
{
return revkey ? revkey->sensitive : false;
}
int RevocationKey::algorithm() const
{
return revkey ? revkey->pubkey_algo : 0;
}
std::ostream &operator<<(std::ostream &os, const UserID &uid) std::ostream &operator<<(std::ostream &os, const UserID &uid)
{ {
os << "GpgME::UserID("; os << "GpgME::UserID(";
@ -1418,20 +1325,6 @@ std::ostream &operator<<(std::ostream &os, const Key &key)
const std::vector<Subkey> subkeys = key.subkeys(); const std::vector<Subkey> subkeys = key.subkeys();
std::copy(subkeys.begin(), subkeys.end(), std::copy(subkeys.begin(), subkeys.end(),
std::ostream_iterator<Subkey>(os, "\n")); std::ostream_iterator<Subkey>(os, "\n"));
os << " revocationKeys:\n";
const std::vector<RevocationKey> revkeys = key.revocationKeys();
std::copy(revkeys.begin(), revkeys.end(),
std::ostream_iterator<RevocationKey>(os, "\n"));
}
return os << ')';
}
std::ostream &operator<<(std::ostream &os, const RevocationKey &revkey)
{
os << "GpgME::RevocationKey(";
if (!revkey.isNull()) {
os << "\n fingerprint: " << protect(revkey.fingerprint())
<< "\n isSensitive: " << revkey.isSensitive();
} }
return os << ')'; return os << ')';
} }

View File

@ -44,7 +44,6 @@ class Context;
class Subkey; class Subkey;
class UserID; class UserID;
class TofuInfo; class TofuInfo;
class RevocationKey;
typedef std::shared_ptr< std::remove_pointer<gpgme_key_t>::type > shared_gpgme_key_t; typedef std::shared_ptr< std::remove_pointer<gpgme_key_t>::type > shared_gpgme_key_t;
@ -101,10 +100,6 @@ public:
std::vector<UserID> userIDs() const; std::vector<UserID> userIDs() const;
std::vector<Subkey> subkeys() const; std::vector<Subkey> subkeys() const;
RevocationKey revocationKey(unsigned int index) const;
unsigned int numRevocationKeys() const;
std::vector<RevocationKey> revocationKeys() const;
bool isRevoked() const; bool isRevoked() const;
bool isExpired() const; bool isExpired() const;
bool isDisabled() const; bool isDisabled() const;
@ -552,53 +547,9 @@ private:
gpgme_key_sig_t sig; gpgme_key_sig_t sig;
}; };
//
// class RevocationKey
//
class GPGMEPP_EXPORT RevocationKey
{
public:
RevocationKey();
RevocationKey(const shared_gpgme_key_t &key, gpgme_revocation_key_t revkey);
RevocationKey(const shared_gpgme_key_t &key, unsigned int idx);
// Rule of Zero
void swap(RevocationKey &other)
{
using std::swap;
swap(this->key, other.key);
swap(this->revkey, other.revkey);
}
bool isNull() const
{
return !key || !revkey;
}
Key parent() const;
const char *fingerprint() const;
bool isSensitive() const;
int algorithm() const;
private:
shared_gpgme_key_t key;
gpgme_revocation_key_t revkey;
};
inline void swap(RevocationKey& v1, RevocationKey& v2)
{
v1.swap(v2);
}
GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const UserID &uid); GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const UserID &uid);
GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const Subkey &subkey); GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const Subkey &subkey);
GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const Key &key); GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const Key &key);
GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const RevocationKey &revkey);
} // namespace GpgME } // namespace GpgME

View File

@ -25,7 +25,7 @@
#ifndef __GPGMEPP_SCDGETINFOASSUANTRANSACTION_H__ #ifndef __GPGMEPP_SCDGETINFOASSUANTRANSACTION_H__
#define __GPGMEPP_SCDGETINFOASSUANTRANSACTION_H__ #define __GPGMEPP_SCDGETINFOASSUANTRANSACTION_H__
#include "interfaces/assuantransaction.h" #include <interfaces/assuantransaction.h>
#include <string> #include <string>
#include <vector> #include <vector>

View File

@ -200,7 +200,6 @@ GpgME::SignatureMode GpgME::CreatedSignature::mode() const
case GPGME_SIG_MODE_DETACH: return Detached; case GPGME_SIG_MODE_DETACH: return Detached;
case GPGME_SIG_MODE_CLEAR: return Clearsigned; case GPGME_SIG_MODE_CLEAR: return Clearsigned;
case GPGME_SIG_MODE_ARCHIVE: return SignArchive; // cannot happen case GPGME_SIG_MODE_ARCHIVE: return SignArchive; // cannot happen
case GPGME_SIG_MODE_FILE: return SignFile; // cannot happen
} }
} }

View File

@ -24,7 +24,7 @@
#ifndef __GPGMEPP_STATUSCONSUMERASSUANTRANSACTION_H__ #ifndef __GPGMEPP_STATUSCONSUMERASSUANTRANSACTION_H__
#define __GPGMEPP_STATUSCONSUMERASSUANTRANSACTION_H__ #define __GPGMEPP_STATUSCONSUMERASSUANTRANSACTION_H__
#include "interfaces/assuantransaction.h" #include <interfaces/assuantransaction.h>
namespace GpgME namespace GpgME
{ {

View File

@ -27,7 +27,7 @@
#define __GPGMEPP_TRUSTITEM_H__ #define __GPGMEPP_TRUSTITEM_H__
#include "gpgmefw.h" #include "gpgmefw.h"
#include "key.h" #include <key.h>
#include "gpgmepp_export.h" #include "gpgmepp_export.h"
#include <algorithm> #include <algorithm>

View File

@ -150,7 +150,7 @@ main (int argc, char **argv)
const GpgME::Key key = ctx->key (*argv, err, only_secret); const GpgME::Key key = ctx->key (*argv, err, only_secret);
std::stringstream ss; std::stringstream ss;
ss << "Key " << key << " Err: " << err.asStdString() << "\n"; ss << "Key " << key << " Err: " << err.asString() << "\n";
std::cout << ss.str(); std::cout << ss.str();

View File

@ -153,17 +153,14 @@ main (int argc, char **argv)
} }
Error err = ctx->startKeyListing (*argv, only_secret); Error err = ctx->startKeyListing (*argv, only_secret);
if (err) { if (err) {
std::cout << "Error: " << err.asStdString() << "\n"; std::cout << "Error: " << err.asString() << "\n";
return -1; return -1;
} }
GpgME::Key key; GpgME::Key key;
std::stringstream ss; std::stringstream ss;
do { do {
key = ctx->nextKey(err); key = ctx->nextKey(err);
if (!err)
{
ss << key << "\n\n"; ss << key << "\n\n";
}
} while (!err && !key.isNull()); } while (!err && !key.isNull());
std::cout << ss.str(); std::cout << ss.str();

View File

@ -75,52 +75,49 @@ main (int argc, char **argv)
Error err; Error err;
auto ctx = std::unique_ptr<Context>{Context::createForEngine(AssuanEngine, &err)}; auto ctx = std::unique_ptr<Context>{Context::createForEngine(AssuanEngine, &err)};
if (!ctx) { if (!ctx) {
std::cerr << "Failed to get context (Error: " << err.asStdString() << ")\n"; std::cerr << "Failed to get context (Error: " << err.asString() << ")\n";
return -1; return -1;
} }
const std::string dirmngrSocket = GpgME::dirInfo("dirmngr-socket"); const std::string dirmngrSocket = GpgME::dirInfo("dirmngr-socket");
if ((err = ctx->setEngineFileName(dirmngrSocket.c_str()))) { if ((err = ctx->setEngineFileName(dirmngrSocket.c_str()))) {
std::cerr << "Failed to set engine file name (Error: " << err.asStdString() << ")\n"; std::cerr << "Failed to set engine file name (Error: " << err.asString() << ")\n";
return -1; return -1;
} }
if ((err = ctx->setEngineHomeDirectory(""))) { if ((err = ctx->setEngineHomeDirectory(""))) {
std::cerr << "Failed to set engine home directory (Error: " << err.asStdString() << ")\n"; std::cerr << "Failed to set engine home directory (Error: " << err.asString() << ")\n";
return -1; return -1;
} }
// try to connect to dirmngr // try to connect to dirmngr
err = ctx->assuanTransact("GETINFO version"); err = ctx->assuanTransact("GETINFO version");
if (err && err.code() != GPG_ERR_ASS_CONNECT_FAILED) { if (err && err.code() != GPG_ERR_ASS_CONNECT_FAILED) {
std::cerr << "Failed to start assuan transaction (Error: " << err.asStdString() << ")\n"; std::cerr << "Failed to start assuan transaction (Error: " << err.asString() << ")\n";
return -1; return -1;
} }
if (err.code() == GPG_ERR_ASS_CONNECT_FAILED) { if (err.code() == GPG_ERR_ASS_CONNECT_FAILED) {
std::cerr << "Starting dirmngr ...\n"; std::cerr << "Starting dirmngr ...\n";
auto spawnCtx = std::unique_ptr<Context>{Context::createForEngine(SpawnEngine, &err)}; auto spawnCtx = std::unique_ptr<Context>{Context::createForEngine(SpawnEngine, &err)};
if (!spawnCtx) { if (!spawnCtx) {
std::cerr << "Failed to get context for spawn engine (Error: " << err.asStdString() << ")\n"; std::cerr << "Failed to get context for spawn engine (Error: " << err.asString() << ")\n";
return -1; return -1;
} }
const auto gpgconfProgram = GpgME::dirInfo("gpgconf-name"); const auto dirmngrProgram = GpgME::dirInfo("dirmngr-name");
// replace backslashes with forward slashes in homedir to work around bug T6833 const auto homedir = GpgME::dirInfo("homedir");
std::string homedir{GpgME::dirInfo("homedir")};
std::replace(homedir.begin(), homedir.end(), '\\', '/');
const char *argv[] = { const char *argv[] = {
gpgconfProgram, dirmngrProgram,
"--homedir", "--homedir",
homedir.c_str(), homedir,
"--launch", "--daemon",
"dirmngr",
NULL NULL
}; };
auto ignoreIO = Data{Data::null}; auto ignoreIO = Data{Data::null};
err = spawnCtx->spawn(gpgconfProgram, argv, err = spawnCtx->spawnAsync(dirmngrProgram, argv,
ignoreIO, ignoreIO, ignoreIO, ignoreIO, ignoreIO, ignoreIO,
Context::SpawnDetached); Context::SpawnDetached);
if (err) { if (err) {
std::cerr << "Failed to start dirmngr (Error: " << err.asStdString() << ")\n"; std::cerr << "Failed to start dirmngr (Error: " << err.asString() << ")\n";
return -1; return -1;
} }
@ -137,7 +134,7 @@ main (int argc, char **argv)
const auto cmd = std::string{"WKD_GET "} + email; const auto cmd = std::string{"WKD_GET "} + email;
err = ctx->assuanTransact(cmd.c_str()); err = ctx->assuanTransact(cmd.c_str());
if (err && err.code() != GPG_ERR_NO_NAME && err.code() != GPG_ERR_NO_DATA) { if (err && err.code() != GPG_ERR_NO_NAME && err.code() != GPG_ERR_NO_DATA) {
std::cerr << "Error: WKD_GET returned " << err.asStdString() << "\n"; std::cerr << "Error: WKD_GET returned " << err.asString() << "\n";
return -1; return -1;
} }

View File

@ -80,7 +80,7 @@ CLEANFILES = copystamp \
# 'make distclean' clears the write bit, breaking rm -rf. Fix the # 'make distclean' clears the write bit, breaking rm -rf. Fix the
# permissions. # permissions.
clean-local: clean-local:
rm -rf -- build dist gpg.egg-info rm -rf -- build
for PYTHON in $(PYTHONS); do \ for PYTHON in $(PYTHONS); do \
find "$$(basename "$${PYTHON}")-gpg" -type d ! -perm -200 -exec chmod u+w {} ';' ; \ find "$$(basename "$${PYTHON}")-gpg" -type d ! -perm -200 -exec chmod u+w {} ';' ; \
rm -rf -- "$$(basename "$${PYTHON}")-gpg" ; \ rm -rf -- "$$(basename "$${PYTHON}")-gpg" ; \
@ -101,12 +101,8 @@ install-exec-local:
done done
uninstall-local: uninstall-local:
set -x; \ set -x; GV=$$(echo $(VERSION) | tr - _); for PYTHON in $(PYTHONS); do \
GV=$$(echo $(VERSION) | tr - _); \
normalizedGV=$$(echo $$GV | sed s/_beta/b/); \
for PYTHON in $(PYTHONS); do \
PLATLIB="$(prefix)/$$("$${PYTHON}" -c 'import sysconfig, os; print(os.path.relpath(sysconfig.get_path("platlib", scheme="posix_prefix"), sysconfig.get_config_var("prefix")))')" ; \ PLATLIB="$(prefix)/$$("$${PYTHON}" -c 'import sysconfig, os; print(os.path.relpath(sysconfig.get_path("platlib", scheme="posix_prefix"), sysconfig.get_config_var("prefix")))')" ; \
rm -rf -- "$(DESTDIR)$${PLATLIB}/gpg" \ rm -rf -- "$(DESTDIR)$${PLATLIB}/gpg" \
"$(DESTDIR)$${PLATLIB}"/gpg-$$GV-py*.egg-info \ "$(DESTDIR)$${PLATLIB}"/gpg-$$GV-py*.egg-info ; \
"$(DESTDIR)$${PLATLIB}"/gpg-$$normalizedGV-py*.egg ; \
done done

View File

@ -2945,7 +2945,7 @@ Save that into a file called =keycount.pyx= and then create a
=setup.py= file which contains this: =setup.py= file which contains this:
#+BEGIN_SRC python -i #+BEGIN_SRC python -i
from setuptools import setup from distutils.core import setup
from Cython.Build import cythonize from Cython.Build import cythonize
setup( setup(

View File

@ -1,4 +1,4 @@
from setuptools import setup from distutils.core import setup
from Cython.Build import cythonize from Cython.Build import cythonize
setup( setup(

View File

@ -18,10 +18,6 @@
# License along with this library; if not, write to the Free Software # License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
try:
from setuptools import setup, Extension
from setuptools.command.build import build
except ImportError:
from distutils.core import setup, Extension from distutils.core import setup, Extension
from distutils.command.build import build from distutils.command.build import build
@ -229,8 +225,9 @@ class BuildExtFirstHack(build):
build.run(self) build.run(self)
py3 = [] if sys.version_info.major < 3 else ['-py3']
swig_sources = [] swig_sources = []
swig_opts = ['-threads'] + extra_swig_opts swig_opts = ['-threads'] + py3 + extra_swig_opts
swige = Extension( swige = Extension(
'gpg._gpgme', 'gpg._gpgme',
sources=swig_sources, sources=swig_sources,
@ -285,12 +282,10 @@ GPGME and these bindings is available here:
'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Operating System :: POSIX', 'Operating System :: POSIX',
'Operating System :: Microsoft :: Windows', 'Operating System :: Microsoft :: Windows',
'Topic :: Communications :: Email', 'Topic :: Communications :: Email',

View File

@ -1,22 +1,22 @@
# Makefile.am - Makefile for QGpgME. # Makefile.am for GPGMEPP.
# Copyright (C) 2016 Bundesamt für Sicherheit in der Informationstechnik # Copyright (C) 2016 Bundesamt für Sicherheit in der Informationstechnik
# Software engineering by Intevation GmbH # Software engineering by Intevation GmbH
# #
# This file is part of QGpgME, the Qt API binding for GpgME. # This file is part of GPGMEPP.
# #
# QGpgME is free software; you can redistribute it and/or modify it # GPGME-CL is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# QGpgME is distributed in the hope that it will be useful, # GPGME-CL is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# General Public License for more details. # GNU Lesser General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Lesser General Public
# along with this program; if not, see <https://gnu.org/licenses/>. # License along with this program; if not, see <https://gnu.org/licenses/>.
# SPDX-License-Identifier: GPL-2.0-or-later # SPDX-License-Identifier: LGPL-2.1-or-later
if RUN_GPG_TESTS if RUN_GPG_TESTS
tests = tests tests = tests

View File

@ -32,7 +32,7 @@ To use QGpgME first you need to obtain a Protocol class
either for CMS (S/MIME) or OpenPGP. This Protocol class either for CMS (S/MIME) or OpenPGP. This Protocol class
can then be used to create a Job. can then be used to create a Job.
Each Job can be started asynchronously and emits a result Each Job can be started asynchronusly and emits a result
signal when done. The jobs are deleted automatically signal when done. The jobs are deleted automatically
with QObject::deleteLater so they can be started without with QObject::deleteLater so they can be started without
result handlers. result handlers.
@ -53,7 +53,7 @@ in the result signal.
Jobs also provide progress signal whenever GnuPG emits Jobs also provide progress signal whenever GnuPG emits
a progress status line. a progress status line.
Most jobs also provide a way synchronously execute them. Most jobs also provide a way synchronusly execute them.
Please not that synchronous use does not cause the autodeletion Please not that synchronous use does not cause the autodeletion
to take place so you have to manually delete them. to take place so you have to manually delete them.

View File

@ -1,22 +1,21 @@
# Makefile.am - Makefile for QGpgME docs. # Makefile.am - Makefile for GPGME Qt docs.
# Copyright (C) 2016 Bundesamt für Sicherheit in der Informationstechnik # Copyright (C) 2016 Bundesamt für Sicherheit in der Informationstechnik
# Software engineering by Intevation GmbH # Software engineering by Intevation GmbH
# #
# This file is part of QGpgME. # This file is part of GPGME.
# #
# QGpgME is free software; you can redistribute it and/or modify it # GPGME is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU Lesser General Public License as
# the Free Software Foundation; either version 2 of the License, or # published by the Free Software Foundation; either version 2.1 of the
# (at your option) any later version. # License, or (at your option) any later version.
# #
# QGpgME is distributed in the hope that it will be useful, # GPGME is distributed in the hope that it will be useful, but WITHOUT
# but WITHOUT ANY WARRANTY; without even the implied warranty of # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
# General Public License for more details. # Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU Lesser General Public
# along with this program; if not, see <https://gnu.org/licenses/>. # License along with this program; if not, see <https://www.gnu.org/licenses/>.
# SPDX-License-Identifier: GPL-2.0-or-later
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in

View File

@ -1,18 +1,18 @@
# Makefile.am for QGpgME. # Makefile.am for GPGMEPP.
# Copyright (C) 2016 Bundesamt für Sicherheit in der Informationstechnik # Copyright (C) 2016 Bundesamt für Sicherheit in der Informationstechnik
# Software engineering by Intevation GmbH # Software engineering by Intevation GmbH
# #
# This file is part of QGpgME, the Qt API binding for GpgME. # This file is part of GPGMEPP.
# #
# QGpgME is free software; you can redistribute it and/or modify it # GPGME-CL is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# QGpgME is distributed in the hope that it will be useful, # GPGME-CL is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# General Public License for more details. # GNU Lesser General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
@ -20,12 +20,11 @@
# 02111-1307, USA # 02111-1307, USA
if WANT_QT5 if WANT_QT5
libqgpgme_la = libqgpgme.la lib_LTLIBRARIES = libqgpgme.la
endif endif
if WANT_QT6 if WANT_QT6
libqgpgmeqt6_la = libqgpgmeqt6.la lib_LTLIBRARIES = libqgpgmeqt6.la
endif endif
lib_LTLIBRARIES = $(libqgpgme_la) $(libqgpgmeqt6_la)
EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \ EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \
qgpgme_debug.h qgpgme_version.h.in \ qgpgme_debug.h qgpgme_version.h.in \
@ -37,7 +36,6 @@ qgpgme_sources = \
dataprovider.cpp \ dataprovider.cpp \
debug.cpp \ debug.cpp \
decryptverifyarchivejob.cpp \ decryptverifyarchivejob.cpp \
decryptverifyjob.cpp \
encryptarchivejob.cpp \ encryptarchivejob.cpp \
filelistdataprovider.cpp \ filelistdataprovider.cpp \
job.cpp multideletejob.cpp qgpgmeadduseridjob.cpp \ job.cpp multideletejob.cpp qgpgmeadduseridjob.cpp \
@ -67,11 +65,8 @@ qgpgme_sources = \
signarchivejob.cpp \ signarchivejob.cpp \
signencryptjob.cpp \ signencryptjob.cpp \
signencryptarchivejob.cpp \ signencryptarchivejob.cpp \
signjob.cpp \
dn.cpp cryptoconfig.cpp wkdlookupresult.cpp \ dn.cpp cryptoconfig.cpp wkdlookupresult.cpp \
util.cpp \ util.cpp \
verifydetachedjob.cpp \
verifyopaquejob.cpp \
wkdrefreshjob.cpp wkdrefreshjob.cpp
# If you add one here make sure that you also add one in camelcase # If you add one here make sure that you also add one in camelcase
@ -184,7 +179,6 @@ private_qgpgme_headers = \
changeexpiryjob_p.h \ changeexpiryjob_p.h \
cleaner.h \ cleaner.h \
decryptverifyarchivejob_p.h \ decryptverifyarchivejob_p.h \
decryptverifyjob_p.h \
encryptarchivejob_p.h \ encryptarchivejob_p.h \
encryptjob_p.h \ encryptjob_p.h \
importjob_p.h \ importjob_p.h \
@ -232,11 +226,8 @@ private_qgpgme_headers = \
signarchivejob_p.h \ signarchivejob_p.h \
signencryptjob_p.h \ signencryptjob_p.h \
signencryptarchivejob_p.h \ signencryptarchivejob_p.h \
signjob_p.h \
threadedjobmixin.h \ threadedjobmixin.h \
util.h \ util.h \
verifydetachedjob_p.h \
verifyopaquejob_p.h \
wkdrefreshjob_p.h wkdrefreshjob_p.h
qgpgme_moc_sources = \ qgpgme_moc_sources = \
@ -320,84 +311,33 @@ qgpgme_moc_sources = \
gpgcardjob.moc \ gpgcardjob.moc \
qgpgmegpgcardjob.moc qgpgmegpgcardjob.moc
if WANT_QT5 qgpgmeincludedir = $(includedir)/qgpgme
includeprefix5 = qgpgme-qt5 qgpgmeinclude_HEADERS = $(qgpgme_headers)
qgpgme5includedir = $(includedir)/$(includeprefix5)/qgpgme camelcaseincludedir = $(includedir)/QGpgME
qgpgme5include_HEADERS = $(qgpgme_headers) camelcaseinclude_HEADERS = $(camelcase_headers)
nodist_qgpgme5include_HEADERS = qgpgme_version.h nodist_qgpgmeinclude_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 if WANT_QT5
libqgpgme_la_CPPFLAGS = -I./moc5 -I$(top_builddir)/lang/cpp/src -I$(top_builddir)/src \ AM_CPPFLAGS = -I$(top_srcdir)/lang/cpp/src -I$(top_builddir)/src \
@GPGME_QT5_CFLAGS@ @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \ @GPGME_QT5_CFLAGS@ @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \
-DBUILDING_QGPGME -Wsuggest-override \ -DBUILDING_QGPGME -Wsuggest-override \
-Wzero-as-null-pointer-constant -Wzero-as-null-pointer-constant
libqgpgme_la_SOURCES = $(qgpgme_sources) $(qgpgme_headers) $(private_qgpgme_headers) 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 \ libqgpgme_la_LIBADD = ../../cpp/src/libgpgmepp.la ../../../src/libgpgme.la \
@LIBASSUAN_LIBS@ @GPG_ERROR_LIBS@ @GPGME_QT5_LIBS@ @LIBASSUAN_LIBS@ @GPG_ERROR_LIBS@ @GPGME_QT5_LIBS@
libqgpgme_la_LDFLAGS = -no-undefined -version-info \ libqgpgme_la_LDFLAGS = -no-undefined -version-info \
@LIBQGPGME_LT_CURRENT@:@LIBQGPGME_LT_REVISION@:@LIBQGPGME_LT_AGE@ @LIBQGPGME_LT_CURRENT@:@LIBQGPGME_LT_REVISION@:@LIBQGPGME_LT_AGE@
endif endif
if WANT_QT6 if WANT_QT6
libqgpgmeqt6_la_CPPFLAGS = -I./moc6 -I$(top_builddir)/lang/cpp/src -I$(top_builddir)/src \ AM_CPPFLAGS = -I$(top_srcdir)/lang/cpp/src -I$(top_builddir)/src \
@GPGME_QT6_CFLAGS@ @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \ @GPGME_QT6_CFLAGS@ @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \
-DBUILDING_QGPGME -Wsuggest-override \ -DBUILDING_QGPGME -Wsuggest-override \
-Wzero-as-null-pointer-constant -Wzero-as-null-pointer-constant
libqgpgmeqt6_la_SOURCES = $(qgpgme_sources) $(qgpgme_headers) $(private_qgpgme_headers) 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 \ libqgpgmeqt6_la_LIBADD = ../../cpp/src/libgpgmepp.la ../../../src/libgpgme.la \
@LIBASSUAN_LIBS@ @GPG_ERROR_LIBS@ @GPGME_QT6_LIBS@ @LIBASSUAN_LIBS@ @GPG_ERROR_LIBS@ @GPGME_QT6_LIBS@
libqgpgmeqt6_la_LDFLAGS = -no-undefined -version-info \ libqgpgmeqt6_la_LDFLAGS = -no-undefined -version-info \
@ -415,12 +355,12 @@ if HAVE_W32_SYSTEM
QGpgmeConfig.cmake: QGpgmeConfig-w32.cmake.in QGpgmeConfig.cmake: QGpgmeConfig-w32.cmake.in
sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \ sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \
sed -e 's|[@]resolved_libdir@|$(libdir)|g' | \ sed -e 's|[@]resolved_libdir@|$(libdir)|g' | \
sed -e 's|[@]resolved_includedir@|$(includedir)/$(includeprefix5)|g' > $@ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
else else
QGpgmeConfig.cmake: QGpgmeConfig.cmake.in QGpgmeConfig.cmake: QGpgmeConfig.cmake.in
sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \ sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \ sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
sed -e 's|[@]resolved_includedir@|$(includedir)/$(includeprefix5)|g' > $@ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
endif endif
endif endif
if WANT_QT6 if WANT_QT6
@ -428,12 +368,12 @@ if HAVE_W32_SYSTEM
QGpgmeQt6Config.cmake: QGpgmeQt6Config-w32.cmake.in QGpgmeQt6Config.cmake: QGpgmeQt6Config-w32.cmake.in
sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \ sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \
sed -e 's|[@]resolved_libdir@|$(libdir)|g' | \ sed -e 's|[@]resolved_libdir@|$(libdir)|g' | \
sed -e 's|[@]resolved_includedir@|$(includedir)/$(includeprefix6)|g' > $@ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
else else
QGpgmeQt6Config.cmake: QGpgmeQt6Config.cmake.in QGpgmeQt6Config.cmake: QGpgmeQt6Config.cmake.in
sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \ sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \ sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
sed -e 's|[@]resolved_includedir@|$(includedir)/$(includeprefix6)|g' > $@ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
endif endif
endif endif
@ -443,65 +383,50 @@ $(camelcase_headers): Makefile.am
echo ".h\"" >> "$@" echo ".h\"" >> "$@"
if WANT_QT5 if WANT_QT5
install-cmake-files-qt5: QGpgmeConfig.cmake QGpgmeConfigVersion.cmake install-cmake-files: QGpgmeConfig.cmake QGpgmeConfigVersion.cmake
-$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/QGpgme -$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/QGpgme
$(INSTALL) -m 644 QGpgmeConfig.cmake \ $(INSTALL) -m 644 QGpgmeConfig.cmake \
$(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake
$(INSTALL) -m 644 QGpgmeConfigVersion.cmake \ $(INSTALL) -m 644 QGpgmeConfigVersion.cmake \
$(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake
install_cmake_files_qt5 = install-cmake-files-qt5
uninstall-cmake-files-qt5: uninstall-cmake-files:
-rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake -rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake
-rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake -rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake
-rmdir $(DESTDIR)$(libdir)/cmake/QGpgme/ -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 endif
if WANT_QT6 if WANT_QT6
install-cmake-files-qt6: QGpgmeQt6Config.cmake QGpgmeQt6ConfigVersion.cmake install-cmake-files: QGpgmeQt6Config.cmake QGpgmeQt6ConfigVersion.cmake
-$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/QGpgmeQt6 -$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/QGpgmeQt6
$(INSTALL) -m 644 QGpgmeQt6Config.cmake \ $(INSTALL) -m 644 QGpgmeQt6Config.cmake \
$(DESTDIR)$(libdir)/cmake/QGpgmeQt6/QGpgmeQt6Config.cmake $(DESTDIR)$(libdir)/cmake/QGpgmeQt6/QGpgmeQt6Config.cmake
$(INSTALL) -m 644 QGpgmeQt6ConfigVersion.cmake \ $(INSTALL) -m 644 QGpgmeQt6ConfigVersion.cmake \
$(DESTDIR)$(libdir)/cmake/QGpgmeQt6/QGpgmeQt6ConfigVersion.cmake $(DESTDIR)$(libdir)/cmake/QGpgmeQt6/QGpgmeQt6ConfigVersion.cmake
install_cmake_files_qt6 = install-cmake-files-qt6
uninstall-cmake-files-qt6: uninstall-cmake-files:
-rm $(DESTDIR)$(libdir)/cmake/QGpgmeQt6/QGpgmeQt6ConfigVersion.cmake -rm $(DESTDIR)$(libdir)/cmake/QGpgmeQt6/QGpgmeQt6ConfigVersion.cmake
-rm $(DESTDIR)$(libdir)/cmake/QGpgmeQt6/QGpgmeQt6Config.cmake -rm $(DESTDIR)$(libdir)/cmake/QGpgmeQt6/QGpgmeQt6Config.cmake
-rmdir $(DESTDIR)$(libdir)/cmake/QGpgmeQt6/ -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 endif
install-data-local: $(install_cmake_files_qt5) $(install_cmake_files_qt6) install-data-local: install-cmake-files
uninstall-hook: $(uninstall_cmake_files_qt5) $(uninstall_cmake_files_qt6) \ uninstall-local: uninstall-cmake-files
$(uninstall_include_dirs_qt5) $(uninstall_include_dirs_qt6)
BUILT_SOURCES = $(qgpgme_moc5_sources) $(qgpgme_moc5_forward_headers) \ BUILT_SOURCES = $(qgpgme_moc_sources) $(camelcase_headers)
$(qgpgme_moc6_sources) $(qgpgme_moc6_forward_headers) \
$(camelcase_headers)
CLEANFILES = $(qgpgme_moc5_sources) $(qgpgme_moc5_forward_headers) \ CLEANFILES = $(qgpgme_moc_sources) $(camelcase_headers) QGpgmeConfig.cmake \
$(qgpgme_moc6_sources) $(qgpgme_moc6_forward_headers) \
$(camelcase_headers) QGpgmeConfig.cmake \
qgpgme_version.h QGpgmeConfig.cmake.in \ qgpgme_version.h QGpgmeConfig.cmake.in \
QGpgmeConfig-w32.cmake.in QGpgmeConfigVersion.cmake \ QGpgmeConfig-w32.cmake.in QGpgmeConfigVersion.cmake \
QGpgmeQt6Config.cmake.in QGpgmeQt6Config-w32.cmake.in \ QGpgmeQt6Config.cmake.in QGpgmeQt6Config-w32.cmake.in \
QGpgmeQt6Config.cmake QGpgmeQt6ConfigVersion.cmake QGpgmeQt6Config.cmake QGpgmeQt6ConfigVersion.cmake
clean-local: if WANT_QT5
-test -z "$(moc5_dir)" || rm -rf $(moc5_dir) nodist_libqgpgme_la_SOURCES = $(qgpgme_moc_sources)
-test -z "$(moc6_dir)" || rm -rf $(moc6_dir) endif
if WANT_QT6
nodist_libqgpgmeqt6_la_SOURCES = $(qgpgme_moc_sources)
endif
.h.moc:
$(MOC) `test -f '$<' || echo '$(srcdir)/'`$< -o $@

View File

@ -1,17 +1,17 @@
# CMake Config file for QGPGME. # CMake Config file for QGPGME.
# Copyright (C) 2016 Intevation GmbH # Copyright (C) 2016 Intevation GmbH
# #
# This file is part of QGpgME. # This file is part of GPGME.
# #
# QGpgME is free software; you can redistribute it and/or modify it # GPGME-CL is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# QGpgME is distributed in the hope that it will be useful, # GPGME-CL is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Lesser General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software

View File

@ -1,17 +1,17 @@
# CMake Config file for QGPGME. # CMake Config file for QGPGME.
# Copyright (C) 2016 Intevation GmbH # Copyright (C) 2016 Intevation GmbH
# #
# This file is part of QGpgME. # This file is part of GPGME.
# #
# QGpgME is free software; you can redistribute it and/or modify it # GPGME-CL is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# QGpgME is distributed in the hope that it will be useful, # GPGME-CL is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Lesser General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software

View File

@ -1,17 +1,17 @@
# CMake Version file for QGPGME. # CMake Version file for QGPGME.
# Copyright (C) 2016 Intevation GmbH # Copyright (C) 2016 Intevation GmbH
# #
# This file is part of QGpgME. # This file is part of GPGME.
# #
# QGpgME is free software; you can redistribute it and/or modify it # GPGME-CL is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# QGpgME is distributed in the hope that it will be useful, # GPGME-CL is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Lesser General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software

View File

@ -1,7 +1,7 @@
# CMake Config file for QGpgME for Qt 6 # CMake Config file for QGpgME for Qt 6
# Copyright (C) 2016 Intevation GmbH # Copyright (C) 2016 Intevation GmbH
# #
# This file is part of QGpgME. # This file is part of GPGME.
# #
# QGpgME is free software; you can redistribute it and/or modify it # QGpgME is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
@ -11,7 +11,7 @@
# QGpgME is distributed in the hope that it will be useful, # QGpgME is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Lesser General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software

View File

@ -1,7 +1,7 @@
# CMake Config file for QGpgME for Qt 6 # CMake Config file for QGpgME for Qt 6
# Copyright (C) 2016 Intevation GmbH # Copyright (C) 2016 Intevation GmbH
# #
# This file is part of QGpgME. # This file is part of GPGME.
# #
# QGpgME is free software; you can redistribute it and/or modify it # QGpgME is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
@ -11,7 +11,7 @@
# QGpgME is distributed in the hope that it will be useful, # QGpgME is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Lesser General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software

View File

@ -1,7 +1,7 @@
# CMake Version file for QGpgME for Qt 6 # CMake Version file for QGpgME for Qt 6
# Copyright (C) 2016 Intevation GmbH # Copyright (C) 2016 Intevation GmbH
# #
# This file is part of QGpgME. # This file is part of GPGME.
# #
# QGpgME is free software; you can redistribute it and/or modify it # QGpgME is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
@ -11,7 +11,7 @@
# QGpgME is distributed in the hope that it will be useful, # QGpgME is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU Lesser General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software

View File

@ -38,7 +38,7 @@
#include "changeexpiryjob.h" #include "changeexpiryjob.h"
#include "changeexpiryjob_p.h" #include "changeexpiryjob_p.h"
#include <gpgme++/context.h> #include <context.h>
using namespace GpgME; using namespace GpgME;
using namespace QGpgME; using namespace QGpgME;

View File

@ -37,7 +37,11 @@
#include "job.h" #include "job.h"
#ifdef BUILDING_QGPGME
# include "key.h"
#else
# include <gpgme++/key.h> # include <gpgme++/key.h>
#endif
#include <vector> #include <vector>

View File

@ -37,7 +37,11 @@
#include "job.h" #include "job.h"
#ifdef BUILDING_QGPGME
# include "key.h"
#else
# include <gpgme++/key.h> # include <gpgme++/key.h>
#endif
namespace QGpgME namespace QGpgME
{ {

View File

@ -1,24 +1,24 @@
/* dataprovider.cpp /* dataprovider.cpp
This file is part of qgpgme, the Qt API binding for gpgme
Copyright (C) 2004 Klarävdalens Datakonsult AB Copyright (C) 2004 Klarävdalens Datakonsult AB
Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH Software engineering by Intevation GmbH
QGpgME is free software; you can redistribute it and/or This file is part of QGPGME.
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, QGPGME is free software; you can redistribute it and/or modify it
but WITHOUT ANY WARRANTY; without even the implied warranty of under the terms of the GNU Library General Public License as published
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU by the Free Software Foundation; either version 2 of the License, or
General Public License for more details. (at your option) any later version.
You should have received a copy of the GNU General Public License QGPGME is distributed in the hope that it will be useful, but
along with this program; if not, write to the Free Software WITHOUT ANY WARRANTY; without even the implied warranty of
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*/ GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with QGPGME; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
// -*- c++ -*- // -*- c++ -*-
@ -28,7 +28,7 @@
#include <dataprovider.h> #include <dataprovider.h>
#include <gpgme++/error.h> #include <error.h>
#include <QIODevice> #include <QIODevice>
#include <QProcess> #include <QProcess>

View File

@ -1,24 +1,24 @@
/* dataprovider.h /* dataprovider.h
This file is part of qgpgme, the Qt API binding for gpgme
Copyright (C) 2004 Klarälvdalens Datakonsult AB Copyright (C) 2004 Klarälvdalens Datakonsult AB
Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH Software engineering by Intevation GmbH
QGpgME is free software; you can redistribute it and/or This file is part of QGPGME.
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, QGPGME is free software; you can redistribute it and/or modify it
but WITHOUT ANY WARRANTY; without even the implied warranty of under the terms of the GNU Library General Public License as published
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU by the Free Software Foundation; either version 2 of the License, or
General Public License for more details. (at your option) any later version.
You should have received a copy of the GNU General Public License QGPGME is distributed in the hope that it will be useful, but
along with this program; if not, write to the Free Software WITHOUT ANY WARRANTY; without even the implied warranty of
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*/ GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with QGPGME; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
// -*- c++ -*- // -*- c++ -*-
#ifndef __QGPGME_DATAPROVIDER_H__ #ifndef __QGPGME_DATAPROVIDER_H__
@ -26,7 +26,11 @@
#include "qgpgme_export.h" #include "qgpgme_export.h"
#ifdef BUILDING_QGPGME
#include <interfaces/dataprovider.h>
#else
#include <gpgme++/interfaces/dataprovider.h> #include <gpgme++/interfaces/dataprovider.h>
#endif
#include <memory> #include <memory>

View File

@ -35,7 +35,7 @@
#include "config.h" #include "config.h"
#endif #endif
#include <gpgme++/error.h> #include "error.h"
#include "debug.h" #include "debug.h"
#include <QDebug> #include <QDebug>
@ -44,9 +44,9 @@ QDebug operator<<(QDebug debug, const GpgME::Error &err)
{ {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
// On Windows, we tell libgpg-error to return (translated) error messages as UTF-8 // On Windows, we tell libgpg-error to return (translated) error messages as UTF-8
const auto errAsString = QString::fromStdString(err.asStdString()); const auto errAsString = QString::fromUtf8(err.asString());
#else #else
const auto errAsString = QString::fromLocal8Bit(err.asStdString().c_str()); const auto errAsString = QString::fromLocal8Bit(err.asString());
#endif #endif
const bool oldSetting = debug.autoInsertSpaces(); const bool oldSetting = debug.autoInsertSpaces();
debug.nospace() << errAsString << " (code: " << err.code() << ", source: " << err.source() << ")"; debug.nospace() << errAsString << " (code: " << err.code() << ", source: " << err.source() << ")";

View File

@ -38,7 +38,7 @@
#include "decryptverifyarchivejob.h" #include "decryptverifyarchivejob.h"
#include "decryptverifyarchivejob_p.h" #include "decryptverifyarchivejob_p.h"
#include <gpgme++/engineinfo.h> #include <engineinfo.h>
using namespace QGpgME; using namespace QGpgME;

View File

@ -36,7 +36,11 @@
#include "job.h" #include "job.h"
#ifdef BUILDING_QGPGME
# include "context.h"
#else
# include <gpgme++/context.h> # include <gpgme++/context.h>
#endif
namespace GpgME namespace GpgME
{ {

View File

@ -1,74 +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 <dev@ingo-kloecker.de>
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::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"

View File

@ -62,14 +62,6 @@ namespace QGpgME
DecryptVerifyJob instance will have scheduled it's own destruction with DecryptVerifyJob instance will have scheduled it's own destruction with
a call to QObject::deleteLater(). 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 After result() is emitted, the DecryptVerifyJob will schedule it's own
destruction by calling QObject::deleteLater(). destruction by calling QObject::deleteLater().
*/ */
@ -79,27 +71,7 @@ class QGPGME_EXPORT DecryptVerifyJob : public Job
protected: protected:
explicit DecryptVerifyJob(QObject *parent); explicit DecryptVerifyJob(QObject *parent);
public: public:
~DecryptVerifyJob() override; ~DecryptVerifyJob();
/**
* 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. Starts the combined decryption and verification operation.

View File

@ -1,50 +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 <dev@ingo-kloecker.de>
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;
};
}
#endif // __QGPGME_DECRYPTVERIFYJOB_P_H__

View File

@ -38,7 +38,7 @@
#include "encryptarchivejob.h" #include "encryptarchivejob.h"
#include "encryptarchivejob_p.h" #include "encryptarchivejob_p.h"
#include <gpgme++/engineinfo.h> #include <engineinfo.h>
using namespace QGpgME; using namespace QGpgME;

View File

@ -36,7 +36,11 @@
#include "job.h" #include "job.h"
#ifdef BUILDING_QGPGME
# include "context.h"
#else
# include <gpgme++/context.h> # include <gpgme++/context.h>
#endif
namespace GpgME namespace GpgME
{ {

View File

@ -40,13 +40,6 @@
using namespace QGpgME; using namespace QGpgME;
EncryptJob::EncryptJob(QObject *parent)
: Job{parent}
{
}
EncryptJob::~EncryptJob() = default;
void EncryptJob::setFileName(const QString &fileName) void EncryptJob::setFileName(const QString &fileName)
{ {
auto d = jobPrivate<EncryptJobPrivate>(this); auto d = jobPrivate<EncryptJobPrivate>(this);
@ -70,53 +63,3 @@ GpgME::Data::Encoding EncryptJob::inputEncoding() const
auto d = jobPrivate<EncryptJobPrivate>(this); auto d = jobPrivate<EncryptJobPrivate>(this);
return d->m_inputEncoding; 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"

View File

@ -38,12 +38,16 @@
#define __KLEO_ENCRYPTJOB_H__ #define __KLEO_ENCRYPTJOB_H__
#include "job.h" #include "job.h"
#include <gpgme++/data.h> #include "data.h"
#include <memory> #include <memory>
#include <vector> #include <vector>
#ifdef BUILDING_QGPGME
# include "context.h"
#else
# include <gpgme++/context.h> # include <gpgme++/context.h>
#endif
class QByteArray; class QByteArray;
class QIODevice; class QIODevice;
@ -68,15 +72,6 @@ namespace QGpgME
EncryptJob instance will have scheduled it's own destruction with EncryptJob instance will have scheduled it's own destruction with
a call to QObject::deleteLater(). 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 After result() is emitted, the EncryptJob will schedule it's own
destruction by calling QObject::deleteLater(). destruction by calling QObject::deleteLater().
*/ */
@ -86,63 +81,14 @@ class QGPGME_EXPORT EncryptJob : public Job
protected: protected:
explicit EncryptJob(QObject *parent); explicit EncryptJob(QObject *parent);
public: public:
~EncryptJob() override; ~EncryptJob();
/**
* 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); void setFileName(const QString &fileName);
QString fileName() const; 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); void setInputEncoding(GpgME::Data::Encoding);
GpgME::Data::Encoding inputEncoding() const; 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 Starts the encryption operation. \a recipients is the a list of
keys to encrypt \a plainText to. Empty (null) keys are keys to encrypt \a plainText to. Empty (null) keys are

View File

@ -35,24 +35,15 @@
#define __QGPGME_ENCRYPTJOB_P_H__ #define __QGPGME_ENCRYPTJOB_P_H__
#include "job_p.h" #include "job_p.h"
#include "data.h"
#include <gpgme++/data.h>
#include <gpgme++/key.h>
namespace QGpgME namespace QGpgME
{ {
struct EncryptJobPrivate : public JobPrivate struct EncryptJobPrivate : public JobPrivate
{ {
// used by start() functions
QString m_fileName; QString m_fileName;
GpgME::Data::Encoding m_inputEncoding; 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;
}; };
} }

View File

@ -80,12 +80,6 @@ public:
virtual void setExportFlags (unsigned int flags); 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: Q_SIGNALS:
void result(const GpgME::Error &result, const QByteArray &keyData, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error()); void result(const GpgME::Error &result, const QByteArray &keyData, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
}; };

View File

@ -41,7 +41,7 @@
#include <QString> #include <QString>
#include <gpgme++/error.h> #include <error.h>
#include <numeric> #include <numeric>

View File

@ -36,7 +36,11 @@
#include "qgpgme_export.h" #include "qgpgme_export.h"
#ifdef BUILDING_QGPGME
#include <interfaces/dataprovider.h>
#else
#include <gpgme++/interfaces/dataprovider.h> #include <gpgme++/interfaces/dataprovider.h>
#endif
#include <memory> #include <memory>
#include <vector> #include <vector>

View File

@ -39,7 +39,11 @@
#include "keylistjob.h" #include "keylistjob.h"
#include "cryptobackend.h" #include "cryptobackend.h"
#ifdef BUILDING_QGPGME
# include "keylistresult.h"
#else
#include <gpgme++/keylistresult.h> #include <gpgme++/keylistresult.h>
#endif
#include <QPointer> #include <QPointer>

View File

@ -38,7 +38,7 @@
#include "importjob.h" #include "importjob.h"
#include "importjob_p.h" #include "importjob_p.h"
#include <gpgme++/context.h> #include <context.h>
using namespace GpgME; using namespace GpgME;
using namespace QGpgME; using namespace QGpgME;
@ -55,18 +55,6 @@ QString QGpgME::ImportJob::importFilter() const
return d->m_importFilter; 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) void ImportJob::setKeyOrigin(GpgME::Key::Origin origin, const QString &url)
{ {
const auto d = jobPrivate<ImportJobPrivate>(this); const auto d = jobPrivate<ImportJobPrivate>(this);

View File

@ -40,7 +40,11 @@
#include "abstractimportjob.h" #include "abstractimportjob.h"
#include "qgpgme_export.h" #include "qgpgme_export.h"
#ifdef BUILDING_QGPGME
# include <key.h>
#else
# include <gpgme++/key.h> # include <gpgme++/key.h>
#endif
namespace GpgME namespace GpgME
{ {
@ -75,9 +79,6 @@ public:
void setImportFilter(const QString &filter); void setImportFilter(const QString &filter);
QString importFilter() const; QString importFilter() const;
void setImportOptions(const QStringList &options);
QStringList importOptions() const;
void setKeyOrigin(GpgME::Key::Origin origin, const QString &url = {}); void setKeyOrigin(GpgME::Key::Origin origin, const QString &url = {});
GpgME::Key::Origin keyOrigin() const; GpgME::Key::Origin keyOrigin() const;
QString keyOriginUrl() const; QString keyOriginUrl() const;

View File

@ -36,7 +36,7 @@
#include "job_p.h" #include "job_p.h"
#include <gpgme++/key.h> #include <key.h>
namespace QGpgME namespace QGpgME
{ {
@ -44,7 +44,6 @@ namespace QGpgME
struct ImportJobPrivate : public JobPrivate struct ImportJobPrivate : public JobPrivate
{ {
QString m_importFilter; QString m_importFilter;
QStringList m_importOptions;
GpgME::Key::Origin m_keyOrigin = GpgME::Key::OriginUnknown; GpgME::Key::Origin m_keyOrigin = GpgME::Key::OriginUnknown;
QString m_keyOriginUrl; QString m_keyOriginUrl;
}; };

View File

@ -43,8 +43,14 @@
#include "keylistjob.h" #include "keylistjob.h"
#include "listallkeysjob.h" #include "listallkeysjob.h"
#include "encryptjob.h"
#include "decryptjob.h" #include "decryptjob.h"
#include "decryptverifyjob.h"
#include "signjob.h"
#include "signkeyjob.h" #include "signkeyjob.h"
#include "signencryptjob.h"
#include "verifydetachedjob.h"
#include "verifyopaquejob.h"
#include "keygenerationjob.h" #include "keygenerationjob.h"
#include "importjob.h" #include "importjob.h"
#include "importfromkeyserverjob.h" #include "importfromkeyserverjob.h"
@ -158,8 +164,14 @@ void QGpgME::Job::startNow()
make_job_subclass(KeyListJob) make_job_subclass(KeyListJob)
make_job_subclass(ListAllKeysJob) make_job_subclass(ListAllKeysJob)
make_job_subclass(EncryptJob)
make_job_subclass(DecryptJob) make_job_subclass(DecryptJob)
make_job_subclass(DecryptVerifyJob)
make_job_subclass(SignJob)
make_job_subclass(SignEncryptJob)
make_job_subclass(SignKeyJob) make_job_subclass(SignKeyJob)
make_job_subclass(VerifyDetachedJob)
make_job_subclass(VerifyOpaqueJob)
make_job_subclass(KeyGenerationJob) make_job_subclass(KeyGenerationJob)
make_job_subclass(AbstractImportJob) make_job_subclass(AbstractImportJob)
make_job_subclass_ext(ImportJob, AbstractImportJob) make_job_subclass_ext(ImportJob, AbstractImportJob)
@ -190,8 +202,14 @@ make_job_subclass(SetPrimaryUserIDJob)
#include "keylistjob.moc" #include "keylistjob.moc"
#include "listallkeysjob.moc" #include "listallkeysjob.moc"
#include "encryptjob.moc"
#include "decryptjob.moc" #include "decryptjob.moc"
#include "decryptverifyjob.moc"
#include "signjob.moc"
#include "signencryptjob.moc"
#include "signkeyjob.moc" #include "signkeyjob.moc"
#include "verifydetachedjob.moc"
#include "verifyopaquejob.moc"
#include "keygenerationjob.moc" #include "keygenerationjob.moc"
#include "abstractimportjob.moc" #include "abstractimportjob.moc"
#include "importjob.moc" #include "importjob.moc"

View File

@ -41,7 +41,11 @@
#include <QString> #include <QString>
#include <QMap> #include <QMap>
#ifdef BUILDING_QGPGME
# include "error.h"
#else
# include <gpgme++/error.h> # include <gpgme++/error.h>
#endif
class QWidget; class QWidget;
@ -93,10 +97,7 @@ public:
/** Starts the job. /** Starts the job.
* *
* Starts the job with the values set for the concrete job. If starting * Starts the job with the values set for the concrete job.
* 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(); GpgME::Error startIt();

View File

@ -37,7 +37,11 @@
#include "job.h" #include "job.h"
#ifdef BUILDING_QGPGME
# include "key.h"
#else
# include <gpgme++/key.h> # include <gpgme++/key.h>
#endif
namespace GpgME namespace GpgME
{ {

View File

@ -38,7 +38,11 @@
#include "job.h" #include "job.h"
#include "qgpgme_export.h" #include "qgpgme_export.h"
#ifdef BUILDING_QGPGME
# include "key.h"
#else
# include <gpgme++/key.h> # include <gpgme++/key.h>
#endif
#include <QtCore/QStringList> #include <QtCore/QStringList>

View File

@ -40,7 +40,11 @@
#include "job.h" #include "job.h"
#include "qgpgme_export.h" #include "qgpgme_export.h"
#ifdef BUILDING_QGPGME
# include "key.h"
#else
# include <gpgme++/key.h> # include <gpgme++/key.h>
#endif
#include <vector> #include <vector>

View File

@ -38,9 +38,9 @@
#include "protocol.h" #include "protocol.h"
#include "deletejob.h" #include "deletejob.h"
#include <gpgme++/key.h> #include <key.h>
#include <gpgme++/context.h> #include <context.h>
#include <gpgme++/data.h> #include <data.h>
#include <iterator> #include <iterator>

View File

@ -41,10 +41,10 @@
#include <QDateTime> #include <QDateTime>
#include <gpgme++/context.h> #include "context.h"
#include <gpgme++/data.h> #include "data.h"
#include <gpgme++/gpgaddexistingsubkeyeditinteractor.h> #include "gpgaddexistingsubkeyeditinteractor.h"
#include <gpgme++/key.h> #include "key.h"
#include <gpg-error.h> #include <gpg-error.h>
@ -90,6 +90,7 @@ Error QGpgMEAddExistingSubkeyJob::start(const GpgME::Key &key, const GpgME::Subk
Error QGpgMEAddExistingSubkeyJob::exec(const GpgME::Key &key, const GpgME::Subkey &subkey) Error QGpgMEAddExistingSubkeyJob::exec(const GpgME::Key &key, const GpgME::Subkey &subkey)
{ {
const result_type r = add_subkey(context(), key, subkey); const result_type r = add_subkey(context(), key, subkey);
resultHook(r);
return std::get<0>(r); return std::get<0>(r);
} }

View File

@ -40,10 +40,10 @@
#include "dataprovider.h" #include "dataprovider.h"
#include <gpgme++/context.h> #include "context.h"
#include <gpgme++/data.h> #include "data.h"
#include <gpgme++/gpgadduserideditinteractor.h> #include "gpgadduserideditinteractor.h"
#include <gpgme++/key.h> #include "key.h"
#include <cassert> #include <cassert>
#include <memory> #include <memory>

View File

@ -40,8 +40,8 @@
#include "qgpgmegpgcardjob.h" #include "qgpgmegpgcardjob.h"
#include <gpgme++/error.h> #include "error.h"
#include <gpgme++/engineinfo.h> #include "engineinfo.h"
#include "protocol_p.h" #include "protocol_p.h"

View File

@ -42,8 +42,8 @@
#include "changeexpiryjob_p.h" #include "changeexpiryjob_p.h"
#include <gpgme++/context.h> #include "context.h"
#include <gpgme++/key.h> #include "key.h"
#include <QDateTime> #include <QDateTime>

View File

@ -40,10 +40,10 @@
#include "dataprovider.h" #include "dataprovider.h"
#include <gpgme++/context.h> #include "context.h"
#include <gpgme++/data.h> #include "data.h"
#include <gpgme++/gpgsetownertrusteditinteractor.h> #include "gpgsetownertrusteditinteractor.h"
#include <gpgme++/key.h> #include "key.h"
#include <cassert> #include <cassert>
#include <memory> #include <memory>

View File

@ -40,9 +40,9 @@
#include "dataprovider.h" #include "dataprovider.h"
#include <gpgme++/context.h> #include "context.h"
#include <gpgme++/data.h> #include "data.h"
#include <gpgme++/key.h> #include "key.h"
#include <cassert> #include <cassert>
#include <memory> #include <memory>

View File

@ -40,9 +40,9 @@
#include "dataprovider.h" #include "dataprovider.h"
#include <gpgme++/context.h> #include "context.h"
#include <gpgme++/decryptionresult.h> #include "decryptionresult.h"
#include <gpgme++/data.h> #include "data.h"
#include <QBuffer> #include <QBuffer>
@ -122,7 +122,15 @@ GpgME::DecryptionResult QGpgME::QGpgMEDecryptJob::exec(const QByteArray &cipherT
{ {
const result_type r = decrypt_qba(context(), cipherText); const result_type r = decrypt_qba(context(), cipherText);
plainText = std::get<1>(r); plainText = std::get<1>(r);
return std::get<0>(r); resultHook(r);
return mResult;
}
//PENDING(marc) implement showErrorDialog()
void QGpgMEDecryptJob::resultHook(const result_type &tuple)
{
mResult = std::get<0>(tuple);
} }
#include "qgpgmedecryptjob.moc" #include "qgpgmedecryptjob.moc"

View File

@ -39,7 +39,11 @@
#include "threadedjobmixin.h" #include "threadedjobmixin.h"
#ifdef BUILDING_QGPGME
# include "decryptionresult.h"
#else
#include <gpgme++/decryptionresult.h> #include <gpgme++/decryptionresult.h>
#endif
namespace QGpgME namespace QGpgME
{ {
@ -69,6 +73,12 @@ public:
/* from DecryptJob */ /* from DecryptJob */
GpgME::DecryptionResult exec(const QByteArray &cipherText, GpgME::DecryptionResult exec(const QByteArray &cipherText,
QByteArray &plainText) override; QByteArray &plainText) override;
/* from ThreadedJobMixin */
void resultHook(const result_type &r) override;
private:
GpgME::DecryptionResult mResult;
}; };
} }

View File

@ -45,7 +45,7 @@
#include <QFile> #include <QFile>
#include <gpgme++/data.h> #include <data.h>
using namespace QGpgME; using namespace QGpgME;
using namespace GpgME; using namespace GpgME;

View File

@ -38,8 +38,8 @@
#include "threadedjobmixin.h" #include "threadedjobmixin.h"
#include <gpgme++/decryptionresult.h> #include <decryptionresult.h>
#include <gpgme++/verificationresult.h> #include <verificationresult.h>
namespace QGpgME namespace QGpgME
{ {

View File

@ -39,56 +39,25 @@
#include "qgpgmedecryptverifyjob.h" #include "qgpgmedecryptverifyjob.h"
#include "dataprovider.h" #include "dataprovider.h"
#include "debug.h"
#include "decryptverifyjob_p.h"
#include "util.h"
#include <gpgme++/context.h> #include "context.h"
#include <gpgme++/decryptionresult.h> #include "decryptionresult.h"
#include <gpgme++/verificationresult.h> #include "verificationresult.h"
#include <gpgme++/data.h> #include "data.h"
#include <QDebug> #include <QDebug>
#include "qgpgme_debug.h" #include "qgpgme_debug.h"
#include <QBuffer> #include <QBuffer>
#include <QFile>
#include <cassert> #include <cassert>
using namespace QGpgME; using namespace QGpgME;
using namespace GpgME; 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) QGpgMEDecryptVerifyJob::QGpgMEDecryptVerifyJob(Context *context)
: mixin_type(context) : mixin_type(context)
{ {
setJobPrivate(this, std::unique_ptr<QGpgMEDecryptVerifyJobPrivate>{new QGpgMEDecryptVerifyJobPrivate{this}});
lateInitialization(); lateInitialization();
} }
@ -119,7 +88,7 @@ static QGpgMEDecryptVerifyJob::result_type decrypt_verify(Context *ctx, QThread
const std::pair<DecryptionResult, VerificationResult> res = ctx->decryptAndVerify(indata, outdata); const std::pair<DecryptionResult, VerificationResult> res = ctx->decryptAndVerify(indata, outdata);
Error ae; Error ae;
const QString log = _detail::audit_log_as_html(ctx, ae); const QString log = _detail::audit_log_as_html(ctx, ae);
qCDebug(QGPGME_LOG) << __func__ << "- End no plainText. Error:" << ae; qCDebug(QGPGME_LOG) << __func__ << "- End no plainText. Error:" << ae.asString();
return std::make_tuple(res.first, res.second, out.data(), log, ae); return std::make_tuple(res.first, res.second, out.data(), log, ae);
} else { } else {
QGpgME::QIODeviceDataProvider out(plainText); QGpgME::QIODeviceDataProvider out(plainText);
@ -128,7 +97,7 @@ static QGpgMEDecryptVerifyJob::result_type decrypt_verify(Context *ctx, QThread
const std::pair<DecryptionResult, VerificationResult> res = ctx->decryptAndVerify(indata, outdata); const std::pair<DecryptionResult, VerificationResult> res = ctx->decryptAndVerify(indata, outdata);
Error ae; Error ae;
const QString log = _detail::audit_log_as_html(ctx, ae); const QString log = _detail::audit_log_as_html(ctx, ae);
qCDebug(QGPGME_LOG) << __func__ << "- End plainText. Error:" << ae; qCDebug(QGPGME_LOG) << __func__ << "- End plainText. Error:" << ae.asString();
return std::make_tuple(res.first, res.second, QByteArray(), log, ae); return std::make_tuple(res.first, res.second, QByteArray(), log, ae);
} }
} }
@ -143,43 +112,6 @@ static QGpgMEDecryptVerifyJob::result_type decrypt_verify_qba(Context *ctx, cons
return decrypt_verify(ctx, nullptr, buffer, std::shared_ptr<QIODevice>()); 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)
{
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
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) Error QGpgMEDecryptVerifyJob::start(const QByteArray &cipherText)
{ {
run(std::bind(&decrypt_verify_qba, std::placeholders::_1, cipherText)); run(std::bind(&decrypt_verify_qba, std::placeholders::_1, cipherText));
@ -196,20 +128,14 @@ QGpgME::QGpgMEDecryptVerifyJob::exec(const QByteArray &cipherText, QByteArray &p
{ {
const result_type r = decrypt_verify_qba(context(), cipherText); const result_type r = decrypt_verify_qba(context(), cipherText);
plainText = std::get<2>(r); plainText = std::get<2>(r);
return std::make_pair(std::get<0>(r), std::get<1>(r)); resultHook(r);
return mResult;
} }
GpgME::Error QGpgMEDecryptVerifyJobPrivate::startIt() //PENDING(marc) implement showErrorDialog()
void QGpgMEDecryptVerifyJob::resultHook(const result_type &tuple)
{ {
if (m_inputFilePath.isEmpty() || m_outputFilePath.isEmpty()) { mResult = std::make_pair(std::get<0>(tuple), std::get<1>(tuple));
return Error::fromCode(GPG_ERR_INV_VALUE);
} }
q->run([=](Context *ctx) {
return decrypt_verify_from_filename(ctx, m_inputFilePath, m_outputFilePath);
});
return {};
}
#include "qgpgmedecryptverifyjob.moc" #include "qgpgmedecryptverifyjob.moc"

View File

@ -39,8 +39,16 @@
#include "threadedjobmixin.h" #include "threadedjobmixin.h"
#ifdef BUILDING_QGPGME
# include "decryptionresult.h"
#else
#include <gpgme++/decryptionresult.h> #include <gpgme++/decryptionresult.h>
#endif
#ifdef BUILDING_QGPGME
# include "verificationresult.h"
#else
#include <gpgme++/verificationresult.h> #include <gpgme++/verificationresult.h>
#endif
namespace QGpgME namespace QGpgME
{ {
@ -70,6 +78,12 @@ public:
/* from DecryptVerifyJob */ /* from DecryptVerifyJob */
std::pair<GpgME::DecryptionResult, GpgME::VerificationResult> std::pair<GpgME::DecryptionResult, GpgME::VerificationResult>
exec(const QByteArray &cipherText, QByteArray &plainText) override; exec(const QByteArray &cipherText, QByteArray &plainText) override;
/* from ThreadedJobMixin */
void resultHook(const result_type &r) override;
private:
std::pair<GpgME::DecryptionResult, GpgME::VerificationResult> mResult;
}; };
} }

View File

@ -38,8 +38,8 @@
#include "qgpgmedeletejob.h" #include "qgpgmedeletejob.h"
#include <gpgme++/context.h> #include "context.h"
#include <gpgme++/key.h> #include "key.h"
#include <cassert> #include <cassert>

View File

@ -40,8 +40,8 @@
#include "dataprovider.h" #include "dataprovider.h"
#include <gpgme++/context.h> #include "context.h"
#include <gpgme++/data.h> #include "data.h"
#include <QStringList> #include <QStringList>

View File

@ -48,7 +48,7 @@
#include <QFile> #include <QFile>
#include <gpgme++/data.h> #include <data.h>
using namespace QGpgME; using namespace QGpgME;
using namespace GpgME; using namespace GpgME;

View File

@ -38,7 +38,7 @@
#include "threadedjobmixin.h" #include "threadedjobmixin.h"
#include <gpgme++/encryptionresult.h> #include <encryptionresult.h>
namespace QGpgME namespace QGpgME
{ {

View File

@ -40,13 +40,13 @@
#include "qgpgmeencryptjob.h" #include "qgpgmeencryptjob.h"
#include "dataprovider.h"
#include "encryptjob_p.h" #include "encryptjob_p.h"
#include "util.h"
#include <gpgme++/context.h> #include "dataprovider.h"
#include <gpgme++/data.h>
#include <gpgme++/encryptionresult.h> #include "context.h"
#include "encryptionresult.h"
#include "data.h"
#include <QBuffer> #include <QBuffer>
#include <QFileInfo> #include <QFileInfo>
@ -72,7 +72,11 @@ public:
~QGpgMEEncryptJobPrivate() override = default; ~QGpgMEEncryptJobPrivate() override = default;
private: private:
GpgME::Error startIt() override; GpgME::Error startIt() override
{
Q_ASSERT(!"Not supported by this Job class.");
return Error::fromCode(GPG_ERR_NOT_SUPPORTED);
}
void startNow() override void startNow() override
{ {
@ -164,44 +168,6 @@ static QGpgMEEncryptJob::result_type encrypt_qba(Context *ctx, const std::vector
return encrypt(ctx, nullptr, recipients, buffer, std::shared_ptr<QIODevice>(), eflags, outputIsBsse64Encoded, inputEncoding, fileName); 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) Error QGpgMEEncryptJob::start(const std::vector<Key> &recipients, const QByteArray &plainText, bool alwaysTrust)
{ {
run(std::bind(&encrypt_qba, std::placeholders::_1, recipients, plainText, run(std::bind(&encrypt_qba, std::placeholders::_1, recipients, plainText,
@ -228,7 +194,8 @@ EncryptionResult QGpgMEEncryptJob::exec(const std::vector<Key> &recipients, cons
{ {
const result_type r = encrypt_qba(context(), recipients, plainText, eflags, mOutputIsBase64Encoded, inputEncoding(), fileName()); const result_type r = encrypt_qba(context(), recipients, plainText, eflags, mOutputIsBase64Encoded, inputEncoding(), fileName());
cipherText = std::get<1>(r); cipherText = std::get<1>(r);
return std::get<0>(r); resultHook(r);
return mResult;
} }
void QGpgMEEncryptJob::start(const std::vector<Key> &recipients, const std::shared_ptr<QIODevice> &plainText, const std::shared_ptr<QIODevice> &cipherText, bool alwaysTrust) void QGpgMEEncryptJob::start(const std::vector<Key> &recipients, const std::shared_ptr<QIODevice> &plainText, const std::shared_ptr<QIODevice> &cipherText, bool alwaysTrust)
@ -241,17 +208,17 @@ EncryptionResult QGpgMEEncryptJob::exec(const std::vector<Key> &recipients, cons
return exec(recipients, plainText, alwaysTrust ? Context::AlwaysTrust : Context::None, cipherText); return exec(recipients, plainText, alwaysTrust ? Context::AlwaysTrust : Context::None, cipherText);
} }
GpgME::Error QGpgMEEncryptJobPrivate::startIt() void QGpgMEEncryptJob::resultHook(const result_type &tuple)
{ {
if (m_inputFilePath.isEmpty() || m_outputFilePath.isEmpty()) { mResult = std::get<0>(tuple);
return Error::fromCode(GPG_ERR_INV_VALUE);
} }
q->run([=](Context *ctx) { #if 0
return encrypt_to_filename(ctx, m_recipients, m_inputFilePath, m_outputFilePath, m_encryptionFlags); void QGpgMEEncryptJob::showErrorDialog(QWidget *parent, const QString &caption) const
}); {
if (mResult.error() && !mResult.error().isCanceled()) {
return {}; MessageBox::error(parent, mResult, this, caption);
} }
}
#endif
#include "qgpgmeencryptjob.moc" #include "qgpgmeencryptjob.moc"

View File

@ -39,8 +39,16 @@
#include "threadedjobmixin.h" #include "threadedjobmixin.h"
#ifdef BUILDING_QGPGME
# include "encryptionresult.h"
#else
#include <gpgme++/encryptionresult.h> #include <gpgme++/encryptionresult.h>
#endif
#ifdef BUILDING_QGPGME
# include "key.h"
#else
#include <gpgme++/key.h> #include <gpgme++/key.h>
#endif
namespace QGpgME namespace QGpgME
{ {
@ -89,8 +97,12 @@ public:
/* from EncryptJob */ /* from EncryptJob */
void setOutputIsBase64Encoded(bool on) override; void setOutputIsBase64Encoded(bool on) override;
/* from ThreadedJobMixin */
void resultHook(const result_type &r) override;
private: private:
bool mOutputIsBase64Encoded; bool mOutputIsBase64Encoded;
GpgME::EncryptionResult mResult;
}; };
} }

View File

@ -42,9 +42,9 @@
#include "dataprovider.h" #include "dataprovider.h"
#include <gpgme++/context.h> #include "context.h"
#include <gpgme++/data.h> #include "data.h"
#include <gpgme++/key.h> #include "key.h"
#include <QStringList> #include <QStringList>
@ -88,14 +88,6 @@ Error QGpgMEExportJob::start(const QStringList &patterns)
return Error(); 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) void QGpgMEExportJob::setExportFlags(unsigned int flags)
{ {
m_additionalExportModeFlags = flags; m_additionalExportModeFlags = flags;
@ -105,11 +97,4 @@ void QGpgMEExportJob::setExportFlags(unsigned int flags)
void ExportJob::setExportFlags(unsigned int) void ExportJob::setExportFlags(unsigned int)
{ {
} }
/* For ABI compat not pure virtual. */
GpgME::Error ExportJob::exec(const QStringList &, QByteArray &)
{
return Error();
}
#include "qgpgmeexportjob.moc" #include "qgpgmeexportjob.moc"

View File

@ -69,7 +69,6 @@ public:
/* from ExportJob */ /* from ExportJob */
GpgME::Error start(const QStringList &patterns) override; GpgME::Error start(const QStringList &patterns) override;
GpgME::Error exec(const QStringList &patterns, QByteArray &data) override;
private: private:
unsigned int m_exportMode; unsigned int m_exportMode;

View File

@ -122,6 +122,7 @@ Error QGpgMEGpgCardJob::exec(const QStringList &cmds, QString &std_out, QString
return Error(make_error(GPG_ERR_NOT_SUPPORTED)); return Error(make_error(GPG_ERR_NOT_SUPPORTED));
} }
const result_type r = do_work(cmds, cardpath); const result_type r = do_work(cmds, cardpath);
resultHook(r);
std_out = std::get<0>(r); std_out = std::get<0>(r);
std_err = std::get<1>(r); std_err = std::get<1>(r);
exitCode = std::get<2>(r); exitCode = std::get<2>(r);

View File

@ -40,9 +40,9 @@
#include "dataprovider.h" #include "dataprovider.h"
#include <gpgme++/context.h> #include "context.h"
#include <gpgme++/data.h> #include "data.h"
#include <gpgme++/key.h> #include "key.h"
#include <cassert> #include <cassert>
@ -74,7 +74,14 @@ Error QGpgMEImportFromKeyserverJob::start(const std::vector<Key> &keys)
GpgME::ImportResult QGpgME::QGpgMEImportFromKeyserverJob::exec(const std::vector<Key> &keys) GpgME::ImportResult QGpgME::QGpgMEImportFromKeyserverJob::exec(const std::vector<Key> &keys)
{ {
const result_type r = importfromkeyserver(context(), keys); const result_type r = importfromkeyserver(context(), keys);
return std::get<0>(r); resultHook(r);
return mResult;
} }
// PENDING(marc) implement showErrorDialog()
void QGpgME::QGpgMEImportFromKeyserverJob::resultHook(const result_type &tuple)
{
mResult = std::get<0>(tuple);
}
#include "qgpgmeimportfromkeyserverjob.moc" #include "qgpgmeimportfromkeyserverjob.moc"

View File

@ -39,7 +39,11 @@
#include "threadedjobmixin.h" #include "threadedjobmixin.h"
#ifdef BUILDING_QGPGME
# include "importresult.h"
#else
#include <gpgme++/importresult.h> #include <gpgme++/importresult.h>
#endif
namespace QGpgME namespace QGpgME
{ {
@ -65,6 +69,12 @@ public:
/* from ImportFromKeyserverJob */ /* from ImportFromKeyserverJob */
GpgME::ImportResult exec(const std::vector<GpgME::Key> &keys) override; GpgME::ImportResult exec(const std::vector<GpgME::Key> &keys) override;
/* from ThreadedJobMixin */
void resultHook(const result_type &r) override;
private:
GpgME::ImportResult mResult;
}; };
} }

View File

@ -44,9 +44,9 @@
#include "dataprovider.h" #include "dataprovider.h"
#include <gpgme++/context.h> #include <context.h>
#include <gpgme++/data.h> #include <data.h>
#include <gpgme++/key.h> #include <key.h>
using namespace QGpgME; using namespace QGpgME;
using namespace GpgME; using namespace GpgME;
@ -106,15 +106,11 @@ static const char *originToString(Key::Origin origin)
} }
static QGpgMEImportJob::result_type import_qba(Context *ctx, const QByteArray &certData, const QString &importFilter, static QGpgMEImportJob::result_type import_qba(Context *ctx, const QByteArray &certData, const QString &importFilter,
const QStringList &importOptions, Key::Origin keyOrigin, Key::Origin keyOrigin, const QString &keyOriginUrl)
const QString &keyOriginUrl)
{ {
if (!importFilter.isEmpty()) { if (!importFilter.isEmpty()) {
ctx->setFlag("import-filter", importFilter.toStdString().c_str()); 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 (keyOrigin != Key::OriginUnknown) {
if (const auto origin = originToString(keyOrigin)) { if (const auto origin = originToString(keyOrigin)) {
std::string value{origin}; std::string value{origin};
@ -153,20 +149,27 @@ static QGpgMEImportJob::result_type import_qba(Context *ctx, const QByteArray &c
Error QGpgMEImportJob::start(const QByteArray &certData) Error QGpgMEImportJob::start(const QByteArray &certData)
{ {
run(std::bind(&import_qba, std::placeholders::_1, certData, importFilter(), importOptions(), keyOrigin(), keyOriginUrl())); run(std::bind(&import_qba, std::placeholders::_1, certData, importFilter(), keyOrigin(), keyOriginUrl()));
return Error(); return Error();
} }
GpgME::ImportResult QGpgME::QGpgMEImportJob::exec(const QByteArray &keyData) GpgME::ImportResult QGpgME::QGpgMEImportJob::exec(const QByteArray &keyData)
{ {
const result_type r = import_qba(context(), keyData, importFilter(), importOptions(), keyOrigin(), keyOriginUrl()); const result_type r = import_qba(context(), keyData, importFilter(), keyOrigin(), keyOriginUrl());
return std::get<0>(r); resultHook(r);
return mResult;
} }
Error QGpgMEImportJob::startLater(const QByteArray &certData) Error QGpgMEImportJob::startLater(const QByteArray &certData)
{ {
setWorkerFunction(std::bind(&import_qba, std::placeholders::_1, certData, importFilter(), importOptions(), keyOrigin(), keyOriginUrl())); setWorkerFunction(std::bind(&import_qba, std::placeholders::_1, certData, importFilter(), keyOrigin(), keyOriginUrl()));
return {}; return {};
} }
// PENDING(marc) implement showErrorDialog()
void QGpgME::QGpgMEImportJob::resultHook(const result_type &tuple)
{
mResult = std::get<0>(tuple);
}
#include "qgpgmeimportjob.moc" #include "qgpgmeimportjob.moc"

View File

@ -41,7 +41,11 @@
#include "threadedjobmixin.h" #include "threadedjobmixin.h"
#ifdef BUILDING_QGPGME
# include "importresult.h"
#else
#include <gpgme++/importresult.h> #include <gpgme++/importresult.h>
#endif
namespace QGpgME namespace QGpgME
{ {
@ -69,6 +73,12 @@ public:
GpgME::ImportResult exec(const QByteArray &keyData) override; GpgME::ImportResult exec(const QByteArray &keyData) override;
GpgME::Error startLater(const QByteArray &keyData) override; GpgME::Error startLater(const QByteArray &keyData) override;
/* from ThreadedJobMixin */
void resultHook(const result_type &r) override;
private:
GpgME::ImportResult mResult;
}; };
} }

Some files were not shown because too many files have changed in this diff Show More