Commit c9b6897e authored by Tobias Hunger's avatar Tobias Hunger Committed by Eike Ziller

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: default avatarEike Ziller <eike.ziller@digia.com>
parent d52ee686
......@@ -1530,7 +1530,6 @@ IEditor *ClearCasePlugin::showOutputInEditor(const QString& title, const QString
e->setSource(source);
if (codec)
e->setCodec(codec);
EditorManager::activateEditor(editor);
return editor;
}
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -1182,7 +1182,6 @@ IEditor *CvsPlugin::showOutputInEditor(const QString& title, const QString &outp
e->setSource(source);
if (codec)
e->setCodec(codec);
EditorManager::activateEditor(editor);
return editor;
}
......
......@@ -2542,9 +2542,9 @@ void DebuggerPluginPrivate::openTextEditor(const QString &titlePattern0,
return;
QString titlePattern = titlePattern0;
IEditor *editor = EditorManager::openEditorWithContents(
CC::K_DEFAULT_TEXT_EDITOR_ID, &titlePattern, contents.toUtf8());
CC::K_DEFAULT_TEXT_EDITOR_ID, &titlePattern, contents.toUtf8(),
EditorManager::IgnoreNavigationHistory);
QTC_ASSERT(editor, return);
EditorManager::activateEditor(editor, EditorManager::IgnoreNavigationHistory);
}
void DebuggerPluginPrivate::showMessage(const QString &msg, int channel, int timeout)
......
......@@ -316,10 +316,10 @@ void DisassemblerAgent::setContentsToEditor(const DisassemblerLines &contents)
qobject_cast<BaseTextEditorWidget *>(d->editor->widget());
if (baseTextEdit)
baseTextEdit->setRequestMarkEnabled(true);
} else {
EditorManager::activateEditor(d->editor);
}
EditorManager::activateEditor(d->editor);
QPlainTextEdit *plainTextEdit =
qobject_cast<QPlainTextEdit *>(d->editor->widget());
QTC_ASSERT(plainTextEdit, return);
......
......@@ -188,7 +188,6 @@ bool MemoryAgent::doCreateBinEditor(quint64 addr, unsigned flags,
MemoryView::setBinEditorRange(editorBinEditor, addr, MemoryAgent::DataRange, MemoryAgent::BinBlockSize);
MemoryView::setBinEditorMarkup(editorBinEditor, ml);
m_editors << editor;
EditorManager::activateEditor(editor);
return true;
}
......
......@@ -120,10 +120,10 @@ void SourceAgent::setContent(const QString &filePath, const QString &content)
qobject_cast<BaseTextEditorWidget *>(d->editor->widget());
if (baseTextEdit)
baseTextEdit->setRequestMarkEnabled(true);
} else {
EditorManager::activateEditor(d->editor);
}
EditorManager::activateEditor(d->editor);
QPlainTextEdit *plainTextEdit =
qobject_cast<QPlainTextEdit *>(d->editor->widget());
QTC_ASSERT(plainTextEdit, return);
......
......@@ -107,8 +107,6 @@ void DiffEditorPlugin::diff()
if (!editor)
return;
Core::EditorManager::activateEditor(editor);
const QString text1 = getFileContents(fileName1);
const QString text2 = getFileContents(fileName2);
......
......@@ -1140,7 +1140,6 @@ VcsBase::VcsBaseEditorWidget *GitClient::createVcsEditor(
}
rc->setForceReadOnly(true);
Core::EditorManager::activateEditor(outputEditor);
if (configWidget)
rc->setConfigurationWidget(configWidget);
......
......@@ -1194,7 +1194,6 @@ Core::IEditor *PerforcePlugin::showOutputInEditor(const QString &title, const QS
e->baseTextDocument()->setSuggestedFileName(s);
if (codec)
e->setCodec(codec);
Core::EditorManager::activateEditor(editor);
return editor;
}
......
......@@ -1036,7 +1036,6 @@ Core::IEditor *SubversionPlugin::showOutputInEditor(const QString &title, const
e->setSource(source);
if (codec)
e->setCodec(codec);
Core::EditorManager::activateEditor(editor);
return editor;
}
......
......@@ -574,6 +574,7 @@ VcsBase::VcsBaseEditorWidget *VcsBaseClient::createVcsEditor(Core::Id kind, QStr
outputEditor->document()->setContents(progressMsg.toUtf8());
baseEditor = VcsBase::VcsBaseEditorWidget::getVcsBaseEditor(outputEditor);
QTC_ASSERT(baseEditor, return 0);
Core::EditorManager::activateEditor(outputEditor);
} else {
outputEditor = Core::EditorManager::openEditorWithContents(kind, &title, progressMsg.toUtf8());
outputEditor->document()->setProperty(registerDynamicProperty, dynamicPropertyValue);
......@@ -587,7 +588,6 @@ VcsBase::VcsBaseEditorWidget *VcsBaseClient::createVcsEditor(Core::Id kind, QStr
}
baseEditor->setForceReadOnly(true);
Core::EditorManager::activateEditor(outputEditor);
return baseEditor;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment