Dispatcher: add `addCurrentLocationToStack`

This is useful when i want to reference something a few pages away while keeping track of my current page
reviewable/pr10393/r1
yparitcher 1 year ago committed by Frans de Jonge
parent 2aeb4a87df
commit de5c872dcb

@ -702,6 +702,13 @@ function ReaderLink:compareLocationToCurrent(saved_location)
return false, current_location
end
function ReaderLink:onAddCurrentLocationToStack(show_notification)
self:addCurrentLocationToStack()
if show_notification then
Notification:notify(_("Current location added to history."))
end
end
-- Remember current location so we can go back to it
function ReaderLink:addCurrentLocationToStack(loc)
local location = loc and loc or self:getCurrentLocation()

@ -127,6 +127,7 @@ local settingsList = {
latest_bookmark = {category="none", event="GoToLatestBookmark", title=_("Go to latest bookmark"), reader=true},
follow_nearest_link = {category="arg", event="GoToPageLink", arg={pos={x=0,y=0}}, title=_("Follow nearest link"), reader=true},
follow_nearest_internal_link = {category="arg", event="GoToInternalPageLink", arg={pos={x=0,y=0}}, title=_("Follow nearest internal link"), reader=true},
add_location_to_history = {category="none", event="AddCurrentLocationToStack", arg=true, title=_("Add current location to history"), reader=true},
clear_location_history = {category="none", event="ClearLocationStack", arg=true, title=_("Clear location history"), reader=true, separator=true},
toc = {category="none", event="ShowToc", title=_("Table of contents"), reader=true},
book_map = {category="none", event="ShowBookMap", title=_("Book map"), reader=true, condition=Device:isTouchDevice()},
@ -312,6 +313,7 @@ local dispatcher_menu_order = {
"next_location",
"follow_nearest_link",
"follow_nearest_internal_link",
"add_location_to_history",
"clear_location_history",
"toc",

Loading…
Cancel
Save