void SuggestionsSidebarBlock::UpdateSuggestionsForItem(CatalogItemPtr item) { if (!item) return; long long now = wxGetUTCTimeMillis().GetValue(); long long delta = now - m_lastUpdateTime; m_lastUpdateTime = now; if (delta < 100) { // User is probably holding arrow down and going through the list as crazy // and not really caring for the suggestions. Throttle them a bit and call // this code after a small delay. Notice that this may repeat itself several // times, only continuing through to show suggestions after the dust settled // and the user didn't change the selection for a few milliseconds. if (!m_suggestionsTimer.IsRunning()) m_suggestionsTimer.StartOnce(110); return; } m_pendingQueries = 0; auto srclang = m_parent->GetCurrentSourceLanguage(); auto lang = m_parent->GetCurrentLanguage(); if (!srclang.IsValid() || !lang.IsValid() || srclang == lang) { OnQueriesFinished(); return; } QueryAllProviders(item); }
void SuggestionsSidebarBlock::Update(CatalogItem *item) { // FIXME: Cancel previous pending async operation if any ClearMessage(); ClearSuggestions(); QueryAllProviders(item); }
void SuggestionsSidebarBlock::Update(const CatalogItemPtr& item) { // FIXME: Cancel previous pending async operation if any ClearMessage(); ClearSuggestions(); auto srclang = m_parent->GetCurrentSourceLanguage(); auto lang = m_parent->GetCurrentLanguage(); if (!srclang.IsValid() || !lang.IsValid() || srclang == lang) { OnQueriesFinished(); return; } QueryAllProviders(item); }