|
|
|
@ -167,6 +167,7 @@ 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) {
|
|
|
|
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);
|
|
|
|
struct Result<string> res_response = this->wrapper_call(cmd);
|
|
|
|
if (res_response.error == 0) {
|
|
|
|
if (res_response.error == 0) {
|
|
|
|
str_replace_all(res_response.response, "\"","");
|
|
|
|
str_replace_all(res_response.response, "\"","");
|
|
|
|
@ -194,6 +195,9 @@ void MainWindow::get_download_mode(string cmd, std::map <string, string> &map_te
|
|
|
|
else if (res_response.error == 3) {
|
|
|
|
else if (res_response.error == 3) {
|
|
|
|
cmbDownloadMode->set_active(-1);
|
|
|
|
cmbDownloadMode->set_active(-1);
|
|
|
|
map_temp["GRUB_BOOT_SILENT"] = "";
|
|
|
|
map_temp["GRUB_BOOT_SILENT"] = "";
|
|
|
|
|
|
|
|
if (start_error != index_error) {
|
|
|
|
|
|
|
|
index_error = start_error;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
cmbDownloadMode->set_active(-1);
|
|
|
|
cmbDownloadMode->set_active(-1);
|
|
|
|
@ -250,6 +254,7 @@ void MainWindow::set_security_login(string cmd="") {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::get_security_login(string cmd, std::map <string, string> &map_temp) {
|
|
|
|
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);
|
|
|
|
struct Result<string> res_response = this->wrapper_call(cmd);
|
|
|
|
// TODO:
|
|
|
|
// TODO:
|
|
|
|
// Убрать в будущем
|
|
|
|
// Убрать в будущем
|
|
|
|
@ -277,6 +282,9 @@ void MainWindow::get_security_login(string cmd, std::map <string, string> &map_t
|
|
|
|
else if (res_response.error == 3) {
|
|
|
|
else if (res_response.error == 3) {
|
|
|
|
chbSecurityLogin->set_active(-1);
|
|
|
|
chbSecurityLogin->set_active(-1);
|
|
|
|
map_temp["GRUB_USER"] = "";
|
|
|
|
map_temp["GRUB_USER"] = "";
|
|
|
|
|
|
|
|
if (start_error != index_error) {
|
|
|
|
|
|
|
|
index_error = start_error;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
chbSecurityLogin->set_active(-1);
|
|
|
|
chbSecurityLogin->set_active(-1);
|
|
|
|
@ -315,8 +323,8 @@ void MainWindow::set_password_protec(string cmd = "", string cmd_remove = "") {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::get_password_protec(string cmd, std::map <string, string> &map_temp) {
|
|
|
|
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);
|
|
|
|
struct Result<string> res_response = this->wrapper_call(cmd);
|
|
|
|
cout << res_response.response << " " << res_response.error << endl;
|
|
|
|
|
|
|
|
if (res_response.error == 0) {
|
|
|
|
if (res_response.error == 0) {
|
|
|
|
str_replace_all(res_response.response, "\"","");
|
|
|
|
str_replace_all(res_response.response, "\"","");
|
|
|
|
entryPasswordProtecc->set_text(res_response.response);
|
|
|
|
entryPasswordProtecc->set_text(res_response.response);
|
|
|
|
@ -340,6 +348,9 @@ void MainWindow::get_password_protec(string cmd, std::map <string, string> &map_
|
|
|
|
chbPasswordProtecc->set_active(2);
|
|
|
|
chbPasswordProtecc->set_active(2);
|
|
|
|
map_temp["GRUB_PASSWORD"] = "";
|
|
|
|
map_temp["GRUB_PASSWORD"] = "";
|
|
|
|
entryPasswordProtecc->set_text("");
|
|
|
|
entryPasswordProtecc->set_text("");
|
|
|
|
|
|
|
|
if (start_error != index_error) {
|
|
|
|
|
|
|
|
index_error = start_error;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
map_temp["GRUB_PASSWORD"] = "";
|
|
|
|
map_temp["GRUB_PASSWORD"] = "";
|
|
|
|
@ -513,6 +524,7 @@ void MainWindow::localization(){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
vector<string> MainWindow::get_setting_entry_all(string cmd, Gtk::Entry &entry_text, std::map <string, string> &map_temp) {
|
|
|
|
vector<string> MainWindow::get_setting_entry_all(string cmd, Gtk::Entry &entry_text, std::map <string, string> &map_temp) {
|
|
|
|
|
|
|
|
int start_error = index_error;
|
|
|
|
vector<string> vec_params;
|
|
|
|
vector<string> vec_params;
|
|
|
|
struct Result<string> res_response = this->wrapper_call(cmd);
|
|
|
|
struct Result<string> res_response = this->wrapper_call(cmd);
|
|
|
|
if (res_response.error == 0) {
|
|
|
|
if (res_response.error == 0) {
|
|
|
|
@ -526,7 +538,9 @@ vector<string> MainWindow::get_setting_entry_all(string cmd, Gtk::Entry &entry_t
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (res_response.error == 3) {
|
|
|
|
else if (res_response.error == 3) {
|
|
|
|
|
|
|
|
if (start_error != index_error) {
|
|
|
|
|
|
|
|
index_error = start_error;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
|
|
|
|
|
|
|
|
@ -538,6 +552,10 @@ bool MainWindow::focus_out_txt_password(GdkEventFocus*) {
|
|
|
|
if (entryPasswordProtecc->get_text().length() == 0) {
|
|
|
|
if (entryPasswordProtecc->get_text().length() == 0) {
|
|
|
|
info_status_app("boxInfoMessError");
|
|
|
|
info_status_app("boxInfoMessError");
|
|
|
|
lblWarning->set_text(gettext("Enter your password"));
|
|
|
|
lblWarning->set_text(gettext("Enter your password"));
|
|
|
|
|
|
|
|
boxSave->set_sensitive(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
boxSave->set_sensitive(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -545,6 +563,10 @@ bool MainWindow::focus_out_txt_login(GdkEventFocus*) {
|
|
|
|
if (entrySecurityLogin->get_text().length() == 0) {
|
|
|
|
if (entrySecurityLogin->get_text().length() == 0) {
|
|
|
|
info_status_app("boxInfoMessError");
|
|
|
|
info_status_app("boxInfoMessError");
|
|
|
|
lblWarning->set_text(gettext("Enter login"));
|
|
|
|
lblWarning->set_text(gettext("Enter login"));
|
|
|
|
|
|
|
|
boxSave->set_sensitive(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
boxSave->set_sensitive(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -578,13 +600,16 @@ void MainWindow::set_entry_to_tree_view(Glib::RefPtr<Gtk::ListStore> &list_store
|
|
|
|
flag_blocked_tree_view = false;
|
|
|
|
flag_blocked_tree_view = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::get_menu_boot(string cmd, std::map <string, string> &map_temp) {
|
|
|
|
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);
|
|
|
|
struct Result<string> res_response = this->wrapper_call(cmd);
|
|
|
|
if (res_response.error == 0) {
|
|
|
|
if (res_response.error == 0) {
|
|
|
|
map_temp["GRUB_TIMEOUT"] = res_response.response;
|
|
|
|
map_temp["GRUB_TIMEOUT"] = res_response.response;
|
|
|
|
spbSecond->set_value(atoi(res_response.response.c_str()));
|
|
|
|
spbSecond->set_value(atoi(res_response.response.c_str()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (res_response.error == 3) {
|
|
|
|
else if (res_response.error == 3) {
|
|
|
|
|
|
|
|
if (start_error != index_error) {
|
|
|
|
|
|
|
|
index_error = start_error;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
|
|
|
|
|
|
|
|
@ -602,13 +627,18 @@ void MainWindow::set_menu_boot(string cmd="") {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::cmd_entry_all(Gtk::Entry &entry, string cmd_settings) {
|
|
|
|
void MainWindow::cmd_entry_all(Gtk::Entry &entry, string cmd_settings, string cmd_remove) {
|
|
|
|
string cmds = entry.get_text();
|
|
|
|
string cmds = entry.get_text();
|
|
|
|
str_remove(cmds, ",");
|
|
|
|
str_remove(cmds, ",");
|
|
|
|
|
|
|
|
if (cmds.length() != 0) {
|
|
|
|
cmd_settings += "\"" + cmds + "\"";
|
|
|
|
cmd_settings += "\"" + cmds + "\"";
|
|
|
|
str_replace_all(cmd_settings, " \"", "\"");
|
|
|
|
str_replace_all(cmd_settings, " \"", "\"");
|
|
|
|
this->wrapper_system(cmd_settings, "");
|
|
|
|
this->wrapper_system(cmd_settings, "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
this->wrapper_system(cmd_remove, "");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::event(){
|
|
|
|
void MainWindow::event(){
|
|
|
|
btnSynopsis->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::synopsis_show));
|
|
|
|
btnSynopsis->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::synopsis_show));
|
|
|
|
@ -647,14 +677,17 @@ void MainWindow::change_security_login() {
|
|
|
|
// Добавить заполнение логина по умолчанию
|
|
|
|
// Добавить заполнение логина по умолчанию
|
|
|
|
string default_login = "superadmin";
|
|
|
|
string default_login = "superadmin";
|
|
|
|
entrySecurityLogin->set_text(default_login);
|
|
|
|
entrySecurityLogin->set_text(default_login);
|
|
|
|
|
|
|
|
boxSave->set_sensitive(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (index == 1) {
|
|
|
|
else if (index == 1) {
|
|
|
|
entrySecurityLogin->set_sensitive(true);
|
|
|
|
entrySecurityLogin->set_sensitive(true);
|
|
|
|
entrySecurityLogin->set_text("");
|
|
|
|
entrySecurityLogin->set_text("");
|
|
|
|
|
|
|
|
boxSave->set_sensitive(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
entrySecurityLogin->set_sensitive(false);
|
|
|
|
entrySecurityLogin->set_sensitive(false);
|
|
|
|
entrySecurityLogin->set_text("");
|
|
|
|
entrySecurityLogin->set_text("");
|
|
|
|
|
|
|
|
boxSave->set_sensitive(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -663,10 +696,15 @@ void MainWindow::change_password_protecc() {
|
|
|
|
if (index == 0 || index == 2 || index == -1) {
|
|
|
|
if (index == 0 || index == 2 || index == -1) {
|
|
|
|
entryPasswordProtecc->set_sensitive(false);
|
|
|
|
entryPasswordProtecc->set_sensitive(false);
|
|
|
|
entryPasswordProtecc->set_text("");
|
|
|
|
entryPasswordProtecc->set_text("");
|
|
|
|
|
|
|
|
boxSave->set_sensitive(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (index == 1) {
|
|
|
|
else if (index == 1) {
|
|
|
|
entryPasswordProtecc->set_sensitive(true);
|
|
|
|
entryPasswordProtecc->set_sensitive(true);
|
|
|
|
entryPasswordProtecc->set_text("");
|
|
|
|
entryPasswordProtecc->set_text("");
|
|
|
|
|
|
|
|
boxSave->set_sensitive(true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
boxSave->set_sensitive(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -709,17 +747,20 @@ bool MainWindow::save_global_cfg() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (this->check_save(flag_save, "GRUB_CMDLINE_LINUX")) {
|
|
|
|
if (this->check_save(flag_save, "GRUB_CMDLINE_LINUX")) {
|
|
|
|
string cmd_settings_kernel = "ubconfig --target global set boot GRUB_CMDLINE_LINUX=";
|
|
|
|
string cmd_settings_kernel = "ubconfig --target global set boot GRUB_CMDLINE_LINUX=";
|
|
|
|
this->cmd_entry_all(*entryKernel, cmd_settings_kernel);
|
|
|
|
string cmd_remove = "ubconfig --target global remove boot GRUB_CMDLINE_LINUX";
|
|
|
|
|
|
|
|
this->cmd_entry_all(*entryKernel, cmd_settings_kernel, cmd_remove);
|
|
|
|
flag_no_save = false;
|
|
|
|
flag_no_save = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (this->check_save(flag_save, "GRUB_TERMINAL_OUTPUT")) {
|
|
|
|
if (this->check_save(flag_save, "GRUB_TERMINAL_OUTPUT")) {
|
|
|
|
string cmd_settings_IPT = "ubconfig --target global set boot GRUB_TERMINAL_OUTPUT=";
|
|
|
|
string cmd_settings_IPT = "ubconfig --target global set boot GRUB_TERMINAL_OUTPUT=";
|
|
|
|
this->cmd_entry_all(*entryIPT, cmd_settings_IPT);
|
|
|
|
string cmd_remove = "ubconfig --target global remove boot GRUB_TERMINAL_OUTPUT";
|
|
|
|
|
|
|
|
this->cmd_entry_all(*entryIPT, cmd_settings_IPT,cmd_remove);
|
|
|
|
flag_no_save = false;
|
|
|
|
flag_no_save = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (this->check_save(flag_save, "GRUB_TERMINAL_INPUT")) {
|
|
|
|
if (this->check_save(flag_save, "GRUB_TERMINAL_INPUT")) {
|
|
|
|
string cmd_settings_OTT = "ubconfig --target global set boot GRUB_TERMINAL_INPUT=";
|
|
|
|
string cmd_settings_OTT = "ubconfig --target global set boot GRUB_TERMINAL_INPUT=";
|
|
|
|
this->cmd_entry_all(*entryOTT, cmd_settings_OTT);
|
|
|
|
string cmd_remove = "ubconfig --target global remove boot GRUB_TERMINAL_INPUT";
|
|
|
|
|
|
|
|
this->cmd_entry_all(*entryOTT, cmd_settings_OTT, cmd_remove);
|
|
|
|
flag_no_save = false;
|
|
|
|
flag_no_save = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (this->check_save(flag_save, "GRUB_BOOT_SILENT")) {
|
|
|
|
if (this->check_save(flag_save, "GRUB_BOOT_SILENT")) {
|
|
|
|
@ -766,17 +807,20 @@ bool MainWindow::save_local_cfg() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (this->check_save(flag_save, "GRUB_CMDLINE_LINUX")) {
|
|
|
|
if (this->check_save(flag_save, "GRUB_CMDLINE_LINUX")) {
|
|
|
|
string cmd_settings_kernel = "ubconfig --target system set boot GRUB_CMDLINE_LINUX=";
|
|
|
|
string cmd_settings_kernel = "ubconfig --target system set boot GRUB_CMDLINE_LINUX=";
|
|
|
|
this->cmd_entry_all(*entryKernel, cmd_settings_kernel);
|
|
|
|
string cmd_remove = "ubconfig --target system remove boot GRUB_CMDLINE_LINUX";
|
|
|
|
|
|
|
|
this->cmd_entry_all(*entryKernel, cmd_settings_kernel, cmd_remove);
|
|
|
|
flag_no_save = false;
|
|
|
|
flag_no_save = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (this->check_save(flag_save, "GRUB_TERMINAL_OUTPUT")) {
|
|
|
|
if (this->check_save(flag_save, "GRUB_TERMINAL_OUTPUT")) {
|
|
|
|
string cmd_settings_IPT = "ubconfig --target system set boot GRUB_TERMINAL_OUTPUT=";
|
|
|
|
string cmd_settings_IPT = "ubconfig --target system set boot GRUB_TERMINAL_OUTPUT=";
|
|
|
|
this->cmd_entry_all(*entryIPT, cmd_settings_IPT);
|
|
|
|
string cmd_remove = "ubconfig --target system remove boot GRUB_TERMINAL_OUTPUT";
|
|
|
|
|
|
|
|
this->cmd_entry_all(*entryIPT, cmd_settings_IPT, cmd_remove);
|
|
|
|
flag_no_save = false;
|
|
|
|
flag_no_save = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (this->check_save(flag_save, "GRUB_TERMINAL_INPUT")) {
|
|
|
|
if (this->check_save(flag_save, "GRUB_TERMINAL_INPUT")) {
|
|
|
|
string cmd_settings_OTT = "ubconfig --target system set boot GRUB_TERMINAL_INPUT=";
|
|
|
|
string cmd_settings_OTT = "ubconfig --target system set boot GRUB_TERMINAL_INPUT=";
|
|
|
|
this->cmd_entry_all(*entryOTT, cmd_settings_OTT);
|
|
|
|
string cmd_remove = "ubconfig --target system remove boot GRUB_TERMINAL_INPUT";
|
|
|
|
|
|
|
|
this->cmd_entry_all(*entryOTT, cmd_settings_OTT, cmd_remove);
|
|
|
|
flag_no_save = false;
|
|
|
|
flag_no_save = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (this->check_save(flag_save, "GRUB_BOOT_SILENT")) {
|
|
|
|
if (this->check_save(flag_save, "GRUB_BOOT_SILENT")) {
|
|
|
|
@ -870,8 +914,6 @@ void MainWindow::download_local_cfg() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MainWindow::check_save(string flag_save, string key_name="") {
|
|
|
|
bool MainWindow::check_save(string flag_save, string key_name="") {
|
|
|
|
if (flag_save.empty() && key_name.empty()) {}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
std::map <string, string>:: iterator iter_map_data;
|
|
|
|
std::map <string, string>:: iterator iter_map_data;
|
|
|
|
std::map <string, string>:: iterator iter_map_data_old;
|
|
|
|
std::map <string, string>:: iterator iter_map_data_old;
|
|
|
|
std::map <string, string> map_config_data_old;
|
|
|
|
std::map <string, string> map_config_data_old;
|
|
|
|
@ -909,7 +951,6 @@ bool MainWindow::check_save(string flag_save, string key_name="") {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cout << 7 << endl;
|
|
|
|
cout << 7 << endl;
|
|
|
|
*/
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|