diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp index c07c0a5f11d..0d19af47965 100644 --- a/src/plugins/bookmarks/bookmarkmanager.cpp +++ b/src/plugins/bookmarks/bookmarkmanager.cpp @@ -489,8 +489,7 @@ Bookmark *BookmarkManager::bookmarkForIndex(const QModelIndex &index) const bool BookmarkManager::gotoBookmark(const Bookmark *bookmark) const { - if (IEditor *editor = EditorManager::openEditorAt(bookmark->fileName().toString(), - bookmark->lineNumber())) + if (IEditor *editor = EditorManager::openEditorAt(bookmark->fileName(), bookmark->lineNumber())) return editor->currentLine() == bookmark->lineNumber(); return false; } diff --git a/src/plugins/clangcodemodel/test/clangdtests.cpp b/src/plugins/clangcodemodel/test/clangdtests.cpp index 5380e11ac68..4c109c888a9 100644 --- a/src/plugins/clangcodemodel/test/clangdtests.cpp +++ b/src/plugins/clangcodemodel/test/clangdtests.cpp @@ -137,16 +137,14 @@ void ClangdTests::testFindReferences() }; const auto headerPath = Utils::FilePath::fromString(testDir.absolutePath("defs.h")); QVERIFY2(headerPath.exists(), qPrintable(headerPath.toUserOutput())); - QScopedPointer headerEditor( - EditorManager::openEditor(headerPath.toString())); + QScopedPointer headerEditor(EditorManager::openEditor(headerPath)); QVERIFY(headerEditor); const auto headerDoc = qobject_cast(headerEditor->document()); QVERIFY(headerDoc); QVERIFY(client->documentForFilePath(headerPath) == headerDoc); const auto cppFilePath = Utils::FilePath::fromString(testDir.absolutePath("main.cpp")); QVERIFY2(cppFilePath.exists(), qPrintable(cppFilePath.toUserOutput())); - QScopedPointer cppFileEditor( - EditorManager::openEditor(cppFilePath.toString())); + QScopedPointer cppFileEditor(EditorManager::openEditor(cppFilePath)); QVERIFY(cppFileEditor); const auto cppDoc = qobject_cast(cppFileEditor->document()); QVERIFY(cppDoc); diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index e0a3ffe3b7a..5c51e6635ff 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -740,19 +740,19 @@ EditorArea *EditorManagerPrivate::mainEditorArea() return d->m_editorAreas.at(0); } -bool EditorManagerPrivate::skipOpeningBigTextFile(const QString &filePath) +bool EditorManagerPrivate::skipOpeningBigTextFile(const FilePath &filePath) { if (!d->m_settings.warnBeforeOpeningBigFilesEnabled) return false; - if (!QFileInfo::exists(filePath)) + if (!filePath.exists()) return false; - Utils::MimeType mimeType = Utils::mimeTypeForFile(filePath); + Utils::MimeType mimeType = Utils::mimeTypeForFile(filePath.toString()); if (!mimeType.inherits("text/plain")) return false; - const QFileInfo fileInfo(filePath); + const QFileInfo fileInfo = filePath.toFileInfo(); const qint64 fileSize = fileInfo.size(); const double fileSizeInMB = fileSize / 1000.0 / 1000.0; if (fileSizeInMB > d->m_settings.bigFileSizeLimitInMB @@ -782,13 +782,13 @@ bool EditorManagerPrivate::skipOpeningBigTextFile(const QString &filePath) return false; } -IEditor *EditorManagerPrivate::openEditor(EditorView *view, const QString &fileName, Id editorId, +IEditor *EditorManagerPrivate::openEditor(EditorView *view, const FilePath &filePath, Id editorId, EditorManager::OpenEditorFlags flags, bool *newEditor) { if (debugEditorManager) - qDebug() << Q_FUNC_INFO << fileName << editorId.name(); + qDebug() << Q_FUNC_INFO << filePath << editorId.name(); - QString fn = fileName; + QString fn = filePath.toString(); QFileInfo fi(fn); int lineNumber = -1; int columnNumber = -1; @@ -803,7 +803,7 @@ IEditor *EditorManagerPrivate::openEditor(EditorView *view, const QString &fileN if (fn.isEmpty()) return nullptr; - if (fn != fileName) + if (fn != filePath.toString()) fi.setFile(fn); if (newEditor) @@ -855,7 +855,7 @@ IEditor *EditorManagerPrivate::openEditor(EditorView *view, const QString &fileN } } - if (skipOpeningBigTextFile(fileName)) + if (skipOpeningBigTextFile(filePath)) return nullptr; IEditor *editor = nullptr; @@ -952,26 +952,25 @@ IEditor *EditorManagerPrivate::openEditor(EditorView *view, const QString &fileN return result; } -IEditor *EditorManagerPrivate::openEditorAt(EditorView *view, const QString &fileName, int line, +IEditor *EditorManagerPrivate::openEditorAt(EditorView *view, const FilePath &filePath, int line, int column, Id editorId, EditorManager::OpenEditorFlags flags, bool *newEditor) { EditorManager::cutForwardNavigationHistory(); EditorManager::addCurrentPositionToNavigationHistory(); EditorManager::OpenEditorFlags tempFlags = flags | EditorManager::IgnoreNavigationHistory; - IEditor *editor = openEditor(view, fileName, editorId, tempFlags, newEditor); + IEditor *editor = openEditor(view, filePath, editorId, tempFlags, newEditor); if (editor && line != -1) editor->gotoLine(line, column); return editor; } -IEditor *EditorManagerPrivate::openEditorWith(const QString &fileName, Utils::Id editorId) +IEditor *EditorManagerPrivate::openEditorWith(const FilePath &filePath, Id editorId) { // close any open editors that have this file open // remember the views to open new editors in there QList views; - QList editorsOpenForFile = DocumentModel::editorsForFilePath( - FilePath::fromString(fileName)); + QList editorsOpenForFile = DocumentModel::editorsForFilePath(filePath); foreach (IEditor *openEditor, editorsOpenForFile) { EditorView *view = EditorManagerPrivate::viewForEditor(openEditor); if (view && view->currentEditor() == openEditor) // visible @@ -982,7 +981,7 @@ IEditor *EditorManagerPrivate::openEditorWith(const QString &fileName, Utils::Id IEditor *openedEditor = nullptr; if (views.isEmpty()) { - openedEditor = EditorManager::openEditor(fileName, editorId); + openedEditor = EditorManager::openEditor(filePath, editorId); } else { if (EditorView *currentView = EditorManagerPrivate::currentEditorView()) { if (views.removeOne(currentView)) @@ -990,7 +989,7 @@ IEditor *EditorManagerPrivate::openEditorWith(const QString &fileName, Utils::Id } EditorManager::OpenEditorFlags flags; foreach (EditorView *view, views) { - IEditor *editor = EditorManagerPrivate::openEditor(view, fileName, editorId, flags); + IEditor *editor = EditorManagerPrivate::openEditor(view, filePath, editorId, flags); if (!openedEditor && editor) openedEditor = editor; // Do not change the current editor after opening the first one. That @@ -1592,7 +1591,7 @@ bool EditorManagerPrivate::activateEditorForEntry(EditorView *view, DocumentMode return editor != nullptr; } - if (!openEditor(view, entry->fileName().toString(), entry->id(), flags)) { + if (!openEditor(view, entry->fileName(), entry->id(), flags)) { DocumentModelPrivate::removeEntry(entry); return false; } @@ -2932,7 +2931,7 @@ void EditorManager::populateOpenWithMenu(QMenu *menu, const QString &fileName) // while the menu is still being processed. connect(action, &QAction::triggered, d, [fileName, editorId]() { - EditorManagerPrivate::openEditorWith(fileName, editorId); + EditorManagerPrivate::openEditorWith(FilePath::fromString(fileName), editorId); }, Qt::QueuedConnection); } // Add all suitable external editors @@ -3061,7 +3060,7 @@ IEditor *EditorManager::activateEditorForDocument(IDocument *document, OpenEdito } /*! - Opens the document specified by \a fileName using the editor type \a + Opens the document specified by \a filePath using the editor type \a editorId and the specified \a flags. If \a editorId is \c Id(), the editor type is derived from the file's MIME @@ -3075,18 +3074,24 @@ IEditor *EditorManager::activateEditorForDocument(IDocument *document, OpenEdito \sa openEditorWithContents() \sa openExternalEditor() */ -IEditor *EditorManager::openEditor(const QString &fileName, Id editorId, +IEditor *EditorManager::openEditor(const FilePath &filePath, Id editorId, OpenEditorFlags flags, bool *newEditor) { if (flags & EditorManager::OpenInOtherSplit) EditorManager::gotoOtherSplit(); return EditorManagerPrivate::openEditor(EditorManagerPrivate::currentEditorView(), - fileName, editorId, flags, newEditor); + filePath, editorId, flags, newEditor); +} + +IEditor *EditorManager::openEditor(const QString &fileName, Id editorId, + OpenEditorFlags flags, bool *newEditor) +{ + return openEditor(FilePath::fromString(fileName), editorId, flags, newEditor); } /*! - Opens the document specified by \a fileName using the editor type \a + Opens the document specified by \a filePath using the editor type \a editorId and the specified \a flags. Moves the text cursor to the \a line and \a column. @@ -3104,14 +3109,20 @@ IEditor *EditorManager::openEditor(const QString &fileName, Id editorId, \sa openExternalEditor() \sa IEditor::gotoLine() */ -IEditor *EditorManager::openEditorAt(const QString &fileName, int line, int column, +IEditor *EditorManager::openEditorAt(const FilePath &filePath, int line, int column, Id editorId, OpenEditorFlags flags, bool *newEditor) { if (flags & EditorManager::OpenInOtherSplit) EditorManager::gotoOtherSplit(); return EditorManagerPrivate::openEditorAt(EditorManagerPrivate::currentEditorView(), - fileName, line, column, editorId, flags, newEditor); + filePath, line, column, editorId, flags, newEditor); +} + +IEditor *EditorManager::openEditorAt(const QString &fileName, int line, int column, + Id editorId, OpenEditorFlags flags, bool *newEditor) +{ + return openEditorAt(FilePath::fromString(fileName), line, column, editorId, flags, newEditor); } /*! @@ -3186,9 +3197,9 @@ EditorManager::FilePathInfo EditorManager::splitLineAndColumnNumber(const QStrin /*! Returns whether \a fileName is an auto-save file created by \QC. */ -bool EditorManager::isAutoSaveFile(const QString &fileName) +bool EditorManager::isAutoSaveFile(const QString &filePath) { - return fileName.endsWith(".autosave"); + return filePath.endsWith(".autosave"); } /*! @@ -3348,7 +3359,7 @@ IEditor *EditorManager::openEditorWithContents(Id editorId, though it is big. Depending on the settings this might ask the user to decide whether the file should be opened. */ -bool EditorManager::skipOpeningBigTextFile(const QString &filePath) +bool EditorManager::skipOpeningBigTextFile(const FilePath &filePath) { return EditorManagerPrivate::skipOpeningBigTextFile(filePath); } @@ -3449,7 +3460,7 @@ void EditorManager::setLastEditLocation(const IEditor* editor) const QByteArray &state = editor->saveState(); EditLocation location; location.document = document; - location.fileName = document->filePath().toString(); + location.filePath = document->filePath(); location.id = document->id(); location.state = QVariant(state); diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h index 38c4b7add3d..0d9f2aa4cf1 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.h +++ b/src/plugins/coreplugin/editormanager/editormanager.h @@ -94,11 +94,19 @@ public: }; static FilePathInfo splitLineAndColumnNumber(const QString &filePath); - static IEditor *openEditor(const QString &fileName, Utils::Id editorId = {}, + static IEditor *openEditor(const Utils::FilePath &filePath, Utils::Id editorId = {}, OpenEditorFlags flags = NoFlags, bool *newEditor = nullptr); - static IEditor *openEditorAt(const QString &fileName, int line, int column = 0, + static IEditor *openEditorAt(const Utils::FilePath &filePath, int line, int column = 0, Utils::Id editorId = {}, OpenEditorFlags flags = NoFlags, bool *newEditor = nullptr); + + // Kept for a while for transition. + static IEditor *openEditor(const QString &fileName, Utils::Id editorId = {}, + OpenEditorFlags flags = NoFlags, bool *newEditor = nullptr); // FIXME: Remove overload + static IEditor *openEditorAt(const QString &fileName, int line, int column = 0, + Utils::Id editorId = {}, OpenEditorFlags flags = NoFlags, + bool *newEditor = nullptr); // FIXME: Remove overload + static void openEditorAtSearchResult(const SearchResultItem &item, Utils::Id editorId = {}, OpenEditorFlags flags = NoFlags, @@ -107,7 +115,7 @@ public: const QByteArray &contents = QByteArray(), const QString &uniqueId = QString(), OpenEditorFlags flags = NoFlags); - static bool skipOpeningBigTextFile(const QString &filePath); + static bool skipOpeningBigTextFile(const Utils::FilePath &filePath); static void clearUniqueId(IDocument *document); static bool openExternalEditor(const QString &fileName, Utils::Id editorId); diff --git a/src/plugins/coreplugin/editormanager/editormanager_p.h b/src/plugins/coreplugin/editormanager/editormanager_p.h index d78a035a93d..63c1098216f 100644 --- a/src/plugins/coreplugin/editormanager/editormanager_p.h +++ b/src/plugins/coreplugin/editormanager/editormanager_p.h @@ -80,18 +80,18 @@ public: static EditorView *currentEditorView(); static void setCurrentEditor(IEditor *editor, bool ignoreNavigationHistory = false); static IEditor *openEditor(EditorView *view, - const QString &fileName, + const Utils::FilePath &filePath, Utils::Id editorId = {}, EditorManager::OpenEditorFlags flags = EditorManager::NoFlags, bool *newEditor = nullptr); static IEditor *openEditorAt(EditorView *view, - const QString &fileName, + const Utils::FilePath &filePath, int line, int column = 0, Utils::Id editorId = {}, EditorManager::OpenEditorFlags flags = EditorManager::NoFlags, bool *newEditor = nullptr); - static IEditor *openEditorWith(const QString &fileName, Utils::Id editorId); + static IEditor *openEditorWith(const Utils::FilePath &filePath, Utils::Id editorId); static IEditor *duplicateEditor(IEditor *editor); static IEditor *activateEditor(EditorView *view, IEditor *editor, EditorManager::OpenEditorFlags flags = EditorManager::NoFlags); @@ -209,7 +209,7 @@ private: static void setupSaveActions(IDocument *document, QAction *saveAction, QAction *saveAsAction, QAction *revertToSavedAction); static void updateWindowTitle(); - static bool skipOpeningBigTextFile(const QString &filePath); + static bool skipOpeningBigTextFile(const Utils::FilePath &filePath); private: explicit EditorManagerPrivate(QObject *parent); diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp index 8a2a2dbe4f0..9f79b1cbdee 100644 --- a/src/plugins/coreplugin/editormanager/editorview.cpp +++ b/src/plugins/coreplugin/editormanager/editorview.cpp @@ -261,15 +261,14 @@ void EditorView::updateEditorHistory(IEditor *editor, QList &histo EditLocation location; location.document = document; - location.fileName = document->filePath().toString(); + location.filePath = document->filePath(); location.id = document->id(); location.state = QVariant(state); for (int i = 0; i < history.size(); ++i) { const EditLocation &item = history.at(i); if (item.document == document - || (!item.document - && !DocumentModel::indexOfFilePath(FilePath::fromString(item.fileName)))) { + || (!item.document && !DocumentModel::indexOfFilePath(item.filePath))) { history.removeAt(i--); } } @@ -405,10 +404,10 @@ void EditorView::openDroppedFiles(const QList &files) auto openEntry = [&](const DropSupport::FileSpec &spec) { if (first) { first = false; - EditorManagerPrivate::openEditorAt(this, spec.filePath, spec.line, spec.column); + EditorManagerPrivate::openEditorAt(this, FilePath::fromString(spec.filePath), spec.line, spec.column); } else if (spec.column != -1 || spec.line != -1) { EditorManagerPrivate::openEditorAt(this, - spec.filePath, + FilePath::fromString(spec.filePath), spec.line, spec.column, Id(), @@ -495,7 +494,7 @@ void EditorView::addCurrentPositionToNavigationHistory(const QByteArray &saveSta EditLocation location; location.document = document; - location.fileName = document->filePath().toString(); + location.filePath = document->filePath(); location.id = document->id(); location.state = QVariant(state); m_currentNavigationHistoryPosition = qMin(m_currentNavigationHistoryPosition, m_navigationHistory.size()); // paranoia @@ -550,17 +549,15 @@ void EditorView::updateCurrentPositionInNavigationHistory() location = &m_navigationHistory[m_navigationHistory.size()-1]; } location->document = document; - location->fileName = document->filePath().toString(); + location->filePath = document->filePath(); location->id = document->id(); location->state = QVariant(editor->saveState()); } -namespace { -static inline bool fileNameWasRemoved(const QString &fileName) +static bool fileNameWasRemoved(const FilePath &filePath) { - return !fileName.isEmpty() && !QFileInfo::exists(fileName); + return !filePath.isEmpty() && !filePath.exists(); } -} // End of anonymous namespace void EditorView::goBackInNavigationHistory() { @@ -574,11 +571,11 @@ void EditorView::goBackInNavigationHistory() EditorManager::IgnoreNavigationHistory); } if (!editor) { - if (fileNameWasRemoved(location.fileName)) { + if (fileNameWasRemoved(location.filePath)) { m_navigationHistory.removeAt(m_currentNavigationHistoryPosition); continue; } - editor = EditorManagerPrivate::openEditor(this, location.fileName, location.id, + editor = EditorManagerPrivate::openEditor(this, location.filePath, location.id, EditorManager::IgnoreNavigationHistory); if (!editor) { m_navigationHistory.removeAt(m_currentNavigationHistoryPosition); @@ -605,11 +602,11 @@ void EditorView::goForwardInNavigationHistory() EditorManager::IgnoreNavigationHistory); } if (!editor) { - if (fileNameWasRemoved(location.fileName)) { + if (fileNameWasRemoved(location.filePath)) { m_navigationHistory.removeAt(m_currentNavigationHistoryPosition); continue; } - editor = EditorManagerPrivate::openEditor(this, location.fileName, location.id, + editor = EditorManagerPrivate::openEditor(this, location.filePath, location.id, EditorManager::IgnoreNavigationHistory); if (!editor) { m_navigationHistory.removeAt(m_currentNavigationHistoryPosition); @@ -634,10 +631,10 @@ void EditorView::goToEditLocation(const EditLocation &location) } if (!editor) { - if (fileNameWasRemoved(location.fileName)) + if (fileNameWasRemoved(location.filePath)) return; - editor = EditorManagerPrivate::openEditor(this, location.fileName, location.id, + editor = EditorManagerPrivate::openEditor(this, location.filePath, location.id, EditorManager::IgnoreNavigationHistory); } @@ -967,7 +964,7 @@ void SplitterOrView::restoreState(const QByteArray &state) stream >> fileName >> id >> editorState; if (!QFile::exists(fileName)) return; - IEditor *e = EditorManagerPrivate::openEditor(view(), fileName, Id::fromString(id), + IEditor *e = EditorManagerPrivate::openEditor(view(), FilePath::fromString(fileName), Id::fromString(id), EditorManager::IgnoreNavigationHistory | EditorManager::DoNotChangeCurrentEditor); diff --git a/src/plugins/coreplugin/editormanager/editorview.h b/src/plugins/coreplugin/editormanager/editorview.h index ebf98dfa1c6..6dca73353a5 100644 --- a/src/plugins/coreplugin/editormanager/editorview.h +++ b/src/plugins/coreplugin/editormanager/editorview.h @@ -26,6 +26,7 @@ #pragma once #include +#include #include #include @@ -62,7 +63,7 @@ namespace Internal { struct EditLocation { QPointer document; - QString fileName; + Utils::FilePath filePath; Utils::Id id; QVariant state; }; diff --git a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp index d7af47f372c..fdcd6b57be2 100644 --- a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp +++ b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp @@ -217,7 +217,7 @@ static DocumentModel::Entry *entryForEditLocation(const EditLocation &item) { if (!item.document.isNull()) return DocumentModel::entryForDocument(item.document); - return DocumentModel::entryForFilePath(Utils::FilePath::fromString(item.fileName)); + return DocumentModel::entryForFilePath(item.filePath); } void OpenEditorsWindow::addHistoryItems(const QList &history, EditorView *view, diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 9f7b9274e70..b8d788196ea 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -950,7 +950,7 @@ void MainWindow::openFileWith() if (isExternal) EditorManager::openExternalEditor(fileName, editorId); else - EditorManagerPrivate::openEditorWith(fileName, editorId); + EditorManagerPrivate::openEditorWith(FilePath::fromString(fileName), editorId); } } diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp index 23bd120e00c..3c8ff25345b 100644 --- a/src/plugins/debugger/breakhandler.cpp +++ b/src/plugins/debugger/breakhandler.cpp @@ -1490,7 +1490,7 @@ void BreakHandler::gotoLocation(const Breakpoint &bp) const // Don't use gotoLocation unconditionally as this ends up in // disassembly if OperateByInstruction is on. But fallback // to disassembly if we can't open the file. - if (IEditor *editor = EditorManager::openEditor(bp->markerFileName().toString())) + if (IEditor *editor = EditorManager::openEditor(bp->markerFileName())) editor->gotoLine(bp->markerLineNumber(), 0); else m_engine->openDisassemblerView(Location(bp->m_parameters.address)); @@ -2694,7 +2694,7 @@ bool BreakpointManager::contextMenuEvent(const ItemViewEvent &ev) void BreakpointManager::gotoLocation(const GlobalBreakpoint &gbp) const { QTC_ASSERT(gbp, return); - if (IEditor *editor = EditorManager::openEditor(gbp->markerFileName().toString())) + if (IEditor *editor = EditorManager::openEditor(gbp->markerFileName())) editor->gotoLine(gbp->markerLineNumber(), 0); } diff --git a/src/plugins/diffeditor/diffeditorplugin.cpp b/src/plugins/diffeditor/diffeditorplugin.cpp index 7785fe9423c..a83c5a7fbb4 100644 --- a/src/plugins/diffeditor/diffeditorplugin.cpp +++ b/src/plugins/diffeditor/diffeditorplugin.cpp @@ -571,7 +571,7 @@ void DiffEditorPluginPrivate::diffExternalFiles() QString()); if (fileName1.isNull()) return; - if (EditorManager::skipOpeningBigTextFile(fileName1)) + if (EditorManager::skipOpeningBigTextFile(FilePath::fromString(fileName1))) return; const QString fileName2 = QFileDialog::getOpenFileName(ICore::dialogParent(), @@ -579,7 +579,7 @@ void DiffEditorPluginPrivate::diffExternalFiles() QString()); if (fileName2.isNull()) return; - if (EditorManager::skipOpeningBigTextFile(fileName2)) + if (EditorManager::skipOpeningBigTextFile(FilePath::fromString(fileName2))) return; const QString documentId = Constants::DIFF_EDITOR_PLUGIN diff --git a/src/plugins/languageclient/locatorfilter.cpp b/src/plugins/languageclient/locatorfilter.cpp index 682f6312757..cd8f6d6fa40 100644 --- a/src/plugins/languageclient/locatorfilter.cpp +++ b/src/plugins/languageclient/locatorfilter.cpp @@ -190,7 +190,7 @@ void DocumentLocatorFilter::accept(Core::LocatorFilterEntry selection, { if (selection.internalData.canConvert()) { auto lineColumn = qvariant_cast(selection.internalData); - Core::EditorManager::openEditorAt(m_currentUri.toFilePath().toString(), + Core::EditorManager::openEditorAt(m_currentUri.toFilePath(), lineColumn.line + 1, lineColumn.column); } else if (selection.internalData.canConvert()) { diff --git a/src/plugins/mercurial/mercurialplugin.cpp b/src/plugins/mercurial/mercurialplugin.cpp index dc5fc93c47b..f0e0be5d278 100644 --- a/src/plugins/mercurial/mercurialplugin.cpp +++ b/src/plugins/mercurial/mercurialplugin.cpp @@ -643,8 +643,7 @@ void MercurialPluginPrivate::showCommitWidget(const QList projFilePath = projNode->visibleAfterAddFileAction(); - if (projFilePath && !Core::EditorManager::openEditor(projFilePath.value().toString())) { + if (projFilePath && !Core::EditorManager::openEditor(projFilePath.value())) { auto errorMessage = QCoreApplication::translate("ProjectExplorer::JsonWizard", "Failed to open an editor for \"%1\".") .arg(QDir::toNativeSeparators(projFilePath.value().toString())); diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index c90ee9f2704..39d7a6c46f4 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -1347,7 +1347,7 @@ void ProjectExplorerPlugin::testProject_multipleBuildConfigs() QCOMPARE(SessionManager::startupProject(), theProject.project()); QCOMPARE(ProjectTree::currentProject(), theProject.project()); - QVERIFY(Core::EditorManager::openEditor(projectDir.pathAppended("main.cpp").toString())); + QVERIFY(Core::EditorManager::openEditor(projectDir.pathAppended("main.cpp"))); QVERIFY(ProjectTree::currentNode()); ProjectTree::instance()->expandAll(); SessionManager::closeAllProjects(); // QTCREATORBUG-25655 diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 224e492cdca..e41c7300511 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -3442,7 +3442,7 @@ void ProjectExplorerPluginPrivate::updateLocationSubMenus() : tr("%1 in %2").arg(li.displayName).arg(li.path.toUserOutput()); auto *action = new QAction(displayName, nullptr); connect(action, &QAction::triggered, this, [line, path]() { - Core::EditorManager::openEditorAt(path.toString(), line); + Core::EditorManager::openEditorAt(path, line); }); projectMenu->addAction(action); @@ -3622,7 +3622,7 @@ void ProjectExplorerPluginPrivate::openFile() { const Node *currentNode = ProjectTree::currentNode(); QTC_ASSERT(currentNode, return); - EditorManager::openEditor(currentNode->filePath().toString()); + EditorManager::openEditor(currentNode->filePath()); } void ProjectExplorerPluginPrivate::searchOnFileSystem() diff --git a/src/plugins/projectexplorer/projecttreewidget.cpp b/src/plugins/projectexplorer/projecttreewidget.cpp index 149b769c2f9..dbaed8d983f 100644 --- a/src/plugins/projectexplorer/projecttreewidget.cpp +++ b/src/plugins/projectexplorer/projecttreewidget.cpp @@ -557,7 +557,7 @@ void ProjectTreeWidget::openItem(const QModelIndex &mainIndex) Node *node = m_model->nodeForIndex(mainIndex); if (!node || !node->asFileNode()) return; - IEditor *editor = EditorManager::openEditor(node->filePath().toString()); + IEditor *editor = EditorManager::openEditor(node->filePath()); if (editor && node->line() >= 0) editor->gotoLine(node->line()); } diff --git a/src/plugins/qmldesigner/assetexporterplugin/assetexporterview.cpp b/src/plugins/qmldesigner/assetexporterplugin/assetexporterview.cpp index 6e5212818de..81dc1ce486c 100644 --- a/src/plugins/qmldesigner/assetexporterplugin/assetexporterview.cpp +++ b/src/plugins/qmldesigner/assetexporterplugin/assetexporterview.cpp @@ -62,7 +62,7 @@ bool AssetExporterView::loadQmlFile(const Utils::FilePath &path, uint timeoutSec setState(LoadState::Busy); m_retryCount = std::max(MinRetry, static_cast((timeoutSecs * 1000) / RetryIntervalMs)); - m_currentEditor = Core::EditorManager::openEditor(path.toString(), Utils::Id(), + m_currentEditor = Core::EditorManager::openEditor(path, Utils::Id(), Core::EditorManager::DoNotMakeVisible); Core::ModeManager::activateMode(Core::Constants::MODE_DESIGN); Core::ModeManager::setFocusToCurrentMode(); diff --git a/src/plugins/qmldesigner/components/componentcore/crumblebar.cpp b/src/plugins/qmldesigner/components/componentcore/crumblebar.cpp index 33f44af9dca..c729fd07512 100644 --- a/src/plugins/qmldesigner/components/componentcore/crumblebar.cpp +++ b/src/plugins/qmldesigner/components/componentcore/crumblebar.cpp @@ -178,7 +178,7 @@ void CrumbleBar::onCrumblePathElementClicked(const QVariant &data) } else { crumblePath()->popElement(); nextFileIsCalledInternally(); - Core::EditorManager::openEditor(clickedCrumbleBarInfo.fileName.toString(), + Core::EditorManager::openEditor(clickedCrumbleBarInfo.fileName, Utils::Id(), Core::EditorManager::DoNotMakeVisible); if (clickedCrumbleBarInfo.modelNode.isValid()) { diff --git a/src/plugins/studiowelcome/studiowelcomeplugin.cpp b/src/plugins/studiowelcome/studiowelcomeplugin.cpp index 8934483647b..55400a3a016 100644 --- a/src/plugins/studiowelcome/studiowelcomeplugin.cpp +++ b/src/plugins/studiowelcome/studiowelcomeplugin.cpp @@ -213,7 +213,7 @@ public: const Utils::FilePath qmlFile = Core::ICore::resourcePath("examples") / example / formFile; - Core::EditorManager::openEditor(qmlFile.toString()); + Core::EditorManager::openEditor(qmlFile); } public slots: void resetProjects(); diff --git a/src/plugins/todo/todoplugin.cpp b/src/plugins/todo/todoplugin.cpp index fc7e47c6144..dab36f7ebe0 100644 --- a/src/plugins/todo/todoplugin.cpp +++ b/src/plugins/todo/todoplugin.cpp @@ -103,7 +103,7 @@ void TodoPluginPrivate::scanningScopeChanged(ScanningScope scanningScope) void TodoPluginPrivate::todoItemClicked(const TodoItem &item) { if (item.file.exists()) - Core::EditorManager::openEditorAt(item.file.toString(), item.line); + Core::EditorManager::openEditorAt(item.file, item.line); } void TodoPluginPrivate::createItemsProvider()