mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-22 01:40:02 +00:00
Refactoring: add shouldClearSearchIfInputTimeReached to KItemListKeyboardSearchManager
This commit is contained in:
parent
beba31d34b
commit
e7de986202
|
@ -34,11 +34,16 @@ KItemListKeyboardSearchManager::~KItemListKeyboardSearchManager()
|
|||
{
|
||||
}
|
||||
|
||||
void KItemListKeyboardSearchManager::addKeys(const QString& keys)
|
||||
bool KItemListKeyboardSearchManager::shouldClearSearchIfInputTimeReached()
|
||||
{
|
||||
const bool keyboardTimeWasValid = m_keyboardInputTime.isValid();
|
||||
const qint64 keyboardInputTimeElapsed = m_keyboardInputTime.restart();
|
||||
if (keyboardInputTimeElapsed > m_timeout || !keyboardTimeWasValid) {
|
||||
return (keyboardInputTimeElapsed > m_timeout) || !keyboardTimeWasValid;
|
||||
}
|
||||
|
||||
void KItemListKeyboardSearchManager::addKeys(const QString& keys)
|
||||
{
|
||||
if (shouldClearSearchIfInputTimeReached()) {
|
||||
m_searchedString.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ public:
|
|||
qint64 timeout() const;
|
||||
|
||||
void cancelSearch();
|
||||
bool shouldClearSearchIfInputTimeReached();
|
||||
|
||||
public slots:
|
||||
|
||||
|
|
Loading…
Reference in a new issue