From b3c3a948d77724e17abe1cf4afb79e88bb2ab923 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Fri, 10 Feb 2023 20:53:43 +0600 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20tooltip,=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/ubl-settings-datetime.cc | 28 +++++++++++++++------------- ubl-settings-datetime.glade | 1 + ubl-settings-datetime_ru.po | 3 +++ 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/source/ubl-settings-datetime.cc b/source/ubl-settings-datetime.cc index f4eecf6..87ca41d 100644 --- a/source/ubl-settings-datetime.cc +++ b/source/ubl-settings-datetime.cc @@ -122,6 +122,7 @@ 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.")); lblSynchronizebChkGLob->set_text(_("Synchronize via NTP")); cbDhcp->append(_("By default")); cbDhcp->append(_("DHCP")); @@ -290,15 +291,21 @@ void MainWindow::wind_close_ntp(){ void MainWindow::stop_ntp(){ windowsNnpClose->hide(); - string cmd = "SEL_SERVICE=\"systemd-timesyncd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service; " - "SEL_SERVICE=\"ntpd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; " - "SEL_SERVICE=\"ntpdate\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; " - "SEL_SERVICE=\"chronyd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; " - "SEL_SERVICE=\"openntpd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ntpd; " - "SEL_SERVICE=\"ptp4l\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; " - "SEL_SERVICE=\"phc2sys\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE} "; - + string cmd = "SEL_SERVICE=\"systemd-timesyncd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service; "; + system(cmd.c_str()); + cmd ="SEL_SERVICE=\"ntpd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; "; + system(cmd.c_str()); + cmd ="SEL_SERVICE=\"ntpdate\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; "; + system(cmd.c_str()); + cmd = "SEL_SERVICE=\"chronyd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; "; + system(cmd.c_str()); + cmd ="SEL_SERVICE=\"openntpd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ntpd; "; system(cmd.c_str()); + cmd ="SEL_SERVICE=\"ptp4l\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; "; + system(cmd.c_str()); + cmd ="SEL_SERVICE=\"phc2sys\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE} "; + system(cmd.c_str()); + this->update_time_date(); } @@ -463,8 +470,6 @@ void MainWindow::get_config(){ this->update_hour_minute(); this->update_calendar(); this->enry_dhcp_mess(); - - string read_reg_zon_cfg = this->call("/usr/bin/ubconfig get clock ZONE"); if ((read_reg_zon_cfg != "") && (strstr(read_reg_zon_cfg.c_str() ,"(null)")==NULL)){ read_reg_zon_cfg = read_reg_zon_cfg.substr(read_reg_zon_cfg.find("=")+1,read_reg_zon_cfg.length()); @@ -688,7 +693,6 @@ void MainWindow::update_time_date(){ cmd = "date +%Y%m%d -s \"" + to_string(year)+ str_month+str_day+"\""; system(cmd.c_str()); - txtDate->set_text(str_data); year=0; month=0; @@ -794,7 +798,6 @@ void MainWindow::read_file(){ } in1.close(); } - time_reg_map.insert({key_reg, zone}); time_reg_map_local.insert({key_reg, zone_local}); }}}} @@ -805,7 +808,6 @@ void MainWindow::read_file(){ } string MainWindow::zone_file_read(string zone){ - if (zone.length()==1){ return ""; } diff --git a/ubl-settings-datetime.glade b/ubl-settings-datetime.glade index 828918b..0c04dfe 100644 --- a/ubl-settings-datetime.glade +++ b/ubl-settings-datetime.glade @@ -807,6 +807,7 @@ Format: DD.MM.YYYY -1 True True + Enter the name of the ntp server or its ip address. When entering multiple addresses, separate them with spaces. center 5 5 diff --git a/ubl-settings-datetime_ru.po b/ubl-settings-datetime_ru.po index 4a9826f..5b04ae9 100644 --- a/ubl-settings-datetime_ru.po +++ b/ubl-settings-datetime_ru.po @@ -1593,3 +1593,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При вводе нескольких адресов, разделяйте их пробелами." +