Added `editorKind' to BaseTextEditor::openEditorAt(). We need it to force the CPPEDITOR kind

when opening files from the C++ editor (e.g. when the user press F2 on #include <QMutex>).
This commit is contained in:
Roberto Raggi
2008-12-11 10:28:39 +01:00
parent 2890e3238b
commit f1e67fa3a3
4 changed files with 22 additions and 10 deletions

View File

@@ -128,12 +128,13 @@ protected:
ITextEditor *BaseTextEditor::openEditorAt(const QString &fileName,
int line,
int column)
int column,
const QString &editorKind)
{
Core::EditorManager *editorManager =
ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->editorManager();
editorManager->addCurrentPositionToNavigationHistory(true);
Core::IEditor *editor = editorManager->openEditor(fileName, QString(), true);
Core::IEditor *editor = editorManager->openEditor(fileName, editorKind, true);
TextEditor::ITextEditor *texteditor = qobject_cast<TextEditor::ITextEditor *>(editor);
if (texteditor) {
texteditor->gotoLine(line, column);
@@ -714,7 +715,7 @@ void BaseTextEditor::moveLineUpDown(bool up)
QString text = move.selectedText();
move.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor);
move.removeSelectedText();
if (up) {
move.movePosition(QTextCursor::PreviousBlock);
move.insertBlock();
@@ -729,7 +730,7 @@ void BaseTextEditor::moveLineUpDown(bool up)
move.insertBlock();
}
}
int start = move.position();
move.clearSelection();
move.insertText(text);
@@ -3376,7 +3377,7 @@ void BaseTextEditorPrivate::moveCursorVisible()
if (!cursor.block().isVisible()) {
cursor.setVisualNavigation(true);
cursor.movePosition(QTextCursor::PreviousBlock);
q->setTextCursor(cursor);
q->setTextCursor(cursor);
}
q->ensureCursorVisible();
}