mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
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 02eab49b2d
)
This commit is contained in:
parent
88c3bd1866
commit
bd26bf2a20
2 changed files with 4 additions and 4 deletions
|
@ -41,8 +41,8 @@ void KItemListKeyboardSearchManager::addKeys(const QString& keys)
|
||||||
{
|
{
|
||||||
const bool keyboardTimeWasValid = m_keyboardInputTime.isValid();
|
const bool keyboardTimeWasValid = m_keyboardInputTime.isValid();
|
||||||
const qint64 keyboardInputTimeElapsed = m_keyboardInputTime.restart();
|
const qint64 keyboardInputTimeElapsed = m_keyboardInputTime.restart();
|
||||||
if (keyboardInputTimeElapsed > QApplication::keyboardInputInterval()
|
const qint64 timeout = 5000;
|
||||||
|| !keyboardTimeWasValid || keys.isEmpty()) {
|
if (keyboardInputTimeElapsed > timeout || !keyboardTimeWasValid || keys.isEmpty()) {
|
||||||
m_searchedString.clear();
|
m_searchedString.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,9 +75,9 @@ void KItemListKeyboardSearchManagerTest::testAbortedKeyboardSearch()
|
||||||
QCOMPARE(spy.count(), 1);
|
QCOMPARE(spy.count(), 1);
|
||||||
QCOMPARE(spy.takeFirst(), QList<QVariant>() << "fi" << false);
|
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.
|
// 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");
|
m_keyboardSearchManager.addKeys("l");
|
||||||
QCOMPARE(spy.count(), 1);
|
QCOMPARE(spy.count(), 1);
|
||||||
|
|
Loading…
Reference in a new issue