2023-11-29 16:13:50 +08:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.5
|
|
|
|
import org.ukui.menu.core 1.0
|
2024-01-04 11:13:41 +08:00
|
|
|
import org.ukui.quick.platform 1.0 as Platform
|
2023-12-11 16:13:53 +08:00
|
|
|
import org.ukui.quick.items 1.0 as UkuiItems
|
2023-11-29 16:13:50 +08:00
|
|
|
import org.ukui.menu.utils 1.0
|
|
|
|
|
|
|
|
Item {
|
2024-01-09 10:08:53 +08:00
|
|
|
id: root
|
|
|
|
property AppPageBackend backend: null
|
2023-11-29 16:13:50 +08:00
|
|
|
property Item focusToPageContent
|
|
|
|
property bool inputStatus: false
|
2024-01-09 10:08:53 +08:00
|
|
|
|
2023-11-29 16:13:50 +08:00
|
|
|
SearchInputBar {
|
|
|
|
id: searchInputBar
|
|
|
|
property string providerId: "search"
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.leftMargin: 16
|
|
|
|
anchors.rightMargin: 16
|
2024-01-04 11:13:41 +08:00
|
|
|
radius: Platform.Theme.normalRadius
|
2023-11-29 16:13:50 +08:00
|
|
|
changeFocusTarget: focusToPageContent
|
|
|
|
visible: true
|
|
|
|
onTextChanged: {
|
|
|
|
if (text === "") {
|
2024-01-09 10:08:53 +08:00
|
|
|
root.backend.group = PluginGroup.Display;
|
2023-11-29 16:13:50 +08:00
|
|
|
inputStatus = false;
|
|
|
|
} else {
|
2024-01-09 10:08:53 +08:00
|
|
|
root.backend.group = PluginGroup.Search;
|
|
|
|
// appPageHeaderUtils.startSearch(text);
|
|
|
|
root.backend.startSearch(text);
|
2023-11-29 16:13:50 +08:00
|
|
|
inputStatus = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-01-09 10:08:53 +08:00
|
|
|
|
2023-11-29 16:13:50 +08:00
|
|
|
function changeToSearch(keyEvent) {
|
|
|
|
if (header.content === null) {
|
|
|
|
searchInputBar.text = keyEvent;
|
|
|
|
searchInputBar.textInputFocus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|