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

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

@ -85,6 +85,7 @@ void MainWindow::settings(){
this->download_globl_cfg(); this->download_globl_cfg();
entrySecurityLogin->set_sensitive(false); entrySecurityLogin->set_sensitive(false);
this->set_active_boot_second(); this->set_active_boot_second();
this->change_password_protecc();
this->event(); 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: // TODO:
// Не работает // Не работает
int index = chbSecurityLogin->get_active_row_number(); int index = chbSecurityLogin->get_active_row_number();
@ -286,18 +287,25 @@ void MainWindow::set_password_protec(string cmd="") {
key = ""; key = "";
} }
else if (index == 1) { else if (index == 1) {
key = ""; key = entryPasswordProtecc->get_text();
} }
else if (index == 2) { else if (index == 2) {
key = ""; key = "remove";
if (cmd.length() != 0 && cmd_remove.length() != 0) {
wrapper_system(cmd_remove, "");
}
cmd = "";
} }
else { else {
return; return;
} }
entrySecurityLogin->set_text(key); if (cmd.length() != 0 && cmd_remove.length() != 0) {
cmd = cmd + key; entrySecurityLogin->set_text(key);
cmd = cmd + key;
wrapper_system(cmd, "");
}
map_cmd_selection["GRUB_PASSWORD"] = key; map_cmd_selection["GRUB_PASSWORD"] = key;
wrapper_system(cmd, "");
} }
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) {
@ -493,10 +501,10 @@ void MainWindow::localization(){
chbPasswordProtecc->append(gettext("Mine")); chbPasswordProtecc->append(gettext("Mine"));
chbPasswordProtecc->append(gettext("Disabled")); chbPasswordProtecc->append(gettext("Disabled"));
cmbDownloadMode->append(gettext("Plymouth graphics, full log")); cmbDownloadMode->append(gettext("Loading animation, full log"));
cmbDownloadMode->append(gettext("Plymouth graphics, no log")); cmbDownloadMode->append(gettext("Loading animation, no log"));
cmbDownloadMode->append(gettext("No plymouth, minimal log")); cmbDownloadMode->append(gettext("No loading animation, full log."));
cmbDownloadMode->append(gettext("Without plymouth, 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) { 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; 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*) { bool MainWindow::focus_out_txt_kernel(GdkEventFocus*) {
this->set_entry_to_tree_view(list_store_kernel, *entryKernel, vec_Option_kernel, size_kernel); this->set_entry_to_tree_view(list_store_kernel, *entryKernel, vec_Option_kernel, size_kernel);
return true; return true;
@ -594,6 +608,8 @@ void MainWindow::event(){
entryKernel->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_kernel)); 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)); 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)); 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) { if (this->check_root() == 0) {
Glib::RefPtr<Gtk::TreeModel> treeViewKernelModel = treeViewKernel->get_model(); Glib::RefPtr<Gtk::TreeModel> treeViewKernelModel = treeViewKernel->get_model();
treeViewKernelModel->signal_row_changed().connect(sigc::mem_fun(*this, &MainWindow::item_selected_kernel)); 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)); 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() { void MainWindow::set_active_boot_second() {
spbSecond->set_sensitive(chbLoadVariantSelectionTimer->get_active()); spbSecond->set_sensitive(chbLoadVariantSelectionTimer->get_active());
lblInfoSeconds->set_sensitive(chbLoadVariantSelectionTimer->get_active()); lblInfoSeconds->set_sensitive(chbLoadVariantSelectionTimer->get_active());
@ -669,7 +695,9 @@ bool MainWindow::save_global_cfg() {
flag_no_save = false; flag_no_save = false;
} }
if (this->check_save(flag_save, "GRUB_PASSWORD")) { 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; flag_no_save = false;
} }
} }
@ -726,7 +754,9 @@ bool MainWindow::save_local_cfg() {
flag_no_save = false; flag_no_save = false;
} }
if (this->check_save(flag_save, "GRUB_PASSWORD")) { 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; 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); void get_security_login(string cmd, std::map <string, string> &map_temp);
bool check_flag_save(string flag_save); bool check_flag_save(string flag_save);
void set_download_mode(string cmd); 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 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); 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); void cmd_entry_all(Gtk::Entry &entry, string cmd_settings);
string dynamic_update_entry(std::map<string, string> &map_view, vector<string> &vec_allowed); 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> <property name="can-focus">False</property>
<child> <child>
<object class="GtkLabel" id="lblInfoDefaultDonw"> <object class="GtkLabel" id="lblInfoDefaultDonw">
<property name="width-request">0</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="halign">start</property> <property name="halign">start</property>
@ -385,6 +384,7 @@ specified priority</property>
<property name="margin-top">6</property> <property name="margin-top">6</property>
<property name="margin-bottom">6</property> <property name="margin-bottom">6</property>
<property name="label" translatable="yes">Default download</property> <property name="label" translatable="yes">Default download</property>
<property name="ellipsize">start</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -443,9 +443,9 @@ specified priority</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<child> <child>
<object class="GtkLabel" id="lblDownloadMode"> <object class="GtkLabel" id="lblDownloadMode">
<property name="width-request">0</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="halign">start</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
<property name="margin-right">5</property> <property name="margin-right">5</property>
<property name="margin-start">5</property> <property name="margin-start">5</property>
@ -453,6 +453,7 @@ specified priority</property>
<property name="margin-top">6</property> <property name="margin-top">6</property>
<property name="margin-bottom">6</property> <property name="margin-bottom">6</property>
<property name="label" translatable="yes">Download mode</property> <property name="label" translatable="yes">Download mode</property>
<property name="ellipsize">start</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -490,9 +491,9 @@ specified priority</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<child> <child>
<object class="GtkLabel" id="lblSecurityLogin"> <object class="GtkLabel" id="lblSecurityLogin">
<property name="width-request">0</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="halign">start</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
<property name="margin-right">5</property> <property name="margin-right">5</property>
<property name="margin-start">5</property> <property name="margin-start">5</property>
@ -500,6 +501,7 @@ specified priority</property>
<property name="margin-top">6</property> <property name="margin-top">6</property>
<property name="margin-bottom">6</property> <property name="margin-bottom">6</property>
<property name="label" translatable="yes">Security login:</property> <property name="label" translatable="yes">Security login:</property>
<property name="ellipsize">start</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -556,6 +558,7 @@ specified priority</property>
<object class="GtkLabel" id="lblPasswordProtec"> <object class="GtkLabel" id="lblPasswordProtec">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="halign">start</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
<property name="margin-right">5</property> <property name="margin-right">5</property>
<property name="margin-start">5</property> <property name="margin-start">5</property>
@ -563,6 +566,7 @@ specified priority</property>
<property name="margin-top">6</property> <property name="margin-top">6</property>
<property name="margin-bottom">6</property> <property name="margin-bottom">6</property>
<property name="label" translatable="yes">Password protection:</property> <property name="label" translatable="yes">Password protection:</property>
<property name="ellipsize">start</property>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -734,6 +738,7 @@ specified priority</property>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="halign">start</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
<property name="margin-right">5</property> <property name="margin-right">5</property>
<property name="margin-start">5</property> <property name="margin-start">5</property>
@ -741,6 +746,7 @@ specified priority</property>
<property name="margin-top">6</property> <property name="margin-top">6</property>
<property name="margin-bottom">6</property> <property name="margin-bottom">6</property>
<property name="label" translatable="yes">Parameters passed to the kernel</property> <property name="label" translatable="yes">Parameters passed to the kernel</property>
<property name="ellipsize">start</property>
</object> </object>
</child> </child>
</object> </object>
@ -848,6 +854,7 @@ specified priority</property>
<object class="GtkLabel" id="lblInfoInputTerminal"> <object class="GtkLabel" id="lblInfoInputTerminal">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="halign">start</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
<property name="margin-right">5</property> <property name="margin-right">5</property>
<property name="margin-start">5</property> <property name="margin-start">5</property>
@ -855,6 +862,7 @@ specified priority</property>
<property name="margin-top">6</property> <property name="margin-top">6</property>
<property name="margin-bottom">6</property> <property name="margin-bottom">6</property>
<property name="label" translatable="yes">Terminal for input</property> <property name="label" translatable="yes">Terminal for input</property>
<property name="ellipsize">start</property>
</object> </object>
</child> </child>
</object> </object>
@ -962,6 +970,7 @@ specified priority</property>
<object class="GtkLabel" id="lblInfoOutputTerminal"> <object class="GtkLabel" id="lblInfoOutputTerminal">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="halign">start</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
<property name="margin-right">5</property> <property name="margin-right">5</property>
<property name="margin-start">5</property> <property name="margin-start">5</property>
@ -969,6 +978,7 @@ specified priority</property>
<property name="margin-top">6</property> <property name="margin-top">6</property>
<property name="margin-bottom">6</property> <property name="margin-bottom">6</property>
<property name="label" translatable="yes">Terminal for output</property> <property name="label" translatable="yes">Terminal for output</property>
<property name="ellipsize">start</property>
</object> </object>
</child> </child>
</object> </object>
@ -1176,6 +1186,32 @@ specified priority</property>
</object> </object>
</child> </child>
</object> </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"> <object class="GtkWindow" id="mess_sudo">
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="title" translatable="yes">Внимание!</property> <property name="title" translatable="yes">Внимание!</property>

@ -16,8 +16,8 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
msgid "Plymouth graphics, full log" msgid "Enter your password"
msgstr "Графика plymouth, полный лог" msgstr "Введите пароль"
msgid "Mine" msgid "Mine"
msgstr "Свой" msgstr "Свой"
@ -28,14 +28,17 @@ msgstr "Отключён"
msgid "Default" msgid "Default"
msgstr "По умолчанию" msgstr "По умолчанию"
msgid "Plymouth graphics, no log" msgid "Loading animation, full log"
msgstr "Графика plymouth, нет лога" msgstr "Анимация загрузки, полный лог"
msgid "No plymouth, minimal log" msgid "Loading animation, no log"
msgstr "Без plymouth, минимальный лог" msgstr "Анимация загрузки, нет лога"
msgid "Without plymouth, full log" msgid "No loading animation, full log."
msgstr "Без plymouth, полный лог" msgstr "Без анимации загрузки, полный лог"
msgid "No loading animation, minimal log."
msgstr "Без анимации загрузки, минимальный лог"
msgid "Download mode:" msgid "Download mode:"
msgstr "Режим загрузки:" msgstr "Режим загрузки:"

Loading…
Cancel
Save