qtmobility/examples/servicenotesmanager/declarative-sfw-notes/Dialog.qml
changeset 4 90517678cc4f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qtmobility/examples/servicenotesmanager/declarative-sfw-notes/Dialog.qml	Mon May 03 13:18:40 2010 +0300
@@ -0,0 +1,60 @@
+import Qt 4.6
+
+Rectangle {
+    property string text: ""
+    property bool alert: false
+    signal confirmed();
+
+    id: page
+    opacity: 0
+    border.width: 1; color: "lightgray"; radius: 5
+
+    width: 200; height: dialogText.height + okButton.height + 35
+    anchors.verticalCenter: mainWindow.verticalCenter
+    anchors.horizontalCenter: mainWindow.horizontalCenter
+
+    Text {
+        id: dialogText
+        text: page.text
+        wrap: true
+        x: 15; y: 15
+        color: activePalette.buttonText
+        anchors.horizontalCenter: page.horizontalCenter
+    }
+
+    Button {
+        id: okButton
+        text: "Ok"
+        width: 75; height: 25
+        anchors.top: dialogText.bottom; anchors.topMargin: 7
+
+        onClicked: {
+            page.confirmed();
+            page.opacity = 0;
+        }
+    }
+
+    Button {
+        id: noButton
+        text: "Cancel"
+        width: 75; height: 25
+        anchors.left: page.horizontalCenter; anchors.leftMargin: 5
+        anchors.top: dialogText.bottom; anchors.topMargin: 7
+    
+        onClicked: {
+            page.opacity = 0;
+        }
+    }
+
+    Component.onCompleted: {
+        if (alert == true)
+        {
+            noButton.opacity = 0;
+            okButton.anchors.horizontalCenter = page.horizontalCenter;
+        }
+        else {
+            okButton.anchors.right = page.horizontalCenter; 
+            okButton.anchors.rightMargin = 5;
+        }
+    }
+}