diff options
author | Johannes Schickel | 2009-07-15 17:07:45 +0000 |
---|---|---|
committer | Johannes Schickel | 2009-07-15 17:07:45 +0000 |
commit | 7b55b5f5e2dbfd59a5936cb4671060d7b3b6ff81 (patch) | |
tree | 114e507bd895542a2485f2a24e4be4f69a426d12 /gui | |
parent | 6b3c3a8a12d9ef7caa316f63d62f92c0ed606881 (diff) | |
download | scummvm-rg350-7b55b5f5e2dbfd59a5936cb4671060d7b3b6ff81.tar.gz scummvm-rg350-7b55b5f5e2dbfd59a5936cb4671060d7b3b6ff81.tar.bz2 scummvm-rg350-7b55b5f5e2dbfd59a5936cb4671060d7b3b6ff81.zip |
Fix "search" filter being settings lost in launcher, when using the "Edit Game..." menu for example.
svn-id: r42510
Diffstat (limited to 'gui')
-rw-r--r-- | gui/ListWidget.cpp | 18 | ||||
-rw-r--r-- | gui/launcher.cpp | 4 |
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() { |