Commit f2c11f14 authored by Nate Graham's avatar Nate Graham
Browse files

[applets/kickoff] Add a visible configure button

This allows the new Kickoff's configuration window to be opened without
having to right-click, increasing usability for touch and for people who
aren't in the habit of right-clicking everything.

Many other applets have visible configure buttons now. Kickoff never did
in the past, but this redesign gives us a perfect place to put it.
parent d7910423
......@@ -481,7 +481,7 @@ Item {
// On back tab focus on right pane
if (event.key == Qt.Key_Backtab) {
if (mainTabGroup.state == "top") {
header.input.forceActiveFocus(Qt.TabFocusReason)
header.configureButton.forceActiveFocus(Qt.TabFocusReason)
} else {
navigationMethod.state = "keyboard"
keyboardNavigation.state = "RightColumn"
......@@ -690,7 +690,7 @@ Item {
if (root.currentContentView.activeFocus) {
// There's no left panel when we search
if (root.state == "Search") {
header.input.forceActiveFocus(Qt.BacktabFocusReason)
header.configureButton.forceActiveFocus(Qt.BacktabFocusReason)
} else {
keyboardNavigation.state = "LeftColumn"
}
......@@ -700,7 +700,7 @@ Item {
if (mainTabGroup.state == "top" && root.state != "Search") {
leaveButtons.leave.forceActiveFocus(Qt.TabFocusReason)
} else {
header.input.forceActiveFocus(Qt.BacktabFocusReason)
header.configureButton.forceActiveFocus(Qt.BacktabFocusReason)
}
event.accepted = true;
return;
......
......@@ -38,6 +38,7 @@ PlasmaExtras.PlasmoidHeading {
property alias query: queryField.text
property Item input: queryField
property Item configureButton: configureButton
property Item avatar: avatarButton
KCoreAddons.KUser {
......@@ -162,46 +163,67 @@ PlasmaExtras.PlasmoidHeading {
}
}
PlasmaComponents.TextField {
id: queryField
RowLayout {
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: PlasmaCore.Units.gridUnit - PlasmaCore.Units.devicePixelRatio //separator width
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: Math.round(parent.width/3) + PlasmaCore.Units.gridUnit + header.leftInset
placeholderText: i18n("Search...")
clearButtonShown: true
spacing: PlasmaCore.Units.gridUnit
Accessible.editable: true
Accessible.searchEdit: true
PlasmaComponents.TextField {
id: queryField
Keys.onPressed: {
// On tab focus on left pane (or search when searching)
if (event.key == Qt.Key_Tab) {
navigationMethod.state = "keyboard"
// There's no left panel when we search
if (root.state == "Search") {
keyboardNavigation.state = "RightColumn"
root.currentContentView.forceActiveFocus()
} else if (mainTabGroup.state == "top") {
applicationButton.forceActiveFocus(Qt.TabFocusReason)
} else {
keyboardNavigation.state = "LeftColumn"
root.currentView.forceActiveFocus()
Layout.fillWidth: true
placeholderText: i18n("Search...")
clearButtonShown: true
Accessible.editable: true
Accessible.searchEdit: true
onTextChanged: {
if (root.state != "Search") {
root.previousState = root.state;
root.state = "Search";
}
if (text == "") {
root.state = root.previousState;
}
event.accepted = true;
return;
}
}
onTextChanged: {
if (root.state != "Search") {
root.previousState = root.state;
root.state = "Search";
PlasmaComponents.ToolButton {
id: configureButton
visible: plasmoid.action("configure").enabled
icon.name: "configure"
Accessible.name: plasmoid.action("configure").text
onClicked: plasmoid.action("configure").trigger()
PlasmaComponents.ToolTip {
text: plasmoid.action("configure").text
}
if (text == "") {
root.state = root.previousState;
Keys.onPressed: {
// On tab focus on left pane (or search when searching)
if (event.key == Qt.Key_Tab) {
navigationMethod.state = "keyboard"
// There's no left panel when we search
if (root.state == "Search") {
keyboardNavigation.state = "RightColumn"
root.currentContentView.forceActiveFocus()
} else if (mainTabGroup.state == "top") {
applicationButton.forceActiveFocus(Qt.TabFocusReason)
} else {
keyboardNavigation.state = "LeftColumn"
root.currentView.forceActiveFocus()
}
event.accepted = true;
return;
}
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment