|
|
|
@ -9,8 +9,12 @@ string path_locale = "/usr/share/locale/";
|
|
|
|
string path_css = "/usr/share/ubl-settings-datetime/css/style.css";
|
|
|
|
string path_css = "/usr/share/ubl-settings-datetime/css/style.css";
|
|
|
|
bool flag_datetime = false;
|
|
|
|
bool flag_datetime = false;
|
|
|
|
bool flag_timezone = false;
|
|
|
|
bool flag_timezone = false;
|
|
|
|
bool flag_ntp = false;
|
|
|
|
bool flag_ntp_mode = false;
|
|
|
|
bool flag_update = false;
|
|
|
|
bool flag_ntp_edit = false;
|
|
|
|
|
|
|
|
bool flag_save = false;
|
|
|
|
|
|
|
|
bool flag_save_local = false;
|
|
|
|
|
|
|
|
bool flag_save_global = false;
|
|
|
|
|
|
|
|
bool flag_load_global = false;
|
|
|
|
int socket_ext_id_I=0;
|
|
|
|
int socket_ext_id_I=0;
|
|
|
|
int socket_trd_id_I=0;
|
|
|
|
int socket_trd_id_I=0;
|
|
|
|
|
|
|
|
|
|
|
|
@ -18,7 +22,6 @@ CmdArgParser::CmdArgParser(const std::string& p_name, const std::string& p_descr
|
|
|
|
: Glib::OptionGroup{p_name, p_description, p_help} {
|
|
|
|
: Glib::OptionGroup{p_name, p_description, p_help} {
|
|
|
|
Glib::OptionEntry socketIDArg;
|
|
|
|
Glib::OptionEntry socketIDArg;
|
|
|
|
socketIDArg.set_long_name("socket-id");
|
|
|
|
socketIDArg.set_long_name("socket-id");
|
|
|
|
socketIDArg.set_short_name('s');
|
|
|
|
|
|
|
|
socketIDArg.set_flags(Glib::OptionEntry::FLAG_IN_MAIN);
|
|
|
|
socketIDArg.set_flags(Glib::OptionEntry::FLAG_IN_MAIN);
|
|
|
|
socketIDArg.set_description("Settings manager socket");
|
|
|
|
socketIDArg.set_description("Settings manager socket");
|
|
|
|
|
|
|
|
|
|
|
|
@ -79,12 +82,6 @@ void MainWindow::settings(){
|
|
|
|
this->event();
|
|
|
|
this->event();
|
|
|
|
this->parse_text_date();
|
|
|
|
this->parse_text_date();
|
|
|
|
this->download_local_cfg();
|
|
|
|
this->download_local_cfg();
|
|
|
|
|
|
|
|
|
|
|
|
//orevrlayInfo->add_overlay(*boxInfoError);
|
|
|
|
|
|
|
|
//imgInfo->set("/usr/share/ubl-settings-datetime/images/checked.svg");
|
|
|
|
|
|
|
|
//GdkPixbuf* pixbuf_image = gdk_pixbuf_new_from_file_at_size("/usr/share/ubl-settings-datetime/images/close.svg", 12,12,NULL);
|
|
|
|
|
|
|
|
//GtkWidget* imageInfo = GTK_WIDGET(imageCloseInfo->gobj());
|
|
|
|
|
|
|
|
//gtk_image_set_from_pixbuf(GTK_IMAGE(imageInfo), pixbuf_image);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
else{
|
|
|
|
btnDownload->set_sensitive(false);
|
|
|
|
btnDownload->set_sensitive(false);
|
|
|
|
@ -109,11 +106,7 @@ void MainWindow::settings(){
|
|
|
|
btnBoxAboutDialog->set_visible(false);
|
|
|
|
btnBoxAboutDialog->set_visible(false);
|
|
|
|
this->event();
|
|
|
|
this->event();
|
|
|
|
imgInfo->set("/usr/share/ubl-settings-datetime/images/checked.svg");
|
|
|
|
imgInfo->set("/usr/share/ubl-settings-datetime/images/checked.svg");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//popCalendar->show_all();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -159,14 +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"));
|
|
|
|
//_lblSynchronizebChk->set_text(_("Synchronize via NTP"));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::flag_block_gui(){
|
|
|
|
void MainWindow::flag_block_gui(){
|
|
|
|
if (flag_datetime==true){
|
|
|
|
if (flag_datetime==true){
|
|
|
|
//numTimeHrs->set_sensitive(false);
|
|
|
|
|
|
|
|
//numTimeMin->set_sensitive(false);
|
|
|
|
|
|
|
|
//txtDate->set_sensitive(false);
|
|
|
|
|
|
|
|
btnUpdateDateTime->set_sensitive(false);
|
|
|
|
btnUpdateDateTime->set_sensitive(false);
|
|
|
|
numTimeHrs->set_sensitive(false);
|
|
|
|
numTimeHrs->set_sensitive(false);
|
|
|
|
numTimeMin->set_sensitive(false);
|
|
|
|
numTimeMin->set_sensitive(false);
|
|
|
|
@ -180,17 +169,28 @@ void MainWindow::flag_block_gui(){
|
|
|
|
if (flag_timezone==true){
|
|
|
|
if (flag_timezone==true){
|
|
|
|
cbRegion->set_sensitive(false);
|
|
|
|
cbRegion->set_sensitive(false);
|
|
|
|
cbZone->set_sensitive(false);
|
|
|
|
cbZone->set_sensitive(false);
|
|
|
|
//btnChooseDate->set_sensitive(false);
|
|
|
|
|
|
|
|
cbDhcp->set_sensitive(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (flag_ntp==true){
|
|
|
|
if (flag_ntp_mode==true){
|
|
|
|
cbDhcp->set_sensitive(false);
|
|
|
|
cbDhcp->set_sensitive(false);
|
|
|
|
txtNtpServer->set_sensitive(false);
|
|
|
|
txtNtpServer->set_sensitive(false);
|
|
|
|
|
|
|
|
flag_ntp_edit = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (flag_update==true){
|
|
|
|
if (flag_ntp_edit==true){
|
|
|
|
txtNtpServer->set_sensitive(false);
|
|
|
|
txtNtpServer->set_sensitive(false);
|
|
|
|
cbDhcp->set_sensitive(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flag_load_global==true){
|
|
|
|
|
|
|
|
btnDonwlolGlob->set_sensitive(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flag_save==true){
|
|
|
|
|
|
|
|
btnSave->set_sensitive(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flag_save_local==true){
|
|
|
|
|
|
|
|
btnSaveLocal->set_sensitive(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flag_save_global==true){
|
|
|
|
|
|
|
|
btnSaveGlob->set_sensitive(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::add_CSS(){
|
|
|
|
void MainWindow::add_CSS(){
|
|
|
|
@ -201,11 +201,8 @@ void MainWindow::add_CSS(){
|
|
|
|
styleContext->add_provider_for_screen(screen, cssProvider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);//add provider for screen in all application
|
|
|
|
styleContext->add_provider_for_screen(screen, cssProvider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);//add provider for screen in all application
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> context = boxColor->get_style_context();
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> context = boxColor->get_style_context();
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> context_lbl_head = lblHead->get_style_context();
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> context_lbl_head = lblHead->get_style_context();
|
|
|
|
|
|
|
|
|
|
|
|
context->add_class("cssboxColor1");
|
|
|
|
context->add_class("cssboxColor1");
|
|
|
|
context_lbl_head->add_class("textHead");
|
|
|
|
context_lbl_head->add_class("textHead");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -240,7 +237,6 @@ void MainWindow::get_builder(){
|
|
|
|
builder->get_widget("lblTimeZone",lblTimeZone);
|
|
|
|
builder->get_widget("lblTimeZone",lblTimeZone);
|
|
|
|
builder->get_widget("lblReg",lblReg);
|
|
|
|
builder->get_widget("lblReg",lblReg);
|
|
|
|
builder->get_widget("lblZone",lblZone);
|
|
|
|
builder->get_widget("lblZone",lblZone);
|
|
|
|
//builder->get_widget("lblSynchronizebChk",_lblSynchronizebChk);
|
|
|
|
|
|
|
|
builder->get_widget("lblSynchronizebChkGLob",lblSynchronizebChkGLob);
|
|
|
|
builder->get_widget("lblSynchronizebChkGLob",lblSynchronizebChkGLob);
|
|
|
|
builder->get_widget("lblSynchronizeBtn",lblSynchronizeBtn);
|
|
|
|
builder->get_widget("lblSynchronizeBtn",lblSynchronizeBtn);
|
|
|
|
builder->get_widget("lblTimeBios",lblTimeBios);
|
|
|
|
builder->get_widget("lblTimeBios",lblTimeBios);
|
|
|
|
@ -249,7 +245,6 @@ void MainWindow::get_builder(){
|
|
|
|
builder->get_widget("lblMessageSudo",lblMessageSudo);
|
|
|
|
builder->get_widget("lblMessageSudo",lblMessageSudo);
|
|
|
|
builder->get_widget("btnMessCloseSudo",btnMessCloseSudo);
|
|
|
|
builder->get_widget("btnMessCloseSudo",btnMessCloseSudo);
|
|
|
|
builder->get_widget("lblSave",lblSave);
|
|
|
|
builder->get_widget("lblSave",lblSave);
|
|
|
|
|
|
|
|
|
|
|
|
builder->get_widget("lblDownload",lblDownload);
|
|
|
|
builder->get_widget("lblDownload",lblDownload);
|
|
|
|
builder->get_widget("aboutWindows", aboutWindows);
|
|
|
|
builder->get_widget("aboutWindows", aboutWindows);
|
|
|
|
builder->get_widget("btnBoxAboutDialog", btnBoxAboutDialog);
|
|
|
|
builder->get_widget("btnBoxAboutDialog", btnBoxAboutDialog);
|
|
|
|
@ -356,20 +351,29 @@ void MainWindow::save_global_cfg(){
|
|
|
|
info_warning_error(3);
|
|
|
|
info_warning_error(3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::save_global_local_cfg(){
|
|
|
|
void MainWindow::save_global_local_cfg(){
|
|
|
|
string cmd = "ubconfig --target system set clock ZONE=";
|
|
|
|
string cmd = "";
|
|
|
|
this->enter_zone(cmd);
|
|
|
|
string cmd_default = "";
|
|
|
|
|
|
|
|
string cmd_dhcp = "";
|
|
|
|
|
|
|
|
string cmd_set_ntp = "";
|
|
|
|
|
|
|
|
string remove = "";
|
|
|
|
|
|
|
|
if (flag_save_global==false){
|
|
|
|
cmd = "/usr/bin/ubconfig --target global set clock ZONE=";
|
|
|
|
cmd = "/usr/bin/ubconfig --target global set clock ZONE=";
|
|
|
|
this->enter_zone(cmd);
|
|
|
|
this->enter_zone(cmd);
|
|
|
|
string cmd_default = "/usr/bin/ubconfig --target global set network NTPSERVERS=default";
|
|
|
|
cmd_default = "/usr/bin/ubconfig --target global set network NTPSERVERS=default";
|
|
|
|
string cmd_dhcp = "/usr/bin/ubconfig --target global set network NTPSERVERS=dhcp";
|
|
|
|
cmd_dhcp = "/usr/bin/ubconfig --target global set network NTPSERVERS=dhcp";
|
|
|
|
string cmd_set_ntp = "/usr/bin/ubconfig --target global set network NTPSERVERS=\"";
|
|
|
|
cmd_set_ntp = "/usr/bin/ubconfig --target global set network NTPSERVERS=\"";
|
|
|
|
string remove = "/usr/bin/ubconfig --target global remove network NTPSERVERS";
|
|
|
|
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);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flag_save_local==false){
|
|
|
|
|
|
|
|
cmd = "ubconfig --target system set clock ZONE=";
|
|
|
|
|
|
|
|
this->enter_zone(cmd);
|
|
|
|
cmd_default = "/usr/bin/ubconfig --target system set network NTPSERVERS=default";
|
|
|
|
cmd_default = "/usr/bin/ubconfig --target system set network NTPSERVERS=default";
|
|
|
|
cmd_dhcp = "/usr/bin/ubconfig --target system set network NTPSERVERS=dhcp";
|
|
|
|
cmd_dhcp = "/usr/bin/ubconfig --target system set network NTPSERVERS=dhcp";
|
|
|
|
cmd_set_ntp = "/usr/bin/ubconfig --target system set network NTPSERVERS=\"";
|
|
|
|
cmd_set_ntp = "/usr/bin/ubconfig --target system set network NTPSERVERS=\"";
|
|
|
|
remove = "/usr/bin/ubconfig --target system remove network NTPSERVERS";
|
|
|
|
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);
|
|
|
|
|
|
|
|
}
|
|
|
|
info_warning_error(4);
|
|
|
|
info_warning_error(4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -417,28 +421,6 @@ void MainWindow::info_warning_error(int mess){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::stop_ntp(){
|
|
|
|
|
|
|
|
int start_error = error_info;
|
|
|
|
|
|
|
|
string cmd = "SEL_SERVICE=\"systemd-timesyncd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service; ";
|
|
|
|
|
|
|
|
wrapper_system(cmd);
|
|
|
|
|
|
|
|
cmd ="SEL_SERVICE=\"ntpd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; ";
|
|
|
|
|
|
|
|
wrapper_system(cmd);
|
|
|
|
|
|
|
|
cmd ="SEL_SERVICE=\"ntpdate\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; ";
|
|
|
|
|
|
|
|
wrapper_system(cmd);
|
|
|
|
|
|
|
|
cmd = "SEL_SERVICE=\"chronyd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; ";
|
|
|
|
|
|
|
|
wrapper_system(cmd);
|
|
|
|
|
|
|
|
cmd ="SEL_SERVICE=\"openntpd\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ntpd; ";
|
|
|
|
|
|
|
|
wrapper_system(cmd);
|
|
|
|
|
|
|
|
cmd ="SEL_SERVICE=\"ptp4l\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE}; ";
|
|
|
|
|
|
|
|
wrapper_system(cmd);
|
|
|
|
|
|
|
|
cmd ="SEL_SERVICE=\"phc2sys\"; systemctl --quiet is-active ${SEL_SERVICE}.service &>/dev/null && systemctl stop ${SEL_SERVICE}.service || pkill -9 ${SEL_SERVICE} ";
|
|
|
|
|
|
|
|
wrapper_system(cmd);
|
|
|
|
|
|
|
|
if (start_error!=error_info){
|
|
|
|
|
|
|
|
error_info=start_error;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
cout << error_info << endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::wrapper_system(string cmd){
|
|
|
|
void MainWindow::wrapper_system(string cmd){
|
|
|
|
int response_cmd = system(cmd.c_str());
|
|
|
|
int response_cmd = system(cmd.c_str());
|
|
|
|
if (response_cmd!=0){
|
|
|
|
if (response_cmd!=0){
|
|
|
|
@ -620,13 +602,14 @@ void MainWindow::event_entry_cbDhcp(){
|
|
|
|
txtNtpServer->set_text("");
|
|
|
|
txtNtpServer->set_text("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (activ_index==2){
|
|
|
|
else if (activ_index==2){
|
|
|
|
|
|
|
|
if (flag_ntp_edit==false){
|
|
|
|
txtNtpServer->set_sensitive(true);
|
|
|
|
txtNtpServer->set_sensitive(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else if (activ_index==3){
|
|
|
|
else if (activ_index==3){
|
|
|
|
txtNtpServer->set_text("");
|
|
|
|
txtNtpServer->set_text("");
|
|
|
|
txtNtpServer->set_sensitive(false);
|
|
|
|
txtNtpServer->set_sensitive(false);
|
|
|
|
btnUpdateDateTime->set_sensitive(true);
|
|
|
|
btnUpdateDateTime->set_sensitive(true);
|
|
|
|
this->stop_ntp();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -655,7 +638,6 @@ void MainWindow::save_Dhcp(string &cmd_default, string &cmd_dhcp, string &remove
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::entry_dhcp_mess(string cmd_get_dhcp, string cmd_default_get_dhcp){
|
|
|
|
void MainWindow::entry_dhcp_mess(string cmd_get_dhcp, string cmd_default_get_dhcp){
|
|
|
|
//string cmd = "/usr/bin/ubconfig get network NTPSERVERS";
|
|
|
|
|
|
|
|
string cmd = cmd_get_dhcp;
|
|
|
|
string cmd = cmd_get_dhcp;
|
|
|
|
struct Result<string> obj_result = this->wrapper_call(cmd);
|
|
|
|
struct Result<string> obj_result = this->wrapper_call(cmd);
|
|
|
|
if (obj_result.error==0){
|
|
|
|
if (obj_result.error==0){
|
|
|
|
@ -671,7 +653,6 @@ void MainWindow::entry_dhcp_mess(string cmd_get_dhcp, string cmd_default_get_dhc
|
|
|
|
else if (str_dhcp=="default"){
|
|
|
|
else if (str_dhcp=="default"){
|
|
|
|
btnUpdateDateTime->set_sensitive(false);
|
|
|
|
btnUpdateDateTime->set_sensitive(false);
|
|
|
|
cbDhcp->set_active(0);
|
|
|
|
cbDhcp->set_active(0);
|
|
|
|
//string cmd = "/usr/bin/ubconfig --source=default get NTPSERVERS_DEFAULT";
|
|
|
|
|
|
|
|
cmd = cmd_default_get_dhcp;
|
|
|
|
cmd = cmd_default_get_dhcp;
|
|
|
|
struct Result<string> obj_result = this->wrapper_call(cmd);
|
|
|
|
struct Result<string> obj_result = this->wrapper_call(cmd);
|
|
|
|
txtNtpServer->set_sensitive(false);
|
|
|
|
txtNtpServer->set_sensitive(false);
|
|
|
|
@ -682,10 +663,6 @@ void MainWindow::entry_dhcp_mess(string cmd_get_dhcp, string cmd_default_get_dhc
|
|
|
|
if (obj_result.error==2){
|
|
|
|
if (obj_result.error==2){
|
|
|
|
warning_info-=1;
|
|
|
|
warning_info-=1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//string error = "";
|
|
|
|
|
|
|
|
//error = string(_("ERROR")) + "\n" + obj_result.response;
|
|
|
|
|
|
|
|
//lblMessage->set_text(error);
|
|
|
|
|
|
|
|
//mess_dchp->show();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
else{
|
|
|
|
@ -701,10 +678,12 @@ void MainWindow::entry_dhcp_mess(string cmd_get_dhcp, string cmd_default_get_dhc
|
|
|
|
else{
|
|
|
|
else{
|
|
|
|
cbDhcp->set_active(2);
|
|
|
|
cbDhcp->set_active(2);
|
|
|
|
txtNtpServer->set_text(str_dhcp);
|
|
|
|
txtNtpServer->set_text(str_dhcp);
|
|
|
|
|
|
|
|
if (flag_ntp_edit==false){
|
|
|
|
txtNtpServer->set_sensitive(true);
|
|
|
|
txtNtpServer->set_sensitive(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
else{
|
|
|
|
cbDhcp->set_active(3);
|
|
|
|
cbDhcp->set_active(3);
|
|
|
|
txtNtpServer->set_text("");
|
|
|
|
txtNtpServer->set_text("");
|
|
|
|
@ -921,7 +900,6 @@ string MainWindow::call(string cmd){
|
|
|
|
exit(1);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (fgets(path, PATH_MAX, fp) != NULL){
|
|
|
|
while (fgets(path, PATH_MAX, fp) != NULL){
|
|
|
|
//printf("%s", path);
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
status = pclose(fp);
|
|
|
|
status = pclose(fp);
|
|
|
|
@ -933,7 +911,6 @@ string MainWindow::call(string cmd){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::append_zone(){
|
|
|
|
void MainWindow::append_zone(){
|
|
|
|
//int length_zone = time_reg_map.at(str_region).size();
|
|
|
|
|
|
|
|
cbZone->remove_all();
|
|
|
|
cbZone->remove_all();
|
|
|
|
int index = cbRegion->get_active_row_number();
|
|
|
|
int index = cbRegion->get_active_row_number();
|
|
|
|
string str_region = array_region[index];
|
|
|
|
string str_region = array_region[index];
|
|
|
|
@ -1052,26 +1029,25 @@ void MainWindow::read_file(){
|
|
|
|
string path_reg_zone = "";
|
|
|
|
string path_reg_zone = "";
|
|
|
|
namespace fs = std::filesystem;
|
|
|
|
namespace fs = std::filesystem;
|
|
|
|
for (const auto & entry : fs::directory_iterator("/usr/share/zoneinfo/")){
|
|
|
|
for (const auto & entry : fs::directory_iterator("/usr/share/zoneinfo/")){
|
|
|
|
std::ifstream in(entry.path()); // окрываем файл для чтения
|
|
|
|
std::ifstream in(entry.path());
|
|
|
|
if (in.is_open()){
|
|
|
|
if (in.is_open()){
|
|
|
|
string key_reg = entry.path().filename().string();
|
|
|
|
string key_reg = entry.path().filename().string();
|
|
|
|
string path_dir = "/usr/share/zoneinfo/"+key_reg;
|
|
|
|
string path_dir = "/usr/share/zoneinfo/"+key_reg;
|
|
|
|
if (fs::is_directory(path_dir)){
|
|
|
|
if (fs::is_directory(path_dir)){
|
|
|
|
if (key_reg!="Pacific"){
|
|
|
|
if (key_reg!="Pacific"){
|
|
|
|
if (key_reg!="posix"){
|
|
|
|
if (key_reg!="posix"){
|
|
|
|
//if (key_reg!="Etc"){
|
|
|
|
|
|
|
|
if (key_reg!="right"){
|
|
|
|
if (key_reg!="right"){
|
|
|
|
vector<string> zone;
|
|
|
|
vector<string> zone;
|
|
|
|
vector<string> zone_local;
|
|
|
|
vector<string> zone_local;
|
|
|
|
for (const auto & entry_zone : fs::directory_iterator(path_dir)){
|
|
|
|
for (const auto & entry_zone : fs::directory_iterator(path_dir)){
|
|
|
|
std::ifstream in1(entry_zone.path()); // окрываем файл для чтения
|
|
|
|
std::ifstream in1(entry_zone.path());
|
|
|
|
if (in1.is_open()){
|
|
|
|
if (in1.is_open()){
|
|
|
|
string key_zone = entry_zone.path().filename().string();
|
|
|
|
string key_zone = entry_zone.path().filename().string();
|
|
|
|
|
|
|
|
|
|
|
|
if (fs::is_directory(path_dir+"/"+key_zone)){
|
|
|
|
if (fs::is_directory(path_dir+"/"+key_zone)){
|
|
|
|
string reg_reg_zone = path_dir+"/"+key_zone;
|
|
|
|
string reg_reg_zone = path_dir+"/"+key_zone;
|
|
|
|
for (const auto & entry_reg_reg_zone : fs::directory_iterator(reg_reg_zone)){
|
|
|
|
for (const auto & entry_reg_reg_zone : fs::directory_iterator(reg_reg_zone)){
|
|
|
|
std::ifstream in2(entry_zone.path()); // окрываем файл для чтения
|
|
|
|
std::ifstream in2(entry_zone.path());
|
|
|
|
if (in2.is_open()){
|
|
|
|
if (in2.is_open()){
|
|
|
|
string reg_reg_zone = entry_reg_reg_zone.path().filename().string();
|
|
|
|
string reg_reg_zone = entry_reg_reg_zone.path().filename().string();
|
|
|
|
zone.push_back(reg_reg_zone);
|
|
|
|
zone.push_back(reg_reg_zone);
|
|
|
|
|