Files
playlet-piped/playlet-lib/src/components/Screens/SettingsScreen/ClearSearchHistoryControl.bs
T

27 lines
721 B
Plaintext

import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/Services/SearchHistory/SearchHistoryUtils.bs"
import "pkg:/source/utils/FocusManagement.bs"
function Init()
m.top.focusable = true
m.top.itemSpacings = [8]
m.button = m.top.findNode("Button")
m.button.observeField("buttonSelected", FuncName(OnButtonSelected))
end function
function OnFocusChange() as void
if not m.top.focus
return
end if
NodeSetFocus(m.button, true)
end function
function BindPreference(preferences as object, key as string)
' Do nothing
end function
function OnButtonSelected()
SearchHistoryUtils.Clear()
DialogUtils.ShowDialog("Search history cleared.", "Success")
end function