|
|
|
|
@ -307,7 +307,6 @@ void MainWindow::get_builder() {
|
|
|
|
|
builder->get_widget("imgSettings", imgSettings);
|
|
|
|
|
builder->get_widget("imgSave", imgSave);
|
|
|
|
|
builder->get_widget("boxWidgetFunc", boxWidgetFunc);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::gui_exit() {
|
|
|
|
|
@ -341,7 +340,7 @@ void MainWindow::event_log_hw() {
|
|
|
|
|
int size_hw = sizeof(array_hw)/sizeof(array_hw[0]);
|
|
|
|
|
for (int i = 0; i < size_hw; i++) {
|
|
|
|
|
if (str_hw == array_hw_local[i]) {
|
|
|
|
|
this->write_config(map_config_data, array_hw[i], "hw");
|
|
|
|
|
this->write_config(array_hw[i], "hw");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -350,17 +349,17 @@ void MainWindow::event_log_hw() {
|
|
|
|
|
void MainWindow::event_zone() {
|
|
|
|
|
int activ_index_reg = cbRegion->get_active_row_number();
|
|
|
|
|
if (activ_index_reg == -1) {
|
|
|
|
|
this->write_config(map_config_data, "error", "zone");
|
|
|
|
|
this->write_config("error", "zone");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
string reg_text = array_region[activ_index_reg];
|
|
|
|
|
int activ_index = cbZone->get_active_row_number();
|
|
|
|
|
if (activ_index == -1) {
|
|
|
|
|
this->write_config(map_config_data, "error", "zone");
|
|
|
|
|
this->write_config("error", "zone");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
string zone_text = "";
|
|
|
|
|
if(!(reg_text.empty())) {
|
|
|
|
|
if (!(reg_text.empty())) {
|
|
|
|
|
int index= 0;
|
|
|
|
|
for (const auto &zone: time_reg_map.at(reg_text)) {
|
|
|
|
|
if (index == activ_index) {
|
|
|
|
|
@ -369,7 +368,7 @@ void MainWindow::event_zone() {
|
|
|
|
|
index+= 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this->write_config(map_config_data, zone_text, "zone");
|
|
|
|
|
this->write_config(zone_text, "zone");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::synopsis_show() {
|
|
|
|
|
@ -393,12 +392,13 @@ void MainWindow::load_local_cfg() {
|
|
|
|
|
string hw = "ubconfig --default --source system get clock HWCLOCK_SYNC";
|
|
|
|
|
this->get_hardware_clock(hw);
|
|
|
|
|
info_warning_error(0);
|
|
|
|
|
map_config_data_old = map_config_data;
|
|
|
|
|
map_config_data_global_local_old = map_config_data_global_local;
|
|
|
|
|
map_config_data_global_old = map_config_data_global;
|
|
|
|
|
map_config_data_local_old = map_config_data_local;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::load_globl_cfg() {
|
|
|
|
|
flag_load = true;
|
|
|
|
|
|
|
|
|
|
string cmd_get_dhcp = "ubconfig --default --source global get network NTPSERVERS";
|
|
|
|
|
string cmd_default_get_dhcp = "ubconfig --source default get [] NTPSERVERS_DEFAULT";
|
|
|
|
|
this->entry_dhcp_mess(cmd_get_dhcp, cmd_default_get_dhcp);
|
|
|
|
|
@ -407,118 +407,174 @@ void MainWindow::load_globl_cfg() {
|
|
|
|
|
string hw = "ubconfig --source global get clock HWCLOCK_SYNC";
|
|
|
|
|
this->get_hardware_clock(hw);
|
|
|
|
|
info_warning_error(1);
|
|
|
|
|
map_config_data_old = map_config_data;
|
|
|
|
|
map_config_data_global_local_old = map_config_data_global_local;
|
|
|
|
|
map_config_data_global_old = map_config_data_global;
|
|
|
|
|
map_config_data_local_old = map_config_data_local;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::save_local_cfg() {
|
|
|
|
|
string cmd_zone = "ubconfig --target system set clock ZONE=";
|
|
|
|
|
string cmd_default = "ubconfig --target system set network NTPSERVERS=default";
|
|
|
|
|
string cmd_dhcp = "ubconfig --target system set network NTPSERVERS=dhcp";
|
|
|
|
|
string cmd_set_ntp = "ubconfig --target system set network NTPSERVERS=\"";
|
|
|
|
|
string remove_ntp = "ubconfig --target system remove network NTPSERVERS";
|
|
|
|
|
string local = "ubconfig --target system set clock HWCLOCK_SYNC=localtime";
|
|
|
|
|
string hw = "ubconfig --target system set clock HWCLOCK_SYNC=utc";
|
|
|
|
|
if (this->check_config("region") == false || this->check_config("zone") == false) {
|
|
|
|
|
this->enter_zone(cmd_zone);
|
|
|
|
|
}
|
|
|
|
|
if (this->check_config("dhcp") == false) {
|
|
|
|
|
this->save_Dhcp(cmd_default, cmd_dhcp, remove_ntp, cmd_set_ntp);
|
|
|
|
|
}
|
|
|
|
|
if (this->check_config("hw") == false) {
|
|
|
|
|
this->set_hardware_clock(local, hw);
|
|
|
|
|
}
|
|
|
|
|
info_warning_error(2);
|
|
|
|
|
map_config_data_old = map_config_data;
|
|
|
|
|
if (this->check_config("region") || this->check_config("zone") ||
|
|
|
|
|
this->check_config("dhcp") || this->check_config("hw")){
|
|
|
|
|
if ((this->check_config("region", 0) && this->check_config("zone", 0) &&
|
|
|
|
|
this->check_config("dhcp", 0) && this->check_config("hw", 0))) {
|
|
|
|
|
lblWarning->set_text(_("Nothing to save!"));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
string cmd_zone = "ubconfig --target system set clock ZONE=";
|
|
|
|
|
string cmd_default = "ubconfig --target system set network NTPSERVERS=default";
|
|
|
|
|
string cmd_dhcp = "ubconfig --target system set network NTPSERVERS=dhcp";
|
|
|
|
|
string cmd_set_ntp = "ubconfig --target system set network NTPSERVERS=\"";
|
|
|
|
|
string remove_ntp = "ubconfig --target system remove network NTPSERVERS";
|
|
|
|
|
string local = "ubconfig --target system set clock HWCLOCK_SYNC=localtime";
|
|
|
|
|
string hw = "ubconfig --target system set clock HWCLOCK_SYNC=utc";
|
|
|
|
|
if ((this->check_config("region", 0) == false || this->check_config("zone", 0) == false)) {
|
|
|
|
|
this->enter_zone(cmd_zone);
|
|
|
|
|
}
|
|
|
|
|
if (this->check_config("dhcp", 0) == false) {
|
|
|
|
|
this->save_Dhcp(cmd_default, cmd_dhcp, remove_ntp, cmd_set_ntp);
|
|
|
|
|
}
|
|
|
|
|
if (this->check_config("hw", 0) == false) {
|
|
|
|
|
this->set_hardware_clock(local, hw);
|
|
|
|
|
}
|
|
|
|
|
info_warning_error(2);
|
|
|
|
|
map_config_data_local_old = map_config_data_local;
|
|
|
|
|
flag_local = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::save_global_cfg() {
|
|
|
|
|
string cmd = "ubconfig --target global set clock ZONE=";
|
|
|
|
|
string cmd_default = "ubconfig --target global set network NTPSERVERS=default";
|
|
|
|
|
string cmd_dhcp = "ubconfig --target global set network NTPSERVERS=dhcp";
|
|
|
|
|
string cmd_set_ntp = "ubconfig --target global set network NTPSERVERS=\"";
|
|
|
|
|
string remove_ntp = "ubconfig --target global remove network NTPSERVERS";
|
|
|
|
|
string local = "ubconfig --target global set clock HWCLOCK_SYNC=localtime";
|
|
|
|
|
string hw = "ubconfig --target global set clock HWCLOCK_SYNC=utc";
|
|
|
|
|
if (this->check_config("region") == false || this->check_config("zone") == false) {
|
|
|
|
|
this->enter_zone(cmd);
|
|
|
|
|
}
|
|
|
|
|
if (this->check_config("dhcp") == false) {
|
|
|
|
|
this->save_Dhcp(cmd_default, cmd_dhcp, remove_ntp, cmd_set_ntp);
|
|
|
|
|
}
|
|
|
|
|
if (this->check_config("hw") == false) {
|
|
|
|
|
this->set_hardware_clock(local, hw);
|
|
|
|
|
}
|
|
|
|
|
info_warning_error(3);
|
|
|
|
|
map_config_data_old = map_config_data;
|
|
|
|
|
if (this->check_config("region") || this->check_config("zone") ||
|
|
|
|
|
this->check_config("dhcp") || this->check_config("hw")){
|
|
|
|
|
if ((this->check_config("region", 1) && this->check_config("zone", 1) &&
|
|
|
|
|
this->check_config("dhcp", 1) && this->check_config("hw", 1))) {
|
|
|
|
|
lblWarning->set_text(_("Nothing to save!"));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
string cmd = "ubconfig --target global set clock ZONE=";
|
|
|
|
|
string cmd_default = "ubconfig --target global set network NTPSERVERS=default";
|
|
|
|
|
string cmd_dhcp = "ubconfig --target global set network NTPSERVERS=dhcp";
|
|
|
|
|
string cmd_set_ntp = "ubconfig --target global set network NTPSERVERS=\"";
|
|
|
|
|
string remove_ntp = "ubconfig --target global remove network NTPSERVERS";
|
|
|
|
|
string local = "ubconfig --target global set clock HWCLOCK_SYNC=localtime";
|
|
|
|
|
string hw = "ubconfig --target global set clock HWCLOCK_SYNC=utc";
|
|
|
|
|
if ((this->check_config("region", 1) == false || this->check_config("zone", 1) == false)) {
|
|
|
|
|
this->enter_zone(cmd);
|
|
|
|
|
}
|
|
|
|
|
if (this->check_config("dhcp", 1) == false) {
|
|
|
|
|
this->save_Dhcp(cmd_default, cmd_dhcp, remove_ntp, cmd_set_ntp);
|
|
|
|
|
}
|
|
|
|
|
if (this->check_config("hw", 1) == false) {
|
|
|
|
|
this->set_hardware_clock(local, hw);
|
|
|
|
|
}
|
|
|
|
|
info_warning_error(3);
|
|
|
|
|
map_config_data_global_old = map_config_data_global;
|
|
|
|
|
flag_global = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void MainWindow::save_global_local_cfg() {
|
|
|
|
|
string cmd = "";
|
|
|
|
|
string cmd_default = "";
|
|
|
|
|
string cmd_dhcp = "";
|
|
|
|
|
string cmd_set_ntp = "";
|
|
|
|
|
string remove = "";
|
|
|
|
|
string local = "";
|
|
|
|
|
string hw = "";
|
|
|
|
|
string remove_ntp = "";
|
|
|
|
|
string cmd_zone = "";
|
|
|
|
|
if (this->check_config("region") == false || this->check_config("zone") == false) {
|
|
|
|
|
cmd_zone = "ubconfig --target system set clock ZONE=";
|
|
|
|
|
this->enter_zone(cmd_zone);
|
|
|
|
|
cmd_zone = "ubconfig --target global set clock ZONE=";
|
|
|
|
|
this->enter_zone(cmd_zone);
|
|
|
|
|
}
|
|
|
|
|
if (this->check_config("dhcp") == false) {
|
|
|
|
|
cmd_default = "ubconfig --target system set network NTPSERVERS=default";
|
|
|
|
|
cmd_dhcp = "ubconfig --target system set network NTPSERVERS=dhcp";
|
|
|
|
|
cmd_set_ntp = "ubconfig --target system set network NTPSERVERS=\"";
|
|
|
|
|
remove_ntp = "ubconfig --target system remove network NTPSERVERS";
|
|
|
|
|
this->save_Dhcp(cmd_default, cmd_dhcp, remove_ntp, cmd_set_ntp);
|
|
|
|
|
cmd_default = "ubconfig --target global set network NTPSERVERS=default";
|
|
|
|
|
cmd_dhcp = "ubconfig --target global set network NTPSERVERS=dhcp";
|
|
|
|
|
cmd_set_ntp = "ubconfig --target global set network NTPSERVERS=\"";
|
|
|
|
|
remove_ntp = "ubconfig --target global remove network NTPSERVERS";
|
|
|
|
|
this->save_Dhcp(cmd_default, cmd_dhcp, remove_ntp, cmd_set_ntp);
|
|
|
|
|
}
|
|
|
|
|
if (this->check_config("hw") == false) {
|
|
|
|
|
local = "ubconfig --target system set clock HWCLOCK_SYNC=localtime";
|
|
|
|
|
hw = "ubconfig --target system set clock HWCLOCK_SYNC=utc";
|
|
|
|
|
this->set_hardware_clock(local, hw);
|
|
|
|
|
local = "ubconfig --target global set clock HWCLOCK_SYNC=localtime";
|
|
|
|
|
hw = "ubconfig --target global set clock HWCLOCK_SYNC=utc";
|
|
|
|
|
this->set_hardware_clock(local, hw);
|
|
|
|
|
}
|
|
|
|
|
map_config_data_old = map_config_data;
|
|
|
|
|
info_warning_error(4);
|
|
|
|
|
if (this->check_config("region") || this->check_config("zone") ||
|
|
|
|
|
this->check_config("dhcp") || this->check_config("hw")){
|
|
|
|
|
if ((this->check_config("region", 2) && this->check_config("zone", 2) &&
|
|
|
|
|
this->check_config("dhcp", 2) && this->check_config("hw", 2))) {
|
|
|
|
|
lblWarning->set_text(_("Nothing to save!"));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
string cmd = "";
|
|
|
|
|
string cmd_default = "";
|
|
|
|
|
string cmd_dhcp = "";
|
|
|
|
|
string cmd_set_ntp = "";
|
|
|
|
|
string remove = "";
|
|
|
|
|
string local = "";
|
|
|
|
|
string hw = "";
|
|
|
|
|
string remove_ntp = "";
|
|
|
|
|
string cmd_zone = "";
|
|
|
|
|
if ((this->check_config("region", 2) == false || this->check_config("zone", 2) == false)) {
|
|
|
|
|
cmd_zone = "ubconfig --target system set clock ZONE=";
|
|
|
|
|
this->enter_zone(cmd_zone);
|
|
|
|
|
cmd_zone = "ubconfig --target global set clock ZONE=";
|
|
|
|
|
this->enter_zone(cmd_zone);
|
|
|
|
|
}
|
|
|
|
|
if (this->check_config("dhcp", 2) == false) {
|
|
|
|
|
cmd_default = "ubconfig --target system set network NTPSERVERS=default";
|
|
|
|
|
cmd_dhcp = "ubconfig --target system set network NTPSERVERS=dhcp";
|
|
|
|
|
cmd_set_ntp = "ubconfig --target system set network NTPSERVERS=\"";
|
|
|
|
|
remove_ntp = "ubconfig --target system remove network NTPSERVERS";
|
|
|
|
|
this->save_Dhcp(cmd_default, cmd_dhcp, remove_ntp, cmd_set_ntp);
|
|
|
|
|
cmd_default = "ubconfig --target global set network NTPSERVERS=default";
|
|
|
|
|
cmd_dhcp = "ubconfig --target global set network NTPSERVERS=dhcp";
|
|
|
|
|
cmd_set_ntp = "ubconfig --target global set network NTPSERVERS=\"";
|
|
|
|
|
remove_ntp = "ubconfig --target global remove network NTPSERVERS";
|
|
|
|
|
this->save_Dhcp(cmd_default, cmd_dhcp, remove_ntp, cmd_set_ntp);
|
|
|
|
|
}
|
|
|
|
|
if (this->check_config("hw", 2) == false) {
|
|
|
|
|
local = "ubconfig --target system set clock HWCLOCK_SYNC=localtime";
|
|
|
|
|
hw = "ubconfig --target system set clock HWCLOCK_SYNC=utc";
|
|
|
|
|
this->set_hardware_clock(local, hw);
|
|
|
|
|
local = "ubconfig --target global set clock HWCLOCK_SYNC=localtime";
|
|
|
|
|
hw = "ubconfig --target global set clock HWCLOCK_SYNC=utc";
|
|
|
|
|
this->set_hardware_clock(local, hw);
|
|
|
|
|
}
|
|
|
|
|
map_config_data_global_local_old = map_config_data_global_local;
|
|
|
|
|
info_warning_error(4);
|
|
|
|
|
flag_global_local = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::write_config(std::map <string, string> &map_config, string data, string key) {
|
|
|
|
|
cout << data << " " << key << endl;
|
|
|
|
|
map_config[key] = data;
|
|
|
|
|
void MainWindow::write_config(string data, string key) {
|
|
|
|
|
|
|
|
|
|
std::map <string, string>:: iterator it, it2, it3;
|
|
|
|
|
it3 = map_config_data_global_local.find(key);
|
|
|
|
|
it2 = map_config_data_global.find(key);
|
|
|
|
|
it = map_config_data_local.find(key);
|
|
|
|
|
if (it != map_config_data_local.end() || it2 != map_config_data_global.end() || it3 != map_config_data_global_local.end()) {
|
|
|
|
|
if (map_config_data_local[key] != data) {
|
|
|
|
|
map_config_data_global[key] = data;
|
|
|
|
|
map_config_data_local[key] = data;
|
|
|
|
|
map_config_data_global_local[key] = data;
|
|
|
|
|
flag_local = false;
|
|
|
|
|
flag_global = false;
|
|
|
|
|
flag_global_local = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (it == map_config_data_local.end() || it2 == map_config_data_global.end() || it3 == map_config_data_global_local.end()) {
|
|
|
|
|
map_config_data_global[key] = data;
|
|
|
|
|
map_config_data_local[key] = data;
|
|
|
|
|
map_config_data_global_local[key] = data;
|
|
|
|
|
flag_local = false;
|
|
|
|
|
flag_global = false;
|
|
|
|
|
flag_global_local = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool MainWindow::check_config(string key) {
|
|
|
|
|
bool MainWindow::check_config(string key, int key_save) {
|
|
|
|
|
std::map <string, string>:: iterator iter_map_config_data;
|
|
|
|
|
std::map <string, string>:: iterator iter_map_config_data_old;
|
|
|
|
|
std::map <string, string> map_config_data;
|
|
|
|
|
std::map <string, string> map_config_data_old;
|
|
|
|
|
if (key_save == 0 && flag_local == true) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (key_save == 1 && flag_global == true) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (key_save == 2 && flag_global_local == true) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if (key_save == 0) {
|
|
|
|
|
iter_map_config_data = map_config_data_local.find(key);
|
|
|
|
|
map_config_data = map_config_data_local;
|
|
|
|
|
map_config_data_old = map_config_data_local_old;
|
|
|
|
|
}
|
|
|
|
|
else if (key_save == 1) {
|
|
|
|
|
iter_map_config_data = map_config_data_global.find(key);
|
|
|
|
|
map_config_data = map_config_data_global;
|
|
|
|
|
map_config_data_old = map_config_data_global_old;
|
|
|
|
|
}
|
|
|
|
|
else if (key_save == 2) {
|
|
|
|
|
iter_map_config_data = map_config_data_global_local.find(key);
|
|
|
|
|
map_config_data = map_config_data_global_local;
|
|
|
|
|
map_config_data_old = map_config_data_global_local_old;
|
|
|
|
|
}
|
|
|
|
|
iter_map_config_data = map_config_data.find(key);
|
|
|
|
|
iter_map_config_data_old = map_config_data_old.find(key);
|
|
|
|
|
if (iter_map_config_data == map_config_data.end()) {
|
|
|
|
|
cout << 1 << endl;
|
|
|
|
|
if (iter_map_config_data == map_config_data.end()) {;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if (iter_map_config_data_old == map_config_data_old.end()) {
|
|
|
|
|
cout << 2 << endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if (iter_map_config_data->second != iter_map_config_data_old->second) {
|
|
|
|
|
@ -644,7 +700,7 @@ void MainWindow::get_hardware_clock(string &cmd) {
|
|
|
|
|
int error = warning_info;
|
|
|
|
|
struct Result<string> obj_result = this->wrapper_call(cmd);
|
|
|
|
|
if (obj_result.error == 0) {
|
|
|
|
|
this->write_config(map_config_data, obj_result.response, "hw");
|
|
|
|
|
this->write_config(obj_result.response, "hw");
|
|
|
|
|
if (obj_result.response.find("localtime") != string::npos) {
|
|
|
|
|
if (array_hw[0] == "localtime"){
|
|
|
|
|
cbHw->set_active(0);
|
|
|
|
|
@ -667,7 +723,7 @@ void MainWindow::get_hardware_clock(string &cmd) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
this->write_config(map_config_data, "", "hw");
|
|
|
|
|
this->write_config("", "hw");
|
|
|
|
|
cbHw->set_active(-1);
|
|
|
|
|
}
|
|
|
|
|
if (error != warning_info){
|
|
|
|
|
@ -709,7 +765,7 @@ bool MainWindow::focus_ntp(string &cmd_set_ntp) {
|
|
|
|
|
}
|
|
|
|
|
if ((flag_error == false) && (flag_error_check_ntp == false)) {
|
|
|
|
|
cmd = cmd_set_ntp + str_ntp + "\"";
|
|
|
|
|
this->write_config(map_config_data, str_ntp, "dhcp");
|
|
|
|
|
this->write_config(str_ntp, "dhcp");
|
|
|
|
|
wrapper_system(cmd, "&");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
@ -839,18 +895,18 @@ void MainWindow::event_entry_cbDhcp() {
|
|
|
|
|
int activ_index = cbDhcp->get_active_row_number();
|
|
|
|
|
if (str_dhcp.length() == 0) {
|
|
|
|
|
cbDhcp->set_active(0);
|
|
|
|
|
this->write_config(map_config_data, "default", "dhcp");
|
|
|
|
|
this->write_config("default", "dhcp");
|
|
|
|
|
}
|
|
|
|
|
else if (activ_index == 0) {
|
|
|
|
|
txtNtpServer->set_text(default_get_dhcp);
|
|
|
|
|
txtNtpServer->set_sensitive(false);
|
|
|
|
|
this->write_config(map_config_data, "default", "dhcp");
|
|
|
|
|
this->write_config("default", "dhcp");
|
|
|
|
|
}
|
|
|
|
|
else if (activ_index == 1) {
|
|
|
|
|
// btnUpdateDateTime->set_sensitive(false);
|
|
|
|
|
txtNtpServer->set_sensitive(false);
|
|
|
|
|
txtNtpServer->set_text("");
|
|
|
|
|
this->write_config(map_config_data, "dhcp", "dhcp");
|
|
|
|
|
this->write_config("dhcp", "dhcp");
|
|
|
|
|
}
|
|
|
|
|
else if (activ_index == 2) {
|
|
|
|
|
txtNtpServer->set_text("");
|
|
|
|
|
@ -866,15 +922,15 @@ void MainWindow::event_entry_cbDhcp() {
|
|
|
|
|
if (response != "dhcp" && response != "default"){
|
|
|
|
|
txtNtpServer->set_text(response);
|
|
|
|
|
}
|
|
|
|
|
this->write_config(map_config_data, response, "dhcp");
|
|
|
|
|
this->write_config(response, "dhcp");
|
|
|
|
|
txtNtpServer->set_sensitive(true);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
this->write_config(map_config_data, "", "dhcp");
|
|
|
|
|
this->write_config("", "dhcp");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (activ_index == 3) {
|
|
|
|
|
this->write_config(map_config_data, "", "dhcp");
|
|
|
|
|
this->write_config("", "dhcp");
|
|
|
|
|
txtNtpServer->set_text("");
|
|
|
|
|
txtNtpServer->set_sensitive(false);
|
|
|
|
|
// btnUpdateDateTime->set_sensitive(true);
|
|
|
|
|
@ -887,11 +943,11 @@ void MainWindow::save_Dhcp(string &cmd_default, string &cmd_dhcp, string &remove
|
|
|
|
|
if (str_dhcp.length() == 0) {
|
|
|
|
|
}
|
|
|
|
|
else if (activ_index == 0) {
|
|
|
|
|
this->write_config(map_config_data, "default", "dhcp");
|
|
|
|
|
this->write_config("default", "dhcp");
|
|
|
|
|
wrapper_system(cmd_default, "&");
|
|
|
|
|
}
|
|
|
|
|
else if (activ_index == 1) {
|
|
|
|
|
this->write_config(map_config_data, "dhcp", "dhcp");
|
|
|
|
|
this->write_config("dhcp", "dhcp");
|
|
|
|
|
wrapper_system(cmd_dhcp, "&");
|
|
|
|
|
}
|
|
|
|
|
else if (activ_index == 2) {
|
|
|
|
|
@ -904,7 +960,7 @@ void MainWindow::save_Dhcp(string &cmd_default, string &cmd_dhcp, string &remove
|
|
|
|
|
if (start_error != error_info) {
|
|
|
|
|
error_info=start_error;
|
|
|
|
|
}
|
|
|
|
|
this->write_config(map_config_data, "", "dhcp");
|
|
|
|
|
this->write_config("", "dhcp");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -917,7 +973,7 @@ void MainWindow::entry_dhcp_mess(string cmd_get_dhcp, string cmd_default_get_dhc
|
|
|
|
|
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") {
|
|
|
|
|
this->write_config(map_config_data, "dhcp", "dhcp");
|
|
|
|
|
this->write_config("dhcp", "dhcp");
|
|
|
|
|
cbDhcp->set_active(1);
|
|
|
|
|
txtNtpServer->set_text("");
|
|
|
|
|
txtNtpServer->set_sensitive(false);
|
|
|
|
|
@ -927,7 +983,7 @@ void MainWindow::entry_dhcp_mess(string cmd_get_dhcp, string cmd_default_get_dhc
|
|
|
|
|
cbDhcp->set_active(0);
|
|
|
|
|
cmd = cmd_default_get_dhcp;
|
|
|
|
|
struct Result<string> obj_result = this->wrapper_call(cmd);
|
|
|
|
|
this->write_config(map_config_data, "default", "dhcp");
|
|
|
|
|
this->write_config("default", "dhcp");
|
|
|
|
|
txtNtpServer->set_sensitive(false);
|
|
|
|
|
if (obj_result.error== 0) {
|
|
|
|
|
txtNtpServer->set_text(obj_result.response);
|
|
|
|
|
@ -941,18 +997,18 @@ void MainWindow::entry_dhcp_mess(string cmd_get_dhcp, string cmd_default_get_dhc
|
|
|
|
|
else {
|
|
|
|
|
// btnUpdateDateTime->set_sensitive(false);
|
|
|
|
|
if (str_dhcp == "") {
|
|
|
|
|
this->write_config(map_config_data, "", "dhcp");
|
|
|
|
|
this->write_config("", "dhcp");
|
|
|
|
|
lblMessage->set_text(_("Enter DHCP!"));
|
|
|
|
|
windowMessDchp->show();
|
|
|
|
|
}
|
|
|
|
|
else if (str_dhcp == "(null)") {
|
|
|
|
|
cbDhcp->set_active(0);
|
|
|
|
|
txtNtpServer->set_text("");
|
|
|
|
|
this->write_config(map_config_data, "", "dhcp");
|
|
|
|
|
this->write_config("", "dhcp");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
cbDhcp->set_active(2);
|
|
|
|
|
this->write_config(map_config_data, str_dhcp, "dhcp");
|
|
|
|
|
this->write_config(str_dhcp, "dhcp");
|
|
|
|
|
txtNtpServer->set_text(str_dhcp);
|
|
|
|
|
if (flag_ntp_edit ==false) {
|
|
|
|
|
txtNtpServer->set_sensitive(true);
|
|
|
|
|
@ -961,7 +1017,7 @@ void MainWindow::entry_dhcp_mess(string cmd_get_dhcp, string cmd_default_get_dhc
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
this->write_config(map_config_data, "", "dhcp");
|
|
|
|
|
this->write_config("", "dhcp");
|
|
|
|
|
cbDhcp->set_active(3);
|
|
|
|
|
txtNtpServer->set_text("");
|
|
|
|
|
txtNtpServer->set_sensitive(false);
|
|
|
|
|
@ -1113,8 +1169,8 @@ void MainWindow::parse_text_date() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::append_region_zone(string region, string zone, Gtk::ComboBoxText *tmpCbReg, Gtk::ComboBoxText *tmpCbZone) {
|
|
|
|
|
this->write_config(map_config_data, region, "region");
|
|
|
|
|
this->write_config(map_config_data, zone, "zone");
|
|
|
|
|
this->write_config(region, "region");
|
|
|
|
|
this->write_config(zone, "zone");
|
|
|
|
|
str_region = region;
|
|
|
|
|
int index = 0;
|
|
|
|
|
Glib::ustring reg_local = "";
|
|
|
|
|
@ -1219,7 +1275,7 @@ void MainWindow::append_zone() {
|
|
|
|
|
if (index!=-1) {
|
|
|
|
|
string str_region = array_region[index];
|
|
|
|
|
string zone_mixing = "";
|
|
|
|
|
this->write_config(map_config_data, str_region, "region");
|
|
|
|
|
this->write_config(str_region, "region");
|
|
|
|
|
string path_dir = "";
|
|
|
|
|
if(str_region.length() != 0) {
|
|
|
|
|
for (const auto &_str_zone : time_reg_map_local.at(str_region)) {
|
|
|
|
|
|