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

@@ -485,7 +485,7 @@ void CPPEditor::jumpToDefinition()
unsigned lineno = tc.blockNumber() + 1;
foreach (const Document::Include &incl, doc->includes()) {
if (incl.line() == lineno) {
if (TextEditor::BaseTextEditor::openEditorAt(incl.fileName(), 0, 0))
if (openCppEditorAt(incl.fileName(), 0, 0))
return; // done
break;
}
@@ -525,7 +525,7 @@ void CPPEditor::jumpToDefinition()
QList<Symbol *> candidates = context.resolve(namedType->name());
if (!candidates.isEmpty()) {
Symbol *s = candidates.takeFirst();
openEditorAt(s->fileName(), s->line(), s->column());
openCppEditorAt(s->fileName(), s->line(), s->column());
}
#endif
}
@@ -534,7 +534,7 @@ void CPPEditor::jumpToDefinition()
if (use.contains(endOfName - 1)) {
const Macro &macro = use.macro();
const QString fileName = QString::fromUtf8(macro.fileName);
if (TextEditor::BaseTextEditor::openEditorAt(fileName, macro.line, 0))
if (openCppEditorAt(fileName, macro.line, 0))
return; // done
}
}
@@ -836,8 +836,15 @@ int CPPEditor::endOfNameUnderCursor()
return pos;
}
TextEditor::ITextEditor *CPPEditor::openCppEditorAt(const QString &fileName,
int line, int column)
{
return TextEditor::BaseTextEditor::openEditorAt(fileName, line, column,
Constants::C_CPPEDITOR);
}
bool CPPEditor::openEditorAt(Symbol *s)
{
const QString fileName = QString::fromUtf8(s->fileName(), s->fileNameLength());
return TextEditor::BaseTextEditor::openEditorAt(fileName, s->line(), s->column());
return openCppEditorAt(fileName, s->line(), s->column());
}