Исправлен баг с информационной панелью

pull/11/head
Igor Belitskiy 3 years ago
parent 14ba70c4b5
commit 027cd6b258

@ -34,31 +34,24 @@ bool Save::check_save(string flag_save, string key_name) {
}
iter_map_data = (*map_gui).find(key_name);
iter_map_data_old = (*map_data_old).find(key_name);
//cout << (*map_local)[key_name] << " || " << (*map_gui)[key_name] << " || " << (*map_global)[key_name] << endl;
if ((*map_local).find(key_name) != (*map_local).end() && (*map_global).find(key_name) != (*map_global).end()) {
if ((*map_local)[key_name] != (*map_global)[key_name]) {
//cout << 1 << endl;
return true;
}
}
if (iter_map_data_old == (*map_data_old).end() && iter_map_data != (*map_gui).end()) {
//cout << 3 << endl;
return true;
}
else if (iter_map_data->second != iter_map_data_old->second) {
//cout << 4 << endl;
return true;
}
else if (iter_map_data->second.length() == 0 && iter_map_data_old->second.length() == 0) {
//cout << 5 << endl;
return false;
}
else if (iter_map_data->second == iter_map_data_old->second) {
//cout << 6 << endl;
return false;
}
else {
//cout << 7 << endl;
return true;
}
return true;
@ -114,4 +107,49 @@ void Save::save(string sections, string str_flag_save) {
}
}
void Save::save_all(string sections, string str_flag_save) {
string key = "";
string value = "";
string cmd_all = "ubconfig --target " + str_flag_save + " set " + sections;
size_t len_start_cmd_all = cmd_all.length();
string str_error = "";
this->flag_no_save = true;
string cmd = "";
string cmd_remove = "";
for (const auto &key: *vec_param_names) {
if (map_gui->find(key) != map_gui->end()) {
value = (*map_gui)[key];
if (this->check_save(str_flag_save, key)) {
if (value.length() != 0) {
cmd_all += " " + key + "=\"" + value + "\"";
}
else if (value.length() == 0) {
cmd = "ubconfig --target " + str_flag_save + " remove " + sections + " " + key;
}
else {
cmd = "";
}
if (cmd.length() != 0) {
process.call(cmd, "");
this->flag_no_save = false;
str_error = process.get_cmd_error();
if (str_error.length() != 0) {
this->vec_errors.push_back(str_error);
str_error = "";
}
}
}
}
}
if (len_start_cmd_all != cmd_all.length()) {
process.call(cmd, "");
this->flag_no_save = false;
str_error = process.get_cmd_error();
if (str_error.length() != 0) {
this->vec_errors.push_back(str_error);
str_error = "";
}
}
}
}

@ -21,6 +21,7 @@ public:
bool get_state_save();
int get_count_error();
string get_cmd_error();
void save_all(string sections, string str_flag_save);
void set_count_error(int count_error);
void set_vec_params(vector<string>& vec_param_names);
void save(string sections, string str_flag_save) ;

@ -472,10 +472,14 @@ vector<string> MainWindow::get_setting_entry_all(string key, std::map <string, s
bool MainWindow::focus_out_txt_password(GdkEventFocus*) {
if (entryPasswordProtecc->get_text().length() == 0) {
info_status_app("boxInfoMessError");
imgInfo->set_from_icon_name("com.ublinux.ubl-settings-bootloader.warning", Gtk::ICON_SIZE_MENU);
lblWarning->set_text(_("Enter your password"));
boxSave->set_sensitive(false);
}
else {
info_status_app("boxInfoMessOK");
imgInfo->set_from_icon_name("com.ublinux.ubl-settings-bootloader.checked", Gtk::ICON_SIZE_MENU);
lblWarning->set_text("");
boxSave->set_sensitive(true);
string key = entryPasswordProtecc->get_text();
if (key != "************") {
@ -488,10 +492,14 @@ bool MainWindow::focus_out_txt_password(GdkEventFocus*) {
bool MainWindow::focus_out_txt_login(GdkEventFocus*) {
if (entrySecurityLogin->get_text().length() == 0) {
info_status_app("boxInfoMessError");
imgInfo->set_from_icon_name("com.ublinux.ubl-settings-bootloader.warning", Gtk::ICON_SIZE_MENU);
lblWarning->set_text(_("Enter login"));
boxSave->set_sensitive(false);
}
else {
info_status_app("boxInfoMessOK");
imgInfo->set_from_icon_name("com.ublinux.ubl-settings-bootloader.checked", Gtk::ICON_SIZE_MENU);
lblWarning->set_text("");
map_cmd_selection["GRUB_USER"] = entrySecurityLogin->get_text();
boxSave->set_sensitive(true);
}
@ -607,6 +615,9 @@ void MainWindow::change_security_login() {
entrySecurityLogin->set_sensitive(false);
entrySecurityLogin->set_text("");
boxSave->set_sensitive(true);
info_status_app("boxInfoMessOK");
imgInfo->set_from_icon_name("com.ublinux.ubl-settings-bootloader.checked", Gtk::ICON_SIZE_MENU);
lblWarning->set_text("");
}
else if (index == 1) {
entrySecurityLogin->set_sensitive(true);
@ -643,6 +654,9 @@ void MainWindow::change_password_protecc() {
entryPasswordProtecc->set_sensitive(false);
entryPasswordProtecc->set_text("");
boxSave->set_sensitive(true);
info_status_app("boxInfoMessOK");
imgInfo->set_from_icon_name("com.ublinux.ubl-settings-bootloader.checked", Gtk::ICON_SIZE_MENU);
lblWarning->set_text("");
}
else if (index == 1) {
entryPasswordProtecc->set_sensitive(true);

Loading…
Cancel
Save