VCS: Add reason text when submit validation fails

Change-Id: If4c8d5d1d5dc5386e49b29be59786dc53cfaaaa3
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
This commit is contained in:
Orgad Shaneh
2018-11-09 09:55:43 +02:00
committed by Orgad Shaneh
parent 3666e3aaeb
commit 96529a27c5
5 changed files with 32 additions and 12 deletions

View File

@@ -532,14 +532,23 @@ void SubmitEditorWidget::descriptionTextChanged()
updateSubmitAction();
}
bool SubmitEditorWidget::canSubmit() const
bool SubmitEditorWidget::canSubmit(QString *whyNot) const
{
if (d->m_updateInProgress)
if (d->m_updateInProgress) {
if (whyNot)
*whyNot = tr("Update in progress");
return false;
if (isDescriptionMandatory() && d->m_description.trimmed().isEmpty())
}
if (isDescriptionMandatory() && d->m_description.trimmed().isEmpty()) {
if (whyNot)
*whyNot = tr("Description is empty");
return false;
}
const unsigned checkedCount = checkedFilesCount();
return d->m_emptyFileListEnabled || checkedCount > 0;
const bool res = d->m_emptyFileListEnabled || checkedCount > 0;
if (!res && whyNot)
*whyNot = tr("No files checked");
return res;
}
void SubmitEditorWidget::setUpdateInProgress(bool value)