Initial commit
[qml-presentation-made-with-qml:qml-presentation-made-with-qml.git] / flickr / mobile / TitleBar.qml
1 import Qt 4.6
2
3 Item {
4     id: titleBar
5     property string untaggedString: "Uploads from everyone"
6     property string taggedString: "Recent uploads tagged "
7
8     BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 }
9
10     Item {
11         id: container
12         width: (parent.width * 2) - 55 ; height: parent.height
13
14         Script {
15             function accept() {
16                 titleBar.state = ""
17                 background.state = ""
18                 rssModel.tags = editor.text
19             }
20         }
21
22         Text {
23             id: categoryText
24             anchors {
25                 left: parent.left; right: tagButton.left; leftMargin: 10; rightMargin: 10
26                 verticalCenter: parent.verticalCenter
27             }
28             elide: "ElideLeft"
29             text: (rssModel.tags=="" ? untaggedString : taggedString + rssModel.tags)
30             font.bold: true; color: "White"; style: "Raised"; styleColor: "Black"
31         }
32
33         Button {
34             id: tagButton; x: titleBar.width - 50; width: 45; height: 32; text: "..."
35             onClicked: if (titleBar.state == "Tags") accept(); else titleBar.state = "Tags"
36             anchors.verticalCenter: parent.verticalCenter
37         }
38
39         Item {
40             id: lineEdit
41             y: 4; height: parent.height - 9
42             anchors { left: tagButton.right; leftMargin: 5; right: parent.right; rightMargin: 5 }
43
44             BorderImage { source: "images/lineedit.sci"; anchors.fill: parent }
45
46             TextInput {
47                 id: editor
48                 anchors {
49                     left: parent.left; right: parent.right; leftMargin: 10; rightMargin: 10
50                     verticalCenter: parent.verticalCenter
51                 }
52                 cursorVisible: true; font.bold: true
53                 color: "#151515"; selectionColor: "Green"
54             }
55
56             Keys.forwardTo: [ (returnKey), (editor)]
57
58             Item {
59                 id: returnKey
60                 Keys.onReturnPressed: accept()
61                 Keys.onEscapePressed: titleBar.state = ""
62             }
63         }
64     }
65
66     states: State {
67         name: "Tags"
68         PropertyChanges { target: container; x: -tagButton.x + 5 }
69         PropertyChanges { target: tagButton; text: "OK" }
70         PropertyChanges { target: lineEdit; focus: true }
71     }
72
73     transitions: Transition {
74         NumberAnimation { properties: "x"; easing: "easeInOutQuad" }
75     }
76 }