|
|
|
|
@ -396,6 +396,7 @@ void MainWindow::synopsis_show() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::load_local_cfg() {
|
|
|
|
|
flag_local_global_load = 0;
|
|
|
|
|
flag_load = false;
|
|
|
|
|
string cmd_zone = "ubconfig --default --source system get clock ZONE";
|
|
|
|
|
this->fill_in_reg_zone(cmd_zone);
|
|
|
|
|
@ -407,12 +408,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_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;
|
|
|
|
|
flag_local_global_load = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::load_globl_cfg() {
|
|
|
|
|
flag_local_global_load = 1;
|
|
|
|
|
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";
|
|
|
|
|
@ -422,9 +424,9 @@ 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_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;
|
|
|
|
|
flag_local_global_load = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::save_local_cfg() {
|
|
|
|
|
@ -453,9 +455,6 @@ void MainWindow::save_local_cfg() {
|
|
|
|
|
info_warning_error(2);
|
|
|
|
|
map_config_data_local_old = map_config_data_local;
|
|
|
|
|
flag_local = true;
|
|
|
|
|
if (flag_global and flag_local){
|
|
|
|
|
map_config_data_global_local_old = map_config_data_global_local;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -485,14 +484,14 @@ void MainWindow::save_global_cfg() {
|
|
|
|
|
info_warning_error(3);
|
|
|
|
|
map_config_data_global_old = map_config_data_global;
|
|
|
|
|
flag_global = true;
|
|
|
|
|
if (flag_global and flag_local){
|
|
|
|
|
map_config_data_global_local_old = map_config_data_global_local;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::save_global_local_cfg() {
|
|
|
|
|
if ((this->check_config("region", 2) && this->check_config("zone", 2) &&
|
|
|
|
|
this->check_config("dhcp", 2) && this->check_config("hw", 2))) {
|
|
|
|
|
if ((this->check_config("region", 0) && this->check_config("zone", 0) &&
|
|
|
|
|
this->check_config("dhcp", 0) && this->check_config("hw", 0)) &&
|
|
|
|
|
(this->check_config("region", 1) && this->check_config("zone", 1) &&
|
|
|
|
|
this->check_config("dhcp", 1) && this->check_config("hw", 1))) {
|
|
|
|
|
info_status_app("boxInfoMessOK");
|
|
|
|
|
lblWarning->set_text(gettext("Nothing to save!"));
|
|
|
|
|
}
|
|
|
|
|
@ -506,17 +505,21 @@ void MainWindow::save_global_local_cfg() {
|
|
|
|
|
string hw = "";
|
|
|
|
|
string remove_ntp = "";
|
|
|
|
|
string cmd_zone = "";
|
|
|
|
|
if ((this->check_config("region", 2) == false || this->check_config("zone", 2) == false)) {
|
|
|
|
|
if (flag_local == false) {}
|
|
|
|
|
if (flag_global == false) {}
|
|
|
|
|
if ((this->check_config("region", 0) == false || this->check_config("zone", 0) == false)) {
|
|
|
|
|
if (flag_local == false) {
|
|
|
|
|
cmd_zone = "ubconfig --target system set clock ZONE=";
|
|
|
|
|
this->enter_zone(cmd_zone);
|
|
|
|
|
}
|
|
|
|
|
if ((this->check_config("region", 0) == false || this->check_config("zone", 0) == false)) {
|
|
|
|
|
if (flag_global == false) {
|
|
|
|
|
cmd_zone = "ubconfig --target global set clock ZONE=";
|
|
|
|
|
this->enter_zone(cmd_zone);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (this->check_config("dhcp", 2) == false) {
|
|
|
|
|
}
|
|
|
|
|
if (this->check_config("dhcp", 0) == false) {
|
|
|
|
|
if (flag_local == false) {
|
|
|
|
|
cmd_default = "ubconfig --target system set network NTPSERVERS=default";
|
|
|
|
|
cmd_dhcp = "ubconfig --target system set network NTPSERVERS=dhcp";
|
|
|
|
|
@ -524,6 +527,8 @@ void MainWindow::save_global_local_cfg() {
|
|
|
|
|
remove_ntp = "ubconfig --target system remove network NTPSERVERS";
|
|
|
|
|
this->save_Dhcp(cmd_default, cmd_dhcp, remove_ntp, cmd_set_ntp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (this->check_config("dhcp", 1) == false) {
|
|
|
|
|
if (flag_global == false) {
|
|
|
|
|
cmd_default = "ubconfig --target global set network NTPSERVERS=default";
|
|
|
|
|
cmd_dhcp = "ubconfig --target global set network NTPSERVERS=dhcp";
|
|
|
|
|
@ -532,19 +537,20 @@ void MainWindow::save_global_local_cfg() {
|
|
|
|
|
this->save_Dhcp(cmd_default, cmd_dhcp, remove_ntp, cmd_set_ntp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (this->check_config("hw", 2) == false) {
|
|
|
|
|
if (this->check_config("hw", 0) == false) {
|
|
|
|
|
if (flag_local == 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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (this->check_config("hw", 1) == false) {
|
|
|
|
|
if (flag_global == false) {
|
|
|
|
|
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;
|
|
|
|
|
map_config_data_global_old = map_config_data_global;
|
|
|
|
|
map_config_data_local_old = map_config_data_local;
|
|
|
|
|
info_warning_error(4);
|
|
|
|
|
@ -554,25 +560,37 @@ void MainWindow::save_global_local_cfg() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
|
if (it != map_config_data_local.end() || it2 != map_config_data_global.end()) {
|
|
|
|
|
if (flag_local_global_load == 2) {
|
|
|
|
|
map_config_data_global[key] = data;
|
|
|
|
|
map_config_data_local[key] = data;
|
|
|
|
|
}
|
|
|
|
|
else if (flag_local_global_load == 1) {
|
|
|
|
|
map_config_data_global[key] = data;
|
|
|
|
|
}
|
|
|
|
|
else if (flag_local_global_load == 0) {
|
|
|
|
|
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()) {
|
|
|
|
|
if (flag_local_global_load == 2) {
|
|
|
|
|
map_config_data_global[key] = data;
|
|
|
|
|
map_config_data_local[key] = data;
|
|
|
|
|
}
|
|
|
|
|
else if (it == map_config_data_local.end() || it2 == map_config_data_global.end() || it3 == map_config_data_global_local.end()) {
|
|
|
|
|
else if (flag_local_global_load == 1) {
|
|
|
|
|
map_config_data_global[key] = data;
|
|
|
|
|
}
|
|
|
|
|
else if (flag_local_global_load == 0) {
|
|
|
|
|
map_config_data_local[key] = data;
|
|
|
|
|
map_config_data_global_local[key] = data;
|
|
|
|
|
}
|
|
|
|
|
flag_local = false;
|
|
|
|
|
flag_global = false;
|
|
|
|
|
flag_global_local = false;
|
|
|
|
|
@ -584,8 +602,21 @@ bool MainWindow::check_config(string key, int key_save) {
|
|
|
|
|
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 (map_config_data_global.find(key) != map_config_data_global.end() &&
|
|
|
|
|
map_config_data_local.find(key) != map_config_data_local.end() &&
|
|
|
|
|
map_config_data_global_old.find(key) != map_config_data_global_old.end() &&
|
|
|
|
|
map_config_data_local_old.find(key) != map_config_data_local_old.end()) {
|
|
|
|
|
if (map_config_data_global[key] != map_config_data_local_old[key] ||
|
|
|
|
|
map_config_data_global_old[key] != map_config_data_local[key]) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (map_config_data_global[key] != map_config_data_local[key]) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((key_save == 0 || key_save == 1) && flag_global_local == true) {
|
|
|
|
|
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;
|
|
|
|
|
return true;
|
|
|
|
|
@ -612,14 +643,9 @@ bool MainWindow::check_config(string key, int key_save) {
|
|
|
|
|
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()) {;
|
|
|
|
|
if (iter_map_config_data == map_config_data.end()) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if (iter_map_config_data_old == map_config_data_old.end()) {
|
|
|
|
|
@ -1398,7 +1424,6 @@ void MainWindow::update_time_date() {
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
flag_error_time = this->post_entry_data();
|
|
|
|
|
cout << 1111 << endl;
|
|
|
|
|
year = 0;
|
|
|
|
|
month = 0;
|
|
|
|
|
day = 0;
|
|
|
|
|
|