summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Reininghaus <frank78ac@googlemail.com>2012-04-25 06:51:38 (GMT)
committerFrank Reininghaus <frank78ac@googlemail.com>2012-04-25 06:51:38 (GMT)
commitd3b1312d3edc615b03fb17c1a5fa62ccb61cdabd (patch)
tree4fb7a9084ea0f08ed821887c330e3d5e8f5a1991
parent73989d64f489e43e7777eb30aafe73f3ea165845 (diff)
When Esc is pressed, clear the selection and cancel the keyboard search
This patch restores the Dolphin 1.x behaviour that Esc clears the selection (Dolphin 2.0 did not have an easy way to clear the selection using the keyboard so far). Moreover, Esc now also cancels the current keyboard search. This fixes the problem that the only way to cancel the search is to wait until the timeout has expired. BUG: 298742 CCBUG: 297458 FIXED-IN: 4.8.3
-rw-r--r--dolphin/src/kitemviews/kitemlistcontroller.cpp7
-rw-r--r--dolphin/src/kitemviews/kitemlistkeyboardsearchmanager.cpp6
-rw-r--r--dolphin/src/kitemviews/kitemlistkeyboardsearchmanager_p.h2
3 files changed, 13 insertions, 2 deletions
diff --git a/dolphin/src/kitemviews/kitemlistcontroller.cpp b/dolphin/src/kitemviews/kitemlistcontroller.cpp
index 79a6ecf..3dfb530 100644
--- a/dolphin/src/kitemviews/kitemlistcontroller.cpp
+++ b/dolphin/src/kitemviews/kitemlistcontroller.cpp
@@ -358,6 +358,13 @@ bool KItemListController::keyPressEvent(QKeyEvent* event)
break;
}
+ case Qt::Key_Escape:
+ if (m_selectionBehavior != SingleSelection) {
+ m_selectionManager->clearSelection();
+ }
+ m_keyboardManager->cancelSearch();
+ break;
+
default:
m_keyboardManager->addKeys(event->text());
return false;
diff --git a/dolphin/src/kitemviews/kitemlistkeyboardsearchmanager.cpp b/dolphin/src/kitemviews/kitemlistkeyboardsearchmanager.cpp
index 592605a..a11c61b 100644
--- a/dolphin/src/kitemviews/kitemlistkeyboardsearchmanager.cpp
+++ b/dolphin/src/kitemviews/kitemlistkeyboardsearchmanager.cpp
@@ -25,8 +25,6 @@
#include <QApplication>
#include <QElapsedTimer>
-#include <KDebug>
-
KItemListKeyboardSearchManager::KItemListKeyboardSearchManager(QObject* parent) :
QObject(parent),
m_timeout(1000)
@@ -76,3 +74,7 @@ qint64 KItemListKeyboardSearchManager::timeout() const
return m_timeout;
}
+void KItemListKeyboardSearchManager::cancelSearch()
+{
+ m_searchedString.clear();
+}
diff --git a/dolphin/src/kitemviews/kitemlistkeyboardsearchmanager_p.h b/dolphin/src/kitemviews/kitemlistkeyboardsearchmanager_p.h
index d6a6686..3f13ff4 100644
--- a/dolphin/src/kitemviews/kitemlistkeyboardsearchmanager_p.h
+++ b/dolphin/src/kitemviews/kitemlistkeyboardsearchmanager_p.h
@@ -58,6 +58,8 @@ public:
void setTimeout(qint64 milliseconds);
qint64 timeout() const;
+ void cancelSearch();
+
signals:
/**
* Is emitted if the current item should be changed corresponding