@ -37,6 +37,7 @@ ColumnLayout {
onVisibleChanged: {
if ( runnerWindow . visible ) {
queryField . forceActiveFocus ( ) ;
listView . currentIndex = - 1
} else {
root . query = "" ;
}
@ -58,13 +59,16 @@ ColumnLayout {
id: queryField
clearButtonShown: true
Layout.minimumWidth: units . gridUnit * 25
activeFocusOnPress: true
onTextChanged: {
root . query = queryField . text
}
Keys.onEscapePressed: {
runnerWindow . visible = false
}
Keys.forwardTo: results
Keys.forwardTo: [ listView , results ]
}
PlasmaComponents . ToolButton {
iconSource: "window-close"
@ -77,6 +81,7 @@ ColumnLayout {
PlasmaExtras . ScrollArea {
Layout.alignment: Qt . AlignTop
visible: results . count > 0
enabled: visible
Layout.fillWidth: true
Layout.preferredHeight: Math . min ( Screen . height , results . contentHeight )
@ -86,6 +91,7 @@ ColumnLayout {
runner: root . runner
onActivated: {
runnerWindow . addToHistory ( queryString )
runnerWindow . visible = false
}
@ -95,4 +101,39 @@ ColumnLayout {
}
}
}
PlasmaExtras . ScrollArea {
Layout.alignment: Qt . AlignTop
Layout.fillWidth: true
visible: root . query . length === 0 && listView . count > 0
/ / d o n ' t a c c e p t k e y b o a r d i n p u t w h e n n o t v i s i b l e s o t h e k e y s p r o p a g a t e t o t h e o t h e r l i s t
enabled: visible
Layout.preferredHeight: Math . min ( Screen . height , listView . contentHeight )
ListView {
id: listView / / n e e d s t h i s i d s o t h e d e l e g a t e c a n a c c e s s i t
keyNavigationWraps: true
highlight: PlasmaComponents . Highlight { }
highlightMoveDuration: 0
model: runnerWindow . history
delegate: Milou . ResultDelegate {
id: resultDelegate
width: listView . width
typeText: index === 0 ? i18nd ( "plasma_lookandfeel_org.kde.lookandfeel" , "Recent Queries" ) : ""
}
Keys.onReturnPressed: runCurrentIndex ( )
Keys.onEnterPressed: runCurrentIndex ( )
Keys.onTabPressed: incrementCurrentIndex ( )
Keys.onBacktabPressed: decrementCurrentIndex ( )
Keys.onUpPressed: decrementCurrentIndex ( )
Keys.onDownPressed: incrementCurrentIndex ( )
function runCurrentIndex ( ) {
queryField . text = runnerWindow . history [ currentIndex ]
}
}
}
}