diff options
Diffstat (limited to 'lang/qt/src/qgpgmesignencryptjob.cpp')
-rw-r--r-- | lang/qt/src/qgpgmesignencryptjob.cpp | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/lang/qt/src/qgpgmesignencryptjob.cpp b/lang/qt/src/qgpgmesignencryptjob.cpp index 5466c54..c2ced59 100644 --- a/lang/qt/src/qgpgmesignencryptjob.cpp +++ b/lang/qt/src/qgpgmesignencryptjob.cpp @@ -5,7 +5,7 @@ Copyright (c) 2004, 2007 Klarälvdalens Datakonsult AB Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik Software engineering by Intevation GmbH - Copyright (c) 2022 g10 Code GmbH + Copyright (c) 2022,2023 g10 Code GmbH Software engineering by Ingo Klöcker <dev@ingo-kloecker.de> QGpgME is free software; you can redistribute it and/or @@ -40,6 +40,8 @@ #include "qgpgmesignencryptjob.h" +#include "signencryptjob_p.h" + #include "dataprovider.h" #include "context.h" @@ -55,10 +57,41 @@ using namespace QGpgME; using namespace GpgME; +namespace +{ + +class QGpgMESignEncryptJobPrivate : public SignEncryptJobPrivate +{ + QGpgMESignEncryptJob *q = nullptr; + +public: + QGpgMESignEncryptJobPrivate(QGpgMESignEncryptJob *qq) + : q{qq} + { + } + + ~QGpgMESignEncryptJobPrivate() override = default; + +private: + GpgME::Error startIt() override + { + Q_ASSERT(!"Not supported by this Job class."); + return Error::fromCode(GPG_ERR_NOT_SUPPORTED); + } + + void startNow() override + { + q->run(); + } +}; + +} + QGpgMESignEncryptJob::QGpgMESignEncryptJob(Context *context) : mixin_type(context), mOutputIsBase64Encoded(false) { + setJobPrivate(this, std::unique_ptr<QGpgMESignEncryptJobPrivate>{new QGpgMESignEncryptJobPrivate{this}}); lateInitialization(); } @@ -81,6 +114,9 @@ static QGpgMESignEncryptJob::result_type sign_encrypt(Context *ctx, QThread *thr QGpgME::QIODeviceDataProvider in(plainText); Data indata(&in); + if (!plainText->isSequential()) { + indata.setSizeHint(plainText->size()); + } const auto pureFileName = QFileInfo{fileName}.fileName().toStdString(); if (!pureFileName.empty()) { |