@ -122,11 +122,11 @@ int MainWindow::check_root(){
}
}
void MainWindow : : lacalization ( ) {
void MainWindow : : lacalization ( ) {
txtDate - > set_tooltip_text ( _ ( " Date of \n Format: DD.MM.YYYY " ) ) ;
txtDate - > set_tooltip_text ( _ ( " Date of \n Format: DD.MM.YYYY " ) ) ;
txtNtpServer - > set_tooltip_text ( _ ( " Enter the name of the ntp server or its ip address.\n When entering multiple addresses, separate them with space s." ) ) ;
txtNtpServer - > set_tooltip_text ( _ ( " Enter the name of the ntp -server or its ip-address.\n When entering multiple addresses, separate them with comma s." ) ) ;
lblSynchronizebChkGLob - > set_text ( _ ( " Synchronize via NTP " ) ) ;
lblSynchronizebChkGLob - > set_text ( _ ( " Synchronize via NTP " ) ) ;
cbDhcp - > append ( _ ( " By d efault" ) ) ;
cbDhcp - > append ( _ ( " D efault" ) ) ;
cbDhcp - > append ( _ ( " DHCP " ) ) ;
cbDhcp - > append ( _ ( " DHCP " ) ) ;
cbDhcp - > append ( _ ( " Manual ly " ) ) ;
cbDhcp - > append ( _ ( " Manual " ) ) ;
lblDateTimeSetting - > set_text ( _ ( " Local Configuration " ) ) ;
lblDateTimeSetting - > set_text ( _ ( " Local Configuration " ) ) ;
lblHead - > set_text ( _ ( " Settings the date and time " ) ) ;
lblHead - > set_text ( _ ( " Settings the date and time " ) ) ;
lblTime - > set_text ( _ ( " Time " ) ) ;
lblTime - > set_text ( _ ( " Time " ) ) ;
@ -327,9 +327,29 @@ bool MainWindow::focus_ntp(GdkEventFocus* event){
}
}
else {
else {
string cmd = " " ;
string cmd = " " ;
cmd = " /usr/bin/ubconfig set network NTPSERVERS= " + txtNtpServer - > get_text ( ) ;
string array_simvol [ ] = {
" ! " , " \" " , " # " , " $ " , " % " , " ^ " , " ' " , " * " , " ( " , " ) " , " + " , " : " , " ; " , " = " , " < " , " > " , " ? " ,
" @ " , " [ " , " ] " , " \\ " , " { " , " } " , " | " , " ~ " , " "
} ;
bool flag_error = false ;
string str_ntp = txtNtpServer - > get_text ( ) ;
for ( const auto & simvol : array_simvol ) {
if ( str_ntp . find ( simvol ) ! = std : : string : : npos ) {
cout < < simvol < < 2222 < < endl ;
flag_error = true ;
break ;
}
}
if ( flag_error = = false ) {
cmd = " /usr/bin/ubconfig set network NTPSERVERS= \" " + str_ntp + " \" " ;
this - > call ( cmd . c_str ( ) ) ;
this - > call ( cmd . c_str ( ) ) ;
}
}
else {
lblMessage - > set_text ( _ ( " An invalid character is entered " ) ) ;
mess_dchp - > show ( ) ;
}
}
return true ;
return true ;
}
}
@ -364,7 +384,7 @@ void MainWindow::event_entry_cbDhcp(){
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 ( " " ) ;
}
}
cbDhcp - > set_active ( activ_index ) ;
cbDhcp - > set_active ( activ_index ) ;
}
}
@ -439,7 +459,7 @@ void MainWindow::enry_dhcp_mess(){
}
}
else if ( str_dhcp = = " default " ) {
else if ( str_dhcp = = " default " ) {
cbDhcp - > set_active ( 0 ) ;
cbDhcp - > set_active ( 0 ) ;
txtNtpServer - > set_text ( str_dhcp ) ;
txtNtpServer - > set_text ( " " ) ;
txtNtpServer - > set_sensitive ( false ) ;
txtNtpServer - > set_sensitive ( false ) ;
}
}
else {
else {
@ -656,7 +676,7 @@ void MainWindow::append_zone_glob(){
cbZoneGlob - > set_active ( 0 ) ;
cbZoneGlob - > set_active ( 0 ) ;
}
}
void MainWindow : : wrapper_update_time_date ( ) {
void MainWindow : : wrapper_update_time_date ( ) {
string cmd = " pidof systemd-timesyncd ntpd chronyd " ;
string cmd = " pidof systemd-timesyncd ntpd chronyd ntpdate openntpd ptp4l phc2sys " ;
string response = this - > call ( cmd ) ;
string response = this - > call ( cmd ) ;
if ( response . length ( ) = = 0 ) {
if ( response . length ( ) = = 0 ) {
this - > update_time_date ( ) ;
this - > update_time_date ( ) ;