Skip to content

[SortWidget] add cancelOrClose method#13189

Merged
Frenzie merged 2 commits into
koreader:masterfrom
Commodore64user:sort-close
Feb 2, 2025
Merged

[SortWidget] add cancelOrClose method#13189
Frenzie merged 2 commits into
koreader:masterfrom
Commodore64user:sort-close

Conversation

@Commodore64user

@Commodore64user Commodore64user commented Feb 1, 2025

Copy link
Copy Markdown
Member

what's new

  • Added a new function onCancelOrClose to handle the CancelOrClose key event, which checks if any items are marked and calls onCancel if so, or onClose otherwise.

This change is Reviewable

Comment thread frontend/ui/widget/sortwidget.lua Outdated
function SortWidget:registerKeyEvents()
if Device:hasKeys() then
self.key_events.Close = { { Device.input.group.Back } }
self.key_events.CloseNT = { { Device.input.group.Back } }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we have some kind of onback event anywhere? (Just thinking about the name.)

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.

reader back has one, yes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Given what it does maybe Back is more appropriate. @poire-z what do you think?

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.

onCancelOrClose()?

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.

No strong opinion.
self.key_events.Back= { { Device.input.group.Back } } reads well :)
self.key_events.CancelOrClose = { { Device.input.group.Back } } says what it does.

Comment thread frontend/ui/widget/sortwidget.lua Outdated
Comment thread frontend/ui/widget/sortwidget.lua Outdated
Comment thread frontend/ui/widget/sortwidget.lua
Comment thread frontend/ui/widget/sortwidget.lua
@Commodore64user Commodore64user changed the title [SortWidget] add closeNT method [SortWidget] add cancelOrClose method Feb 2, 2025
@Frenzie Frenzie added this to the 2025.02 milestone Feb 2, 2025
@Frenzie Frenzie merged commit f516d21 into koreader:master Feb 2, 2025
@Commodore64user Commodore64user deleted the sort-close branch February 2, 2025 12:36
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.

4 participants