mirror of
https://github.com/koreader/koreader
synced 2024-11-06 09:20:32 +00:00
Coverbrowser: event for cache refreshing (#10956)
This commit is contained in:
parent
08555ad68b
commit
0ac258fcb7
@ -164,12 +164,7 @@ function BookInfo:show(file, book_props)
|
||||
self.custom_doc_settings = nil
|
||||
self.custom_book_cover = nil
|
||||
if self.prop_updated then
|
||||
local ui = self.ui -- Reader
|
||||
or require("apps/filemanager/filemanager").instance -- FM, Hist/Coll over FM
|
||||
or require("apps/reader/readerui").instance -- Hist/Coll over Reader
|
||||
if ui.coverbrowser then -- refresh cache db
|
||||
ui.coverbrowser:deleteBookInfo(file)
|
||||
end
|
||||
UIManager:broadcastEvent(Event:new("InvalidateMetadataCache", file))
|
||||
UIManager:broadcastEvent(Event:new("BookMetadataChanged", self.prop_updated))
|
||||
end
|
||||
end,
|
||||
|
@ -5,6 +5,7 @@ This module contains miscellaneous helper functions for FileManager
|
||||
local BD = require("ui/bidi")
|
||||
local Device = require("device")
|
||||
local DocSettings = require("docsettings")
|
||||
local Event = require("ui/event")
|
||||
local UIManager = require("ui/uimanager")
|
||||
local ffiutil = require("ffi/util")
|
||||
local util = require("util")
|
||||
@ -161,16 +162,12 @@ function filemanagerutil.genResetSettingsButton(file, caller_callback, button_di
|
||||
ok_callback = function()
|
||||
local data_to_purge = {
|
||||
doc_settings = check_button_settings.checked,
|
||||
custom_cover_file = check_button_cover.checked and custom_cover_file,
|
||||
custom_metadata_file = check_button_metadata.checked and custom_metadata_file,
|
||||
custom_cover_file = check_button_cover.checked,
|
||||
custom_metadata_file = check_button_metadata.checked,
|
||||
}
|
||||
DocSettings:open(file):purge(nil, data_to_purge)
|
||||
if data_to_purge.custom_cover_file or data_to_purge.custom_metadata_file then
|
||||
local ui = require("apps/filemanager/filemanager").instance
|
||||
or require("apps/reader/readerui").instance
|
||||
if ui and ui.coverbrowser then
|
||||
ui.coverbrowser:deleteBookInfo(file) -- refresh coverbrowser cached book info
|
||||
end
|
||||
UIManager:broadcastEvent(Event:new("InvalidateMetadataCache", file))
|
||||
end
|
||||
if data_to_purge.doc_settings then
|
||||
require("readhistory"):fileSettingsPurged(file)
|
||||
|
@ -106,7 +106,6 @@ function CoverBrowser:addToMainMenu(menu_items)
|
||||
self:setupCollectionDisplayMode(mode)
|
||||
end
|
||||
end,
|
||||
separator = i == #modes,
|
||||
})
|
||||
table.insert(history_sub_item_table, {
|
||||
text = text,
|
||||
@ -127,6 +126,7 @@ function CoverBrowser:addToMainMenu(menu_items)
|
||||
end,
|
||||
})
|
||||
end
|
||||
sub_item_table[#modes].separator = true
|
||||
table.insert(sub_item_table, {
|
||||
text = _("Use this mode everywhere"),
|
||||
checked_func = function()
|
||||
@ -671,8 +671,9 @@ function CoverBrowser:getBookInfo(file)
|
||||
return BookInfoManager:getBookInfo(file)
|
||||
end
|
||||
|
||||
function CoverBrowser:deleteBookInfo(file)
|
||||
function CoverBrowser:onInvalidateMetadataCache(file)
|
||||
BookInfoManager:deleteBookInfo(file)
|
||||
return true
|
||||
end
|
||||
|
||||
function CoverBrowser:extractBooksInDirectory(path)
|
||||
|
Loading…
Reference in New Issue
Block a user