forked from qt-creator/qt-creator
EditorManager: add a flag for embedded linenumbers
And make use of it to accept on the command line the patterns: "filename" "+45", "filename" ":23", "filename:12" and "filename+42" Task-Nr: QTCREATORBUG-2428
This commit is contained in:
@@ -416,7 +416,7 @@ void MainWindow::dropEvent(QDropEvent *event)
|
||||
QStringList files;
|
||||
if (isDesktopFileManagerDrop(event->mimeData(), &files)) {
|
||||
event->accept();
|
||||
openFiles(files, true);
|
||||
openFiles(files, ICore::SwitchMode);
|
||||
} else {
|
||||
event->ignore();
|
||||
}
|
||||
@@ -793,7 +793,7 @@ void MainWindow::newFile()
|
||||
|
||||
void MainWindow::openFile()
|
||||
{
|
||||
openFiles(editorManager()->getOpenFileNames(), true);
|
||||
openFiles(editorManager()->getOpenFileNames(), ICore::SwitchMode);
|
||||
}
|
||||
|
||||
static QList<IFileFactory*> getNonEditorFileFactories()
|
||||
@@ -823,7 +823,7 @@ static IFileFactory *findFileFactory(const QList<IFileFactory*> &fileFactories,
|
||||
}
|
||||
|
||||
// opens either an editor or loads a project
|
||||
void MainWindow::openFiles(const QStringList &fileNames, bool switchMode)
|
||||
void MainWindow::openFiles(const QStringList &fileNames, ICore::OpenFilesFlags flags)
|
||||
{
|
||||
QList<IFileFactory*> nonEditorFileFactories = getNonEditorFileFactories();
|
||||
|
||||
@@ -832,13 +832,15 @@ void MainWindow::openFiles(const QStringList &fileNames, bool switchMode)
|
||||
const QString absoluteFilePath = fi.absoluteFilePath();
|
||||
if (IFileFactory *fileFactory = findFileFactory(nonEditorFileFactories, mimeDatabase(), fi)) {
|
||||
fileFactory->open(absoluteFilePath);
|
||||
if (switchMode)
|
||||
if (flags && ICore::SwitchMode)
|
||||
Core::ModeManager::instance()->activateMode(Core::Constants::MODE_EDIT);
|
||||
} else {
|
||||
EditorManager::OpenEditorFlag flags;
|
||||
if (switchMode)
|
||||
flags = EditorManager::ModeSwitch;
|
||||
editorManager()->openEditor(absoluteFilePath, QString(), flags);
|
||||
QFlags<EditorManager::OpenEditorFlag> emFlags;
|
||||
if (flags && ICore::SwitchMode)
|
||||
emFlags = EditorManager::ModeSwitch;
|
||||
if (flags && ICore::CanContainLineNumbers)
|
||||
emFlags |= EditorManager::CanContainLineNumber;
|
||||
editorManager()->openEditor(absoluteFilePath, QString(), emFlags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user