Commit 9a8722cb authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Use DeVSCompliance helper for setting icon and color for compliance

GnuPG-bug-id: 6073
parent 1d6b96f4
Pipeline #204565 passed with stage
in 2 minutes and 38 seconds
......@@ -274,14 +274,7 @@ private:
auto btn = ui.buttonBox.button(QDialogButtonBox::Ok);
btn->setIcon(QIcon::fromTheme(de_vs
? QStringLiteral("security-high")
: QStringLiteral("security-medium")));
if (!SystemInfo::isHighContrastModeActive()) {
btn->setStyleSheet(QStringLiteral("QPushButton { background-color: %1; }").arg(de_vs
? KColorScheme(QPalette::Active, KColorScheme::View).background(KColorScheme::PositiveBackground).color().name()
: KColorScheme(QPalette::Active, KColorScheme::View).background(KColorScheme::NegativeBackground).color().name()));
}
DeVSCompliance::decorate(btn, de_vs);
ui.complianceLB.setText(de_vs
? i18nc("%1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant",
"%1 communication possible.", DeVSCompliance::name(true))
......
......@@ -41,6 +41,7 @@
#include <QLabel>
#include <QIcon>
#include <QCheckBox>
#include <QPushButton>
#include <QStyle>
#include <gpgme++/key.h>
......@@ -442,19 +443,12 @@ private Q_SLOTS:
if (mParent->currentPage() != this) {
return;
}
auto btn = mParent->button(QWizard::CommitButton);
auto btn = qobject_cast<QPushButton*>(mParent->button(QWizard::CommitButton));
if (!label.isEmpty()) {
mParent->setButtonText(QWizard::CommitButton, label);
if (DeVSCompliance::isActive()) {
const bool de_vs = DeVSCompliance::isCompliant() && mWidget->isDeVsAndValid();
btn->setIcon(QIcon::fromTheme(de_vs
? QStringLiteral("security-high")
: QStringLiteral("security-medium")));
if (!SystemInfo::isHighContrastModeActive()) {
btn->setStyleSheet(QStringLiteral("QPushButton { background-color: %1; }").arg(de_vs
? KColorScheme(QPalette::Active, KColorScheme::View).background(KColorScheme::PositiveBackground).color().name()
: KColorScheme(QPalette::Active, KColorScheme::View).background(KColorScheme::NegativeBackground).color().name()));
}
DeVSCompliance::decorate(btn, de_vs);
mParent->setLabelText(de_vs
? i18nc("%1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant",
"%1 communication possible.", DeVSCompliance::name(true))
......
......@@ -493,14 +493,7 @@ public:
if (DeVSCompliance::isActive()) {
const bool de_vs = DeVSCompliance::isCompliant() && mSigEncWidget->isDeVsAndValid();
mCryptBtn->setIcon(QIcon::fromTheme(de_vs
? QStringLiteral("security-high")
: QStringLiteral("security-medium")));
if (!SystemInfo::isHighContrastModeActive()) {
mCryptBtn->setStyleSheet(QStringLiteral("QPushButton { background-color: %1; }").arg(de_vs
? KColorScheme(QPalette::Active, KColorScheme::View).background(KColorScheme::PositiveBackground).color().name()
: KColorScheme(QPalette::Active, KColorScheme::View).background(KColorScheme::NegativeBackground).color().name()));
}
DeVSCompliance::decorate(mCryptBtn, de_vs);
mAdditionalInfoLabel->setText(de_vs
? i18nc("%1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant",
"%1 communication possible.", DeVSCompliance::name(true))
......
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