diff --git a/timezone/src/include/timezone/dialogs.rb b/timezone/src/include/timezone/dialogs.rb index 6d29f798..0befdf38 100644 --- a/timezone/src/include/timezone/dialogs.rb +++ b/timezone/src/include/timezone/dialogs.rb @@ -345,6 +345,9 @@ def SetTimeDialog ret = ntp_handled if ntp_handled != nil show_current_time.call if ret == :redraw + if ret == :ntp || ret == :manual + ntp_rb = ret == :ntp + end if ret == :ntp if !ntp.ensure_installed ntp_rb = false diff --git a/timezone/src/lib/timezone/ntp.rb b/timezone/src/lib/timezone/ntp.rb index 8249538b..d1de8718 100644 --- a/timezone/src/lib/timezone/ntp.rb +++ b/timezone/src/lib/timezone/ntp.rb @@ -5,18 +5,21 @@ module Yast # TODO: separate UI and non-UI, figure out a reasonable UI interface # (check also CWM) class TimezoneNtp + include Yast::UIShortcuts + # [Boolean] if system clock is configured to sync with NTP - attr :used + attr_accessor :used # [String] ntp server configured to sync with # FIXME we use an array, but this is the one to contact now - attr :server + attr_accessor :server def initialize self.used = false self.server = "" # FIXME better nil # when checking for NTP status for first time, check the service status - self.first_time = true + @first_time = true + @installed = Stage.initial || Package.Installed("yast2-ntp-client") end # @return [String] a RichText help @@ -35,11 +38,11 @@ def ui_init { "replace_point" => Id(:rp), "country" => Language.GetLanguageCountry, - "first_time" => first_time + "first_time" => @first_time } ) ) - self.first_time = false + @first_time = false ntp_rb end @@ -56,7 +59,7 @@ def ui_handle(user_input) # if the responsible yast package is not installed, # fall back to disabling the config widgets def installed? - Stage.initial || Package.Installed("yast2-ntp-client") + @installed end @@ -141,8 +144,7 @@ def save # The called client has been meanwhile moved to this package but it # does not check for the dependencies itself yet. def ntp_call(acall, args) - args = deep_copy(args) - if !@ntp_installed + if !@installed # replace "replace_point" by the widgets if acall == "ui_init" return false # deselect the RB @@ -167,7 +169,7 @@ def ntp_call(acall, args) end ret = WFM.CallFunction("timezone_ntp", [acall, args]) - deep_copy(ret) + ret end end end