Исправлена локализация, добавлена обработка cbx пароля

pull/11/head
Igor Belitskiy 3 years ago
parent 1388a5b5fb
commit dfad291131

@ -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 <string, string> &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 <string, string> &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<string> MainWindow::get_setting_entry_all(string cmd, Gtk::Entry &entry_text, std::map <string, string> &map_temp) {
@ -521,6 +529,12 @@ vector<string> 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<Gtk::TreeModel> 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;
}
}

@ -175,8 +175,10 @@ class MainWindow : public Gtk::ApplicationWindow {
void get_security_login(string cmd, std::map <string, string> &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 <string, string> &map_temp);
void set_password_protec(string cmd);
void set_password_protec(string cmd, string cmd_remove);
vector<string> get_setting_entry_all(string cmd, Gtk::Entry &entry_text, std::map <string, string> &map_temp);
void cmd_entry_all(Gtk::Entry &entry, string cmd_settings);
string dynamic_update_entry(std::map<string, string> &map_view, vector<string> &vec_allowed);

@ -374,7 +374,6 @@ specified priority</property>
<property name="can-focus">False</property>
<child>
<object class="GtkLabel" id="lblInfoDefaultDonw">
<property name="width-request">0</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
@ -385,6 +384,7 @@ specified priority</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="label" translatable="yes">Default download</property>
<property name="ellipsize">start</property>
</object>
<packing>
<property name="expand">False</property>
@ -443,9 +443,9 @@ specified priority</property>
<property name="can-focus">False</property>
<child>
<object class="GtkLabel" id="lblDownloadMode">
<property name="width-request">0</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
@ -453,6 +453,7 @@ specified priority</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="label" translatable="yes">Download mode</property>
<property name="ellipsize">start</property>
</object>
<packing>
<property name="expand">False</property>
@ -490,9 +491,9 @@ specified priority</property>
<property name="can-focus">False</property>
<child>
<object class="GtkLabel" id="lblSecurityLogin">
<property name="width-request">0</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
@ -500,6 +501,7 @@ specified priority</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="label" translatable="yes">Security login:</property>
<property name="ellipsize">start</property>
</object>
<packing>
<property name="expand">False</property>
@ -556,6 +558,7 @@ specified priority</property>
<object class="GtkLabel" id="lblPasswordProtec">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
@ -563,6 +566,7 @@ specified priority</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="label" translatable="yes">Password protection:</property>
<property name="ellipsize">start</property>
</object>
<packing>
<property name="expand">False</property>
@ -734,6 +738,7 @@ specified priority</property>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
@ -741,6 +746,7 @@ specified priority</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="label" translatable="yes">Parameters passed to the kernel</property>
<property name="ellipsize">start</property>
</object>
</child>
</object>
@ -848,6 +854,7 @@ specified priority</property>
<object class="GtkLabel" id="lblInfoInputTerminal">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
@ -855,6 +862,7 @@ specified priority</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="label" translatable="yes">Terminal for input</property>
<property name="ellipsize">start</property>
</object>
</child>
</object>
@ -962,6 +970,7 @@ specified priority</property>
<object class="GtkLabel" id="lblInfoOutputTerminal">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
@ -969,6 +978,7 @@ specified priority</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="label" translatable="yes">Terminal for output</property>
<property name="ellipsize">start</property>
</object>
</child>
</object>
@ -1176,6 +1186,32 @@ specified priority</property>
</object>
</child>
</object>
<object class="GtkSizeGroup">
<property name="mode">both</property>
<property name="ignore-hidden">True</property>
<widgets>
<widget name="entryKernel"/>
<widget name="entryIPT"/>
<widget name="entryOTT"/>
</widgets>
</object>
<object class="GtkSizeGroup">
<property name="mode">both</property>
<property name="ignore-hidden">True</property>
<widgets>
<widget name="cmbDefaultDonw"/>
<widget name="chbSecurityLogin"/>
<widget name="chbPasswordProtecc"/>
</widgets>
</object>
<object class="GtkSizeGroup">
<widgets>
<widget name="lblInfoDefaultDonw"/>
<widget name="lblDownloadMode"/>
<widget name="lblSecurityLogin"/>
<widget name="lblPasswordProtec"/>
</widgets>
</object>
<object class="GtkWindow" id="mess_sudo">
<property name="can-focus">False</property>
<property name="title" translatable="yes">Внимание!</property>

@ -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 "Режим загрузки:"

Loading…
Cancel
Save