diff --git a/source/ubl-settings-datetime.cc b/source/ubl-settings-datetime.cc index 89b2d19..ac46b29 100644 --- a/source/ubl-settings-datetime.cc +++ b/source/ubl-settings-datetime.cc @@ -383,7 +383,7 @@ void MainWindow::event_entry_cbDhcp(){ txtNtpServer->set_text(""); } 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(0,str_dhcp.find("\n")); if (str_dhcp!="dhcp" && str_dhcp!="(null)"){ @@ -450,9 +450,11 @@ void MainWindow::calendar_show(){ void MainWindow::enry_dhcp_mess(){ string str_dhcp = this->call("/usr/bin/ubconfig get network NTPSERVERS"); - if ((str_dhcp!="") && (str_dhcp!="(null)")){ - cbxSynchronizeNtpGlob->set_active(1); - this->set_ntp_toggle_glob(); + cout << str_dhcp << endl; + if (str_dhcp.find("(null)")==std::string::npos){ + + 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(0,str_dhcp.find("\n")); if (str_dhcp=="dhcp"){ @@ -482,9 +484,10 @@ void MainWindow::enry_dhcp_mess(){ } } else{ - cbxSynchronizeNtpGlob->set_active(0); - cbDhcp->set_sensitive(0); - txtNtpServer->set_sensitive(0); + cout << 2222 << endl; + cbxSynchronizeNtpGlob->set_active(false); + cbDhcp->set_sensitive(false); + txtNtpServer->set_sensitive(false); } } @@ -602,14 +605,16 @@ void MainWindow::set_ntp_toggle_glob(){ if (flag==false){ system("/usr/bin/ubconfig remove network NTPSERVERS"); cbDhcp->set_sensitive(false); + txtNtpServer->set_text(""); txtNtpServer->set_sensitive(false); + } else{ cbDhcp->set_sensitive(true); - int activ_index = cbDhcp->get_active_row_number(); - if (activ_index==2){ - txtNtpServer->set_sensitive(true); - } + system("/usr/bin/ubconfig set network NTPSERVERS=dhcp"); + cbDhcp->set_active(1); + txtNtpServer->set_text(""); + txtNtpServer->set_sensitive(false); } }