diff options
| author | Frank Reininghaus <[email protected]> | 2012-03-28 19:15:20 +0200 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2012-03-28 19:22:12 +0200 |
| commit | bd26bf2a20fba80c33ad1e8438592bddc4bea4aa (patch) | |
| tree | 43eff6cf6825fe86b167c9e97a854ed507331522 /src | |
| parent | 88c3bd18663c8ceaf418e4b6d247ba6bd83e47ff (diff) | |
Increase the timeout in KItemListKeyboardSearchManager to 5 seconds
The previous timeout [QApplication::keyboardInputInterval()] was too
short to do a multi-letter search for users who do not type extremely
fast.
(cherry picked from commit 02eab49b2de51c31fe46a0d9501327b579b3648e)
Diffstat (limited to 'src')
| -rw-r--r-- | src/kitemviews/kitemlistkeyboardsearchmanager.cpp | 4 | ||||
| -rw-r--r-- | src/tests/kitemlistkeyboardsearchmanagertest.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/kitemviews/kitemlistkeyboardsearchmanager.cpp b/src/kitemviews/kitemlistkeyboardsearchmanager.cpp index cefedfc2c..1ff60d09c 100644 --- a/src/kitemviews/kitemlistkeyboardsearchmanager.cpp +++ b/src/kitemviews/kitemlistkeyboardsearchmanager.cpp @@ -41,8 +41,8 @@ void KItemListKeyboardSearchManager::addKeys(const QString& keys) { const bool keyboardTimeWasValid = m_keyboardInputTime.isValid(); const qint64 keyboardInputTimeElapsed = m_keyboardInputTime.restart(); - if (keyboardInputTimeElapsed > QApplication::keyboardInputInterval() - || !keyboardTimeWasValid || keys.isEmpty()) { + const qint64 timeout = 5000; + if (keyboardInputTimeElapsed > timeout || !keyboardTimeWasValid || keys.isEmpty()) { m_searchedString.clear(); } diff --git a/src/tests/kitemlistkeyboardsearchmanagertest.cpp b/src/tests/kitemlistkeyboardsearchmanagertest.cpp index be483930d..14a09a31c 100644 --- a/src/tests/kitemlistkeyboardsearchmanagertest.cpp +++ b/src/tests/kitemlistkeyboardsearchmanagertest.cpp @@ -75,9 +75,9 @@ void KItemListKeyboardSearchManagerTest::testAbortedKeyboardSearch() QCOMPARE(spy.count(), 1); QCOMPARE(spy.takeFirst(), QList<QVariant>() << "fi" << false); - // If the delay between two key presses is larger than QApplication::keyboardInputInterval(), + // If the delay between two key presses is larger than 5000 milliseconds, // a new search is started. We add a small safety margin to avoid race conditions. - QTest::qWait(QApplication::keyboardInputInterval() + 10); + QTest::qWait(5000 + 10); m_keyboardSearchManager.addKeys("l"); QCOMPARE(spy.count(), 1); |
