filemanagerutil: add multiple collections

reviewable/pr11693/r1
hius07 4 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 end
function filemanagerutil.genAddRemoveFavoritesButton(file, caller_callback, button_disabled) function filemanagerutil.genAddRemoveFavoritesButton(file, caller_callback, button_disabled)
local ReadCollection = require("readcollection")
local has_file = ReadCollection:hasFile(file)
return { return {
text_func = function() text = _("Book in collections"),
return has_file and _("Remove from favorites") or _("Add to favorites")
end,
enabled = not button_disabled, enabled = not button_disabled,
callback = function() callback = function()
caller_callback() caller_callback()
if has_file then local ui = require("apps/filemanager/filemanager").instance or require("apps/reader/readerui").instance
ReadCollection:removeItem(file) ui.collections:onShowCollList(file)
else
ReadCollection:addItem(file)
end
end, end,
} }
end end

Loading…
Cancel
Save