filemanagercollection: add 'New collection' button in select mode

reviewable/pr11693/r5
hius07 1 month ago committed by GitHub
parent 6b313b670e
commit 565710d97f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -403,40 +403,53 @@ function FileManagerCollection:onCollListHold(item)
end
function FileManagerCollection:onLeftButtonTap(file_or_files)
if file_or_files then
if type(file_or_files) == "string" then
ReadCollection:addRemoveItemMultiple(file_or_files, self.selected_colections)
else -- selected files
ReadCollection:addItemsMultiple(file_or_files, self.selected_colections)
end
self.coll_list.close_callback(true)
else
local button_dialog
local buttons = {
local button_dialog, buttons
local new_collection_button = {
{
text = _("New collection"),
callback = function()
UIManager:close(button_dialog)
self:addCollection()
end,
},
}
if self.selected_colections then
buttons = {
new_collection_button,
{}, -- separator
{
{
text = _("Arrange collections"),
text = _("Apply selection"),
callback = function()
UIManager:close(button_dialog)
self:sortCollections()
if type(file_or_files) == "string" then
ReadCollection:addRemoveItemMultiple(file_or_files, self.selected_colections)
else -- selected files
ReadCollection:addItemsMultiple(file_or_files, self.selected_colections)
end
self.coll_list.close_callback(true)
end,
},
},
}
else
buttons = {
new_collection_button,
{
{
text = _("New collection"),
text = _("Arrange collections"),
callback = function()
UIManager:close(button_dialog)
self:addCollection()
self:sortCollections()
end,
},
},
}
button_dialog = ButtonDialog:new{
buttons = buttons,
}
UIManager:show(button_dialog)
end
button_dialog = ButtonDialog:new{
buttons = buttons,
}
UIManager:show(button_dialog)
end
function FileManagerCollection:editCollectionName(editCallback, old_name)
@ -477,9 +490,16 @@ end
function FileManagerCollection:addCollection()
local editCallback = function(name)
ReadCollection:addCollection(name)
local mandatory
if self.selected_colections then
self.selected_colections[name] = true
mandatory = self.checkmark
else
mandatory = 0
end
table.insert(self.coll_list.item_table, {
text = name,
mandatory = 0,
mandatory = mandatory,
name = name,
order = ReadCollection.coll_order[name],
})

Loading…
Cancel
Save