diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2014-06-22 12:55:14 +0300 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2014-06-23 15:29:55 +0200 |
commit | a6d8bbbb147f033167e47fc6fec8b442ade9aa7c (patch) | |
tree | 8abc5e9678bbf7f651b5e95c368737b6992a453f /src/plugins | |
parent | bbdd0655bc0a285e022587711d84ed02c7d4db48 (diff) | |
download | qt-creator-a6d8bbbb147f033167e47fc6fec8b442ade9aa7c.tar.gz |
VCS: Discard commit if submit widget is disabled
Change-Id: I8f11f56565f46919e93a30f754465de3bc44437e
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/git/gitplugin.cpp | 16 | ||||
-rw-r--r-- | src/plugins/git/gitsubmiteditor.cpp | 3 | ||||
-rw-r--r-- | src/plugins/git/gitsubmiteditor.h | 2 | ||||
-rw-r--r-- | src/plugins/vcsbase/vcsbasesubmiteditor.cpp | 3 |
4 files changed, 9 insertions, 15 deletions
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index f84a240868..668c06d910 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -1077,16 +1077,12 @@ bool GitPlugin::submitEditorAboutToClose() return true; // Prompt user. Force a prompt unless submit was actually invoked (that // is, the editor was closed or shutdown). - VcsBase::VcsBaseSubmitEditor::PromptSubmitResult answer; - if (editor->forceClose()) { - answer = VcsBase::VcsBaseSubmitEditor::SubmitDiscarded; - } else { - bool promptData = false; - answer = editor->promptSubmit(tr("Closing Git Editor"), - tr("Do you want to commit the change?"), - tr("Git will not accept this commit. Do you want to continue to edit it?"), - &promptData, !m_submitActionTriggered, false); - } + bool promptData = false; + const VcsBase::VcsBaseSubmitEditor::PromptSubmitResult answer + = editor->promptSubmit(tr("Closing Git Editor"), + tr("Do you want to commit the change?"), + tr("Git will not accept this commit. Do you want to continue to edit it?"), + &promptData, !m_submitActionTriggered, false); m_submitActionTriggered = false; switch (answer) { case VcsBase::VcsBaseSubmitEditor::SubmitCanceled: diff --git a/src/plugins/git/gitsubmiteditor.cpp b/src/plugins/git/gitsubmiteditor.cpp index a3b6a7454d..e35e298e88 100644 --- a/src/plugins/git/gitsubmiteditor.cpp +++ b/src/plugins/git/gitsubmiteditor.cpp @@ -90,7 +90,6 @@ GitSubmitEditor::GitSubmitEditor(const VcsBase::VcsBaseSubmitEditorParameters *p m_model(0), m_commitEncoding(0), m_commitType(SimpleCommit), - m_forceClose(false), m_firstUpdate(true) { connect(this, SIGNAL(diffSelectedFiles(QList<int>)), this, SLOT(slotDiffSelected(QList<int>))); @@ -186,14 +185,12 @@ void GitSubmitEditor::updateFileModel() QString errorMessage, commitTemplate; CommitData data(m_commitType); if (client->getCommitData(m_workingDirectory, &commitTemplate, data, &errorMessage)) { - m_forceClose = false; setCommitData(data); submitEditorWidget()->refreshLog(m_workingDirectory); widget()->setEnabled(true); } else { // Nothing to commit left! VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage); - m_forceClose = true; m_model->clear(); widget()->setEnabled(false); } diff --git a/src/plugins/git/gitsubmiteditor.h b/src/plugins/git/gitsubmiteditor.h index 45c2a5e87c..ed5b3924d7 100644 --- a/src/plugins/git/gitsubmiteditor.h +++ b/src/plugins/git/gitsubmiteditor.h @@ -53,7 +53,6 @@ public: void setCommitData(const CommitData &); GitSubmitEditorPanelData panelData() const; - bool forceClose() { updateFileModel(); return m_forceClose; } CommitType commitType() const { return m_commitType; } QString amendSHA1() const; @@ -78,7 +77,6 @@ private: QTextCodec *m_commitEncoding; CommitType m_commitType; QString m_amendSHA1; - bool m_forceClose; QString m_workingDirectory; bool m_firstUpdate; }; diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp index 6aa9b5f347..d8355f61d0 100644 --- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp +++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp @@ -547,6 +547,9 @@ VcsBaseSubmitEditor::PromptSubmitResult Core::EditorManager::activateEditor(this, Core::EditorManager::IgnoreNavigationHistory); + if (!submitWidget->isEnabled()) + return SubmitDiscarded; + QString errorMessage; QMessageBox::StandardButton answer = QMessageBox::Yes; |