@ -15,7 +15,7 @@
* along with this program . If not , see < http: / / w w w . g n u . o r g / l i c e n s e s / > .
* /
import QtQuick 2.0
import QtQuick 2.6
import QtQuick . Layouts 1.1
import QtQuick . Window 2.1
import org . kde . plasma . core 2.0 as PlasmaCore
@ -97,19 +97,26 @@ ColumnLayout {
Keys.onPressed: allowCompletion = ( event . key !== Qt . Key_Backspace && event . key !== Qt . Key_Delete )
Keys.onUpPressed: {
if ( length === 0 ) {
root . showHistory = true
root . showHistory = true ;
listView . forceActiveFocus ( ) ;
} else {
results . forceActiveFocus ( ) ;
}
}
Keys.onDownPressed: {
if ( length === 0 ) {
root . showHistory = true
root . showHistory = true ;
listView . forceActiveFocus ( ) ;
} else {
results . forceActiveFocus ( ) ;
}
}
Keys.onEnterPressed: results . runCurrentIndex ( )
Keys.onReturnPressed: results . runCurrentIndex ( )
Keys.onEscapePressed: {
runnerWindow . visible = false
}
Keys.forwardTo: [ listView , results ]
}
PlasmaComponents . ToolButton {
iconSource: "window-close"
@ -131,6 +138,13 @@ ColumnLayout {
queryString: root . query
runner: root . runner
Keys.onPressed: {
if ( event . text != "" ) {
queryField . text += event . text ;
queryField . focus = true ;
}
}
onActivated: {
runnerWindow . addToHistory ( queryString )
runnerWindow . visible = false
@ -156,6 +170,7 @@ ColumnLayout {
keyNavigationWraps: true
highlight: PlasmaComponents . Highlight { }
highlightMoveDuration: 0
activeFocusOnTab: true
/ / w e s t o r e 5 0 e n t r i e s i n t h e h i s t o r y b u t o n l y s h o w 2 0 i n t h e U I s o i t d o e s n ' t g e t t o o h u g e
model: root . showHistory ? runnerWindow . history . slice ( 0 , 20 ) : [ ]
delegate: Milou . ResultDelegate {
@ -166,13 +181,38 @@ ColumnLayout {
icon: "list-remove" ,
text: i18nd ( "plasma_lookandfeel_org.kde.lookandfeel" , "Remove" )
} ]
Accessible.description: i18n ( "in category recent queries" )
}
onActiveFocusChanged: {
if ( ! activeFocus && currentIndex == listView . count - 1 ) {
currentIndex = 0 ;
}
}
Keys.onReturnPressed: runCurrentIndex ( )
Keys.onEnterPressed: runCurrentIndex ( )
Keys.onTabPressed: incrementCurrentIndex ( )
Keys.onBacktabPressed: decrementCurrentIndex ( )
Keys.onTabPressed: {
if ( currentIndex == listView . count - 1 ) {
listView . nextItemInFocusChain ( true ) . forceActiveFocus ( ) ;
} else {
incrementCurrentIndex ( )
}
}
Keys.onBacktabPressed: {
if ( currentIndex == 0 ) {
listView . nextItemInFocusChain ( false ) . forceActiveFocus ( ) ;
} else {
decrementCurrentIndex ( )
}
}
Keys.onPressed: {
if ( event . text != "" ) {
queryField . text += event . text ;
queryField . focus = true ;
}
}
Keys.onUpPressed: decrementCurrentIndex ( )
Keys.onDownPressed: incrementCurrentIndex ( )
@ -180,6 +220,7 @@ ColumnLayout {
var entry = runnerWindow . history [ currentIndex ]
if ( entry ) {
queryField . text = entry
queryField . forceActiveFocus ( ) ;
}
}