Bookmarks: Use more FilePath

Change-Id: I8d4337f9dccaf26b37583eb87f364c9d995f94fd
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2023-02-07 18:11:35 +01:00
parent a86299d573
commit a7bf65c288
4 changed files with 9 additions and 9 deletions

View File

@@ -66,11 +66,11 @@ void Bookmark::updateBlock(const QTextBlock &block)
} }
} }
void Bookmark::updateFileName(const FilePath &fileName) void Bookmark::updateFileName(const FilePath &filePath)
{ {
const FilePath &oldFileName = this->fileName(); const FilePath oldFilePath = this->fileName();
TextMark::updateFileName(fileName); TextMark::updateFileName(filePath);
m_manager->updateBookmarkFileName(this, oldFileName.toString()); m_manager->updateBookmarkFileName(this, oldFilePath);
} }
void Bookmark::setNote(const QString &note) void Bookmark::setNote(const QString &note)

View File

@@ -17,7 +17,7 @@ public:
void updateLineNumber(int lineNumber) override; void updateLineNumber(int lineNumber) override;
void move(int line) override; void move(int line) override;
void updateBlock(const QTextBlock &block) override; void updateBlock(const QTextBlock &block) override;
void updateFileName(const Utils::FilePath &fileName) override; void updateFileName(const Utils::FilePath &filePath) override;
void removedFromEditor() override; void removedFromEditor() override;
bool isDraggable() const override; bool isDraggable() const override;

View File

@@ -417,12 +417,12 @@ void BookmarkManager::updateBookmark(Bookmark *bookmark)
saveBookmarks(); saveBookmarks();
} }
void BookmarkManager::updateBookmarkFileName(Bookmark *bookmark, const QString &oldFileName) void BookmarkManager::updateBookmarkFileName(Bookmark *bookmark, const FilePath &oldFilePath)
{ {
if (oldFileName == bookmark->fileName().toString()) if (oldFilePath == bookmark->fileName())
return; return;
m_bookmarksMap[Utils::FilePath::fromString(oldFileName)].removeAll(bookmark); m_bookmarksMap[oldFilePath].removeAll(bookmark);
m_bookmarksMap[bookmark->fileName()].append(bookmark); m_bookmarksMap[bookmark->fileName()].append(bookmark);
updateBookmark(bookmark); updateBookmark(bookmark);
} }

View File

@@ -31,7 +31,7 @@ public:
~BookmarkManager() final; ~BookmarkManager() final;
void updateBookmark(Bookmark *bookmark); void updateBookmark(Bookmark *bookmark);
void updateBookmarkFileName(Bookmark *bookmark, const QString &oldFileName); void updateBookmarkFileName(Bookmark *bookmark, const Utils::FilePath &oldFilePath);
void deleteBookmark(Bookmark *bookmark); // Does not remove the mark void deleteBookmark(Bookmark *bookmark); // Does not remove the mark
void removeAllBookmarks(); void removeAllBookmarks();
Bookmark *bookmarkForIndex(const QModelIndex &index) const; Bookmark *bookmarkForIndex(const QModelIndex &index) const;