diff --git a/source/ubl-settings-datetime.cc b/source/ubl-settings-datetime.cc
index 87ca41d..9639378 100644
--- a/source/ubl-settings-datetime.cc
+++ b/source/ubl-settings-datetime.cc
@@ -122,11 +122,11 @@ int MainWindow::check_root(){
}
void MainWindow::lacalization(){
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"));
- cbDhcp->append(_("By default"));
+ cbDhcp->append(_("Default"));
cbDhcp->append(_("DHCP"));
- cbDhcp->append(_("Manually"));
+ cbDhcp->append(_("Manual"));
lblDateTimeSetting->set_text(_("Local Configuration"));
lblHead->set_text(_("Settings the date and time"));
lblTime->set_text(_("Time"));
@@ -327,8 +327,28 @@ bool MainWindow::focus_ntp(GdkEventFocus* event){
}
else{
string cmd = "";
- cmd = "/usr/bin/ubconfig set network NTPSERVERS=" + txtNtpServer->get_text();
- this->call(cmd.c_str());
+ 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());
+ }
+ else{
+ lblMessage->set_text(_("An invalid character is entered"));
+ mess_dchp->show();
+ }
}
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(0,str_dhcp.find("\n"));
if (str_dhcp!="dhcp" && str_dhcp!="(null)"){
- txtNtpServer->set_text(str_dhcp);
+ txtNtpServer->set_text("");
}
cbDhcp->set_active(activ_index);
}
@@ -439,7 +459,7 @@ void MainWindow::enry_dhcp_mess(){
}
else if (str_dhcp=="default"){
cbDhcp->set_active(0);
- txtNtpServer->set_text(str_dhcp);
+ txtNtpServer->set_text("");
txtNtpServer->set_sensitive(false);
}
else{
@@ -656,7 +676,7 @@ void MainWindow::append_zone_glob(){
cbZoneGlob->set_active(0);
}
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);
if (response.length()==0){
this->update_time_date();
diff --git a/ubl-settings-datetime.glade b/ubl-settings-datetime.glade
index 0c04dfe..32570d0 100644
--- a/ubl-settings-datetime.glade
+++ b/ubl-settings-datetime.glade
@@ -218,7 +218,7 @@
-
+
diff --git a/ubl-settings-datetime_ru.po b/ubl-settings-datetime_ru.po
index 5b04ae9..caecef2 100644
--- a/ubl-settings-datetime_ru.po
+++ b/ubl-settings-datetime_ru.po
@@ -6,6 +6,9 @@
msgid ""
msgstr ""
+msgid "An invalid character is entered"
+msgstr "Введён недопустимый символ"
+
msgid "Longyearbyen"
msgstr "Лонгйир"
@@ -18,13 +21,13 @@ msgstr "Закрыть"
msgid "Active service detected\nAutomatic time and date synchronization service detected"
msgstr "Обнаружен активный сервис\nавтоматической синхронизации времени и даты"
-msgid "By default"
+msgid "Default"
msgstr "По умолчанию"
msgid "The program must be run with \nsuperuser privileges!"
msgstr "Программа должна быть запущена с правами \nсуперпользователя!"
-msgid "Manually"
+msgid "Manual"
msgstr "Вручную"
msgid "Enter DHCP!"
@@ -1593,6 +1596,6 @@ msgstr "Майотта"
msgid "BajaSur"
msgstr "Южная Нижняя Калифорния"
-msgid "Enter the name of the ntp server or its ip address.\nWhen entering multiple addresses, separate them with spaces."
-msgstr "Введите имя ntp-сервера или его ip-адрес.\nПри вводе нескольких адресов, разделяйте их пробелами."
+msgid "Enter the name of the ntp-server or its ip-address.\nWhen entering multiple addresses, separate them with commas."
+msgstr "Введите имя ntp-сервера или его ip-адрес.\nПри вводе нескольких адресов, разделяйте их запятыми."