hfdialer has been made a singleton and will only start one
[profile/ivi/hfdialer.git] / qml / CallItemView.qml
1 /*
2  * Copyright 2012 Intel Corporation.
3  *
4  * This program is licensed under the terms and conditions of the
5  * Apache License, version 2.0.  The full text of the Apache License is at
6  * http://www.apache.org/licenses/LICENSE-2.0
7  */
8
9 import Qt 4.7
10
11 Item
12 {
13     id: root
14     anchors.fill: parent
15     property variant call: null
16
17     state: 'disconnected'
18     onStateChanged: {
19         console.log("*** STATE IS now >> " + root.state);
20     }
21     Connections {
22         target: adapter
23         onCallCountChanged: {
24             if (callCount <= 0)
25                 root.state = 'disconnected'
26         }
27     }
28     onCallChanged: {
29         if(call) {
30             largeView.call = call;
31             console.log("*** QML *** :: CALL ITEM CHANGED, STATE: " + call.state);
32             root.state = call.state;
33
34             if (call.stateChanged)
35             {
36                 call.stateChanged.connect(function(state) {
37                     console.log("*** QML *** :: CALL ITEM STATE CHANGED: " + state);
38                     console.log("");
39
40                     root.state = state;
41                     });
42             }
43         }
44     }
45
46     states {
47         State {
48             name: 'active'
49             PropertyChanges {target: root; visible: true}
50         }
51
52         State {
53             name: 'held'
54             PropertyChanges {target: root; visible: true}
55         }
56
57         State {
58             name: 'dialing'
59             PropertyChanges {target: root; visible: true}
60         }
61
62         State {
63             name: 'alerting'
64             PropertyChanges {target: root; visible: true}
65         }
66
67         State {
68             name: 'incoming'
69             PropertyChanges {target: root; visible: true}
70         }
71
72         State {
73             name: 'waiting'
74             PropertyChanges {target: root; visible: true}
75         }
76
77         State {
78             name: 'disconnected'
79             PropertyChanges {target: root; visible: false}
80         }
81     }
82
83     Rectangle
84     {
85         id: background
86         anchors {top: parent.top; left: parent.left; right: parent.right; bottom: parent.bottom; topMargin: parent.height / 4; bottomMargin: parent.height / 5}
87
88         gradient: Gradient {
89             GradientStop {position: 0.0; color: '#4f4f4f'}
90             GradientStop {position: 1.0; color: '#000000'}
91         }
92
93         CallItemViewLarge
94         {
95             id: largeView
96             call: root.call //parent.call
97             state: root.state //parent.state
98         }
99     }
100 }
101