Core: filepathify file renaming

Change-Id: I3d4f39e34e65cde3df7b7c19570e3a54d0625d53
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
David Schulz
2021-06-11 14:34:34 +02:00
parent 55b91a7617
commit f66df921d7
32 changed files with 203 additions and 176 deletions

View File

@@ -531,9 +531,9 @@ public:
void editorAboutToClose(Core::IEditor *);
void currentEditorAboutToChange(Core::IEditor *);
void allDocumentsRenamed(const QString &oldName, const QString &newName);
void documentRenamed(Core::IDocument *document, const QString &oldName, const QString &newName);
void renameFileNameInEditors(const QString &oldName, const QString &newName);
void allDocumentsRenamed(const FilePath &oldPath, const FilePath &newPath);
void documentRenamed(Core::IDocument *document, const FilePath &oldPath, const FilePath &newPath);
void renameFileNameInEditors(const FilePath &oldPath, const FilePath &newPath);
void setUseFakeVim(bool on);
void setUseFakeVimInternal(bool on);
@@ -1881,23 +1881,23 @@ void FakeVimPluginPrivate::currentEditorAboutToChange(IEditor *editor)
handler->enterCommandMode();
}
void FakeVimPluginPrivate::allDocumentsRenamed(const QString &oldName, const QString &newName)
void FakeVimPluginPrivate::allDocumentsRenamed(const FilePath &oldPath, const FilePath &newPath)
{
renameFileNameInEditors(oldName, newName);
FakeVimHandler::updateGlobalMarksFilenames(oldName, newName);
renameFileNameInEditors(oldPath, newPath);
FakeVimHandler::updateGlobalMarksFilenames(oldPath.toString(), newPath.toString());
}
void FakeVimPluginPrivate::documentRenamed(
IDocument *, const QString &oldName, const QString &newName)
IDocument *, const FilePath &oldPath, const FilePath &newPath)
{
renameFileNameInEditors(oldName, newName);
renameFileNameInEditors(oldPath, newPath);
}
void FakeVimPluginPrivate::renameFileNameInEditors(const QString &oldName, const QString &newName)
void FakeVimPluginPrivate::renameFileNameInEditors(const FilePath &oldPath, const FilePath &newPath)
{
foreach (FakeVimHandler *handler, m_editorToHandler.values()) {
if (handler->currentFileName() == oldName)
handler->setCurrentFileName(newName);
if (handler->currentFileName() == oldPath.toString())
handler->setCurrentFileName(newPath.toString());
}
}