Commit 6158a4ca authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

VCS: Avoid repetitive calls to cleanupDescription in submit editor



It is called twice on each change to the text, and called again on
commit.

Change-Id: I8bfa2b37247a270f8b92e0b8a4e581278acf4cea
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 2a8fa557
......@@ -157,6 +157,7 @@ struct SubmitEditorWidgetPrivate
bool m_ignoreChange;
bool m_descriptionMandatory;
bool m_updateInProgress;
QString m_description;
QActionPushButton *m_submitButton;
};
......@@ -323,12 +324,7 @@ static QString wrappedText(const QTextEdit *e)
QString SubmitEditorWidget::descriptionText() const
{
QString rc = trimMessageText(lineWrap() ? wrappedText(d->m_ui.description) :
d->m_ui.description->toPlainText());
// append field entries
foreach (const SubmitFieldWidget *fw, d->m_fieldWidgets)
rc += fw->fieldValues();
return cleanupDescription(rc);
return d->m_description;
}
void SubmitEditorWidget::setDescriptionText(const QString &text)
......@@ -555,6 +551,12 @@ void SubmitEditorWidget::hideDescription()
void SubmitEditorWidget::descriptionTextChanged()
{
QString rc = trimMessageText(lineWrap() ? wrappedText(d->m_ui.description) :
d->m_ui.description->toPlainText());
// append field entries
foreach (const SubmitFieldWidget *fw, d->m_fieldWidgets)
rc += fw->fieldValues();
d->m_description = cleanupDescription(rc);
updateSubmitAction();
}
......@@ -562,7 +564,7 @@ bool SubmitEditorWidget::canSubmit() const
{
if (d->m_updateInProgress)
return false;
if (isDescriptionMandatory() && cleanupDescription(descriptionText()).trimmed().isEmpty())
if (isDescriptionMandatory() && d->m_description.trimmed().isEmpty())
return false;
const unsigned checkedCount = checkedFilesCount();
return d->m_emptyFileListEnabled || checkedCount > 0;
......
Markdown is supported
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