Commit c6d235f2 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Store file name of result file in DecryptVerifyResult

This allows retrieving the name of the decrypted file.

GnuPG-bug-id: 6056
parent c5a5af14
......@@ -647,6 +647,7 @@ public:
const VerificationResult &vr,
const DecryptionResult &dr,
const QByteArray &stuff,
const QString &fileName,
int errCode,
const QString &errString,
const QString &input,
......@@ -660,6 +661,7 @@ public:
m_verificationResult(vr),
m_decryptionResult(dr),
m_stuff(stuff),
m_fileName(fileName),
m_error(errCode),
m_errorString(errString),
m_inputLabel(input),
......@@ -693,6 +695,7 @@ public:
VerificationResult m_verificationResult;
DecryptionResult m_decryptionResult;
QByteArray m_stuff;
QString m_fileName;
int m_error;
QString m_errorString;
QString m_inputLabel;
......@@ -714,6 +717,7 @@ std::shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromDecryptResul
VerificationResult(),
dr,
plaintext,
{},
0,
QString(),
inputLabel(),
......@@ -730,6 +734,7 @@ std::shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromDecryptResul
VerificationResult(),
DecryptionResult(err),
QByteArray(),
{},
err.code(),
what,
inputLabel(),
......@@ -739,7 +744,7 @@ std::shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromDecryptResul
informativeSender()));
}
std::shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromDecryptVerifyResult(const DecryptionResult &dr, const VerificationResult &vr, const QByteArray &plaintext, const AuditLog &auditLog)
std::shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromDecryptVerifyResult(const DecryptionResult &dr, const VerificationResult &vr, const QByteArray &plaintext, const QString &fileName, const AuditLog &auditLog)
{
int err = dr.error() ? dr.error().code() : vr.error().code();
return std::shared_ptr<DecryptVerifyResult>(new DecryptVerifyResult(
......@@ -747,6 +752,7 @@ std::shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromDecryptVerif
vr,
dr,
plaintext,
fileName,
err,
QString(),
inputLabel(),
......@@ -763,6 +769,7 @@ std::shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromDecryptVerif
VerificationResult(),
DecryptionResult(err),
QByteArray(),
{},
err.code(),
details,
inputLabel(),
......@@ -779,6 +786,7 @@ std::shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromVerifyOpaque
vr,
DecryptionResult(),
plaintext,
{},
0,
QString(),
inputLabel(),
......@@ -794,6 +802,7 @@ std::shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromVerifyOpaque
VerificationResult(err),
DecryptionResult(),
QByteArray(),
{},
err.code(),
details,
inputLabel(),
......@@ -810,6 +819,7 @@ std::shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromVerifyDetach
vr,
DecryptionResult(),
QByteArray(),
{},
0,
QString(),
inputLabel(),
......@@ -825,6 +835,7 @@ std::shared_ptr<DecryptVerifyResult> AbstractDecryptVerifyTask::fromVerifyDetach
VerificationResult(err),
DecryptionResult(),
QByteArray(),
{},
err.code(),
details,
inputLabel(),
......@@ -838,6 +849,7 @@ DecryptVerifyResult::DecryptVerifyResult(DecryptVerifyOperation type,
const VerificationResult &vr,
const DecryptionResult &dr,
const QByteArray &stuff,
const QString &fileName,
int errCode,
const QString &errString,
const QString &inputLabel,
......@@ -845,7 +857,7 @@ DecryptVerifyResult::DecryptVerifyResult(DecryptVerifyOperation type,
const AuditLog &auditLog,
Task *parentTask,
const Mailbox &informativeSender)
: Task::Result(), d(new Private(type, vr, dr, stuff, errCode, errString, inputLabel, outputLabel, auditLog, parentTask, informativeSender, this))
: Task::Result(), d(new Private(type, vr, dr, stuff, fileName, errCode, errString, inputLabel, outputLabel, auditLog, parentTask, informativeSender, this))
{
}
......@@ -925,6 +937,11 @@ GpgME::DecryptionResult DecryptVerifyResult::decryptionResult() const
return d->m_decryptionResult;
}
QString DecryptVerifyResult::fileName() const
{
return d->m_fileName;
}
class AbstractDecryptVerifyTask::Private
{
public:
......@@ -1011,7 +1028,7 @@ void DecryptVerifyTask::Private::slotResult(const DecryptionResult &dr, const Ve
return;
}
emitResult(q->fromDecryptVerifyResult(dr, vr, plainText, auditLog));
emitResult(q->fromDecryptVerifyResult(dr, vr, plainText, m_output->fileName(), auditLog));
}
DecryptVerifyTask::DecryptVerifyTask(QObject *parent) : AbstractDecryptVerifyTask(parent), d(new Private(this))
......
......@@ -66,7 +66,7 @@ Q_SIGNALS:
protected:
std::shared_ptr<DecryptVerifyResult> fromDecryptResult(const GpgME::DecryptionResult &dr, const QByteArray &plaintext, const AuditLog &auditLog);
std::shared_ptr<DecryptVerifyResult> fromDecryptResult(const GpgME::Error &err, const QString &details, const AuditLog &auditLog);
std::shared_ptr<DecryptVerifyResult> fromDecryptVerifyResult(const GpgME::DecryptionResult &dr, const GpgME::VerificationResult &vr, const QByteArray &plaintext, const AuditLog &auditLog);
std::shared_ptr<DecryptVerifyResult> fromDecryptVerifyResult(const GpgME::DecryptionResult &dr, const GpgME::VerificationResult &vr, const QByteArray &plaintext, const QString &fileName, const AuditLog &auditLog);
std::shared_ptr<DecryptVerifyResult> fromDecryptVerifyResult(const GpgME::Error &err, const QString &what, const AuditLog &auditLog);
std::shared_ptr<DecryptVerifyResult> fromVerifyOpaqueResult(const GpgME::VerificationResult &vr, const QByteArray &plaintext, const AuditLog &auditLog);
std::shared_ptr<DecryptVerifyResult> fromVerifyOpaqueResult(const GpgME::Error &err, const QString &details, const AuditLog &auditLog);
......@@ -229,6 +229,7 @@ public:
GpgME::VerificationResult verificationResult() const;
GpgME::DecryptionResult decryptionResult() const;
QString fileName() const;
private:
static QString keyToString(const GpgME::Key &key);
......@@ -242,6 +243,7 @@ private:
const GpgME::VerificationResult &vr,
const GpgME::DecryptionResult &dr,
const QByteArray &stuff,
const QString &fileName,
int errCode,
const QString &errString,
const QString &inputLabel,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment