|
|
|
|
@ -165,42 +165,35 @@ void MainWindow::item_selected_IPT(const Gtk::TreeModel::Path& path, const Gtk::
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::get_download_mode(string cmd, std::map <string, string> &map_temp) {
|
|
|
|
|
int start_error = index_error;
|
|
|
|
|
struct Result<string> res_response = this->wrapper_call(cmd);
|
|
|
|
|
if (res_response.error == 0) {
|
|
|
|
|
Utils::str_replace_all(res_response.response, "\"","");
|
|
|
|
|
if (res_response.response == "splash") {
|
|
|
|
|
void MainWindow::get_download_mode(std::map <string, string> &map_temp) {
|
|
|
|
|
std::map <string, string>:: iterator iter_map_data;
|
|
|
|
|
iter_map_data = map_temp.find("GRUB_BOOT_SILENT");
|
|
|
|
|
if (iter_map_data != map_temp.end()) {
|
|
|
|
|
string value = iter_map_data->second;
|
|
|
|
|
if (value.length() != 0) {
|
|
|
|
|
Utils::str_replace_all(value, "\"","");
|
|
|
|
|
if (value == "splash") {
|
|
|
|
|
cmbDownloadMode->set_active(0);
|
|
|
|
|
map_temp["GRUB_BOOT_SILENT"] = "splash";
|
|
|
|
|
}
|
|
|
|
|
else if (res_response.response == "splash quiet ub.silent") {
|
|
|
|
|
else if (value == "splash quiet ub.silent") {
|
|
|
|
|
cmbDownloadMode->set_active(1);
|
|
|
|
|
map_temp["GRUB_BOOT_SILENT"] = "splash quiet ub.silent";
|
|
|
|
|
}
|
|
|
|
|
else if (res_response.response == "quiet ub.silent") {
|
|
|
|
|
else if (value == "quiet ub.silent") {
|
|
|
|
|
cmbDownloadMode->set_active(2);
|
|
|
|
|
map_temp["GRUB_BOOT_SILENT"] = "quiet ub.silent";
|
|
|
|
|
}
|
|
|
|
|
else if (res_response.response == "plymouth.enable=0") {
|
|
|
|
|
else if (value == "plymouth.enable=0") {
|
|
|
|
|
cmbDownloadMode->set_active(3);
|
|
|
|
|
map_temp["GRUB_BOOT_SILENT"] = "plymouth.enable=0";
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
cmbDownloadMode->set_active(-1);
|
|
|
|
|
map_temp["GRUB_BOOT_SILENT"] = "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (res_response.error == 3) {
|
|
|
|
|
else {
|
|
|
|
|
cmbDownloadMode->set_active(-1);
|
|
|
|
|
map_temp["GRUB_BOOT_SILENT"] = "";
|
|
|
|
|
if (start_error != index_error) {
|
|
|
|
|
index_error = start_error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
cmbDownloadMode->set_active(-1);
|
|
|
|
|
map_temp["GRUB_BOOT_SILENT"] = "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -224,7 +217,7 @@ void MainWindow::set_download_mode(string cmd="") {
|
|
|
|
|
}
|
|
|
|
|
if (cmd.length() !=0 ) {
|
|
|
|
|
cmd += "\"" + key + "\"";
|
|
|
|
|
wrapper_system(cmd, "");
|
|
|
|
|
obj_process_system.call(cmd, "");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
flag_save_local = true;
|
|
|
|
|
@ -240,7 +233,7 @@ void MainWindow::set_security_login(string cmd = "", string cmd_remove = "") {
|
|
|
|
|
if (index == 0) {
|
|
|
|
|
key = "";
|
|
|
|
|
if (cmd_remove.length() != 0) {
|
|
|
|
|
wrapper_system(cmd_remove, "");
|
|
|
|
|
obj_process_system.call(cmd_remove, "");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
flag_save_local = true;
|
|
|
|
|
@ -253,7 +246,7 @@ void MainWindow::set_security_login(string cmd = "", string cmd_remove = "") {
|
|
|
|
|
if (cmd.length() != 0) {
|
|
|
|
|
entrySecurityLogin->set_text(key);
|
|
|
|
|
cmd = cmd + "\"" + key + "\"";
|
|
|
|
|
wrapper_system(cmd, "");
|
|
|
|
|
obj_process_system.call(cmd, "");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
flag_save_local = true;
|
|
|
|
|
@ -267,39 +260,28 @@ void MainWindow::set_security_login(string cmd = "", string cmd_remove = "") {
|
|
|
|
|
map_cmd_selection["GRUB_USER"] = key;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::get_security_login(string cmd, std::map <string, string> &map_temp) {
|
|
|
|
|
int start_error = index_error;
|
|
|
|
|
struct Result<string> res_response = this->wrapper_call(cmd);
|
|
|
|
|
// TODO:
|
|
|
|
|
// Убрать в будущем
|
|
|
|
|
string default_login = "superadmin";
|
|
|
|
|
if (res_response.error == 0) {
|
|
|
|
|
Utils::str_replace_all(res_response.response, " ","");
|
|
|
|
|
Utils::str_replace_all(res_response.response, "\"","");
|
|
|
|
|
if (res_response.response.length() > 0) {
|
|
|
|
|
void MainWindow::get_security_login(std::map <string, string> &map_temp) {
|
|
|
|
|
std::map <string, string>:: iterator iter_map_data;
|
|
|
|
|
iter_map_data = map_temp.find("GRUB_USER");
|
|
|
|
|
if (iter_map_data != map_temp.end()) {
|
|
|
|
|
string value = iter_map_data->second;
|
|
|
|
|
if (value.length() != 0) {
|
|
|
|
|
Utils::str_replace_all(value, " ","");
|
|
|
|
|
Utils::str_replace_all(value, "\"","");
|
|
|
|
|
chbSecurityLogin->set_active(1);
|
|
|
|
|
map_temp["GRUB_USER"] = res_response.response;
|
|
|
|
|
entrySecurityLogin->set_sensitive(true);
|
|
|
|
|
entrySecurityLogin->set_text(res_response.response);
|
|
|
|
|
entrySecurityLogin->set_text(value);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
chbSecurityLogin->set_active(-1);
|
|
|
|
|
map_temp["GRUB_USER"] = "";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (res_response.error == 3) {
|
|
|
|
|
map_temp["GRUB_USER"] = "";
|
|
|
|
|
if (start_error != index_error) {
|
|
|
|
|
index_error = start_error;
|
|
|
|
|
}
|
|
|
|
|
chbSecurityLogin->set_active(0);
|
|
|
|
|
entrySecurityLogin->set_text("");
|
|
|
|
|
entrySecurityLogin->set_sensitive(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
chbSecurityLogin->set_active(-1);
|
|
|
|
|
map_temp["GRUB_USER"] = "";
|
|
|
|
|
chbSecurityLogin->set_active(0);
|
|
|
|
|
entrySecurityLogin->set_text("");
|
|
|
|
|
entrySecurityLogin->set_sensitive(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -309,7 +291,7 @@ void MainWindow::set_password_protec(string cmd = "", string cmd_remove = "") {
|
|
|
|
|
if (index == 0){
|
|
|
|
|
key = "";
|
|
|
|
|
if (cmd_remove.length() != 0) {
|
|
|
|
|
wrapper_system(cmd_remove, "");
|
|
|
|
|
obj_process_system.call(cmd_remove, "");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
flag_save_local = true;
|
|
|
|
|
@ -322,7 +304,7 @@ void MainWindow::set_password_protec(string cmd = "", string cmd_remove = "") {
|
|
|
|
|
if (cmd.length() != 0 and key != "************") {
|
|
|
|
|
entryPasswordProtecc->set_text(key);
|
|
|
|
|
cmd = cmd + "\"" + key + "\"";
|
|
|
|
|
wrapper_system(cmd, "");
|
|
|
|
|
obj_process_system.call(cmd, "");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
flag_save_local = true;
|
|
|
|
|
@ -339,32 +321,23 @@ void MainWindow::set_password_protec(string cmd = "", string cmd_remove = "") {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::get_password_protec(string cmd, std::map <string, string> &map_temp) {
|
|
|
|
|
int start_error = index_error;
|
|
|
|
|
struct Result<string> res_response = this->wrapper_call(cmd);
|
|
|
|
|
if (res_response.error == 0) {
|
|
|
|
|
Utils::str_replace_all(res_response.response, "\"","");
|
|
|
|
|
if (res_response.response.length() != 0) {
|
|
|
|
|
void MainWindow::get_password_protec(std::map <string, string> &map_temp) {
|
|
|
|
|
std::map <string, string>:: iterator iter_map_data;
|
|
|
|
|
iter_map_data = map_temp.find("GRUB_PASSWORD");
|
|
|
|
|
if (iter_map_data != map_temp.end()) {
|
|
|
|
|
string value = iter_map_data->second;
|
|
|
|
|
if (value.length() != 0) {
|
|
|
|
|
Utils::str_replace_all(value, "\"","");
|
|
|
|
|
chbPasswordProtecc->set_active(1);
|
|
|
|
|
map_temp["GRUB_PASSWORD"] = res_response.response;
|
|
|
|
|
entryPasswordProtecc->set_text("************");
|
|
|
|
|
entryPasswordProtecc->set_sensitive(true);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
map_temp["GRUB_PASSWORD"] = "";
|
|
|
|
|
chbPasswordProtecc->set_active(-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (res_response.error == 3) {
|
|
|
|
|
chbPasswordProtecc->set_active(0);
|
|
|
|
|
map_temp["GRUB_PASSWORD"] = "";
|
|
|
|
|
entryPasswordProtecc->set_text("");
|
|
|
|
|
if (start_error != index_error) {
|
|
|
|
|
index_error = start_error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
map_temp["GRUB_PASSWORD"] = "";
|
|
|
|
|
chbPasswordProtecc->set_active(-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -535,30 +508,33 @@ void MainWindow::localization(){
|
|
|
|
|
cmbDefaultDonw->append(_("Last Successful Download"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vector<string> MainWindow::get_setting_entry_all(string key, string cmd, Gtk::Entry &entry_text, std::map <string, string> &map_temp) {
|
|
|
|
|
int start_error = index_error;
|
|
|
|
|
vector<string> MainWindow::get_setting_entry_all(string key, Gtk::Entry &entry_text, std::map <string, string> &map_temp) {
|
|
|
|
|
vector<string> vec_params;
|
|
|
|
|
struct Result<string> res_response = this->wrapper_call(cmd);
|
|
|
|
|
if (res_response.error == 0) {
|
|
|
|
|
Utils::str_replace_all(res_response.response, "\"", "");
|
|
|
|
|
vec_params = Utils::split(res_response.response, ' ');
|
|
|
|
|
Utils::str_replace_all(res_response.response, " ", ", ");
|
|
|
|
|
entry_text.set_text(res_response.response);
|
|
|
|
|
std::map <string, string>:: iterator iter_map_data;
|
|
|
|
|
iter_map_data = map_temp.find(key);
|
|
|
|
|
if (iter_map_data != map_temp.end()) {
|
|
|
|
|
string value = iter_map_data->second;
|
|
|
|
|
if (value.length() != 0) {
|
|
|
|
|
Utils::str_replace_all(value, "\"", "");
|
|
|
|
|
vec_params = Utils::split(value, ' ');
|
|
|
|
|
Utils::str_replace_all(value, " ", ", ");
|
|
|
|
|
entry_text.set_text(value);
|
|
|
|
|
for (auto ¶m: vec_params) {
|
|
|
|
|
map_cmd_selection[param] = "1";
|
|
|
|
|
map_temp[param] = "1";
|
|
|
|
|
}
|
|
|
|
|
Utils::str_remove(res_response.response, ",");
|
|
|
|
|
map_temp[key] = res_response.response;
|
|
|
|
|
Utils::str_remove(value, ",");
|
|
|
|
|
map_temp[key] = value;
|
|
|
|
|
}
|
|
|
|
|
else if (res_response.error == 3) {
|
|
|
|
|
if (start_error != index_error) {
|
|
|
|
|
index_error = start_error;
|
|
|
|
|
else {
|
|
|
|
|
entry_text.set_text("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
|
|
entry_text.set_text("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return vec_params;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -619,30 +595,28 @@ void MainWindow::set_entry_to_tree_view(Glib::RefPtr<Gtk::ListStore> &list_store
|
|
|
|
|
}
|
|
|
|
|
flag_blocked_tree_view = false;
|
|
|
|
|
}
|
|
|
|
|
void MainWindow::get_menu_boot(string cmd, std::map <string, string> &map_temp) {
|
|
|
|
|
int start_error = index_error;
|
|
|
|
|
struct Result<string> res_response = this->wrapper_call(cmd);
|
|
|
|
|
if (res_response.error == 0) {
|
|
|
|
|
map_temp["GRUB_TIMEOUT"] = res_response.response;
|
|
|
|
|
spbSecond->set_value(atoi(res_response.response.c_str()));
|
|
|
|
|
|
|
|
|
|
void MainWindow::get_menu_boot(std::map <string, string> &map_temp) {
|
|
|
|
|
std::map <string, string>:: iterator iter_map_data;
|
|
|
|
|
iter_map_data = map_temp.find("GRUB_TIMEOUT");
|
|
|
|
|
if (iter_map_data != map_temp.end()) {
|
|
|
|
|
if (iter_map_data->second.length() > 0) {
|
|
|
|
|
spbSecond->set_value(atoi(iter_map_data->second.c_str()));
|
|
|
|
|
chbLoadVariantSelectionTimer->set_active(true);
|
|
|
|
|
spbSecond->set_sensitive(true);
|
|
|
|
|
lblInfoSeconds->set_sensitive(true);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (res_response.error == 3) {
|
|
|
|
|
if (start_error != index_error) {
|
|
|
|
|
index_error = start_error;
|
|
|
|
|
}
|
|
|
|
|
map_temp["GRUB_TIMEOUT"] = "";
|
|
|
|
|
else {
|
|
|
|
|
chbLoadVariantSelectionTimer->set_active(false);
|
|
|
|
|
spbSecond->set_sensitive(false);
|
|
|
|
|
lblInfoSeconds->set_sensitive(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
map_temp["GRUB_TIMEOUT"] = "";
|
|
|
|
|
chbLoadVariantSelectionTimer->set_active(false);
|
|
|
|
|
spbSecond->set_sensitive(false);
|
|
|
|
|
lblInfoSeconds->set_sensitive(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::set_menu_boot(string cmd = "", string cmd_remove = "") {
|
|
|
|
|
@ -650,7 +624,7 @@ void MainWindow::set_menu_boot(string cmd = "", string cmd_remove = "") {
|
|
|
|
|
int value = spbSecond->get_value();
|
|
|
|
|
if (cmd.length() != 0) {
|
|
|
|
|
cmd += to_string(value);
|
|
|
|
|
this->wrapper_system(cmd, "");
|
|
|
|
|
obj_process_system.call(cmd, "");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
flag_save_local = true;
|
|
|
|
|
@ -661,7 +635,7 @@ void MainWindow::set_menu_boot(string cmd = "", string cmd_remove = "") {
|
|
|
|
|
}
|
|
|
|
|
else if (chbLoadVariantSelectionTimer->get_active() == false) {
|
|
|
|
|
if (cmd_remove.length() != 0) {
|
|
|
|
|
this->wrapper_system(cmd_remove, "");
|
|
|
|
|
obj_process_system.call(cmd_remove, "");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
flag_save_local = true;
|
|
|
|
|
@ -684,10 +658,10 @@ void MainWindow::cmd_entry_all(Gtk::Entry &entry, string cmd_settings, string cm
|
|
|
|
|
if (cmds.length() != 0) {
|
|
|
|
|
cmd_settings += "\"" + cmds + "\"";
|
|
|
|
|
Utils::str_replace_all(cmd_settings, " \"", "\"");
|
|
|
|
|
this->wrapper_system(cmd_settings, "");
|
|
|
|
|
obj_process_system.call(cmd_settings, "");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
this->wrapper_system(cmd_remove, "");
|
|
|
|
|
obj_process_system.call(cmd_remove, "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -747,7 +721,7 @@ void MainWindow::set_default_load(string cmd = "", string cmd_remove = "") {
|
|
|
|
|
int index = cmbDefaultDonw->get_active_row_number();
|
|
|
|
|
if (index == 0) {
|
|
|
|
|
if (cmd.length() != 0) {
|
|
|
|
|
wrapper_system(cmd, "");
|
|
|
|
|
obj_process_system.call(cmd, "");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
flag_save_local = true;
|
|
|
|
|
@ -757,7 +731,7 @@ void MainWindow::set_default_load(string cmd = "", string cmd_remove = "") {
|
|
|
|
|
}
|
|
|
|
|
else if (index > 0) {
|
|
|
|
|
if (cmd_remove.length() != 0) {
|
|
|
|
|
wrapper_system(cmd_remove, "");
|
|
|
|
|
obj_process_system.call(cmd_remove, "");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
flag_save_local = true;
|
|
|
|
|
@ -773,23 +747,20 @@ void MainWindow::set_default_load(string cmd = "", string cmd_remove = "") {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::get_default_load(string cmd, std::map <string, string> &map_temp) {
|
|
|
|
|
int start_error = index_error;
|
|
|
|
|
struct Result<string> res_response = this->wrapper_call(cmd);
|
|
|
|
|
if (res_response.error == 0) {
|
|
|
|
|
map_temp["GRUB_DEFAULT"] = res_response.response;
|
|
|
|
|
cmbDefaultDonw->set_active_text(res_response.response);
|
|
|
|
|
void MainWindow::get_default_load(std::map <string, string> &map_temp) {
|
|
|
|
|
std::map <string, string>:: iterator iter_map_data;
|
|
|
|
|
iter_map_data = map_temp.find("GRUB_DEFAULT");
|
|
|
|
|
if (iter_map_data != map_temp.end()) {
|
|
|
|
|
string value = iter_map_data->second;
|
|
|
|
|
if (value.length() != 0) {
|
|
|
|
|
cmbDefaultDonw->set_active_text(value);
|
|
|
|
|
}
|
|
|
|
|
else if (res_response.error == 3) {
|
|
|
|
|
if (start_error != index_error) {
|
|
|
|
|
index_error = start_error;
|
|
|
|
|
else {
|
|
|
|
|
cmbDefaultDonw->set_active(0);
|
|
|
|
|
}
|
|
|
|
|
map_temp["GRUB_DEFAULT"] = "";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
map_temp["GRUB_DEFAULT"] = "";
|
|
|
|
|
cmbDefaultDonw->set_active(-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -897,6 +868,45 @@ bool MainWindow::save_global_cfg() {
|
|
|
|
|
return flag_no_save;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool MainWindow::check_save(string flag_save, string key_name="") {
|
|
|
|
|
std::map <string, string>:: iterator iter_map_data;
|
|
|
|
|
std::map <string, string>:: iterator iter_map_data_old;
|
|
|
|
|
std::map <string, string> map_config_data_old;
|
|
|
|
|
if (flag_save == "local") {
|
|
|
|
|
map_config_data_old = map_local_cmd_selection;
|
|
|
|
|
}
|
|
|
|
|
else if (flag_save == "global") {
|
|
|
|
|
map_config_data_old = map_global_cmd_selection;
|
|
|
|
|
}
|
|
|
|
|
iter_map_data = map_cmd_selection.find(key_name);
|
|
|
|
|
iter_map_data_old = map_config_data_old.find(key_name);
|
|
|
|
|
|
|
|
|
|
if (iter_map_data_old == map_config_data_old.end() && iter_map_data != map_cmd_selection.end()) {
|
|
|
|
|
cout << 2 << endl;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (iter_map_data->second != iter_map_data_old->second) {
|
|
|
|
|
cout << iter_map_data->second << " ||| " << iter_map_data_old->second << endl;
|
|
|
|
|
cout << 3 << endl;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (iter_map_data->second.length() == 0 && iter_map_data_old->second.length() == 0) {
|
|
|
|
|
cout << 4 << " " << key_name << endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if (iter_map_data->second == iter_map_data_old->second) {
|
|
|
|
|
cout << 5 << " " << key_name << endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
cout << 6 << endl;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
cout << 7 << endl;
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::wrapper_save_local_cfg() {
|
|
|
|
|
if (this->save_local_cfg()){
|
|
|
|
|
this->info_warning_error(5);
|
|
|
|
|
@ -982,6 +992,7 @@ void MainWindow::set_data_cfg() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::download_globl_cfg() {
|
|
|
|
|
this->init_dict();
|
|
|
|
|
entryKernel->set_text("");
|
|
|
|
|
entryOTT->set_text("");
|
|
|
|
|
entryIPT->set_text("");
|
|
|
|
|
@ -989,26 +1000,42 @@ void MainWindow::download_globl_cfg() {
|
|
|
|
|
flag_save_global = true;
|
|
|
|
|
flag_save_all = true;
|
|
|
|
|
flag_load = true;
|
|
|
|
|
std::string cmd_boot_time = "ubconfig --default --source global get boot GRUB_TIMEOUT";
|
|
|
|
|
this->get_menu_boot(cmd_boot_time, map_global_cmd_selection);
|
|
|
|
|
string cmd_kernel_entry = "ubconfig --default --source global get boot GRUB_CMDLINE_LINUX";
|
|
|
|
|
this->get_setting_entry_all("GRUB_CMDLINE_LINUX",cmd_kernel_entry, *entryKernel, map_global_cmd_selection);
|
|
|
|
|
string cmd_ipt_entry = "ubconfig --default --source global get boot GRUB_TERMINAL_INPUT";
|
|
|
|
|
this->get_setting_entry_all("GRUB_TERMINAL_INPUT",cmd_ipt_entry, *entryIPT, map_global_cmd_selection);
|
|
|
|
|
string cmd_opt_entry = "ubconfig --default --source global get boot GRUB_TERMINAL_OUTPUT";
|
|
|
|
|
this->get_setting_entry_all("GRUB_TERMINAL_OUTPUT", cmd_opt_entry, *entryOTT, map_global_cmd_selection);
|
|
|
|
|
|
|
|
|
|
vector<string> vec_sections;
|
|
|
|
|
vec_sections.push_back("boot");
|
|
|
|
|
obj_load.set_sections(vec_sections);
|
|
|
|
|
map_local_cmd_selection = obj_load.get_load_data(map_global_cmd_selection, "global");
|
|
|
|
|
this->get_menu_boot(map_global_cmd_selection);
|
|
|
|
|
|
|
|
|
|
this->get_setting_entry_all("GRUB_CMDLINE_LINUX",*entryKernel, map_global_cmd_selection);
|
|
|
|
|
this->get_setting_entry_all("GRUB_TERMINAL_INPUT",*entryIPT, map_global_cmd_selection);
|
|
|
|
|
this->get_setting_entry_all("GRUB_TERMINAL_OUTPUT", *entryOTT, map_global_cmd_selection);
|
|
|
|
|
this->set_row_all(map_global_cmd_selection, list_store_kernel, vec_Option_kernel, size_kernel);
|
|
|
|
|
this->set_row_all(map_global_cmd_selection, list_store_IPT, vec_Option_IPT, size_IPT);
|
|
|
|
|
this->set_row_all(map_global_cmd_selection, list_store_OTT, vec_Option_OTT, size_OTT);
|
|
|
|
|
this->get_download_mode("ubconfig --default --source global get boot GRUB_BOOT_SILENT", map_global_cmd_selection);
|
|
|
|
|
this->get_security_login("ubconfig --default --source global get boot GRUB_USER", map_global_cmd_selection);
|
|
|
|
|
this->get_password_protec("ubconfig --default --source global get boot GRUB_PASSWORD", map_global_cmd_selection);
|
|
|
|
|
this->get_default_load("ubconfig --default --source global get boot GRUB_DEFAULT", map_global_cmd_selection);
|
|
|
|
|
this->get_download_mode(map_global_cmd_selection);
|
|
|
|
|
this->get_security_login(map_global_cmd_selection);
|
|
|
|
|
this->get_password_protec(map_global_cmd_selection);
|
|
|
|
|
this->get_default_load(map_global_cmd_selection);
|
|
|
|
|
info_warning_error(1);
|
|
|
|
|
map_cmd_selection = map_global_cmd_selection;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::init_dict() {
|
|
|
|
|
map_cmd_selection["GRUB_TIMEOUT"] = "";
|
|
|
|
|
map_cmd_selection["GRUB_CMDLINE_LINUX"] = "";
|
|
|
|
|
map_cmd_selection["GRUB_TERMINAL_INPUT"] = "";
|
|
|
|
|
map_cmd_selection["GRUB_TERMINAL_OUTPUT"] = "";
|
|
|
|
|
map_cmd_selection["GRUB_BOOT_SILENT"] = "";
|
|
|
|
|
map_cmd_selection["GRUB_USER"] = "";
|
|
|
|
|
map_cmd_selection["GRUB_PASSWORD"] = "";
|
|
|
|
|
map_cmd_selection["GRUB_DEFAULT"] = "";
|
|
|
|
|
map_global_cmd_selection = map_cmd_selection;
|
|
|
|
|
map_local_cmd_selection = map_cmd_selection;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::download_local_cfg() {
|
|
|
|
|
entryKernel->set_text("");
|
|
|
|
|
entryOTT->set_text("");
|
|
|
|
|
@ -1017,63 +1044,28 @@ void MainWindow::download_local_cfg() {
|
|
|
|
|
flag_save_global = true;
|
|
|
|
|
flag_save_all = true;
|
|
|
|
|
flag_load = false;
|
|
|
|
|
std::string cmd_boot_time = "ubconfig --default --source system get boot GRUB_TIMEOUT";
|
|
|
|
|
this->get_menu_boot(cmd_boot_time, map_local_cmd_selection);
|
|
|
|
|
string cmd_kernel_entry = "ubconfig --default --source system get boot GRUB_CMDLINE_LINUX";
|
|
|
|
|
this->get_setting_entry_all("GRUB_CMDLINE_LINUX", cmd_kernel_entry, *entryKernel, map_local_cmd_selection);
|
|
|
|
|
string cmd_ipt_entry = "ubconfig --default --source system get boot GRUB_TERMINAL_INPUT";
|
|
|
|
|
this->get_setting_entry_all("GRUB_TERMINAL_INPUT", cmd_ipt_entry, *entryIPT, map_local_cmd_selection);
|
|
|
|
|
string cmd_opt_entry = "ubconfig --default --source system get boot GRUB_TERMINAL_OUTPUT";
|
|
|
|
|
this->get_setting_entry_all("GRUB_TERMINAL_OUTPUT", cmd_opt_entry, *entryOTT, map_local_cmd_selection);
|
|
|
|
|
this->init_dict();
|
|
|
|
|
|
|
|
|
|
vector<string> vec_sections;
|
|
|
|
|
vec_sections.push_back("boot");
|
|
|
|
|
obj_load.set_sections(vec_sections);
|
|
|
|
|
map_local_cmd_selection = obj_load.get_load_data(map_local_cmd_selection, "system");
|
|
|
|
|
|
|
|
|
|
this->get_menu_boot(map_local_cmd_selection);
|
|
|
|
|
this->get_setting_entry_all("GRUB_CMDLINE_LINUX", *entryKernel, map_local_cmd_selection);
|
|
|
|
|
this->get_setting_entry_all("GRUB_TERMINAL_INPUT", *entryIPT, map_local_cmd_selection);
|
|
|
|
|
this->get_setting_entry_all("GRUB_TERMINAL_OUTPUT", *entryOTT, map_local_cmd_selection);
|
|
|
|
|
this->set_row_all(map_local_cmd_selection, list_store_kernel, vec_Option_kernel, size_kernel);
|
|
|
|
|
this->set_row_all(map_local_cmd_selection, list_store_IPT, vec_Option_IPT, size_IPT);
|
|
|
|
|
this->set_row_all(map_local_cmd_selection, list_store_OTT, vec_Option_OTT, size_OTT);
|
|
|
|
|
this->get_download_mode("ubconfig --default --source system get boot GRUB_BOOT_SILENT", map_local_cmd_selection);
|
|
|
|
|
this->get_security_login("ubconfig --default --source system get boot GRUB_USER", map_local_cmd_selection);
|
|
|
|
|
this->get_password_protec("ubconfig --default --source system get boot GRUB_PASSWORD", map_local_cmd_selection);
|
|
|
|
|
this->get_default_load("ubconfig --default --source system get boot GRUB_DEFAULT", map_local_cmd_selection);
|
|
|
|
|
this->get_download_mode(map_local_cmd_selection);
|
|
|
|
|
this->get_security_login(map_local_cmd_selection);
|
|
|
|
|
this->get_password_protec(map_local_cmd_selection);
|
|
|
|
|
this->get_default_load(map_local_cmd_selection);
|
|
|
|
|
info_warning_error(0);
|
|
|
|
|
map_cmd_selection = map_local_cmd_selection;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool MainWindow::check_save(string flag_save, string key_name="") {
|
|
|
|
|
std::map <string, string>:: iterator iter_map_data;
|
|
|
|
|
std::map <string, string>:: iterator iter_map_data_old;
|
|
|
|
|
std::map <string, string> map_config_data_old;
|
|
|
|
|
if (flag_save == "local") {
|
|
|
|
|
map_config_data_old = map_local_cmd_selection;
|
|
|
|
|
}
|
|
|
|
|
else if (flag_save == "global") {
|
|
|
|
|
map_config_data_old = map_global_cmd_selection;
|
|
|
|
|
}
|
|
|
|
|
iter_map_data = map_cmd_selection.find(key_name);
|
|
|
|
|
iter_map_data_old = map_config_data_old.find(key_name);
|
|
|
|
|
|
|
|
|
|
if (iter_map_data_old == map_config_data_old.end() && iter_map_data != map_cmd_selection.end()) {
|
|
|
|
|
cout << 2 << endl;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (iter_map_data->second != iter_map_data_old->second) {
|
|
|
|
|
cout << iter_map_data->second << " ||| " << iter_map_data_old->second << endl;
|
|
|
|
|
cout << 3 << endl;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (iter_map_data->second.length() == 0 && iter_map_data_old->second.length() == 0) {
|
|
|
|
|
cout << 4 << " " << key_name << endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if (iter_map_data->second == iter_map_data_old->second) {
|
|
|
|
|
cout << 5 << " " << key_name << endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
cout << 6 << endl;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
cout << 7 << endl;
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::set_row_all(std::map <string, string> &map_cmd, Glib::RefPtr<Gtk::ListStore> &list_store, vector<string> &list_params, size_t size) {
|
|
|
|
|
for (auto &name: list_params) {
|
|
|
|
|
@ -1103,17 +1095,9 @@ void MainWindow::synopsis_show() {
|
|
|
|
|
string response_user = getlogin();
|
|
|
|
|
cmd = "su -l " + response_user + " -c \" DISPLAY=$DISPLAY " + cmd + " \"";
|
|
|
|
|
}
|
|
|
|
|
wrapper_system(cmd, "&");
|
|
|
|
|
obj_process_system.call(cmd, "&");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::wrapper_system(string cmd, string thread_str = "") {
|
|
|
|
|
string cmd_new = cmd + " " + thread_str;
|
|
|
|
|
int response_cmd = system(cmd_new.c_str());
|
|
|
|
|
if (response_cmd != 0) {
|
|
|
|
|
index_error += 1;
|
|
|
|
|
this->log_mess_error(cmd);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::info_status_app(string stule) {
|
|
|
|
|
boxInfo->remove_class("boxInfoMessOK");
|
|
|
|
|
@ -1173,59 +1157,6 @@ void MainWindow::info_warning_error(int mess) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct MainWindow::Result<string> MainWindow::wrapper_call(string cmd) {
|
|
|
|
|
struct Result<string> obj_result;
|
|
|
|
|
string response = Utils::call(cmd);
|
|
|
|
|
if ((response.find("(null)") == std::string::npos) && (response.length() != 0 )) {
|
|
|
|
|
if (response.find("=") != std::string::npos) {
|
|
|
|
|
if (response.find("\n") != std::string::npos) {
|
|
|
|
|
response = response.substr(response.find("=")+1,response.length());
|
|
|
|
|
response = response.substr(0,response.find("\n"));
|
|
|
|
|
obj_result.response = response;
|
|
|
|
|
obj_result.error = 0;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
obj_result.response = response;
|
|
|
|
|
obj_result.error = 1;
|
|
|
|
|
index_error += 1;
|
|
|
|
|
this->log_mess_error(cmd);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
obj_result.response = response;
|
|
|
|
|
obj_result.error = 2;
|
|
|
|
|
index_error += 1;
|
|
|
|
|
str_cmd_error = cmd;
|
|
|
|
|
this->log_mess_error(cmd);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
obj_result.response = response;
|
|
|
|
|
obj_result.error = 3;
|
|
|
|
|
index_error += 1;
|
|
|
|
|
str_cmd_error = cmd;
|
|
|
|
|
this->log_mess_error(cmd);
|
|
|
|
|
}
|
|
|
|
|
return obj_result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::log_mess_error(string &cmd) {
|
|
|
|
|
string key = "";
|
|
|
|
|
if (map_cmd_error.find(cmd) != map_cmd_error.end()){
|
|
|
|
|
str_cmd_error = map_cmd_error[cmd];
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
for (const auto &map_iter: map_cmd_error) {
|
|
|
|
|
key = map_iter.first;
|
|
|
|
|
if (cmd.find(key) != std::string::npos){
|
|
|
|
|
str_cmd_error = map_iter.second;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::add_CSS(){
|
|
|
|
|
Glib::RefPtr<Gtk::CssProvider> cssProvider = Gtk::CssProvider::create();
|
|
|
|
|
cssProvider->load_from_path(path_css);
|
|
|
|
|
|