diff --git a/source/ubl-settings-bootloader.cc b/source/ubl-settings-bootloader.cc index 841b5d0..543d475 100755 --- a/source/ubl-settings-bootloader.cc +++ b/source/ubl-settings-bootloader.cc @@ -86,6 +86,7 @@ void MainWindow::settings(){ entrySecurityLogin->set_sensitive(false); this->set_active_boot_second(); this->change_password_protecc(); + this->change_security_login(); this->event(); } @@ -220,11 +221,10 @@ void MainWindow::set_download_mode(string cmd="") { return; } if (cmd.length() !=0 ) { - cmd +="\"" + key + "\""; + cmd += "\"" + key + "\""; wrapper_system(cmd, ""); } map_cmd_selection["GRUB_BOOT_SILENT"] = key; - } void MainWindow::set_security_login(string cmd="") { @@ -610,6 +610,7 @@ void MainWindow::event(){ entryOTT->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_OTT)); entryPasswordProtecc->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_password)); chbPasswordProtecc->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::change_password_protecc)); + chbSecurityLogin->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::change_security_login)); if (this->check_root() == 0) { Glib::RefPtr treeViewKernelModel = treeViewKernel->get_model(); treeViewKernelModel->signal_row_changed().connect(sigc::mem_fun(*this, &MainWindow::item_selected_kernel)); @@ -624,6 +625,20 @@ void MainWindow::event(){ chbLoadVariantSelectionTimer->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::set_active_boot_second)); } +void MainWindow::change_security_login() { + int index = chbSecurityLogin->get_active_row_number(); + if (index == 0 || index == -1) { + entrySecurityLogin->set_sensitive(false); + // TODO: + // Добавить заполнение логина по умолчанию + entrySecurityLogin->set_text(""); + } + else if (index == 1) { + entrySecurityLogin->set_sensitive(true); + entrySecurityLogin->set_text(""); + } +} + void MainWindow::change_password_protecc() { int index = chbPasswordProtecc->get_active_row_number(); if (index == 0 || index == 2 || index == -1) { @@ -631,6 +646,7 @@ void MainWindow::change_password_protecc() { } else if (index == 1) { entryPasswordProtecc->set_sensitive(true); + entryPasswordProtecc->set_text(""); } } @@ -665,6 +681,8 @@ bool MainWindow::save_global_cfg() { bool flag_no_save = true; if (flag_save_global) { if (flag_save_all) { + flag_save_all = false; + flag_save_global = false; this->set_data_cfg(); if (this->check_save(flag_save, "GRUB_TIMEOUT")) { std::string cmd_boot_time = "ubconfig --target global set boot GRUB_TIMEOUT="; @@ -702,9 +720,6 @@ bool MainWindow::save_global_cfg() { } } } - else { - flag_no_save = true; - } map_global_cmd_selection = map_cmd_selection; return flag_no_save; } @@ -724,6 +739,8 @@ bool MainWindow::save_local_cfg() { bool flag_no_save = true; if (flag_save_local) { if (flag_save_all) { + flag_save_all = false; + flag_save_local = false; this->set_data_cfg(); if (this->check_save(flag_save, "GRUB_TIMEOUT")) { std::string cmd_boot_time = "ubconfig --target system set boot GRUB_TIMEOUT="; @@ -761,9 +778,6 @@ bool MainWindow::save_local_cfg() { } } } - else { - flag_no_save = true; - } map_local_cmd_selection = map_cmd_selection; return flag_no_save; } @@ -790,9 +804,9 @@ void MainWindow::download_globl_cfg() { entryKernel->set_text(""); entryOTT->set_text(""); entryIPT->set_text(""); - flag_save_local = false; - flag_save_global = false; - flag_save_all = false; + flag_save_local = true; + 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); @@ -816,9 +830,9 @@ void MainWindow::download_local_cfg() { entryKernel->set_text(""); entryOTT->set_text(""); entryIPT->set_text(""); - flag_save_local = false; - flag_save_global = false; - flag_save_all = false; + flag_save_local = true; + 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); diff --git a/source/ubl-settings-bootloader.h b/source/ubl-settings-bootloader.h index a01f8cb..44e7fe7 100644 --- a/source/ubl-settings-bootloader.h +++ b/source/ubl-settings-bootloader.h @@ -176,6 +176,7 @@ class MainWindow : public Gtk::ApplicationWindow { bool check_flag_save(string flag_save); void set_download_mode(string cmd); void change_password_protecc(); + void change_security_login(); bool focus_out_txt_password(GdkEventFocus*); void get_password_protec(string cmd, std::map &map_temp); void set_password_protec(string cmd, string cmd_remove);