2013-02-23 12:41:21 +01:00
|
|
|
AddServer = {}
|
|
|
|
|
|
|
|
-- private variables
|
|
|
|
local addServerWindow = nil
|
|
|
|
|
|
|
|
-- public functions
|
|
|
|
function AddServer.init()
|
|
|
|
addServerWindow = g_ui.displayUI('addserver')
|
|
|
|
end
|
|
|
|
|
|
|
|
function AddServer.terminate()
|
|
|
|
addServerWindow:destroy()
|
|
|
|
end
|
|
|
|
|
|
|
|
function AddServer.add()
|
|
|
|
local host = addServerWindow:getChildById('host'):getText()
|
|
|
|
local port = addServerWindow:getChildById('port'):getText()
|
|
|
|
local protocol = addServerWindow:getChildById('protocol'):getCurrentOption().text
|
|
|
|
|
|
|
|
local added, error = ServerList.add(host, port, protocol)
|
|
|
|
if not added then
|
2015-07-17 11:22:31 +02:00
|
|
|
displayErrorBox(tr('Error'), tr(error))
|
2013-02-23 12:41:21 +01:00
|
|
|
else
|
|
|
|
AddServer.hide()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function AddServer.show()
|
|
|
|
addServerWindow:show()
|
|
|
|
addServerWindow:raise()
|
|
|
|
addServerWindow:focus()
|
|
|
|
addServerWindow:lock()
|
|
|
|
end
|
|
|
|
|
|
|
|
function AddServer.hide()
|
|
|
|
addServerWindow:hide()
|
|
|
|
addServerWindow:unlock()
|
|
|
|
end
|