widgets/krunner: Restore milou

This commit is contained in:
Devin Lin 2023-03-18 19:23:37 -07:00
parent 6160280b0c
commit 3f309067ef
2 changed files with 110 additions and 103 deletions

View file

@ -15,7 +15,7 @@ import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras import org.kde.plasma.extras 2.0 as PlasmaExtras
// import org.kde.milou 0.1 as Milou import org.kde.milou 0.1 as Milou
import org.kde.kirigami 2.19 as Kirigami import org.kde.kirigami 2.19 as Kirigami
import "../../components" as Components import "../../components" as Components
@ -58,6 +58,9 @@ Item {
anim.to = closedContentY; anim.to = closedContentY;
anim.restart(); anim.restart();
} }
// emitted when an item on the ListView is triggered
signal actionTriggered()
readonly property real closedContentY: PlasmaCore.Units.gridUnit * 5 readonly property real closedContentY: PlasmaCore.Units.gridUnit * 5
readonly property real openedContentY: 0 readonly property real openedContentY: 0
@ -184,108 +187,110 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
// Milou.ResultsListView { Milou.ResultsListView {
// id: listView id: listView
// queryString: queryField.text queryString: queryField.text
// highlight: null highlight: null
// clip: true clip: true
// PlasmaCore.ColorScope.colorGroup: PlasmaCore.Theme.NormalColorGroup PlasmaCore.ColorScope.colorGroup: PlasmaCore.Theme.NormalColorGroup
//
// onActivated: queryField.text = ""; onActivated: queryField.text = "";
// onUpdateQueryString: { onUpdateQueryString: {
// queryField.text = text queryField.text = text
// queryField.cursorPosition = cursorPosition queryField.cursorPosition = cursorPosition
// } }
//
// delegate: MouseArea { delegate: MouseArea {
// id: delegate id: delegate
// height: rowLayout.height height: rowLayout.height
// width: listView.width width: listView.width
//
// onClicked: { onClicked: {
// listView.currentIndex = model.index; listView.currentIndex = model.index;
// listView.runCurrentIndex(); listView.runCurrentIndex();
// }
// hoverEnabled: true root.actionTriggered();
// }
// Rectangle { hoverEnabled: true
// anchors.fill: parent
// color: delegate.pressed ? Qt.rgba(255, 255, 255, 0.2) : (delegate.containsMouse ? Qt.rgba(255, 255, 255, 0.05) : "transparent") Rectangle {
// Behavior on color { anchors.fill: parent
// ColorAnimation { duration: PlasmaCore.Units.shortDuration } color: delegate.pressed ? Qt.rgba(255, 255, 255, 0.2) : (delegate.containsMouse ? Qt.rgba(255, 255, 255, 0.05) : "transparent")
// } Behavior on color {
// } ColorAnimation { duration: PlasmaCore.Units.shortDuration }
// }
// RowLayout { }
// id: rowLayout
// height: PlasmaCore.Units.gridUnit * 3 RowLayout {
// anchors.top: parent.top id: rowLayout
// anchors.left: parent.left height: PlasmaCore.Units.gridUnit * 3
// anchors.right: parent.right anchors.top: parent.top
// anchors.leftMargin: PlasmaCore.Units.largeSpacing anchors.left: parent.left
// anchors.rightMargin: PlasmaCore.Units.largeSpacing anchors.right: parent.right
// anchors.leftMargin: PlasmaCore.Units.largeSpacing
// Kirigami.Icon { anchors.rightMargin: PlasmaCore.Units.largeSpacing
// Layout.alignment: Qt.AlignVCenter
// source: model.decoration Kirigami.Icon {
// implicitWidth: PlasmaCore.Units.iconSizes.medium Layout.alignment: Qt.AlignVCenter
// implicitHeight: PlasmaCore.Units.iconSizes.medium source: model.decoration
// } implicitWidth: PlasmaCore.Units.iconSizes.medium
// implicitHeight: PlasmaCore.Units.iconSizes.medium
// ColumnLayout { }
// Layout.fillWidth: true
// Layout.alignment: Qt.AlignVCenter ColumnLayout {
// spacing: PlasmaCore.Units.smallSpacing Layout.fillWidth: true
// Layout.alignment: Qt.AlignVCenter
// PlasmaComponents.Label { spacing: PlasmaCore.Units.smallSpacing
// id: title
// Layout.fillWidth: true PlasmaComponents.Label {
// Layout.leftMargin: PlasmaCore.Units.smallSpacing * 2 id: title
// Layout.rightMargin: PlasmaCore.Units.largeSpacing Layout.fillWidth: true
// Layout.leftMargin: PlasmaCore.Units.smallSpacing * 2
// maximumLineCount: 1 Layout.rightMargin: PlasmaCore.Units.largeSpacing
// elide: Text.ElideRight
// text: typeof modelData !== "undefined" ? modelData : model.display maximumLineCount: 1
// color: "white" elide: Text.ElideRight
// text: typeof modelData !== "undefined" ? modelData : model.display
// font.pointSize: PlasmaCore.Theme.defaultFont.pointSize color: "white"
// }
// PlasmaComponents.Label { font.pointSize: PlasmaCore.Theme.defaultFont.pointSize
// id: subtitle }
// Layout.fillWidth: true PlasmaComponents.Label {
// Layout.leftMargin: PlasmaCore.Units.smallSpacing * 2 id: subtitle
// Layout.rightMargin: PlasmaCore.Units.largeSpacing Layout.fillWidth: true
// Layout.leftMargin: PlasmaCore.Units.smallSpacing * 2
// maximumLineCount: 1 Layout.rightMargin: PlasmaCore.Units.largeSpacing
// elide: Text.ElideRight
// text: model.subtext || "" maximumLineCount: 1
// color: "white" elide: Text.ElideRight
// opacity: 0.8 text: model.subtext || ""
// color: "white"
// font.pointSize: Math.round(PlasmaCore.Theme.defaultFont.pointSize * 0.8) opacity: 0.8
// }
// } font.pointSize: Math.round(PlasmaCore.Theme.defaultFont.pointSize * 0.8)
// }
// Repeater { }
// id: actionsRepeater
// model: typeof actions !== "undefined" ? actions : [] Repeater {
// id: actionsRepeater
// Controls.ToolButton { model: typeof actions !== "undefined" ? actions : []
// icon: modelData.icon || ""
// visible: modelData.visible || true Controls.ToolButton {
// enabled: modelData.enabled || true icon: modelData.icon || ""
// visible: modelData.visible || true
// Accessible.role: Accessible.Button enabled: modelData.enabled || true
// Accessible.name: modelData.text
// checkable: checked Accessible.role: Accessible.Button
// checked: delegate.activeAction === index Accessible.name: modelData.text
// focus: delegate.activeAction === index checkable: checked
// onClicked: delegate.ListView.view.runAction(index) checked: delegate.activeAction === index
// } focus: delegate.activeAction === index
// } onClicked: delegate.ListView.view.runAction(index)
// } }
// } }
// } }
}
}
} }
MouseArea { MouseArea {

View file

@ -89,6 +89,8 @@ MobileShell.HomeScreen {
id: search id: search
anchors.fill: parent anchors.fill: parent
visible: openFactor > 0 visible: openFactor > 0
onActionTriggered: search.close()
topMargin: root.topMargin topMargin: root.topMargin
bottomMargin: root.bottomMargin bottomMargin: root.bottomMargin