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

Add helper returning the version number of the Gpg4win release

The version may contain a product-specific prefix which the new helper
strips off.

GnuPG-bug-id: 5663
parent 6fca33aa
......@@ -33,6 +33,7 @@
#include <QByteArray>
#include <QStandardPaths>
#include <QCoreApplication>
#include <QRegularExpression>
#include <gpg-error.h>
#ifdef Q_OS_WIN
......@@ -212,6 +213,15 @@ bool Kleo::gpg4winSignedversion()
return Gpg4win::instance()->isSignedVersion();
}
QString Kleo::gpg4winVersionNumber()
{
// extract the actual version number from the string returned by Gpg4win::version();
// we assume that Gpg4win::version() returns the version number prefixed with
// some text followed by a dash, e.g. "Gpg4win-3.1.15"; see https://dev.gnupg.org/T5663
static const QRegularExpression prefixRegExp{QLatin1String{"^.*-"}};
return gpg4winVersion().remove(prefixRegExp);
}
QString Kleo::gpg4winVersion()
{
return Gpg4win::instance()->version();
......
......@@ -35,6 +35,9 @@ KLEO_EXPORT QString gpgPath();
KLEO_EXPORT QString gpgConfListDir(const char *which);
KLEO_EXPORT QString gpg4winInstallPath();
// Returns the version number.
KLEO_EXPORT QString gpg4winVersionNumber();
// Returns the version number with an optional product specific prefix.
KLEO_EXPORT QString gpg4winVersion();
KLEO_EXPORT bool gpg4winSignedversion();
KLEO_EXPORT QString gpg4winDescription();
......
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