summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/analyzerbase/analyzerutils.cpp2
-rw-r--r--src/plugins/android/androidmanifestdocument.cpp6
-rw-r--r--src/plugins/android/androidmanifesteditorwidget.cpp10
-rw-r--r--src/plugins/android/javaeditor.cpp6
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsprojectfile.cpp2
-rw-r--r--src/plugins/autotoolsprojectmanager/autotoolsprojectnode.cpp2
-rw-r--r--src/plugins/bazaar/bazaarplugin.cpp2
-rw-r--r--src/plugins/beautifier/beautifierplugin.cpp2
-rw-r--r--src/plugins/bineditor/bineditorplugin.cpp23
-rw-r--r--src/plugins/bookmarks/bookmarkmanager.cpp8
-rw-r--r--src/plugins/bookmarks/bookmarksplugin.cpp6
-rw-r--r--src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp4
-rw-r--r--src/plugins/clangcodemodel/clangutils.cpp2
-rw-r--r--src/plugins/classview/classviewmanager.cpp2
-rw-r--r--src/plugins/clearcase/clearcaseplugin.cpp2
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeeditor.cpp10
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeproject.cpp4
-rw-r--r--src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp4
-rw-r--r--src/plugins/coreplugin/dialogs/saveitemsdialog.cpp2
-rw-r--r--src/plugins/coreplugin/documentmanager.cpp30
-rw-r--r--src/plugins/coreplugin/documentmanager.h5
-rw-r--r--src/plugins/coreplugin/editormanager/documentmodel.cpp11
-rw-r--r--src/plugins/coreplugin/editormanager/editormanager.cpp40
-rw-r--r--src/plugins/coreplugin/editormanager/editorview.cpp14
-rw-r--r--src/plugins/coreplugin/editormanager/openeditorswindow.cpp2
-rw-r--r--src/plugins/coreplugin/editortoolbar.cpp9
-rw-r--r--src/plugins/coreplugin/externaltool.cpp2
-rw-r--r--src/plugins/coreplugin/idocument.cpp12
-rw-r--r--src/plugins/coreplugin/idocument.h8
-rw-r--r--src/plugins/coreplugin/locator/filesystemfilter.cpp2
-rw-r--r--src/plugins/cppeditor/cppcodemodelinspectordialog.cpp4
-rw-r--r--src/plugins/cppeditor/cppeditor.cpp6
-rw-r--r--src/plugins/cppeditor/cppeditordocument.cpp17
-rw-r--r--src/plugins/cppeditor/cppeditordocument.h2
-rw-r--r--src/plugins/cppeditor/cppeditoroutline.cpp2
-rw-r--r--src/plugins/cppeditor/cppelementevaluator.cpp2
-rw-r--r--src/plugins/cppeditor/cppfollowsymbolundercursor.cpp4
-rw-r--r--src/plugins/cppeditor/cppincludehierarchy.cpp4
-rw-r--r--src/plugins/cppeditor/cppincludehierarchymodel.cpp4
-rw-r--r--src/plugins/cppeditor/cppquickfixassistant.cpp2
-rw-r--r--src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp2
-rw-r--r--src/plugins/cpptools/baseeditordocumentprocessor.h2
-rw-r--r--src/plugins/cpptools/builtineditordocumentprocessor.cpp2
-rw-r--r--src/plugins/cpptools/cppcompletion_test.cpp2
-rw-r--r--src/plugins/cpptools/cppcurrentdocumentfilter.cpp4
-rw-r--r--src/plugins/cpptools/cppmodelmanager.cpp7
-rw-r--r--src/plugins/cpptools/cppmodelmanager_test.cpp2
-rw-r--r--src/plugins/cpptools/cppsourceprocessor_test.cpp2
-rw-r--r--src/plugins/cpptools/cpptoolsplugin.cpp2
-rw-r--r--src/plugins/cpptools/cpptoolsreuse.cpp2
-rw-r--r--src/plugins/cvs/cvsplugin.cpp2
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp10
-rw-r--r--src/plugins/debugger/debuggertooltipmanager.cpp4
-rw-r--r--src/plugins/debugger/qml/qmlinspectoradapter.cpp10
-rw-r--r--src/plugins/debugger/sourceutils.cpp4
-rw-r--r--src/plugins/designer/formeditorplugin.cpp2
-rw-r--r--src/plugins/designer/formwindoweditor.cpp2
-rw-r--r--src/plugins/designer/formwindowfile.cpp19
-rw-r--r--src/plugins/designer/formwindowfile.h2
-rw-r--r--src/plugins/designer/gotoslot_test.cpp4
-rw-r--r--src/plugins/designer/qtcreatorintegration.cpp2
-rw-r--r--src/plugins/diffeditor/diffeditordocument.cpp6
-rw-r--r--src/plugins/fakevim/fakevimplugin.cpp4
-rw-r--r--src/plugins/genericprojectmanager/genericproject.cpp2
-rw-r--r--src/plugins/genericprojectmanager/genericprojectnodes.cpp8
-rw-r--r--src/plugins/git/gitclient.cpp2
-rw-r--r--src/plugins/git/gitplugin.cpp2
-rw-r--r--src/plugins/glsleditor/glsleditor.cpp2
-rw-r--r--src/plugins/imageviewer/imageviewer.cpp2
-rw-r--r--src/plugins/imageviewer/imageviewerfile.cpp2
-rw-r--r--src/plugins/mercurial/mercurialplugin.cpp2
-rw-r--r--src/plugins/projectexplorer/editorconfiguration.cpp2
-rw-r--r--src/plugins/projectexplorer/project.cpp2
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp8
-rw-r--r--src/plugins/projectexplorer/projecttree.cpp2
-rw-r--r--src/plugins/projectexplorer/session.cpp2
-rw-r--r--src/plugins/qbsprojectmanager/qbsproject.cpp10
-rw-r--r--src/plugins/qbsprojectmanager/qbsprojectfile.cpp2
-rw-r--r--src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp4
-rw-r--r--src/plugins/qmakeprojectmanager/profileeditor.cpp8
-rw-r--r--src/plugins/qmakeprojectmanager/qmakenodes.cpp2
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeproject.cpp6
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp4
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp2
-rw-r--r--src/plugins/qmldesigner/components/componentcore/crumblebar.cpp2
-rw-r--r--src/plugins/qmldesigner/components/integration/designdocument.cpp17
-rw-r--r--src/plugins/qmldesigner/components/integration/designdocument.h2
-rw-r--r--src/plugins/qmldesigner/designmodewidget.cpp2
-rw-r--r--src/plugins/qmldesigner/qmldesignerplugin.cpp2
-rw-r--r--src/plugins/qmljseditor/qmljseditor.cpp8
-rw-r--r--src/plugins/qmljseditor/qmljseditordocument.cpp8
-rw-r--r--src/plugins/qmljseditor/qmljsquickfixassist.cpp2
-rw-r--r--src/plugins/qmljseditor/qmloutlinemodel.cpp2
-rw-r--r--src/plugins/qmljstools/qmljsmodelmanager.cpp2
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectfile.cpp4
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectfile.h2
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectnodes.cpp6
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp4
-rw-r--r--src/plugins/qnx/bardescriptordocument.cpp12
-rw-r--r--src/plugins/qnx/bardescriptoreditor.cpp2
-rw-r--r--src/plugins/qnx/bardescriptoreditorwidget.cpp4
-rw-r--r--src/plugins/qnx/bardescriptoreditorwidget.h2
-rw-r--r--src/plugins/qnx/bardescriptorfilenodemanager.cpp2
-rw-r--r--src/plugins/qtsupport/uicodemodelsupport.cpp4
-rw-r--r--src/plugins/resourceeditor/resourceeditorw.cpp26
-rw-r--r--src/plugins/resourceeditor/resourceeditorw.h2
-rw-r--r--src/plugins/resourceeditor/resourcenode.cpp2
-rw-r--r--src/plugins/subversion/subversionplugin.cpp2
-rw-r--r--src/plugins/tasklist/taskfile.cpp4
-rw-r--r--src/plugins/tasklist/tasklistplugin.cpp2
-rw-r--r--src/plugins/texteditor/codecselector.cpp4
-rw-r--r--src/plugins/texteditor/findincurrentfile.cpp6
-rw-r--r--src/plugins/texteditor/refactoringchanges.cpp2
-rw-r--r--src/plugins/texteditor/textdocument.cpp20
-rw-r--r--src/plugins/texteditor/textdocument.h2
-rw-r--r--src/plugins/texteditor/texteditor.cpp8
-rw-r--r--src/plugins/texteditor/textmark.cpp4
-rw-r--r--src/plugins/todo/todoitemsprovider.cpp2
-rw-r--r--src/plugins/valgrind/callgrindtool.cpp2
-rw-r--r--src/plugins/vcsbase/submiteditorfile.cpp9
-rw-r--r--src/plugins/vcsbase/vcsbaseeditor.cpp4
-rw-r--r--src/plugins/vcsbase/vcsbaseplugin.cpp4
-rw-r--r--src/plugins/vcsbase/vcsbasesubmiteditor.cpp2
123 files changed, 327 insertions, 324 deletions
diff --git a/src/plugins/analyzerbase/analyzerutils.cpp b/src/plugins/analyzerbase/analyzerutils.cpp
index ac75620a81..2872b23353 100644
--- a/src/plugins/analyzerbase/analyzerutils.cpp
+++ b/src/plugins/analyzerbase/analyzerutils.cpp
@@ -74,7 +74,7 @@ CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor()
widget->convertPosition(pos, &line, &column);
const CPlusPlus::Snapshot &snapshot = CppTools::CppModelManager::instance()->snapshot();
- CPlusPlus::Document::Ptr doc = snapshot.document(widget->textDocument()->filePath());
+ CPlusPlus::Document::Ptr doc = snapshot.document(widget->textDocument()->filePath().toString());
QTC_ASSERT(doc, return 0);
// fetch the expression's code
diff --git a/src/plugins/android/androidmanifestdocument.cpp b/src/plugins/android/androidmanifestdocument.cpp
index ea12428ca0..cf7cfee3a9 100644
--- a/src/plugins/android/androidmanifestdocument.cpp
+++ b/src/plugins/android/androidmanifestdocument.cpp
@@ -56,14 +56,12 @@ bool AndroidManifestDocument::save(QString *errorString, const QString &fileName
QString AndroidManifestDocument::defaultPath() const
{
- QFileInfo fi(filePath());
- return fi.absolutePath();
+ return filePath().toFileInfo().absolutePath();
}
QString AndroidManifestDocument::suggestedFileName() const
{
- QFileInfo fi(filePath());
- return fi.fileName();
+ return filePath().toFileInfo().fileName();
}
bool AndroidManifestDocument::isModified() const
diff --git a/src/plugins/android/androidmanifesteditorwidget.cpp b/src/plugins/android/androidmanifesteditorwidget.cpp
index f02ae1d413..f1b51507d2 100644
--- a/src/plugins/android/androidmanifesteditorwidget.cpp
+++ b/src/plugins/android/androidmanifesteditorwidget.cpp
@@ -476,7 +476,7 @@ bool AndroidManifestEditorWidget::eventFilter(QObject *obj, QEvent *event)
void AndroidManifestEditorWidget::updateTargetComboBox()
{
- const QString docPath(m_textEditorWidget->textDocument()->filePath());
+ const QString docPath(m_textEditorWidget->textDocument()->filePath().toString());
ProjectExplorer::Project *project = androidProject(docPath);
QStringList items;
if (project) {
@@ -577,7 +577,7 @@ void AndroidManifestEditorWidget::preSave()
syncToEditor();
if (m_setAppName && m_appNameInStringsXml) {
- QString baseDir = QFileInfo(m_textEditorWidget->textDocument()->filePath()).absolutePath();
+ QString baseDir = m_textEditorWidget->textDocument()->filePath().toFileInfo().absolutePath();
QString fileName = baseDir + QLatin1String("/res/values/strings.xml");
QFile f(fileName);
if (f.open(QIODevice::ReadOnly)) {
@@ -601,7 +601,7 @@ void AndroidManifestEditorWidget::preSave()
m_setAppName = false;
}
- QString baseDir = QFileInfo(m_textEditorWidget->textDocument()->filePath()).absolutePath();
+ QString baseDir = m_textEditorWidget->textDocument()->filePath().toFileInfo().absolutePath();
if (!m_lIconPath.isEmpty()) {
copyIcon(LowDPI, baseDir, m_lIconPath);
m_lIconPath.clear();
@@ -695,7 +695,7 @@ void AndroidManifestEditorWidget::updateInfoBar()
void AndroidManifestEditorWidget::updateSdkVersions()
{
- const QString docPath(m_textEditorWidget->textDocument()->filePath());
+ const QString docPath(m_textEditorWidget->textDocument()->filePath().toString());
QPair<int, int> apiLevels = AndroidManager::apiLevelRange();
for (int i = apiLevels.first; i < apiLevels.second + 1; ++i)
m_androidMinSdkVersion->addItem(tr("API %1: %2")
@@ -766,7 +766,7 @@ void AndroidManifestEditorWidget::syncToWidgets(const QDomDocument &doc)
setApiLevel(m_androidMinSdkVersion, usesSdkElement, QLatin1String("android:minSdkVersion"));
setApiLevel(m_androidTargetSdkVersion, usesSdkElement, QLatin1String("android:targetSdkVersion"));
- QString baseDir = QFileInfo(m_textEditorWidget->textDocument()->filePath()).absolutePath();
+ QString baseDir = m_textEditorWidget->textDocument()->filePath().toFileInfo().absolutePath();
QString fileName = baseDir + QLatin1String("/res/values/strings.xml");
QDomElement applicationElement = manifest.firstChildElement(QLatin1String("application"));
diff --git a/src/plugins/android/javaeditor.cpp b/src/plugins/android/javaeditor.cpp
index 9413dd39de..c8194db492 100644
--- a/src/plugins/android/javaeditor.cpp
+++ b/src/plugins/android/javaeditor.cpp
@@ -71,14 +71,12 @@ JavaDocument::JavaDocument()
QString JavaDocument::defaultPath() const
{
- QFileInfo fi(filePath());
- return fi.absolutePath();
+ return filePath().toFileInfo().absolutePath();
}
QString JavaDocument::suggestedFileName() const
{
- QFileInfo fi(filePath());
- return fi.fileName();
+ return filePath().toFileInfo().fileName();
}
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.cpp b/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.cpp
index b2cc63e942..0131421794 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.cpp
+++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectfile.cpp
@@ -43,7 +43,7 @@ AutotoolsProjectFile::AutotoolsProjectFile(AutotoolsProject *project, const QStr
{
setId("Autotools.ProjectFile");
setMimeType(QLatin1String(Constants::MAKEFILE_MIMETYPE));
- setFilePath(fileName);
+ setFilePath(Utils::FileName::fromString(fileName));
}
bool AutotoolsProjectFile::save(QString *errorString, const QString &fileName, bool autoSave)
diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectnode.cpp b/src/plugins/autotoolsprojectmanager/autotoolsprojectnode.cpp
index 3964c1c224..6f6d395f75 100644
--- a/src/plugins/autotoolsprojectmanager/autotoolsprojectnode.cpp
+++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectnode.cpp
@@ -40,7 +40,7 @@ using namespace AutotoolsProjectManager::Internal;
using namespace ProjectExplorer;
AutotoolsProjectNode::AutotoolsProjectNode(AutotoolsProject *project, Core::IDocument *projectFile) :
- ProjectNode(projectFile->filePath()),
+ ProjectNode(projectFile->filePath().toString()),
m_project(project),
m_projectFile(projectFile)
{
diff --git a/src/plugins/bazaar/bazaarplugin.cpp b/src/plugins/bazaar/bazaarplugin.cpp
index f6d537b3e6..e077ed5c0b 100644
--- a/src/plugins/bazaar/bazaarplugin.cpp
+++ b/src/plugins/bazaar/bazaarplugin.cpp
@@ -746,7 +746,7 @@ bool BazaarPlugin::submitEditorAboutToClose()
// Whether local commit or not
if (commitWidget->isLocalOptionEnabled())
extraOptions += QLatin1String("--local");
- m_client->commit(m_submitRepository, files, editorDocument->filePath(), extraOptions);
+ m_client->commit(m_submitRepository, files, editorDocument->filePath().toString(), extraOptions);
}
return true;
}
diff --git a/src/plugins/beautifier/beautifierplugin.cpp b/src/plugins/beautifier/beautifierplugin.cpp
index 1d99602220..a398dbb75e 100644
--- a/src/plugins/beautifier/beautifierplugin.cpp
+++ b/src/plugins/beautifier/beautifierplugin.cpp
@@ -233,7 +233,7 @@ void BeautifierPlugin::formatCurrentFile(const Command &command)
watcher, &QFutureWatcher<FormatTask>::cancel);
connect(watcher, SIGNAL(finished()), m_asyncFormatMapper, SLOT(map()));
m_asyncFormatMapper->setMapping(watcher, watcher);
- const QString filePath = widget->textDocument()->filePath();
+ const QString filePath = widget->textDocument()->filePath().toString();
watcher->setFuture(QtConcurrent::run(&BeautifierPlugin::formatAsync, this,
FormatTask(widget, filePath, sourceData, command)));
}
diff --git a/src/plugins/bineditor/bineditorplugin.cpp b/src/plugins/bineditor/bineditorplugin.cpp
index 63843f76ea..85786c21e4 100644
--- a/src/plugins/bineditor/bineditorplugin.cpp
+++ b/src/plugins/bineditor/bineditorplugin.cpp
@@ -61,6 +61,7 @@
#include <utils/reloadpromptutils.h>
#include <utils/qtcassert.h>
+using namespace Utils;
using namespace Core;
namespace BinEditor {
@@ -256,9 +257,8 @@ public:
bool save(QString *errorString, const QString &fn, bool autoSave)
{
QTC_ASSERT(!autoSave, return true); // bineditor does not support autosave - it would be a bit expensive
- const QString fileNameToUse
- = fn.isEmpty() ? filePath() : fn;
- if (m_widget->save(errorString, filePath(), fileNameToUse)) {
+ const FileName fileNameToUse = fn.isEmpty() ? filePath() : FileName::fromString(fn);
+ if (m_widget->save(errorString, filePath().toString(), fileNameToUse.toString())) {
setFilePath(fileNameToUse);
return true;
} else {
@@ -281,7 +281,7 @@ public:
return false;
if (file.open(QIODevice::ReadOnly)) {
file.close();
- setFilePath(fileName);
+ setFilePath(Utils::FileName::fromString(fileName));
m_widget->setSizes(offset, file.size());
return true;
}
@@ -297,10 +297,10 @@ public:
private slots:
void provideData(quint64 block)
{
- const QString fn = filePath();
+ const FileName fn = filePath();
if (fn.isEmpty())
return;
- QFile file(fn);
+ QFile file(fn.toString());
if (file.open(QIODevice::ReadOnly)) {
int blockSize = m_widget->dataBlockSize();
file.seek(block * blockSize);
@@ -313,13 +313,13 @@ private slots:
} else {
QMessageBox::critical(Core::ICore::mainWindow(), tr("File Error"),
tr("Cannot open %1: %2").arg(
- QDir::toNativeSeparators(fn), file.errorString()));
+ fn.toUserOutput(), file.errorString()));
}
}
void provideNewRange(quint64 offset)
{
- open(0, filePath(), offset);
+ open(0, filePath().toString(), offset);
}
public:
@@ -332,11 +332,10 @@ public:
: m_widget->isModified(); }
bool isFileReadOnly() const {
- const QString fn = filePath();
+ const FileName fn = filePath();
if (fn.isEmpty())
return false;
- const QFileInfo fi(fn);
- return !fi.isWritable();
+ return !fn.toFileInfo().isWritable();
}
bool isSaveAsAllowed() const { return true; }
@@ -350,7 +349,7 @@ public:
emit aboutToReload();
int cPos = m_widget->cursorPosition();
m_widget->clear();
- const bool success = open(errorString, filePath());
+ const bool success = open(errorString, filePath().toString());
m_widget->setCursorPosition(cPos);
emit reloadFinished(success);
return success;
diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp
index 3e9a3aef89..43dd21b83e 100644
--- a/src/plugins/bookmarks/bookmarkmanager.cpp
+++ b/src/plugins/bookmarks/bookmarkmanager.cpp
@@ -437,7 +437,7 @@ void BookmarkManager::toggleBookmark(bool)
if (!editor)
return;
- toggleBookmark(editor->document()->filePath(), editor->currentLine());
+ toggleBookmark(editor->document()->filePath().toString(), editor->currentLine());
}
void BookmarkManager::toggleBookmark(const QString &fileName, int lineNumber)
@@ -555,7 +555,7 @@ void BookmarkManager::documentPrevNext(bool next)
if (editorLine <= 0)
return;
- QFileInfo fi(editor->document()->filePath());
+ const QFileInfo fi = editor->document()->filePath().toFileInfo();
if (!m_bookmarksMap.contains(fi.path()))
return;
@@ -646,7 +646,7 @@ BookmarkManager::State BookmarkManager::state() const
if (!editor)
return HasBookMarks;
- const QFileInfo fi(editor->document()->filePath());
+ const QFileInfo fi = editor->document()->filePath().toFileInfo();
const DirectoryFileBookmarksMap::const_iterator dit = m_bookmarksMap.constFind(fi.path());
if (dit == m_bookmarksMap.constEnd())
@@ -849,7 +849,7 @@ void BookmarkManager::loadBookmarks()
void BookmarkManager::handleBookmarkTooltipRequest(IEditor *editor, const QPoint &pos, int line)
{
- Bookmark *mark = findBookmark(editor->document()->filePath(), line);
+ Bookmark *mark = findBookmark(editor->document()->filePath().toString(), line);
operateTooltip(editor->widget(), pos, mark);
}
diff --git a/src/plugins/bookmarks/bookmarksplugin.cpp b/src/plugins/bookmarks/bookmarksplugin.cpp
index 9a5a5f071f..4d1a1b6836 100644
--- a/src/plugins/bookmarks/bookmarksplugin.cpp
+++ b/src/plugins/bookmarks/bookmarksplugin.cpp
@@ -110,7 +110,7 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
connect(m_toggleAction, &QAction::triggered, [this]() {
if (BaseTextEditor *editor = BaseTextEditor::currentTextEditor())
- m_bookmarkManager->toggleBookmark(editor->document()->filePath(), editor->currentLine());
+ m_bookmarkManager->toggleBookmark(editor->document()->filePath().toString(), editor->currentLine());
});
connect(m_prevAction, &QAction::triggered, m_bookmarkManager, &BookmarkManager::prev);
@@ -165,7 +165,7 @@ void BookmarksPlugin::editorOpened(IEditor *editor)
connect(widget, &TextEditorWidget::markRequested, m_bookmarkManager,
[this, editor](TextEditorWidget *, int line, TextMarkRequestKind kind) {
if (kind == BookmarkRequest && editor->document())
- m_bookmarkManager->toggleBookmark(editor->document()->filePath(), line);
+ m_bookmarkManager->toggleBookmark(editor->document()->filePath().toString(), line);
});
@@ -196,7 +196,7 @@ void BookmarksPlugin::requestContextMenu(TextEditorWidget *widget,
return;
m_bookmarkMarginActionLineNumber = lineNumber;
- m_bookmarkMarginActionFileName = widget->textDocument()->filePath();
+ m_bookmarkMarginActionFileName = widget->textDocument()->filePath().toString();
menu->addAction(m_bookmarkMarginAction);
if (m_bookmarkManager->hasBookmarkInPosition(m_bookmarkMarginActionFileName, m_bookmarkMarginActionLineNumber))
diff --git a/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp b/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp
index e7ded2e40b..afc47ecd33 100644
--- a/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp
+++ b/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp
@@ -94,7 +94,7 @@ namespace ClangCodeModel {
ClangEditorDocumentProcessor::ClangEditorDocumentProcessor(TextEditor::TextDocument *document)
: BaseEditorDocumentProcessor(document)
- , m_parser(document->filePath())
+ , m_parser(document->filePath().toString())
, m_parserRevision(0)
, m_semanticHighlighter(document)
, m_builtinProcessor(document, /*enableSemanticHighlighter=*/ false)
@@ -112,7 +112,7 @@ ClangEditorDocumentProcessor::ClangEditorDocumentProcessor(TextEditor::TextDocum
const int lastLine = baseTextDocument()->document()->blockCount();
CreateMarkers *createMarkers = CreateMarkers::create(m_parser.semanticMarker(),
- baseTextDocument()->filePath(),
+ baseTextDocument()->filePath().toString(),
firstLine, lastLine);
return createMarkers->start();
});
diff --git a/src/plugins/clangcodemodel/clangutils.cpp b/src/plugins/clangcodemodel/clangutils.cpp
index 7d37540f21..82cbbd5483 100644
--- a/src/plugins/clangcodemodel/clangutils.cpp
+++ b/src/plugins/clangcodemodel/clangutils.cpp
@@ -76,7 +76,7 @@ UnsavedFiles createUnsavedFiles(WorkingCopy workingCopy)
QSet< ::Utils::FileName> modifiedFiles;
foreach (IDocument *doc, Core::DocumentManager::modifiedDocuments())
- modifiedFiles.insert(::Utils::FileName::fromString(doc->filePath()));
+ modifiedFiles.insert(doc->filePath());
UnsavedFiles result;
QHashIterator< ::Utils::FileName, QPair<QByteArray, unsigned> > wcIter = workingCopy.iterator();
diff --git a/src/plugins/classview/classviewmanager.cpp b/src/plugins/classview/classviewmanager.cpp
index 56f6350b5e..f70cb60fba 100644
--- a/src/plugins/classview/classviewmanager.cpp
+++ b/src/plugins/classview/classviewmanager.cpp
@@ -455,7 +455,7 @@ void Manager::gotoLocations(const QList<QVariant> &list)
auto textEditor = qobject_cast<TextEditor::BaseTextEditor *>(EditorManager::currentEditor());
if (textEditor) {
// check if current cursor position is a known location of the symbol
- const QString fileName = textEditor->document()->filePath();
+ const QString fileName = textEditor->document()->filePath().toString();
int line;
int column;
textEditor->convertPosition(textEditor->position(), &line, &column);
diff --git a/src/plugins/clearcase/clearcaseplugin.cpp b/src/plugins/clearcase/clearcaseplugin.cpp
index a2d864a406..cf6e22db37 100644
--- a/src/plugins/clearcase/clearcaseplugin.cpp
+++ b/src/plugins/clearcase/clearcaseplugin.cpp
@@ -633,7 +633,7 @@ bool ClearCasePlugin::submitEditorAboutToClose()
// Submit editor closing. Make it write out the check in message
// and retrieve files
- const QFileInfo editorFile(editorDocument->filePath());
+ const QFileInfo editorFile = editorDocument->filePath().toFileInfo();
const QFileInfo changeFile(m_checkInMessageFileName);
if (editorFile.absoluteFilePath() != changeFile.absoluteFilePath())
return true; // Oops?!
diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp
index fa19445743..3acf674867 100644
--- a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp
@@ -85,7 +85,7 @@ void CMakeEditor::finalizeInitialization()
info.setCustomButtonInfo(tr("Build now"), [document]() {
foreach (Project *p, SessionManager::projects()) {
if (CMakeProject *cmakeProject = qobject_cast<CMakeProject *>(p)) {
- if (cmakeProject->isProjectFile(document->filePath())) {
+ if (cmakeProject->isProjectFile(document->filePath().toString())) {
ProjectExplorerPlugin::buildProject(cmakeProject);
break;
}
@@ -212,7 +212,7 @@ CMakeEditorWidget::Link CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
// TODO: Resolve variables
- QDir dir(QFileInfo(textDocument()->filePath()).absolutePath());
+ QDir dir(textDocument()->filePath().toFileInfo().absolutePath());
QString fileName = dir.filePath(buffer);
QFileInfo fi(fileName);
if (fi.exists()) {
@@ -252,14 +252,12 @@ CMakeDocument::CMakeDocument()
QString CMakeDocument::defaultPath() const
{
- QFileInfo fi(filePath());
- return fi.absolutePath();
+ return filePath().toFileInfo().absolutePath();
}
QString CMakeDocument::suggestedFileName() const
{
- QFileInfo fi(filePath());
- return fi.fileName();
+ return filePath().toFileInfo().fileName();
}
//
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
index 6a87c17da7..cd23330aa5 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
@@ -233,7 +233,7 @@ bool CMakeProject::parseCMakeLists()
CMakeBuildConfiguration *activeBC = static_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration());
foreach (Core::IDocument *document, Core::DocumentModel::openedDocuments())
- if (isProjectFile(document->filePath()))
+ if (isProjectFile(document->filePath().toString()))
document->infoBar()->removeInfo("CMakeEditor.RunCMake");
// Find cbp file
@@ -741,7 +741,7 @@ CMakeFile::CMakeFile(CMakeProject *parent, QString fileName)
{
setId("Cmake.ProjectFile");
setMimeType(QLatin1String(Constants::CMAKEPROJECTMIMETYPE));
- setFilePath(fileName);
+ setFilePath(Utils::FileName::fromString(fileName));
}
bool CMakeFile::save(QString *errorString, const QString &fileName, bool autoSave)
diff --git a/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp b/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp
index b8632e4183..2c860bb652 100644
--- a/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp
+++ b/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp
@@ -162,7 +162,7 @@ ReadOnlyFilesDialog::ReadOnlyFilesDialog(IDocument *document, QWidget *parent,
: QDialog(parent)
, d(new ReadOnlyFilesDialogPrivate(this, document, displaySaveAs))
{
- d->initDialog(QStringList(document->filePath()));
+ d->initDialog(QStringList(document->filePath().toString()));
}
ReadOnlyFilesDialog::ReadOnlyFilesDialog(const QList<IDocument *> &documents, QWidget *parent)
@@ -171,7 +171,7 @@ ReadOnlyFilesDialog::ReadOnlyFilesDialog(const QList<IDocument *> &documents, QW
{
QStringList files;
foreach (IDocument *document, documents)
- files << document->filePath();
+ files << document->filePath().toString();
d->initDialog(files);
}
diff --git a/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp b/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp
index ac8d73d7bf..ed186e7844 100644
--- a/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp
+++ b/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp
@@ -63,7 +63,7 @@ SaveItemsDialog::SaveItemsDialog(QWidget *parent,
foreach (IDocument *document, items) {
QString visibleName;
QString directory;
- QString fileName = document->filePath();
+ QString fileName = document->filePath().toString();
if (fileName.isEmpty()) {
visibleName = document->suggestedFileName();
} else {
diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp
index e7ace44aed..c62af65b3c 100644
--- a/src/plugins/coreplugin/documentmanager.cpp
+++ b/src/plugins/coreplugin/documentmanager.cpp
@@ -44,6 +44,7 @@
#include <coreplugin/editormanager/ieditorfactory.h>
#include <coreplugin/editormanager/iexternaleditor.h>
+#include <utils/fileutils.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <utils/pathchooser.h>
@@ -265,8 +266,8 @@ static void addFileInfo(const QString &fileName, IDocument *document, bool isLin
(The added file names are guaranteed to be absolute and cleaned.) */
static void addFileInfo(IDocument *document)
{
- const QString fixedName = DocumentManager::fixFileName(document->filePath(), DocumentManager::KeepLinks);
- const QString fixedResolvedName = DocumentManager::fixFileName(document->filePath(), DocumentManager::ResolveLinks);
+ const QString fixedName = DocumentManager::fixFileName(document->filePath().toString(), DocumentManager::KeepLinks);
+ const QString fixedResolvedName = DocumentManager::fixFileName(document->filePath().toString(), DocumentManager::ResolveLinks);
addFileInfo(fixedResolvedName, document, false);
if (fixedName != fixedResolvedName)
addFileInfo(fixedName, document, true);
@@ -285,7 +286,8 @@ void DocumentManager::addDocuments(const QList<IDocument *> &documents, bool add
foreach (IDocument *document, documents) {
if (document && !d->m_documentsWithoutWatch.contains(document)) {
connect(document, SIGNAL(destroyed(QObject*)), m_instance, SLOT(documentDestroyed(QObject*)));
- connect(document, SIGNAL(filePathChanged(QString,QString)), m_instance, SLOT(filePathChanged(QString,QString)));
+ connect(document, &IDocument::filePathChanged,
+ m_instance, &DocumentManager::filePathChanged);
d->m_documentsWithoutWatch.append(document);
}
}
@@ -296,7 +298,7 @@ void DocumentManager::addDocuments(const QList<IDocument *> &documents, bool add
if (document && !d->m_documentsWithWatch.contains(document)) {
connect(document, SIGNAL(changed()), m_instance, SLOT(checkForNewFileName()));
connect(document, SIGNAL(destroyed(QObject*)), m_instance, SLOT(documentDestroyed(QObject*)));
- connect(document, SIGNAL(filePathChanged(QString,QString)), m_instance, SLOT(filePathChanged(QString,QString)));
+ connect(document, &IDocument::filePathChanged, m_instance, &DocumentManager::filePathChanged);
addFileInfo(document);
}
}
@@ -387,20 +389,20 @@ void DocumentManager::renamedFile(const QString &from, const QString &to)
foreach (IDocument *document, documentsToRename) {
d->m_blockedIDocument = document;
removeFileInfo(document);
- document->setFilePath(to);
+ document->setFilePath(Utils::FileName::fromString(to));
addFileInfo(document);
d->m_blockedIDocument = 0;
}
emit m_instance->allDocumentsRenamed(from, to);
}
-void DocumentManager::filePathChanged(const QString &oldName, const QString &newName)
+void DocumentManager::filePathChanged(const Utils::FileName &oldName, const Utils::FileName &newName)
{
IDocument *doc = qobject_cast<IDocument *>(sender());
QTC_ASSERT(doc, return);
if (doc == d->m_blockedIDocument)
return;
- emit m_instance->documentRenamed(doc, oldName, newName);
+ emit m_instance->documentRenamed(doc, oldName.toString(), newName.toString());
}
/*!
@@ -564,7 +566,7 @@ static bool saveModifiedFilesHelper(const QList<IDocument *> &documents,
foreach (IDocument *document, documents) {
if (document && document->isModified()) {
- QString name = document->filePath();
+ QString name = document->filePath().toString();
if (name.isEmpty())
name = document->suggestedFileName();
@@ -634,7 +636,7 @@ static bool saveModifiedFilesHelper(const QList<IDocument *> &documents,
bool DocumentManager::saveDocument(IDocument *document, const QString &fileName, bool *isReadOnly)
{
bool ret = true;
- QString effName = fileName.isEmpty() ? document->filePath() : fileName;
+ QString effName = fileName.isEmpty() ? document->filePath().toString() : fileName;
expectFileChange(effName); // This only matters to other IDocuments which refer to this file
bool addWatcher = removeDocument(document); // So that our own IDocument gets no notification at all
@@ -721,7 +723,7 @@ QString DocumentManager::getSaveAsFileName(const IDocument *document, const QStr
{
if (!document)
return QLatin1String("");
- QString absoluteFilePath = document->filePath();
+ QString absoluteFilePath = document->filePath().toString();
const QFileInfo fi(absoluteFilePath);
QString path;
QString fileName;
@@ -1063,7 +1065,7 @@ void DocumentManager::checkForReload()
success = document->reload(&errorString, IDocument::FlagReload, IDocument::TypeContents);
} else {
// Ask about content change
- previousReloadAnswer = Utils::reloadPrompt(document->filePath(), document->isModified(),
+ previousReloadAnswer = Utils::reloadPrompt(document->filePath().toString(), document->isModified(),
ICore::dialogParent());
switch (previousReloadAnswer) {
case Utils::ReloadAll:
@@ -1086,13 +1088,13 @@ void DocumentManager::checkForReload()
while (unhandled) {
if (previousDeletedAnswer != Utils::FileDeletedCloseAll) {
previousDeletedAnswer =
- Utils::fileDeletedPrompt(document->filePath(),
+ Utils::fileDeletedPrompt(document->filePath().toString(),
trigger == IDocument::TriggerExternal,
QApplication::activeWindow());
}
switch (previousDeletedAnswer) {
case Utils::FileDeletedSave:
- documentsToSave.insert(document, document->filePath());
+ documentsToSave.insert(document, document->filePath().toString());
unhandled = false;
break;
case Utils::FileDeletedSaveAs:
@@ -1115,7 +1117,7 @@ void DocumentManager::checkForReload()
}
if (!success) {
if (errorString.isEmpty())
- errorStrings << tr("Cannot reload %1").arg(QDir::toNativeSeparators(document->filePath()));
+ errorStrings << tr("Cannot reload %1").arg(document->filePath().toUserOutput());
else
errorStrings << errorString;
}
diff --git a/src/plugins/coreplugin/documentmanager.h b/src/plugins/coreplugin/documentmanager.h
index d0dd6058c3..79c41a362b 100644
--- a/src/plugins/coreplugin/documentmanager.h
+++ b/src/plugins/coreplugin/documentmanager.h
@@ -43,6 +43,8 @@ class QMainWindow;
class QMenu;
QT_END_NAMESPACE
+namespace Utils { class FileName; }
+
namespace Core {
class IContext;
@@ -160,7 +162,6 @@ protected:
private slots:
void documentDestroyed(QObject *obj);
- void filePathChanged(const QString &oldName, const QString &newName);
void checkForNewFileName();
void checkForReload();
void changedFile(const QString &file);
@@ -169,6 +170,8 @@ private:
explicit DocumentManager(QObject *parent);
~DocumentManager();
+ void filePathChanged(const Utils::FileName &oldName, const Utils::FileName &newName);
+
friend class Core::Internal::MainWindow;
};
diff --git a/src/plugins/coreplugin/editormanager/documentmodel.cpp b/src/plugins/coreplugin/editormanager/documentmodel.cpp
index b6c88e1983..d80ebacd39 100644
--- a/src/plugins/coreplugin/editormanager/documentmodel.cpp
+++ b/src/plugins/coreplugin/editormanager/documentmodel.cpp
@@ -130,7 +130,7 @@ QAbstractItemModel *DocumentModel::model()
QString DocumentModel::Entry::fileName() const
{
- return document ? document->filePath() : m_fileName;
+ return document ? document->filePath().toString() : m_fileName;
}
QString DocumentModel::Entry::displayName() const
@@ -400,13 +400,10 @@ QVariant DocumentModelPrivate::data(const QModelIndex &index, int role) const
case Qt::DecorationRole:
{
bool showLock = false;
- if (e->document) {
- showLock = e->document->filePath().isEmpty()
- ? false
- : e->document->isFileReadOnly();
- } else {
+ if (e->document)
+ showLock = e->document->filePath().isEmpty() ? false : e->document->isFileReadOnly();
+ else
showLock = !QFileInfo(e->m_fileName).isWritable();
- }
return showLock ? m_lockedIcon : QIcon();
}
case Qt::ToolTipRole:
diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index 013ce279e8..4925a692be 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -492,7 +492,7 @@ void EditorManagerPrivate::init()
globalMacroExpander()->registerFileVariables(kCurrentDocumentPrefix, tr("Current document"),
[]() -> QString {
IDocument *document = EditorManager::currentDocument();
- return document ? document->filePath() : QString();
+ return document ? document->filePath().toString() : QString();
});
globalMacroExpander()->registerIntVariable(kCurrentDocumentXPos,
@@ -930,7 +930,7 @@ void EditorManagerPrivate::addEditor(IEditor *editor)
const bool addWatcher = !isTemporary;
DocumentManager::addDocument(editor->document(), addWatcher);
if (!isTemporary)
- DocumentManager::addToRecentFiles(editor->document()->filePath(),
+ DocumentManager::addToRecentFiles(editor->document()->filePath().toString(),
editor->document()->id());
}
emit m_instance->editorOpened(editor);
@@ -988,7 +988,7 @@ IEditor *EditorManagerPrivate::duplicateEditor(IEditor *editor)
IEditor *duplicate = editor->duplicate();
duplicate->restoreState(editor->saveState());
- emit m_instance->editorCreated(duplicate, duplicate->document()->filePath());
+ emit m_instance->editorCreated(duplicate, duplicate->document()->filePath().toString());
addEditor(duplicate);
return duplicate;
}
@@ -1077,7 +1077,7 @@ void EditorManagerPrivate::activateView(EditorView *view)
void EditorManagerPrivate::restoreEditorState(IEditor *editor)
{
QTC_ASSERT(editor, return);
- QString fileName = editor->document()->filePath();
+ QString fileName = editor->document()->filePath().toString();
editor->restoreState(d->m_editorStates.value(fileName).toByteArray());
}
@@ -1253,7 +1253,7 @@ void EditorManagerPrivate::addDocumentToRecentFiles(IDocument *document)
DocumentModel::Entry *entry = DocumentModel::entryForDocument(document);
if (!entry)
return;
- DocumentManager::addToRecentFiles(document->filePath(), entry->id());
+ DocumentManager::addToRecentFiles(document->filePath().toString(), entry->id());
}
void EditorManagerPrivate::updateAutoSave()
@@ -1275,9 +1275,9 @@ void EditorManagerPrivate::updateMakeWritableWarning()
// Do this after setWriteWarning so we don't re-evaluate this part even
// if we do not really show a warning.
bool promptVCS = false;
- const QString directory = QFileInfo(document->filePath()).absolutePath();
+ const QString directory = document->filePath().toFileInfo().absolutePath();
IVersionControl *versionControl = VcsManager::findVersionControlForDirectory(directory);
- if (versionControl && versionControl->openSupportMode(document->filePath()) != IVersionControl::NoOpen) {
+ if (versionControl && versionControl->openSupportMode(document->filePath().toString()) != IVersionControl::NoOpen) {
if (versionControl->settingsFlags() & IVersionControl::AutoOpen) {
vcsOpenCurrentEditor();
ww = false;
@@ -1368,7 +1368,7 @@ void EditorManagerPrivate::updateWindowTitleForDocument(IDocument *document, QWi
QString windowTitle;
const QString dashSep = QLatin1String(" - ");
- QString filePath = document ? QFileInfo(document->filePath()).absoluteFilePath()
+ QString filePath = document ? document->filePath().toFileInfo().absoluteFilePath()
: QString();
const QString windowTitleAddition = d->m_titleAdditionHandler
@@ -1473,12 +1473,12 @@ void EditorManagerPrivate::vcsOpenCurrentEditor()
if (!document)
return;
- const QString directory = QFileInfo(document->filePath()).absolutePath();
+ const QString directory = document->filePath().toFileInfo().absolutePath();
IVersionControl *versionControl = VcsManager::findVersionControlForDirectory(directory);
- if (!versionControl || versionControl->openSupportMode(document->filePath()) == IVersionControl::NoOpen)
+ if (!versionControl || versionControl->openSupportMode(document->filePath().toString()) == IVersionControl::NoOpen)
return;
- if (!versionControl->vcsOpen(document->filePath())) {
+ if (!versionControl->vcsOpen(document->filePath().toString())) {
// TODO: wrong dialog parent
QMessageBox::warning(ICore::mainWindow(), tr("Cannot Open File"),
tr("Cannot open the file for editing with VCS."));
@@ -1550,7 +1550,7 @@ void EditorManagerPrivate::autoSave()
if (document->filePath().isEmpty()) // FIXME: save them to a dedicated directory
continue;
QString errorString;
- if (!document->autoSave(&errorString, autoSaveName(document->filePath())))
+ if (!document->autoSave(&errorString, autoSaveName(document->filePath().toString())))
errors << errorString;
}
if (!errors.isEmpty())
@@ -1577,7 +1577,7 @@ void EditorManagerPrivate::handleContextChange(const QList<IContext *> &context)
QTimer::singleShot(0, d, SLOT(setCurrentEditorFromContextChange()));
} else {
if (editor && !editor->document()->isTemporary())
- DocumentManager::setCurrentFile(editor->document()->filePath());
+ DocumentManager::setCurrentFile(editor->document()->filePath().toString());
updateActions();
}
}
@@ -1653,7 +1653,7 @@ bool EditorManagerPrivate::saveDocument(IDocument *document)
document->checkPermissions();
- const QString &fileName = document->filePath();
+ const QString &fileName = document->filePath().toString();
if (fileName.isEmpty())
return saveDocumentAs(document);
@@ -1689,7 +1689,7 @@ bool EditorManagerPrivate::saveDocumentAs(IDocument *document)
const QString filter = MimeDatabase::allFiltersString();
QString selectedFilter =
- MimeDatabase::findByFile(QFileInfo(document->filePath())).filterString();
+ MimeDatabase::findByFile(document->filePath().toFileInfo()).filterString();
if (selectedFilter.isEmpty())
selectedFilter = MimeDatabase::findByType(document->mimeType()).filterString();
const QString &absoluteFilePath =
@@ -1698,7 +1698,7 @@ bool EditorManagerPrivate::saveDocumentAs(IDocument *document)
if (absoluteFilePath.isEmpty())
return false;
- if (absoluteFilePath != document->filePath()) {
+ if (absoluteFilePath != document->filePath().toString()) {
// close existing editors for the new file name
IDocument *otherDocument = DocumentModel::documentForFilePath(absoluteFilePath);
if (otherDocument)
@@ -1734,7 +1734,7 @@ void EditorManagerPrivate::revertToSaved(IDocument *document)
{
if (!document)
return;
- const QString fileName = document->filePath();
+ const QString fileName = document->filePath().toString();
if (fileName.isEmpty())
return;
if (document->isModified()) {
@@ -1824,7 +1824,7 @@ void EditorManagerPrivate::setCurrentEditorFromContextChange()
d->m_scheduledCurrentEditor = 0;
setCurrentEditor(newCurrent);
if (!newCurrent->document()->isTemporary())
- DocumentManager::setCurrentFile(newCurrent->document()->filePath());
+ DocumentManager::setCurrentFile(newCurrent->document()->filePath().toString());
}
@@ -2096,7 +2096,7 @@ bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool ask
&& !editor->document()->isTemporary()) {
QByteArray state = editor->saveState();
if (!state.isEmpty())
- d->m_editorStates.insert(editor->document()->filePath(), QVariant(state));
+ d->m_editorStates.insert(editor->document()->filePath().toString(), QVariant(state));
}
EditorManagerPrivate::removeEditor(editor);
@@ -2468,7 +2468,7 @@ QByteArray EditorManager::saveState()
IEditor *editor = DocumentModel::editorsForDocument(document).first();
QByteArray state = editor->saveState();
if (!state.isEmpty())
- d->m_editorStates.insert(document->filePath(), QVariant(state));
+ d->m_editorStates.insert(document->filePath().toString(), QVariant(state));
}
}
diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp
index d54be3dd3e..fc0a312460 100644
--- a/src/plugins/coreplugin/editormanager/editorview.cpp
+++ b/src/plugins/coreplugin/editormanager/editorview.cpp
@@ -219,7 +219,7 @@ void EditorView::updateEditorHistory(IEditor *editor, QList<EditLocation> &histo
EditLocation location;
location.document = document;
- location.fileName = document->filePath();
+ location.fileName = document->filePath().toString();
location.id = document->id();
location.state = QVariant(state);
@@ -440,7 +440,7 @@ void EditorView::addCurrentPositionToNavigationHistory(const QByteArray &saveSta
EditLocation location;
location.document = document;
- location.fileName = document->filePath();
+ location.fileName = document->filePath().toString();
location.id = document->id();
location.state = QVariant(state);
m_currentNavigationHistoryPosition = qMin(m_currentNavigationHistoryPosition, m_navigationHistory.size()); // paranoia
@@ -495,7 +495,7 @@ void EditorView::updateCurrentPositionInNavigationHistory()
location = &m_navigationHistory[m_navigationHistory.size()-1];
}
location->document = document;
- location->fileName = document->filePath();
+ location->fileName = document->filePath().toString();
location->id = document->id();
location->state = QVariant(editor->saveState());
}
@@ -810,10 +810,14 @@ QByteArray SplitterOrView::saveState() const
stream << QByteArray("empty");
} else if (e == EditorManager::currentEditor()) {
stream << QByteArray("currenteditor")
- << e->document()->filePath() << e->document()->id().toString() << e->saveState();
+ << e->document()->filePath().toString()
+ << e->document()->id().toString()
+ << e->saveState();
} else {
stream << QByteArray("editor")
- << e->document()->filePath() << e->document()->id().toString() << e->saveState();
+ << e->document()->filePath().toString()
+ << e->document()->id().toString()
+ << e->saveState();
}
}
return bytes;
diff --git a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp
index 0a51d68a6d..c172161320 100644
--- a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp
+++ b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp
@@ -233,7 +233,7 @@ void OpenEditorsWindow::addHistoryItems(const QList<EditLocation> &history, Edit
item->setIcon(0, !hi.document->filePath().isEmpty() && hi.document->isFileReadOnly()
? DocumentModel::lockedIcon() : m_emptyIcon);
item->setText(0, title);
- item->setToolTip(0, hi.document->filePath());
+ item->setToolTip(0, hi.document->filePath().toString());
item->setData(0, Qt::UserRole, QVariant::fromValue(hi.document.data()));
item->setData(0, Qt::UserRole+1, QVariant::fromValue(view));
item->setTextAlignment(0, Qt::AlignLeft);
diff --git a/src/plugins/coreplugin/editortoolbar.cpp b/src/plugins/coreplugin/editortoolbar.cpp
index b18376abc1..a2f4018832 100644
--- a/src/plugins/coreplugin/editortoolbar.cpp
+++ b/src/plugins/coreplugin/editortoolbar.cpp
@@ -424,12 +424,11 @@ void EditorToolBar::updateDocumentStatus(IDocument *document)
if (document->filePath().isEmpty())
d->m_dragHandle->setIcon(QIcon());
else
- d->m_dragHandle->setIcon(FileIconProvider::icon(QFileInfo(document->filePath())));
+ d->m_dragHandle->setIcon(FileIconProvider::icon(document->filePath().toFileInfo()));
- d->m_editorList->setToolTip(
- document->filePath().isEmpty()
- ? document->displayName()
- : QDir::toNativeSeparators(document->filePath()));
+ d->m_editorList->setToolTip(document->filePath().isEmpty()
+ ? document->displayName()
+ : document->filePath().toUserOutput());
}
bool EditorToolBar::eventFilter(QObject *obj, QEvent *event)
diff --git a/src/plugins/coreplugin/externaltool.cpp b/src/plugins/coreplugin/externaltool.cpp
index c3fe3ae4bd..5be3349644 100644
--- a/src/plugins/coreplugin/externaltool.cpp
+++ b/src/plugins/coreplugin/externaltool.cpp
@@ -591,7 +591,7 @@ void ExternalToolRunner::run()
}
if (m_tool->modifiesCurrentDocument()) {
if (IDocument *document = EditorManager::currentDocument()) {
- m_expectedFileName = document->filePath();
+ m_expectedFileName = document->filePath().toString();
if (!DocumentManager::saveModifiedDocument(document)) {
deleteLater();
return;
diff --git a/src/plugins/coreplugin/idocument.cpp b/src/plugins/coreplugin/idocument.cpp
index 4bd5484d80..a953eebd51 100644
--- a/src/plugins/coreplugin/idocument.cpp
+++ b/src/plugins/coreplugin/idocument.cpp
@@ -82,7 +82,7 @@ public:
Id id;
QString mimeType;
- QString filePath;
+ Utils::FileName filePath;
QString displayName;
QString autoSaveName;
InfoBar *infoBar;
@@ -127,7 +127,7 @@ bool IDocument::setContents(const QByteArray &contents)
return false;
}
-QString IDocument::filePath() const
+Utils::FileName IDocument::filePath() const
{
return d->filePath;
}
@@ -154,7 +154,7 @@ bool IDocument::isFileReadOnly() const
{
if (filePath().isEmpty())
return false;
- return !QFileInfo(filePath()).isWritable();
+ return !filePath().toFileInfo().isWritable();
}
/*!
@@ -244,11 +244,11 @@ InfoBar *IDocument::infoBar()
signals. Can be reimplemented by subclasses to do more.
\sa filePath()
*/
-void IDocument::setFilePath(const QString &filePath)
+void IDocument::setFilePath(const Utils::FileName &filePath)
{
if (d->filePath == filePath)
return;
- QString oldName = d->filePath;
+ Utils::FileName oldName = d->filePath;
d->filePath = filePath;
emit filePathChanged(oldName, d->filePath);
emit changed();
@@ -263,7 +263,7 @@ QString IDocument::displayName() const
{
if (!d->displayName.isEmpty())
return d->displayName;
- return QFileInfo(d->filePath).fileName();
+ return d->filePath.toFileInfo().fileName();
}
/*!
diff --git a/src/plugins/coreplugin/idocument.h b/src/plugins/coreplugin/idocument.h
index 8e88a9cc52..2a04fd441e 100644
--- a/src/plugins/coreplugin/idocument.h
+++ b/src/plugins/coreplugin/idocument.h
@@ -34,6 +34,8 @@
#include "core_global.h"
#include "id.h"
+#include <utils/fileutils.h>
+
#include <QObject>
namespace Core {
@@ -88,8 +90,8 @@ public:
virtual bool save(QString *errorString, const QString &fileName = QString(), bool autoSave = false) = 0;
virtual bool setContents(const QByteArray &contents);
- QString filePath() const;
- virtual void setFilePath(const QString &filePath);
+ Utils::FileName filePath() const;
+ virtual void setFilePath(const Utils::FileName &filePath);
QString displayName() const;
void setDisplayName(const QString &name);
@@ -128,7 +130,7 @@ signals:
void aboutToReload();
void reloadFinished(bool success);
- void filePathChanged(const QString &oldName, const QString &newName);
+ void filePathChanged(const Utils::FileName &oldName, const Utils::FileName &newName);
private:
Internal::IDocumentPrivate *d;
diff --git a/src/plugins/coreplugin/locator/filesystemfilter.cpp b/src/plugins/coreplugin/locator/filesystemfilter.cpp
index 81215c1bad..d4aff295e0 100644
--- a/src/plugins/coreplugin/locator/filesystemfilter.cpp
+++ b/src/plugins/coreplugin/locator/filesystemfilter.cpp
@@ -69,7 +69,7 @@ void FileSystemFilter::prepareSearch(const QString &entry)
Q_UNUSED(entry)
IDocument *document= EditorManager::currentDocument();
if (document && !document->filePath().isEmpty()) {
- QFileInfo info(document->filePath());
+ const QFileInfo info = document->filePath().toFileInfo();
m_currentDocumentDirectory = info.absolutePath() + QLatin1Char('/');
} else {
m_currentDocumentDirectory.clear();
diff --git a/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp b/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp
index 7c189f52e2..7826148d30 100644
--- a/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp
+++ b/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp
@@ -71,7 +71,7 @@ TextEditor::BaseTextEditor *currentEditor()
QString fileInCurrentEditor()
{
if (TextEditor::BaseTextEditor *editor = currentEditor())
- return editor->document()->filePath();
+ return editor->document()->filePath().toString();
return QString();
}
@@ -1364,7 +1364,7 @@ void CppCodeModelInspectorDialog::refresh()
TextEditor::BaseTextEditor *editor = currentEditor();
EditorDocumentHandle *editorDocument = 0;
if (editor) {
- const QString editorFilePath = editor->document()->filePath();
+ const QString editorFilePath = editor->document()->filePath().toString();
editorDocument = cmmi->editorDocument(editorFilePath);
if (auto *documentProcessor = BaseEditorDocumentProcessor::get(editorFilePath)) {
const CPlusPlus::Snapshot editorSnapshot = documentProcessor->snapshot();
diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp
index 3ea97b7324..e01f08c85c 100644
--- a/src/plugins/cppeditor/cppeditor.cpp
+++ b/src/plugins/cppeditor/cppeditor.cpp
@@ -637,7 +637,7 @@ AssistInterface *CppEditorWidget::createAssistInterface(AssistKind kind, AssistR
if (CppCompletionAssistProvider *cap =
qobject_cast<CppCompletionAssistProvider *>(cppEditorDocument()->completionAssistProvider())) {
return cap->createAssistInterface(
- textDocument()->filePath(),
+ textDocument()->filePath().toString(),
document(),
cppEditorDocument()->isObjCEnabled(),
position(),
@@ -766,7 +766,7 @@ void CppEditorWidget::abortDeclDefLink()
void CppEditorWidget::showPreProcessorWidget()
{
- const Utils::FileName fileName = Utils::FileName::fromString(textDocument()->filePath());
+ const Utils::FileName fileName = textDocument()->filePath();
// Check if this editor belongs to a project
QList<ProjectPart::Ptr> projectParts = d->m_modelManager->projectPart(fileName);
@@ -775,7 +775,7 @@ void CppEditorWidget::showPreProcessorWidget()
if (projectParts.isEmpty())
projectParts << d->m_modelManager->fallbackProjectPart();
- CppPreProcessorDialog preProcessorDialog(this, textDocument()->filePath(), projectParts);
+ CppPreProcessorDialog preProcessorDialog(this, textDocument()->filePath().toString(), projectParts);
if (preProcessorDialog.exec() == QDialog::Accepted) {
cppEditorDocument()->setPreprocessorSettings(
preProcessorDialog.projectPart(),
diff --git a/src/plugins/cppeditor/cppeditordocument.cpp b/src/plugins/cppeditor/cppeditordocument.cpp
index 987ee522a5..3c68be7acf 100644
--- a/src/plugins/cppeditor/cppeditordocument.cpp
+++ b/src/plugins/cppeditor/cppeditordocument.cpp
@@ -68,14 +68,14 @@ class CppEditorDocumentHandle : public CppTools::EditorDocumentHandle
public:
CppEditorDocumentHandle(CppEditor::Internal::CppEditorDocument *cppEditorDocument)
: m_cppEditorDocument(cppEditorDocument)
- , m_registrationFilePath(cppEditorDocument->filePath())
+ , m_registrationFilePath(cppEditorDocument->filePath().toString())
{
mm()->registerEditorDocument(this);
}
~CppEditorDocumentHandle() { mm()->unregisterEditorDocument(m_registrationFilePath); }
- QString filePath() const { return m_cppEditorDocument->filePath(); }
+ QString filePath() const { return m_cppEditorDocument->filePath().toString(); }
QByteArray contents() const { return m_cppEditorDocument->contentsText(); }
unsigned revision() const { return m_cppEditorDocument->contentsRevision(); }
@@ -105,8 +105,8 @@ CppEditorDocument::CppEditorDocument()
connect(this, SIGNAL(aboutToReload()), this, SLOT(onAboutToReload()));
connect(this, SIGNAL(reloadFinished(bool)), this, SLOT(onReloadFinished()));
- connect(this, SIGNAL(filePathChanged(QString,QString)),
- this, SLOT(onFilePathChanged(QString,QString)));
+ connect(this, &IDocument::filePathChanged,
+ this, &CppEditorDocument::onFilePathChanged);
m_processorTimer.setSingleShot(true);
m_processorTimer.setInterval(processDocumentIntervalInMs);
@@ -196,12 +196,13 @@ void CppEditorDocument::onReloadFinished()
m_fileIsBeingReloaded = false;
}
-void CppEditorDocument::onFilePathChanged(const QString &oldPath, const QString &newPath)
+void CppEditorDocument::onFilePathChanged(const Utils::FileName &oldPath,
+ const Utils::FileName &newPath)
{
Q_UNUSED(oldPath);
if (!newPath.isEmpty()) {
- setMimeType(Core::MimeDatabase::findByFile(QFileInfo(newPath)).type());
+ setMimeType(Core::MimeDatabase::findByFile(newPath.toFileInfo()).type());
disconnect(this, SIGNAL(contentsChanged()), this, SLOT(scheduleProcessDocument()));
connect(this, SIGNAL(contentsChanged()), this, SLOT(scheduleProcessDocument()));
@@ -250,8 +251,8 @@ void CppEditorDocument::updatePreprocessorSettings()
const QString prefix = QLatin1String(Constants::CPP_PREPROCESSOR_PROJECT_PREFIX);
const QString &projectFile = ProjectExplorer::SessionManager::value(
- prefix + filePath()).toString();
- const QString directivesKey = projectFile + QLatin1Char(',') + filePath();
+ prefix + filePath().toString()).toString();
+ const QString directivesKey = projectFile + QLatin1Char(',') + filePath().toString();
const QByteArray additionalDirectives = ProjectExplorer::SessionManager::value(
directivesKey).toString().toUtf8();
diff --git a/src/plugins/cppeditor/cppeditordocument.h b/src/plugins/cppeditor/cppeditordocument.h
index ace78a6548..5fea535373 100644
--- a/src/plugins/cppeditor/cppeditordocument.h
+++ b/src/plugins/cppeditor/cppeditordocument.h
@@ -84,7 +84,7 @@ protected:
private slots:
void invalidateFormatterCache();
- void onFilePathChanged(const QString &oldPath, const QString &newPath);
+ void onFilePathChanged(const Utils::FileName &oldPath, const Utils::FileName &newPath);
void onMimeTypeChanged();
void onAboutToReload();
diff --git a/src/plugins/cppeditor/cppeditoroutline.cpp b/src/plugins/cppeditor/cppeditoroutline.cpp
index a5d1c776fc..7b26ac198e 100644
--- a/src/plugins/cppeditor/cppeditoroutline.cpp
+++ b/src/plugins/cppeditor/cppeditoroutline.cpp
@@ -195,7 +195,7 @@ void CppEditorOutline::updateNow()
return;
const CPlusPlus::Snapshot snapshot = cmmi->snapshot();
- const QString filePath = m_editorWidget->textDocument()->filePath();
+ const QString filePath = m_editorWidget->textDocument()->filePath().toString();
CPlusPlus::Document::Ptr document = snapshot.document(filePath);
if (!document)
return;
diff --git a/src/plugins/cppeditor/cppelementevaluator.cpp b/src/plugins/cppeditor/cppelementevaluator.cpp
index 32960691de..7d0ce8f3f9 100644
--- a/src/plugins/cppeditor/cppelementevaluator.cpp
+++ b/src/plugins/cppeditor/cppelementevaluator.cpp
@@ -88,7 +88,7 @@ void CppElementEvaluator::execute()
return;
const Snapshot &snapshot = m_modelManager->snapshot();
- Document::Ptr doc = snapshot.document(m_editor->textDocument()->filePath());
+ Document::Ptr doc = snapshot.document(m_editor->textDocument()->filePath().toString());
if (!doc)
return;
diff --git a/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp b/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp
index 0f52de09fa..ac0600554b 100644
--- a/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp
+++ b/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp
@@ -550,7 +550,7 @@ TextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &curs
}
// Now we prefer the doc from the snapshot with macros expanded.
- Document::Ptr doc = snapshot.document(m_widget->textDocument()->filePath());
+ Document::Ptr doc = snapshot.document(m_widget->textDocument()->filePath().toString());
if (!doc) {
doc = documentFromSemanticInfo;
if (!doc)
@@ -645,7 +645,7 @@ TextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &curs
if (Symbol *d = r.declaration()) {
if (d->isDeclaration() || d->isFunction()) {
const QString fileName = QString::fromUtf8(d->fileName(), d->fileNameLength());
- if (m_widget->textDocument()->filePath() == fileName) {
+ if (m_widget->textDocument()->filePath().toString() == fileName) {
if (unsigned(lineNumber) == d->line()
&& unsigned(positionInBlock) >= d->column()) { // TODO: check the end
result = r; // take the symbol under cursor.
diff --git a/src/plugins/cppeditor/cppincludehierarchy.cpp b/src/plugins/cppeditor/cppincludehierarchy.cpp
index ce5d145a1b..d4f6865e07 100644
--- a/src/plugins/cppeditor/cppincludehierarchy.cpp
+++ b/src/plugins/cppeditor/cppincludehierarchy.cpp
@@ -118,12 +118,12 @@ void CppIncludeHierarchyWidget::perform()
return;
m_model->clear();
- m_model->buildHierarchy(m_editor, widget->textDocument()->filePath());
+ m_model->buildHierarchy(m_editor, widget->textDocument()->filePath().toString());
if (m_model->isEmpty())
return;
m_inspectedFile->setText(widget->textDocument()->displayName());
- m_inspectedFile->setLink(TextEditorWidget::Link(widget->textDocument()->filePath()));
+ m_inspectedFile->setLink(TextEditorWidget::Link(widget->textDocument()->filePath().toString()));
//expand "Includes"
m_treeView->expand(m_model->index(0, 0));
diff --git a/src/plugins/cppeditor/cppincludehierarchymodel.cpp b/src/plugins/cppeditor/cppincludehierarchymodel.cpp
index a7fb9780bb..07bbe84e5e 100644
--- a/src/plugins/cppeditor/cppincludehierarchymodel.cpp
+++ b/src/plugins/cppeditor/cppincludehierarchymodel.cpp
@@ -174,7 +174,7 @@ void CppIncludeHierarchyModel::fetchMore(const QModelIndex &parent)
return;
if (parentItem->needChildrenPopulate()) {
- const QString editorFilePath = m_editor->document()->filePath();
+ const QString editorFilePath = m_editor->document()->filePath().toString();
QSet<QString> cyclic;
cyclic << editorFilePath;
CppIncludeHierarchyItem *item = parentItem->parent();
@@ -285,7 +285,7 @@ void CppIncludeHierarchyModel::buildHierarchyIncludes(const QString &currentFile
if (!m_editor)
return;
- const QString editorFilePath = m_editor->document()->filePath();
+ const QString editorFilePath = m_editor->document()->filePath().toString();
auto *documentProcessor = BaseEditorDocumentProcessor::get(editorFilePath);
QTC_ASSERT(documentProcessor, return);
const Snapshot editorDocumentSnapshot = documentProcessor->snapshot();
diff --git a/src/plugins/cppeditor/cppquickfixassistant.cpp b/src/plugins/cppeditor/cppquickfixassistant.cpp
index b9a2c867e6..6bfb0e5d51 100644
--- a/src/plugins/cppeditor/cppquickfixassistant.cpp
+++ b/src/plugins/cppeditor/cppquickfixassistant.cpp
@@ -77,7 +77,7 @@ QList<TextEditor::QuickFixFactory *> CppQuickFixAssistProvider::quickFixFactorie
CppQuickFixInterface::CppQuickFixInterface(CppEditorWidget *editor,
TextEditor::AssistReason reason)
: AssistInterface(editor->document(), editor->position(),
- editor->textDocument()->filePath(), reason)
+ editor->textDocument()->filePath().toString(), reason)
, m_editor(editor)
, m_semanticInfo(editor->semanticInfo())
, m_snapshot(CppTools::CppModelManager::instance()->snapshot())
diff --git a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
index 2637efc51d..685febfe69 100644
--- a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
+++ b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
@@ -344,7 +344,7 @@ F2TestCase::F2TestCase(CppEditorAction action,
BaseTextEditor *currentTextEditor = dynamic_cast<BaseTextEditor*>(currentEditor);
QVERIFY(currentTextEditor);
- QCOMPARE(currentTextEditor->document()->filePath(), targetTestFile->filePath());
+ QCOMPARE(currentTextEditor->document()->filePath().toString(), targetTestFile->filePath());
int expectedLine, expectedColumn;
currentTextEditor->convertPosition(targetTestFile->m_targetCursorPosition,
&expectedLine, &expectedColumn);
diff --git a/src/plugins/cpptools/baseeditordocumentprocessor.h b/src/plugins/cpptools/baseeditordocumentprocessor.h
index 866508eaab..edc9924f7b 100644
--- a/src/plugins/cpptools/baseeditordocumentprocessor.h
+++ b/src/plugins/cpptools/baseeditordocumentprocessor.h
@@ -87,7 +87,7 @@ protected:
CppTools::WorkingCopy workingCopy);
// Convenience
- QString filePath() const { return m_baseTextDocument->filePath(); }
+ QString filePath() const { return m_baseTextDocument->filePath().toString(); }
unsigned revision() const { return static_cast<unsigned>(textDocument()->revision()); }
QTextDocument *textDocument() const { return m_baseTextDocument->document(); }
diff --git a/src/plugins/cpptools/builtineditordocumentprocessor.cpp b/src/plugins/cpptools/builtineditordocumentprocessor.cpp
index 758c7083db..f81094e110 100644
--- a/src/plugins/cpptools/builtineditordocumentprocessor.cpp
+++ b/src/plugins/cpptools/builtineditordocumentprocessor.cpp
@@ -128,7 +128,7 @@ BuiltinEditorDocumentProcessor::BuiltinEditorDocumentProcessor(
TextEditor::TextDocument *document,
bool enableSemanticHighlighter)
: BaseEditorDocumentProcessor(document)
- , m_parser(document->filePath())
+ , m_parser(document->filePath().toString())
, m_codeWarningsUpdated(false)
, m_semanticHighlighter(enableSemanticHighlighter
? new CppTools::SemanticHighlighter(document)
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp
index a676a5efec..5d3d54b2a1 100644
--- a/src/plugins/cpptools/cppcompletion_test.cpp
+++ b/src/plugins/cpptools/cppcompletion_test.cpp
@@ -105,7 +105,7 @@ public:
{
QStringList completions;
CppCompletionAssistInterface *ai
- = new CppCompletionAssistInterface(m_editorWidget->textDocument()->filePath(),
+ = new CppCompletionAssistInterface(m_editorWidget->textDocument()->filePath().toString(),
m_editorWidget->document(), m_position,
ExplicitlyInvoked, m_snapshot,
ProjectPart::HeaderPaths());
diff --git a/src/plugins/cpptools/cppcurrentdocumentfilter.cpp b/src/plugins/cpptools/cppcurrentdocumentfilter.cpp
index 306e77f683..2317bed647 100644
--- a/src/plugins/cpptools/cppcurrentdocumentfilter.cpp
+++ b/src/plugins/cpptools/cppcurrentdocumentfilter.cpp
@@ -133,7 +133,7 @@ void CppCurrentDocumentFilter::onCurrentEditorChanged(Core::IEditor *currentEdit
{
QMutexLocker locker(&m_mutex);
if (currentEditor)
- m_currentFileName = currentEditor->document()->filePath();
+ m_currentFileName = currentEditor->document()->filePath().toString();
else
m_currentFileName.clear();
m_itemsOfCurrentDoc.clear();
@@ -145,7 +145,7 @@ void CppCurrentDocumentFilter::onEditorAboutToClose(Core::IEditor *editorAboutTo
return;
QMutexLocker locker(&m_mutex);
- if (m_currentFileName == editorAboutToClose->document()->filePath()) {
+ if (m_currentFileName == editorAboutToClose->document()->filePath().toString()) {
m_currentFileName.clear();
m_itemsOfCurrentDoc.clear();
}
diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp
index a2c263ee0a..7568a32e7c 100644
--- a/src/plugins/cpptools/cppmodelmanager.cpp
+++ b/src/plugins/cpptools/cppmodelmanager.cpp
@@ -699,7 +699,7 @@ void CppModelManager::updateCppEditorDocuments() const
QSet<Core::IDocument *> visibleCppEditorDocuments;
foreach (Core::IEditor *editor, Core::EditorManager::visibleEditors()) {
if (Core::IDocument *document = editor->document()) {
- if (EditorDocumentHandle *cppEditorDocument = editorDocument(document->filePath())) {
+ if (EditorDocumentHandle *cppEditorDocument = editorDocument(document->filePath().toString())) {
visibleCppEditorDocuments.insert(document);
cppEditorDocument->processor()->run();
}
@@ -711,7 +711,7 @@ void CppModelManager::updateCppEditorDocuments() const
= Core::DocumentModel::openedDocuments().toSet();
invisibleCppEditorDocuments.subtract(visibleCppEditorDocuments);
foreach (Core::IDocument *document, invisibleCppEditorDocuments) {
- if (EditorDocumentHandle *cppEditorDocument = editorDocument(document->filePath()))
+ if (EditorDocumentHandle *cppEditorDocument = editorDocument(document->filePath().toString()))
cppEditorDocument->setNeedsRefresh(true);
}
}
@@ -887,7 +887,8 @@ void CppModelManager::onCurrentEditorChanged(Core::IEditor *editor)
if (!editor || !editor->document())
return;
- if (EditorDocumentHandle *cppEditorDocument = editorDocument(editor->document()->filePath())) {
+ if (EditorDocumentHandle *cppEditorDocument =
+ editorDocument(editor->document()->filePath().toString())) {
if (cppEditorDocument->needsRefresh()) {
cppEditorDocument->setNeedsRefresh(false);
cppEditorDocument->processor()->run();
diff --git a/src/plugins/cpptools/cppmodelmanager_test.cpp b/src/plugins/cpptools/cppmodelmanager_test.cpp
index c1ec0a33f9..cd9d078a3c 100644
--- a/src/plugins/cpptools/cppmodelmanager_test.cpp
+++ b/src/plugins/cpptools/cppmodelmanager_test.cpp
@@ -989,7 +989,7 @@ void CppToolsPlugin::test_modelmanager_defines_per_editor()
QCOMPARE(Core::DocumentModel::openedDocuments().size(), 1);
QVERIFY(mm->isCppEditor(editor));
- const QString filePath = editor->document()->filePath();
+ const QString filePath = editor->document()->filePath().toString();
BaseEditorDocumentParser *parser = BaseEditorDocumentParser::get(filePath);
parser->setEditorDefines(editorDefines.toUtf8());
parser->update(mm->workingCopy());
diff --git a/src/plugins/cpptools/cppsourceprocessor_test.cpp b/src/plugins/cpptools/cppsourceprocessor_test.cpp
index d40fcfb889..ecc0899fcc 100644
--- a/src/plugins/cpptools/cppsourceprocessor_test.cpp
+++ b/src/plugins/cpptools/cppsourceprocessor_test.cpp
@@ -134,7 +134,7 @@ void CppToolsPlugin::test_cppsourceprocessor_includes_cyclic()
testCase.closeEditorAtEndOfTestCase(editor);
// Check editor snapshot
- const QString filePath = editor->document()->filePath();
+ const QString filePath = editor->document()->filePath().toString();
auto *processor = BaseEditorDocumentProcessor::get(filePath);
QVERIFY(processor);
Snapshot snapshot = processor->snapshot();
diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp
index 0ed79950c7..fdd2f51de7 100644
--- a/src/plugins/cpptools/cpptoolsplugin.cpp
+++ b/src/plugins/cpptools/cpptoolsplugin.cpp
@@ -236,7 +236,7 @@ void CppToolsPlugin::switchHeaderSource()
void CppToolsPlugin::switchHeaderSourceInNextSplit()
{
QString otherFile = correspondingHeaderOrSource(
- EditorManager::currentDocument()->filePath());
+ EditorManager::currentDocument()->filePath().toString());
if (!otherFile.isEmpty())
EditorManager::openEditor(otherFile, Id(), EditorManager::OpenInOtherSplit);
}
diff --git a/src/plugins/cpptools/cpptoolsreuse.cpp b/src/plugins/cpptools/cpptoolsreuse.cpp
index cfb29dc401..f64a31ffdb 100644
--- a/src/plugins/cpptools/cpptoolsreuse.cpp
+++ b/src/plugins/cpptools/cpptoolsreuse.cpp
@@ -196,7 +196,7 @@ void switchHeaderSource()
{
const Core::IDocument *currentDocument = Core::EditorManager::currentDocument();
QTC_ASSERT(currentDocument, return);
- const QString otherFile = correspondingHeaderOrSource(currentDocument->filePath());
+ const QString otherFile = correspondingHeaderOrSource(currentDocument->filePath().toString());
if (!otherFile.isEmpty())
Core::EditorManager::openEditor(otherFile);
}
diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp
index 630616c0b1..0c7502afea 100644
--- a/src/plugins/cvs/cvsplugin.cpp
+++ b/src/plugins/cvs/cvsplugin.cpp
@@ -492,7 +492,7 @@ bool CvsPlugin::submitEditorAboutToClose()
// Submit editor closing. Make it write out the commit message
// and retrieve files
- const QFileInfo editorFile(editorDocument->filePath());
+ const QFileInfo editorFile = editorDocument->filePath().toFileInfo();
const QFileInfo changeFile(m_commitMessageFileName);
if (editorFile.absoluteFilePath() != changeFile.absoluteFilePath())
return true; // Oops?!
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 709fe0a04c..715ae0bc2f 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -568,7 +568,7 @@ static bool currentTextEditorPosition(ContextData *data)
return false;
const TextDocument *document = textEditor->textDocument();
QTC_ASSERT(document, return false);
- data->fileName = document->filePath();
+ data->fileName = document->filePath().toString();
if (document->property(Constants::OPENED_WITH_DISASSEMBLY).toBool()) {
int lineNumber = textEditor->currentLine();
QString line = textEditor->textDocument()->plainText()
@@ -1722,7 +1722,7 @@ void DebuggerPluginPrivate::requestContextMenu(TextEditorWidget *widget,
BreakpointModelId id = BreakpointModelId();
TextDocument *document = widget->textDocument();
- args.fileName = document->filePath();
+ args.fileName = document->filePath().toString();
if (document->property(Constants::OPENED_WITH_DISASSEMBLY).toBool()) {
QString line = document->plainText()
.section(QLatin1Char('\n'), lineNumber - 1, lineNumber - 1);
@@ -1842,7 +1842,7 @@ void DebuggerPluginPrivate::toggleBreakpoint()
quint64 address = DisassemblerLine::addressFromDisassemblyLine(line);
toggleBreakpointByAddress(address);
} else if (lineNumber >= 0) {
- toggleBreakpointByFileAndLine(textEditor->document()->filePath(), lineNumber);
+ toggleBreakpointByFileAndLine(textEditor->document()->filePath().toString(), lineNumber);
}
}
@@ -1899,7 +1899,7 @@ void DebuggerPluginPrivate::requestMark(TextEditorWidget *widget, int lineNumber
quint64 address = DisassemblerLine::addressFromDisassemblyLine(line);
toggleBreakpointByAddress(address);
} else {
- toggleBreakpointByFileAndLine(document->filePath(), lineNumber);
+ toggleBreakpointByFileAndLine(document->filePath().toString(), lineNumber);
}
}
@@ -1981,7 +1981,7 @@ void DebuggerPluginPrivate::cleanupViews()
bool keepIt = true;
if (document->isModified())
keepIt = true;
- else if (document->filePath().contains(_("qeventdispatcher")))
+ else if (document->filePath().toString().contains(_("qeventdispatcher")))
keepIt = false;
else if (isMemory)
keepIt = !closeMemory;
diff --git a/src/plugins/debugger/debuggertooltipmanager.cpp b/src/plugins/debugger/debuggertooltipmanager.cpp
index c138539248..f4dba546e9 100644
--- a/src/plugins/debugger/debuggertooltipmanager.cpp
+++ b/src/plugins/debugger/debuggertooltipmanager.cpp
@@ -1189,7 +1189,7 @@ void DebuggerToolTipManager::slotUpdateVisibleToolTips()
return;
}
- const QString fileName = toolTipEditor->textDocument()->filePath();
+ const QString fileName = toolTipEditor->textDocument()->filePath().toString();
if (fileName.isEmpty()) {
hideAllToolTips();
return;
@@ -1339,7 +1339,7 @@ static void slotTooltipOverrideRequested
DebuggerToolTipContext context;
context.engineType = engine->objectName();
- context.fileName = editorWidget->textDocument()->filePath();
+ context.fileName = editorWidget->textDocument()->filePath().toString();
context.position = pos;
editorWidget->convertPosition(pos, &context.line, &context.column);
QString raw = cppExpressionAt(editorWidget, context.position, &context.line, &context.column,
diff --git a/src/plugins/debugger/qml/qmlinspectoradapter.cpp b/src/plugins/debugger/qml/qmlinspectoradapter.cpp
index 207a706673..1566780dbc 100644
--- a/src/plugins/debugger/qml/qmlinspectoradapter.cpp
+++ b/src/plugins/debugger/qml/qmlinspectoradapter.cpp
@@ -299,7 +299,7 @@ void QmlInspectorAdapter::createPreviewForEditor(Core::IEditor *newEditor)
!= QmlJSEditor::Constants::C_QMLJSEDITOR_ID)
return;
- QString filename = newEditor->document()->filePath();
+ QString filename = newEditor->document()->filePath().toString();
QmlJS::ModelManagerInterface *modelManager =
QmlJS::ModelManagerInterface::instance();
if (modelManager) {
@@ -330,7 +330,7 @@ void QmlInspectorAdapter::createPreviewForEditor(Core::IEditor *newEditor)
connect(preview, SIGNAL(reloadRequest()),
this, SLOT(onReload()));
- m_textPreviews.insert(newEditor->document()->filePath(), preview);
+ m_textPreviews.insert(newEditor->document()->filePath().toString(), preview);
preview->associateEditor(newEditor);
preview->updateDebugIds();
}
@@ -340,7 +340,7 @@ void QmlInspectorAdapter::createPreviewForEditor(Core::IEditor *newEditor)
void QmlInspectorAdapter::removePreviewForEditor(Core::IEditor *editor)
{
if (QmlLiveTextPreview *preview
- = m_textPreviews.value(editor->document()->filePath())) {
+ = m_textPreviews.value(editor->document()->filePath().toString())) {
preview->unassociateEditor(editor);
}
}
@@ -364,7 +364,7 @@ void QmlInspectorAdapter::updatePendingPreviewDocuments(QmlJS::Document::Ptr doc
Core::IEditor *editor = editors.takeFirst();
createPreviewForEditor(editor);
QmlLiveTextPreview *preview
- = m_textPreviews.value(editor->document()->filePath());
+ = m_textPreviews.value(editor->document()->filePath().toString());
foreach (Core::IEditor *editor, editors)
preview->associateEditor(editor);
}
@@ -460,7 +460,7 @@ void QmlInspectorAdapter::initializePreviews()
QList<Core::IEditor *> editors = Core::DocumentModel::editorsForDocument(document);
createPreviewForEditor(editors.takeFirst());
QmlLiveTextPreview *preview
- = m_textPreviews.value(document->filePath());
+ = m_textPreviews.value(document->filePath().toString());
foreach (Core::IEditor *editor, editors)
preview->associateEditor(editor);
}
diff --git a/src/plugins/debugger/sourceutils.cpp b/src/plugins/debugger/sourceutils.cpp
index eec4b595cf..d4deb12e55 100644
--- a/src/plugins/debugger/sourceutils.cpp
+++ b/src/plugins/debugger/sourceutils.cpp
@@ -264,7 +264,7 @@ bool getUninitializedVariables(const Snapshot &snapshot,
bool isCppEditor(TextEditorWidget *editorWidget)
{
const TextDocument *document = editorWidget->textDocument();
- return ProjectFile::classify(document->filePath()) != ProjectFile::Unclassified;
+ return ProjectFile::classify(document->filePath().toString()) != ProjectFile::Unclassified;
}
QString cppFunctionAt(const QString &fileName, int line, int column)
@@ -305,7 +305,7 @@ QString cppExpressionAt(TextEditorWidget *editorWidget, int pos,
}
if (!expr.isEmpty()) {
- QString fileName = editorWidget->textDocument()->filePath();
+ QString fileName = editorWidget->textDocument()->filePath().toString();
const Snapshot snapshot = CppModelManager::instance()->snapshot();
if (const Document::Ptr document = snapshot.document(fileName)) {
QString func = document->functionAt(*line, *column, scopeFromLine, scopeToLine);
diff --git a/src/plugins/designer/formeditorplugin.cpp b/src/plugins/designer/formeditorplugin.cpp
index 771775242c..8a13cef2f2 100644
--- a/src/plugins/designer/formeditorplugin.cpp
+++ b/src/plugins/designer/formeditorplugin.cpp
@@ -147,7 +147,7 @@ void FormEditorPlugin::initializeTemplates()
static QString currentFile()
{
if (const IDocument *document = EditorManager::currentDocument()) {
- const QString fileName = document->filePath();
+ const QString fileName = document->filePath().toString();
if (!fileName.isEmpty() && QFileInfo(fileName).isFile())
return fileName;
}
diff --git a/src/plugins/designer/formwindoweditor.cpp b/src/plugins/designer/formwindoweditor.cpp
index 4e538dad76..ab287d5a09 100644
--- a/src/plugins/designer/formwindoweditor.cpp
+++ b/src/plugins/designer/formwindoweditor.cpp
@@ -95,7 +95,7 @@ bool FormWindowEditor::open(QString *errorString, const QString &fileName, const
form->setDirty(fileName != realFileName);
document->syncXmlFromFormWindow();
- document->setFilePath(absfileName);
+ document->setFilePath(Utils::FileName::fromString(absfileName));
document->setShouldAutoSave(false);
document->resourceHandler()->updateResources(true);
diff --git a/src/plugins/designer/formwindowfile.cpp b/src/plugins/designer/formwindowfile.cpp
index 0719a91f41..3c26340f9a 100644
--- a/src/plugins/designer/formwindowfile.cpp
+++ b/src/plugins/designer/formwindowfile.cpp
@@ -44,6 +44,8 @@
#include <QDebug>
#include <QTextCodec>
+using namespace Utils;
+
namespace Designer {
namespace Internal {
@@ -64,13 +66,13 @@ FormWindowFile::FormWindowFile(QDesignerFormWindowInterface *form, QObject *pare
connect(m_formWindow, SIGNAL(changed()), SLOT(updateIsModified()));
m_resourceHandler = new ResourceHandler(form);
- connect(this, SIGNAL(filePathChanged(QString,QString)),
+ connect(this, SIGNAL(filePathChanged(Utils::FileName,Utils::FileName)),
m_resourceHandler, SLOT(updateResources()));
}
bool FormWindowFile::save(QString *errorString, const QString &name, bool autoSave)
{
- const QString actualName = name.isEmpty() ? filePath() : name;
+ const FileName actualName = name.isEmpty() ? filePath() : FileName::fromString(name);
if (Designer::Constants::Internal::debug)
qDebug() << Q_FUNC_INFO << name << "->" << actualName;
@@ -80,11 +82,10 @@ bool FormWindowFile::save(QString *errorString, const QString &name, bool autoSa
if (actualName.isEmpty())
return false;
- const QFileInfo fi(actualName);
const QString oldFormName = m_formWindow->fileName();
if (!autoSave)
- m_formWindow->setFileName(fi.absoluteFilePath());
- const bool writeOK = writeFile(actualName, errorString);
+ m_formWindow->setFileName(actualName.toString());
+ const bool writeOK = writeFile(actualName.toString(), errorString);
m_shouldAutoSave = false;
if (autoSave)
return writeOK;
@@ -95,7 +96,7 @@ bool FormWindowFile::save(QString *errorString, const QString &name, bool autoSa
}
m_formWindow->setDirty(false);
- setFilePath(fi.absoluteFilePath());
+ setFilePath(actualName);
updateIsModified();
return true;
@@ -135,9 +136,9 @@ bool FormWindowFile::setContents(const QByteArray &contents)
return true;
}
-void FormWindowFile::setFilePath(const QString &newName)
+void FormWindowFile::setFilePath(const FileName &newName)
{
- m_formWindow->setFileName(newName);
+ m_formWindow->setFileName(newName.toString());
IDocument::setFilePath(newName);
}
@@ -173,7 +174,7 @@ bool FormWindowFile::reload(QString *errorString, ReloadFlag flag, ChangeType ty
emit changed();
} else {
emit aboutToReload();
- emit reloadRequested(errorString, filePath());
+ emit reloadRequested(errorString, filePath().toString());
const bool success = errorString->isEmpty();
emit reloadFinished(success);
return success;
diff --git a/src/plugins/designer/formwindowfile.h b/src/plugins/designer/formwindowfile.h
index bcbc617f17..c4fa847267 100644
--- a/src/plugins/designer/formwindowfile.h
+++ b/src/plugins/designer/formwindowfile.h
@@ -77,7 +77,7 @@ signals:
void reloadRequested(QString *errorString, const QString &);
public slots:
- void setFilePath(const QString &);
+ void setFilePath(const Utils::FileName &);
void setShouldAutoSave(bool sad = true) { m_shouldAutoSave = sad; }
void updateIsModified();
diff --git a/src/plugins/designer/gotoslot_test.cpp b/src/plugins/designer/gotoslot_test.cpp
index 54950c6907..a0ab9b1b89 100644
--- a/src/plugins/designer/gotoslot_test.cpp
+++ b/src/plugins/designer/gotoslot_test.cpp
@@ -178,12 +178,12 @@ public:
integration->emitNavigateToSlot(QLatin1String("pushButton"), QLatin1String("clicked()"),
QStringList());
- QCOMPARE(EditorManager::currentDocument()->filePath(), cppFile);
+ QCOMPARE(EditorManager::currentDocument()->filePath().toString(), cppFile);
QVERIFY(EditorManager::currentDocument()->isModified());
// Wait for updated documents
foreach (TextEditor::BaseTextEditor *editor, editors) {
- const QString filePath = editor->document()->filePath();
+ const QString filePath = editor->document()->filePath().toString();
if (auto parser = BuiltinEditorDocumentParser::get(filePath)) {
forever {
if (Document::Ptr document = parser->document()) {
diff --git a/src/plugins/designer/qtcreatorintegration.cpp b/src/plugins/designer/qtcreatorintegration.cpp
index 689b36dcb3..303fc32f8c 100644
--- a/src/plugins/designer/qtcreatorintegration.cpp
+++ b/src/plugins/designer/qtcreatorintegration.cpp
@@ -510,7 +510,7 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName,
{
typedef QMap<int, Document::Ptr> DocumentMap;
- const QString currentUiFile = FormEditorW::activeEditor()->document()->filePath();
+ const QString currentUiFile = FormEditorW::activeEditor()->document()->filePath().toString();
#if 0
return Designer::Internal::navigateToSlot(currentUiFile, objectName, signalSignature, parameterNames, errorMessage);
#endif
diff --git a/src/plugins/diffeditor/diffeditordocument.cpp b/src/plugins/diffeditor/diffeditordocument.cpp
index 3aaedf549a..0f10016e1e 100644
--- a/src/plugins/diffeditor/diffeditordocument.cpp
+++ b/src/plugins/diffeditor/diffeditordocument.cpp
@@ -90,7 +90,7 @@ bool DiffEditorDocument::save(QString *errorString, const QString &fileName, boo
DiffEditorManager::removeDocument(this);
const QFileInfo fi(fileName);
setTemporary(false);
- setFilePath(QDir::cleanPath(fi.absoluteFilePath()));
+ setFilePath(Utils::FileName::fromString(fi.absoluteFilePath()));
setDisplayName(QString());
return true;
}
@@ -100,7 +100,7 @@ bool DiffEditorDocument::reload(QString *errorString, ReloadFlag flag, ChangeTyp
Q_UNUSED(type)
if (flag == FlagIgnore)
return true;
- return open(errorString, filePath());
+ return open(errorString, filePath().toString());
}
bool DiffEditorDocument::open(QString *errorString, const QString &fileName)
@@ -120,7 +120,7 @@ bool DiffEditorDocument::open(QString *errorString, const QString &fileName)
const QFileInfo fi(fileName);
setTemporary(false);
- setFilePath(QDir::cleanPath(fi.absoluteFilePath()));
+ setFilePath(Utils::FileName::fromString(fi.absoluteFilePath()));
m_controller->setDiffFiles(fileDataList, fi.absolutePath());
return true;
}
diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp
index 099fae1626..12aeb452ac 100644
--- a/src/plugins/fakevim/fakevimplugin.cpp
+++ b/src/plugins/fakevim/fakevimplugin.cpp
@@ -1810,7 +1810,7 @@ void FakeVimPluginPrivate::editorOpened(IEditor *editor)
connect(ICore::instance(), SIGNAL(saveSettingsRequested()),
SLOT(writeSettings()));
- handler->setCurrentFileName(editor->document()->filePath());
+ handler->setCurrentFileName(editor->document()->filePath().toString());
handler->installEventFilter();
// pop up the bar
@@ -1970,7 +1970,7 @@ void FakeVimPluginPrivate::handleExCommand(bool *handled, const ExCommand &cmd)
// :w[rite]
IEditor *editor = m_editorToHandler.key(handler);
const QString fileName = handler->currentFileName();
- if (editor && editor->document()->filePath() == fileName) {
+ if (editor && editor->document()->filePath().toString() == fileName) {
// Handle that as a special case for nicer interaction with core
DocumentManager::saveDocument(editor->document());
// Check result by reading back.
diff --git a/src/plugins/genericprojectmanager/genericproject.cpp b/src/plugins/genericprojectmanager/genericproject.cpp
index ab70c94fac..e4d61047aa 100644
--- a/src/plugins/genericprojectmanager/genericproject.cpp
+++ b/src/plugins/genericprojectmanager/genericproject.cpp
@@ -447,7 +447,7 @@ GenericProjectFile::GenericProjectFile(GenericProject *parent, QString fileName,
{
setId("Generic.ProjectFile");
setMimeType(QLatin1String(Constants::GENERICMIMETYPE));
- setFilePath(fileName);
+ setFilePath(Utils::FileName::fromString(fileName));
}
bool GenericProjectFile::save(QString *, const QString &, bool)
diff --git a/src/plugins/genericprojectmanager/genericprojectnodes.cpp b/src/plugins/genericprojectmanager/genericprojectnodes.cpp
index 36bb164bfb..3b2970971a 100644
--- a/src/plugins/genericprojectmanager/genericprojectnodes.cpp
+++ b/src/plugins/genericprojectmanager/genericprojectnodes.cpp
@@ -43,9 +43,11 @@ namespace GenericProjectManager {
namespace Internal {
GenericProjectNode::GenericProjectNode(GenericProject *project, Core::IDocument *projectFile)
- : ProjectNode(projectFile->filePath()), m_project(project), m_projectFile(projectFile)
+ : ProjectNode(projectFile->filePath().toString())
+ , m_project(project)
+ , m_projectFile(projectFile)
{
- setDisplayName(QFileInfo(projectFile->filePath()).completeBaseName());
+ setDisplayName(projectFile->filePath().toFileInfo().completeBaseName());
}
Core::IDocument *GenericProjectNode::projectFile() const
@@ -55,7 +57,7 @@ Core::IDocument *GenericProjectNode::projectFile() const
QString GenericProjectNode::projectFilePath() const
{
- return m_projectFile->filePath();
+ return m_projectFile->filePath().toString();
}
QHash<QString, QStringList> sortFilesIntoPaths(const QString &base, const QSet<QString> &files)
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index 38b9795ca0..1ea6220e00 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -698,7 +698,7 @@ static inline QString msgCannotLaunch(const QString &binary)
static inline QString currentDocumentPath()
{
if (IDocument *document= EditorManager::currentDocument())
- return QFileInfo(document->filePath()).path();
+ return document->filePath().toFileInfo().path();
return QString();
}
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp
index 547132b1c5..472166bea4 100644
--- a/src/plugins/git/gitplugin.cpp
+++ b/src/plugins/git/gitplugin.cpp
@@ -1035,7 +1035,7 @@ bool GitPlugin::submitEditorAboutToClose()
QTC_ASSERT(editorDocument, return true);
// Submit editor closing. Make it write out the commit message
// and retrieve files
- const QFileInfo editorFile(editorDocument->filePath());
+ const QFileInfo editorFile = editorDocument->filePath().toFileInfo();
const QFileInfo changeFile(m_commitMessageFileName);
// Paranoia!
if (editorFile.absoluteFilePath() != changeFile.absoluteFilePath())
diff --git a/src/plugins/glsleditor/glsleditor.cpp b/src/plugins/glsleditor/glsleditor.cpp
index 817a3be8d3..3f3af8751c 100644
--- a/src/plugins/glsleditor/glsleditor.cpp
+++ b/src/plugins/glsleditor/glsleditor.cpp
@@ -313,7 +313,7 @@ AssistInterface *GlslEditorWidget::createAssistInterface(
if (kind == Completion)
return new GlslCompletionAssistInterface(document(),
position(),
- textDocument()->filePath(),
+ textDocument()->filePath().toString(),
reason,
textDocument()->mimeType(),
m_glslDocument);
diff --git a/src/plugins/imageviewer/imageviewer.cpp b/src/plugins/imageviewer/imageviewer.cpp
index 2850efddf4..ab3b264899 100644
--- a/src/plugins/imageviewer/imageviewer.cpp
+++ b/src/plugins/imageviewer/imageviewer.cpp
@@ -126,7 +126,7 @@ bool ImageViewer::open(QString *errorString, const QString &fileName, const QStr
*errorString = tr("Cannot open image file %1.").arg(QDir::toNativeSeparators(realFileName));
return false;
}
- d->file->setFilePath(fileName);
+ d->file->setFilePath(Utils::FileName::fromString(fileName));
d->ui_toolbar.toolButtonPlayPause->setVisible(d->imageView->isAnimated());
setPaused(!d->imageView->isAnimated());
// d_ptr->file->setMimeType
diff --git a/src/plugins/imageviewer/imageviewerfile.cpp b/src/plugins/imageviewer/imageviewerfile.cpp
index a3b1191b86..c7963b7bf3 100644
--- a/src/plugins/imageviewer/imageviewerfile.cpp
+++ b/src/plugins/imageviewer/imageviewerfile.cpp
@@ -65,7 +65,7 @@ bool ImageViewerFile::reload(QString *errorString,
emit changed();
return true;
}
- return m_editor->open(errorString, filePath(), filePath());
+ return m_editor->open(errorString, filePath().toString(), filePath().toString());
}
bool ImageViewerFile::save(QString *errorString, const QString &fileName, bool autoSave)
diff --git a/src/plugins/mercurial/mercurialplugin.cpp b/src/plugins/mercurial/mercurialplugin.cpp
index 5b57e492c3..c736c0763a 100644
--- a/src/plugins/mercurial/mercurialplugin.cpp
+++ b/src/plugins/mercurial/mercurialplugin.cpp
@@ -638,7 +638,7 @@ bool MercurialPlugin::submitEditorAboutToClose()
QStringList extraOptions;
if (!commitEditor->committerInfo().isEmpty())
extraOptions << QLatin1String("-u") << commitEditor->committerInfo();
- m_client->commit(m_submitRepository, files, editorFile->filePath(),
+ m_client->commit(m_submitRepository, files, editorFile->filePath().toString(),
extraOptions);
}
return true;
diff --git a/src/plugins/projectexplorer/editorconfiguration.cpp b/src/plugins/projectexplorer/editorconfiguration.cpp
index cc5e050118..2bb35c8107 100644
--- a/src/plugins/projectexplorer/editorconfiguration.cpp
+++ b/src/plugins/projectexplorer/editorconfiguration.cpp
@@ -281,7 +281,7 @@ void EditorConfiguration::setUseGlobalSettings(bool use)
d->m_defaultCodeStyle->setCurrentDelegate(use ? TextEditorSettings::codeStyle() : 0);
foreach (Core::IEditor *editor, Core::DocumentModel::editorsForOpenedDocuments()) {
if (TextEditorWidget *widget = qobject_cast<TextEditorWidget *>(editor->widget())) {
- Project *project = SessionManager::projectForFile(editor->document()->filePath());
+ Project *project = SessionManager::projectForFile(editor->document()->filePath().toString());
if (project && project->editorConfiguration() == this)
switchSettings(widget);
}
diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp
index 1c73409d91..fa1f1c392e 100644
--- a/src/plugins/projectexplorer/project.cpp
+++ b/src/plugins/projectexplorer/project.cpp
@@ -134,7 +134,7 @@ Core::Id Project::id() const
Utils::FileName Project::projectFilePath() const
{
- return Utils::FileName::fromString(document()->filePath());
+ return document()->filePath();
}
bool Project::hasActiveBuildSettings() const
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 5d3a7edfed..30e251459a 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -1120,11 +1120,11 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
expander->registerFileVariables(Constants::VAR_CURRENTPROJECT_PREFIX,
tr("Current project's main file"),
[this]() -> QString {
- QString projectFilePath;
+ Utils::FileName projectFilePath;
if (Project *project = ProjectTree::currentProject())
if (IDocument *doc = project->document())
projectFilePath = doc->filePath();
- return projectFilePath;
+ return projectFilePath.toString();
});
expander->registerVariable(Constants::VAR_CURRENTPROJECT_BUILDPATH,
@@ -1242,7 +1242,7 @@ void ProjectExplorerPlugin::loadAction()
// for your special convenience, we preselect a pro file if it is
// the current file
if (const IDocument *document = EditorManager::currentDocument()) {
- const QString fn = document->filePath();
+ const QString fn = document->filePath().toString();
const bool isProject = dd->m_profileMimeTypes.contains(document->mimeType());
dir = isProject ? fn : QFileInfo(fn).absolutePath();
}
@@ -1304,7 +1304,7 @@ void ProjectExplorerPlugin::unloadProject(Project *project)
if (!DocumentManager::saveModifiedDocumentSilently(document))
return;
- dd->addToRecentProjects(document->filePath(), project->displayName());
+ dd->addToRecentProjects(document->filePath().toString(), project->displayName());
SessionManager::removeProject(project);
m_instance->updateActions();
diff --git a/src/plugins/projectexplorer/projecttree.cpp b/src/plugins/projectexplorer/projecttree.cpp
index 7e2974b789..2b470344e9 100644
--- a/src/plugins/projectexplorer/projecttree.cpp
+++ b/src/plugins/projectexplorer/projecttree.cpp
@@ -333,7 +333,7 @@ void ProjectTree::updateExternalFileWarning()
}
if (!infoBar->canInfoBeAdded(externalFileId))
return;
- Utils::FileName fileName = Utils::FileName::fromString(document->filePath());
+ const Utils::FileName fileName = document->filePath();
const QList<Project *> projects = SessionManager::projects();
if (projects.isEmpty())
return;
diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp
index 9d2fa0acb9..3e2c478952 100644
--- a/src/plugins/projectexplorer/session.cpp
+++ b/src/plugins/projectexplorer/session.cpp
@@ -607,7 +607,7 @@ void SessionManager::configureEditor(Core::IEditor *editor, const QString &fileN
void SessionManager::configureEditors(Project *project)
{
foreach (IDocument *document, DocumentModel::openedDocuments()) {
- if (d->projectContainsFile(project, document->filePath())) {
+ if (d->projectContainsFile(project, document->filePath().toString())) {
foreach (IEditor *editor, DocumentModel::editorsForDocument(document)) {
if (TextEditor::BaseTextEditor *textEditor = qobject_cast<TextEditor::BaseTextEditor*>(editor)) {
project->editorConfiguration()->configureEditor(textEditor);
diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp
index e6db73238b..3fa7e633b2 100644
--- a/src/plugins/qbsprojectmanager/qbsproject.cpp
+++ b/src/plugins/qbsprojectmanager/qbsproject.cpp
@@ -157,7 +157,7 @@ QString QbsProject::displayName() const
IDocument *QbsProject::document() const
{
foreach (IDocument *doc, m_qbsDocuments) {
- if (doc->filePath() == m_fileName)
+ if (doc->filePath().toString() == m_fileName)
return doc;
}
QTC_ASSERT(false, return 0);
@@ -211,7 +211,7 @@ public:
: m_document(0)
{
foreach (Core::IDocument * const doc, documents) {
- if (doc->filePath() == filePath) {
+ if (doc->filePath().toString() == filePath) {
m_document = doc;
break;
}
@@ -226,7 +226,7 @@ public:
{
QTC_ASSERT(m_document, return);
Core::DocumentManager::addDocument(m_document);
- Core::DocumentManager::unexpectFileChange(m_document->filePath());
+ Core::DocumentManager::unexpectFileChange(m_document->filePath().toString());
}
private:
@@ -658,7 +658,7 @@ void QbsProject::updateDocuments(const QSet<QString> &files)
QTC_ASSERT(!newFiles.isEmpty(), newFiles << m_fileName);
QSet<QString> oldFiles;
foreach (IDocument *doc, m_qbsDocuments)
- oldFiles.insert(doc->filePath());
+ oldFiles.insert(doc->filePath().toString());
QSet<QString> filesToAdd = newFiles;
filesToAdd.subtract(oldFiles);
@@ -667,7 +667,7 @@ void QbsProject::updateDocuments(const QSet<QString> &files)
QSet<IDocument *> currentDocuments = m_qbsDocuments;
foreach (IDocument *doc, currentDocuments) {
- if (filesToRemove.contains(doc->filePath())) {
+ if (filesToRemove.contains(doc->filePath().toString())) {
m_qbsDocuments.remove(doc);
delete doc;
}
diff --git a/src/plugins/qbsprojectmanager/qbsprojectfile.cpp b/src/plugins/qbsprojectmanager/qbsprojectfile.cpp
index ebb608f09a..1eb44dee0e 100644
--- a/src/plugins/qbsprojectmanager/qbsprojectfile.cpp
+++ b/src/plugins/qbsprojectmanager/qbsprojectfile.cpp
@@ -41,7 +41,7 @@ QbsProjectFile::QbsProjectFile(QbsProject *parent, QString fileName) : Core::IDo
{
setId("Qbs.ProjectFile");
setMimeType(QLatin1String(Constants::MIME_TYPE));
- setFilePath(fileName);
+ setFilePath(Utils::FileName::fromString(fileName));
}
QbsProjectFile::~QbsProjectFile()
diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp
index 20ebb8862a..6750c80a23 100644
--- a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp
+++ b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp
@@ -71,13 +71,13 @@ namespace Internal {
static Node *currentEditorNode()
{
Core::IDocument *doc = Core::EditorManager::currentDocument();
- return doc ? SessionManager::nodeForFile(doc->filePath()) : 0;
+ return doc ? SessionManager::nodeForFile(doc->filePath().toString()) : 0;
}
static QbsProject *currentEditorProject()
{
Core::IDocument *doc = Core::EditorManager::currentDocument();
- return doc ? qobject_cast<QbsProject *>(SessionManager::projectForFile(doc->filePath())) : 0;
+ return doc ? qobject_cast<QbsProject *>(SessionManager::projectForFile(doc->filePath().toString())) : 0;
}
QbsProjectManagerPlugin::QbsProjectManagerPlugin() :
diff --git a/src/plugins/qmakeprojectmanager/profileeditor.cpp b/src/plugins/qmakeprojectmanager/profileeditor.cpp
index adb7b2731a..07fb025649 100644
--- a/src/plugins/qmakeprojectmanager/profileeditor.cpp
+++ b/src/plugins/qmakeprojectmanager/profileeditor.cpp
@@ -137,7 +137,7 @@ ProFileEditorWidget::Link ProFileEditorWidget::findLinkAt(const QTextCursor &cur
}
}
- QDir dir(QFileInfo(textDocument()->filePath()).absolutePath());
+ QDir dir(textDocument()->filePath().toFileInfo().absolutePath());
QString fileName = dir.filePath(buffer);
QFileInfo fi(fileName);
if (fi.exists()) {
@@ -185,14 +185,12 @@ ProFileDocument::ProFileDocument()
QString ProFileDocument::defaultPath() const
{
- QFileInfo fi(filePath());
- return fi.absolutePath();
+ return filePath().toFileInfo().absolutePath();
}
QString ProFileDocument::suggestedFileName() const
{
- QFileInfo fi(filePath());
- return fi.fileName();
+ return filePath().toFileInfo().fileName();
}
//
diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp
index 1da974b1f1..10504b3586 100644
--- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp
@@ -244,7 +244,7 @@ QmakePriFile::QmakePriFile(QmakeProjectManager::QmakePriFileNode *qmakePriFile)
{
setId("Qmake.PriFile");
setMimeType(QLatin1String(QmakeProjectManager::Constants::PROFILE_MIMETYPE));
- setFilePath(m_priFile->path());
+ setFilePath(Utils::FileName::fromString(m_priFile->path()));
}
bool QmakePriFile::save(QString *errorString, const QString &fileName, bool autoSave)
diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp
index 75bdda5ab7..f9bc634c25 100644
--- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp
@@ -283,7 +283,7 @@ QmakeProjectFile::QmakeProjectFile(const QString &filePath, QObject *parent)
{
setId("Qmake.ProFile");
setMimeType(QLatin1String(QmakeProjectManager::Constants::PROFILE_MIMETYPE));
- setFilePath(filePath);
+ setFilePath(Utils::FileName::fromString(filePath));
}
bool QmakeProjectFile::save(QString *, const QString &, bool)
@@ -414,7 +414,7 @@ bool QmakeProject::fromMap(const QVariantMap &map)
m_manager->registerProject(this);
- m_rootProjectNode = new QmakeProFileNode(this, m_fileInfo->filePath(), this);
+ m_rootProjectNode = new QmakeProFileNode(this, m_fileInfo->filePath().toString(), this);
m_rootProjectNode->registerWatcher(m_nodesWatcher);
// We have the profile nodes now, so we know the runconfigs!
@@ -1048,7 +1048,7 @@ void QmakeProject::destroyProFileReader(QtSupport::ProFileReader *reader)
{
delete reader;
if (!--m_qmakeGlobalsRefCnt) {
- QString dir = QFileInfo(m_fileInfo->filePath()).absolutePath();
+ QString dir = m_fileInfo->filePath().toFileInfo().absolutePath();
if (!dir.endsWith(QLatin1Char('/')))
dir += QLatin1Char('/');
QtSupport::ProFileCacheManager::instance()->discardFiles(dir);
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp
index c12f9da501..f889ea2b72 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp
@@ -135,7 +135,7 @@ void QmakeManager::setContextFile(ProjectExplorer::FileNode *file)
void QmakeManager::addLibrary()
{
if (auto editor = qobject_cast<BaseTextEditor *>(Core::EditorManager::currentEditor()))
- addLibrary(editor->document()->filePath(), editor);
+ addLibrary(editor->document()->filePath().toString(), editor);
}
void QmakeManager::addLibraryContextMenu()
@@ -231,7 +231,7 @@ void QmakeManager::buildFileContextMenu()
void QmakeManager::buildFile()
{
if (Core::IDocument *currentDocument= Core::EditorManager::currentDocument()) {
- const QString file = currentDocument->filePath();
+ const QString file = currentDocument->filePath().toString();
FileNode *node = qobject_cast<FileNode *>(SessionManager::nodeForFile(file));
Project *project = SessionManager::projectForFile(file);
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp
index fa464df46a..ddb3ba7226 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp
@@ -392,7 +392,7 @@ void QmakeProjectManagerPlugin::updateBuildFileAction()
bool enabled = false;
if (Core::IDocument *currentDocument= Core::EditorManager::currentDocument()) {
- QString file = currentDocument->filePath();
+ QString file = currentDocument->filePath().toString();
Node *node = SessionManager::nodeForFile(file);
Project *project = SessionManager::projectForFile(file);
m_buildFileAction->setParameter(QFileInfo(file).fileName());
diff --git a/src/plugins/qmldesigner/components/componentcore/crumblebar.cpp b/src/plugins/qmldesigner/components/componentcore/crumblebar.cpp
index 776e2892bc..6711604bfb 100644
--- a/src/plugins/qmldesigner/components/componentcore/crumblebar.cpp
+++ b/src/plugins/qmldesigner/components/componentcore/crumblebar.cpp
@@ -65,7 +65,7 @@ static CrumbleBarInfo createCrumbleBarInfoFromModelNode(const ModelNode &modelNo
{
CrumbleBarInfo crumbleBarInfo;
crumbleBarInfo.displayName = componentIdForModelNode(modelNode);
- crumbleBarInfo.fileName = currentDesignDocument()->textEditor()->document()->filePath();
+ crumbleBarInfo.fileName = currentDesignDocument()->textEditor()->document()->filePath().toString();
crumbleBarInfo.modelNode = modelNode;
return crumbleBarInfo;
diff --git a/src/plugins/qmldesigner/components/integration/designdocument.cpp b/src/plugins/qmldesigner/components/integration/designdocument.cpp
index b32c5db707..f5f873270f 100644
--- a/src/plugins/qmldesigner/components/integration/designdocument.cpp
+++ b/src/plugins/qmldesigner/components/integration/designdocument.cpp
@@ -194,22 +194,22 @@ QString DesignDocument::simplfiedDisplayName() const
return list.last();
}
-void DesignDocument::updateFileName(const QString & /*oldFileName*/, const QString &newFileName)
+void DesignDocument::updateFileName(const Utils::FileName & /*oldFileName*/, const Utils::FileName &newFileName)
{
if (m_documentModel)
- m_documentModel->setFileUrl(QUrl::fromLocalFile(newFileName));
+ m_documentModel->setFileUrl(QUrl::fromLocalFile(newFileName.toString()));
if (m_inFileComponentModel)
- m_inFileComponentModel->setFileUrl(QUrl::fromLocalFile(newFileName));
+ m_inFileComponentModel->setFileUrl(QUrl::fromLocalFile(newFileName.toString()));
- viewManager().setItemLibraryViewResourcePath(QFileInfo(newFileName).absolutePath());
+ viewManager().setItemLibraryViewResourcePath(newFileName.toFileInfo().absolutePath());
emit displayNameChanged(displayName());
}
QString DesignDocument::fileName() const
{
- return editor()->document()->filePath();
+ return editor()->document()->filePath().toString();
}
ProjectExplorer::Kit *DesignDocument::currentKit() const
@@ -243,7 +243,7 @@ void DesignDocument::loadDocument(QPlainTextEdit *edit)
m_inFileComponentTextModifier.reset();
- updateFileName(QString(), fileName());
+ updateFileName(Utils::FileName(), Utils::FileName::fromString(fileName()));
m_documentLoaded = true;
}
@@ -581,9 +581,8 @@ RewriterView *DesignDocument::rewriterView() const
void DesignDocument::setEditor(Core::IEditor *editor)
{
m_textEditor = editor;
- connect(editor->document(),
- SIGNAL(filePathChanged(QString,QString)),
- SLOT(updateFileName(QString,QString)));
+ connect(editor->document(), &Core::IDocument::filePathChanged,
+ this, &DesignDocument::updateFileName);
updateActiveQtVersion();
}
diff --git a/src/plugins/qmldesigner/components/integration/designdocument.h b/src/plugins/qmldesigner/components/integration/designdocument.h
index 7ff027235a..923089c62f 100644
--- a/src/plugins/qmldesigner/components/integration/designdocument.h
+++ b/src/plugins/qmldesigner/components/integration/designdocument.h
@@ -126,7 +126,7 @@ public slots:
void changeToMaster();
private slots:
- void updateFileName(const QString &oldFileName, const QString &newFileName);
+ void updateFileName(const Utils::FileName &oldFileName, const Utils::FileName &newFileName);
private: // functions
void changeToInFileComponentModel(ComponentTextModifier *textModifer);
diff --git a/src/plugins/qmldesigner/designmodewidget.cpp b/src/plugins/qmldesigner/designmodewidget.cpp
index f32557ba2f..3dadf47733 100644
--- a/src/plugins/qmldesigner/designmodewidget.cpp
+++ b/src/plugins/qmldesigner/designmodewidget.cpp
@@ -509,7 +509,7 @@ void DesignModeWidget::resizeEvent(QResizeEvent *event)
void DesignModeWidget::setupNavigatorHistory(Core::IEditor *editor)
{
if (!m_keepNavigatorHistory)
- addNavigatorHistoryEntry(editor->document()->filePath());
+ addNavigatorHistoryEntry(editor->document()->filePath().toString());
const bool canGoBack = m_navigatorHistoryCounter > 0;
const bool canGoForward = m_navigatorHistoryCounter < (m_navigatorHistory.size() - 1);
diff --git a/src/plugins/qmldesigner/qmldesignerplugin.cpp b/src/plugins/qmldesigner/qmldesignerplugin.cpp
index 337268887f..9ae249083f 100644
--- a/src/plugins/qmldesigner/qmldesignerplugin.cpp
+++ b/src/plugins/qmldesigner/qmldesignerplugin.cpp
@@ -366,7 +366,7 @@ static bool checkIfEditorIsQtQuick(Core::IEditor *editor)
if (editor)
if (editor && editor->document()->id() == QmlJSEditor::Constants::C_QMLJSEDITOR_ID) {
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
- QmlJS::Document::Ptr document = modelManager->ensuredGetDocumentForPath(editor->document()->filePath());
+ QmlJS::Document::Ptr document = modelManager->ensuredGetDocumentForPath(editor->document()->filePath().toString());
if (!document.isNull())
return document->language() == QmlJS::Dialect::QmlQtQuick1
|| document->language() == QmlJS::Dialect::QmlQtQuick2
diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp
index 381dd05e89..85652d9c6e 100644
--- a/src/plugins/qmljseditor/qmljseditor.cpp
+++ b/src/plugins/qmljseditor/qmljseditor.cpp
@@ -224,7 +224,7 @@ void QmlJSEditorWidget::updateCodeWarnings(QmlJS::Document::Ptr doc)
void QmlJSEditorWidget::modificationChanged(bool changed)
{
if (!changed && m_modelManager)
- m_modelManager->fileChangedOnDisk(textDocument()->filePath());
+ m_modelManager->fileChangedOnDisk(textDocument()->filePath().toString());
}
void QmlJSEditorWidget::jumpToOutlineElement(int /*index*/)
@@ -641,12 +641,12 @@ TextEditorWidget::Link QmlJSEditorWidget::findLinkAt(const QTextCursor &cursor,
void QmlJSEditorWidget::findUsages()
{
- m_findReferences->findUsages(textDocument()->filePath(), textCursor().position());
+ m_findReferences->findUsages(textDocument()->filePath().toString(), textCursor().position());
}
void QmlJSEditorWidget::renameUsages()
{
- m_findReferences->renameUsages(textDocument()->filePath(), textCursor().position());
+ m_findReferences->renameUsages(textDocument()->filePath().toString(), textCursor().position());
}
void QmlJSEditorWidget::showContextPane()
@@ -846,7 +846,7 @@ AssistInterface *QmlJSEditorWidget::createAssistInterface(
if (assistKind == TextEditor::Completion) {
return new QmlJSCompletionAssistInterface(document(),
position(),
- textDocument()->filePath(),
+ textDocument()->filePath().toString(),
reason,
m_qmlJsEditorDocument->semanticInfo());
} else if (assistKind == TextEditor::QuickFix) {
diff --git a/src/plugins/qmljseditor/qmljseditordocument.cpp b/src/plugins/qmljseditor/qmljseditordocument.cpp
index 44b0b71fa6..b56bfb44ef 100644
--- a/src/plugins/qmljseditor/qmljseditordocument.cpp
+++ b/src/plugins/qmljseditor/qmljseditordocument.cpp
@@ -451,7 +451,7 @@ QmlJSEditorDocumentPrivate::QmlJSEditorDocumentPrivate(QmlJSEditorDocument *pare
m_updateOutlineModelTimer.setSingleShot(true);
connect(&m_updateOutlineModelTimer, SIGNAL(timeout()), this, SLOT(updateOutlineModel()));
- modelManager->updateSourceFiles(QStringList(parent->filePath()), false);
+ modelManager->updateSourceFiles(QStringList(parent->filePath().toString()), false);
}
QmlJSEditorDocumentPrivate::~QmlJSEditorDocumentPrivate()
@@ -468,13 +468,13 @@ void QmlJSEditorDocumentPrivate::invalidateFormatterCache()
void QmlJSEditorDocumentPrivate::reparseDocument()
{
- ModelManagerInterface::instance()->updateSourceFiles(QStringList() << q->filePath(),
- false);
+ ModelManagerInterface::instance()->updateSourceFiles(QStringList(q->filePath().toString()),
+ false);
}
void QmlJSEditorDocumentPrivate::onDocumentUpdated(Document::Ptr doc)
{
- if (q->filePath() != doc->fileName())
+ if (q->filePath().toString() != doc->fileName())
return;
// text document has changed, simply wait for the next onDocumentUpdated
diff --git a/src/plugins/qmljseditor/qmljsquickfixassist.cpp b/src/plugins/qmljseditor/qmljsquickfixassist.cpp
index a2c7a43109..3f4055f0e3 100644
--- a/src/plugins/qmljseditor/qmljsquickfixassist.cpp
+++ b/src/plugins/qmljseditor/qmljsquickfixassist.cpp
@@ -50,7 +50,7 @@ using namespace Internal;
QmlJSQuickFixAssistInterface::QmlJSQuickFixAssistInterface(QmlJSEditorWidget *editor,
TextEditor::AssistReason reason)
: AssistInterface(editor->document(), editor->position(),
- editor->textDocument()->filePath(), reason)
+ editor->textDocument()->filePath().toString(), reason)
, m_semanticInfo(editor->qmlJsEditorDocument()->semanticInfo())
, m_currentFile(QmlJSRefactoringChanges::file(editor, m_semanticInfo.document))
{}
diff --git a/src/plugins/qmljseditor/qmloutlinemodel.cpp b/src/plugins/qmljseditor/qmloutlinemodel.cpp
index d5fb914063..1be8316885 100644
--- a/src/plugins/qmljseditor/qmloutlinemodel.cpp
+++ b/src/plugins/qmljseditor/qmloutlinemodel.cpp
@@ -336,7 +336,7 @@ QMimeData *QmlOutlineModel::mimeData(const QModelIndexList &indexes) const
QModelIndex index = indexes.at(i);
AST::SourceLocation location = sourceLocation(index);
- data->addFile(m_editorDocument->filePath(), location.startLine,
+ data->addFile(m_editorDocument->filePath().toString(), location.startLine,
location.startColumn - 1 /*editors have 0-based column*/);
QList<int> rowPath;
diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp
index ac4ab52c41..7729f166b3 100644
--- a/src/plugins/qmljstools/qmljsmodelmanager.cpp
+++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp
@@ -251,7 +251,7 @@ ModelManagerInterface::WorkingCopy ModelManager::workingCopyInternal() const
{
WorkingCopy workingCopy;
foreach (IDocument *document, DocumentModel::openedDocuments()) {
- const QString key = document->filePath();
+ const QString key = document->filePath().toString();
if (TextEditor::TextDocument *textDocument = qobject_cast<TextEditor::TextDocument *>(document)) {
// TODO the language should be a property on the document, not the editor
if (DocumentModel::editorsForDocument(document).first()->context().contains(ProjectExplorer::Constants::LANG_QMLJS))
diff --git a/src/plugins/qmlprojectmanager/qmlprojectfile.cpp b/src/plugins/qmlprojectmanager/qmlprojectfile.cpp
index 4294a65e7e..321b32ead8 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectfile.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectfile.cpp
@@ -36,7 +36,7 @@
namespace QmlProjectManager {
namespace Internal {
-QmlProjectFile::QmlProjectFile(QmlProject *parent, QString fileName)
+QmlProjectFile::QmlProjectFile(QmlProject *parent, const QString &fileName)
: Core::IDocument(parent),
m_project(parent)
{
@@ -44,7 +44,7 @@ QmlProjectFile::QmlProjectFile(QmlProject *parent, QString fileName)
QTC_CHECK(!fileName.isEmpty());
setId("Qml.ProjectFile");
setMimeType(QLatin1String(Constants::QMLPROJECT_MIMETYPE));
- setFilePath(fileName);
+ setFilePath(Utils::FileName::fromString(fileName));
}
QmlProjectFile::~QmlProjectFile()
diff --git a/src/plugins/qmlprojectmanager/qmlprojectfile.h b/src/plugins/qmlprojectmanager/qmlprojectfile.h
index feb4e77d01..e1b5fbffc6 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectfile.h
+++ b/src/plugins/qmlprojectmanager/qmlprojectfile.h
@@ -44,7 +44,7 @@ class QmlProjectFile : public Core::IDocument
Q_OBJECT
public:
- QmlProjectFile(QmlProject *parent, QString fileName);
+ QmlProjectFile(QmlProject *parent, const QString &fileName);
virtual ~QmlProjectFile();
virtual bool save(QString *errorString, const QString &fileName, bool autoSave);
diff --git a/src/plugins/qmlprojectmanager/qmlprojectnodes.cpp b/src/plugins/qmlprojectmanager/qmlprojectnodes.cpp
index c36a42dec2..89b3c70a9d 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectnodes.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectnodes.cpp
@@ -42,11 +42,11 @@ namespace QmlProjectManager {
namespace Internal {
QmlProjectNode::QmlProjectNode(QmlProject *project, Core::IDocument *projectFile)
- : ProjectExplorer::ProjectNode(QFileInfo(projectFile->filePath()).absoluteFilePath()),
+ : ProjectExplorer::ProjectNode(projectFile->filePath().toString()),
m_project(project),
m_projectFile(projectFile)
{
- setDisplayName(QFileInfo(projectFile->filePath()).completeBaseName());
+ setDisplayName(projectFile->filePath().toFileInfo().completeBaseName());
// make overlay
const QSize desiredSize = QSize(16, 16);
const QIcon projectBaseIcon(QLatin1String(":/qmlproject/images/qmlfolder.png"));
@@ -63,7 +63,7 @@ Core::IDocument *QmlProjectNode::projectFile() const
{ return m_projectFile; }
QString QmlProjectNode::projectFilePath() const
-{ return m_projectFile->filePath(); }
+{ return m_projectFile->filePath().toString(); }
void QmlProjectNode::refresh()
{
diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp
index 3d0eabf9af..fdf637da7a 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp
@@ -257,7 +257,7 @@ void QmlProjectRunConfiguration::changeCurrentFile(IEditor *editor)
editor = EditorManager::currentEditor();
if (editor)
- m_currentFileFilename = editor->document()->filePath();
+ m_currentFileFilename = editor->document()->filePath().toString();
updateEnabled();
}
@@ -267,7 +267,7 @@ void QmlProjectRunConfiguration::updateEnabled()
if (mainScriptSource() == FileInEditor) {
IDocument *document = EditorManager::currentDocument();
if (document) {
- m_currentFileFilename = document->filePath();
+ m_currentFileFilename = document->filePath().toString();
if (MimeDatabase::findByFile(mainScript()).type() == QLatin1String("application/x-qml"))
qmlFileFound = true;
}
diff --git a/src/plugins/qnx/bardescriptordocument.cpp b/src/plugins/qnx/bardescriptordocument.cpp
index bb53862c5c..263556eded 100644
--- a/src/plugins/qnx/bardescriptordocument.cpp
+++ b/src/plugins/qnx/bardescriptordocument.cpp
@@ -68,7 +68,7 @@ bool BarDescriptorDocument::open(QString *errorString, const QString &fileName)
if (read(fileName, &contents, errorString) != Utils::TextFileFormat::ReadSuccess)
return false;
- setFilePath(fileName);
+ setFilePath(Utils::FileName::fromString(fileName));
const bool result = loadContent(contents, false);
@@ -83,7 +83,7 @@ bool BarDescriptorDocument::save(QString *errorString, const QString &fn, bool a
QTC_ASSERT(!autoSave, return false);
QTC_ASSERT(fn.isEmpty(), return false);
- const bool result = write(filePath(), xmlSource(), errorString);
+ const bool result = write(filePath().toString(), xmlSource(), errorString);
if (!result)
return false;
@@ -94,14 +94,12 @@ bool BarDescriptorDocument::save(QString *errorString, const QString &fn, bool a
QString BarDescriptorDocument::defaultPath() const
{
- QFileInfo fi(filePath());
- return fi.absolutePath();
+ return filePath().toFileInfo().absolutePath();
}
QString BarDescriptorDocument::suggestedFileName() const
{
- QFileInfo fi(filePath());
- return fi.fileName();
+ return filePath().toFileInfo().fileName();
}
bool BarDescriptorDocument::shouldAutoSave() const
@@ -135,7 +133,7 @@ bool BarDescriptorDocument::reload(QString *errorString, Core::IDocument::Reload
if (flag == Core::IDocument::FlagIgnore)
return true;
- return open(errorString, filePath());
+ return open(errorString, filePath().toString());
}
QString BarDescriptorDocument::xmlSource() const
diff --git a/src/plugins/qnx/bardescriptoreditor.cpp b/src/plugins/qnx/bardescriptoreditor.cpp
index 188ef97158..b6d6ff81ba 100644
--- a/src/plugins/qnx/bardescriptoreditor.cpp
+++ b/src/plugins/qnx/bardescriptoreditor.cpp
@@ -112,7 +112,7 @@ bool BarDescriptorEditor::open(QString *errorString, const QString &fileName, co
if (result) {
BarDescriptorEditorWidget *editorWidget = qobject_cast<BarDescriptorEditorWidget *>(widget());
QTC_ASSERT(editorWidget, return false);
- editorWidget->setFilePath(fileName);
+ editorWidget->setFilePath(Utils::FileName::fromString(fileName));
}
return result;
diff --git a/src/plugins/qnx/bardescriptoreditorwidget.cpp b/src/plugins/qnx/bardescriptoreditorwidget.cpp
index 525fb1f57f..d0de2eef49 100644
--- a/src/plugins/qnx/bardescriptoreditorwidget.cpp
+++ b/src/plugins/qnx/bardescriptoreditorwidget.cpp
@@ -192,7 +192,7 @@ TextEditor::TextEditorWidget *BarDescriptorEditorWidget::sourceWidget() const
return m_xmlSourceWidget;
}
-void BarDescriptorEditorWidget::setFilePath(const QString &filePath)
+void BarDescriptorEditorWidget::setFilePath(const Utils::FileName &filePath)
{
Core::IDocument *doc = m_xmlSourceWidget->textDocument();
if (doc)
@@ -211,7 +211,7 @@ void BarDescriptorEditorWidget::updateDocumentContent()
if (!result) {
ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error, errorMsg, Constants::QNX_TASK_CATEGORY_BARDESCRIPTOR,
- Utils::FileName::fromString(barDescriptorDocument()->filePath()), errorLine);
+ Utils::FileName::fromString(barDescriptorDocument()->filePath().toString()), errorLine);
ProjectExplorer::TaskHub::requestPopup();
}
}
diff --git a/src/plugins/qnx/bardescriptoreditorwidget.h b/src/plugins/qnx/bardescriptoreditorwidget.h
index dd893d0374..95fd4fe101 100644
--- a/src/plugins/qnx/bardescriptoreditorwidget.h
+++ b/src/plugins/qnx/bardescriptoreditorwidget.h
@@ -64,7 +64,7 @@ public:
TextEditor::TextEditorWidget *sourceWidget() const;
- void setFilePath(const QString &filePath);
+ void setFilePath(const Utils::FileName &filePath);
signals:
void changed(BarDescriptorDocument::Tag tag, const QVariant &value);
diff --git a/src/plugins/qnx/bardescriptorfilenodemanager.cpp b/src/plugins/qnx/bardescriptorfilenodemanager.cpp
index 008241f236..0d47584e70 100644
--- a/src/plugins/qnx/bardescriptorfilenodemanager.cpp
+++ b/src/plugins/qnx/bardescriptorfilenodemanager.cpp
@@ -170,7 +170,7 @@ void BarDescriptorFileNodeManager::updateBarDescriptorNodes(ProjectExplorer::Pro
Core::MessageManager::write(tr("Cannot save bar descriptor file: %1").arg(errorMessage));
continue;
} else {
- oldDocument->setFilePath(package.appDescriptorPath());
+ oldDocument->setFilePath(Utils::FileName::fromString(package.appDescriptorPath()));
if (!oldDocument->reload(&errorMessage, Core::IDocument::FlagReload, Core::IDocument::TypeContents))
Core::MessageManager::write(tr("Cannot reload bar descriptor file: %1").arg(errorMessage));
diff --git a/src/plugins/qtsupport/uicodemodelsupport.cpp b/src/plugins/qtsupport/uicodemodelsupport.cpp
index 888b084622..9c3a1f6dc4 100644
--- a/src/plugins/qtsupport/uicodemodelsupport.cpp
+++ b/src/plugins/qtsupport/uicodemodelsupport.cpp
@@ -411,7 +411,7 @@ void UiCodeModelManager::editorIsAboutToClose(Core::IEditor *editor)
if (isFormWindowDocument(m_lastEditor->document())) {
disconnect(m_lastEditor->document(), SIGNAL(changed()), this, SLOT(uiDocumentContentsHasChanged()));
if (m_dirty) {
- updateContents(m_lastEditor->document()->filePath(),
+ updateContents(m_lastEditor->document()->filePath().toString(),
formWindowEditorContents(m_lastEditor));
m_dirty = false;
}
@@ -427,7 +427,7 @@ void UiCodeModelManager::editorWasChanged(Core::IEditor *editor)
disconnect(m_lastEditor->document(), SIGNAL(changed()), this, SLOT(uiDocumentContentsHasChanged()));
if (m_dirty) {
- updateContents(m_lastEditor->document()->filePath(),
+ updateContents(m_lastEditor->document()->filePath().toString(),
formWindowEditorContents(m_lastEditor));
m_dirty = false;
}
diff --git a/src/plugins/resourceeditor/resourceeditorw.cpp b/src/plugins/resourceeditor/resourceeditorw.cpp
index dc9fae45b1..207a823346 100644
--- a/src/plugins/resourceeditor/resourceeditorw.cpp
+++ b/src/plugins/resourceeditor/resourceeditorw.cpp
@@ -54,6 +54,8 @@
#include <QInputDialog>
#include <QClipboard>
+using namespace Utils;
+
namespace ResourceEditor {
namespace Internal {
@@ -68,7 +70,7 @@ ResourceEditorDocument::ResourceEditorDocument(ResourceEditorW *parent) :
{
setId(ResourceEditor::Constants::RESOURCEEDITOR_ID);
setMimeType(QLatin1String(ResourceEditor::Constants::C_RESOURCE_MIMETYPE));
- setFilePath(parent->m_resourceEditor->fileName());
+ setFilePath(FileName::fromString(parent->m_resourceEditor->fileName()));
if (debugResourceEditorW)
qDebug() << "ResourceEditorFile::ResourceEditorFile()";
}
@@ -145,7 +147,7 @@ bool ResourceEditorW::open(QString *errorString, const QString &fileName, const
return false;
}
- m_resourceDocument->setFilePath(fileName);
+ m_resourceDocument->setFilePath(FileName::fromString(fileName));
m_resourceDocument->setBlockDirtyChanged(false);
m_resourceEditor->setDirty(fileName != realFileName);
m_shouldAutoSave = false;
@@ -158,23 +160,23 @@ bool ResourceEditorDocument::save(QString *errorString, const QString &name, boo
if (debugResourceEditorW)
qDebug(">ResourceEditorW::save: %s", qPrintable(name));
- const QString oldFileName = filePath();
- const QString actualName = name.isEmpty() ? oldFileName : name;
+ const FileName oldFileName = filePath();
+ const FileName actualName = name.isEmpty() ? oldFileName : FileName::fromString(name);
if (actualName.isEmpty())
return false;
m_blockDirtyChanged = true;
- m_parent->m_resourceEditor->setFileName(actualName);
+ m_parent->m_resourceEditor->setFileName(actualName.toString());
if (!m_parent->m_resourceEditor->save()) {
*errorString = m_parent->m_resourceEditor->errorMessage();
- m_parent->m_resourceEditor->setFileName(oldFileName);
+ m_parent->m_resourceEditor->setFileName(oldFileName.toString());
m_blockDirtyChanged = false;
return false;
}
m_parent->m_shouldAutoSave = false;
if (autoSave) {
- m_parent->m_resourceEditor->setFileName(oldFileName);
+ m_parent->m_resourceEditor->setFileName(oldFileName.toString());
m_parent->m_resourceEditor->setDirty(true);
m_blockDirtyChanged = false;
return true;
@@ -194,7 +196,7 @@ QString ResourceEditorDocument::plainText() const
bool ResourceEditorDocument::setContents(const QByteArray &contents)
{
- Utils::TempFileSaver saver;
+ TempFileSaver saver;
saver.write(contents);
if (!saver.finalize(Core::ICore::mainWindow()))
return false;
@@ -206,10 +208,10 @@ bool ResourceEditorDocument::setContents(const QByteArray &contents)
return rc;
}
-void ResourceEditorDocument::setFilePath(const QString &newName)
+void ResourceEditorDocument::setFilePath(const FileName &newName)
{
- if (newName != m_parent->m_resourceEditor->fileName())
- m_parent->m_resourceEditor->setFileName(newName);
+ if (newName.toString() != m_parent->m_resourceEditor->fileName())
+ m_parent->m_resourceEditor->setFileName(newName.toString());
IDocument::setFilePath(newName);
}
@@ -246,7 +248,7 @@ bool ResourceEditorDocument::reload(QString *errorString, ReloadFlag flag, Chang
emit changed();
} else {
emit aboutToReload();
- QString fn = filePath();
+ QString fn = filePath().toString();
const bool success = m_parent->open(errorString, fn, fn);
emit reloadFinished(success);
return success;
diff --git a/src/plugins/resourceeditor/resourceeditorw.h b/src/plugins/resourceeditor/resourceeditorw.h
index 908a936506..7eac71e9bb 100644
--- a/src/plugins/resourceeditor/resourceeditorw.h
+++ b/src/plugins/resourceeditor/resourceeditorw.h
@@ -65,7 +65,7 @@ public:
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
QString defaultPath() const;
QString suggestedFileName() const;
- void setFilePath(const QString &newName);
+ void setFilePath(const Utils::FileName &newName);
void setBlockDirtyChanged(bool value);
public slots:
diff --git a/src/plugins/resourceeditor/resourcenode.cpp b/src/plugins/resourceeditor/resourcenode.cpp
index cd5f855ac4..452c0503db 100644
--- a/src/plugins/resourceeditor/resourcenode.cpp
+++ b/src/plugins/resourceeditor/resourcenode.cpp
@@ -445,7 +445,7 @@ ResourceFileWatcher::ResourceFileWatcher(ResourceTopLevelNode *node)
{
setId("ResourceNodeWatcher");
setMimeType(QLatin1String(ResourceEditor::Constants::C_RESOURCE_MIMETYPE));
- setFilePath(node->path());
+ setFilePath(Utils::FileName::fromString(node->path()));
}
bool ResourceFileWatcher::save(QString *errorString, const QString &fileName, bool autoSave)
diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp
index 7e69673bb0..d462a52da3 100644
--- a/src/plugins/subversion/subversionplugin.cpp
+++ b/src/plugins/subversion/subversionplugin.cpp
@@ -468,7 +468,7 @@ bool SubversionPlugin::submitEditorAboutToClose()
// Submit editor closing. Make it write out the commit message
// and retrieve files
- const QFileInfo editorFile(editorDocument->filePath());
+ const QFileInfo editorFile = editorDocument->filePath().toFileInfo();
const QFileInfo changeFile(m_commitMessageFileName);
if (editorFile.absoluteFilePath() != changeFile.absoluteFilePath())
return true; // Oops?!
diff --git a/src/plugins/tasklist/taskfile.cpp b/src/plugins/tasklist/taskfile.cpp
index d3cd980b58..5882c36017 100644
--- a/src/plugins/tasklist/taskfile.cpp
+++ b/src/plugins/tasklist/taskfile.cpp
@@ -92,12 +92,12 @@ bool TaskFile::reload(QString *errorString, ReloadFlag flag, ChangeType type)
deleteLater();
return true;
}
- return open(errorString, filePath());
+ return open(errorString, filePath().toString());
}
bool TaskFile::open(QString *errorString, const QString &fileName)
{
- setFilePath(fileName);
+ setFilePath(Utils::FileName::fromString(fileName));
return TaskListPlugin::loadFile(errorString, m_baseDir, fileName);
}
diff --git a/src/plugins/tasklist/tasklistplugin.cpp b/src/plugins/tasklist/tasklistplugin.cpp
index 3b28f9e8d4..b06a2595eb 100644
--- a/src/plugins/tasklist/tasklistplugin.cpp
+++ b/src/plugins/tasklist/tasklistplugin.cpp
@@ -169,7 +169,7 @@ static bool parseTaskFile(QString *errorString, const QString &base, const QStri
Core::IDocument *TaskListPlugin::openTasks(const QString &base, const QString &fileName)
{
foreach (TaskFile *doc, m_openFiles) {
- if (doc->filePath() == fileName)
+ if (doc->filePath().toString() == fileName)
return doc;
}
diff --git a/src/plugins/texteditor/codecselector.cpp b/src/plugins/texteditor/codecselector.cpp
index 0011f188a8..cdf09bccba 100644
--- a/src/plugins/texteditor/codecselector.cpp
+++ b/src/plugins/texteditor/codecselector.cpp
@@ -78,7 +78,9 @@ CodecSelector::CodecSelector(QWidget *parent, TextDocument *doc)
QString decodingErrorHint;
if (m_hasDecodingError)
decodingErrorHint = QLatin1Char('\n') + tr("The following encodings are likely to fit:");
- m_label->setText(tr("Select encoding for \"%1\".%2").arg(QFileInfo(doc->filePath()).fileName()).arg(decodingErrorHint));
+ m_label->setText(tr("Select encoding for \"%1\".%2")
+ .arg(doc->filePath().toFileInfo().fileName())
+ .arg(decodingErrorHint));
m_listWidget = new CodecListWidget(this);
m_listWidget->setActivationMode(Utils::DoubleClickActivation);
diff --git a/src/plugins/texteditor/findincurrentfile.cpp b/src/plugins/texteditor/findincurrentfile.cpp
index b6546cd7d0..1c54e1c064 100644
--- a/src/plugins/texteditor/findincurrentfile.cpp
+++ b/src/plugins/texteditor/findincurrentfile.cpp
@@ -73,18 +73,18 @@ Utils::FileIterator *FindInCurrentFile::files(const QStringList &nameFilters,
QVariant FindInCurrentFile::additionalParameters() const
{
- return qVariantFromValue(m_currentDocument->filePath());
+ return qVariantFromValue(m_currentDocument->filePath().toString());
}
QString FindInCurrentFile::label() const
{
- return tr("File \"%1\":").arg(QFileInfo(m_currentDocument->filePath()).fileName());
+ return tr("File \"%1\":").arg(m_currentDocument->filePath().toFileInfo().fileName());
}
QString FindInCurrentFile::toolTip() const
{
// %2 is filled by BaseFileFind::runNewSearch
- return tr("File path: %1\n%2").arg(QDir::toNativeSeparators(m_currentDocument->filePath()));
+ return tr("File path: %1\n%2").arg(m_currentDocument->filePath().toUserOutput());
}
bool FindInCurrentFile::isEnabled() const
diff --git a/src/plugins/texteditor/refactoringchanges.cpp b/src/plugins/texteditor/refactoringchanges.cpp
index a85132c096..4c34d25293 100644
--- a/src/plugins/texteditor/refactoringchanges.cpp
+++ b/src/plugins/texteditor/refactoringchanges.cpp
@@ -161,7 +161,7 @@ RefactoringFile::RefactoringFile(QTextDocument *document, const QString &fileNam
{ }
RefactoringFile::RefactoringFile(TextEditorWidget *editor)
- : m_fileName(editor->textDocument()->filePath())
+ : m_fileName(editor->textDocument()->filePath().toString())
, m_document(0)
, m_editor(editor)
, m_openEditor(false)
diff --git a/src/plugins/texteditor/textdocument.cpp b/src/plugins/texteditor/textdocument.cpp
index 9e312eb29c..d9b5e25023 100644
--- a/src/plugins/texteditor/textdocument.cpp
+++ b/src/plugins/texteditor/textdocument.cpp
@@ -231,7 +231,7 @@ QMap<QString, QString> TextDocument::openedTextDocumentContents()
TextDocument *textEditorDocument = qobject_cast<TextDocument *>(document);
if (!textEditorDocument)
continue;
- QString fileName = textEditorDocument->filePath();
+ QString fileName = textEditorDocument->filePath().toString();
workingCopy[fileName] = textEditorDocument->plainText();
}
return workingCopy;
@@ -244,7 +244,7 @@ QMap<QString, QTextCodec *> TextDocument::openedTextDocumentEncodings()
TextDocument *textEditorDocument = qobject_cast<TextDocument *>(document);
if (!textEditorDocument)
continue;
- QString fileName = textEditorDocument->filePath();
+ QString fileName = textEditorDocument->filePath().toString();
workingCopy[fileName] = const_cast<QTextCodec *>(textEditorDocument->codec());
}
return workingCopy;
@@ -466,7 +466,7 @@ bool TextDocument::save(QString *errorString, const QString &saveFileName, bool
cursor.endEditBlock();
}
- QString fName = filePath();
+ QString fName = filePath().toString();
if (!saveFileName.isEmpty())
fName = saveFileName;
@@ -509,7 +509,7 @@ bool TextDocument::save(QString *errorString, const QString &saveFileName, bool
// inform about the new filename
const QFileInfo fi(fName);
d->m_document.setModified(false); // also triggers update of the block revisions
- setFilePath(QDir::cleanPath(fi.absoluteFilePath()));
+ setFilePath(Utils::FileName::fromUserInput(fi.absoluteFilePath()));
emit changed();
return true;
}
@@ -524,12 +524,11 @@ bool TextDocument::shouldAutoSave() const
return d->m_autoSaveRevision != d->m_document.revision();
}
-void TextDocument::setFilePath(const QString &newName)
+void TextDocument::setFilePath(const Utils::FileName &newName)
{
if (newName == filePath())
return;
- const QFileInfo fi(newName);
- IDocument::setFilePath(QDir::cleanPath(fi.absoluteFilePath()));
+ IDocument::setFilePath(Utils::FileName::fromUserInput(newName.toFileInfo().absoluteFilePath()));
}
bool TextDocument::isFileReadOnly() const
@@ -548,8 +547,7 @@ void TextDocument::checkPermissions()
{
bool previousReadOnly = d->m_fileIsReadOnly;
if (!filePath().isEmpty()) {
- const QFileInfo fi(filePath());
- d->m_fileIsReadOnly = !fi.isWritable();
+ d->m_fileIsReadOnly = !filePath().toFileInfo().isWritable();
} else {
d->m_fileIsReadOnly = false;
}
@@ -598,7 +596,7 @@ bool TextDocument::open(QString *errorString, const QString &fileName, const QSt
documentLayout->lastSaveRevision = d->m_autoSaveRevision = d->m_document.revision();
d->updateRevisions();
d->m_document.setModified(fileName != realFileName);
- setFilePath(QDir::cleanPath(fi.absoluteFilePath()));
+ setFilePath(Utils::FileName::fromUserInput(fi.absoluteFilePath()));
}
return readResult == Utils::TextFileFormat::ReadSuccess
|| readResult == Utils::TextFileFormat::ReadEncodingError;
@@ -620,7 +618,7 @@ bool TextDocument::reload(QString *errorString)
if (documentLayout)
marks = documentLayout->documentClosing(); // removes text marks non-permanently
- bool success = open(errorString, filePath(), filePath());
+ bool success = open(errorString, filePath().toString(), filePath().toString());
if (documentLayout)
documentLayout->documentReloaded(marks, this); // re-adds text marks
diff --git a/src/plugins/texteditor/textdocument.h b/src/plugins/texteditor/textdocument.h
index e82e33f0fa..72a8f17119 100644
--- a/src/plugins/texteditor/textdocument.h
+++ b/src/plugins/texteditor/textdocument.h
@@ -111,7 +111,7 @@ public:
bool isSaveAsAllowed() const;
void checkPermissions();
bool reload(QString *errorString, ReloadFlag flag, ChangeType type);
- void setFilePath(const QString &newName);
+ void setFilePath(const Utils::FileName &newName);
QString defaultPath() const;
QString suggestedFileName() const;
diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp
index 243616be09..28a328ae3e 100644
--- a/src/plugins/texteditor/texteditor.cpp
+++ b/src/plugins/texteditor/texteditor.cpp
@@ -2733,7 +2733,7 @@ void TextEditorWidgetPrivate::updateCodeFoldingVisible()
void TextEditorWidgetPrivate::reconfigure()
{
- q->configureMimeType(MimeDatabase::findByFile(m_document->filePath()));
+ q->configureMimeType(MimeDatabase::findByFile(m_document->filePath().toString()));
}
bool TextEditorWidget::codeFoldingVisible() const
@@ -5360,7 +5360,7 @@ bool TextEditorWidget::openLink(const Link &link, bool inNextSplit)
if (!link.hasValidTarget())
return false;
- if (!inNextSplit && textDocument()->filePath() == link.targetFileName) {
+ if (!inNextSplit && textDocument()->filePath().toString() == link.targetFileName) {
EditorManager::addCurrentPositionToNavigationHistory();
gotoLine(link.targetLine, link.targetColumn);
setFocus();
@@ -7094,7 +7094,7 @@ AssistInterface *TextEditorWidget::createAssistInterface(AssistKind kind,
AssistReason reason) const
{
Q_UNUSED(kind);
- return new AssistInterface(document(), position(), d->m_document->filePath(), reason);
+ return new AssistInterface(document(), position(), d->m_document->filePath().toString(), reason);
}
QString TextEditorWidget::foldReplacementText(const QTextBlock &) const
@@ -7198,7 +7198,7 @@ void TextEditorWidget::configureMimeType(const MimeType &mimeType)
setCodeFoldingSupported(true);
}
} else {
- const QString &fileName = textDocument()->filePath();
+ const QString &fileName = textDocument()->filePath().toString();
if (TextEditorSettings::highlighterSettings().isIgnoredFilePattern(fileName))
d->m_isMissingSyntaxDefinition = false;
}
diff --git a/src/plugins/texteditor/textmark.cpp b/src/plugins/texteditor/textmark.cpp
index 2a33f888d7..9f8a729fa8 100644
--- a/src/plugins/texteditor/textmark.cpp
+++ b/src/plugins/texteditor/textmark.cpp
@@ -214,10 +214,10 @@ void TextMarkRegistry::editorOpened(Core::IEditor *editor)
auto document = qobject_cast<TextDocument *>(editor ? editor->document() : 0);
if (!document)
return;
- if (!m_marks.contains(FileName::fromString(document->filePath())))
+ if (!m_marks.contains(document->filePath()))
return;
- foreach (TextMark *mark, m_marks.value(FileName::fromString(document->filePath())))
+ foreach (TextMark *mark, m_marks.value(document->filePath()))
document->addMark(mark);
}
diff --git a/src/plugins/todo/todoitemsprovider.cpp b/src/plugins/todo/todoitemsprovider.cpp
index 24ddabdeec..ed63c80e9b 100644
--- a/src/plugins/todo/todoitemsprovider.cpp
+++ b/src/plugins/todo/todoitemsprovider.cpp
@@ -81,7 +81,7 @@ void TodoItemsProvider::updateList()
// Show only items of the current file if any
if (m_settings.scanningScope == ScanningScopeCurrentFile) {
if (m_currentEditor)
- m_itemsList = m_itemsHash.value(m_currentEditor->document()->filePath());
+ m_itemsList = m_itemsHash.value(m_currentEditor->document()->filePath().toString());
// Show only items of the startup project if any
} else {
if (m_startupProject)
diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp
index 23b2d2775d..48e2ff8b15 100644
--- a/src/plugins/valgrind/callgrindtool.cpp
+++ b/src/plugins/valgrind/callgrindtool.cpp
@@ -872,7 +872,7 @@ void CallgrindToolPrivate::requestContextMenu(TextEditorWidget *widget, int line
// find callgrind text mark that corresponds to this editor's file and line number
const Function *func = 0;
foreach (CallgrindTextMark *textMark, m_textMarks) {
- if (textMark->fileName() == widget->textDocument()->filePath() && textMark->lineNumber() == line) {
+ if (textMark->fileName() == widget->textDocument()->filePath().toString() && textMark->lineNumber() == line) {
func = textMark->function();
break;
}
diff --git a/src/plugins/vcsbase/submiteditorfile.cpp b/src/plugins/vcsbase/submiteditorfile.cpp
index 84cab62a4d..71a1b40dd5 100644
--- a/src/plugins/vcsbase/submiteditorfile.cpp
+++ b/src/plugins/vcsbase/submiteditorfile.cpp
@@ -38,6 +38,7 @@
using namespace VcsBase;
using namespace VcsBase::Internal;
+using namespace Utils;
/*!
\class VcsBase::Internal::SubmitEditorFile
@@ -71,15 +72,15 @@ void SubmitEditorFile::setModified(bool modified)
bool SubmitEditorFile::save(QString *errorString, const QString &fileName, bool autoSave)
{
- const QString fName = fileName.isEmpty() ? filePath() : fileName;
- Utils::FileSaver saver(fName, QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text);
+ const FileName fName = fileName.isEmpty() ? filePath() : FileName::fromString(fileName);
+ FileSaver saver(fName.toString(),
+ QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text);
saver.write(m_editor->fileContents());
if (!saver.finalize(errorString))
return false;
if (autoSave)
return true;
- const QFileInfo fi(fName);
- setFilePath(fi.absoluteFilePath());
+ setFilePath(FileName::fromUserInput(fName.toFileInfo().absoluteFilePath()));
setModified(false);
if (!errorString->isEmpty())
return false;
diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp
index 1c999c9ee3..8755a4c091 100644
--- a/src/plugins/vcsbase/vcsbaseeditor.cpp
+++ b/src/plugins/vcsbase/vcsbaseeditor.cpp
@@ -1221,7 +1221,7 @@ static QTextCodec *findProjectCodec(const QString &dir)
const ProjectList::const_iterator pcend = projects.constEnd();
for (ProjectList::const_iterator it = projects.constBegin(); it != pcend; ++it)
if (const Core::IDocument *document = (*it)->document())
- if (document->filePath().startsWith(dir)) {
+ if (document->filePath().toString().startsWith(dir)) {
QTextCodec *codec = (*it)->editorConfiguration()->textCodec();
return codec;
}
@@ -1267,7 +1267,7 @@ int VcsBaseEditor::lineNumberOfCurrentEditor(const QString &currentFile)
return -1;
if (!currentFile.isEmpty()) {
const Core::IDocument *idocument = ed->document();
- if (!idocument || idocument->filePath() != currentFile)
+ if (!idocument || idocument->filePath().toString() != currentFile)
return -1;
}
const BaseTextEditor *eda = qobject_cast<const BaseTextEditor *>(ed);
diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp
index 461312d461..d17ee8e210 100644
--- a/src/plugins/vcsbase/vcsbaseplugin.cpp
+++ b/src/plugins/vcsbase/vcsbaseplugin.cpp
@@ -261,7 +261,7 @@ void StateListener::slotStateChanged()
if (!currentDocument) {
state.currentFile.clear();
} else {
- state.currentFile = currentDocument->filePath();
+ state.currentFile = currentDocument->filePath().toString();
if (state.currentFile.isEmpty() || currentDocument->isTemporary())
state.currentFile = VcsBasePlugin::source(currentDocument);
}
@@ -676,7 +676,7 @@ void VcsBasePlugin::createRepository()
// Find current starting directory
QString directory;
if (const Project *currentProject = ProjectTree::currentProject())
- directory = QFileInfo(currentProject->document()->filePath()).absolutePath();
+ directory = currentProject->document()->filePath().toFileInfo().absolutePath();
// Prompt for a directory that is not under version control yet
QWidget *mw = ICore::mainWindow();
do {
diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp
index 31b0d0389b..0574bc1e3f 100644
--- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp
+++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp
@@ -372,7 +372,7 @@ bool VcsBaseSubmitEditor::open(QString *errorString, const QString &fileName, co
if (!setFileContents(text.toUtf8()))
return false;
- d->m_file->setFilePath(QFileInfo(fileName).absoluteFilePath());
+ d->m_file->setFilePath(Utils::FileName::fromString(fileName));
d->m_file->setModified(fileName != realFileName);
return true;
}