44 import org.kde.plasma.core 0.1 as PlasmaCore
45 import "private/AppManager.js" as Utils
47 import
"private" as Private
65 property alias title: titleBar.children
72 property alias content: contentItem.children
79 property alias buttons: buttonItem.children
85 property Item visualParent
100 property alias privateTitleHeight: titleBar.height
101 property alias privateButtonsHeight: buttonItem.height
129 signal clickedOutside
135 dialogLayout.parent = internalLoader.item.mainItem
137 if (internalLoader.dialog) {
138 var pos = internalLoader.dialog.popupPosition(root.visualParent, Qt.AlignCenter)
139 internalLoader.dialog.x = pos.x
140 internalLoader.dialog.y = pos.y
142 internalLoader.dialog.visible =
true
143 internalLoader.dialog.activateWindow()
145 internalLoader.inlineDialog.open()
157 if (internalLoader.dialog) {
158 internalLoader.dialog.visible =
false
160 internalLoader.inlineDialog.close()
174 if (internalLoader.dialog) {
175 internalLoader.dialog.visible =
false
177 internalLoader.inlineDialog.close()
187 if (internalLoader.dialog) {
188 internalLoader.dialog.visible =
false
190 internalLoader.inlineDialog.close()
199 property Item rootItem
202 property Item dialog: sourceComponent == dialogComponent ? item : null
204 property Item inlineDialog: sourceComponent == inlineDialogComponent ? item : null
206 property bool loadCompleted:
false
208 Component.onCompleted: {
209 rootItem = Utils.rootObject()
215 if (rootItem == null || dialogLayout.width > rootItem.width || dialogLayout.height > rootItem.height) {
218 inlineDialogComponent
228 windowFlags: Qt.Popup
242 width: dialogLayout.width
243 height: dialogLayout.height + theme.defaultFont.mSize.height * 2
246 Component.onCompleted: dialogLayout.parent = dialogMainItem
247 Component.onDestruction: dialogLayout.parent = root
252 id: inlineDialogComponent
253 Private.InlineDialog {
255 visualParent: root.visualParent
256 property Item mainItem: inlineDialogMainItem
257 onStatusChanged: root.status = status
260 id: inlineDialogMainItem
261 width: dialogLayout.width
262 height: dialogLayout.height
265 Component.onCompleted: {
266 dialogLayout.parent = inlineDialogMainItem
268 Component.onDestruction: dialogLayout.parent = root
274 width: Math.max(buttonItem.childrenRect.width, contentItem.childrenRect.width)
275 height: titleBar.height + contentItem.childrenRect.height + buttonItem.childrenRect.height + 10
277 parent: internalLoader.dialog ? internalLoader.dialog : internalLoader.inlineDialog
279 Keys.onPressed:
event.accepted =
true
280 Keys.onReleased:
event.accepted =
true
285 height: children.length > 0 && children[0].visible ? childrenRect.height : 0
301 bottom: buttonItem.top
309 height: childrenRect.height
313 bottom: parent.bottom