From 6fe97065c5911ac3e7b37e40ba71776ee96e060e Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Sat, 4 Jan 2014 15:20:56 +0100 Subject: [PATCH] CMenuOptionChooser: Fix multiple menu items, when using sort option Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/9af1cdb3187d140c6f710135f1a3fb0b7f9b789b Author: Michael Liebmann Date: 2014-01-04 (Sat, 04 Jan 2014) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/widget/menue.cpp | 14 ++++++++------ src/gui/widget/menue.h | 6 +++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 94545daec..d622db8c3 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1383,6 +1383,7 @@ int CMenuOptionChooser::exec(CMenuTarget*) int ret = menu_return::RETURN_NONE; if (optionsSort) { + optionsSort = false; clearChooserOptions(); unsigned int i1; for (i1 = 0; i1 < number_of_options; i1++) @@ -1395,12 +1396,13 @@ int CMenuOptionChooser::exec(CMenuTarget*) sort(option_chooser_options_v.begin(), option_chooser_options_v.end(), CMenuOptionChooserCompareItem()); - i1 = 0; - for (std::vector::iterator it = option_chooser_options_v.begin(); it != option_chooser_options_v.end() && i1 < number_of_options; ++it) { - options[i1].key = (*it)->key; - options[i1].value = NONEXISTANT_LOCALE; - options[i1].valname = (*it)->valname.c_str(); - i1++; + options.clear(); + for (std::vector::iterator it = option_chooser_options_v.begin(); it != option_chooser_options_v.end(); ++it) { + struct keyval_ext opt; + opt.key = (*it)->key; + opt.value = NONEXISTANT_LOCALE; + opt.valname = (*it)->valname.c_str(); + options.push_back(opt); } } diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index d2a39fb86..d5b067093 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -352,9 +352,9 @@ class CMenuOptionChooser : public CAbstractMenuOptionChooser private: std::vector options; std::vector option_chooser_options_v; - unsigned number_of_options; - CChangeObserver * observ; - std::string optionNameString; + unsigned number_of_options; + CChangeObserver * observ; + std::string optionNameString; bool pulldown; bool optionsSort;