Commit 7257004b authored by Justus Winter's avatar Justus Winter

Add and use function providing a short compliance string for keys

Include short compliance information in key lists and combo boxes.
Signed-off-by: default avatarJustus Winter <justus@gnupg.org>
parent e5d187fe
......@@ -192,8 +192,9 @@ public:
name = dn[QStringLiteral("CN")];
email = dn[QStringLiteral("EMAIL")];
}
return i18nc("Name <email> (type, created: date)", "%1 (%2, created: %3)",
return i18nc("Name <email> (validity, type, created: date)", "%1 (%2, %3, created: %4)",
email.isEmpty() ? name : name.isEmpty() ? email : i18nc("Name <email>", "%1 <%2>", name, email),
Kleo::Formatting::complianceStringShort(key),
key.protocol() == GpgME::OpenPGP ? i18n("OpenPGP") : i18n("S/MIME"),
Kleo::Formatting::creationDateString(key));
}
......
......@@ -781,8 +781,10 @@ QString Formatting::usageString(const Subkey &sub)
QString Formatting::summaryLine(const Key &key)
{
return keyToString(key) + QLatin1Char(' ') +
i18nc("First arg is the Key Protocol OpenPGP or S/MIME, second arg is the creation date.",
"(%1 - created: %2)", displayName(key.protocol()) ,
i18nc("(validity, protocol, creation date)",
"(%1, %2, created: %3)",
Formatting::complianceStringShort(key),
displayName(key.protocol()),
Formatting::creationDateString(key));
}
......@@ -878,3 +880,18 @@ QString Formatting::complianceStringForKey(const GpgME::Key &key)
}
return QString();
}
QString Formatting::complianceStringShort(const GpgME::Key &key)
{
if (Formatting::uidsHaveFullValidity(key)) {
if (complianceMode() == QStringLiteral("de-vs")
&& Formatting::isKeyDeVs(key)) {
return QStringLiteral("★ ") +
i18nc("VS-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-compliant");
}
return i18nc("As in all user IDs are valid.", "certified");
}
return i18nc("As in not all user IDs are valid.", "not certified");
}
......@@ -145,6 +145,11 @@ KLEO_EXPORT bool isKeyDeVs(const GpgME::Key &key);
/* A sentence if the key confirms to the current compliance mode */
KLEO_EXPORT QString complianceStringForKey(const GpgME::Key &key);
/* A single word for use in keylists to describe the validity of the
* given key, including any conformance statements relevant to the
* current conformance mode. */
KLEO_EXPORT QString complianceStringShort(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