Some work on PlasmaComponents.Dialog

Still broken in all kinds of ways, buttons, geometry, etc.
This commit is contained in:
Sebastian Kügler 2013-02-20 06:56:48 +01:00
parent 0fe94f0dac
commit 6461683f58

View File

@ -43,7 +43,7 @@
import QtQuick 2.0 import QtQuick 2.0
import org.kde.plasma.core 0.1 as PlasmaCore import org.kde.plasma.core 0.1 as PlasmaCore
import "private/AppManager.js" as Utils import "private/AppManager.js" as Utils
import "." 0.1 as PlasmaComponents import org.kde.plasma.components 0.1 as PlasmaComponents
import "private" as Private import "private" as Private
/** /**
@ -87,12 +87,12 @@ Item {
/** /**
* Indicates the dialog's phase in its life cycle. The values are as follows: * Indicates the dialog's phase in its life cycle. The values are as follows:
* *
* - DialogStatus.Opening - the dialog is opening * - PlasmaComponents.DialogStatus.Opening - the dialog is opening
* - DialogStatus.Open - the dialog is open and visible to the user * - PlasmaComponents.DialogStatus.Open - the dialog is open and visible to the user
* - DialogStatus.Closing - the dialog is closing * - PlasmaComponents.DialogStatus.Closing - the dialog is closing
* - DialogStatus.Closed - the dialog is closed and not visible to the user * - PlasmaComponents.DialogStatus.Closed - the dialog is closed and not visible to the user
* *
* The dialog's initial status is DialogStatus.Closed. * The dialog's initial status is PlasmaComponents.DialogStatus.Closed.
*/ */
property int status: PlasmaComponents.DialogStatus.Closed property int status: PlasmaComponents.DialogStatus.Closed
@ -153,12 +153,13 @@ Item {
* @see reject() * @see reject()
*/ */
function accept() { function accept() {
if (status == DialogStatus.Open) { if (status == PlasmaComponents.DialogStatus.Open) {
if (internalLoader.dialog) { coreDialog.visible = false;
internalLoader.dialog.visible = false // if (internalLoader.dialog) {
} else { // internalLoader.dialog.visible = false
internalLoader.inlineDialog.close() // } else {
} // internalLoader.inlineDialog.close()
// }
accepted() accepted()
} }
} }
@ -170,12 +171,13 @@ Item {
* @see accept() * @see accept()
*/ */
function reject() { function reject() {
if (status == DialogStatus.Open) { if (status == PlasmaComponents.DialogStatus.Open) {
if (internalLoader.dialog) { coreDialog.visible = false;
internalLoader.dialog.visible = false // if (internalLoader.dialog) {
} else { // internalLoader.dialog.visible = false
internalLoader.inlineDialog.close() // } else {
} // internalLoader.inlineDialog.close()
// }
rejected() rejected()
} }
} }
@ -184,11 +186,12 @@ Item {
* Closes the dialog without any user interaction. * Closes the dialog without any user interaction.
*/ */
function close() { function close() {
if (internalLoader.dialog) { internalLoader.sourceComponent.coreDialog.visible = false;
internalLoader.dialog.visible = false // if (internalLoader.dialog) {
} else { // internalLoader.dialog.visible = false
internalLoader.inlineDialog.close() // } else {
} // internalLoader.inlineDialog.close()
// }
} }
visible: false visible: false
@ -199,7 +202,7 @@ Item {
property Item rootItem property Item rootItem
//this is when the dialog is a separate window //this is when the dialog is a separate window
property Item dialog: sourceComponent == dialogComponent ? item : null property QtObject dialog: sourceComponent == dialogComponent ? item : null
//this is when the dialog is inline //this is when the dialog is inline
property Item inlineDialog: sourceComponent == inlineDialogComponent ? item : null property Item inlineDialog: sourceComponent == inlineDialogComponent ? item : null
@ -223,16 +226,18 @@ Item {
Component { Component {
id: dialogComponent id: dialogComponent
//property bool visible: coreDialog.visible
PlasmaCore.Dialog { PlasmaCore.Dialog {
id: coreDialog
windowFlags: Qt.Popup windowFlags: Qt.Popup
//state: "Hidden" // state: "Hidden"
visible: false visible: false
onVisibleChanged: { onVisibleChanged: {
if (visible) { if (visible) {
root.status = DialogStatus.Open root.status = PlasmaComponents.DialogStatus.Open
} else { } else {
root.status = DialogStatus.Closed root.status = PlasmaComponents.DialogStatus.Closed
} }
} }