Update WWW
[ubi] / qml / ubi / components / FileOld.qml
1 import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
2 import "../UIConstants.js" as Const
3
4
5 Item {
6     id: root
7     property alias name: label.text
8     property bool isDirectory: false
9     property variant properties: null
10     property string filename: ""
11     property int textMax: 27
12
13     state: mouseArea.pressed && !root.disabled ? "pressed" : "unpressed"
14
15     width: box.width
16     height: box.height
17
18     signal clicked(variant prop)
19
20     Rectangle {
21         id: shadow
22         width: box.width
23         height: box.height
24         color: Const.SHADOW_COLOR;
25         radius: 10
26         x: Const.SHADOW_OFFSET;
27         y: Const.SHADOW_OFFSET;
28     }
29
30     Rectangle {
31         id: box
32         color: root.isDirectory ? "black" : "white"
33         height: label.height+20
34         width: label.width<=100 ? 120 : label.width+20
35         radius: 10
36     }
37
38     Rectangle {
39         width: box.width
40         height: box.height
41         x: box.x
42         y: box.y
43         color: root.isDirectory ? "white" : "black"
44         opacity: 0.5
45         radius: 10
46         visible: mouseArea.pressed
47     }
48
49     Text {
50         id: label
51         x: 10
52         y: 10
53         font.pixelSize: 30
54         color: root.isDirectory ? "white" : "black"
55         elide: Text.ElideLeft
56         anchors.centerIn: box
57         wrapMode: Text.Wrap
58         onTextChanged: {
59             if(text.length>root.textMax)
60                 root.name = text.substring(0,root.textMax-3)+"...";
61         }
62     }
63
64     MouseArea {
65         id: mouseArea
66         width: box.width
67         height: box.height
68         onClicked: {
69             root.clicked(root.properties);
70         }
71     }
72
73     states: [
74         State {
75             name: "unpressed"
76             PropertyChanges {target: shadow; x: Const.SHADOW_OFFSET}
77             PropertyChanges {target: shadow; y: Const.SHADOW_OFFSET}
78             PropertyChanges {target: box; x: 0}
79             PropertyChanges {target: box; y: 0}
80         },
81         State {
82             name: "pressed"
83             PropertyChanges {target: shadow; x: Const.SHADOW_OFFSET}
84             PropertyChanges {target: shadow; y: Const.SHADOW_OFFSET}
85             PropertyChanges {target: box; x: Const.SHADOW_OFFSET}
86             PropertyChanges {target: box; y: Const.SHADOW_OFFSET}
87         }
88     ]
89 }