Commit df058c80 authored by Hugues Delorme's avatar Hugues Delorme

Bazaar,Mercurial: fix update of the commit button

There was a bug with the initial display of the submit editor.
The submit action was not disabled (description field is empty) and
thus the user was allowed to commit changes without entering a
description. Empty commit message causes error for most VCS (if not all).

Technically, Utils::SubmitEditorWidget::registerActions() must be called
before init of the widget (eg call to BazaarPlugin::setFields()), because
SubmitEditorWidget::updateActions() won't have any chance to be called.

Change-Id: I154d6c807e0943b98abcb6222d8f57ec5421181c
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
Reviewed-by: default avatarBill King <bill.king@nokia.com>
parent 0b67a513
......@@ -586,6 +586,11 @@ void BazaarPlugin::showCommitWidget(const QList<VCSBase::VCSBaseClient::StatusIt
return;
}
commitEditor->registerActions(m_editorUndo, m_editorRedo, m_editorCommit, m_editorDiff);
connect(commitEditor, SIGNAL(diffSelectedFiles(QStringList)),
this, SLOT(diffFromEditorSelected(QStringList)));
commitEditor->setCheckScriptWorkingDirectory(m_submitRepository);
const QString msg = tr("Commit changes for \"%1\".").
arg(QDir::toNativeSeparators(m_submitRepository));
commitEditor->setDisplayName(msg);
......@@ -593,11 +598,6 @@ void BazaarPlugin::showCommitWidget(const QList<VCSBase::VCSBaseClient::StatusIt
const BranchInfo branch = m_client->synchronousBranchQuery(m_submitRepository);
commitEditor->setFields(branch, m_bazaarSettings.stringValue(BazaarSettings::userNameKey),
m_bazaarSettings.stringValue(BazaarSettings::userEmailKey), status);
commitEditor->registerActions(m_editorUndo, m_editorRedo, m_editorCommit, m_editorDiff);
connect(commitEditor, SIGNAL(diffSelectedFiles(QStringList)),
this, SLOT(diffFromEditorSelected(QStringList)));
commitEditor->setCheckScriptWorkingDirectory(m_submitRepository);
}
void BazaarPlugin::diffFromEditorSelected(const QStringList &files)
......
......@@ -601,20 +601,19 @@ void MercurialPlugin::showCommitWidget(const QList<VCSBase::VCSBaseClient::Statu
QTC_ASSERT(qobject_cast<CommitEditor *>(editor), return)
CommitEditor *commitEditor = static_cast<CommitEditor *>(editor);
commitEditor->registerActions(editorUndo, editorRedo, editorCommit, editorDiff);
connect(commitEditor, SIGNAL(diffSelectedFiles(QStringList)),
this, SLOT(diffFromEditorSelected(QStringList)));
commitEditor->setCheckScriptWorkingDirectory(m_submitRepository);
const QString msg = tr("Commit changes for \"%1\".").
arg(QDir::toNativeSeparators(m_submitRepository));
commitEditor->setDisplayName(msg);
QString branch = m_client->branchQuerySync(m_submitRepository);
commitEditor->setFields(m_submitRepository, branch,
mercurialSettings.stringValue(MercurialSettings::userNameKey),
mercurialSettings.stringValue(MercurialSettings::userEmailKey), status);
commitEditor->registerActions(editorUndo, editorRedo, editorCommit, editorDiff);
connect(commitEditor, SIGNAL(diffSelectedFiles(QStringList)),
this, SLOT(diffFromEditorSelected(QStringList)));
commitEditor->setCheckScriptWorkingDirectory(m_submitRepository);
}
void MercurialPlugin::diffFromEditorSelected(const QStringList &files)
......
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