Hello community,

here is the log from the commit of package yast2-dhcp-server for 
openSUSE:Factory checked in at 2015-12-03 13:30:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-dhcp-server (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-dhcp-server.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-dhcp-server"

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-dhcp-server/yast2-dhcp-server.changes      
2014-12-05 21:04:05.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.yast2-dhcp-server.new/yast2-dhcp-server.changes 
2015-12-03 13:30:48.000000000 +0100
@@ -1,0 +2,13 @@
+Fri Nov 27 09:19:18 UTC 2015 - [email protected]
+
+- Adapted to latest changes in UI::ServiceStatus API (fate#318771)
+- 3.1.7
+
+-------------------------------------------------------------------
+Thu Nov 26 10:36:14 UTC 2015 - [email protected]
+
+- Several UI improvements and fixes, including the usage of the
+  new generic widget to handle the service status (fate#318771).
+- 3.1.6
+
+-------------------------------------------------------------------

Old:
----
  yast2-dhcp-server-3.1.5.tar.bz2

New:
----
  yast2-dhcp-server-3.1.7.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-dhcp-server.spec ++++++
--- /var/tmp/diff_new_pack.cIGqkH/_old  2015-12-03 13:30:49.000000000 +0100
+++ /var/tmp/diff_new_pack.cIGqkH/_new  2015-12-03 13:30:49.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package yast2-dhcp-server
 #
-# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-dhcp-server
-Version:        3.1.5
+Version:        3.1.7
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
@@ -32,11 +32,12 @@
 BuildRequires:  popt-devel
 BuildRequires:  sgml-skel
 BuildRequires:  update-desktop-files
-BuildRequires:  yast2
 BuildRequires:  yast2-devtools >= 3.1.10
 BuildRequires:  yast2-dns-server
 BuildRequires:  yast2-perl-bindings
 BuildRequires:  yast2-testsuite
+# UI::ServiceStatus
+BuildRequires:  yast2 >= 3.1.161
 
 Requires:       bind-utils
 Requires:       perl-Digest-SHA1
@@ -45,10 +46,8 @@
 Requires:       perl-gettext
 Requires:       yast2-ldap
 Requires:       yast2-perl-bindings
-# Address::CheckMAC && Address::ValidMAC (2.13.73)
-# Punycode
-# Wizard::SetDesktopTitleAndIcon
-Requires:       yast2 >= 2.21.22
+# UI::ServiceStatus
+Requires:       yast2 >= 3.1.161
 # DnsServerAPI::IsServiceConfigurableExternally
 Requires:       yast2-dns-server >= 2.13.16
 

++++++ yast2-dhcp-server-3.1.5.tar.bz2 -> yast2-dhcp-server-3.1.7.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-dhcp-server-3.1.5/.travis.yml 
new/yast2-dhcp-server-3.1.7/.travis.yml
--- old/yast2-dhcp-server-3.1.5/.travis.yml     2014-12-04 10:58:16.000000000 
+0100
+++ new/yast2-dhcp-server-3.1.7/.travis.yml     2015-11-27 14:43:01.000000000 
+0100
@@ -5,7 +5,7 @@
     # disable rvm, use system Ruby
     - rvm reset
     - wget 
https://raw.githubusercontent.com/yast/yast-devtools/master/travis-tools/travis_setup.sh
-    - sh ./travis_setup.sh -p "rake yast2-devtools yast2-testsuite yast2 
yast2-perl-bindings" -g "rspec:2.14.1 yast-rake gettext"
+    - sh ./travis_setup.sh -p "rake yast2-devtools yast2-testsuite yast2 
yast2-perl-bindings" -g "rspec:3.3.0 yast-rake gettext"
 script:
     - rake check:syntax
     - rake check:pot
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-dhcp-server-3.1.5/CONTRIBUTING.md 
new/yast2-dhcp-server-3.1.7/CONTRIBUTING.md
--- old/yast2-dhcp-server-3.1.5/CONTRIBUTING.md 2014-12-04 10:58:16.000000000 
+0100
+++ new/yast2-dhcp-server-3.1.7/CONTRIBUTING.md 2015-11-27 14:43:01.000000000 
+0100
@@ -12,13 +12,13 @@
 -----------
 
 If you find a problem, please report it either using
-[Bugzilla](https://bugzilla.novell.com/enter_bug.cgi?format=guided&product=openSUSE+Factory&component=YaST2)
+[Bugzilla](https://bugzilla.suse.com/enter_bug.cgi?format=guided&product=openSUSE+Factory&component=YaST2)
 or [GitHub issues](../../issues). (For Bugzilla, use the [simplified
 
registration](https://secure-www.novell.com/selfreg/jsp/createSimpleAccount.jsp)
 if you don't have an account yet.)
 
 If you find a problem, please report it either using
-[Bugzilla](https://bugzilla.novell.com/) or GitHub issues. We can't guarantee
+[Bugzilla](https://bugzilla.suse.com/) or GitHub issues. We can't guarantee
 that every bug will be fixed, but we'll try.
 
 When creating a bug report, please follow our [bug reporting
@@ -71,7 +71,7 @@
 [widely used
 
conventions](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
 
-If your commit is related to a bug in Buzgilla or an issue on GitHub, make sure
+If your commit is related to a bug in Bugzilla or an issue on GitHub, make sure
 you mention it in the commit message for cross-reference. Use format like
 bnc#775814 or gh#yast/yast-foo#42. See also [GitHub
 
autolinking](https://help.github.com/articles/github-flavored-markdown#references)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-dhcp-server-3.1.5/package/yast2-dhcp-server.changes 
new/yast2-dhcp-server-3.1.7/package/yast2-dhcp-server.changes
--- old/yast2-dhcp-server-3.1.5/package/yast2-dhcp-server.changes       
2014-12-04 10:58:16.000000000 +0100
+++ new/yast2-dhcp-server-3.1.7/package/yast2-dhcp-server.changes       
2015-11-27 14:43:01.000000000 +0100
@@ -1,4 +1,17 @@
 -------------------------------------------------------------------
+Fri Nov 27 09:19:18 UTC 2015 - [email protected]
+
+- Adapted to latest changes in UI::ServiceStatus API (fate#318771)
+- 3.1.7
+
+-------------------------------------------------------------------
+Thu Nov 26 10:36:14 UTC 2015 - [email protected]
+
+- Several UI improvements and fixes, including the usage of the
+  new generic widget to handle the service status (fate#318771).
+- 3.1.6
+
+-------------------------------------------------------------------
 Thu Dec  4 09:50:01 UTC 2014 - [email protected]
 
 - remove X-KDE-Library from desktop file (bnc#899104)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-dhcp-server-3.1.5/package/yast2-dhcp-server.spec 
new/yast2-dhcp-server-3.1.7/package/yast2-dhcp-server.spec
--- old/yast2-dhcp-server-3.1.5/package/yast2-dhcp-server.spec  2014-12-04 
10:58:16.000000000 +0100
+++ new/yast2-dhcp-server-3.1.7/package/yast2-dhcp-server.spec  2015-11-27 
14:43:01.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-dhcp-server
-Version:        3.1.5
+Version:        3.1.7
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
@@ -25,14 +25,14 @@
 
 Group:          System/YaST
 License:        GPL-2.0
-BuildRequires: perl-Digest-SHA1 perl-X500-DN perl-XML-Writer 
docbook-xsl-stylesheets doxygen libxslt perl-XML-Writer popt-devel sgml-skel 
update-desktop-files yast2 yast2-perl-bindings yast2-testsuite yast2-dns-server
+BuildRequires: perl-Digest-SHA1 perl-X500-DN perl-XML-Writer 
docbook-xsl-stylesheets doxygen libxslt perl-XML-Writer popt-devel sgml-skel 
update-desktop-files yast2-perl-bindings yast2-testsuite yast2-dns-server
 BuildRequires:  yast2-devtools >= 3.1.10
+# UI::ServiceStatus
+BuildRequires:  yast2 >= 3.1.161
 
 Requires:       perl-gettext yast2-perl-bindings bind-utils perl-X500-DN 
yast2-ldap perl-Digest-SHA1 perl-Parse-RecDescent
-# Address::CheckMAC && Address::ValidMAC (2.13.73)
-# Punycode
-# Wizard::SetDesktopTitleAndIcon
-Requires:       yast2 >= 2.21.22
+# UI::ServiceStatus
+Requires:       yast2 >= 3.1.161
 # DnsServerAPI::IsServiceConfigurableExternally
 Requires:       yast2-dns-server >= 2.13.16
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-dhcp-server-3.1.5/src/include/dhcp-server/dialogs.rb 
new/yast2-dhcp-server-3.1.7/src/include/dhcp-server/dialogs.rb
--- old/yast2-dhcp-server-3.1.5/src/include/dhcp-server/dialogs.rb      
2014-12-04 10:58:16.000000000 +0100
+++ new/yast2-dhcp-server-3.1.7/src/include/dhcp-server/dialogs.rb      
2015-11-27 14:43:01.000000000 +0100
@@ -46,6 +46,10 @@
       Builtins.y2milestone("Running write dialog")
       Wizard.RestoreHelp(Ops.get(@HELPS, "write", ""))
       ret = DhcpServer.Write
+      if ret && restart?
+        # Restart only if it's already running
+        @service.try_restart
+      end
       # yes-no popup
       if !ret &&
           Popup.YesNo(
@@ -56,29 +60,58 @@
       ret ? :next : :abort
     end
 
+    # Write settings without quitting
+    def SaveAndRestart(event)
+      return nil unless CWM.validate_current_widgets(event)
+      CWM.save_current_widgets(event)
+
+      Wizard.CreateDialog
+      Wizard.RestoreHelp(Ops.get(@HELPS, "write", ""))
+      ret = DhcpServer.Write
+      if ret
+        # Restart only if it's already running
+        @service.try_restart if restart?
+      else
+        Report.Error(_("Saving the configuration failed"))
+      end
+      UI.CloseDialog
+
+      nil
+    end
 
     # Run main dialog
     # @return [Symbol] for wizard sequencer
     def OldMainDialog
       Builtins.y2milestone("Running main dialog")
       w = CWM.CreateWidgets(
-        ["start", "chroot", "ldap_support", "configtree"],
+        [
+          "service_status", "chroot", "ldap_support",
+          "configtree", "advanced", "apply"
+        ],
         @widgets
       )
-      contents = HBox(
-        HSpacing(2),
-        VBox(
-          VSpacing(1),
-          Left(Ops.get_term(w, [0, "widget"]) { VSpacing(0) }),
-          VSpacing(1),
-          Left(Ops.get_term(w, [1, "widget"]) { VSpacing(0) }),
-          VSpacing(1),
-          Left(Ops.get_term(w, [2, "widget"]) { VSpacing(0) }),
-          VSpacing(1),
-          Ops.get_term(w, [3, "widget"]) { VSpacing(0) },
-          VSpacing(1)
+      contents = VBox(
+        HBox(
+          HSpacing(2),
+          VBox(
+            VSpacing(1),
+            Left(Ops.get_term(w, [0, "widget"]) { VSpacing(0) }),
+            VSpacing(1),
+            Left(Ops.get_term(w, [1, "widget"]) { VSpacing(0) }),
+            VSpacing(1),
+            Left(Ops.get_term(w, [2, "widget"]) { VSpacing(0) }),
+            VSpacing(1),
+            Ops.get_term(w, [3, "widget"]) { VSpacing(0) }
+          ),
+          HSpacing(2)
         ),
-        HSpacing(2)
+        VSpacing(1),
+        Right(
+          HBox(
+            w[4]["widget"],
+            w[5]["widget"]
+          )
+        )
       )
       # dialog caption
       caption = _("DHCP Server Configuration")
@@ -611,5 +644,14 @@
       return :expert if Mode.config
       DhcpServer.IsConfigurationSimple ? :simple : :expert
     end
+
+  private
+
+    # Checks if the service must be restarted after saving
+    # @return [Boolean]
+    def restart?
+      # If ServiceStatus is used, DhcpServer must be set to write-only
+      DhcpServer.GetWriteOnly() && @status_widget && 
@status_widget.reload_flag?
+    end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-dhcp-server-3.1.5/src/include/dhcp-server/dialogs2.rb 
new/yast2-dhcp-server-3.1.7/src/include/dhcp-server/dialogs2.rb
--- old/yast2-dhcp-server-3.1.5/src/include/dhcp-server/dialogs2.rb     
2014-12-04 10:58:16.000000000 +0100
+++ new/yast2-dhcp-server-3.1.7/src/include/dhcp-server/dialogs2.rb     
2015-11-27 14:43:01.000000000 +0100
@@ -80,14 +80,15 @@
       @tabs = {
         "start_up"        => {
           "contents"        => VBox(
-            "auto_start_up",
-            #      `VSpacing(),
-            "use_ldap",
+            "service_status",
             VSpacing(),
-            "start_stop",
+            "use_ldap",
             VSpacing(),
             HBox("other_options", HStretch()),
-            VStretch()
+            VStretch(),
+            Right(
+              "apply"
+            )
           ),
           # dialog caption
           "caption"         => _("DHCP Server: Start-Up"),
@@ -96,11 +97,11 @@
           # tree item
           "tree_item_label" => _("Start-Up"),
           "widget_names"    => [
-            "auto_start_up",
+            "service_status",
             "use_ldap",
-            "start_stop",
             "expert_settings",
-            "other_options"
+            "other_options",
+            "apply"
           ]
         },
         "card_selection"  => {
@@ -214,44 +215,6 @@
                 )
               }
             ),
-            "start_stop"      => CWMServiceStart.CreateStartStopWidget(
-              {
-                "service_id"                => "dhcpd",
-                # label - service status
-                "service_running_label"     => _(
-                  "DHCP server is running"
-                ),
-                # label - service status
-                "service_not_running_label" => _(
-                  "DHCP server is not running"
-                ),
-                # push button
-                "start_now_button"          => _(
-                  "&Start DHCP Server Now"
-                ),
-                # push button
-                "stop_now_button"           => _(
-                  "S&top DHCP Server Now"
-                ),
-                "save_now_action"           => fun_ref(
-                  method(:SaveAndRestart),
-                  "void ()"
-                ),
-                # push button
-                "save_now_button"           => _(
-                  "Save Settings and Restart DHCP Server &Now"
-                ),
-                "help"                      => Builtins.sformat(
-                  CWMServiceStart.StartStopHelpTemplate(true),
-                  # part of help text - push button label, NO SHORTCUT!!!
-                  _("Start DHCP Server Now"),
-                  # part of help text - push button label, NO SHORTCUT!!!
-                  _("Stop DHCP Server Now"),
-                  # part of help text - push button label, NO SHORTCUT!!!
-                  _("Save Settings and Restart DHCP Server Now")
-                )
-              }
-            ),
             "use_ldap"        => CWMServiceStart.CreateLdapWidget(
               {
                 "get_use_ldap" => fun_ref(
@@ -2190,15 +2153,6 @@
 
       nil
     end
-
-    def SaveAndRestart
-      Wizard.CreateDialog
-      Wizard.RestoreHelp(Ops.get(@HELPS, "write", ""))
-      DhcpServer.Write
-      UI.CloseDialog
-
-      nil
-    end
 
     # Common Config Dialog
     # @return [Symbol] for the wizard sequencer
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-dhcp-server-3.1.5/src/include/dhcp-server/helps.rb 
new/yast2-dhcp-server-3.1.7/src/include/dhcp-server/helps.rb
--- old/yast2-dhcp-server-3.1.5/src/include/dhcp-server/helps.rb        
2014-12-04 10:58:16.000000000 +0100
+++ new/yast2-dhcp-server-3.1.7/src/include/dhcp-server/helps.rb        
2015-11-27 14:43:01.000000000 +0100
@@ -35,12 +35,6 @@
             "This option is only available if the firewall\n" +
             "is enabled.</p>"
         ),
-        # help text 1/5
-        "start"                 => _(
-          "<p><b><big>DHCP Server</big></b></p>\n" +
-            "<p>To run the DHCP server every time your computer is started, 
set\n" +
-            "<b>Start DHCP Server</b>.</p>"
-        ),
         # help text 2/5
         "chroot"                => _(
           "<p>\n" +
@@ -61,15 +55,15 @@
             "To add a new declaration, select a declaration that should 
include\n" +
             "the new declaration and click <b>Add</b>.\n" +
             "To delete a declaration, select it and click <b>Delete</b>.</p>"
-        ) +
-          # help text 5/5
-          _(
-            "<p><b><big>Advanced Functions</big></b><br>\n" +
-              "Use <b>Advanced</b> to display the log of the DHCP server,\n" +
-              "change network interfaces to which the DHCP server listens,\n" +
-              "or manage TSIG keys that can be used for authentication of \n" +
-              "dynamic DNS updates.</p>"
-          ),
+        ),
+        # help text 5/5
+        "advanced"              => _(
+          "<p><b><big>Advanced Functions</big></b><br>\n" +
+            "Use <b>Advanced</b> to display the log of the DHCP server,\n" +
+            "change network interfaces to which the DHCP server listens,\n" +
+            "or manage TSIG keys that can be used for authentication of \n" +
+            "dynamic DNS updates.</p>"
+        ),
         # help text 1/3, alt. 1
         "subnet"                => _(
           "<p><b><big>Subnet Configuration</big></b><br>\nSet the <b>Network 
Address</b> and <b>Network Mask</b> of the subnet.</p>"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-dhcp-server-3.1.5/src/include/dhcp-server/routines.rb 
new/yast2-dhcp-server-3.1.7/src/include/dhcp-server/routines.rb
--- old/yast2-dhcp-server-3.1.5/src/include/dhcp-server/routines.rb     
2014-12-04 10:58:16.000000000 +0100
+++ new/yast2-dhcp-server-3.1.7/src/include/dhcp-server/routines.rb     
2015-11-27 14:43:01.000000000 +0100
@@ -16,13 +16,6 @@
       textdomain "dhcp-server"
     end
 
-    # Restart the DHCP daemon
-    def RestartDhcpDaemon
-      Service.RunInitScript("dhcpd", "restart")
-
-      nil
-    end
-
     # Merge section id and key together to one identifier
     # @param [String] type string section type
     # @param [String] id string section identifier
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-dhcp-server-3.1.5/src/include/dhcp-server/widgets.rb 
new/yast2-dhcp-server-3.1.7/src/include/dhcp-server/widgets.rb
--- old/yast2-dhcp-server-3.1.5/src/include/dhcp-server/widgets.rb      
2014-12-04 10:58:16.000000000 +0100
+++ new/yast2-dhcp-server-3.1.7/src/include/dhcp-server/widgets.rb      
2015-11-27 14:43:01.000000000 +0100
@@ -5,9 +5,10 @@
 # Summary:     Data for configuration of dhcp-server,
 #              input and output functions.
 # Authors:     Jiri Srain <[email protected]>
-#
-# $Id$
-#
+
+require "yast"
+require "ui/service_status"
+
 # Representation of the configuration of dhcp-server.
 # Input and output routines.
 module Yast
@@ -26,6 +27,10 @@
       Yast.import "TablePopup"
       Yast.import "SuSEFirewall"
       Yast.import "Mode"
+
+      # Init ServiceStatus widget
+      @service = SystemdService.find(DhcpServer.ServiceName())
+      @status_widget = ::UI::ServiceStatus.new(@service, reload_flag_label: 
:restart)
     end
 
     # Function for deleting entry from section
@@ -185,51 +190,6 @@
       confirmAbort
     end
 
-    # Enable or disable a widget according the current status of the service
-    # @param [String] id string widget id
-    # @param [Hash] event map event that caused storing process
-    def dhcpEnabledOrDisabled(id, event)
-      event = deep_copy(event)
-      ev_id = Ops.get(event, "ID")
-      if ev_id == "boot" || ev_id == "never"
-        enabled = UI.QueryWidget(Id("start"), :CurrentButton) != "never"
-        UI.ChangeWidget(Id(id), :Enabled, enabled)
-      end
-
-      nil
-    end
-
-    # Initialize the widget
-    # @param [String] id any widget id
-    def startInit(id)
-      ss = DhcpServer.GetStartService
-      UI.ChangeWidget(Id("start"), :Value, ss)
-
-      nil
-    end
-
-    # Store settings of the widget
-    # @param [String] id string widget id
-    # @param [Hash] event map event that caused storing process
-    def startStore(id, event)
-      event = deep_copy(event)
-      ss = Convert.to_boolean(UI.QueryWidget(Id("start"), :Value))
-      DhcpServer.SetStartService(ss)
-
-      nil
-    end
-
-    # Handle function of the widget
-    # @param [String] id string widget id
-    # @param [Hash] event map event that caused storing process
-    # @return [Symbol] always nil
-    def startHandle(id, event)
-      event = deep_copy(event)
-      start = Convert.to_boolean(UI.QueryWidget(Id("start"), :Value))
-      DhcpServer.SetModified if start != DhcpServer.GetStartService
-      nil
-    end
-
     # chroot widget
 
     # Initialize the widget
@@ -237,7 +197,6 @@
     def chrootInit(id)
       ss = DhcpServer.GetChrootJail
       UI.ChangeWidget(Id(id), :Value, ss)
-      chrootHandle(id, { "ID" => "start" })
 
       nil
     end
@@ -259,11 +218,6 @@
     # @return [Symbol] always nil
     def chrootHandle(id, event)
       event = deep_copy(event)
-      if Ops.get(event, "ID") == "start"
-        en = Convert.to_boolean(UI.QueryWidget(Id("start"), :Value))
-        UI.ChangeWidget(Id(id), :Enabled, en)
-        return nil
-      end
       start = Convert.to_boolean(UI.QueryWidget(Id(id), :Value))
       DhcpServer.SetModified if start != DhcpServer.GetChrootJail
       nil
@@ -277,12 +231,7 @@
       ul = DhcpServer.GetUseLdap
       ldap_available = DhcpServer.GetLdapAvailable
       UI.ChangeWidget(Id(id), :Value, ul)
-
-      if ldap_available
-        ldapHandle(id, { "ID" => "start" })
-      else
-        UI.ChangeWidget(Id(id), :Enabled, ldap_available)
-      end
+      UI.ChangeWidget(Id(id), :Enabled, ldap_available)
 
       nil
     end
@@ -306,11 +255,6 @@
     # @return [Symbol] always nil
     def ldapHandle(id, event)
       event = deep_copy(event)
-      if Ops.get(event, "ID") == "start"
-        en = Convert.to_boolean(UI.QueryWidget(Id("start"), :Value))
-        UI.ChangeWidget(Id(id), :Enabled, en)
-        return nil
-      end
       ldap = Convert.to_boolean(UI.QueryWidget(Id(id), :Value))
       if ldap != DhcpServer.GetUseLdap
         SetUseLdap(ldap)
@@ -387,7 +331,7 @@
               ),
               Builtins.mergestring(ifaces_not_in_fw, "\n")
             )
-          ) 
+          )
           #return false;
           # FIXME: dialog for adding interfaces into firewall zones
           # only one
@@ -400,7 +344,7 @@
               ),
               Ops.get(ifaces_not_in_fw, 0, "")
             )
-          ) 
+          )
           #return false;
           # FIXME: dialog for adding interfaces into firewall zones
         end
@@ -409,16 +353,10 @@
       true
     end
 
-
-    # Handle function of the widget
-    # @param [String] id string widget id
-    # @param [Hash] event map event that caused storing process
-    # @return [Symbol] always nil
-    def configTreeHandle(id, event)
-      event = deep_copy(event)
-      if Mode.config &&
-          (Ops.get(event, "ID") == :log || Ops.get(event, "ID") == :interfaces 
||
-            Ops.get(event, "ID") == :tsig_keys)
+    # Handle function for the advanced options dropdown
+    def handle_advanced(_id, event)
+      event_id = event["ID"]
+      if Mode.config && [:log, :interfaces, :tsig_keys].include?(event_id)
         # popup message
         Popup.Message(
           _(
@@ -427,54 +365,40 @@
         )
         return nil
       end
-      enabled = Convert.to_boolean(UI.QueryWidget(Id("start"), :Value))
-      if Ops.get(event, "ID") == "start"
-        UI.ChangeWidget(Id("configtree"), :Enabled, enabled)
-        UI.ChangeWidget(Id(:adv), :Enabled, enabled)
-        UI.ChangeWidget(Id(:edit), :Enabled, enabled)
-      end
-      if Ops.get(event, "ID") == :log
+      if event_id == :log
         LogView.Display(
           {
             "file"    => "/var/log/messages",
             "grep"    => "dhcpd",
-            "save"    => true,
-            "actions" => [
-              # menubutton entry, try to keep short
-              [
-                _("Restart DHCP Server"),
-                fun_ref(method(:RestartDhcpDaemon), "void ()")
-              ],
-              # menubutton entry, try to keep short
-              [
-                _("Save Settings and Restart DHCP Server"),
-                fun_ref(DhcpServer.method(:Write), "boolean ()")
-              ]
-            ]
+            "save"    => true
           }
         )
         return nil
       end
-      return :interfaces if Ops.get(event, "ID") == :interfaces
-      return :tsig_keys if Ops.get(event, "ID") == :tsig_keys
+      if [:interfaces, :tsig_keys].include?(event_id)
+        event_id
+      else
+        nil
+      end
+    end
+
+    # Handle function of the widget
+    # @param [String] id string widget id
+    # @param [Hash] event map event that caused storing process
+    # @return [Symbol] always nil
+    def configTreeHandle(id, event)
+      event = deep_copy(event)
       current_item = Convert.to_string(
         UI.QueryWidget(Id("configtree"), :CurrentItem)
       )
-      if current_item == " " || !enabled
-        UI.ChangeWidget(Id(:delete), :Enabled, false) 
-        #      UI::ChangeWidget (`id (`move), `Enabled, false);
-      else
-        UI.ChangeWidget(Id(:delete), :Enabled, true) 
-        #      UI::ChangeWidget (`id (`move), `Enabled, true);
-      end
+      UI.ChangeWidget(Id(:delete), :Enabled, current_item != " ")
       selected = key2typeid(current_item)
       if selected == nil
         Builtins.y2error("Unexistent entry selected")
         return nil
       end
       sel_type = Ops.get(selected, "type", "")
-      if sel_type == "pool" || sel_type == "class" || sel_type == "host" ||
-          !enabled
+      if ["pool", "class", "host"].include?(sel_type)
         UI.ChangeWidget(Id(:add), :Enabled, false)
       else
         UI.ChangeWidget(Id(:add), :Enabled, true)
@@ -522,7 +446,7 @@
         )
         configTreeInit(id)
       elsif Ops.get(event, "ID") == :move
-        return nil 
+        return nil
         # TODO move button
       end
       # if (event["ID"]:nil == `add || event["ID"]:nil == `edit)
@@ -550,7 +474,6 @@
         )
       )
       UI.ChangeWidget(Id("configtree"), :CurrentItem, " ")
-      configTreeHandle(id, { "ID" => "start" })
       nil
     end
 
@@ -916,6 +839,39 @@
       :main
     end
 
+    # Handle function for the 'Apply' button
+    def handle_apply(_key, event)
+      event_id = event["ID"]
+      if event_id == "apply"
+        SaveAndRestart(event)
+      end
+      nil
+    end
+
+    def init_service_status(_key)
+      # If UI::ServiceStatus is used, do not let DnsServer manage the service
+      # status, let the user decide
+      DhcpServer.SetWriteOnly(true)
+      nil
+    end
+
+    # Handle function for the ServiceStatus widget
+    def handle_service_status(_key, event)
+      event_id = event["ID"]
+      if @status_widget.handle_input(event_id) == :enabled_flag
+        DhcpServer.SetModified
+      end
+      nil
+    end
+
+    # Store settings of the widget
+    # @param [String] id string widget id
+    # @param [Hash] event map event that caused storing process
+    def store_service_status(_key, _event)
+      DhcpServer.SetStartService(@status_widget.enabled_flag?)
+      nil
+    end
+
     # Initialize widgets
     # Create description map and copy it into appropriate variable of the
     #  DhcpServer module
@@ -1054,15 +1010,19 @@
           #FIXME CWM should be able to handle virtual widgets
           "widget"        => :textentry
         },
-        "start"                => {
-          "widget" => :checkbox,
-          # check box
-          "label"  => _("&Start DHCP Server"),
-          "help"   => Ops.get(@HELPS, "start", ""),
-          "init"   => fun_ref(method(:startInit), "void (string)"),
-          "handle" => fun_ref(method(:startHandle), "symbol (string, map)"),
-          "store"  => fun_ref(method(:startStore), "void (string, map)"),
-          "opt"    => [:notify]
+        "service_status"         => {
+          "widget" => :custom,
+          "custom_widget" => @status_widget.widget,
+          "help"   => @status_widget.help,
+          "init"   => fun_ref(method(:init_service_status), "void (string)"),
+          "handle" => fun_ref(method(:handle_service_status), "symbol (string, 
map)"),
+          "store"  => fun_ref(method(:store_service_status), "void (string, 
map)")
+        },
+        "apply"           => {
+          "widget" => :push_button,
+          "label"  => _("Apply Changes"),
+          "handle" => fun_ref(method(:handle_apply), "symbol (string, map)"),
+          "help"   => ""
         },
         "chroot"               => {
           "widget" => :checkbox,
@@ -1086,7 +1046,7 @@
           "widget"        => :custom,
           "custom_widget" => VWeight(
             1,
-            VBox(
+            HBox(
               VWeight(
                 1,
                 ReplacePoint(
@@ -1099,25 +1059,10 @@
                   )
                 )
               ),
-              HBox(
+              VBox(
                 PushButton(Id(:add), Label.AddButton),
                 PushButton(Id(:edit), Label.EditButton),
                 PushButton(Id(:delete), Label.DeleteButton),
-                #                      `PushButton (`id (`move), _("&Move")),
-                HStretch(),
-                # menu button
-                MenuButton(
-                  Id(:adv),
-                  _("Ad&vanced"),
-                  [
-                    # item of a menu button
-                    Item(Id(:log), _("Display &Log")),
-                    # item of a menu button
-                    Item(Id(:interfaces), _("&Interface Configuration")),
-                    # item of a menu button
-                    Item(Id(:tsig_keys), _("TSIG Key Management"))
-                  ]
-                )
               )
             )
           ),
@@ -1128,6 +1073,22 @@
             "symbol (string, map)"
           )
         },
+        "advanced"             => {
+          "widget"        => :custom,
+          "custom_widget" => MenuButton(
+            Id(:adv),
+            _("Ad&vanced"),
+            [
+              # item of a menu button
+              Item(Id(:log), _("Display &Log")),
+              # item of a menu button
+              Item(Id(:interfaces), _("&Interface Configuration")),
+              # item of a menu button
+              Item(Id(:tsig_keys), _("TSIG Key Management"))
+            ]
+          ),
+          "handle"        => fun_ref(method(:handle_advanced), "symbol 
(string, map)")
+        },
         "subnet"               => {
           "widget"        => :custom,
           "custom_widget" => HBox(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-dhcp-server-3.1.5/src/modules/DhcpServer.pm 
new/yast2-dhcp-server-3.1.7/src/modules/DhcpServer.pm
--- old/yast2-dhcp-server-3.1.5/src/modules/DhcpServer.pm       2014-12-04 
10:58:16.000000000 +0100
+++ new/yast2-dhcp-server-3.1.7/src/modules/DhcpServer.pm       2015-11-27 
14:43:01.000000000 +0100
@@ -185,6 +185,12 @@
     return $dns_server_available;
 }
 
+BEGIN {$TYPEINFO{ServiceName} = [ "function", "string" ];}
+sub ServiceName () {
+    # returns systemd name for the DHCP service
+    return $SERVICE;
+}
+
 sub InitTSIGKeys {
     my $self = shift;
 
@@ -1286,6 +1292,13 @@
     $write_only = shift;
 }
 
+BEGIN{$TYPEINFO{GetWriteOnly} = ["function", "boolean"];}
+sub GetWriteOnly {
+    my $self = shift;
+
+    return Boolean ($write_only);
+}
+
 BEGIN{$TYPEINFO{GetAllowedInterfaces} = ["function", ["list", "string"] ];}
 sub GetAllowedInterfaces {
     my $self = shift;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-dhcp-server-3.1.5/src/modules/DhcpServerUI.rb 
new/yast2-dhcp-server-3.1.7/src/modules/DhcpServerUI.rb
--- old/yast2-dhcp-server-3.1.5/src/modules/DhcpServerUI.rb     2014-12-04 
10:58:16.000000000 +0100
+++ new/yast2-dhcp-server-3.1.7/src/modules/DhcpServerUI.rb     2015-11-27 
14:43:01.000000000 +0100
@@ -152,7 +152,6 @@
     publish :function => :getOptionsTableWidget, :type => "map <string, any> 
(list)"
     publish :function => :confirmAbort, :type => "boolean ()"
     publish :function => :confirmAbortIfChanged, :type => "boolean ()"
-    publish :function => :dhcpEnabledOrDisabled, :type => "void (string, map)"
     publish :function => :startInit, :type => "void (string)"
     publish :function => :startStore, :type => "void (string, map)"
     publish :function => :startHandle, :type => "symbol (string, map)"


Reply via email to