From dfad291131caa2c51b889adb0e440bd9aa2509b9 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Fri, 31 Mar 2023 12:18:37 +0600 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=BB=D0=BE=D0=BA=D0=B0=D0=BB=D0=B8=D0=B7?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F,=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0=20cbx=20=D0=BF=D0=B0=D1=80=D0=BE=D0=BB=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/ubl-settings-bootloader.cc | 54 ++++++++++++++++++++++++------- source/ubl-settings-bootloader.h | 4 ++- ubl-settings-bootloader.glade | 42 ++++++++++++++++++++++-- ubl-settings-bootloader_ru.po | 19 ++++++----- 4 files changed, 95 insertions(+), 24 deletions(-) diff --git a/source/ubl-settings-bootloader.cc b/source/ubl-settings-bootloader.cc index 244f1e6..841b5d0 100755 --- a/source/ubl-settings-bootloader.cc +++ b/source/ubl-settings-bootloader.cc @@ -85,6 +85,7 @@ void MainWindow::settings(){ this->download_globl_cfg(); entrySecurityLogin->set_sensitive(false); this->set_active_boot_second(); + this->change_password_protecc(); this->event(); } @@ -277,7 +278,7 @@ void MainWindow::get_security_login(string cmd, std::map &map_t } } -void MainWindow::set_password_protec(string cmd="") { +void MainWindow::set_password_protec(string cmd = "", string cmd_remove= "") { // TODO: // Не работает int index = chbSecurityLogin->get_active_row_number(); @@ -286,18 +287,25 @@ void MainWindow::set_password_protec(string cmd="") { key = ""; } else if (index == 1) { - key = ""; + key = entryPasswordProtecc->get_text(); + } else if (index == 2) { - key = ""; + key = "remove"; + if (cmd.length() != 0 && cmd_remove.length() != 0) { + wrapper_system(cmd_remove, ""); + } + cmd = ""; } else { return; } - entrySecurityLogin->set_text(key); - cmd = cmd + key; + if (cmd.length() != 0 && cmd_remove.length() != 0) { + entrySecurityLogin->set_text(key); + cmd = cmd + key; + wrapper_system(cmd, ""); + } map_cmd_selection["GRUB_PASSWORD"] = key; - wrapper_system(cmd, ""); } void MainWindow::get_password_protec(string cmd, std::map &map_temp) { @@ -493,10 +501,10 @@ void MainWindow::localization(){ chbPasswordProtecc->append(gettext("Mine")); chbPasswordProtecc->append(gettext("Disabled")); - cmbDownloadMode->append(gettext("Plymouth graphics, full log")); - cmbDownloadMode->append(gettext("Plymouth graphics, no log")); - cmbDownloadMode->append(gettext("No plymouth, minimal log")); - cmbDownloadMode->append(gettext("Without plymouth, full log")); + cmbDownloadMode->append(gettext("Loading animation, full log")); + cmbDownloadMode->append(gettext("Loading animation, no log")); + cmbDownloadMode->append(gettext("No loading animation, full log.")); + cmbDownloadMode->append(gettext("No loading animation, minimal log.")); } vector MainWindow::get_setting_entry_all(string cmd, Gtk::Entry &entry_text, std::map &map_temp) { @@ -521,6 +529,12 @@ vector MainWindow::get_setting_entry_all(string cmd, Gtk::Entry &entry_t return vec_params; } +bool MainWindow::focus_out_txt_password(GdkEventFocus*) { + info_status_app("boxInfoMessError"); + lblWarning->set_text(gettext("Enter your password")); + return true; +} + bool MainWindow::focus_out_txt_kernel(GdkEventFocus*) { this->set_entry_to_tree_view(list_store_kernel, *entryKernel, vec_Option_kernel, size_kernel); return true; @@ -594,6 +608,8 @@ void MainWindow::event(){ entryKernel->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_kernel)); entryIPT->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_IPT)); 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)); if (this->check_root() == 0) { Glib::RefPtr treeViewKernelModel = treeViewKernel->get_model(); treeViewKernelModel->signal_row_changed().connect(sigc::mem_fun(*this, &MainWindow::item_selected_kernel)); @@ -608,6 +624,16 @@ void MainWindow::event(){ chbLoadVariantSelectionTimer->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::set_active_boot_second)); } +void MainWindow::change_password_protecc() { + int index = chbPasswordProtecc->get_active_row_number(); + if (index == 0 || index == 2 || index == -1) { + entryPasswordProtecc->set_sensitive(false); + } + else if (index == 1) { + entryPasswordProtecc->set_sensitive(true); + } +} + void MainWindow::set_active_boot_second() { spbSecond->set_sensitive(chbLoadVariantSelectionTimer->get_active()); lblInfoSeconds->set_sensitive(chbLoadVariantSelectionTimer->get_active()); @@ -669,7 +695,9 @@ bool MainWindow::save_global_cfg() { flag_no_save = false; } if (this->check_save(flag_save, "GRUB_PASSWORD")) { - this->set_password_protec("ubconfig --target global set boot GRUB_PASSWORD="); + string cmd_password = "ubconfig --target global set boot GRUB_PASSWORD="; + string cmd_password_remove = "ubconfig --target global remove boot GRUB_PASSWORD="; + this->set_password_protec(cmd_password, cmd_password_remove); flag_no_save = false; } } @@ -726,7 +754,9 @@ bool MainWindow::save_local_cfg() { flag_no_save = false; } if (this->check_save(flag_save, "GRUB_PASSWORD")) { - this->set_password_protec("ubconfig --target system set boot GRUB_PASSWORD="); + string cmd_password = "ubconfig --target system set boot GRUB_PASSWORD="; + string cmd_password_remove = "ubconfig --target system remove boot GRUB_PASSWORD="; + this->set_password_protec(cmd_password, cmd_password_remove); flag_no_save = false; } } diff --git a/source/ubl-settings-bootloader.h b/source/ubl-settings-bootloader.h index ce06be7..a01f8cb 100644 --- a/source/ubl-settings-bootloader.h +++ b/source/ubl-settings-bootloader.h @@ -175,8 +175,10 @@ class MainWindow : public Gtk::ApplicationWindow { void get_security_login(string cmd, std::map &map_temp); bool check_flag_save(string flag_save); void set_download_mode(string cmd); + void change_password_protecc(); + bool focus_out_txt_password(GdkEventFocus*); void get_password_protec(string cmd, std::map &map_temp); - void set_password_protec(string cmd); + void set_password_protec(string cmd, string cmd_remove); vector get_setting_entry_all(string cmd, Gtk::Entry &entry_text, std::map &map_temp); void cmd_entry_all(Gtk::Entry &entry, string cmd_settings); string dynamic_update_entry(std::map &map_view, vector &vec_allowed); diff --git a/ubl-settings-bootloader.glade b/ubl-settings-bootloader.glade index 3ff4e67..72ff405 100644 --- a/ubl-settings-bootloader.glade +++ b/ubl-settings-bootloader.glade @@ -374,7 +374,6 @@ specified priority False - 0 True False start @@ -385,6 +384,7 @@ specified priority 6 6 Default download + start False @@ -443,9 +443,9 @@ specified priority False - 0 True False + start 5 5 5 @@ -453,6 +453,7 @@ specified priority 6 6 Download mode + start False @@ -490,9 +491,9 @@ specified priority False - 0 True False + start 5 5 5 @@ -500,6 +501,7 @@ specified priority 6 6 Security login: + start False @@ -556,6 +558,7 @@ specified priority True False + start 5 5 5 @@ -563,6 +566,7 @@ specified priority 6 6 Password protection: + start False @@ -734,6 +738,7 @@ specified priority True False + start 5 5 5 @@ -741,6 +746,7 @@ specified priority 6 6 Parameters passed to the kernel + start @@ -848,6 +854,7 @@ specified priority True False + start 5 5 5 @@ -855,6 +862,7 @@ specified priority 6 6 Terminal for input + start @@ -962,6 +970,7 @@ specified priority True False + start 5 5 5 @@ -969,6 +978,7 @@ specified priority 6 6 Terminal for output + start @@ -1176,6 +1186,32 @@ specified priority + + both + True + + + + + + + + both + True + + + + + + + + + + + + + + False Внимание! diff --git a/ubl-settings-bootloader_ru.po b/ubl-settings-bootloader_ru.po index f1c80e7..f74bcd5 100644 --- a/ubl-settings-bootloader_ru.po +++ b/ubl-settings-bootloader_ru.po @@ -16,8 +16,8 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -msgid "Plymouth graphics, full log" -msgstr "Графика plymouth, полный лог" +msgid "Enter your password" +msgstr "Введите пароль" msgid "Mine" msgstr "Свой" @@ -28,14 +28,17 @@ msgstr "Отключён" msgid "Default" msgstr "По умолчанию" -msgid "Plymouth graphics, no log" -msgstr "Графика plymouth, нет лога" +msgid "Loading animation, full log" +msgstr "Анимация загрузки, полный лог" -msgid "No plymouth, minimal log" -msgstr "Без plymouth, минимальный лог" +msgid "Loading animation, no log" +msgstr "Анимация загрузки, нет лога" -msgid "Without plymouth, full log" -msgstr "Без plymouth, полный лог" +msgid "No loading animation, full log." +msgstr "Без анимации загрузки, полный лог" + +msgid "No loading animation, minimal log." +msgstr "Без анимации загрузки, минимальный лог" msgid "Download mode:" msgstr "Режим загрузки:"