add OPDS search support & next/prev page navigation (upstream #1462)

This commit is contained in:
jpirnay
2026-04-12 22:49:33 +02:00
parent 52a754b5e4
commit cf3ab19c77
20 changed files with 186 additions and 211 deletions
@@ -11,21 +11,13 @@
/**
* Activity for browsing and downloading books from an OPDS server.
* Supports navigation through catalog hierarchy and downloading EPUBs.
* When WiFi connection fails, launches WiFi selection to let user connect.
*/
class OpdsBookBrowserActivity final : public Activity {
public:
enum class BrowserState {
CHECK_WIFI, // Checking WiFi connection
WIFI_SELECTION, // WiFi selection subactivity is active
LOADING, // Fetching OPDS feed
BROWSING, // Displaying entries (navigation or books)
DOWNLOADING, // Downloading selected EPUB
ERROR // Error state with message
};
enum class BrowserState { CHECK_WIFI, WIFI_SELECTION, LOADING, BROWSING, DOWNLOADING, ERROR, SEARCH_INPUT };
explicit OpdsBookBrowserActivity(GfxRenderer& renderer, MappedInputManager& mappedInput)
: Activity("OpdsBookBrowser", renderer, mappedInput) {}
: Activity("OpdsBookBrowser", renderer, mappedInput), buttonNavigator() {}
void onEnter() override;
void onExit() override;
@@ -36,8 +28,11 @@ class OpdsBookBrowserActivity final : public Activity {
ButtonNavigator buttonNavigator;
BrowserState state = BrowserState::LOADING;
std::vector<OpdsEntry> entries;
std::vector<std::string> navigationHistory; // Stack of previous feed paths for back navigation
std::string currentPath; // Current feed path being displayed
std::vector<std::string> navigationHistory;
std::string currentPath;
std::string searchTemplate;
bool consumeConfirm = false;
bool consumeBack = false; // Added missing member
int selectorIndex = 0;
std::string errorMessage;
std::string statusMessage;
@@ -51,5 +46,7 @@ class OpdsBookBrowserActivity final : public Activity {
void navigateToEntry(const OpdsEntry& entry);
void navigateBack();
void downloadBook(const OpdsEntry& book);
void launchSearch();
void performSearch(const std::string& query);
bool preventAutoSleep() override { return true; }
};