Skip to content

Commit

Permalink
Deactivate widget in network window
Browse files Browse the repository at this point in the history
IP Addresses can be set after a network interface is found. After
switching to network setup, no network interface is yet selected and it
should not possible to set any address.

Signed-off-by: Stefano Babic <[email protected]>
  • Loading branch information
sbabic committed Jan 8, 2019
1 parent 64d55d0 commit 0fd62ed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions SWUpdateGUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ function NetWindow:setRecord(fields)
end

net:setip(dhcp,checkip(fields[3], "192.168.0.1"), checkip(fields[4], "255.255.255.0"))
net:enable(dhcp)
if (fields[1] == INTF_GATEWAY) then
net:setip(dhcp,checkip(fields[3], "192.168.0.1"), "0.0.0.0")
net:justaddress()
Expand Down Expand Up @@ -670,6 +671,8 @@ app = ui.Application:new
g:setValue("SelectedLine", g:getItem(1), true)
g:moveLine(1, true)
end
g = app:getById("network-fields")
g:deactivate()
end,
},

Expand Down
7 changes: 6 additions & 1 deletion SWUpdateGUI_ipaddress.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ function NetAddress.new(class, self, defaultip, defaultnetmask)
self = self or { }
self.Class = "netaddress"

print(defaultip, defaultnetmask)
self.defaultip = defaultip
self.defaultnetmask = defaultnetmask
self.grp = ui.Group.new(class, self)
Expand Down Expand Up @@ -142,6 +141,12 @@ function NetAddress:justaddress()
self.netmask:enable(false)
end

function NetAddress:deactivate()
self.dhcp:setValue("Disabled", true)
self.ip:enable(false)
self.netmask:enable(false)
end

function NetAddress:setip(endhcp, ip, netmask, gateway)
self.dhcp:setValue("Disabled", false)
self.dhcp:setValue("Selected", endhcp)
Expand Down

0 comments on commit 0fd62ed

Please sign in to comment.