Brings ~55 mod-exclusive files to the upstream-based mod/master-resync branch: Activities (migrated to new ActivityManager pattern): - Clock/Time: SetTimeActivity, SetTimezoneOffsetActivity, NtpSyncActivity - Dictionary: DictionaryDefinitionActivity, DictionarySuggestionsActivity, DictionaryWordSelectActivity, LookedUpWordsActivity - Bookmark: EpubReaderBookmarkSelectionActivity - Book management: BookManageMenuActivity, EndOfBookMenuActivity - OPDS: OpdsServerListActivity, OpdsSettingsActivity - Utility: DirectoryPickerActivity, NumericStepperActivity Utilities (unchanged): - BookManager, BookSettings, BookmarkStore, BootNtpSync - Dictionary, LookupHistory, TimeSync, OpdsServerStore Libraries: PlaceholderCover, TableData, ChapterXPathIndexer Scripts: inject_mod_version, generate_book_icon, preview_placeholder_cover Docs: KOReader sync XPath mapping Migration changes: - ActivityWithSubactivity -> Activity base class - Callback constructors -> finish()/setResult() pattern - enterNewActivity() -> startActivityForResult() - Activity::RenderLock&& -> RenderLock&& These files won't compile yet - they reference mod settings and I18n strings that will be added in subsequent phases. Made-with: Cursor
2.2 KiB
2.2 KiB
OPDS Server Reordering
Task
Add the ability to reorder OPDS servers via a sortOrder field, editable on-device and with up/down buttons in the web UI.
Changes Made
Data Model (src/OpdsServerStore.h)
- Added
int sortOrder = 0field toOpdsServerstruct
Store Logic (src/OpdsServerStore.cpp)
saveToFile(): persistssort_orderto JSONloadFromFile(): readssort_order, assigns sequential defaults to servers missing it, sorts after loadmigrateFromSettings(): assignssortOrder = 1to migrated serveraddServer(): auto-assignssortOrder = max(existing) + 1when left at 0updateServer(): re-sorts after update- Added
sortServers()private helper: sorts by sortOrder ascending, ties broken case-insensitively by name (falling back to URL) - Added
moveServer(index, direction): swaps sortOrder with adjacent server, re-sorts, saves
On-Device UI (src/activities/settings/OpdsSettingsActivity.cpp)
- Added "Position" as first menu item (index 0), shifting all others by 1
- Uses
NumericStepperActivity(new) for position editing: numeric stepper with Up/Down and PageForward/PageBack to increment/decrement saveServer()now re-locates the server by name+url after sort to keepserverIndexvalid
NumericStepperActivity (new: src/activities/util/NumericStepperActivity.{h,cpp})
- Reusable numeric stepper modeled after
SetTimezoneOffsetActivity - Displays value with highlight rect and up/down arrow indicators
- Up/PageForward increment, Down/PageBack decrement (clamped to min/max)
- Confirm saves, Back cancels
- Side button hints show +/-
Web API (src/network/CrossPointWebServer.{h,cpp})
GET /api/opds: now includessortOrderin responsePOST /api/opds: preservesdownloadPathandsortOrderon update- New
POST /api/opds/reorder: accepts{index, direction: "up"|"down"}, callsmoveServer()
Web UI (src/network/html/SettingsPage.html)
- Added up/down arrow buttons to each OPDS server card (hidden at boundaries)
- Added
reorderOpdsServer()JS function calling the new API endpoint
i18n
- Added
STR_POSITIONto all 9 translation YAML files - Regenerated
I18nKeys.h,I18nStrings.h,I18nStrings.cpp
Follow-up Items
- None identified; build passes cleanly.