27 lines
600 B
Lua
27 lines
600 B
Lua
-- name = "Calendar"
|
|
-- description = "Calendar search script"
|
|
-- author = "Evgeny Zobnin (zobnin@gmail.com)"
|
|
-- type = "search"
|
|
|
|
local events = calendar:get_events()
|
|
local results = {}
|
|
|
|
function on_search(str)
|
|
results = {}
|
|
buttons = {}
|
|
|
|
for _,event in pairs(events) do
|
|
if event.title:lower():find(str:lower()) ~= nil then
|
|
table.insert(results, event)
|
|
table.insert(buttons, event.title)
|
|
end
|
|
end
|
|
|
|
search:show(buttons)
|
|
end
|
|
|
|
function on_click(idx)
|
|
--calendar:show_event_dialog(results[idx].id)
|
|
calendar:open_event(results[idx].id)
|
|
end
|