Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 04dff1e0 authored by Oleg Solovyov's avatar Oleg Solovyov Committed by Albert Astals Cid

Allow dictionary runner to search multiple times

Summary: Any time we search a word definition we add a source to our match engine but we never remove it.

Test Plan:
1) Open krunner
2) Search a word definition
3) Close krunner
4) Open krunner
5) Search the same word definition one more time
Expected result: the definition appears again
Actual result: there are no definitions shown.

Reviewers: jriddell, broulik, #plasma, mart

Reviewed By: #plasma, mart

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D16038
parent 5fb5ce7f
......@@ -43,6 +43,7 @@ QString DictionaryMatchEngine::lookupWord(const QString &word)
qDebug() << "The dictionary data engine timed out (word:" << word << ")";
locker.unlock();
QMetaObject::invokeMethod(this, "sourceRemoved", Qt::QueuedConnection, Q_ARG(const QString&, word));
// after a timeout, if dataUpdated gets m_wordLock here, it can lock data->mutex successfully.
m_wordLock.lockForWrite();
......@@ -60,6 +61,11 @@ void DictionaryMatchEngine::sourceAdded(const QString &source)
m_dictionaryEngine->connectSource(source, this);
}
void DictionaryMatchEngine::sourceRemoved(const QString &source)
{
m_dictionaryEngine->disconnectSource(source, this);
}
void DictionaryMatchEngine::dataUpdated(const QString &source, const Plasma::DataEngine::Data &result)
{
if (!result.contains(QLatin1String("text")))
......
......@@ -37,6 +37,7 @@ private:
private Q_SLOTS:
void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data);
void sourceAdded(const QString &source);
void sourceRemoved(const QString &source);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment