ReaderStatistics: reset stack/link on showing first widget

Reset self.kv stack/link on showing first widget.
This avoids return arrow to possibly show previously
displayed old and unrelated KeyValuePage.
Note: when closing a leaf KeyValuePage, the previous
one will leak as self.kv.
pull/8758/head
poire-z 2 years ago
parent 67b17d0845
commit 83172d62ae

@ -1056,10 +1056,11 @@ The max value ensures a page you stay on for a long time (because you fell aslee
text = _("Current book"), text = _("Current book"),
keep_menu_open = true, keep_menu_open = true,
callback = function() callback = function()
UIManager:show(KeyValuePage:new{ self.kv = KeyValuePage:new{
title = _("Current statistics"), title = _("Current statistics"),
kv_pairs = self:getCurrentStat() kv_pairs = self:getCurrentStat()
}) }
UIManager:show(self.kv)
end, end,
enabled_func = function() return not self:isDocless() and self.settings.is_enabled end, enabled_func = function() return not self:isDocless() and self.settings.is_enabled end,
}, },
@ -2448,6 +2449,7 @@ end
function ReaderStatistics:onShowCalendarView() function ReaderStatistics:onShowCalendarView()
self:insertDB() self:insertDB()
self.kv = nil -- clean left over stack link
local CalendarView = require("calendarview") local CalendarView = require("calendarview")
UIManager:show(CalendarView:new{ UIManager:show(CalendarView:new{
reader_statistics = self, reader_statistics = self,
@ -2569,11 +2571,11 @@ end
function ReaderStatistics:onShowBookStats() function ReaderStatistics:onShowBookStats()
if self:isDocless() or not self.settings.is_enabled then return end if self:isDocless() or not self.settings.is_enabled then return end
local stats = KeyValuePage:new{ self.kv = KeyValuePage:new{
title = _("Current statistics"), title = _("Current statistics"),
kv_pairs = self:getCurrentStat() kv_pairs = self:getCurrentStat()
} }
UIManager:show(stats) UIManager:show(self.kv)
end end
function ReaderStatistics:getCurrentBookReadPages() function ReaderStatistics:getCurrentBookReadPages()

Loading…
Cancel
Save