Remove missing books from recent list

This commit is contained in:
jpirnay
2026-05-15 19:22:58 +02:00
parent 684a96f108
commit 3ed5bc3673
4 changed files with 23 additions and 11 deletions
+1 -2
View File
@@ -168,8 +168,7 @@ void HomeActivity::loadRecentBooks(int maxBooks) {
break;
}
// Skip if file no longer exists
if (!Storage.exists(book.path.c_str())) {
if (RecentBooksStore::isMissing(book)) {
continue;
}
+5 -9
View File
@@ -68,15 +68,7 @@ std::string gridThumbPath(const std::string& coverBmpPath, int tw, int th) {
}
} // namespace
void RecentBooksActivity::loadRecentBooks() {
recentBooks.clear();
const auto& books = RECENT_BOOKS.getBooks();
recentBooks.reserve(books.size());
for (const auto& book : books) {
if (!Storage.exists(book.path.c_str())) continue;
recentBooks.push_back(book);
}
}
void RecentBooksActivity::loadRecentBooks() { recentBooks = RECENT_BOOKS.getBooks(); }
bool RecentBooksActivity::loadNextCover() {
const Rect contentRect = UITheme::getContentRect(renderer, true, true);
@@ -134,6 +126,10 @@ bool RecentBooksActivity::loadNextCover() {
void RecentBooksActivity::onEnter() {
Activity::onEnter();
if (RECENT_BOOKS.pruneMissing()) {
RECENT_BOOKS.saveToFile();
}
loadRecentBooks();
selectorIndex = 0;