12#include <config-libkleo.h>
14#include "auditlogentry.h"
16#include <libkleo/formatting.h>
17#include <libkleo_debug.h>
24#include <gpgme++/error.h>
28class AuditLogEntry::Private
35AuditLogEntry::AuditLogEntry()
36 : AuditLogEntry{
QString{}, GpgME::Error{}}
40AuditLogEntry::AuditLogEntry(
const GpgME::Error &error)
45AuditLogEntry::AuditLogEntry(
const QString &text,
const GpgME::Error &error)
46 : d{new Private{text,
error}}
50AuditLogEntry::~AuditLogEntry() =
default;
52AuditLogEntry::AuditLogEntry(
const AuditLogEntry &other)
53 : d{new Private{*other.d}}
57AuditLogEntry &AuditLogEntry::operator=(
const AuditLogEntry &other)
63AuditLogEntry::AuditLogEntry(AuditLogEntry &&other) =
default;
64AuditLogEntry &AuditLogEntry::operator=(AuditLogEntry &&other) =
default;
66AuditLogEntry AuditLogEntry::fromJob(
const QGpgME::Job *job)
69 return AuditLogEntry{job->auditLogAsHtml(), job->auditLogError()};
71 return AuditLogEntry{};
75GpgME::Error AuditLogEntry::error()
const
80QString AuditLogEntry::text()
const
85QUrl AuditLogEntry::asUrl(
const QUrl &urlTemplate)
const
90 if (
const int code = d->error.code()) {
91 if (code == GPG_ERR_NOT_IMPLEMENTED) {
92 qCDebug(LIBKLEO_LOG) <<
"not showing link (not implemented)";
93 }
else if (code == GPG_ERR_NO_DATA) {
94 qCDebug(LIBKLEO_LOG) <<
"not showing link (not available)";
96 qCDebug(LIBKLEO_LOG) <<
"Error Retrieving Audit Log:" << Formatting::errorAsString(d->error);
101 if (d->text.isEmpty()) {
105 QUrl url = urlTemplate;
115 debug.
nospace() <<
"AuditLogEntry(" << Formatting::errorAsString(auditLog.error()) <<
", " << auditLog.text() <<
')';
QDebug operator<<(QDebug dbg, const DcrawInfoContainer &c)
void error(QWidget *parent, const QString &text, const QString &title, const KGuiItem &buttonOk, Options options=Notify)
bool autoInsertSpaces() const const
void setAutoInsertSpaces(bool b)
void setQuery(const QString &query, ParsingMode mode)
void addQueryItem(const QString &key, const QString &value)