Добавлена блокировка изменения даты и времени

pull/71/head
Igor Belitskiy 3 years ago
parent 14fcfc9f16
commit cc63b16e6c

@ -15,5 +15,4 @@ if [[ -z ${VER} ]] ; then
VER="${MAJOR}.$(echo $((${MINOR} +1)))"
fi
echo ":: Updated VERSION ${CURRENT} to ${VER}"
find ../ -maxdepth 2 -type f -iname "${FILE_VERSION}" -exec echo ":: Insert version in file: {}" \; -exec sed "s/VERSION *[[:digit:]]*.*/VERSION ${VER}/" -i {} \;
find ../ -maxdepth 2 -type f -iname "${FILE_VERSION}" -exec echo ":: Insert version in file: {}" \; -exec sed "s/VERSION *[[:digit:]]*.*/VERSION ${VER}/" -i {} \;

@ -13,7 +13,7 @@ find_package(ICU REQUIRED COMPONENTS uc dt in io)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always \
-O2 -pipe -fno-plt -fexceptions \
-Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
-fstack-clash-protection -fcf-protection -g")
-fstack-clash-protection -fcf-protection")
set(SOURCE_FILES
ubl-util-standard.h

@ -268,6 +268,7 @@ void MainWindow::get_builder(){
builder->get_widget("lblHW", lblHW);
builder->get_widget("cbHw", cbHw);
builder->get_widget("popCalendar", popCalendar);
builder->get_widget("boxDateTime", boxDateTime);
this->add_CSS();
}
void MainWindow::gui_exit(){
@ -318,19 +319,21 @@ void MainWindow::download_local_cfg(){
string cmd_get_dhcp = "/usr/bin/ubconfig --source system get network NTPSERVERS";
string cmd_default_get_dhcp = "/usr/bin/ubconfig --source=default get NTPSERVERS_DEFAULT";
this->entry_dhcp_mess(cmd_get_dhcp, cmd_default_get_dhcp);
string hw = "/usr/bin/ubconfig --default --source system get clock HWCLOCK_SYNC";
this->entry_hardware_clock(hw);
string hw = "/usr/bin/ubconfig --source system get clock HWCLOCK_SYNC";
string hw_default = "/usr/bin/ubconfig --default --source system get clock HWCLOCK_SYNC";
this->entry_hardware_clock(hw, hw_default);
info_warning_error(0);
}
void MainWindow::download_globl_cfg(){
string cmd_get_dhcp = "/usr/bin/ubconfig --target global get network NTPSERVERS";
string cmd_get_dhcp = "/usr/bin/ubconfig --source global get network NTPSERVERS";
string cmd_default_get_dhcp = "/usr/bin/ubconfig --source=default get NTPSERVERS_DEFAULT";
this->entry_dhcp_mess(cmd_get_dhcp, cmd_default_get_dhcp);
string cmd = "/usr/bin/ubconfig --default --source global get clock ZONE";
this->fill_in_reg_zone(cmd);
string hw = "/usr/bin/ubconfig get clock HWCLOCK_SYNC";
this->entry_hardware_clock(hw);
string hw_default = "/usr/bin/ubconfig --default get clock HWCLOCK_SYNC";
this->entry_hardware_clock(hw, hw_default);
info_warning_error(1);
}
@ -439,7 +442,7 @@ void MainWindow::hardware_clock_global(string &local, string &etc){
}
}
void MainWindow::entry_hardware_clock(string &cmd){
void MainWindow::entry_hardware_clock(string &cmd, string &cmd_default){
struct Result<string> obj_result = this->wrapper_call(cmd);
if (obj_result.error == 0){
if (obj_result.response == "localtime"){
@ -453,6 +456,21 @@ void MainWindow::entry_hardware_clock(string &cmd){
warning_info-=1;
cbHw->set_active(-1);
}
else{
struct Result<string> obj_result = this->wrapper_call(cmd_default);
if (obj_result.error == 0){
if (obj_result.response == "localtime"){
cbHw->set_active(0);
}
else if (obj_result.response == "etc"){
cbHw->set_active(1);
}
}
else if (obj_result.error == 3){
warning_info-=1;
cbHw->set_active(-1);
}
}
}
void MainWindow::hardware_clock(){
@ -647,12 +665,15 @@ void MainWindow::save_Dhcp(string &cmd_default, string &cmd_dhcp, string &remove
}
else if (activ_index==0){
wrapper_system(cmd_default, "&");
boxDateTime->set_sensitive(false);
}
else if (activ_index==1){
wrapper_system(cmd_dhcp, "&");
boxDateTime->set_sensitive(false);
}
else if (activ_index==2){
this->focus_ntp(cmd_set_ntp);
boxDateTime->set_sensitive(false);
}
else if (activ_index==3){
int start_error = error_info;
@ -660,11 +681,13 @@ void MainWindow::save_Dhcp(string &cmd_default, string &cmd_dhcp, string &remove
if (start_error != error_info){
error_info=start_error;
}
boxDateTime->set_sensitive(true);
}
}
void MainWindow::entry_dhcp_mess(string cmd_get_dhcp, string cmd_default_get_dhcp){
string cmd = cmd_get_dhcp;
boxDateTime->set_sensitive(false);
struct Result<string> obj_result = this->wrapper_call(cmd);
if (obj_result.error==0){
string str_dhcp = obj_result.response;
@ -715,6 +738,7 @@ void MainWindow::entry_dhcp_mess(string cmd_get_dhcp, string cmd_default_get_dhc
txtNtpServer->set_text("");
txtNtpServer->set_sensitive(false);
btnUpdateDateTime->set_sensitive(true);
boxDateTime->set_sensitive(true);
warning_info-=1;
}
}

@ -104,6 +104,7 @@ class MainWindow : public Gtk::ApplicationWindow {
Gtk::Label *lblHeader;
Gtk::Label *lblHW;
Gtk::ComboBoxText *cbHw;
Gtk::Box *boxDateTime;
unsigned int year=0;
unsigned int month=0;
unsigned int day=0;
@ -129,7 +130,7 @@ class MainWindow : public Gtk::ApplicationWindow {
void hardware_clock_global(string &local, string &etc);
void info_warning_error(int mess);
void synopsis_show();
void entry_hardware_clock(string &cmd);
void entry_hardware_clock(string &cmd, string &cmd_default);
void save_global_local_cfg();
void fill_in_reg_zone(string &cmd);
void download_globl_cfg();

@ -323,7 +323,7 @@
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<object class="GtkBox" id="boxDateTime">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>

Loading…
Cancel
Save