mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 07:52:50 -05:00
Remove loader from Spotlight chain
This commit is contained in:
@@ -12,6 +12,7 @@ PanelWindow {
|
|||||||
|
|
||||||
property alias content: contentLoader.sourceComponent
|
property alias content: contentLoader.sourceComponent
|
||||||
property alias contentLoader: contentLoader
|
property alias contentLoader: contentLoader
|
||||||
|
property Item directContent: null
|
||||||
property real width: 400
|
property real width: 400
|
||||||
property real height: 300
|
property real height: 300
|
||||||
readonly property real screenWidth: screen ? screen.width : 1920
|
readonly property real screenWidth: screen ? screen.width : 1920
|
||||||
@@ -200,14 +201,44 @@ PanelWindow {
|
|||||||
focus: root.shouldBeVisible
|
focus: root.shouldBeVisible
|
||||||
clip: false
|
clip: false
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: directContentWrapper
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
visible: root.directContent !== null
|
||||||
|
focus: true
|
||||||
|
clip: false
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (root.directContent) {
|
||||||
|
root.directContent.parent = directContentWrapper
|
||||||
|
root.directContent.anchors.fill = directContentWrapper
|
||||||
|
Qt.callLater(() => root.directContent.forceActiveFocus())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
function onDirectContentChanged() {
|
||||||
|
if (root.directContent) {
|
||||||
|
root.directContent.parent = directContentWrapper
|
||||||
|
root.directContent.anchors.fill = directContentWrapper
|
||||||
|
Qt.callLater(() => root.directContent.forceActiveFocus())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
target: root
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: contentLoader
|
id: contentLoader
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
active: root.keepContentLoaded || root.shouldBeVisible || root.visible
|
active: root.directContent === null && (root.keepContentLoaded || root.shouldBeVisible || root.visible)
|
||||||
asynchronous: false
|
asynchronous: false
|
||||||
focus: true
|
focus: true
|
||||||
clip: false
|
clip: false
|
||||||
|
visible: root.directContent === null
|
||||||
|
|
||||||
onLoaded: {
|
onLoaded: {
|
||||||
if (item) {
|
if (item) {
|
||||||
|
|||||||
@@ -13,15 +13,15 @@ DankModal {
|
|||||||
id: spotlightModal
|
id: spotlightModal
|
||||||
|
|
||||||
property bool spotlightOpen: false
|
property bool spotlightOpen: false
|
||||||
property Component spotlightContent
|
property alias spotlightContent: spotlightContentInstance
|
||||||
|
|
||||||
function show() {
|
function show() {
|
||||||
spotlightOpen = true
|
spotlightOpen = true
|
||||||
open()
|
open()
|
||||||
|
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
if (contentLoader.item && contentLoader.item.searchField) {
|
if (spotlightContent && spotlightContent.searchField) {
|
||||||
contentLoader.item.searchField.forceActiveFocus()
|
spotlightContent.searchField.forceActiveFocus()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -32,17 +32,17 @@ DankModal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onDialogClosed: {
|
onDialogClosed: {
|
||||||
if (contentLoader.item) {
|
if (spotlightContent) {
|
||||||
if (contentLoader.item.appLauncher) {
|
if (spotlightContent.appLauncher) {
|
||||||
contentLoader.item.appLauncher.searchQuery = ""
|
spotlightContent.appLauncher.searchQuery = ""
|
||||||
contentLoader.item.appLauncher.selectedIndex = 0
|
spotlightContent.appLauncher.selectedIndex = 0
|
||||||
contentLoader.item.appLauncher.setCategory(I18n.tr("All"))
|
spotlightContent.appLauncher.setCategory(I18n.tr("All"))
|
||||||
}
|
}
|
||||||
if (contentLoader.item.resetScroll) {
|
if (spotlightContent.resetScroll) {
|
||||||
contentLoader.item.resetScroll()
|
spotlightContent.resetScroll()
|
||||||
}
|
}
|
||||||
if (contentLoader.item.searchField) {
|
if (spotlightContent.searchField) {
|
||||||
contentLoader.item.searchField.text = ""
|
spotlightContent.searchField.text = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -68,10 +68,10 @@ DankModal {
|
|||||||
if (visible && !spotlightOpen) {
|
if (visible && !spotlightOpen) {
|
||||||
show()
|
show()
|
||||||
}
|
}
|
||||||
if (visible && contentLoader.item) {
|
if (visible && spotlightContent) {
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
if (contentLoader.item.searchField) {
|
if (spotlightContent.searchField) {
|
||||||
contentLoader.item.searchField.forceActiveFocus()
|
spotlightContent.searchField.forceActiveFocus()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,6 @@ DankModal {
|
|||||||
onBackgroundClicked: () => {
|
onBackgroundClicked: () => {
|
||||||
return hide()
|
return hide()
|
||||||
}
|
}
|
||||||
content: spotlightContent
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
function onCloseAllModalsExcept(excludedModal) {
|
function onCloseAllModalsExcept(excludedModal) {
|
||||||
@@ -110,9 +109,11 @@ DankModal {
|
|||||||
target: "spotlight"
|
target: "spotlight"
|
||||||
}
|
}
|
||||||
|
|
||||||
spotlightContent: Component {
|
SpotlightContent {
|
||||||
SpotlightContent {
|
id: spotlightContentInstance
|
||||||
parentModal: spotlightModal
|
|
||||||
}
|
parentModal: spotlightModal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
directContent: spotlightContentInstance
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user