Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
libkleo
Commits
1f46bc24
Commit
1f46bc24
authored
Jul 13, 2022
by
Ingo Klöcker
Browse files
Replace Formatting::deVsString with DeVSCompliance::name
GnuPG-bug-id: 6073
parent
c0179b08
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/ui/newkeyapprovaldialog.cpp
View file @
1f46bc24
...
...
@@ -856,11 +856,11 @@ public:
if
(
de_vs
)
{
mComplianceLbl
->
setText
(
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
(
)));
DeVSCompliance
::
name
(
true
)));
}
else
{
mComplianceLbl
->
setText
(
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
(
)));
DeVSCompliance
::
name
(
true
)));
}
mComplianceLbl
->
setVisible
(
true
);
}
...
...
src/utils/compliance.cpp
View file @
1f46bc24
...
...
@@ -16,7 +16,10 @@
#include
"gnupg.h"
#include
"systeminfo.h"
#include
<libkleo/keyfiltermanager.h>
#include
<KColorScheme>
#include
<KLocalizedString>
#include
<QPushButton>
...
...
@@ -66,3 +69,17 @@ void Kleo::DeVSCompliance::decorate(QPushButton *button, bool compliant)
}
}
}
QString
Kleo
::
DeVSCompliance
::
name
()
{
return
name
(
isCompliant
());
}
QString
Kleo
::
DeVSCompliance
::
name
(
bool
compliant
)
{
const
auto
filterId
=
compliant
?
QStringLiteral
(
"de-vs-filter"
)
:
QStringLiteral
(
"not-de-vs-filter"
);
if
(
auto
filter
=
KeyFilterManager
::
instance
()
->
keyFilterByID
(
filterId
))
{
return
filter
->
name
();
}
return
compliant
?
i18n
(
"VS-NfD compliant"
)
:
i18n
(
"Not VS-NfD compliant"
);
}
src/utils/compliance.h
View file @
1f46bc24
...
...
@@ -13,6 +13,7 @@
#include
"kleo_export.h"
class
QPushButton
;
class
QString
;
namespace
Kleo
::
DeVSCompliance
{
...
...
@@ -46,4 +47,22 @@ KLEO_EXPORT void decorate(QPushButton *button);
*/
KLEO_EXPORT
void
decorate
(
QPushButton
*
button
,
bool
compliant
);
/**
* \overload
*
* Returns a localized name for the compliance or non-compliance depending on
* the state of compliance.
*/
KLEO_EXPORT
QString
name
();
/**
* Returns a localized name for the compliance or non-compliance depending on
* the value of \p compliant.
*
* \note The localized name is taken from the de-vs-filter filter resp. the
* not-de-vs-filter. This allows the customization of the name for different
* users because VS-NfD compliance is called differently in different
* environments, e.g. NATO RESTRICTED or EU RESTRICTED.
*/
KLEO_EXPORT
QString
name
(
bool
compliant
);
}
src/utils/formatting.cpp
View file @
1f46bc24
...
...
@@ -19,7 +19,6 @@
#include
<libkleo/dn.h>
#include
<libkleo/keycache.h>
#include
<libkleo/keyfiltermanager.h>
#include
<libkleo/keygroup.h>
#include
<KEmailAddress>
...
...
@@ -1159,13 +1158,13 @@ QString Formatting::complianceStringForKey(const GpgME::Key &key)
if
(
uidsHaveFullValidity
(
key
)
&&
isKeyDeVs
(
key
))
{
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."
,
d
eV
sString
(
));
D
eV
SCompliance
::
name
(
true
));
}
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 %1 communication."
,
d
eV
sString
(
));
D
eV
SCompliance
::
name
(
true
));
}
}
return
QString
();
...
...
@@ -1176,7 +1175,7 @@ QString Formatting::complianceStringShort(const GpgME::Key &key)
const
bool
keyValidityChecked
=
(
key
.
keyListMode
()
&
GpgME
::
Validate
);
if
(
keyValidityChecked
&&
Formatting
::
uidsHaveFullValidity
(
key
))
{
if
(
DeVSCompliance
::
isCompliant
()
&&
Formatting
::
isKeyDeVs
(
key
))
{
return
QStringLiteral
(
"★ "
)
+
d
eV
sString
(
true
);
return
QStringLiteral
(
"★ "
)
+
D
eV
SCompliance
::
name
(
true
);
}
return
i18nc
(
"As in all user IDs are valid."
,
"certified"
);
}
...
...
@@ -1261,11 +1260,7 @@ QString Formatting::origin(int o)
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
();
return
DeVSCompliance
::
name
(
compliant
);
}
namespace
...
...
src/utils/formatting.h
View file @
1f46bc24
...
...
@@ -154,14 +154,11 @@ KLEO_DEPRECATED_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 environments. E.g NATO RESTRICTED or
* EU RESTRICTED. */
KLEO_EXPORT
QString
deVsString
(
bool
compliant
=
true
);
/**
* Use Kleo::DeVSCompliance::name(bool) instead.
*/
KLEO_DEPRECATED_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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment