Core: filepathify expected document changes

Change-Id: Ifa9341e55c79459db9ecef3c441da9b2816695bf
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2021-06-09 09:59:37 +02:00
parent 072958c3b0
commit 410b02f8c5
19 changed files with 60 additions and 53 deletions

View File

@@ -1100,7 +1100,7 @@ bool ClearCasePluginPrivate::vcsUndoCheckOut(const QString &workingDir, const QS
if (Constants::debug) if (Constants::debug)
qDebug() << Q_FUNC_INFO << workingDir << fileName << keep; qDebug() << Q_FUNC_INFO << workingDir << fileName << keep;
FileChangeBlocker fcb(fileName); FileChangeBlocker fcb(FilePath::fromString(fileName));
// revert // revert
QStringList args(QLatin1String("uncheckout")); QStringList args(QLatin1String("uncheckout"));
@@ -1175,7 +1175,7 @@ void ClearCasePluginPrivate::undoHijackCurrent()
keep = unhijackUi.chkKeep->isChecked(); keep = unhijackUi.chkKeep->isChecked();
} }
FileChangeBlocker fcb(state.currentFile()); FileChangeBlocker fcb(FilePath::fromString(state.currentFile()));
// revert // revert
if (vcsUndoHijack(state.currentFileTopLevel(), fileName, keep)) if (vcsUndoHijack(state.currentFileTopLevel(), fileName, keep))
@@ -1760,7 +1760,7 @@ bool ClearCasePluginPrivate::vcsOpen(const QString &workingDir, const QString &f
if (m_viewData.isUcm && !vcsSetActivity(topLevel, title, coDialog.activity())) if (m_viewData.isUcm && !vcsSetActivity(topLevel, title, coDialog.activity()))
return false; return false;
FileChangeBlocker fcb(absPath); FileChangeBlocker fcb(FilePath::fromString(absPath));
QStringList args(QLatin1String("checkout")); QStringList args(QLatin1String("checkout"));
const QString comment = coDialog.comment(); const QString comment = coDialog.comment();
@@ -1886,7 +1886,8 @@ bool ClearCasePluginPrivate::vcsCheckIn(const QString &messageFile, const QStrin
args << files; args << files;
QList<FCBPointer> blockers; QList<FCBPointer> blockers;
foreach (const QString &fileName, files) { foreach (const QString &fileName, files) {
FCBPointer fcb(new FileChangeBlocker(QFileInfo(m_checkInView, fileName).canonicalFilePath())); FCBPointer fcb(new FileChangeBlocker(
FilePath::fromString(QFileInfo(m_checkInView, fileName).canonicalFilePath())));
blockers.append(fcb); blockers.append(fcb);
} }
const ClearCaseResponse response = const ClearCaseResponse response =

View File

@@ -44,6 +44,7 @@
#include <coreplugin/editormanager/ieditorfactory.h> #include <coreplugin/editormanager/ieditorfactory.h>
#include <coreplugin/editormanager/iexternaleditor.h> #include <coreplugin/editormanager/iexternaleditor.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
@@ -177,7 +178,7 @@ public:
QSet<QString> m_changedFiles; // watched file paths collected from file watcher notifications QSet<QString> m_changedFiles; // watched file paths collected from file watcher notifications
QList<IDocument *> m_documentsWithoutWatch; QList<IDocument *> m_documentsWithoutWatch;
QMap<IDocument *, QStringList> m_documentsWithWatch; // document -> list of filePathKeys QMap<IDocument *, QStringList> m_documentsWithWatch; // document -> list of filePathKeys
QSet<QString> m_expectedFileNames; // set of file names without normalization QSet<Utils::FilePath> m_expectedFileNames; // set of file paths without normalization
QList<DocumentManager::RecentFile> m_recentFiles; QList<DocumentManager::RecentFile> m_recentFiles;
@@ -633,11 +634,11 @@ QList<IDocument *> DocumentManager::modifiedDocuments()
\sa unexpectFileChange() \sa unexpectFileChange()
*/ */
void DocumentManager::expectFileChange(const QString &fileName) void DocumentManager::expectFileChange(const Utils::FilePath &filePath)
{ {
if (fileName.isEmpty()) if (filePath.isEmpty())
return; return;
d->m_expectedFileNames.insert(fileName); d->m_expectedFileNames.insert(filePath);
} }
/* only called from unblock and unexpect file change functions */ /* only called from unblock and unexpect file change functions */
@@ -657,16 +658,17 @@ static void updateExpectedState(const QString &filePathKey)
\sa expectFileChange() \sa expectFileChange()
*/ */
void DocumentManager::unexpectFileChange(const QString &fileName) void DocumentManager::unexpectFileChange(const FilePath &filePath)
{ {
// We are updating the expected time of the file // We are updating the expected time of the file
// And in changedFile we'll check if the modification time // And in changedFile we'll check if the modification time
// is the same as the saved one here // is the same as the saved one here
// If so then it's a expected change // If so then it's a expected change
if (fileName.isEmpty()) if (filePath.isEmpty())
return; return;
d->m_expectedFileNames.remove(fileName); d->m_expectedFileNames.remove(filePath);
const QString &fileName = filePath.toString();
const QString cleanAbsFilePath = cleanAbsoluteFilePath(fileName, KeepLinks); const QString cleanAbsFilePath = cleanAbsoluteFilePath(fileName, KeepLinks);
updateExpectedState(filePathKey(fileName, KeepLinks)); updateExpectedState(filePathKey(fileName, KeepLinks));
const QString resolvedCleanAbsFilePath = cleanAbsoluteFilePath(fileName, ResolveLinks); const QString resolvedCleanAbsFilePath = cleanAbsoluteFilePath(fileName, ResolveLinks);
@@ -766,7 +768,7 @@ bool DocumentManager::saveDocument(IDocument *document,
{ {
bool ret = true; bool ret = true;
const Utils::FilePath &savePath = filePath.isEmpty() ? document->filePath() : filePath; const Utils::FilePath &savePath = filePath.isEmpty() ? document->filePath() : filePath;
expectFileChange(savePath.toString()); // This only matters to other IDocuments which refer to this file expectFileChange(savePath); // 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 bool addWatcher = removeDocument(document); // So that our own IDocument gets no notification at all
QString errorString; QString errorString;
@@ -787,7 +789,7 @@ bool DocumentManager::saveDocument(IDocument *document,
} }
addDocument(document, addWatcher); addDocument(document, addWatcher);
unexpectFileChange(savePath.toString()); unexpectFileChange(savePath);
m_instance->updateSaveAll(); m_instance->updateSaveAll();
return ret; return ret;
} }
@@ -1147,7 +1149,8 @@ void DocumentManager::checkForReload()
// if the resolved names are different when unexpectFileChange is called // if the resolved names are different when unexpectFileChange is called
// we would end up with never-unexpected file names // we would end up with never-unexpected file names
QSet<QString> expectedFileKeys; QSet<QString> expectedFileKeys;
foreach (const QString &fileName, d->m_expectedFileNames) { foreach (const Utils::FilePath &filePath, d->m_expectedFileNames) {
const QString &fileName = filePath.toString();
const QString cleanAbsFilePath = cleanAbsoluteFilePath(fileName, KeepLinks); const QString cleanAbsFilePath = cleanAbsoluteFilePath(fileName, KeepLinks);
expectedFileKeys.insert(filePathKey(fileName, KeepLinks)); expectedFileKeys.insert(filePathKey(fileName, KeepLinks));
const QString resolvedCleanAbsFilePath = cleanAbsoluteFilePath(fileName, ResolveLinks); const QString resolvedCleanAbsFilePath = cleanAbsoluteFilePath(fileName, ResolveLinks);
@@ -1575,15 +1578,15 @@ void DocumentManager::registerSaveAllAction()
IDocument object in the destructor, set modifiedReload() to \c true. IDocument object in the destructor, set modifiedReload() to \c true.
*/ */
FileChangeBlocker::FileChangeBlocker(const QString &fileName) FileChangeBlocker::FileChangeBlocker(const FilePath &filePath)
: m_fileName(fileName) : m_filePath(filePath)
{ {
DocumentManager::expectFileChange(fileName); DocumentManager::expectFileChange(filePath);
} }
FileChangeBlocker::~FileChangeBlocker() FileChangeBlocker::~FileChangeBlocker()
{ {
DocumentManager::unexpectFileChange(m_fileName); DocumentManager::unexpectFileChange(m_filePath);
} }
} // namespace Core } // namespace Core

View File

@@ -65,8 +65,8 @@ public:
static void renamedFile(const QString &from, const QString &to); static void renamedFile(const QString &from, const QString &to);
static void expectFileChange(const QString &fileName); static void expectFileChange(const Utils::FilePath &filePath);
static void unexpectFileChange(const QString &fileName); static void unexpectFileChange(const Utils::FilePath &filePath);
// recent files // recent files
static void addToRecentFiles(const Utils::FilePath &filePath, Utils::Id editorId = {}); static void addToRecentFiles(const Utils::FilePath &filePath, Utils::Id editorId = {});
@@ -172,10 +172,10 @@ private:
class CORE_EXPORT FileChangeBlocker class CORE_EXPORT FileChangeBlocker
{ {
public: public:
explicit FileChangeBlocker(const QString &fileName); explicit FileChangeBlocker(const Utils::FilePath &filePath);
~FileChangeBlocker(); ~FileChangeBlocker();
private: private:
const QString m_fileName; const Utils::FilePath m_filePath;
Q_DISABLE_COPY(FileChangeBlocker) Q_DISABLE_COPY(FileChangeBlocker)
}; };

View File

@@ -644,12 +644,12 @@ void ExternalToolRunner::run()
} }
if (m_tool->modifiesCurrentDocument()) { if (m_tool->modifiesCurrentDocument()) {
if (IDocument *document = EditorManager::currentDocument()) { if (IDocument *document = EditorManager::currentDocument()) {
m_expectedFileName = document->filePath().toString(); m_expectedFilePath = document->filePath();
if (!DocumentManager::saveModifiedDocument(document)) { if (!DocumentManager::saveModifiedDocument(document)) {
deleteLater(); deleteLater();
return; return;
} }
DocumentManager::expectFileChange(m_expectedFileName); DocumentManager::expectFileChange(m_expectedFilePath);
} }
} }
m_process = new QtcProcess(this); m_process = new QtcProcess(this);
@@ -687,7 +687,7 @@ void ExternalToolRunner::finished()
ExternalToolManager::emitReplaceSelectionRequested(m_processOutput); ExternalToolManager::emitReplaceSelectionRequested(m_processOutput);
} }
if (m_tool->modifiesCurrentDocument()) if (m_tool->modifiesCurrentDocument())
DocumentManager::unexpectFileChange(m_expectedFileName); DocumentManager::unexpectFileChange(m_expectedFilePath);
const auto write = m_tool->outputHandling() == ExternalTool::ShowInPane const auto write = m_tool->outputHandling() == ExternalTool::ShowInPane
? QOverload<const QString &>::of(MessageManager::writeFlashing) ? QOverload<const QString &>::of(MessageManager::writeFlashing)
: QOverload<const QString &>::of(MessageManager::writeSilently); : QOverload<const QString &>::of(MessageManager::writeSilently);
@@ -698,7 +698,7 @@ void ExternalToolRunner::finished()
void ExternalToolRunner::error(QProcess::ProcessError error) void ExternalToolRunner::error(QProcess::ProcessError error)
{ {
if (m_tool->modifiesCurrentDocument()) if (m_tool->modifiesCurrentDocument())
DocumentManager::unexpectFileChange(m_expectedFileName); DocumentManager::unexpectFileChange(m_expectedFilePath);
// TODO inform about errors // TODO inform about errors
Q_UNUSED(error) Q_UNUSED(error)
deleteLater(); deleteLater();

View File

@@ -154,7 +154,7 @@ private:
QTextCodec::ConverterState m_outputCodecState; QTextCodec::ConverterState m_outputCodecState;
QTextCodec::ConverterState m_errorCodecState; QTextCodec::ConverterState m_errorCodecState;
QString m_processOutput; QString m_processOutput;
QString m_expectedFileName; Utils::FilePath m_expectedFilePath;
bool m_hasError; bool m_hasError;
QString m_errorString; QString m_errorString;
}; };

View File

@@ -908,7 +908,7 @@ void CvsPluginPrivate::revertCurrentFile()
tr("The file has been changed. Do you want to revert it?"))) tr("The file has been changed. Do you want to revert it?")))
return; return;
FileChangeBlocker fcb(state.currentFile()); FileChangeBlocker fcb(FilePath::fromString(state.currentFile()));
// revert // revert
args.clear(); args.clear();

View File

@@ -162,7 +162,9 @@ void DiffEditorWidgetController::patch(bool revert, int fileIndex, int chunkInde
const QString workingDirectory = m_document->baseDirectory().isEmpty() const QString workingDirectory = m_document->baseDirectory().isEmpty()
? QFileInfo(fileName).absolutePath() ? QFileInfo(fileName).absolutePath()
: m_document->baseDirectory(); : m_document->baseDirectory();
const QString absFileName = QFileInfo(workingDirectory + '/' + QFileInfo(fileName).fileName()).absoluteFilePath(); const Utils::FilePath absFilePath = Utils::FilePath::fromString(workingDirectory)
.pathAppended(QFileInfo(fileName).fileName())
.absoluteFilePath();
if (patchBehaviour == DiffFileInfo::PatchFile) { if (patchBehaviour == DiffFileInfo::PatchFile) {
const int strip = m_document->baseDirectory().isEmpty() ? -1 : 0; const int strip = m_document->baseDirectory().isEmpty() ? -1 : 0;
@@ -172,13 +174,13 @@ void DiffEditorWidgetController::patch(bool revert, int fileIndex, int chunkInde
if (patch.isEmpty()) if (patch.isEmpty())
return; return;
FileChangeBlocker fileChangeBlocker(absFileName); FileChangeBlocker fileChangeBlocker(absFilePath);
if (PatchTool::runPatch(EditorManager::defaultTextCodec()->fromUnicode(patch), if (PatchTool::runPatch(EditorManager::defaultTextCodec()->fromUnicode(patch),
workingDirectory, strip, revert)) workingDirectory, strip, revert))
m_document->reload(); m_document->reload();
} else { // PatchEditor } else { // PatchEditor
auto textDocument = qobject_cast<TextEditor::TextDocument *>( auto textDocument = qobject_cast<TextEditor::TextDocument *>(
DocumentModel::documentForFilePath(Utils::FilePath::fromString(absFileName))); DocumentModel::documentForFilePath(absFilePath));
if (!textDocument) if (!textDocument)
return; return;

View File

@@ -302,9 +302,10 @@ bool GenericBuildSystem::saveRawFileList(const QStringList &rawFileList)
bool GenericBuildSystem::saveRawList(const QStringList &rawList, const QString &fileName) bool GenericBuildSystem::saveRawList(const QStringList &rawList, const QString &fileName)
{ {
FileChangeBlocker changeGuard(fileName); const FilePath filePath = FilePath::fromString(fileName);
FileChangeBlocker changeGuard(filePath);
// Make sure we can open the file for writing // Make sure we can open the file for writing
Utils::FileSaver saver(Utils::FilePath::fromString(fileName), QIODevice::Text); Utils::FileSaver saver(filePath, QIODevice::Text);
if (!saver.hasError()) { if (!saver.hasError()) {
QTextStream stream(saver.file()); QTextStream stream(saver.file());
for (const QString &filePath : rawList) for (const QString &filePath : rawList)

View File

@@ -1118,7 +1118,7 @@ void GitPluginPrivate::undoFileChanges(bool revertStaging)
} }
const VcsBasePluginState state = currentState(); const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return); QTC_ASSERT(state.hasFile(), return);
FileChangeBlocker fcb(state.currentFile()); FileChangeBlocker fcb(Utils::FilePath::fromString(state.currentFile()));
m_gitClient.revert({state.currentFile()}, revertStaging); m_gitClient.revert({state.currentFile()}, revertStaging);
} }

View File

@@ -626,7 +626,7 @@ void PerforcePluginPrivate::revertCurrentFile()
if (doNotRevert) if (doNotRevert)
return; return;
FileChangeBlocker fcb(state.currentFile()); FileChangeBlocker fcb(FilePath::fromString(state.currentFile()));
args.clear(); args.clear();
args << QLatin1String("revert") << state.relativeCurrentFile(); args << QLatin1String("revert") << state.relativeCurrentFile();
PerforceResponse result2 = runP4Cmd(state.currentFileTopLevel(), args, PerforceResponse result2 = runP4Cmd(state.currentFileTopLevel(), args,

View File

@@ -540,18 +540,17 @@ void FolderNavigationWidget::removeCurrentItem()
const QModelIndex current = m_sortProxyModel->mapToSource(m_listView->currentIndex()); const QModelIndex current = m_sortProxyModel->mapToSource(m_listView->currentIndex());
if (!current.isValid() || m_fileSystemModel->isDir(current)) if (!current.isValid() || m_fileSystemModel->isDir(current))
return; return;
const QString filePath = m_fileSystemModel->filePath(current); const Utils::FilePath filePath = Utils::FilePath::fromString(m_fileSystemModel->filePath(current));
Utils::RemoveFileDialog dialog(filePath, Core::ICore::dialogParent()); Utils::RemoveFileDialog dialog(filePath.toString(), Core::ICore::dialogParent());
dialog.setDeleteFileVisible(false); dialog.setDeleteFileVisible(false);
if (dialog.exec() == QDialog::Accepted) { if (dialog.exec() == QDialog::Accepted) {
const QVector<FolderNode *> folderNodes = removableFolderNodes( const QVector<FolderNode *> folderNodes = removableFolderNodes(filePath);
Utils::FilePath::fromString(filePath));
const QVector<FolderNode *> failedNodes = Utils::filtered(folderNodes, const QVector<FolderNode *> failedNodes = Utils::filtered(folderNodes,
[filePath](FolderNode *folder) { [filePath](FolderNode *folder) {
return folder->removeFiles({filePath}) != RemovedFilesFromProject::Ok; return folder->removeFiles({filePath.toString()}) != RemovedFilesFromProject::Ok;
}); });
Core::FileChangeBlocker changeGuard(filePath); Core::FileChangeBlocker changeGuard(filePath);
Core::FileUtils::removeFile(filePath, true /*delete from disk*/); Core::FileUtils::removeFiles({filePath}, true /*delete from disk*/);
if (!failedNodes.isEmpty()) { if (!failedNodes.isEmpty()) {
const QString projects = projectNames(failedNodes).join(", "); const QString projects = projectNames(failedNodes).join(", ");
const QString errorMessage const QString errorMessage

View File

@@ -3754,7 +3754,7 @@ void ProjectExplorerPluginPrivate::removeFile()
FilePaths pathList; FilePaths pathList;
for (const NodeAndPath &file : qAsConst(filesToRemove)) { for (const NodeAndPath &file : qAsConst(filesToRemove)) {
pathList << file.second; pathList << file.second;
changeGuards.emplace_back(std::make_unique<FileChangeBlocker>(file.second.toString())); changeGuards.emplace_back(std::make_unique<FileChangeBlocker>(file.second));
} }
Core::FileUtils::removeFiles(pathList, deleteFile); Core::FileUtils::removeFiles(pathList, deleteFile);
@@ -3826,7 +3826,7 @@ void ProjectExplorerPluginPrivate::deleteFile()
folderNode->deleteFiles(QStringList(filePath)); folderNode->deleteFiles(QStringList(filePath));
FileChangeBlocker changeGuard(filePath); FileChangeBlocker changeGuard(currentNode->filePath());
if (IVersionControl *vc = if (IVersionControl *vc =
VcsManager::findVersionControlForDirectory(QFileInfo(filePath).absolutePath())) { VcsManager::findVersionControlForDirectory(QFileInfo(filePath).absolutePath())) {
vc->vcsDelete(filePath); vc->vcsDelete(filePath);

View File

@@ -694,7 +694,7 @@ bool FlatModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int r
} }
filesToAdd << targetFile; filesToAdd << targetFile;
filesToRemove << sourceFile; filesToRemove << sourceFile;
Core::FileChangeBlocker changeGuard(sourceFile); Core::FileChangeBlocker changeGuard(FilePath::fromString(sourceFile));
if (sourceVcs.vcs && sourceVcs.vcs->supportsOperation( if (sourceVcs.vcs && sourceVcs.vcs->supportsOperation(
Core::IVersionControl::DeleteOperation) Core::IVersionControl::DeleteOperation)
&& !sourceVcs.vcs->vcsDelete(sourceFile)) { && !sourceVcs.vcs->vcsDelete(sourceFile)) {

View File

@@ -290,12 +290,13 @@ bool PythonBuildSystem::saveRawFileList(const QStringList &rawFileList)
bool PythonBuildSystem::saveRawList(const QStringList &rawList, const QString &fileName) bool PythonBuildSystem::saveRawList(const QStringList &rawList, const QString &fileName)
{ {
FileChangeBlocker changeGuarg(fileName); const FilePath filePath = FilePath::fromString(fileName);
FileChangeBlocker changeGuarg(filePath);
bool result = false; bool result = false;
// New project file // New project file
if (fileName.endsWith(".pyproject")) { if (fileName.endsWith(".pyproject")) {
FileSaver saver(FilePath::fromString(fileName), QIODevice::ReadOnly | QIODevice::Text); FileSaver saver(filePath, QIODevice::ReadOnly | QIODevice::Text);
if (!saver.hasError()) { if (!saver.hasError()) {
QString content = QTextStream(saver.file()).readAll(); QString content = QTextStream(saver.file()).readAll();
if (saver.finalize(ICore::dialogParent())) { if (saver.finalize(ICore::dialogParent())) {
@@ -306,7 +307,7 @@ bool PythonBuildSystem::saveRawList(const QStringList &rawList, const QString &f
} }
} }
} else { // Old project file } else { // Old project file
FileSaver saver(FilePath::fromString(fileName), QIODevice::WriteOnly | QIODevice::Text); FileSaver saver(filePath, QIODevice::WriteOnly | QIODevice::Text);
if (!saver.hasError()) { if (!saver.hasError()) {
QTextStream stream(saver.file()); QTextStream stream(saver.file());
for (const QString &filePath : rawList) for (const QString &filePath : rawList)

View File

@@ -930,7 +930,7 @@ void QmakePriFile::save(const QStringList &lines)
{ {
{ {
QTC_ASSERT(m_textFormat.codec, return); QTC_ASSERT(m_textFormat.codec, return);
FileChangeBlocker changeGuard(filePath().toString()); FileChangeBlocker changeGuard(filePath());
QString errorMsg; QString errorMsg;
if (!m_textFormat.writeFile(filePath(), lines.join('\n'), &errorMsg)) { if (!m_textFormat.writeFile(filePath(), lines.join('\n'), &errorMsg)) {
QMessageBox::critical(Core::ICore::dialogParent(), QCoreApplication::translate( QMessageBox::critical(Core::ICore::dialogParent(), QCoreApplication::translate(

View File

@@ -529,7 +529,7 @@ bool QmlBuildSystem::renameFile(Node * context, const QString &filePath, const Q
// make sure to change it also in the qmlproject file // make sure to change it also in the qmlproject file
const Utils::FilePath qmlProjectFilePath = project()->projectFilePath(); const Utils::FilePath qmlProjectFilePath = project()->projectFilePath();
Core::FileChangeBlocker fileChangeBlocker(qmlProjectFilePath.toString()); Core::FileChangeBlocker fileChangeBlocker(qmlProjectFilePath);
const QList<Core::IEditor *> editors = Core::DocumentModel::editorsForFilePath(qmlProjectFilePath); const QList<Core::IEditor *> editors = Core::DocumentModel::editorsForFilePath(qmlProjectFilePath);
TextEditor::TextDocument *document = nullptr; TextEditor::TextDocument *document = nullptr;
if (!editors.isEmpty()) { if (!editors.isEmpty()) {

View File

@@ -522,7 +522,7 @@ RemovedFilesFromProject ResourceFolderNode::removeFiles(const QStringList &fileP
file.removeFile(index, j); file.removeFile(index, j);
--j; --j;
} }
FileChangeBlocker changeGuard(m_topLevelNode->filePath().toString()); FileChangeBlocker changeGuard(m_topLevelNode->filePath());
file.save(); file.save();
return RemovedFilesFromProject::Ok; return RemovedFilesFromProject::Ok;
@@ -561,7 +561,7 @@ bool ResourceFolderNode::renameFile(const QString &filePath, const QString &newF
for (int j = 0; j < file.fileCount(index); ++j) { for (int j = 0; j < file.fileCount(index); ++j) {
if (file.file(index, j) == filePath) { if (file.file(index, j) == filePath) {
file.replaceFile(index, j, newFilePath); file.replaceFile(index, j, newFilePath);
FileChangeBlocker changeGuard(m_topLevelNode->filePath().toString()); FileChangeBlocker changeGuard(m_topLevelNode->filePath());
file.save(); file.save();
return true; return true;
} }

View File

@@ -723,7 +723,7 @@ void SubversionPluginPrivate::revertCurrentFile()
return; return;
FileChangeBlocker fcb(state.currentFile()); FileChangeBlocker fcb(FilePath::fromString(state.currentFile()));
// revert // revert
args.clear(); args.clear();

View File

@@ -379,7 +379,7 @@ bool RefactoringFile::apply()
QTC_ASSERT(!m_filePath.isEmpty(), return false); QTC_ASSERT(!m_filePath.isEmpty(), return false);
QString error; QString error;
// suppress "file has changed" warnings if the file is open in a read-only editor // suppress "file has changed" warnings if the file is open in a read-only editor
Core::FileChangeBlocker block(m_filePath.toString()); Core::FileChangeBlocker block(m_filePath);
if (!m_textFileFormat.writeFile(m_filePath, if (!m_textFileFormat.writeFile(m_filePath,
doc->toPlainText(), doc->toPlainText(),
&error)) { &error)) {