Исправлены баги с выводом информации об ошибках

pull/55/head
Igor Belitskiy 3 years ago
parent ea140dd2d3
commit 34484f7538

@ -308,9 +308,11 @@ void MainWindow::event(){
}
void MainWindow::synopsis_show(){
int start_error = error_info;
//wrapper_system("xdg-open https://wiki.ublinux.ru/ru/home");
error_info=0;
warning_info=0;
if (start_error!=error_info){
error_info=start_error;
}
}
void MainWindow::download_local_cfg(){
@ -336,13 +338,12 @@ void MainWindow::download_globl_cfg(){
void MainWindow::save_local_cfg(){
string cmd = "ubconfig --target system set clock ZONE=";
this->enter_zone(cmd);
info_warning_error(2);
string cmd_default = "/usr/bin/ubconfig --target system set network NTPSERVERS=default";
string cmd_dhcp = "/usr/bin/ubconfig --target system set network NTPSERVERS=dhcp";
string cmd_set_ntp = "/usr/bin/ubconfig --target system set network NTPSERVERS=\"";
string remove = "/usr/bin/ubconfig --target system remove network NTPSERVERS";
this->save_Dhcp(cmd_default, cmd_dhcp, remove, cmd_set_ntp);
info_warning_error(2);
}
void MainWindow::save_global_cfg(){
@ -358,7 +359,6 @@ void MainWindow::save_global_cfg(){
void MainWindow::save_global_local_cfg(){
string cmd = "ubconfig --target system set clock ZONE=";
this->enter_zone(cmd);
info_warning_error(4);
cmd = "/usr/bin/ubconfig --target global set clock ZONE=";
this->enter_zone(cmd);
string cmd_default = "/usr/bin/ubconfig --target global set network NTPSERVERS=default";
@ -366,12 +366,12 @@ void MainWindow::save_global_local_cfg(){
string cmd_set_ntp = "/usr/bin/ubconfig --target global set network NTPSERVERS=\"";
string remove = "/usr/bin/ubconfig --target global remove network NTPSERVERS";
this->save_Dhcp(cmd_default, cmd_dhcp, remove, cmd_set_ntp);
cmd_default = "/usr/bin/ubconfig --target system set network NTPSERVERS=default";
cmd_dhcp = "/usr/bin/ubconfig --target system set network NTPSERVERS=dhcp";
cmd_set_ntp = "/usr/bin/ubconfig --target system set network NTPSERVERS=\"";
remove = "/usr/bin/ubconfig --target system remove network NTPSERVERS";
this->save_Dhcp(cmd_default, cmd_dhcp, remove, cmd_set_ntp);
info_warning_error(4);
}
void MainWindow::info_warning_error(int mess){
@ -419,6 +419,7 @@ void MainWindow::info_warning_error(int mess){
void MainWindow::stop_ntp(){
int start_error = error_info;
string cmd = "SEL_SERVICE=\"systemd-timesyncd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service; ";
wrapper_system(cmd);
cmd ="SEL_SERVICE=\"ntpd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; ";
@ -433,7 +434,10 @@ void MainWindow::stop_ntp(){
wrapper_system(cmd);
cmd ="SEL_SERVICE=\"phc2sys\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE} ";
wrapper_system(cmd);
if (start_error!=error_info){
error_info=start_error;
}
cout << error_info << endl;
}
void MainWindow::wrapper_system(string cmd){
@ -477,7 +481,6 @@ bool MainWindow::focus_ntp(string &cmd_set_ntp){
}
if ((flag_error==false) && (flag_error_check_ntp==false)){
cmd = cmd_set_ntp + str_ntp + "\"";
//cmd = "/usr/bin/ubconfig set network NTPSERVERS=\"" + str_ntp + "\"";
wrapper_system(cmd);
}
else{
@ -635,20 +638,20 @@ void MainWindow::save_Dhcp(string &cmd_default, string &cmd_dhcp, string &remove
}
else if (activ_index==0){
//string cmd = "/usr/bin/ubconfig set network NTPSERVERS=default";
wrapper_system(cmd_default);
}
else if (activ_index==1){
//string cmd = "/usr/bin/ubconfig set network NTPSERVERS=dhcp";
wrapper_system(cmd_dhcp);
}
else if (activ_index==2){
this->focus_ntp(cmd_set_ntp);
//this->focus_ntp("/usr/bin/ubconfig set network NTPSERVERS=\"");
}
else if (activ_index==3){
//string cmd = "/usr/bin/ubconfig remove network NTPSERVERS";
int start_error = error_info;
wrapper_system(remove);
if (start_error != error_info){
error_info=start_error;
}
}
}
@ -678,7 +681,6 @@ void MainWindow::entry_dhcp_mess(string cmd_get_dhcp, string cmd_default_get_dhc
}
else{
if (obj_result.error==2){
error_info-=1;
warning_info-=1;
}
//string error = "";
@ -709,6 +711,7 @@ void MainWindow::entry_dhcp_mess(string cmd_get_dhcp, string cmd_default_get_dhc
txtNtpServer->set_text("");
txtNtpServer->set_sensitive(false);
btnUpdateDateTime->set_sensitive(true);
warning_info-=1;
}
}
@ -903,11 +906,10 @@ void MainWindow::append_region_zone(string region, string zone, Gtk::ComboBoxTex
}
}
if (region=="Etc" && zone==""){
error_info-=1;
warning_info-=1;
}
else if (region==""){
error_info+=1;
warning_info+=1;
}
}

Loading…
Cancel
Save