/**@{*/
/**
- * @brief Notify engine that SearchData was Inserted/Updated/Deleted
+ * @brief Insert/Delete results for given SearchData
* @param[in] searchData SearchData object
*/
void insertSearchData(SearchData *searchData);
- void updateSearchData(SearchData *searchData);
void deleteSearchData(SearchData *searchData);
/**@}*/
searchData->setSearchResult(lastResult);
}
-void SearchEngine::updateSearchData(SearchData *searchData)
-{
- SearchResult *lastResult = nullptr;
-
- historyFor([searchData, &lastResult](const std::string &query, ResultList &list) {
- auto it = findSearchData(list, searchData);
- if (it != list.end()) {
- SearchResultPtr searchResult = searchData->compare(query);
- lastResult = searchResult.get();
-
- if (searchResult) {
- it->second = std::move(searchResult);
- } else {
- list.erase(it);
- }
- }
-
- return true;
- });
-
- searchData->setSearchResult(lastResult);
-}
-
void SearchEngine::deleteSearchData(SearchData *searchData)
{
for (auto &&list : m_History) {
typedef std::function<void(const char *)> ChangeCallback;
/**
+ * @return Search query text.
+ */
+ const char *getText() const;
+
+ /**
* @brief Set entry changed callback
*/
void setChangeCallback(ChangeCallback callback);
void ListView::onUpdateFinished()
{
elm_index_level_go(m_Index, 0);
+ if (m_IsSearching) {
+ elm_genlist_filter_set(m_Genlist->getEvasObject(), (void *) m_SearchField->getText());
+ }
}
bool ListView::isListEmpty()
void PersonSearchProvider::onUpdated(PersonSearchData &searchData, int changes)
{
- m_SearchEngine.updateSearchData(&searchData);
+ m_SearchEngine.deleteSearchData(&searchData);
+ m_SearchEngine.insertSearchData(&searchData);
searchData.onUpdated(changes);
}
using namespace Contacts::List;
+const char *SearchField::getText() const
+{
+ return m_Text.c_str();
+}
+
void SearchField::setChangeCallback(ChangeCallback callback)
{
m_OnChanged = std::move(callback);