From 1ab8965b703b109594aaa5c42309f1052600480f Mon Sep 17 00:00:00 2001 From: hius07 <62179190+hius07@users.noreply.github.com> Date: Thu, 18 Apr 2024 09:51:45 +0300 Subject: [PATCH] filemanagerutil: add multiple collections --- frontend/apps/filemanager/filemanagerutil.lua | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/frontend/apps/filemanager/filemanagerutil.lua b/frontend/apps/filemanager/filemanagerutil.lua index 713c381a2..9311e875a 100644 --- a/frontend/apps/filemanager/filemanagerutil.lua +++ b/frontend/apps/filemanager/filemanagerutil.lua @@ -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