Unverified Commit 8c414248 authored by Andre Heinecke's avatar Andre Heinecke
Browse files

Add branding icon and window title if set

If the signed VERSION file for Kleopatra contains
branding information we can load this as the Window Title
and add an additional Icon in the Toolbar.

GnuPG-Bug-Id: T5989
parent 135bd0a6
Pipeline #222524 passed with stage
in 3 minutes and 39 seconds
......@@ -34,7 +34,7 @@ set(KF5_MIN_VERSION "5.97.0")
set(KIDENTITYMANAGEMENT_VERSION "5.21.40")
set(KMAILTRANSPORT_VERSION "5.21.40")
set(KMIME_VERSION "5.21.40")
set(LIBKLEO_VERSION "5.21.47")
set(LIBKLEO_VERSION "5.21.48")
set(QT_REQUIRED_VERSION "5.15.2")
set(GPGME_REQUIRED_VERSION "1.16.0")
......
......@@ -54,7 +54,9 @@ static const about_data credits[] = {
};
AboutData::AboutData()
: KAboutData(QStringLiteral("kleopatra"), i18n("Kleopatra"),
: KAboutData(QStringLiteral("kleopatra"),
(Kleo::brandingWindowTitle().isEmpty() ?
i18n("Kleopatra") : Kleo::brandingWindowTitle()),
#ifdef Q_OS_WIN
Kleo::gpg4winVersion(),
Kleo::gpg4winDescription(),
......
......@@ -72,6 +72,7 @@
#include <QStackedWidget>
#include <QStatusBar>
#include <QLabel>
#include <QPixmap>
#include <Libkleo/Compliance>
#include <Libkleo/Formatting>
......@@ -441,7 +442,8 @@ MainWindow::Private::Private(MainWindow *qq)
q->createGUI(QStringLiteral("kleopatra.rc"));
// make toolbar buttons accessible by keyboard
if (auto toolbar = q->findChild<KToolBar*>()) {
auto toolbar = q->findChild<KToolBar*>();
if (toolbar) {
auto toolbarButtons = toolbar->findChildren<QToolButton*>();
for (auto b : toolbarButtons) {
b->setFocusPolicy(Qt::TabFocus);
......@@ -455,6 +457,28 @@ MainWindow::Private::Private(MainWindow *qq)
});
}
const auto title = Kleo::brandingWindowTitle();
if (!title.isEmpty()) {
QApplication::setApplicationDisplayName(title);
}
const auto icon = Kleo::brandingIcon();
if (!icon.isEmpty()) {
const auto dir = QDir(Kleo::gpg4winInstallPath() + QStringLiteral("/../share/kleopatra/pics"));
qCDebug(KLEOPATRA_LOG) << "Loading branding icon:" << dir.absoluteFilePath(icon);
QPixmap brandingIcon(dir.absoluteFilePath(icon));
if (!brandingIcon.isNull()) {
auto *w = new QWidget;
auto *hl = new QHBoxLayout;
auto *lbl = new QLabel;
w->setLayout(hl);
hl->addWidget(lbl);
lbl->setPixmap(brandingIcon);
toolbar->addSeparator();
toolbar->addWidget(w);
}
}
q->setAcceptDrops(true);
// set default window size
......
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