Commit 38582b8b authored by Harald Sitter's avatar Harald Sitter 🏳️‍🌈
Browse files

move UI setup logic out of checkTexts

it has no business being there, it is... not checking text.

specifically this resolves a problem whereby the new initial focus
setting was switching focus while the user types.

  "thou shall not covet thy neighbor's focus"

CHANGELOG: input focus is no longer dancing tango with two text fields
BUG: 433480
FIXED-IN: 5.21.3
parent 454baf7e
......@@ -383,6 +383,18 @@ void BugzillaInformationPage::aboutToShow()
}
ui.m_detailsEdit->setText(descriptionTemplate);
}
// If attaching this report to an existing one then the title is not needed
bool showTitle = (reportInterface()->attachToBugNumber() == 0);
ui.m_titleEdit->setVisible(showTitle);
ui.m_titleLabel->setVisible(showTitle);
// Force focus on the first input field for ease of use.
// https://bugs.kde.org/show_bug.cgi?id=428350
if (showTitle) {
ui.m_titleEdit->setFocus();
} else {
ui.m_detailsEdit->setFocus();
}
checkTexts(); // May be the options (canDetail) changed and we need to recheck
}
......@@ -405,19 +417,6 @@ int BugzillaInformationPage::currentDescriptionCharactersCount()
void BugzillaInformationPage::checkTexts()
{
// If attaching this report to an existing one then the title is not needed
bool showTitle = (reportInterface()->attachToBugNumber() == 0);
ui.m_titleEdit->setVisible(showTitle);
ui.m_titleLabel->setVisible(showTitle);
// Force focus on the first input field for ease of use.
// https://bugs.kde.org/show_bug.cgi?id=428350
if (showTitle) {
ui.m_titleEdit->setFocus();
} else {
ui.m_detailsEdit->setFocus();
}
bool ok = !((ui.m_titleEdit->isVisible() && ui.m_titleEdit->text().isEmpty()) || ui.m_detailsEdit->toPlainText().isEmpty());
QString message;
......
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