2021-10-15 11:31:29 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
|
2021-10-22 10:29:39 +00:00
|
|
|
import "../status-desktop/ui/shared/popups" as SharedPopups
|
|
|
|
import "../status-desktop/ui/shared/panels" as SharedPanels
|
|
|
|
|
2021-10-15 11:31:29 +00:00
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: root
|
|
|
|
|
2021-10-22 10:29:39 +00:00
|
|
|
property SharedPopups.ModalPopup target: null
|
2021-10-15 11:31:29 +00:00
|
|
|
|
|
|
|
property var header
|
|
|
|
property var contentItem
|
|
|
|
property var footer
|
|
|
|
|
|
|
|
property Helpers __helpers: Helpers {}
|
|
|
|
|
2021-10-22 10:29:39 +00:00
|
|
|
property var headerComp: Component {
|
2021-10-15 11:31:29 +00:00
|
|
|
QtObject {
|
2021-10-22 10:29:39 +00:00
|
|
|
property SharedPanels.StyledText title: null
|
2021-10-15 11:31:29 +00:00
|
|
|
property var closeButton: null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function findInContent(objectName) {
|
|
|
|
if (root.contentItem) {
|
|
|
|
return __helpers.getObjectByObjectName(root.contentItem, objectName)
|
|
|
|
}
|
|
|
|
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
|
|
|
function findInFooter(objectName) {
|
|
|
|
if (root.footer) {
|
|
|
|
return __helpers.getObjectByObjectName(root.footer, objectName)
|
|
|
|
}
|
|
|
|
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
2021-10-22 10:29:39 +00:00
|
|
|
property var cbComponent: Component {
|
2021-10-15 11:31:29 +00:00
|
|
|
QtObject {
|
|
|
|
property Rectangle background: null
|
2021-10-22 10:29:39 +00:00
|
|
|
property SharedPanels.SVGImage icon: null
|
2021-10-15 11:31:29 +00:00
|
|
|
property MouseArea sensor: null
|
|
|
|
|
|
|
|
function click() {
|
|
|
|
if (sensor) {
|
|
|
|
sensor.clicked()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onTargetChanged: {
|
|
|
|
if (target) {
|
|
|
|
var hdr = __helpers.getObjectByObjectName(target.contentItem, "headerContent")
|
|
|
|
var headerNew = headerComp.createObject()
|
|
|
|
headerNew.title = __helpers.getObjectByObjectName(hdr, "titleText")
|
|
|
|
|
|
|
|
var clbtn = __helpers.getObjectByObjectName(__helpers.getObjectByObjectName(target.contentItem, "closeButtonRectangle"))
|
|
|
|
var icon = __helpers.getObjectByObjectName(clbtn, "closeImage")
|
|
|
|
var sensor = __helpers.getObjectByObjectName(clbtn, "closeSensor")
|
|
|
|
headerNew.closeButton = cbComponent.createObject(null, {
|
|
|
|
background: clbtn,
|
|
|
|
icon: icon,
|
|
|
|
sensor: sensor
|
|
|
|
})
|
|
|
|
root.header = headerNew
|
|
|
|
|
|
|
|
root.contentItem = __helpers.getObjectByObjectName(target.contentItem, "contentParent")
|
|
|
|
root.footer = __helpers.getObjectByObjectName(target.contetItem, "footerParent")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|