qt: Fix building with C++11

* lang/qt/src/qgpgmerefreshsmimekeysjob.cpp
(QGpgMERefreshSMIMEKeysJob::start): Replace 'auto' in lambda with the
actual type.
* lang/qt/src/qgpgmesignkeyjob.cpp (class TrustSignatureProperties): Add
default c'tor and c'tor initializing all members.
* lang/qt/src/util.cpp (toFingerprints): Replace 'auto' in lambda with
the actual type.
* lang/qt/tests/run-exportjob.cpp (createExportJob): Replace 'auto'
return type with actual type.
--

This fixes compilation with strict C++11.

GnuPG-bug-id: 6141
This commit is contained in:
Ingo Klöcker 2022-08-22 14:39:22 +02:00
parent 0566180684
commit 83176ad7d3
4 changed files with 12 additions and 3 deletions

View File

@ -94,7 +94,7 @@ GpgME::Error QGpgMERefreshSMIMEKeysJob::start(const std::vector<GpgME::Key> &key
return {};
}
const bool gotWrongKeys = std::any_of(std::begin(keys), std::end(keys), [](const auto &k) {
const bool gotWrongKeys = std::any_of(std::begin(keys), std::end(keys), [](const GpgME::Key &k) {
return k.protocol() != GpgME::CMS;
});
if (gotWrongKeys) {

View File

@ -57,6 +57,15 @@ using namespace GpgME;
namespace
{
struct TrustSignatureProperties {
TrustSignatureProperties() = default;
// needed for C++11 because until C++14 "aggregate initialization requires
// class type, that has no default member initializers"
TrustSignatureProperties(TrustSignatureTrust trust_, unsigned int depth_, const QString &scope_)
: trust{trust_}
, depth{depth_}
, scope{scope_}
{}
TrustSignatureTrust trust = TrustSignatureTrust::None;
unsigned int depth = 0;
QString scope;

View File

@ -56,7 +56,7 @@ QStringList toFingerprints(const std::vector<GpgME::Key> &keys)
{
QStringList fprs;
fprs.reserve(keys.size());
std::transform(std::begin(keys), std::end(keys), std::back_inserter(fprs), [](const auto &k) {
std::transform(std::begin(keys), std::end(keys), std::back_inserter(fprs), [](const GpgME::Key &k) {
return QString::fromLatin1(k.primaryFingerprint());
});
return fprs;

View File

@ -57,7 +57,7 @@ static void showUsageAndExitWithCode(int exitCode)
exit(exitCode);
}
static auto createExportJob(unsigned int mode)
static QGpgME::ExportJob *createExportJob(unsigned int mode)
{
if (mode & Context::ExportSecretSubkey) {
return QGpgME::openpgp()->secretSubkeyExportJob(/*armor=*/true);