EditorManager: Add OpenEditorFlags to openEditorWithContents

This requires moving the activateEditor call into openEditorWithContents.

Remove that line elsewhere when editors are constructed. Keep it when
reusing an existing editor though.

Change-Id: I872f03e16fde42f3b8adec2cf2344b7cc495cd08
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Tobias Hunger
2014-03-06 15:44:13 +01:00
committed by Eike Ziller
parent d52ee686d1
commit c9b6897e78
13 changed files with 16 additions and 18 deletions

View File

@@ -1657,11 +1657,15 @@ QStringList EditorManager::getOpenFileNames()
IEditor *EditorManager::openEditorWithContents(const Id &editorId,
QString *titlePattern,
const QByteArray &contents)
const QByteArray &contents,
OpenEditorFlags flags)
{
if (debugEditorManager)
qDebug() << Q_FUNC_INFO << editorId.name() << titlePattern << contents;
if (flags & EditorManager::OpenInOtherSplit)
m_instance->gotoOtherSplit();
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
QString title;
@@ -1712,6 +1716,7 @@ IEditor *EditorManager::openEditorWithContents(const Id &editorId,
m_instance->addEditor(edt);
QApplication::restoreOverrideCursor();
activateEditor(edt, flags);
return edt;
}

View File

@@ -113,8 +113,9 @@ public:
static IEditor *openEditorAt(const QString &fileName, int line, int column = 0,
const Id &editorId = Id(), OpenEditorFlags flags = NoFlags,
bool *newEditor = 0);
static IEditor *openEditorWithContents(const Id &editorId,
QString *titlePattern = 0, const QByteArray &contents = QByteArray());
static IEditor *openEditorWithContents(const Id &editorId, QString *titlePattern = 0,
const QByteArray &contents = QByteArray(),
OpenEditorFlags flags = NoFlags);
static bool openExternalEditor(const QString &fileName, const Id &editorId);