Commit 83dbedef authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Show de-vs compliance in status bar if de-vs compliance is configured

GnuPG-bug-id: 5362
parent da7567ea
Pipeline #91321 passed with stage
in 13 minutes and 40 seconds
......@@ -54,6 +54,7 @@
#include "kleopatra_debug.h"
#include <KConfigGroup>
#include <KConfigDialog>
#include <KColorScheme>
#include <QAbstractItemView>
#include <QCloseEvent>
......@@ -179,13 +180,19 @@ public:
void updateStatusBar()
{
const auto complianceMode = Formatting::complianceMode();
if (complianceMode == QStringLiteral("de-vs")) {
auto statusBar = new QStatusBar;
q->setStatusBar(statusBar);
auto statusLbl = new QLabel(Formatting::deVsString());
statusBar->insertPermanentWidget(0, statusLbl);
if (Kleo::gnupgUsesDeVsCompliance()) {
auto statusBar = std::make_unique<QStatusBar>();
auto statusLbl = std::make_unique<QLabel>(Formatting::deVsString(Kleo::gnupgIsDeVsCompliant()));
const auto color = KColorScheme(QPalette::Active, KColorScheme::View).foreground(
Kleo::gnupgIsDeVsCompliant() ? KColorScheme::PositiveText : KColorScheme::NegativeText
).color();
const auto background = KColorScheme(QPalette::Active, KColorScheme::View).background(
Kleo::gnupgIsDeVsCompliant() ? KColorScheme::PositiveBackground : KColorScheme::NegativeBackground
).color();
statusLbl->setStyleSheet(QStringLiteral("QLabel { color: %1; background-color: %2; }").
arg(color.name()).arg(background.name()));
statusBar->insertPermanentWidget(0, statusLbl.release());
q->setStatusBar(statusBar.release()); // QMainWindow takes ownership
} else {
q->setStatusBar(nullptr);
}
......
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