Skip to content

FileSearcher: consistent results window#13298

Merged
hius07 merged 13 commits into
koreader:masterfrom
hius07:filesearcher
Feb 27, 2025
Merged

FileSearcher: consistent results window#13298
hius07 merged 13 commits into
koreader:masterfrom
hius07:filesearcher

Conversation

@hius07

@hius07 hius07 commented Feb 22, 2025

Copy link
Copy Markdown
Member

Use CoverBrowser (following file manager display mode), standard file dialog on long-pressing.

1


This change is Reviewable

@hius07

hius07 commented Feb 22, 2025

Copy link
Copy Markdown
Member Author

Tuning the file dialog, I encountered that .sh and .py files were treated as books (so showing status, book cover etc. buttons).

-- Scripts that we allow running in the FM (c.f., Device:canExecuteScript)
registry:addProvider("sh", "application/x-shellscript", self, 90)
registry:addProvider("py", "text/x-python", self, 90)

I suppose it was done by @NiLuJe to enable adding scripts to Favorites.
Currently any file can be added to a collection from within the collection.
I think the providers can be removed.

I do not see anything that requires a provider in the script execution code:

function filemanagerutil.genExecuteScriptButton(file, caller_callback)

@poire-z poire-z left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too many stuff mostly moved around to review each bit, so trusting you.

function FileManagerCollection:onShowColl(collection_name)
collection_name = collection_name or ReadCollection.default_collection_name
self.coll_menu = BookList:new{
self.booklist_menu = BookList:new{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this change of name everywhere is because you access this.booklist_menu in CoverBrowser.getUpdateItemTableFunc() and you need that same name everywhere.
I think it should be mentionned as a comment here (and elsewhere).
-- This may be hijacked by CoverBrowser pluging and needs to be known as booklist_menu.
(or something like that if I'm not fully correct with that comment).

Comment on lines +275 to +284
if Device:canExecuteScript(file) then
table.insert(buttons, {
filemanagerutil.genExecuteScriptButton(file, close_dialog_callback),
})
end
if FileManagerConverter:isSupported(file) then
table.insert(buttons, {
FileManagerConverter:genConvertButton(file, close_dialog_callback, refresh_callback)
})
end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This being moved around will just insert full rows above instead of below - no change in the layout of the other buttons?

@hius07 hius07 Feb 22, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please look at the screenshot.
Currently 'Convert' and 'Execute script' full-width buttons are added between 'Book cover' and 'Ignore cover' rows (even if we remove providers for py and sh, the provider for md should remain, i.e. these rows are shown).
I move Convert and Execute buttons upper, without changing the layout of other buttons.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep related 'cover' buttons together.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, that's fine.

Please look at the screenshot.

(I didn't see any of these rarely-seen buttons on your screenshot, so that's why I asked.)

@hius07

hius07 commented Feb 22, 2025

Copy link
Copy Markdown
Member Author

File dialog:

FM
2
History
3
Collections
4
FileSearcher
5

@jonnyl2

jonnyl2 commented Feb 23, 2025

Copy link
Copy Markdown
Contributor

I haven't tested this but it looks promising.

Just a question: is it still the case that this dialog is normally opened via long-press on a file, except in FileSearcher where it is flipped: long-press opens the file but short tap opens the dialog?. I think that is very confusing to a user, and makes it easy to accidentally open a search result when one just wants to see more details or choose another option. Long press for more options/details is the expected behavior.

@hius07

hius07 commented Feb 23, 2025

Copy link
Copy Markdown
Member Author

The same feeling, so this PR provides the standard behaviour in FileSearcher: tap to open, long-press to call the file dialog.

@hius07 hius07 merged commit f1726a9 into koreader:master Feb 27, 2025
@hius07 hius07 deleted the filesearcher branch February 27, 2025 16:45
@hius07 hius07 added this to the 2025.02 milestone Feb 27, 2025
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants