From 0112ec6a1f671728e60d173536fd0e45478300ea Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Wed, 10 May 2023 16:52:54 +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=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D0=B0?= =?UTF-8?q?=20=D1=81=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/CMakeLists.txt | 2 +- source/save.cc | 18 ++++++++++++++++-- source/save.h | 2 +- source/ubl-settings-bootloader.cc | 12 ++++-------- source/ubl-settings-bootloader.h | 6 ++++-- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 670aa0b..725f694 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -28,7 +28,7 @@ configure_file(ubl-settings-bootloader.h.in ubl-settings-bootloader-cm.h) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always \ -O2 -pipe -fno-plt -fexceptions \ -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \ - -fstack-clash-protection -fcf-protection") + -fstack-clash-protection -fcf-protection -g") set(SOURCE_FILES menu_os.h diff --git a/source/save.cc b/source/save.cc index c824093..8fc3d11 100644 --- a/source/save.cc +++ b/source/save.cc @@ -57,6 +57,20 @@ bool Save::check_save(string flag_save, string key_name) { return true; } +bool Save::wrapper_check_save(string flag_save, string key_name) { + if (flag_save == "all") { + bool bool_flag_save = this->check_save("system", key_name); + if (bool_flag_save) { + return true; + } + return this->check_save("global", key_name); + } + else { + return this->check_save(flag_save, key_name); + } + +} + int Save::get_count_error() { return process.get_count_error(); } @@ -82,7 +96,7 @@ void Save::save(string sections, string str_flag_save) { for (const auto &key: *vec_param_names) { if (map_gui->find(key) != map_gui->end()) { value = (*map_gui)[key]; - if (this->check_save(str_flag_save, key)) { + if (this->wrapper_check_save(str_flag_save, key)) { if (value.length() != 0) { cmd = "ubconfig --target " + str_flag_save + " set " + sections + " " + key + "=\"" + value + "\""; @@ -117,7 +131,7 @@ void Save::save_one_cmd(string cmd1, string cmd_remove, string str_flag_save) { for (const auto &key: *vec_param_names) { if (map_gui->find(key) != map_gui->end()) { value = (*map_gui)[key]; - if (this->check_save(str_flag_save, key)) { + if (this->wrapper_check_save(str_flag_save, key)) { if (value.length() != 0) { cmd = cmd + key + "=\"" + value + "\" "; } diff --git a/source/save.h b/source/save.h index 40b13a1..b268b31 100644 --- a/source/save.h +++ b/source/save.h @@ -20,7 +20,7 @@ public: void set_data_gui(std::map &map_gui); bool check_save(string flag_save, string key_name); bool get_state_save(); - + bool wrapper_check_save(string flag_save, string key_name); void save_one_cmd(string cmd1, string cmd_remove, string str_flag_save); int get_count_error(); string get_cmd_error(); diff --git a/source/ubl-settings-bootloader.cc b/source/ubl-settings-bootloader.cc index 4bd132f..a7cd686 100755 --- a/source/ubl-settings-bootloader.cc +++ b/source/ubl-settings-bootloader.cc @@ -951,15 +951,11 @@ void MainWindow::set_active_boot_second() { void MainWindow::wrapper_save_all_cfg() { this->set_data_cfg(); - bool _flag_save_global1 = true; - bool _flag_save_local1 = true; - if (flag_save_global == false) { - _flag_save_global1 = this->save_template(global_save, global_remove , "global"); + bool _flag_save_all = true; + if (flag_save_global == false || flag_save_local == false) { + _flag_save_all = this->save_template(all_save, all_remove, "all"); } - if (flag_save_local == false) { - _flag_save_local1 = this->save_template(system_save, system_remove , "system"); - } - if (_flag_save_global1 && _flag_save_local1) { + if (_flag_save_all) { this->info_warning_error(5); } else { diff --git a/source/ubl-settings-bootloader.h b/source/ubl-settings-bootloader.h index ab0b0b1..9c31ff6 100644 --- a/source/ubl-settings-bootloader.h +++ b/source/ubl-settings-bootloader.h @@ -120,8 +120,10 @@ void me_thread(string cmd); #define global_load "ubconfig --default --source global get boot" #define system_load "ubconfig --default --source system get boot" -#define global_save "ubconfig --target global set boot " -#define system_save "ubconfig --target system set boot " +#define all_save "ubconfig --noexecute set boot " +#define all_remove "ubconfig --noexecute set/remove boot " +#define global_save "ubconfig --target global --noexecute set boot " +#define system_save "ubconfig --target system --noexecute set boot " #define global_remove "ubconfig --target global --noexecute set/remove boot " #define system_remove "ubconfig --target system --noexecute set/remove boot " #define link_doc "https://wiki.ublinux.com/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-bootloader"