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

Allow customization of name and email input field labels

This restores the customization possibility offered by the old wizard.

GnuPG-bug-id: 5832
parent 4b2cdc0e
......@@ -158,6 +158,20 @@ bool NameAndEmailWidget::nameIsRequired() const
return d->ui.nameInput->isRequired();
}
void NameAndEmailWidget::setNameLabel(const QString &label)
{
if (label.isEmpty()) {
d->ui.nameInput->setLabelText(i18nc("@label", "Name"));
} else {
d->ui.nameInput->setLabelText(label);
}
}
QString NameAndEmailWidget::nameLabel() const
{
return d->ui.nameInput->label()->text();
}
void NameAndEmailWidget::setNameHint(const QString &hint)
{
d->ui.nameInput->setHint(hint);
......@@ -198,6 +212,20 @@ bool NameAndEmailWidget::emailIsRequired() const
return d->ui.emailInput->isRequired();
}
void NameAndEmailWidget::setEmailLabel(const QString &label)
{
if (label.isEmpty()) {
d->ui.emailInput->setLabelText(i18nc("@label", "Email address"));
} else {
d->ui.emailInput->setLabelText(label);
}
}
QString NameAndEmailWidget::emailLabel() const
{
return d->ui.emailInput->label()->text();
}
void NameAndEmailWidget::setEmailHint(const QString &hint)
{
d->ui.emailInput->setHint(hint);
......
......@@ -29,6 +29,8 @@ public:
QString name() const;
void setNameIsRequired(bool required);
bool nameIsRequired() const;
void setNameLabel(const QString &label);
QString nameLabel() const;
void setNameHint(const QString &hint);
QString nameHint() const;
void setNamePattern(const QString &pattern);
......@@ -38,6 +40,8 @@ public:
QString email() const;
void setEmailIsRequired(bool required);
bool emailIsRequired() const;
void setEmailLabel(const QString &label);
QString emailLabel() const;
void setEmailHint(const QString &hint);
QString emailHint() const;
void setEmailPattern(const QString &pattern);
......
......@@ -125,9 +125,11 @@ public:
: i18n("Enter a name and/or an email address to use for the certificate."));
ui.nameAndEmail->setNameIsRequired(nameIsRequired);
ui.nameAndEmail->setNameLabel(config.readEntry("NAME_label"));
ui.nameAndEmail->setNameHint(config.readEntry("NAME_hint", config.readEntry("NAME_placeholder")));
ui.nameAndEmail->setNamePattern(config.readEntry("NAME_regex"));
ui.nameAndEmail->setEmailIsRequired(emailIsRequired);
ui.nameAndEmail->setEmailLabel(config.readEntry("EMAIL_label"));
ui.nameAndEmail->setEmailHint(config.readEntry("EMAIL_hint", config.readEntry("EMAIL_placeholder")));
ui.nameAndEmail->setEmailPattern(config.readEntry("EMAIL_regex"));
......
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