diff --git a/applets/kickoff/package/contents/ui/FullRepresentation.qml b/applets/kickoff/package/contents/ui/FullRepresentation.qml --- a/applets/kickoff/package/contents/ui/FullRepresentation.qml +++ b/applets/kickoff/package/contents/ui/FullRepresentation.qml @@ -43,10 +43,13 @@ property QtObject globalFavorites: rootModelFavorites state: "Normal" - focus: true + + onFocusChanged: { + header.input.forceActiveFocus(); + } function switchToInitial() { - if(firstButton != null) { + if (firstButton != null) { mainTabGroup.currentTab = firstButton.tab; tabBar.currentTab = firstButton; header.query = "" @@ -400,16 +403,16 @@ } } - onCurrentTabChanged: root.forceActiveFocus(); + onCurrentTabChanged: header.input.forceActiveFocus(); Connections { target: plasmoid onExpandedChanged: { if(menuItemsChanged()) { createButtons(); } if (!expanded) { - switchToInitial() + switchToInitial(); } } } @@ -437,7 +440,7 @@ break; } case Qt.Key_Left: { - if (header.input.focus) { + if (header.input.focus && header.state == "query") { break; } if (!currentView.deactivateCurrentIndex()) { @@ -451,7 +454,7 @@ break; } case Qt.Key_Right: { - if (header.input.focus) { + if (header.input.focus && header.state == "query") { break; } currentView.activateCurrentIndex(); @@ -473,7 +476,7 @@ if (header.state != "query") { plasmoid.expanded = false; } else { - switchToInitial(); + header.query = ""; } event.accepted = true; break; @@ -483,28 +486,10 @@ event.accepted = true; break; } - - default: { // forward key to searchView - //header.query += event.text will break if the key is backspace, - //since if the user continues to type, it will produce an invalid query, - //having backspace as the first character - if (event.key == Qt.Key_Backspace && header.query == "") { - return; - } - if (event.text != "" && !header.input.focus) { - root.currentView.listView.currentIndex = -1; - - if (event.matches(StandardKey.Paste) ) { - header.input.paste(); - } else if (! (event.key & Qt.Key_Escape)) { - //if special key, do nothing. Qt.Escape is 0x10000000 which happens to be a mask used for all special keys in Qt. - header.query = ""; - header.query += event.text; - } + default: + if (!header.input.focus) { header.input.forceActiveFocus(); - event.accepted = true; } - } } } @@ -541,6 +526,10 @@ target: mainTabGroup currentTab: searchPage } + PropertyChanges { + target: root + Keys.forwardTo: [root] + } } ] // states diff --git a/applets/kickoff/package/contents/ui/Header.qml b/applets/kickoff/package/contents/ui/Header.qml --- a/applets/kickoff/package/contents/ui/Header.qml +++ b/applets/kickoff/package/contents/ui/Header.qml @@ -177,7 +177,6 @@ } if (text == "") { root.state = root.previousState; - root.forceActiveFocus(); header.state = "info"; } else { header.state = "query";