VCS: Clear commit message hint when editor becomes disabled

The commit editor becomes disabled, when no more
changed files were available. In this case, the
commit message verification makes no sense and
should be removed.

Change-Id: Ic16cc4ade1ecd1b64faee52b21a10b9c882908d0
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Andre Hartmann
2021-07-27 09:13:26 +02:00
committed by André Hartmann
parent 3edc5822da
commit 0e8756508c
2 changed files with 13 additions and 0 deletions

View File

@@ -435,6 +435,12 @@ void SubmitEditorWidget::updateSubmitAction()
} }
} }
void SubmitEditorWidget::changeEvent(QEvent *event)
{
if (event->type() == QEvent::EnabledChange)
verifyDescription();
}
// Enable diff depending on selected files // Enable diff depending on selected files
void SubmitEditorWidget::updateDiffAction() void SubmitEditorWidget::updateDiffAction()
{ {
@@ -506,6 +512,12 @@ void SubmitEditorWidget::hideDescription()
void SubmitEditorWidget::verifyDescription() void SubmitEditorWidget::verifyDescription()
{ {
if (!isEnabled()) {
d->m_ui.descriptionHint->setText(QString());
d->m_ui.descriptionHint->setToolTip(QString());
return;
}
auto fontColor = [](Utils::Theme::Color color) { auto fontColor = [](Utils::Theme::Color color) {
return QString("<font color=\"%1\">") return QString("<font color=\"%1\">")
.arg(Utils::creatorTheme()->color(color).name()); .arg(Utils::creatorTheme()->color(color).name());

View File

@@ -111,6 +111,7 @@ signals:
void submitActionEnabledChanged(bool); void submitActionEnabledChanged(bool);
protected: protected:
virtual void changeEvent(QEvent *event) override;
virtual QString cleanupDescription(const QString &) const; virtual QString cleanupDescription(const QString &) const;
virtual QString commitName() const; virtual QString commitName() const;
void insertTopWidget(QWidget *w); void insertTopWidget(QWidget *w);