forked from qt-creator/qt-creator
Git: Only enable submit button when a description is available
Only enable submit button in the git submit editor when a non-empty desciption of the patch is available. Git rejects empty commit messages and old versions fail without even giving an error Qt Creator can detect, so this should make commiting a bit more save. Task-number: QTCREATORBUG-2410
This commit is contained in:
@@ -172,6 +172,8 @@ SubmitEditorWidget::SubmitEditorWidget(QWidget *parent) :
|
||||
m_d->m_ui.description->setWordWrapMode(QTextOption::WordWrap);
|
||||
connect(m_d->m_ui.description, SIGNAL(customContextMenuRequested(QPoint)),
|
||||
this, SLOT(editorCustomContextMenuRequested(QPoint)));
|
||||
connect(m_d->m_ui.description, SIGNAL(textChanged()),
|
||||
this, SLOT(updateSubmitAction()));
|
||||
|
||||
// File List
|
||||
m_d->m_ui.fileView->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
@@ -291,11 +293,12 @@ static QString wrappedText(const QTextEdit *e)
|
||||
|
||||
QString SubmitEditorWidget::descriptionText() const
|
||||
{
|
||||
QString rc = trimMessageText(lineWrap() ? wrappedText(m_d->m_ui.description) : m_d->m_ui.description->toPlainText());
|
||||
QString rc = trimMessageText(lineWrap() ? wrappedText(m_d->m_ui.description) :
|
||||
m_d->m_ui.description->toPlainText());
|
||||
// append field entries
|
||||
foreach(const SubmitFieldWidget *fw, m_d->m_fieldWidgets)
|
||||
rc += fw->fieldValues();
|
||||
return rc;
|
||||
return cleanupDescription(rc);
|
||||
}
|
||||
|
||||
void SubmitEditorWidget::setDescriptionText(const QString &text)
|
||||
@@ -495,6 +498,11 @@ unsigned SubmitEditorWidget::checkedFilesCount() const
|
||||
return checkedCount;
|
||||
}
|
||||
|
||||
QString SubmitEditorWidget::cleanupDescription(const QString &input) const
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
void SubmitEditorWidget::changeEvent(QEvent *e)
|
||||
{
|
||||
QWidget::changeEvent(e);
|
||||
|
||||
Reference in New Issue
Block a user