Changeset View
Changeset View
Standalone View
Standalone View
transactions/kgpgverify.cpp
Show All 12 Lines | |||||
13 | 13 | | |||
14 | #include "kgpgverify.h" | 14 | #include "kgpgverify.h" | ||
15 | 15 | | |||
16 | #include "gpgproc.h" | 16 | #include "gpgproc.h" | ||
17 | #include "core/KGpgKeyNode.h" | 17 | #include "core/KGpgKeyNode.h" | ||
18 | #include "model/kgpgitemmodel.h" | 18 | #include "model/kgpgitemmodel.h" | ||
19 | 19 | | |||
20 | #include <QLocale> | 20 | #include <QLocale> | ||
21 | #include <QRegularExpression> | ||||
21 | 22 | | |||
22 | #include <KLocalizedString> | 23 | #include <KLocalizedString> | ||
23 | 24 | | |||
24 | KGpgVerify::KGpgVerify(QObject *parent, const QString &text) | 25 | KGpgVerify::KGpgVerify(QObject *parent, const QString &text) | ||
25 | : KGpgTextOrFileTransaction(parent, text), | 26 | : KGpgTextOrFileTransaction(parent, text), | ||
26 | m_fileIndex(-1) | 27 | m_fileIndex(-1) | ||
27 | { | 28 | { | ||
28 | } | 29 | } | ||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Line(s) | |||||
101 | 102 | | |||
102 | QString | 103 | QString | ||
103 | KGpgVerify::getReport(const QStringList &log, const KGpgItemModel *model) | 104 | KGpgVerify::getReport(const QStringList &log, const KGpgItemModel *model) | ||
104 | { | 105 | { | ||
105 | QString result; | 106 | QString result; | ||
106 | // newer versions of GnuPG emit both VALIDSIG and GOODSIG | 107 | // newer versions of GnuPG emit both VALIDSIG and GOODSIG | ||
107 | // for a good signature. Since VALIDSIG has more information | 108 | // for a good signature. Since VALIDSIG has more information | ||
108 | // we use that. | 109 | // we use that. | ||
109 | const QRegExp validsig(QLatin1String("^\\[GNUPG:\\] VALIDSIG([ ]+[^ ]+){10,}.*$")); | 110 | const QRegularExpression validsig(QStringLiteral("^\\[GNUPG:\\] VALIDSIG([ ]+[^ ]+){10,}.*$")); | ||
110 | const bool useGoodSig = (model == nullptr) || (log.indexOf(validsig) == -1); | 111 | const bool useGoodSig = (model == nullptr) || (log.indexOf(validsig) == -1); | ||
111 | QString sigtime; // timestamp of signature creation | 112 | QString sigtime; // timestamp of signature creation | ||
112 | 113 | | |||
113 | for (const QString &line : log) { | 114 | for (const QString &line : log) { | ||
114 | if (!line.startsWith(QLatin1String("[GNUPG:] "))) | 115 | if (!line.startsWith(QLatin1String("[GNUPG:] "))) | ||
115 | continue; | 116 | continue; | ||
116 | 117 | | |||
117 | const QString msg = line.mid(9); | 118 | const QString msg = line.mid(9); | ||
▲ Show 20 Lines • Show All 82 Lines • Show Last 20 Lines |