mirror of
https://invent.kde.org/graphics/okular
synced 2024-10-02 22:23:43 +00:00
Only show certificates that are still valid when signing
No point in letting people sign a file with a certificate that's no longer valid
This commit is contained in:
parent
6cf0ca2194
commit
bb97810957
|
@ -364,20 +364,27 @@ public:
|
|||
|
||||
QStringList items;
|
||||
QHash<QString, Okular::CertificateInfo *> nickToCert;
|
||||
const QDateTime now = QDateTime::currentDateTime();
|
||||
for (auto cert : certs) {
|
||||
items.append(cert->nickName());
|
||||
nickToCert[cert->nickName()] = cert;
|
||||
if (cert->validityStart() <= now && now <= cert->validityEnd()) {
|
||||
items.append(cert->nickName());
|
||||
nickToCert[cert->nickName()] = cert;
|
||||
}
|
||||
}
|
||||
|
||||
if (items.isEmpty()) {
|
||||
m_creationCompleted = false;
|
||||
clicked = false;
|
||||
KMessageBox::information(m_pageView,
|
||||
i18n("There are no available signing certificates.<br/>For more information, please see the section about <a href=\"%1\">Adding Digital Signatures</a> in the manual.",
|
||||
QStringLiteral("help:/okular/index.html#adding_digital_signatures")),
|
||||
QString(),
|
||||
QString(),
|
||||
KMessageBox::Notify | KMessageBox::AllowLink);
|
||||
if (certs.isEmpty()) {
|
||||
KMessageBox::information(m_pageView,
|
||||
i18n("There are no available signing certificates.<br/>For more information, please see the section about <a href=\"%1\">Adding Digital Signatures</a> in the manual.",
|
||||
QStringLiteral("help:/okular/index.html#adding_digital_signatures")),
|
||||
QString(),
|
||||
QString(),
|
||||
KMessageBox::Notify | KMessageBox::AllowLink);
|
||||
} else {
|
||||
KMessageBox::information(m_pageView, i18n("All your signing certificates are either not valid yet or are past their validity date."));
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue