diff --git a/applets/kicker/package/contents/ui/DashboardRepresentation.qml b/applets/kicker/package/contents/ui/DashboardRepresentation.qml --- a/applets/kicker/package/contents/ui/DashboardRepresentation.qml +++ b/applets/kicker/package/contents/ui/DashboardRepresentation.qml @@ -258,14 +258,16 @@ } } - PlasmaComponents.TextField { + TextEdit { id: searchField width: 0 height: 0 visible: false + persistentSelection: true + onTextChanged: { if (tabBar.activeTab == 0) { runnerModel.query = searchField.text; @@ -277,9 +279,12 @@ function clear() { text = ""; } + + onSelectionStartChanged: Qt.callLater(searchHeading.updateSelection) + onSelectionEndChanged: Qt.callLater(searchHeading.updateSelection) } - PlasmaExtras.Heading { + TextEdit { id: searchHeading anchors { @@ -289,16 +294,24 @@ y: (middleRow.anchors.topMargin / 2) - (smallScreen ? (height/10) : 0) font.pointSize: dummyHeading.font.pointSize * 1.5 - - elide: Text.ElideRight wrapMode: Text.NoWrap opacity: 1.0 - color: "white" + selectByMouse: false + cursorVisible: false - level: 1 + color: "white" text: searching ? i18n("Searching for '%1'", searchField.text) : i18n("Type to search.") + + function updateSelection() { + if (!searchField.selectedText) { + return; + } + + var delta = text.lastIndexOf(searchField.text, text.length - 2); + searchHeading.select(searchField.selectionStart + delta, searchField.selectionEnd + delta); + } } PlasmaComponents.ToolButton { diff --git a/applets/kicker/plugin/dashboardwindow.cpp b/applets/kicker/plugin/dashboardwindow.cpp --- a/applets/kicker/plugin/dashboardwindow.cpp +++ b/applets/kicker/plugin/dashboardwindow.cpp @@ -190,6 +190,10 @@ e->nativeScanCode(), e->nativeVirtualKey(), e->nativeModifiers(), e->text(), e->isAutoRepeat(), e->count()); QCoreApplication::postEvent(this, eventCopy); + + // We _need_ to do it twice to make sure the event ping-pong needed + // for delivery happens before we sap focus again. + QCoreApplication::processEvents(); QCoreApplication::processEvents(); if (previousFocusItem) {