Исправлен баг в выводом Null в поле ввода ntpserver и баг с блокировкой flag_datetime

pull/18/head
Igor Belitskiy 3 years ago
parent 1d03479984
commit 07c22ff695

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 33 KiB

@ -104,6 +104,15 @@ void MainWindow::flag_block_gui(){
//_numTimeMin->set_sensitive(false); //_numTimeMin->set_sensitive(false);
//_txtDate->set_sensitive(false); //_txtDate->set_sensitive(false);
_btnUpdateDateTime->set_sensitive(false); _btnUpdateDateTime->set_sensitive(false);
_numTimeHrs->set_sensitive(false);
_numTimeMin->set_sensitive(false);
_btnChooseDate->set_sensitive(false);
_txtDate->set_sensitive(false);
_lblTimeBios->set_sensitive(false);
_btnHardwareTime->set_sensitive(false);
_lblTime->set_sensitive(false);
_lblData->set_sensitive(false);
//_cbxSynchronizeNtp->set_sensitive(false);
} }
if (flag_timezone==true){ if (flag_timezone==true){
_cbRegion->set_sensitive(false); _cbRegion->set_sensitive(false);
@ -204,7 +213,7 @@ void MainWindow::event(){
void MainWindow::set_ntp_toggle(){ void MainWindow::set_ntp_toggle(){
bool flag = _cbxSynchronizeNtp->get_active(); bool flag = _cbxSynchronizeNtp->get_active();
if (flag_ntp==true){ if (flag_ntp==true || flag_datetime==true){
} }
else { else {
_numTimeHrs->set_sensitive(!flag); _numTimeHrs->set_sensitive(!flag);
@ -212,6 +221,9 @@ void MainWindow::set_ntp_toggle(){
_btnChooseDate->set_sensitive(!flag); _btnChooseDate->set_sensitive(!flag);
_txtDate->set_sensitive(!flag); _txtDate->set_sensitive(!flag);
_lblTimeBios->set_sensitive(!flag); _lblTimeBios->set_sensitive(!flag);
_btnUpdateDateTime->set_sensitive(!flag);
_lblTime->set_sensitive(!flag);
_lblData->set_sensitive(!flag);
} }
string cmd = ""; string cmd = "";
if (flag==false){ if (flag==false){
@ -251,6 +263,8 @@ bool MainWindow::focus_ntp(GdkEventFocus* event){
void MainWindow::event_entry_cbDhcp(){ void MainWindow::event_entry_cbDhcp(){
Glib::ustring str_dhcp = _cbDhcp->get_active_text(); Glib::ustring str_dhcp = _cbDhcp->get_active_text();
int index_activ = _cbDhcp->get_entry_text_column();
cout << index_activ << endl;
if (str_dhcp.length()!=0){ if (str_dhcp.length()!=0){
if (str_dhcp=="DHCP"){ if (str_dhcp=="DHCP"){
string cmd = "/usr/bin/ubconfig set network NTPSERVERS=dhcp"; string cmd = "/usr/bin/ubconfig set network NTPSERVERS=dhcp";
@ -264,7 +278,7 @@ void MainWindow::event_entry_cbDhcp(){
if ((str_dhcp!="") && (str_dhcp!="(null)") ){ if ((str_dhcp!="") && (str_dhcp!="(null)") ){
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" && str_dhcp!="(null)"){
_txtNtpServer->set_text(str_dhcp); _txtNtpServer->set_text(str_dhcp);
} }
_txtNtpServer->set_sensitive(true); _txtNtpServer->set_sensitive(true);
@ -333,6 +347,10 @@ void MainWindow::enry_dhcp_mess(){
_lblMessage->set_text(gettext("Enter DHCP !")); _lblMessage->set_text(gettext("Enter DHCP !"));
_mess_dchp->show(); _mess_dchp->show();
} }
else if (str_dhcp=="(null)"){
_cbDhcp->set_active(0);
_txtNtpServer->set_text("");
}
else{ else{
_cbDhcp->set_active(1); _cbDhcp->set_active(1);
_txtNtpServer->set_text(str_dhcp); _txtNtpServer->set_text(str_dhcp);
@ -426,12 +444,15 @@ void MainWindow::enter_zone_glob(){
} }
void MainWindow::set_ntp_toggle_glob(){ void MainWindow::set_ntp_toggle_glob(){
bool flag = _cbxSynchronizeNtp->get_active(); bool flag = _cbxSynchronizeNtpGlob->get_active();
if (flag==false){ if (flag==false){
system("/usr/bin/ubconfig remove network NTPSERVERS"); system("/usr/bin/ubconfig remove network NTPSERVERS");
_cbDhcp->set_sensitive(false);
_txtNtpServer->set_sensitive(false);
} }
else{ else{
_cbDhcp->set_sensitive(true);
_txtNtpServer->set_sensitive(true);
} }
} }

@ -131,9 +131,10 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Настройки даты и времени</property> <property name="label" translatable="yes">Настройки даты и времени</property>
<attributes> <attributes>
<attribute name="font-desc" value="URW Gothic Semi-Bold 10"/>
<attribute name="weight" value="bold"/> <attribute name="weight" value="bold"/>
<attribute name="foreground" value="#000023233232"/> <attribute name="foreground" value="#000023233232"/>
<attribute name="size" value="12288"/> <attribute name="size" value="14336"/>
</attributes> </attributes>
</object> </object>
<packing> <packing>

Loading…
Cancel
Save