Commit e6f56087 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Move the key protocol to the window title

This saves some vertical space and it should improve accessibility
because the window title is announced first by screen readers and this
way the user "knows" as early as possible what information to expect in
the dialog.

GnuPG-bug-id: 5843
parent 806aa4e3
......@@ -21,7 +21,6 @@
CertificateDetailsDialog::CertificateDetailsDialog(QWidget *parent)
: QDialog(parent)
{
setWindowTitle(i18nc("@title:window", "Certificate Details"));
auto l = new QVBoxLayout(this);
auto w = new CertificateDetailsWidget{this};
w->layout()->setContentsMargins(0, 0, 0, 0);
......@@ -55,16 +54,29 @@ void CertificateDetailsDialog::writeConfig()
dialog.sync();
}
namespace
{
QString title(const GpgME::Key &key)
{
switch (key.protocol())
{
case GpgME::OpenPGP:
return i18nc("@title:window", "OpenPGP Certificate");
case GpgME::CMS:
return i18nc("@title:window", "S/MIME Certificate");
default:
return {};
}
}
}
void CertificateDetailsDialog::setKey(const GpgME::Key &key)
{
auto w = findChild<CertificateDetailsWidget*>();
Q_ASSERT(w);
w->setKey(key);
setWindowTitle(title(key));
findChild<CertificateDetailsWidget*>()->setKey(key);
}
GpgME::Key CertificateDetailsDialog::key() const
{
auto w = findChild<CertificateDetailsWidget*>();
Q_ASSERT(w);
return w->key();
return findChild<CertificateDetailsWidget*>()->key();
}
......@@ -252,7 +252,6 @@ private:
InfoField *validFromField = nullptr;
InfoField *expiresField = nullptr;
QAction *changeExpirationAction = nullptr;
InfoField *typeField = nullptr;
InfoField *fingerprintField = nullptr;
QAction *copyFingerprintAction = nullptr;
InfoField *smimeIssuerField = nullptr;
......@@ -349,11 +348,6 @@ private:
gridLayout->addWidget(expiresField->label(), boxRow, 0, 1, 1);
gridLayout->addLayout(expiresField->layout(), boxRow, 1, 1, 1);
boxRow++;
typeField = new InfoField{i18n("Type:"), parent};
gridLayout->addWidget(typeField->label(), boxRow, 0, 1, 1);
gridLayout->addLayout(typeField->layout(), boxRow, 1, 1, 1);
boxRow++;
fingerprintField = new InfoField{i18n("Fingerprint:"), parent};
if (QGuiApplication::clipboard()) {
......@@ -485,7 +479,6 @@ void CertificateDetailsWidget::Private::setupCommonProperties()
ui.validFromField->setValue(Formatting::creationDateString(key), Formatting::accessibleCreationDate(key));
ui.expiresField->setValue(Formatting::expirationDateString(key, i18nc("Expires", "never")),
Formatting::accessibleExpirationDate(key, i18nc("Expires", "never")));
ui.typeField->setValue(Kleo::Formatting::type(key));
ui.fingerprintField->setValue(Formatting::prettyID(key.primaryFingerprint()),
Formatting::accessibleHexID(key.primaryFingerprint()));
......
Supports Markdown
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