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

Allow only plain text for label, hint, and error messages

GnuPG-bug-id: 5916
parent 95ee796e
......@@ -93,23 +93,23 @@ public:
const auto regexp = config.readEntry("NAME_regex");
if (regexp.isEmpty()) {
ui.nameInput->setValidator(Validation::simpleName(Validation::Optional, q));
ui.nameInput->setHint(i18n("Must not include <, >, and @."),
ui.nameInput->setHint(i18n("Must not include <, >, and @."),
i18nc("text for screen readers",
"Must not include less-than sign, greater-than sign, and at sign."));
ui.nameInput->setInvalidEntryErrorMessage(
i18n("Error: The name must not include &lt;, &gt;, and @."),
i18n("Error: The name must not include <, >, and @."),
i18nc("text for screen readers",
"Error: The name must not include less-than sign, greater-than sign, and at sign."));
} else {
ui.nameInput->setValidator(Validation::simpleName(regexp, Validation::Optional, q));
ui.nameInput->setHint(i18n("Must be in the format required by your organization and "
"must not include &lt;, &gt;, and @."),
"must not include <, >, and @."),
i18nc("text for screen readers",
"Must be in the format required by your organization and "
"must not include less-than sign, greater-than sign, and at sign."));
ui.nameInput->setInvalidEntryErrorMessage(
i18n("Error: The name must be in the format required by your organization and "
"it must not include &lt;, &gt;, and @."),
"it must not include <, >, and @."),
i18nc("text for screen readers",
"Error: The name must be in the format required by your organization and "
"it must not include less-than sign, greater-than sign, and at sign."));
......
......@@ -317,15 +317,18 @@ void FormTextInputBase::setWidget(QWidget *widget)
auto parent = widget ? widget->parentWidget() : nullptr;
d->mWidget = widget;
d->mLabel = new QLabel{parent};
d->mLabel->setTextFormat(Qt::PlainText);
QFont font = d->mLabel->font();
font.setBold(true);
d->mLabel->setFont(font);
d->mLabel->setBuddy(d->mWidget);
d->mHintLabel = new QLabel{parent};
d->mHintLabel->setTextFormat(Qt::PlainText);
// set widget as buddy of hint label, so that the label isn't considered unrelated
d->mHintLabel->setBuddy(d->mWidget);
d->mHintLabel->setVisible(false);
d->mErrorLabel = new ErrorLabel{parent};
d->mErrorLabel->setTextFormat(Qt::PlainText);
// set widget as buddy of error label, so that the label isn't considered unrelated
d->mErrorLabel->setBuddy(d->mWidget);
d->mErrorLabel->setVisible(false);
......
......@@ -55,7 +55,7 @@ public:
/**
* Sets \p text as text of the label and \p accessibleName as alternative
* text for assistive tools. If \p accessibleName is empty, then \p text is
* used instead.
* used instead. Both texts must be plain text.
*
* Note: If input is required, then the label is annotated appropriately.
*/
......@@ -64,7 +64,7 @@ public:
/**
* Sets \p text as hint text for this input field and \p accessibleDescription
* as alternative text for assistive tools. If \p accessibleDescription is
* empty, then \p text is used instead.
* empty, then \p text is used instead. Both texts must be plain text.
*/
void setHint(const QString &text, const QString &accessibleDescription = {});
......@@ -89,7 +89,7 @@ public:
/**
* Sets \p text as error message to display if a value is required for the
* input field, but if no value has been entered. If \p text is empty, then
* a default message will be used.
* a default message will be used. Both texts must be plain text.
* The optional \p accessibleText is used as alternative text for assistive
* tools.
*/
......@@ -99,7 +99,7 @@ public:
* Sets \p text as error message to display if the entered value is not accepted
* by the validator. If \p text is empty, then a default message will be used.
* The optional \p accessibleText is used as alternative text for assistive
* tools.
* tools. Both texts must be plain text.
*/
void setInvalidEntryErrorMessage(const QString &text, const QString &accessibleText = {});
......
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