* locale for web app * more translations * Rename profiles service to avoid locale conflict * More translation work * Lint fix --------- Co-authored-by: github-action linter <githubaction@githubaction.com>
64 lines
1.9 KiB
Plaintext
64 lines
1.9 KiB
Plaintext
import "pkg:/components/Dialog/DialogUtils.bs"
|
|
import "pkg:/components/Navigation/Navigation.bs"
|
|
import "pkg:/components/ProfileView/ProfileViewUtils.bs"
|
|
import "pkg:/source/utils/FocusManagement.bs"
|
|
import "pkg:/source/utils/Types.bs"
|
|
|
|
function Init()
|
|
m.top.focusable = true
|
|
m.profileRowList = m.top.FindNode("ProfileRowList")
|
|
end function
|
|
|
|
function OnNodeReady()
|
|
SetNavigation(invalid, "back", m.navBar)
|
|
SetNavigation(invalid, "left", m.navBar)
|
|
|
|
m.profileRowList.content = m.profilesService.content
|
|
m.profileRowList.observeFieldScoped("rowItemSelected", FuncName(OnRowItemSelected))
|
|
m.profilesService.observeFieldScoped("currentProfile", FuncName(OnCurrentProfileChanged))
|
|
end function
|
|
|
|
function OnFocusChange() as void
|
|
if not m.top.focus
|
|
return
|
|
end if
|
|
NodeSetFocus(m.profileRowList, true)
|
|
end function
|
|
|
|
function OnkeyEvent(key as string, press as boolean) as boolean
|
|
if NavigationKeyHandler(key, press).handled
|
|
return true
|
|
end if
|
|
return false
|
|
end function
|
|
|
|
function OnRowItemSelected() as void
|
|
index = m.profileRowList.rowItemSelected[1]
|
|
row = m.profileRowList.content.GetChild(0)
|
|
selectedProfile = row.GetChild(index)
|
|
if selectedProfile.type = "login"
|
|
dialog = CreateObject("roSGNode", "LoginDialog")
|
|
dialog@.BindNode()
|
|
m.top.getScene().dialog = dialog
|
|
return
|
|
end if
|
|
|
|
ProfileViewUtils.Open(selectedProfile, m.appController)
|
|
end function
|
|
|
|
function OnCurrentProfileChanged() as void
|
|
currentProfile = m.profilesService.currentProfile
|
|
if currentProfile = invalid
|
|
return
|
|
end if
|
|
|
|
row = m.profileRowList.content.GetChild(0)
|
|
allProfiles = row.getChildren(-1, 0)
|
|
for i = 0 to allProfiles.Count() - 1
|
|
if currentProfile.id = allProfiles[i].id
|
|
m.profileRowList.jumpToRowItem = [0, i]
|
|
return
|
|
end if
|
|
end for
|
|
end function
|