forked from qt-creator/qt-creator
VCS: Clean up submit editor handling
It was not possible to simultaneously open two commit editors for different version control systems, also there was no reason to scan all open editors for the submit editor, since the plugins can just remember the editor that they opened. Change-Id: I1bea6ece3cd6faa1ecc0566bdd6f5fb10c816963 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -589,12 +589,12 @@ VcsBaseSubmitEditor::PromptSubmitResult
|
||||
const QString &checkFailureQuestion,
|
||||
bool *promptSetting,
|
||||
bool forcePrompt,
|
||||
bool canCommitOnFailure) const
|
||||
bool canCommitOnFailure)
|
||||
{
|
||||
SubmitEditorWidget *submitWidget =
|
||||
static_cast<SubmitEditorWidget *>(const_cast<VcsBaseSubmitEditor *>(this)->widget());
|
||||
SubmitEditorWidget *submitWidget = static_cast<SubmitEditorWidget *>(this->widget());
|
||||
|
||||
raiseSubmitEditor();
|
||||
Core::EditorManager::activateEditor(
|
||||
this, Core::EditorManager::IgnoreNavigationHistory | Core::EditorManager::ModeSwitch);
|
||||
|
||||
QString errorMessage;
|
||||
QMessageBox::StandardButton answer = QMessageBox::Yes;
|
||||
@@ -814,23 +814,4 @@ void VcsBaseSubmitEditor::filterUntrackedFilesOfProject(const QString &repositor
|
||||
}
|
||||
}
|
||||
|
||||
// Helper to raise an already open submit editor to prevent opening twice.
|
||||
bool VcsBaseSubmitEditor::raiseSubmitEditor()
|
||||
{
|
||||
// Nothing to do?
|
||||
if (Core::IEditor *ce = Core::EditorManager::currentEditor())
|
||||
if (qobject_cast<VcsBaseSubmitEditor*>(ce))
|
||||
return true;
|
||||
// Try to activate a hidden one
|
||||
Core::EditorManager *em = Core::EditorManager::instance();
|
||||
foreach (Core::IEditor *e, em->openedEditors()) {
|
||||
if (qobject_cast<VcsBaseSubmitEditor*>(e)) {
|
||||
Core::EditorManager::activateEditor(e,
|
||||
Core::EditorManager::IgnoreNavigationHistory | Core::EditorManager::ModeSwitch);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace VcsBase
|
||||
|
||||
Reference in New Issue
Block a user