aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
Diffstat (limited to 'gui')
-rw-r--r--gui/ListWidget.cpp18
-rw-r--r--gui/launcher.cpp4
2 files changed, 22 insertions, 0 deletions
diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp
index 8661444cf3..78372fcba8 100644
--- a/gui/ListWidget.cpp
+++ b/gui/ListWidget.cpp
@@ -105,6 +105,22 @@ Widget *ListWidget::findWidget(int x, int y) {
}
void ListWidget::setSelected(int item) {
+ // HACK/FIXME: If our _listIndex has a non zero size,
+ // we will need to look up, whether the user selected
+ // item is present in that list
+ if (_listIndex.size()) {
+ int filteredItem = -1;
+
+ for (uint i = 0; i < _listIndex.size(); ++i) {
+ if (_listIndex[i] == item) {
+ filteredItem = i;
+ break;
+ }
+ }
+
+ item = filteredItem;
+ }
+
assert(item >= -1 && item < (int)_list.size());
// We only have to do something if the widget is enabled and the selection actually changes
@@ -131,6 +147,7 @@ void ListWidget::setList(const StringList &list) {
_dataList = list;
_list = list;
_filter.clear();
+ _listIndex.clear();
int size = list.size();
if (_currentPos >= size)
@@ -560,6 +577,7 @@ void ListWidget::setFilter(const String &filter, bool redraw) {
if (_filter.empty()) {
// No filter -> display everything
_list = _dataList;
+ _listIndex.clear();
} else {
// Restrict the list to everything which contains all words in _filter
// as substrings, ignoring case.
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index da49c1ccfd..1ab4728072 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -641,6 +641,10 @@ void LauncherDialog::updateListing() {
// Select the last entry if the list has been reduced
_list->setSelected(_list->getList().size() - 1);
updateButtons();
+
+ // Update the filter settings, those are lost when "setList"
+ // is called.
+ _list->setFilter(_searchWidget->getEditString());
}
void LauncherDialog::addGame() {