|  |  | @ -34,6 +34,11 @@ bool Save::check_save(string flag_save, string key_name) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |     iter_map_data = (*map_gui).find(key_name); |  |  |  |     iter_map_data = (*map_gui).find(key_name); | 
			
		
	
		
		
			
				
					
					|  |  |  |     iter_map_data_old = (*map_data_old).find(key_name); |  |  |  |     iter_map_data_old = (*map_data_old).find(key_name); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     if ((*map_local).find(key_name) != (*map_local).end() && (*map_global).find(key_name) != (*map_global).end()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if ((*map_local)[key_name] != (*map_global)[key_name]) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return true; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |     if (iter_map_data_old == (*map_data_old).end() && iter_map_data != (*map_gui).end()) { |  |  |  |     if (iter_map_data_old == (*map_data_old).end() && iter_map_data != (*map_gui).end()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         return true; |  |  |  |         return true; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
	
		
		
			
				
					|  |  | @ -52,16 +57,32 @@ bool Save::check_save(string flag_save, string key_name) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     return true; |  |  |  |     return true; | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | void Save::save(std::map <string, string> &map_gui, string sections, string str_flag_save) { |  |  |  | int Save::get_count_error() { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     return process.get_count_error(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | string Save::get_cmd_error() { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     return process.get_cmd_error(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | void Save::set_count_error(int count_error) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     process.set_count_error(count_error); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | void Save::set_vec_params(vector<string>& vec_param_names) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     this->vec_param_names = &vec_param_names; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | void Save::save(string sections, string str_flag_save) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     string key = ""; |  |  |  |     string key = ""; | 
			
		
	
		
		
			
				
					
					|  |  |  |     string value = ""; |  |  |  |     string value = ""; | 
			
		
	
		
		
			
				
					
					|  |  |  |     string cmd = ""; |  |  |  |     string cmd = ""; | 
			
		
	
		
		
			
				
					
					|  |  |  |     string str_error = ""; |  |  |  |     string str_error = ""; | 
			
		
	
		
		
			
				
					
					|  |  |  |     this->flag_no_save = false; |  |  |  |     this->flag_no_save = true; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     for (const auto &map_iter: map_gui) { |  |  |  |     for (const auto &key: *vec_param_names) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         key = map_iter.first; |  |  |  |         if (map_gui->find(key) != map_gui->end()) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         value = map_iter.second; |  |  |  |             value = (*map_gui)[key]; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         if (this->check_save(str_flag_save, key) == true) { |  |  |  |             if (this->check_save(str_flag_save, key)) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 if (value.length() != 0) { |  |  |  |                 if (value.length() != 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     cmd = "ubconfig --target  " + str_flag_save + " set " + sections + " " + |  |  |  |                     cmd = "ubconfig --target  " + str_flag_save + " set " + sections + " " + | 
			
		
	
		
		
			
				
					
					|  |  |  |                             key + "=\"" + value + "\""; |  |  |  |                             key + "=\"" + value + "\""; | 
			
		
	
	
		
		
			
				
					|  |  | @ -74,7 +95,43 @@ void Save::save(std::map <string, string> &map_gui, string sections, string str_ | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (cmd.length() != 0) { |  |  |  |                 if (cmd.length() != 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     process.call(cmd, ""); |  |  |  |                     process.call(cmd, ""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     this->flag_no_save = false; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     str_error = process.get_cmd_error(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     if (str_error.length() != 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         this->vec_errors.push_back(str_error); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         str_error = ""; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |          | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | void Save::save_all(string sections, string str_flag_save) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     string key = ""; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     string value = ""; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     string cmd_all = "ubconfig --target  " + str_flag_save + " set " + sections; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     size_t len_start_cmd_all = cmd_all.length();  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     string str_error = ""; | 
			
		
	
		
		
			
				
					
					|  |  |  |     this->flag_no_save = true; |  |  |  |     this->flag_no_save = true; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     string cmd = ""; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     string cmd_remove = ""; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     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 (value.length() != 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     cmd_all += " " + key + "=\"" + value + "\""; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 else if (value.length() == 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     cmd = "ubconfig --target  " + str_flag_save + " remove " + sections + " " + key; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     cmd = ""; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (cmd.length() != 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     process.call(cmd, ""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     this->flag_no_save = false; | 
			
		
	
		
		
			
				
					
					|  |  |  |                     str_error = process.get_cmd_error(); |  |  |  |                     str_error = process.get_cmd_error(); | 
			
		
	
		
		
			
				
					
					|  |  |  |                     if (str_error.length() != 0) { |  |  |  |                     if (str_error.length() != 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                         this->vec_errors.push_back(str_error); |  |  |  |                         this->vec_errors.push_back(str_error); | 
			
		
	
	
		
		
			
				
					|  |  | @ -83,5 +140,16 @@ void Save::save(std::map <string, string> &map_gui, string sections, string str_ | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |          | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     if (len_start_cmd_all != cmd_all.length()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         process.call(cmd, ""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         this->flag_no_save = false; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         str_error = process.get_cmd_error(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (str_error.length() != 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             this->vec_errors.push_back(str_error); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             str_error = ""; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |