diff --git a/source/ubl-settings-datetime.cc b/source/ubl-settings-datetime.cc index 46359d0..b12414e 100755 --- a/source/ubl-settings-datetime.cc +++ b/source/ubl-settings-datetime.cc @@ -530,61 +530,21 @@ void MainWindow::save_global_local_cfg() { lblWarning->set_text(nothing_save); } else { - string cmd = ""; - string cmd_default = ""; - string cmd_dhcp = ""; - string cmd_set_ntp = ""; - string remove = ""; - string local = ""; - string hw = ""; - string remove_ntp = ""; - string cmd_zone = ""; - if (flag_local == false) {} - if (flag_global == false) {} - if ((this->check_config("region", 0) == false || this->check_config("zone", 0) == false)) { - if (flag_local == false) { - cmd_zone = set_system_ZONE; - this->enter_zone(cmd_zone); - } - } + string cmd = set_all_ZONE; + string cmd_default = set_all_NTPSERVERS_default; + string cmd_dhcp = set_all_NTPSERVERS_dhcp; + string cmd_set_ntp = set_all_NTPSERVERS; + string remove_ntp = remove_all_NTPSERVERS; + string local = set_all_HWCLOCK_SYNC_localtime; + string hw = set_all_HWCLOCK_SYNC_utc; if ((this->check_config("region", 1) == false || this->check_config("zone", 1) == false)) { - if (flag_global == false) { - cmd_zone = set_global_ZONE; - this->enter_zone(cmd_zone); - } - } - - if (this->check_config("dhcp", 0) == false) { - if (flag_local == false) { - cmd_default = set_system_NTPSERVERS_default; - cmd_dhcp = set_system_NTPSERVERS_dhcp; - cmd_set_ntp = set_system_NTPSERVERS; - remove_ntp = remove_system_NTPSERVERS; - this->save_Dhcp(cmd_default, cmd_dhcp, remove_ntp, cmd_set_ntp); - } - } - if (this->check_config("dhcp", 1) == false) { - if (flag_global == false) { - cmd_default = set_global_NTPSERVERS_default; - cmd_dhcp = set_global_NTPSERVERS_dhcp; - cmd_set_ntp = set_global_NTPSERVERS; - remove_ntp = remove_global_NTPSERVERS; - this->save_Dhcp(cmd_default, cmd_dhcp, remove_ntp, cmd_set_ntp); - } + this->enter_zone(cmd); } - if (this->check_config("hw", 0) == false) { - if (flag_local == false) { - local = set_system_HWCLOCK_SYNC_localtime; - hw = set_system_HWCLOCK_SYNC_utc; - this->set_hardware_clock(local, hw); - } + if (this->check_config("dhcp", 1) == false) { + this->save_Dhcp(cmd_default, cmd_dhcp, remove_ntp, cmd_set_ntp); } if (this->check_config("hw", 1) == false) { - if (flag_global == false) { - local = set_global_HWCLOCK_SYNC_localtime; - hw = set_global_HWCLOCK_SYNC_utc; - this->set_hardware_clock(local, hw); - } + this->set_hardware_clock(local, hw); } map_config_data_global_old = map_config_data_global; map_config_data_local_old = map_config_data_local; diff --git a/source/ubl-settings-datetime.h b/source/ubl-settings-datetime.h index c23b895..c585869 100644 --- a/source/ubl-settings-datetime.h +++ b/source/ubl-settings-datetime.h @@ -41,12 +41,21 @@ #define set_global_HWCLOCK_SYNC_localtime "ubconfig --target global set clock HWCLOCK_SYNC=localtime" #define set_system_HWCLOCK_SYNC_localtime "ubconfig --target system set clock HWCLOCK_SYNC=localtime" #define set_system_HWCLOCK_SYNC_utc "ubconfig --target system set clock HWCLOCK_SYNC=utc" -#define remove_global_NTPSERVERS "ubconfig --target global --noexecute set/remove network NTPSERVERS" +#define remove_global_NTPSERVERS "ubconfig --target global --noexecute remove network NTPSERVERS" #define set_system_NTPSERVERS_default "ubconfig --target system set network NTPSERVERS=default" #define set_system_NTPSERVERS_dhcp "ubconfig --target system set network NTPSERVERS=dhcp" #define set_system_NTPSERVERS "ubconfig --target system set network NTPSERVERS=\"" -#define remove_system_NTPSERVERS "ubconfig --target system --noexecute set/remove network NTPSERVERS" +#define remove_system_NTPSERVERS "ubconfig --target system --noexecute remove network NTPSERVERS" #define set_global_ZONE "ubconfig --target global set clock ZONE=" + +#define set_all_ZONE "ubconfig --noexecute set clock ZONE=" +#define set_all_NTPSERVERS_default "ubconfig --noexecute set network NTPSERVERS=default" +#define set_all_NTPSERVERS_dhcp "ubconfig --noexecute set network NTPSERVERS=dhcp" +#define set_all_NTPSERVERS "ubconfig --noexecute set network NTPSERVERS=\"" +#define remove_all_NTPSERVERS "ubconfig --noexecute remove network NTPSERVERS" +#define set_all_HWCLOCK_SYNC_localtime "ubconfig --noexecute set clock HWCLOCK_SYNC=localtime" +#define set_all_HWCLOCK_SYNC_utc "ubconfig --noexecute set clock HWCLOCK_SYNC=utc" + #define set_global_NTPSERVERS_default "ubconfig --target global set network NTPSERVERS=default" #define set_global_NTPSERVERS_dhcp "ubconfig --target global set network NTPSERVERS=dhcp" #define set_global_NTPSERVERS "ubconfig --target global set network NTPSERVERS=\""