From 46a27ca937309d97153268cd11da8b9d75d3f1f4 Mon Sep 17 00:00:00 2001 From: Frank Reininghaus Date: Mon, 7 Oct 2013 09:08:55 +0200 Subject: Include "Space" in the keyboard search string Before this commit, we only added pressed keys to the search string if they have no other meaning. This means that files containing a Space in their name could not be searched because Ctrl+Space toggles the selection state of the current item, and Space alone selects the current item. After this commit, Space is added to the search string if (a) the key press did not have any other effect, i.e., if Ctrl was not pressed, and the current item is selected already, and (b) a keyboard search has been started already (to prevent unexpected effects when pressing Space accidentally - I think that it's rather uncommon to have files whose names start with a Space - and to make the unit test simpler). I modified the unit test of KItemListController, which did not test keyboard search yet. This uncovered a small problem in KItemListController::slotChangeCurrentItem() when NoSelection mode is used. It's not really relevant for anything that is executed inside Dolphin, but I still fixed it to make the unit test happy. BUG: 324479 FIXED-IN: 4.11.3 REVIEW: 113071 --- src/tests/kitemlistcontrollertest.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/tests') diff --git a/src/tests/kitemlistcontrollertest.cpp b/src/tests/kitemlistcontrollertest.cpp index d8f838873..60e93e539 100644 --- a/src/tests/kitemlistcontrollertest.cpp +++ b/src/tests/kitemlistcontrollertest.cpp @@ -98,7 +98,7 @@ void KItemListControllerTest::initTestCase() << "b1" << "c1" << "c2" << "c3" << "c4" << "c5" << "d1" << "d2" << "d3" << "d4" - << "e1" << "e2" << "e3" << "e4" << "e5" << "e6" << "e7"; + << "e" << "e 2" << "e 3" << "e 4" << "e 5" << "e 6" << "e 7"; m_testDir->createFiles(files); m_model->loadDirectory(m_testDir->url()); @@ -282,7 +282,14 @@ void KItemListControllerTest::testKeyboardNavigation_data() << qMakePair(KeyPress(Qt::Key_Home), ViewState(0, QSet() << 0)) << qMakePair(KeyPress(Qt::Key_Space, Qt::ControlModifier), ViewState(0, QSet())) << qMakePair(KeyPress(Qt::Key_Enter), ViewState(0, QSet(), true)) - << qMakePair(KeyPress(Qt::Key_Space, Qt::ControlModifier), ViewState(0, QSet() << 0)); + << qMakePair(KeyPress(Qt::Key_Space, Qt::ControlModifier), ViewState(0, QSet() << 0)) + << qMakePair(KeyPress(Qt::Key_Space, Qt::ControlModifier), ViewState(0, QSet())) + << qMakePair(KeyPress(Qt::Key_Space), ViewState(0, QSet() << 0)) + << qMakePair(KeyPress(Qt::Key_E), ViewState(13, QSet() << 13)) + << qMakePair(KeyPress(Qt::Key_Space), ViewState(14, QSet() << 14)) + << qMakePair(KeyPress(Qt::Key_3), ViewState(15, QSet() << 15)) + << qMakePair(KeyPress(Qt::Key_Home), ViewState(0, QSet() << 0)) + << qMakePair(KeyPress(Qt::Key_Escape), ViewState(0, QSet())); // Next, we test combinations of key presses which only work for a // particular number of columns and either enabled or disabled grouping. -- cgit v1.3