diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index b0d3007..09e128f 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -13,7 +13,7 @@ find_package(ICU REQUIRED COMPONENTS uc dt in io) 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 ubl-util-standard.h diff --git a/source/ubl-settings-datetime.cc b/source/ubl-settings-datetime.cc index 363512e..8da0772 100644 --- a/source/ubl-settings-datetime.cc +++ b/source/ubl-settings-datetime.cc @@ -808,7 +808,7 @@ void MainWindow::calendar_show(){ } void MainWindow::fill_in_reg_zone(string &cmd){ int error = warning_info; - struct Result obj_result_1 = this->wrapper_call(cmd); + struct Result obj_result_1 = this->wrapper_call(cmd); if (obj_result_1.error==0){ auto arr_reg_zone = this->split_region_zone(obj_result_1.response); if (arr_reg_zone[0].length()!=0){ @@ -836,7 +836,7 @@ void MainWindow::get_config(){ this->update_calendar(); } -array MainWindow::split_region_zone(string read_reg_zon_cfg){ +array MainWindow::split_region_zone(string &read_reg_zon_cfg){ array arr; if (read_reg_zon_cfg.find("/")!=std::string::npos){ string str_filling_reg = read_reg_zon_cfg.substr(0,read_reg_zon_cfg.find("/")); @@ -845,6 +845,10 @@ array MainWindow::split_region_zone(string read_reg_zon_cfg){ arr[0] = str_filling_reg; arr[1] = str_filling_zon; } + else if (read_reg_zon_cfg.length()!=0){ + arr[0] = read_reg_zon_cfg; + arr[1] = ""; + } else{ arr[0] = ""; arr[1] = ""; @@ -940,11 +944,13 @@ void MainWindow::append_region_zone(string region, string zone, Gtk::ComboBoxTex if (region==""){ tmpCbZone->append(" "); tmpCbZone->set_active(0); + tmpCbReg->set_active(-1); return; } if (time_reg_map_local.find(region) == time_reg_map_local.end()){ tmpCbZone->append(" "); tmpCbZone->set_active(0); + tmpCbReg->set_active(-1); } else{ for (string &_str_zone : time_reg_map_local.at(region)){ @@ -952,13 +958,14 @@ void MainWindow::append_region_zone(string region, string zone, Gtk::ComboBoxTex if (_str_zone!=""){ if (zone_offest == _str_zone){ tmpCbZone->set_active(index); - } } + } index+=1; } } if (region=="Etc" && zone==""){ warning_info-=1; + tmpCbZone->set_active(index); } else if (region=="" && zone==""){ warning_info+=1; @@ -991,15 +998,17 @@ string MainWindow::call(string cmd){ void MainWindow::append_zone(){ cbZone->remove_all(); int index = cbRegion->get_active_row_number(); - string str_region = array_region[index]; - string zone_mixing=""; - string path_dir=""; - if(str_region.length()!=0){ - for (const auto &_str_zone : time_reg_map_local.at(str_region)){ - cbZone->append(Glib::ustring(_str_zone)); + if (index!=-1){ + string str_region = array_region[index]; + string zone_mixing=""; + string path_dir=""; + if(str_region.length()!=0){ + for (const auto &_str_zone : time_reg_map_local.at(str_region)){ + cbZone->append(Glib::ustring(_str_zone)); + } } + cbZone->set_active(0); } - cbZone->set_active(0); } void MainWindow::update_time_date(){ diff --git a/source/ubl-settings-datetime.h b/source/ubl-settings-datetime.h old mode 100644 new mode 100755 index 9fc5583..9bf6c34 --- a/source/ubl-settings-datetime.h +++ b/source/ubl-settings-datetime.h @@ -176,7 +176,7 @@ class MainWindow : public Gtk::ApplicationWindow { void wrapper_update_time_date(); string zone_file_read(string zone); void sort_zone(vector *time_reg_map_local,vector *time_reg_map); - array split_region_zone(string read_reg_zon_cfg); + array split_region_zone(string &read_reg_zon_cfg); string str_remove(std::string& source, const std::string to_remove); vector split(const std::string &s, char delim); struct Result wrapper_call(string cmd);