Formatting

This commit is contained in:
jimiatnymbl 2021-12-23 21:08:43 -07:00
parent 6a38b7b598
commit 48c81f97d7
3 changed files with 13 additions and 13 deletions

View File

@ -37,12 +37,12 @@ function onKeyEvent(key as string, press as boolean) as boolean
'focus the submit button from serverUrl
else if key = "down" and m.serverUrlContainer.hasFocus()
m.submit.setFocus(true)
else if key = "options"
else if key = "options"
if m.serverPicker.content.getChild(m.serverPicker.itemFocused).name = "Saved"
'Can only delete previously saved servers, not locally discovered ones
'So if we are on a "Saved" item, let the options dialog be shown (handled elsewhere)
handled = false
end if
end if
else
handled = false
end if
@ -83,7 +83,7 @@ sub ScanForServersComplete(event)
end for
if alreadyListed = false
items.update([server], true)
end if
end if
end for
end if

View File

@ -422,11 +422,11 @@ sub SaveServerList()
end if
end for
if alreadySaved = false
savedServers.serverList.Push({ name: "Saved", baseUrl: server, username: m.user.name, iconUrl: "pkg:/images/logo-icon120.jpg", iconWidth: 120, iconHeight: 120})
savedServers.serverList.Push({ name: "Saved", baseUrl: server, username: m.user.name, iconUrl: "pkg:/images/logo-icon120.jpg", iconWidth: 120, iconHeight: 120 })
set_setting("saved_servers", FormatJson(savedServers))
end if
else
set_setting("saved_servers", FormatJson({ serverList: [{name: "Saved", baseUrl: server, username: m.user.name, iconUrl: "pkg:/images/logo-icon120.jpg", iconWidth: 120, iconHeight: 120}]}))
set_setting("saved_servers", FormatJson({ serverList: [{ name: "Saved", baseUrl: server, username: m.user.name, iconUrl: "pkg:/images/logo-icon120.jpg", iconWidth: 120, iconHeight: 120 }] }))
end if
end sub
@ -434,7 +434,7 @@ sub DeleteFromServerList(urlToDelete)
saved = get_setting("saved_servers")
if saved <> invalid
savedServers = ParseJson(saved)
newServers = {serverList: []}
newServers = { serverList: [] }
for each item in savedServers.serverList
if item.baseUrl <> urlToDelete
newServers.serverList.Push(item)

View File

@ -16,12 +16,12 @@ function CreateServerGroup()
sidepanel = screen.findNode("options")
opt = CreateObject("roSGNode", "OptionsButton")
opt.title = tr("Delete Saved")
opt.id = "delete_saved"
opt.id = "delete_saved"
opt.observeField("optionSelected", port)
new_options.push(opt)
sidepanel.options = new_options
sidepanel.observeField("closeSidePanel", port)
screen.observeField("backPressed", port)
while true
@ -86,7 +86,7 @@ function CreateServerGroup()
serverPicker.content.removeChild(itemToDelete)
sidepanel.visible = false
serverPicker.setFocus(true)
end if
end if
end if
end if
end while
@ -140,7 +140,7 @@ function CreateSigninGroup(user = "")
'Load in any saved server data and see if we can just log them in...
server = get_setting("server")
saved = get_setting("saved_servers")
if saved <> invalid
if saved <> invalid
savedServers = ParseJson(saved)
for each item in savedServers.serverList
if item.baseUrl = server and item.username <> invalid and item.password <> invalid
@ -361,14 +361,14 @@ sub UpdateSavedServerList()
username = get_setting("username")
password = get_setting("password")
if server = invalid or username = invalid or password = invalid
if server = invalid or username = invalid or password = invalid
return
end if
saved = get_setting("saved_servers")
if saved <> invalid
savedServers = ParseJson(saved)
newServers = {serverList: []}
newServers = { serverList: [] }
for each item in savedServers.serverList
if item.baseUrl = server and item.username = username
item.password = password
@ -377,6 +377,6 @@ sub UpdateSavedServerList()
end for
set_setting("saved_servers", FormatJson(newServers))
else
set_setting("saved_servers", FormatJson({ serverList: [{name: "Saved", baseUrl: server, username: username, password: password, iconUrl: "pkg:/images/logo-icon120.jpg", iconWidth: 120, iconHeight: 120}]}))
set_setting("saved_servers", FormatJson({ serverList: [{ name: "Saved", baseUrl: server, username: username, password: password, iconUrl: "pkg:/images/logo-icon120.jpg", iconWidth: 120, iconHeight: 120 }] }))
end if
end sub