Merge branch 'develop'

pull/97/head
Igor Belitskiy 3 years ago
commit 742c44ce0a

@ -454,6 +454,9 @@ void MainWindow::save_local_cfg() {
info_warning_error(2); info_warning_error(2);
map_config_data_local_old = map_config_data_local; map_config_data_local_old = map_config_data_local;
flag_local = true; flag_local = true;
if (flag_global and flag_local){
map_config_data_global_local_old = map_config_data_global_local;
}
} }
} }
@ -482,6 +485,9 @@ void MainWindow::save_global_cfg() {
info_warning_error(3); info_warning_error(3);
map_config_data_global_old = map_config_data_global; map_config_data_global_old = map_config_data_global;
flag_global = true; flag_global = true;
if (flag_global and flag_local){
map_config_data_global_local_old = map_config_data_global_local;
}
} }
} }
void MainWindow::save_global_local_cfg() { void MainWindow::save_global_local_cfg() {
@ -500,34 +506,49 @@ void MainWindow::save_global_local_cfg() {
string remove_ntp = ""; string remove_ntp = "";
string cmd_zone = ""; string cmd_zone = "";
if ((this->check_config("region", 2) == false || this->check_config("zone", 2) == false)) { if ((this->check_config("region", 2) == false || this->check_config("zone", 2) == false)) {
if (flag_local == false) {
cmd_zone = "ubconfig --target system set clock ZONE="; cmd_zone = "ubconfig --target system set clock ZONE=";
this->enter_zone(cmd_zone); this->enter_zone(cmd_zone);
}
if (flag_global == false) {
cmd_zone = "ubconfig --target global set clock ZONE="; cmd_zone = "ubconfig --target global set clock ZONE=";
this->enter_zone(cmd_zone); this->enter_zone(cmd_zone);
} }
}
if (this->check_config("dhcp", 2) == false) { if (this->check_config("dhcp", 2) == false) {
if (flag_local == false) {
cmd_default = "ubconfig --target system set network NTPSERVERS=default"; cmd_default = "ubconfig --target system set network NTPSERVERS=default";
cmd_dhcp = "ubconfig --target system set network NTPSERVERS=dhcp"; cmd_dhcp = "ubconfig --target system set network NTPSERVERS=dhcp";
cmd_set_ntp = "ubconfig --target system set network NTPSERVERS=\""; cmd_set_ntp = "ubconfig --target system set network NTPSERVERS=\"";
remove_ntp = "ubconfig --target system remove network NTPSERVERS"; remove_ntp = "ubconfig --target system remove network NTPSERVERS";
this->save_Dhcp(cmd_default, cmd_dhcp, remove_ntp, cmd_set_ntp); this->save_Dhcp(cmd_default, cmd_dhcp, remove_ntp, cmd_set_ntp);
}
if (flag_global == false) {
cmd_default = "ubconfig --target global set network NTPSERVERS=default"; cmd_default = "ubconfig --target global set network NTPSERVERS=default";
cmd_dhcp = "ubconfig --target global set network NTPSERVERS=dhcp"; cmd_dhcp = "ubconfig --target global set network NTPSERVERS=dhcp";
cmd_set_ntp = "ubconfig --target global set network NTPSERVERS=\""; cmd_set_ntp = "ubconfig --target global set network NTPSERVERS=\"";
remove_ntp = "ubconfig --target global remove network NTPSERVERS"; remove_ntp = "ubconfig --target global remove network NTPSERVERS";
this->save_Dhcp(cmd_default, cmd_dhcp, remove_ntp, cmd_set_ntp); this->save_Dhcp(cmd_default, cmd_dhcp, remove_ntp, cmd_set_ntp);
} }
}
if (this->check_config("hw", 2) == false) { if (this->check_config("hw", 2) == false) {
if (flag_local == false) {
local = "ubconfig --target system set clock HWCLOCK_SYNC=localtime"; local = "ubconfig --target system set clock HWCLOCK_SYNC=localtime";
hw = "ubconfig --target system set clock HWCLOCK_SYNC=utc"; hw = "ubconfig --target system set clock HWCLOCK_SYNC=utc";
this->set_hardware_clock(local, hw); this->set_hardware_clock(local, hw);
}
if (flag_global == false) {
local = "ubconfig --target global set clock HWCLOCK_SYNC=localtime"; local = "ubconfig --target global set clock HWCLOCK_SYNC=localtime";
hw = "ubconfig --target global set clock HWCLOCK_SYNC=utc"; hw = "ubconfig --target global set clock HWCLOCK_SYNC=utc";
this->set_hardware_clock(local, hw); this->set_hardware_clock(local, hw);
} }
}
map_config_data_global_local_old = map_config_data_global_local; map_config_data_global_local_old = map_config_data_global_local;
map_config_data_global_old = map_config_data_global;
map_config_data_local_old = map_config_data_local;
info_warning_error(4); info_warning_error(4);
flag_global_local = true; flag_global_local = true;
} }
} }
@ -562,12 +583,21 @@ bool MainWindow::check_config(string key, int key_save) {
std::map <string, string>:: iterator iter_map_config_data_old; std::map <string, string>:: iterator iter_map_config_data_old;
std::map <string, string> map_config_data; std::map <string, string> map_config_data;
std::map <string, string> map_config_data_old; std::map <string, string> map_config_data_old;
if (key_save == 0 && flag_local == true) { if ((key_save == 0 || key_save == 1) && flag_global_local == true) {
map_config_data_global_local_old = map_config_data_global_local;
map_config_data_global_old = map_config_data_global;
map_config_data_local_old = map_config_data_local;
return true;
}
else if (key_save == 0 && flag_local == true) {
return true; return true;
} }
else if (key_save == 1 && flag_global == true) { else if (key_save == 1 && flag_global == true) {
return true; return true;
} }
else if (key_save == 2 && flag_global == true && flag_local == true) {
return true;
}
else if (key_save == 2 && flag_global_local == true) { else if (key_save == 2 && flag_global_local == true) {
return true; return true;
} }
@ -598,7 +628,7 @@ bool MainWindow::check_config(string key, int key_save) {
return false; return false;
} }
else if (iter_map_config_data->second.length() == 0 || iter_map_config_data_old->second.length() == 0) { else if (iter_map_config_data->second.length() == 0 || iter_map_config_data_old->second.length() == 0) {
return false; return true;
} }
else if (iter_map_config_data->second == iter_map_config_data_old->second) { else if (iter_map_config_data->second == iter_map_config_data_old->second) {
return true; return true;

Loading…
Cancel
Save