forked from qt-creator/qt-creator
Core: Remove EditorManager::CanContainLineAndColumnNumber
In preparation of just supporting Utils::FilePath to open editors. Opening editors at specific locations is still supported via openEditorAt with Utils::Link, but the caller has first to parse the file name via Utils::Link::fromString. Change-Id: I17e5a28aeb50779cef9948fe72e37122d1020c50 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -243,9 +243,6 @@ void EditorManagerPlaceHolder::showEvent(QShowEvent *)
|
||||
opened editor.
|
||||
\value DoNotMakeVisible
|
||||
Does not force the editor to become visible.
|
||||
\value CanContainLineAndColumnNumber
|
||||
If the file path contains line and column numbers, opens
|
||||
the file in an editor and jumps to the line and column.
|
||||
\value OpenInOtherSplit
|
||||
Opens the document in another split of the window.
|
||||
\value DoNotSwitchToDesignMode
|
||||
@@ -3072,8 +3069,6 @@ IEditor *EditorManager::openEditor(const QString &fileName, Id editorId,
|
||||
OpenEditorFlags flags, bool *newEditor)
|
||||
{
|
||||
QFileInfo fi(fileName);
|
||||
if ((flags & CanContainLineAndColumnNumber) && !fi.exists())
|
||||
return openEditorAt(Link::fromString(fileName, true), editorId, flags, newEditor);
|
||||
return openEditor(FilePath::fromString(fileName), editorId, flags, newEditor);
|
||||
}
|
||||
|
||||
|
@@ -80,12 +80,11 @@ public:
|
||||
DoNotChangeCurrentEditor = 1,
|
||||
IgnoreNavigationHistory = 2,
|
||||
DoNotMakeVisible = 4,
|
||||
CanContainLineAndColumnNumber = 8,
|
||||
OpenInOtherSplit = 16,
|
||||
DoNotSwitchToDesignMode = 32,
|
||||
DoNotSwitchToEditMode = 64,
|
||||
SwitchSplitIfAlreadyVisible = 128,
|
||||
DoNotRaise = 256
|
||||
OpenInOtherSplit = 8,
|
||||
DoNotSwitchToDesignMode = 16,
|
||||
DoNotSwitchToEditMode = 32,
|
||||
SwitchSplitIfAlreadyVisible = 64,
|
||||
DoNotRaise = 128
|
||||
};
|
||||
Q_DECLARE_FLAGS(OpenEditorFlags, OpenEditorFlag)
|
||||
|
||||
|
@@ -900,14 +900,19 @@ IDocument *MainWindow::openFiles(const QStringList &fileNames,
|
||||
if (flags & ICore::SwitchMode)
|
||||
ModeManager::activateMode(Id(Constants::MODE_EDIT));
|
||||
}
|
||||
} else {
|
||||
} else if (flags & (ICore::SwitchSplitIfAlreadyVisible | ICore::CanContainLineAndColumnNumbers)
|
||||
|| !res) {
|
||||
QFlags<EditorManager::OpenEditorFlag> emFlags;
|
||||
if (flags & ICore::CanContainLineAndColumnNumbers)
|
||||
emFlags |= EditorManager::CanContainLineAndColumnNumber;
|
||||
if (flags & ICore::SwitchSplitIfAlreadyVisible)
|
||||
emFlags |= EditorManager::SwitchSplitIfAlreadyVisible;
|
||||
if (emFlags != EditorManager::NoFlags || !res) {
|
||||
IEditor *editor = EditorManager::openEditor(absoluteFilePath, Id(), emFlags);
|
||||
IEditor *editor = nullptr;
|
||||
if (flags & ICore::CanContainLineAndColumnNumbers) {
|
||||
const Link &link = Link::fromString(absoluteFilePath, true);
|
||||
editor = EditorManager::openEditorAt(link, {}, emFlags);
|
||||
} else {
|
||||
const FilePath &filePath = FilePath::fromString(absoluteFilePath);
|
||||
editor = EditorManager::openEditor(filePath, {}, emFlags);
|
||||
}
|
||||
if (!editor) {
|
||||
if (flags & ICore::StopOnLoadFail)
|
||||
return res;
|
||||
@@ -921,7 +926,6 @@ IDocument *MainWindow::openFiles(const QStringList &fileNames,
|
||||
factory ? factory->id() : Id());
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user