Initial commit
[ubi] / qml / ubi / components / DialogInput.qml
1 import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
2 import "../UIConstants.js" as Const
3
4 DialogBox {
5     id: root
6
7     property alias label: text.text
8     property alias placeholderText: input.placeholderText
9     property string text
10     property alias textWidth: input.width
11
12     signal closed(string resp)
13
14     function reset() {
15         input.text = "";
16     }
17
18     Rectangle {
19         id: box
20         anchors.left: root.left; anchors.right: root.right
21         height: column.height
22         anchors.bottom: root.bottom
23         color: Const.LIGHT_AUBERGINE_COLOR
24
25         MouseArea {
26             anchors.fill: parent
27         }
28
29         Column {
30             id: column
31             spacing: Const.DEFAULT_MARGIN
32             anchors.horizontalCenter: parent.horizontalCenter
33             Spacer {}
34
35             Text {
36                 id: text
37                 color: Const.DEFAULT_DIALOG_FOREGROUND_COLOR
38                 font.pixelSize: Const.DEFAULT_FONT_PIXEL_SIZE
39             }
40
41             TextField {
42                 id: input
43             }
44
45             Row {
46                 spacing: Const.DEFAULT_MARGIN
47                 Button {
48                     label: "Ok"
49                     onButtonClicked: {
50                         root.close();
51                         root.closed(input.text);
52                     }
53                 }
54             }
55             Spacer {}
56         }
57     }
58
59     Rectangle {
60         anchors.right: root.right; anchors.left: root.left
61         anchors.bottom: box.top
62         height: Const.SHADOW_OFFSET
63         color: "black"
64         opacity: 0.5
65     }
66 }