Skip to content

Commit

Permalink
[UX] Gesture manager: add action - fulltext search (#4715)
Browse files Browse the repository at this point in the history
Fixes #4687.
  • Loading branch information
Frenzie committed Mar 2, 2019
1 parent c9de46d commit e96ac7e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
4 changes: 4 additions & 0 deletions frontend/apps/reader/modules/readergesture.lua
Expand Up @@ -42,6 +42,7 @@ local action_strings = {

dictionary_lookup = _("Dictionary lookup"),
wikipedia_lookup = _("Wikipedia lookup"),
fulltext_search = _("Fulltext search"),

full_refresh = _("Full screen refresh"),
night_mode = _("Night mode"),
Expand Down Expand Up @@ -282,6 +283,7 @@ function ReaderGesture:buildMenu(ges, default)

{"dictionary_lookup", true},
{"wikipedia_lookup", true, true},
{"fulltext_search", not self.is_docless, true},

{"full_refresh", true},
{"night_mode", true},
Expand Down Expand Up @@ -567,6 +569,8 @@ function ReaderGesture:gestureAction(action, ges)
self.ui:handleEvent(Event:new("ShowDictionaryLookup"))
elseif action == "wikipedia_lookup" then
self.ui:handleEvent(Event:new("ShowWikipediaLookup"))
elseif action == "fulltext_search" then
self.ui:handleEvent(Event:new("ShowFulltextSearchInput"))
elseif action == "show_menu" then
if self.ges_mode == "gesture_fm" then
self.ui:handleEvent(Event:new("ShowMenu"))
Expand Down
22 changes: 14 additions & 8 deletions frontend/apps/reader/modules/readersearch.lua
Expand Up @@ -21,14 +21,20 @@ end
function ReaderSearch:addToMainMenu(menu_items)
menu_items.fulltext_search = {
text = _("Fulltext search"),
tap_input = {
title = _("Input text to search for"),
ok_text = _("Search all text"),
type = "text",
callback = function(input)
self:onShowSearchDialog(input)
end,
},
callback = function()
self:onShowFulltextSearchInput()
end,
}
end

function ReaderSearch:onShowFulltextSearchInput()
self:onInput{
title = _("Enter text to search for"),
ok_text = _("Search all text"),
type = "text",
callback = function(input)
self:onShowSearchDialog(input)
end,
}
end

Expand Down

0 comments on commit e96ac7e

Please sign in to comment.