Unverified Commit 39bbfda2 authored by Andre Heinecke's avatar Andre Heinecke
Browse files

Add API to read branding icon and title

This adds support for two new optional lines in
the VERSION file. That can allow users of libkleo
to set a different branding.

GnuPG-Bug-Id: T5989
parent 9c6eee09
Pipeline #222519 passed with stage
in 1 minute and 53 seconds
# SPDX-License-Identifier: CC0-1.0
# SPDX-FileCopyrightText: none
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
set(PIM_VERSION "5.21.47")
set(PIM_VERSION "5.21.48")
project(libkleo VERSION ${PIM_VERSION})
......
......@@ -149,6 +149,8 @@ private:
QString mVersion;
QString mDescription;
QString mDescLong;
QString mBrandingWindowTitle;
QString mBrandingIcon;
bool mSignedVersion;
Gpg4win()
......@@ -161,21 +163,18 @@ private:
const QString verPath = instPath + QStringLiteral("/../VERSION");
QFile versionFile(verPath);
QString versVersion;
QString versDescription;
QString versDescLong;
// Open the file first to avoid a verify and then read issue where
// "auditors" might say its an issue,...
if (!versionFile.open(QIODevice::ReadOnly)) {
// No need to translate this should only be the case in development
// builds.
return;
} else {
// Expect a three line format of three HTML strings.
versVersion = QString::fromUtf8(versionFile.readLine()).trimmed();
versDescription = QString::fromUtf8(versionFile.readLine()).trimmed();
versDescLong = QString::fromUtf8(versionFile.readLine()).trimmed();
}
// Expect a three line format of three HTML strings.
const auto versVersion = QString::fromUtf8(versionFile.readLine()).trimmed();
const auto versDescription = QString::fromUtf8(versionFile.readLine()).trimmed();
const auto versDescLong = QString::fromUtf8(versionFile.readLine()).trimmed();
// read optional two branding strings
const auto brandingWindowTitle = QString::fromUtf8(versionFile.readLine()).trimmed();
const auto brandingIcon = QString::fromUtf8(versionFile.readLine()).trimmed();
const QString sigPath = verPath + QStringLiteral(".sig");
QFileInfo versionSig(instPath + QStringLiteral("/../VERSION.sig"));
......@@ -193,6 +192,8 @@ private:
mVersion = versVersion;
mDescription = versDescription;
mDescLong = versDescLong;
mBrandingWindowTitle = brandingWindowTitle;
mBrandingIcon = brandingIcon;
mSignedVersion = true;
} else {
qCDebug(LIBKLEO_LOG) << "gpgv failed with stderr: " << gpgv.readAllStandardError();
......@@ -222,6 +223,14 @@ public:
{
return mSignedVersion;
}
const QString &brandingWindowTitle() const
{
return mBrandingWindowTitle;
}
const QString &brandingIcon() const
{
return mBrandingIcon;
}
};
} // namespace
......@@ -262,6 +271,15 @@ QString Kleo::gpg4winLongDescription()
return Gpg4win::instance()->longDescription();
}
QString Kleo::brandingWindowTitle()
{
return Gpg4win::instance()->brandingWindowTitle();
}
QString Kleo::brandingIcon()
{
return Gpg4win::instance()->brandingIcon();
}
QString Kleo::gpg4winInstallPath()
{
#ifdef Q_OS_WIN
......
......@@ -42,6 +42,9 @@ KLEO_EXPORT QString gpg4winLongDescription();
KLEO_EXPORT QString gnupgInstallPath();
KLEO_EXPORT const QString &paperKeyInstallPath();
KLEO_EXPORT QString brandingWindowTitle();
KLEO_EXPORT QString brandingIcon();
/**
* Returns a list of filename globs of files in one of the whitelisted folders
* to watch for changes.
......
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