Bookmarks: refresh list entry when closing Bookmark details dialog with X (#12390)

Also: refresh dogear state for current page when closing Page browser
or Book map, as we may have toggled bookmark on it.
This commit is contained in:
Frédéric Brière
2024-08-21 17:46:51 -04:00
committed by GitHub
parent 9c001a660a
commit 39fa008e21
3 changed files with 24 additions and 13 deletions

View File

@@ -1090,11 +1090,28 @@ function ReaderBookmark:showBookmarkDetails(item)
self:updateBookmarkList(nil, idx)
self:showBookmarkDetails(item_table[idx])
end
-- Refresh the bookmark list whenever details may have been edited
local _updateBookmarkList = function()
if self.details_updated then
self.details_updated = nil
if self.show_edited_only then
for i = #item_table, 1, -1 do
if not item_table[i].text_edited then
table.remove(item_table, i)
end
end
end
self:updateBookmarkList(item_table, -1)
end
end
textviewer = TextViewer:new{
title = T(_("Bookmark details (%1/%2)"), item.idx, #item_table),
text = text,
text_type = "bookmark",
close_callback = function()
_updateBookmarkList()
end,
buttons_table = {
{
{
@@ -1141,17 +1158,7 @@ function ReaderBookmark:showBookmarkDetails(item)
{
text = _("Close"),
callback = function()
if self.details_updated then
self.details_updated = nil
if self.show_edited_only then
for i = #item_table, 1, -1 do
if not item_table[i].text_edited then
table.remove(item_table, i)
end
end
end
self:updateBookmarkList(item_table, -1)
end
_updateBookmarkList()
UIManager:close(textviewer)
end,
},

View File

@@ -1437,9 +1437,11 @@ function BookMapWidget:onClose(close_all_parents)
collectgarbage()
collectgarbage()
end)
-- As we're getting back to Reader, update the footer and do a full flashing
-- As we're getting back to Reader, update the footer and the dogear state
-- (we may have toggled bookmark for current page) and do a full flashing
-- refresh to remove any ghost trace of thumbnails or black page slots
UIManager:broadcastEvent(Event:new("UpdateFooter"))
self.ui.bookmark:onPageUpdate(self.ui:getCurrentPage())
UIManager:setDirty(self.ui.dialog, "full")
end
return true

View File

@@ -1084,9 +1084,11 @@ function PageBrowserWidget:onClose(close_all_parents)
collectgarbage()
collectgarbage()
end)
-- As we're getting back to Reader, update the footer and do a full flashing
-- As we're getting back to Reader, update the footer and the dogear state
-- (we may have toggled bookmark for current page) and do a full flashing
-- refresh to remove any ghost trace of thumbnails or black page slots
UIManager:broadcastEvent(Event:new("UpdateFooter"))
self.ui.bookmark:onPageUpdate(self.ui:getCurrentPage())
UIManager:setDirty(self.ui.dialog, "full")
end
return true