Исправлен баг выбора в 'ручную' в Comboboxtext

pull/30/head
Igor Belitskiy 3 years ago
parent 8bd881a876
commit 06bee15e03

@ -258,7 +258,7 @@ void MainWindow::event(){
cbxSynchronizeNtpGlob->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::set_ntp_toggle_glob)); cbxSynchronizeNtpGlob->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::set_ntp_toggle_glob));
btnUpdateDateTime->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::wrapper_update_time_date)); btnUpdateDateTime->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::wrapper_update_time_date));
btnChooseDate->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::calendar_show)); btnChooseDate->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::calendar_show));
cbDhcp->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::event_entrycbDhcp)); cbDhcp->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::event_entry_cbDhcp));
cbRegion->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::append_zone)); cbRegion->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::append_zone));
cbRegionGlob->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::append_zone_glob)); cbRegionGlob->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::append_zone_glob));
cbZone->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::enter_zone)); cbZone->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::enter_zone));
@ -305,7 +305,7 @@ bool MainWindow::focus_ntp(GdkEventFocus* event){
return true; return true;
} }
void MainWindow::event_entrycbDhcp(){ void MainWindow::event_entry_cbDhcp(){
Glib::ustring str_dhcp = cbDhcp->get_active_text(); Glib::ustring str_dhcp = cbDhcp->get_active_text();
int activ_index = cbDhcp->get_active_row_number(); int activ_index = cbDhcp->get_active_row_number();
cout << activ_index << endl; cout << activ_index << endl;
@ -325,14 +325,14 @@ void MainWindow::event_entrycbDhcp(){
txtNtpServer->set_text(""); txtNtpServer->set_text("");
} }
else if (activ_index==2){ else if (activ_index==2){
txtNtpServer->set_sensitive(true);
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)") ){ if ((str_dhcp!="") && (str_dhcp!="(null)") && (str_dhcp!="default")){
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)"){
txtNtpServer->set_text(str_dhcp); txtNtpServer->set_text(str_dhcp);
} }
txtNtpServer->set_sensitive(true);
cbDhcp->set_active(activ_index); cbDhcp->set_active(activ_index);
} }
} }
@ -386,11 +386,18 @@ 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)")){ if ((str_dhcp!="") && (str_dhcp!="(null)")){
this->set_ntp_toggle_glob();
cbxSynchronizeNtpGlob->set_active(1); cbxSynchronizeNtpGlob->set_active(1);
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"){
cbDhcp->set_active(1);
txtNtpServer->set_text("");
txtNtpServer->set_sensitive(false);
}
else if (str_dhcp=="default"){
cbDhcp->set_active(0); cbDhcp->set_active(0);
txtNtpServer->set_text("");
txtNtpServer->set_sensitive(false); txtNtpServer->set_sensitive(false);
} }
else{ else{
@ -403,11 +410,11 @@ void MainWindow::enry_dhcp_mess(){
txtNtpServer->set_text(""); txtNtpServer->set_text("");
} }
else{ else{
cbDhcp->set_active(1); cbDhcp->set_active(2);
txtNtpServer->set_text(str_dhcp); txtNtpServer->set_text(str_dhcp);
txtNtpServer->set_sensitive(true);
} }
} }
this->set_ntp_toggle_glob();
} }
else{ else{
cbxSynchronizeNtpGlob->set_active(0); cbxSynchronizeNtpGlob->set_active(0);

@ -56,7 +56,7 @@ class MainWindow : public Gtk::ApplicationWindow {
void event(); void event();
void gui_mess_close(); void gui_mess_close();
bool focus_ntp(GdkEventFocus* event); bool focus_ntp(GdkEventFocus* event);
void event_entrycbDhcp(); void event_entry_cbDhcp();
void get_calendar(); void get_calendar();
void calendar_show(); void calendar_show();
void enry_dhcp_mess(); void enry_dhcp_mess();

Loading…
Cancel
Save