76 lines
2.2 KiB
Diff
76 lines
2.2 KiB
Diff
From fb13d539581ac69d84548097c2d6c6e7669fe57a Mon Sep 17 00:00:00 2001
|
|
From: Fabian Vogt <fabian@ritter-vogt.de>
|
|
Date: Wed, 5 Jun 2019 16:49:54 +0200
|
|
Subject: [PATCH] Don't give up if no results arrive after 500ms
|
|
|
|
Summary:
|
|
Currently it resets the entire context if no results appear after 500ms,
|
|
which means no new results can appear. This makes no sense.
|
|
|
|
RunnerManager does not emit any matchChanged signal while the runners update
|
|
the matches too quickly. The way this delay is implemented can result in never
|
|
actually emitting the signal until all runners are done though.
|
|
Thus it's actually likely to hit this situation.
|
|
|
|
BUG: 389611
|
|
|
|
Test Plan:
|
|
Test results appear now, even if the first batch of runners is slow.
|
|
List of matches still clears if nothing was found.
|
|
|
|
Reviewers: #plasma
|
|
|
|
Subscribers: plasma-devel
|
|
|
|
Tags: #plasma
|
|
|
|
Differential Revision: https://phabricator.kde.org/D21605
|
|
---
|
|
lib/sourcesmodel.cpp | 8 ++++++--
|
|
lib/sourcesmodel.h | 3 +++
|
|
2 files changed, 9 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/lib/sourcesmodel.cpp b/lib/sourcesmodel.cpp
|
|
index d8b068f..cf4e893 100644
|
|
--- a/lib/sourcesmodel.cpp
|
|
+++ b/lib/sourcesmodel.cpp
|
|
@@ -237,7 +237,12 @@ void SourcesModel::setQueryString(const QString& str)
|
|
void SourcesModel::slotResetTimeout()
|
|
{
|
|
if (!m_modelPopulated) {
|
|
- clear();
|
|
+ // The old items are still shown, get rid of them
|
|
+ beginResetModel();
|
|
+ m_matches.clear();
|
|
+ m_size = 0;
|
|
+ m_duplicates.clear();
|
|
+ endResetModel();
|
|
}
|
|
}
|
|
|
|
@@ -313,7 +318,6 @@ void SourcesModel::slotMatchAdded(const Plasma::QueryMatch& m)
|
|
return;
|
|
|
|
QString matchType = m.matchCategory();
|
|
-
|
|
if (!m_types.contains(matchType)) {
|
|
m_types << matchType;
|
|
}
|
|
diff --git a/lib/sourcesmodel.h b/lib/sourcesmodel.h
|
|
index 652f713..5c8e4da 100644
|
|
--- a/lib/sourcesmodel.h
|
|
+++ b/lib/sourcesmodel.h
|
|
@@ -88,6 +88,9 @@ public slots:
|
|
void reloadConfiguration();
|
|
void setQueryString(const QString& str);
|
|
void setQueryLimit(int limit);
|
|
+ /**
|
|
+ * Clears the model content and resets the runner context, i.e. no new items will appear.
|
|
+ */
|
|
void clear();
|
|
|
|
bool run(int index);
|
|
--
|
|
2.21.0
|
|
|