mirror of
https://github.com/OpenMW/openmw.git
synced 2026-02-01 05:48:27 +00:00
Move search result count persistence to tableSizeUpdate
This commit is contained in:
parent
98f309d7f8
commit
0ca93eb23e
2 changed files with 10 additions and 9 deletions
|
|
@ -116,8 +116,12 @@ void CSVTools::SearchBox::setSearchMode(bool enabled)
|
|||
|
||||
void CSVTools::SearchBox::setSearchResultCount(int resultCount)
|
||||
{
|
||||
int priorResultCount = mSearchResultCount;
|
||||
mSearchResultCount = resultCount;
|
||||
updateSearchButtons();
|
||||
|
||||
// Update search buttons only if we're changing between zero and non-zero
|
||||
if ((priorResultCount == 0) != (mSearchResultCount == 0))
|
||||
updateSearchButtons();
|
||||
}
|
||||
|
||||
CSMTools::Search CSVTools::SearchBox::getSearch() const
|
||||
|
|
|
|||
|
|
@ -65,8 +65,6 @@ void CSVTools::SearchSubView::replace(bool selection)
|
|||
mTable->model()->removeRows(*iter, 1);
|
||||
}
|
||||
}
|
||||
|
||||
mSearchBox.setSearchResultCount(mTable->model()->rowCount());
|
||||
}
|
||||
|
||||
void CSVTools::SearchSubView::showEvent(QShowEvent* event)
|
||||
|
|
@ -152,16 +150,15 @@ void CSVTools::SearchSubView::replaceAllRequest()
|
|||
|
||||
void CSVTools::SearchSubView::tableSizeUpdate()
|
||||
{
|
||||
mBottom->tableSizeChanged(mDocument.getReport(getUniversalId())->rowCount(), 0, 0);
|
||||
int resultCount = mDocument.getReport(getUniversalId())->rowCount();
|
||||
mBottom->tableSizeChanged(resultCount, 0, 0);
|
||||
mSearchBox.setSearchResultCount(resultCount);
|
||||
}
|
||||
|
||||
void CSVTools::SearchSubView::operationDone(int type, bool failed)
|
||||
{
|
||||
if (type == CSMDoc::State_Searching)
|
||||
if (type == CSMDoc::State_Searching && !failed && !mDocument.getReport(getUniversalId())->rowCount())
|
||||
{
|
||||
int resultCount = mDocument.getReport(getUniversalId())->rowCount();
|
||||
if (!failed && !resultCount)
|
||||
mBottom->setStatusMessage("No Results");
|
||||
mSearchBox.setSearchResultCount(resultCount);
|
||||
mBottom->setStatusMessage("No Results");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue