Исправлены баги с галкой dhcp

pull/46/head
Igor Belitskiy 3 years ago
parent eb93a6c263
commit df0d0af3ee

@ -383,7 +383,7 @@ void MainWindow::event_entry_cbDhcp(){
txtNtpServer->set_text(""); txtNtpServer->set_text("");
} }
string str_dhcp = this->call("/usr/bin/ubconfig get network NTPSERVERS"); string str_dhcp = this->call("/usr/bin/ubconfig get network NTPSERVERS");
if ((str_dhcp!="") && (str_dhcp!="(null)") && (str_dhcp.find("default")==std::string::npos)){ if ((str_dhcp.find("(null)")==std::string::npos) && (str_dhcp.find("default")==std::string::npos)){
str_dhcp = str_dhcp.substr(str_dhcp.find("=")+1,str_dhcp.length()); str_dhcp = str_dhcp.substr(str_dhcp.find("=")+1,str_dhcp.length());
str_dhcp = str_dhcp.substr(0,str_dhcp.find("\n")); str_dhcp = str_dhcp.substr(0,str_dhcp.find("\n"));
if (str_dhcp!="dhcp" && str_dhcp!="(null)"){ if (str_dhcp!="dhcp" && str_dhcp!="(null)"){
@ -450,9 +450,11 @@ void MainWindow::calendar_show(){
void MainWindow::enry_dhcp_mess(){ void MainWindow::enry_dhcp_mess(){
string str_dhcp = this->call("/usr/bin/ubconfig get network NTPSERVERS"); string str_dhcp = this->call("/usr/bin/ubconfig get network NTPSERVERS");
if ((str_dhcp!="") && (str_dhcp!="(null)")){ cout << str_dhcp << endl;
cbxSynchronizeNtpGlob->set_active(1); if (str_dhcp.find("(null)")==std::string::npos){
this->set_ntp_toggle_glob();
cbxSynchronizeNtpGlob->set_active(true);
//this->set_ntp_toggle_glob();
str_dhcp = str_dhcp.substr(str_dhcp.find("=")+1,str_dhcp.length()); str_dhcp = str_dhcp.substr(str_dhcp.find("=")+1,str_dhcp.length());
str_dhcp = str_dhcp.substr(0,str_dhcp.find("\n")); str_dhcp = str_dhcp.substr(0,str_dhcp.find("\n"));
if (str_dhcp=="dhcp"){ if (str_dhcp=="dhcp"){
@ -482,9 +484,10 @@ void MainWindow::enry_dhcp_mess(){
} }
} }
else{ else{
cbxSynchronizeNtpGlob->set_active(0); cout << 2222 << endl;
cbDhcp->set_sensitive(0); cbxSynchronizeNtpGlob->set_active(false);
txtNtpServer->set_sensitive(0); cbDhcp->set_sensitive(false);
txtNtpServer->set_sensitive(false);
} }
} }
@ -602,14 +605,16 @@ void MainWindow::set_ntp_toggle_glob(){
if (flag==false){ if (flag==false){
system("/usr/bin/ubconfig remove network NTPSERVERS"); system("/usr/bin/ubconfig remove network NTPSERVERS");
cbDhcp->set_sensitive(false); cbDhcp->set_sensitive(false);
txtNtpServer->set_text("");
txtNtpServer->set_sensitive(false); txtNtpServer->set_sensitive(false);
} }
else{ else{
cbDhcp->set_sensitive(true); cbDhcp->set_sensitive(true);
int activ_index = cbDhcp->get_active_row_number(); system("/usr/bin/ubconfig set network NTPSERVERS=dhcp");
if (activ_index==2){ cbDhcp->set_active(1);
txtNtpServer->set_sensitive(true); txtNtpServer->set_text("");
} txtNtpServer->set_sensitive(false);
} }
} }

Loading…
Cancel
Save