## Summary This fixes navigating back from the BMP Viewer to the FileBrowser which was broken when moving to the new ActivityManager This is fixed by making FileBrowserActivity able to take a full file path on enter and splitting the basePath and fileName from it and navigating to the correct place. fixes: https://github.com/crosspoint-reader/crosspoint-reader/issues/1553 duplicates: https://github.com/crosspoint-reader/crosspoint-reader/pull/910 to some extend but mine has the file cursor at the correct file instead of the first one in the folder ## Additional Context * Add any other information that might be helpful for the reviewer (e.g., performance implications, potential risks, specific areas to focus on). --- ### AI Usage While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? _**PARTIALLY**_ --------- Co-authored-by: Jan Ivanov <jan.ivanov@sirma.com>
35 lines
1.2 KiB
C++
35 lines
1.2 KiB
C++
#pragma once
|
|
#include <memory>
|
|
|
|
#include "../Activity.h"
|
|
#include "activities/home/FileBrowserActivity.h"
|
|
|
|
class Epub;
|
|
class Xtc;
|
|
class Txt;
|
|
|
|
class ReaderActivity final : public Activity {
|
|
std::string initialBookPath;
|
|
std::string currentBookPath; // Track current book path for navigation
|
|
static std::unique_ptr<Epub> loadEpub(const std::string& path);
|
|
static std::unique_ptr<Xtc> loadXtc(const std::string& path);
|
|
static std::unique_ptr<Txt> loadTxt(const std::string& path);
|
|
static bool isXtcFile(const std::string& path);
|
|
static bool isTxtFile(const std::string& path);
|
|
static bool isBmpFile(const std::string& path);
|
|
|
|
void goToLibrary(const std::string& fromBookPath = "");
|
|
void onGoToEpubReader(std::unique_ptr<Epub> epub);
|
|
void onGoToXtcReader(std::unique_ptr<Xtc> xtc);
|
|
void onGoToTxtReader(std::unique_ptr<Txt> txt);
|
|
void onGoToBmpViewer(const std::string& path);
|
|
|
|
void onGoBack();
|
|
|
|
public:
|
|
explicit ReaderActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, std::string initialBookPath)
|
|
: Activity("Reader", renderer, mappedInput), initialBookPath(std::move(initialBookPath)) {}
|
|
void onEnter() override;
|
|
bool isReaderActivity() const override { return true; }
|
|
};
|