From aced85db1f7c72268860f0368402cf97f34e55c2 Mon Sep 17 00:00:00 2001 From: Frank Reininghaus Date: Thu, 29 Mar 2012 19:56:53 +0200 Subject: KItemListKeyboardSearchManager: make it possible to choose the timeout It's now possible to change the timeout, after which any call of KItemListKeyboardSearchManager::addKeys(const QString&) starts a new search, from the default value of 5000 milliseconds. This is not used in Dolphin at the moment, but it permits to reduce the timeout to a small value in the unit test. Before this change, the unit test took more than 5 seconds to complete. (cherry picked from commit 82fc1b54bd01768f50aba7d328cdcde7de1483d7) --- src/kitemviews/kitemlistkeyboardsearchmanager_p.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/kitemviews/kitemlistkeyboardsearchmanager_p.h') diff --git a/src/kitemviews/kitemlistkeyboardsearchmanager_p.h b/src/kitemviews/kitemlistkeyboardsearchmanager_p.h index 05de76a8c..d6a6686db 100644 --- a/src/kitemviews/kitemlistkeyboardsearchmanager_p.h +++ b/src/kitemviews/kitemlistkeyboardsearchmanager_p.h @@ -49,6 +49,15 @@ public: */ void addKeys(const QString& keys); + /** + * Sets the delay after which the search is cancelled to \a milliseconds. + * If the time interval between two calls of addKeys(const QString&) is + * larger than this, the second call will start a new search, rather than + * combining the keys received from both calls to a single search string. + */ + void setTimeout(qint64 milliseconds); + qint64 timeout() const; + signals: /** * Is emitted if the current item should be changed corresponding @@ -64,6 +73,7 @@ signals: private: QString m_searchedString; QElapsedTimer m_keyboardInputTime; + qint64 m_timeout; }; #endif -- cgit v1.3