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
2d281d8e
Commit
2d281d8e
authored
Jul 27, 2022
by
Ingo Klöcker
Browse files
Add helpers for accessible creation date and expiration date of subkeys
GnuPG-bug-id: 6104
parent
1be06ea6
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/utils/formatting.cpp
View file @
2d281d8e
...
...
@@ -611,10 +611,15 @@ QDate Formatting::expirationDate(const UserID::Signature &sig)
QString
Formatting
::
accessibleExpirationDate
(
const
Key
&
key
,
const
QString
&
noExpiration
)
{
if
(
key
.
subkey
(
0
).
neverExpires
())
{
return
accessibleExpirationDate
(
key
.
subkey
(
0
),
noExpiration
);
}
QString
Formatting
::
accessibleExpirationDate
(
const
Subkey
&
subkey
,
const
QString
&
noExpiration
)
{
if
(
subkey
.
neverExpires
())
{
return
noExpiration
.
isEmpty
()
?
i18n
(
"no expiration"
)
:
noExpiration
;
}
else
{
return
accessibleDate
(
expirationDate
(
key
));
return
accessibleDate
(
expirationDate
(
sub
key
));
}
}
...
...
@@ -653,6 +658,11 @@ QString Formatting::accessibleCreationDate(const Key &key)
return
accessibleDate
(
creationDate
(
key
));
}
QString
Formatting
::
accessibleCreationDate
(
const
Subkey
&
subkey
)
{
return
accessibleDate
(
creationDate
(
subkey
));
}
//
// Types
//
...
...
src/utils/formatting.h
View file @
2d281d8e
...
...
@@ -93,6 +93,12 @@ KLEO_EXPORT QDate expirationDate(const GpgME::UserID::Signature &sig);
* returns the localization of "no expiration".
*/
KLEO_EXPORT
QString
accessibleExpirationDate
(
const
GpgME
::
Key
&
key
,
const
QString
&
noExpiration
=
{});
/**
* Returns expiration date of @p subkey as string suitable for screen readers.
* If the subkey doesn't expire, then it returns @p noExpiration if @p noExpiration is not empty. Otherwise,
* returns the localization of "no expiration".
*/
KLEO_EXPORT
QString
accessibleExpirationDate
(
const
GpgME
::
Subkey
&
subkey
,
const
QString
&
noExpiration
=
{});
KLEO_EXPORT
QString
creationDateString
(
const
GpgME
::
Key
&
key
);
KLEO_EXPORT
QString
creationDateString
(
const
GpgME
::
Subkey
&
subkey
);
...
...
@@ -101,6 +107,7 @@ KLEO_EXPORT QDate creationDate(const GpgME::Key &key);
KLEO_EXPORT
QDate
creationDate
(
const
GpgME
::
Subkey
&
subkey
);
KLEO_EXPORT
QDate
creationDate
(
const
GpgME
::
UserID
::
Signature
&
sig
);
KLEO_EXPORT
QString
accessibleCreationDate
(
const
GpgME
::
Key
&
key
);
KLEO_EXPORT
QString
accessibleCreationDate
(
const
GpgME
::
Subkey
&
subkey
);
/* Convert a GPGME style time or a QDate to a localized string */
KLEO_EXPORT
QString
dateString
(
time_t
t
);
...
...
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