filemanagerutil: add multiple collections

reviewable/pr11693/r1
hius07 2 weeks ago committed by GitHub
parent 63382fe699
commit 1ab8965b70
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -235,20 +235,13 @@ function filemanagerutil.genResetSettingsButton(doc_settings_or_file, caller_cal
end
function filemanagerutil.genAddRemoveFavoritesButton(file, caller_callback, button_disabled)
local ReadCollection = require("readcollection")
local has_file = ReadCollection:hasFile(file)
return {
text_func = function()
return has_file and _("Remove from favorites") or _("Add to favorites")
end,
text = _("Book in collections"),
enabled = not button_disabled,
callback = function()
caller_callback()
if has_file then
ReadCollection:removeItem(file)
else
ReadCollection:addItem(file)
end
local ui = require("apps/filemanager/filemanager").instance or require("apps/reader/readerui").instance
ui.collections:onShowCollList(file)
end,
}
end

Loading…
Cancel
Save