First attempt

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
jpirnay
2026-04-27 15:30:43 +02:00
co-authored by Copilot
parent 291898bb7f
commit aed297b2b1
11 changed files with 213 additions and 17 deletions
+13 -2
View File
@@ -12,6 +12,8 @@
#include "../util/ConfirmationActivity.h"
#include "BookInfoActivity.h"
#include "CrossPointSettings.h"
#include "CrossPointState.h"
#include "KOReaderCredentialStore.h"
#include "MappedInputManager.h"
#include "components/UITheme.h"
#include "fontIds.h"
@@ -165,14 +167,17 @@ void FileBrowserActivity::loop() {
return;
}
// Confirm short press opens selected entry; long press does nothing
if (mappedInput.wasReleased(MappedInputManager::Button::Confirm) && mappedInput.getHeldTime() < GO_HOME_MS) {
// Confirm short press opens selected entry; long press on a file opens it with KOReader sync.
// Long press on a directory is ignored (no useful directory-level sync action).
if (mappedInput.wasReleased(MappedInputManager::Button::Confirm)) {
if (files.empty()) return;
const std::string& entry = files[selectorIndex];
const bool isDirectory = (entry.back() == '/');
const bool longPress = mappedInput.getHeldTime() >= GO_HOME_MS;
if (isDirectory) {
if (longPress) return;
if (basepath.back() != '/') basepath += "/";
basepath += entry.substr(0, entry.length() - 1);
loadFiles();
@@ -182,6 +187,12 @@ void FileBrowserActivity::loop() {
std::string fullPath = basepath;
if (fullPath.back() != '/') fullPath += "/";
fullPath += entry;
if (longPress && KOREADER_STORE.hasCredentials()) {
auto& sync = APP_STATE.koReaderSyncSession;
sync.autoPullOnOpen = true;
sync.exitToHomeAfterSync = false;
APP_STATE.saveToFile();
}
ReturnHint hint;
hint.target = ReturnTo::FileBrowser;
hint.path = basepath;