diff --git a/src/plugins/coreplugin/locator/filesystemfilter.cpp b/src/plugins/coreplugin/locator/filesystemfilter.cpp index 3402e69b792..95c9bf16ea2 100644 --- a/src/plugins/coreplugin/locator/filesystemfilter.cpp +++ b/src/plugins/coreplugin/locator/filesystemfilter.cpp @@ -175,24 +175,21 @@ void FileSystemFilter::accept(LocatorFilterEntry selection, int *selectionLength) const { Q_UNUSED(selectionLength) - QFileInfo info = selection.filePath.toFileInfo(); - if (info.isDir()) { + if (selection.filePath.isDir()) { const QString value = shortcutString() + ' ' - + QDir::toNativeSeparators(info.absoluteFilePath() + '/'); + + selection.filePath.absoluteFilePath().toUserOutput() + '/'; *newText = value; *selectionStart = value.length(); } else { // Don't block locator filter execution with dialog - QMetaObject::invokeMethod(EditorManager::instance(), [info, selection] { - const QString targetFile = selection.internalData.toString(); - if (!info.exists()) { + QMetaObject::invokeMethod(EditorManager::instance(), [selection] { + const FilePath targetFile = FilePath::fromVariant(selection.internalData); + if (!selection.filePath.exists()) { if (CheckableMessageBox::shouldAskAgain(ICore::settings(), kAlwaysCreate)) { CheckableMessageBox messageBox(ICore::dialogParent()); messageBox.setWindowTitle(tr("Create File")); messageBox.setIcon(QMessageBox::Question); - messageBox.setText( - tr("Create \"%1\"?") - .arg(FilePath::fromString(targetFile).shortNativePath())); + messageBox.setText(tr("Create \"%1\"?").arg(targetFile.shortNativePath())); messageBox.setCheckBoxVisible(true); messageBox.setCheckBoxText(tr("Always create")); messageBox.setChecked(false); @@ -206,10 +203,10 @@ void FileSystemFilter::accept(LocatorFilterEntry selection, if (messageBox.isChecked()) CheckableMessageBox::doNotAskAgain(ICore::settings(), kAlwaysCreate); } - QFile file(targetFile); + QFile file(targetFile.toString()); file.open(QFile::WriteOnly); file.close(); - VcsManager::promptToAdd(QFileInfo(targetFile).absolutePath(), { targetFile }); + VcsManager::promptToAdd(targetFile.absolutePath(), {targetFile}); } BaseFileFilter::openEditorAt(selection); }, Qt::QueuedConnection); diff --git a/src/plugins/coreplugin/vcsmanager.cpp b/src/plugins/coreplugin/vcsmanager.cpp index d4fed2d7d8e..e42f6ee238b 100644 --- a/src/plugins/coreplugin/vcsmanager.cpp +++ b/src/plugins/coreplugin/vcsmanager.cpp @@ -431,13 +431,13 @@ QStringList VcsManager::additionalToolsPath() return d->m_cachedAdditionalToolsPaths; } -void VcsManager::promptToAdd(const QString &directory, const QStringList &fileNames) +void VcsManager::promptToAdd(const FilePath &directory, const FilePaths &filePaths) { - IVersionControl *vc = findVersionControlForDirectory(FilePath::fromString(directory)); + IVersionControl *vc = findVersionControlForDirectory(directory); if (!vc || !vc->supportsOperation(IVersionControl::AddOperation)) return; - const FilePaths unmanagedFiles = vc->unmanagedFiles(Utils::transform(fileNames, &FilePath::fromString)); + const FilePaths unmanagedFiles = vc->unmanagedFiles(filePaths); if (unmanagedFiles.isEmpty()) return; @@ -446,7 +446,7 @@ void VcsManager::promptToAdd(const QString &directory, const QStringList &fileNa if (dlg.exec() == QDialog::Accepted) { QStringList notAddedToVc; for (const FilePath &file : unmanagedFiles) { - if (!vc->vcsAdd(FilePath::fromString(QDir(directory).filePath(file.path())))) + if (!vc->vcsAdd(directory.resolvePath(file))) notAddedToVc << file.toUserOutput(); } diff --git a/src/plugins/coreplugin/vcsmanager.h b/src/plugins/coreplugin/vcsmanager.h index 7cb15f2f58f..f0ce9b30cab 100644 --- a/src/plugins/coreplugin/vcsmanager.h +++ b/src/plugins/coreplugin/vcsmanager.h @@ -80,7 +80,7 @@ public: // Shows a confirmation dialog, whether the files in the list should be // added to revision control. Calls vcsAdd for each file. - static void promptToAdd(const QString &directory, const QStringList &fileNames); + static void promptToAdd(const Utils::FilePath &directory, const Utils::FilePaths &filePaths); static void emitRepositoryChanged(const Utils::FilePath &repository); diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index d8fb0dc8f2f..852b5c27e87 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -3619,10 +3619,10 @@ void ProjectExplorerPluginPrivate::addExistingProjects() if (subProjectFilePaths.empty()) return; FilePaths failedProjects; - QStringList addedProjects; + FilePaths addedProjects; for (const FilePath &filePath : qAsConst(subProjectFilePaths)) { if (projectNode->addSubProject(filePath)) - addedProjects << filePath.toString(); + addedProjects << filePath; else failedProjects << filePath; } @@ -3633,7 +3633,7 @@ void ProjectExplorerPluginPrivate::addExistingProjects() message + "\n " + FilePath::formatFilePaths(failedProjects, "\n ")); return; } - VcsManager::promptToAdd(dir.toString(), addedProjects); + VcsManager::promptToAdd(dir, addedProjects); } void ProjectExplorerPluginPrivate::handleAddExistingFiles() @@ -3685,7 +3685,7 @@ void ProjectExplorerPlugin::addExistingFiles(FolderNode *folderNode, const FileP [¬Added](const FilePath &f) { return !notAdded.contains(f); }); } - VcsManager::promptToAdd(dir.toString(), Utils::transform(fileNames, &FilePath::toString)); + VcsManager::promptToAdd(dir, fileNames); } void ProjectExplorerPluginPrivate::removeProject() diff --git a/src/plugins/resourceeditor/qrceditor/resourcefile.cpp b/src/plugins/resourceeditor/qrceditor/resourcefile.cpp index f4ab60b6f43..b89ddffb88a 100644 --- a/src/plugins/resourceeditor/qrceditor/resourcefile.cpp +++ b/src/plugins/resourceeditor/qrceditor/resourcefile.cpp @@ -30,7 +30,9 @@ #include #include #include -#include + +#include +#include #include #include @@ -995,7 +997,8 @@ void ResourceModel::addFiles(int prefixIndex, const QStringList &fileNames, int firstFile = cnt; lastFile = cnt + unique_list.count() - 1; - Core::VcsManager::promptToAdd(m_resource_file.filePath().absolutePath().toString(), fileNames); + Core::VcsManager::promptToAdd(m_resource_file.filePath().absolutePath(), + Utils::transform(fileNames, &FilePath::fromString)); }