File 0011-Fix-crash-when-wrapping-around-the-leftmost-list-sea.patch of Package plasma5-desktop.openSUSE_13.2_Update

From c4b1a24ab103b75fc830107781d32df6bc741644 Mon Sep 17 00:00:00 2001
From: Eike Hein <hein@kde.org>
Date: Thu, 2 Apr 2015 19:48:08 +0200
Subject: [PATCH 11/11] Fix crash when wrapping around the leftmost list +
 search field sandwich by keyboard nav.

BUG:345785
---
 .../kicker/package/contents/ui/FullRepresentation.qml   | 15 ++++++++-------
 applets/kicker/package/contents/ui/ItemListView.qml     | 17 ++++++++++++++++-
 .../kicker/package/contents/ui/RunnerResultsList.qml    |  6 ++++++
 3 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/applets/kicker/package/contents/ui/FullRepresentation.qml b/applets/kicker/package/contents/ui/FullRepresentation.qml
index 254a03efbf7451a03f111ce037df60680441b5ef..124c2a895a23cfb5b1bc54fc15e387aa482a4d30 100644
--- a/applets/kicker/package/contents/ui/FullRepresentation.qml
+++ b/applets/kicker/package/contents/ui/FullRepresentation.qml
@@ -219,6 +219,10 @@ FocusScope {
 
             model: rootModel
 
+            onKeyNavigationAtListEnd: {
+                searchField.focus = true;
+            }
+
             states: [ State {
                 name: "top"
                 when: (plasmoid.location == PlasmaCore.Types.TopEdge)
@@ -230,9 +234,6 @@ FocusScope {
                 }
             }]
 
-            KeyNavigation.up: searchField
-            KeyNavigation.down: searchField
-
             Component.onCompleted: {
                 rootList.exited.connect(root.reset);
             }
@@ -255,6 +256,10 @@ FocusScope {
                 delegate: RunnerResultsList {
                     id: runnerMatches
 
+                    onKeyNavigationAtListEnd: {
+                        searchField.focus = true;
+                    }
+
                     onContainsMouseChanged: {
                         if (containsMouse) {
                             runnerMatches.focus = true;
@@ -304,10 +309,6 @@ FocusScope {
                     Component.onDestruction: {
                         runnerColumns.focusChanged.disconnect(focusChanged);
                     }
-
-
-                    KeyNavigation.up: (index == 0) ? searchField : null
-                    KeyNavigation.down: (index == 0) ? searchField : null
                 }
             }
         }
diff --git a/applets/kicker/package/contents/ui/ItemListView.qml b/applets/kicker/package/contents/ui/ItemListView.qml
index 427fe3dcd8f4de82764c235734c7527434def041..a5cdcdc3b4cdb856e002c5cc39a167187c726f32 100644
--- a/applets/kicker/package/contents/ui/ItemListView.qml
+++ b/applets/kicker/package/contents/ui/ItemListView.qml
@@ -31,6 +31,7 @@ FocusScope {
     height: listView.contentHeight
 
     signal exited
+    signal keyNavigationAtListEnd
     signal appendSearchText(string text)
 
     property Item focusParent: null
@@ -153,7 +154,7 @@ FocusScope {
 
                 onCurrentIndexChanged: {
                     if (currentIndex != -1) {
-                        itemList.focus = true;
+                        itemList.forceActiveFocus();
 
                         if (childDialog) {
                             if (currentItem && currentItem.hasChildren) {
@@ -187,11 +188,25 @@ FocusScope {
                 Keys.onPressed: {
                     if (event.key == Qt.Key_Up) {
                         event.accepted = true;
+
+                        if (!keyNavigationWraps && currentIndex == 0) {
+                            itemList.keyNavigationAtListEnd();
+
+                            return;
+                        }
+
                         showChildDialogs = false;
                         decrementCurrentIndex();
                         showChildDialogs = true;
                     } else if (event.key == Qt.Key_Down) {
                         event.accepted = true;
+
+                        if (!keyNavigationWraps && currentIndex == count - 1) {
+                            itemList.keyNavigationAtListEnd();
+
+                            return;
+                        }
+
                         showChildDialogs = false;
                         incrementCurrentIndex();
                         showChildDialogs = true;
diff --git a/applets/kicker/package/contents/ui/RunnerResultsList.qml b/applets/kicker/package/contents/ui/RunnerResultsList.qml
index 2f973f397518a206b7e8a599c835f69d141e40e1..33603f0e29e32456e57a7aa73f4a4884a858cd6f 100644
--- a/applets/kicker/package/contents/ui/RunnerResultsList.qml
+++ b/applets/kicker/package/contents/ui/RunnerResultsList.qml
@@ -27,6 +27,8 @@ FocusScope {
     width: rootList.width + vertLine.width + vertLine.anchors.leftMargin
     height: parent.height
 
+    signal keyNavigationAtListEnd
+
     property alias currentIndex: runnerMatches.currentIndex
     property alias containsMouse: runnerMatches.containsMouse
 
@@ -91,4 +93,8 @@ FocusScope {
             }
         }
     }
+
+    Component.onCompleted: {
+        runnerMatches.keyNavigationAtListEnd.connect(keyNavigationAtListEnd);
+    }
 }
-- 
2.3.4

openSUSE Build Service is sponsored by