From fd71e8780089a2fe7ed1df5f0123db0115c76b83 Mon Sep 17 00:00:00 2001 From: jpirnay Date: Sun, 8 Mar 2026 17:58:20 +0100 Subject: [PATCH] Add info option to recents, too --- src/activities/home/RecentBooksActivity.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/activities/home/RecentBooksActivity.cpp b/src/activities/home/RecentBooksActivity.cpp index 2b77fc7b..55f41ad0 100644 --- a/src/activities/home/RecentBooksActivity.cpp +++ b/src/activities/home/RecentBooksActivity.cpp @@ -1,11 +1,13 @@ #include "RecentBooksActivity.h" +#include #include #include #include #include +#include "BookInfoActivity.h" #include "MappedInputManager.h" #include "RecentBooksStore.h" #include "components/UITheme.h" @@ -59,6 +61,17 @@ void RecentBooksActivity::loop() { onGoHome(); } + if (mappedInput.wasReleased(MappedInputManager::Button::Right)) { + if (!recentBooks.empty() && selectorIndex < static_cast(recentBooks.size())) { + const std::string& path = recentBooks[selectorIndex].path; + if (FsHelpers::hasEpubExtension(path) || FsHelpers::hasXtcExtension(path)) { + startActivityForResult(std::make_unique(renderer, mappedInput, path), + [this](const ActivityResult&) { requestUpdate(); }); + return; + } + } + } + int listSize = static_cast(recentBooks.size()); buttonNavigator.onNextRelease([this, listSize] { @@ -111,8 +124,14 @@ void RecentBooksActivity::render(RenderLock&&) { } // Help text - const auto labels = mappedInput.mapLabels(tr(STR_HOME), tr(STR_OPEN), tr(STR_DIR_UP), tr(STR_DIR_DOWN)); + const bool hasInfo = !recentBooks.empty() && selectorIndex < recentBooks.size() && + (FsHelpers::hasEpubExtension(recentBooks[selectorIndex].path) || + FsHelpers::hasXtcExtension(recentBooks[selectorIndex].path)); + const auto labels = mappedInput.mapLabels(tr(STR_HOME), tr(STR_OPEN), "", hasInfo ? tr(STR_INFO) : ""); + GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4); + // Side buttons (Up/Down) navigate; show their hints on the side + GUI.drawSideButtonHints(renderer, tr(STR_DIR_UP), tr(STR_DIR_DOWN)); renderer.displayBuffer(); }