EditorManager: Add NoNewSplits to OpenEditorFlags

This is used together with OpenInOtherSplit to suppress creation
of a new split if none are currently in use.

Change-Id: Ied97dcd6a756518bcf8bbe1d815cb2df9b872bfc
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Tobias Hunger
2014-03-05 17:44:16 +01:00
committed by Eike Ziller
parent c9b6897e78
commit f6f8e56cf1
2 changed files with 15 additions and 5 deletions

View File

@@ -1490,8 +1490,13 @@ Core::Id EditorManager::getOpenWithEditorId(const QString &fileName,
IEditor *EditorManager::openEditor(const QString &fileName, const Id &editorId, IEditor *EditorManager::openEditor(const QString &fileName, const Id &editorId,
OpenEditorFlags flags, bool *newEditor) OpenEditorFlags flags, bool *newEditor)
{ {
if (flags & EditorManager::OpenInOtherSplit) if (flags & EditorManager::OpenInOtherSplit) {
m_instance->gotoOtherSplit(); if (flags & EditorManager::NoNewSplits)
m_instance->gotoNextSplit();
else
m_instance->gotoOtherSplit();
}
return m_instance->openEditor(m_instance->currentEditorView(), return m_instance->openEditor(m_instance->currentEditorView(),
fileName, editorId, flags, newEditor); fileName, editorId, flags, newEditor);
} }
@@ -1663,8 +1668,12 @@ IEditor *EditorManager::openEditorWithContents(const Id &editorId,
if (debugEditorManager) if (debugEditorManager)
qDebug() << Q_FUNC_INFO << editorId.name() << titlePattern << contents; qDebug() << Q_FUNC_INFO << editorId.name() << titlePattern << contents;
if (flags & EditorManager::OpenInOtherSplit) if (flags & EditorManager::OpenInOtherSplit) {
m_instance->gotoOtherSplit(); if (flags & EditorManager::NoNewSplits)
m_instance->gotoNextSplit();
else
m_instance->gotoOtherSplit();
}
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));

View File

@@ -103,7 +103,8 @@ public:
IgnoreNavigationHistory = 2, IgnoreNavigationHistory = 2,
DoNotMakeVisible = 4, DoNotMakeVisible = 4,
CanContainLineNumber = 8, CanContainLineNumber = 8,
OpenInOtherSplit = 16 OpenInOtherSplit = 16,
NoNewSplits = 32
}; };
Q_DECLARE_FLAGS(OpenEditorFlags, OpenEditorFlag) Q_DECLARE_FLAGS(OpenEditorFlags, OpenEditorFlag)