mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Merge pull request #781 from WS64/master
Add search options and remove one bug with searching
This commit is contained in:
@@ -124,11 +124,12 @@ function FileManagerMenu:setUpdateItemTable()
|
||||
end
|
||||
})
|
||||
table.insert(self.tab_item_table.info, {
|
||||
text = _("Search Books (experimental)"),
|
||||
text = _("Search books"),
|
||||
callback = function()
|
||||
Search:init()
|
||||
end
|
||||
})
|
||||
table.insert(self.tab_item_table.info, Screen:SearchOptions())
|
||||
end
|
||||
|
||||
function FileManagerMenu:onShowMenu()
|
||||
|
||||
@@ -151,7 +151,7 @@ function Search:find()
|
||||
s=string.sub(s,n,string.len(s)-3)
|
||||
end
|
||||
|
||||
s=string.gsub(s,"\\u([a-f0-9][a-f0-9][a-f0-9][a-f0-9])",function(w) return unichar(tonumber(w, 16)) end) -- '
|
||||
s=string.gsub(s,"\\u([a-f0-9][a-f0-9][a-f0-9][a-f0-9])",function(w) return unichar(tonumber(w, 16)) end)
|
||||
|
||||
return s
|
||||
end
|
||||
@@ -188,7 +188,7 @@ function Search:find()
|
||||
if SEARCH_TAGS then dummy = dummy .. self.data[i][self.tags] end
|
||||
if not SEARCH_CASESENSITIVE then dummy = string.upper(dummy) end
|
||||
|
||||
if string.find(dummy,upsearch) then
|
||||
if string.find(dummy,upsearch,nil,true) then
|
||||
i = i + 1
|
||||
self.data[i] = {"","","","",""}
|
||||
end
|
||||
|
||||
@@ -307,5 +307,53 @@ function Screen:getDPIMenuTable()
|
||||
}
|
||||
end
|
||||
|
||||
function Screen:SearchOptions()
|
||||
return {
|
||||
text = _("Search options"),
|
||||
sub_item_table = {
|
||||
{
|
||||
text = _("Case sensitive"),
|
||||
checked_func = function()
|
||||
local search_option = SEARCH_CASESENSITIVE
|
||||
return search_option
|
||||
end,
|
||||
callback = function() SEARCH_CASESENSITIVE = not SEARCH_CASESENSITIVE end
|
||||
},
|
||||
{
|
||||
text = _("Search title"),
|
||||
checked_func = function()
|
||||
local search_option = SEARCH_TITLE
|
||||
return search_option
|
||||
end,
|
||||
callback = function() SEARCH_TITLE = not SEARCH_TITLE end
|
||||
},
|
||||
{
|
||||
text = _("Search tags"),
|
||||
checked_func = function()
|
||||
local search_option = SEARCH_TAGS
|
||||
return search_option
|
||||
end,
|
||||
callback = function() SEARCH_TAGS = not SEARCH_TAGS end
|
||||
},
|
||||
{
|
||||
text = _("Search series"),
|
||||
checked_func = function()
|
||||
local search_option = SEARCH_SERIES
|
||||
return search_option
|
||||
end,
|
||||
callback = function() SEARCH_SERIES = not SEARCH_SERIES end
|
||||
},
|
||||
{
|
||||
text = _("Search path"),
|
||||
checked_func = function()
|
||||
local search_option = SEARCH_PATH
|
||||
return search_option
|
||||
end,
|
||||
callback = function() SEARCH_PATH = not SEARCH_PATH end
|
||||
},
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
return Screen
|
||||
|
||||
|
||||
Reference in New Issue
Block a user