Fixes: Polish submit message checking.

Details: Use a global model for nicknames that is shared by all dialogs to solve the updating  problems. Make p4 plugin submit work again. Force a submit prompt in case of shutdown or editor close (as opposed to user clickling on "Submit").
This commit is contained in:
Friedemann Kleint
2009-03-20 10:16:18 +01:00
parent 79d6c96d4e
commit 927578ed55
12 changed files with 160 additions and 82 deletions

View File

@@ -142,7 +142,8 @@ GitPlugin::GitPlugin() :
m_coreListener(0),
m_submitEditorFactory(0),
m_versionControl(0),
m_changeTmpFile(0)
m_changeTmpFile(0),
m_submitActionTriggered(false)
{
m_instance = this;
}
@@ -651,6 +652,7 @@ Core::IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const Commit
void GitPlugin::submitCurrentLog()
{
// Close the submit editor
m_submitActionTriggered = true;
QList<Core::IEditor*> editors;
editors.push_back(m_core->editorManager()->currentEditor());
m_core->editorManager()->closeEditors(editors);
@@ -672,11 +674,14 @@ bool GitPlugin::editorAboutToClose(Core::IEditor *iEditor)
// Paranoia!
if (editorFile.absoluteFilePath() != changeFile.absoluteFilePath())
return true;
// Prompt user.
// Prompt user. Force a prompt unless submit was actually invoked (that
// is, the editor was closed or shutdown).
const VCSBase::VCSBaseSubmitEditor::PromptSubmitResult answer =
editor->promptSubmit(tr("Closing git editor"),
tr("Do you want to commit the change?"),
tr("The commit message check failed. Do you want to commit the change?"));
tr("The commit message check failed. Do you want to commit the change?"),
!m_submitActionTriggered);
m_submitActionTriggered = false;
switch (answer) {
case VCSBase::VCSBaseSubmitEditor::SubmitCanceled:
return false; // Keep editing and change file

View File

@@ -171,6 +171,7 @@ private:
QString m_submitRepository;
QStringList m_submitOrigCommitFiles;
QTemporaryFile *m_changeTmpFile;
bool m_submitActionTriggered;
};
} // namespace Git

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>201</width>
<height>189</height>
<width>374</width>
<height>229</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@@ -59,26 +59,43 @@
<property name="title">
<string>Commit Information</string>
</property>
<layout class="QFormLayout" name="editFormLayout">
<item row="0" column="0">
<widget class="QLabel" name="authorLabel">
<property name="text">
<string>Author:</string>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="authorLabel">
<property name="text">
<string>Author:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="authorLineEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="emailLabel">
<property name="text">
<string>Email:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="emailLineEdit"/>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="authorLineEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="emailLabel">
<property name="text">
<string>Email:</string>
<property name="sizeHint" stdset="0">
<size>
<width>161</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="emailLineEdit"/>
</spacer>
</item>
</layout>
</widget>