|
|
|
@ -152,6 +152,10 @@ void MainWindow::lacalization(){
|
|
|
|
mess_sudo->set_title(_("Warning!"));
|
|
|
|
mess_sudo->set_title(_("Warning!"));
|
|
|
|
mess_dchp->set_title(_("Warning!"));
|
|
|
|
mess_dchp->set_title(_("Warning!"));
|
|
|
|
lblTimeBios->set_text(_("Synchronize hardware time"));
|
|
|
|
lblTimeBios->set_text(_("Synchronize hardware time"));
|
|
|
|
|
|
|
|
lblHW->set_text(_("Synchronize hardware time:"));
|
|
|
|
|
|
|
|
cbHw->append(_("Local time"));
|
|
|
|
|
|
|
|
cbHw->append(_("UTC time"));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::flag_block_gui(){
|
|
|
|
void MainWindow::flag_block_gui(){
|
|
|
|
@ -266,6 +270,8 @@ void MainWindow::get_builder(){
|
|
|
|
builder->get_widget("btnSaveGlob", btnSaveGlob);
|
|
|
|
builder->get_widget("btnSaveGlob", btnSaveGlob);
|
|
|
|
builder->get_widget("headerBar", headerBar);
|
|
|
|
builder->get_widget("headerBar", headerBar);
|
|
|
|
builder->get_widget("lblHeader", lblHeader);
|
|
|
|
builder->get_widget("lblHeader", lblHeader);
|
|
|
|
|
|
|
|
builder->get_widget("lblHW", lblHW);
|
|
|
|
|
|
|
|
builder->get_widget("cbHw", cbHw);
|
|
|
|
this->add_CSS();
|
|
|
|
this->add_CSS();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::gui_exit(){
|
|
|
|
void MainWindow::gui_exit(){
|
|
|
|
@ -299,11 +305,13 @@ void MainWindow::event(){
|
|
|
|
btnSaveLocalGlob->signal_clicked().connect([&](){save_global_local_cfg();});
|
|
|
|
btnSaveLocalGlob->signal_clicked().connect([&](){save_global_local_cfg();});
|
|
|
|
btnSaveLocal->signal_clicked().connect([&](){save_local_cfg();});
|
|
|
|
btnSaveLocal->signal_clicked().connect([&](){save_local_cfg();});
|
|
|
|
btnSaveGlob->signal_clicked().connect([&](){save_global_cfg();});
|
|
|
|
btnSaveGlob->signal_clicked().connect([&](){save_global_cfg();});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::synopsis_show(){
|
|
|
|
void MainWindow::synopsis_show(){
|
|
|
|
int start_error = error_info;
|
|
|
|
int start_error = error_info;
|
|
|
|
//wrapper_system("xdg-open https://wiki.ublinux.ru/ru/home");
|
|
|
|
wrapper_system("xdg-open https://wiki.ublinux.ru/ru/home &");
|
|
|
|
|
|
|
|
//gtk_show_uri_on_window(NULL, "https://wiki.ublinux.ru/ru/home", 0, 0);
|
|
|
|
if (start_error!=error_info){
|
|
|
|
if (start_error!=error_info){
|
|
|
|
error_info=start_error;
|
|
|
|
error_info=start_error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -317,6 +325,8 @@ void MainWindow::download_local_cfg(){
|
|
|
|
string cmd_get_dhcp = "/usr/bin/ubconfig --source system get network NTPSERVERS";
|
|
|
|
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";
|
|
|
|
string cmd_default_get_dhcp = "/usr/bin/ubconfig --source=default get NTPSERVERS_DEFAULT";
|
|
|
|
this->entry_dhcp_mess(cmd_get_dhcp, cmd_default_get_dhcp);
|
|
|
|
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);
|
|
|
|
info_warning_error(0);
|
|
|
|
info_warning_error(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -326,17 +336,22 @@ void MainWindow::download_globl_cfg(){
|
|
|
|
this->entry_dhcp_mess(cmd_get_dhcp, cmd_default_get_dhcp);
|
|
|
|
this->entry_dhcp_mess(cmd_get_dhcp, cmd_default_get_dhcp);
|
|
|
|
string cmd = "/usr/bin/ubconfig --default --source global get clock ZONE";
|
|
|
|
string cmd = "/usr/bin/ubconfig --default --source global get clock ZONE";
|
|
|
|
this->fill_in_reg_zone(cmd);
|
|
|
|
this->fill_in_reg_zone(cmd);
|
|
|
|
|
|
|
|
string hw = "/usr/bin/ubconfig --default --source global get clock HWCLOCK_SYNC";
|
|
|
|
|
|
|
|
this->entry_hardware_clock(hw);
|
|
|
|
info_warning_error(1);
|
|
|
|
info_warning_error(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::save_local_cfg(){
|
|
|
|
void MainWindow::save_local_cfg(){
|
|
|
|
string cmd = "ubconfig --target system set clock ZONE=";
|
|
|
|
string cmd = "/usr/bin/ubconfig --target system set clock ZONE=";
|
|
|
|
this->enter_zone(cmd);
|
|
|
|
this->enter_zone(cmd);
|
|
|
|
string cmd_default = "/usr/bin/ubconfig --target system set network NTPSERVERS=default";
|
|
|
|
string cmd_default = "/usr/bin/ubconfig --target system set network NTPSERVERS=default";
|
|
|
|
string cmd_dhcp = "/usr/bin/ubconfig --target system set network NTPSERVERS=dhcp";
|
|
|
|
string cmd_dhcp = "/usr/bin/ubconfig --target system set network NTPSERVERS=dhcp";
|
|
|
|
string cmd_set_ntp = "/usr/bin/ubconfig --target system set network NTPSERVERS=\"";
|
|
|
|
string cmd_set_ntp = "/usr/bin/ubconfig --target system set network NTPSERVERS=\"";
|
|
|
|
string remove = "/usr/bin/ubconfig --target system remove network NTPSERVERS";
|
|
|
|
string remove = "/usr/bin/ubconfig --target system remove network NTPSERVERS";
|
|
|
|
this->save_Dhcp(cmd_default, cmd_dhcp, remove, cmd_set_ntp);
|
|
|
|
this->save_Dhcp(cmd_default, cmd_dhcp, remove, cmd_set_ntp);
|
|
|
|
|
|
|
|
string local = "/usr/bin/ubconfig --target system set clock HWCLOCK_SYNC=localtime";
|
|
|
|
|
|
|
|
string hw = "/usr/bin/ubconfig --target system set clock HWCLOCK_SYNC=utc";
|
|
|
|
|
|
|
|
this->hardware_clock_global(local, hw);
|
|
|
|
info_warning_error(2);
|
|
|
|
info_warning_error(2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -348,6 +363,9 @@ void MainWindow::save_global_cfg(){
|
|
|
|
string cmd_set_ntp = "/usr/bin/ubconfig --target global set network NTPSERVERS=\"";
|
|
|
|
string cmd_set_ntp = "/usr/bin/ubconfig --target global set network NTPSERVERS=\"";
|
|
|
|
string remove = "/usr/bin/ubconfig --target global remove network NTPSERVERS";
|
|
|
|
string remove = "/usr/bin/ubconfig --target global remove network NTPSERVERS";
|
|
|
|
this->save_Dhcp(cmd_default, cmd_dhcp, remove, cmd_set_ntp);
|
|
|
|
this->save_Dhcp(cmd_default, cmd_dhcp, remove, cmd_set_ntp);
|
|
|
|
|
|
|
|
string local = "/usr/bin/ubconfig --target global set clock HWCLOCK_SYNC=localtime";
|
|
|
|
|
|
|
|
string hw = "/usr/bin/ubconfig --target global set clock HWCLOCK_SYNC=utc";
|
|
|
|
|
|
|
|
this->hardware_clock_global(local, hw);
|
|
|
|
info_warning_error(3);
|
|
|
|
info_warning_error(3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::save_global_local_cfg(){
|
|
|
|
void MainWindow::save_global_local_cfg(){
|
|
|
|
@ -357,22 +375,11 @@ void MainWindow::save_global_local_cfg(){
|
|
|
|
string cmd_set_ntp = "";
|
|
|
|
string cmd_set_ntp = "";
|
|
|
|
string remove = "";
|
|
|
|
string remove = "";
|
|
|
|
if (flag_save_global==false){
|
|
|
|
if (flag_save_global==false){
|
|
|
|
cmd = "/usr/bin/ubconfig --target global set clock ZONE=";
|
|
|
|
this->save_local_cfg();
|
|
|
|
this->enter_zone(cmd);
|
|
|
|
|
|
|
|
cmd_default = "/usr/bin/ubconfig --target global set network NTPSERVERS=default";
|
|
|
|
|
|
|
|
cmd_dhcp = "/usr/bin/ubconfig --target global set network NTPSERVERS=dhcp";
|
|
|
|
|
|
|
|
cmd_set_ntp = "/usr/bin/ubconfig --target global set network NTPSERVERS=\"";
|
|
|
|
|
|
|
|
remove = "/usr/bin/ubconfig --target global remove network NTPSERVERS";
|
|
|
|
|
|
|
|
this->save_Dhcp(cmd_default, cmd_dhcp, remove, cmd_set_ntp);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (flag_save_local==false){
|
|
|
|
if (flag_save_local==false){
|
|
|
|
cmd = "ubconfig --target system set clock ZONE=";
|
|
|
|
this->save_global_cfg();
|
|
|
|
this->enter_zone(cmd);
|
|
|
|
|
|
|
|
cmd_default = "/usr/bin/ubconfig --target system set network NTPSERVERS=default";
|
|
|
|
|
|
|
|
cmd_dhcp = "/usr/bin/ubconfig --target system set network NTPSERVERS=dhcp";
|
|
|
|
|
|
|
|
cmd_set_ntp = "/usr/bin/ubconfig --target system set network NTPSERVERS=\"";
|
|
|
|
|
|
|
|
remove = "/usr/bin/ubconfig --target system remove network NTPSERVERS";
|
|
|
|
|
|
|
|
this->save_Dhcp(cmd_default, cmd_dhcp, remove, cmd_set_ntp);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
info_warning_error(4);
|
|
|
|
info_warning_error(4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -429,6 +436,31 @@ void MainWindow::wrapper_system(string cmd){
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::hardware_clock_global(string &local, string &utc){
|
|
|
|
|
|
|
|
int index = cbHw->get_active_row_number();
|
|
|
|
|
|
|
|
cout << index << endl;
|
|
|
|
|
|
|
|
if (index == 0){
|
|
|
|
|
|
|
|
cout << local << endl;
|
|
|
|
|
|
|
|
wrapper_system(local);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (index == 1){
|
|
|
|
|
|
|
|
cout << utc << endl;
|
|
|
|
|
|
|
|
wrapper_system(utc);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::entry_hardware_clock(string &cmd){
|
|
|
|
|
|
|
|
struct Result<string> obj_result = this->wrapper_call(cmd);
|
|
|
|
|
|
|
|
if (obj_result.error == 0){
|
|
|
|
|
|
|
|
if (obj_result.response == "localtime"){
|
|
|
|
|
|
|
|
cbHw->set_active(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
cbHw->set_active(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::hardware_clock(){
|
|
|
|
void MainWindow::hardware_clock(){
|
|
|
|
string cmd = "hwclock --systohc";
|
|
|
|
string cmd = "hwclock --systohc";
|
|
|
|
wrapper_system(cmd);
|
|
|
|
wrapper_system(cmd);
|
|
|
|
|