Merge pull request 'master' (#34) from Igor1/ubl-settings-datetime:master into develop

Reviewed-on: #34
pull/35/head
Dmitry Razumov 3 years ago
commit 861fe83a05

@ -122,11 +122,11 @@ int MainWindow::check_root(){
} }
void MainWindow::lacalization(){ void MainWindow::lacalization(){
txtDate->set_tooltip_text(_("Date of\nFormat: DD.MM.YYYY")); txtDate->set_tooltip_text(_("Date of\nFormat: DD.MM.YYYY"));
txtNtpServer->set_tooltip_text(_("Enter the name of the ntp server or its ip address.\nWhen entering multiple addresses, separate them with spaces.")); txtNtpServer->set_tooltip_text(_("Enter the name of the ntp-server or its ip-address.\nWhen entering multiple addresses, separate them with commas."));
lblSynchronizebChkGLob->set_text(_("Synchronize via NTP")); lblSynchronizebChkGLob->set_text(_("Synchronize via NTP"));
cbDhcp->append(_("By default")); cbDhcp->append(_("Default"));
cbDhcp->append(_("DHCP")); cbDhcp->append(_("DHCP"));
cbDhcp->append(_("Manually")); 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,8 +327,28 @@ 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[]={
this->call(cmd.c_str()); "!","\"","#","$","%","^","'","*","(",")","+",":",";","=","<",">","?",
"@","[","]","\\","{","}","|","~", " "
};
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());
}
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();

@ -218,7 +218,7 @@
<attribute name="font-desc" value="URW Gothic Semi-Bold 10"/> <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="14336"/> <attribute name="size" value="15360"/>
</attributes> </attributes>
</object> </object>
<packing> <packing>

@ -6,6 +6,9 @@
msgid "" msgid ""
msgstr "" msgstr ""
msgid "An invalid character is entered"
msgstr "Введён недопустимый символ"
msgid "Longyearbyen" msgid "Longyearbyen"
msgstr "Лонгйир" msgstr "Лонгйир"
@ -18,13 +21,13 @@ msgstr "Закрыть"
msgid "Active service detected\nAutomatic time and date synchronization service detected" msgid "Active service detected\nAutomatic time and date synchronization service detected"
msgstr "Обнаружен активный сервис\nавтоматической синхронизации времени и даты" msgstr "Обнаружен активный сервис\nавтоматической синхронизации времени и даты"
msgid "By default" msgid "Default"
msgstr "По умолчанию" msgstr "По умолчанию"
msgid "The program must be run with \nsuperuser privileges!" msgid "The program must be run with \nsuperuser privileges!"
msgstr "Программа должна быть запущена с правами \nсуперпользователя!" msgstr "Программа должна быть запущена с правами \nсуперпользователя!"
msgid "Manually" msgid "Manual"
msgstr "Вручную" msgstr "Вручную"
msgid "Enter DHCP!" msgid "Enter DHCP!"
@ -1593,6 +1596,6 @@ msgstr "Майотта"
msgid "BajaSur" msgid "BajaSur"
msgstr "Южная Нижняя Калифорния" msgstr "Южная Нижняя Калифорния"
msgid "Enter the name of the ntp server or its ip address.\nWhen entering multiple addresses, separate them with spaces." msgid "Enter the name of the ntp-server or its ip-address.\nWhen entering multiple addresses, separate them with commas."
msgstr "Введите имя ntp-сервера или его ip-адрес.\nПри вводе нескольких адресов, разделяйте их пробелами." msgstr "Введите имя ntp-сервера или его ip-адрес.\nПри вводе нескольких адресов, разделяйте их запятыми."

Loading…
Cancel
Save