Unverified Commit 80d602a6 authored by Andre Heinecke's avatar Andre Heinecke
Browse files

Take compliance mode name from libkleopatrarc

GnuPG is starting to get "compliance mode" users outside
of the German Government. As the approval for restricted
communication is also for NATO RESTRICTED and EU RESTRICTED
different users need to see different strings for the
mode.

The solution is now to use the names of the key filters already
defined in libkleopatrarc so that the string can be
changed through config.
parent 43374598
Pipeline #30302 passed with stage
in 8 minutes and 54 seconds
cmake_minimum_required(VERSION 3.5)
set(PIM_VERSION "5.15.40")
set(PIM_VERSION "5.15.41")
project(libkleo VERSION ${PIM_VERSION})
......
......@@ -575,6 +575,7 @@ Name[zh_TW]=X509 憑證
# de-vs
[Key Filter #10]
is-de-vs=true
id=de-vs-filter
Name=VS-NfD Compliant
Name[ca]=Compatible amb VS-NfD
Name[ca@valencia]=Compatible amb VS-NfD
......@@ -604,6 +605,7 @@ background-color=213,250,226
[Key Filter #11]
is-de-vs=false
id=not-de-vs-filter
Name=Not VS-NfD Compliant
Name[ca]=No compatible amb VS-NfD
Name[ca@valencia]=No compatible amb VS-NfD
......
......@@ -692,10 +692,10 @@ public:
? QStringLiteral("#D5FAE2") // KColorScheme(QPalette::Active, KColorScheme::View).background(KColorScheme::PositiveBackground).color().name()
: QStringLiteral("#FAE9EB"))); //KColorScheme(QPalette::Active, KColorScheme::View).background(KColorScheme::NegativeBackground).color().name()));
mComplianceLbl->setText(de_vs
? i18nc("VS-NfD-conforming is a German standard for restricted documents for which special restrictions about algorithms apply. The string states that all cryptographic operations necessary for the communication are compliant with that.",
"VS-NfD-compliant communication possible.")
: i18nc("VS-NfD-conforming is a German standard for restricted documents for which special restrictions about algorithms apply. The string states that all cryptographic operations necessary for the communication are compliant with that.",
"VS-NfD-compliant communication not possible."));
? i18nc("%1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant",
"%1 communication possible.", Formatting::deVsString())
: i18nc("%1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant",
"%1 communication not possible.", Formatting::deVsString()));
mComplianceLbl->setVisible(true);
}
......
......@@ -33,6 +33,7 @@
#include "formatting.h"
#include "kleo/dn.h"
#include "kleo/keyfiltermanager.h"
#include <gpgme++/key.h>
#include <gpgme++/importresult.h>
......@@ -999,11 +1000,11 @@ QString Formatting::complianceStringForKey(const GpgME::Key &key)
// for now we only have DE-VS
if (complianceMode() == QLatin1String("de-vs")) {
if (uidsHaveFullValidity(key) && isKeyDeVs(key)) {
return i18nc("VS-NfD conforming is a German standard for restricted documents. For which special restrictions about algorithms apply. The string describes if a key is compliant with that..",
"May be used for VS-NfD-compliant communication.");
return i18nc("%1 is a placeholder for the name of a compliance mode. E.g. NATO RESTRICTED compliant or VS-NfD compliant",
"May be used for %1 communication.", deVsString());
} else {
return i18nc("VS-NfD-conforming is a German standard for restricted documents. For which special restrictions about algorithms apply. The string describes if a key is compliant to that..",
"May <b>not</b> be used for VS-NfD-compliant communication.");
"May <b>not</b> be used for %1 communication.", deVsString());
}
}
return QString();
......@@ -1014,9 +1015,7 @@ QString Formatting::complianceStringShort(const GpgME::Key &key)
if (Formatting::uidsHaveFullValidity(key)) {
if (complianceMode() == QLatin1String("de-vs")
&& Formatting::isKeyDeVs(key)) {
return QStringLiteral("★ ") +
i18nc("VS-NfD-conforming is a German standard for restricted documents for which special restrictions about algorithms apply. The string states that a key is compliant with that.",
"VS-NfD-compliant");
return QStringLiteral("★ ") + deVsString(true);
}
return i18nc("As in all user IDs are valid.", "certified");
}
......@@ -1072,3 +1071,14 @@ QString Formatting::origin(int o)
return i18n("Unknown");
}
}
QString Formatting::deVsString(bool compliant)
{
const auto filter = KeyFilterManager::instance()->keyFilterByID(compliant ?
QStringLiteral("de-vs-filter") :
QStringLiteral("not-de-vs-filter"));
if (!filter) {
return compliant ? i18n("VS-NfD compliant") : i18n("Not VS-NfD compliant");
}
return filter->name();
}
......@@ -150,6 +150,14 @@ KLEO_EXPORT QString complianceMode();
/* Is the given key in compliance with CO_DE_VS? */
KLEO_EXPORT bool isKeyDeVs(const GpgME::Key &key);
/* Localized string describing the name of the VS-NfD Compliance filter. If
* compliant is false the name of the not Compliant filter.
*
* This is required to make the string configurable which is
* a common request from users because VS-NfD compliance is called
* differently in different enviornments. E.g NATO RESTRICTED or
* EU RESTRICTED. */
KLEO_EXPORT QString deVsString (bool compliant = true);
/* A sentence if the key confirms to the current compliance mode */
KLEO_EXPORT QString complianceStringForKey(const GpgME::Key &key);
......
Markdown is supported
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