initial commit
[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
22   onCallChanged: {
23     if(call) {
24       largeView.call = call;
25       console.log("*** QML *** :: CALL ITEM CHANGED, STATE: " + call.state);
26       root.state = call.state;
27
28       if (call.stateChanged)
29       {
30       call.stateChanged.connect(function(state) {
31        console.log("*** QML *** :: CALL ITEM STATE CHANGED: " + state);
32        console.log("");
33
34         root.state = state;
35      });
36     }
37     else
38     {
39         console.log("*** call.stateChanged doesn't exist.. setting state to disconnect");
40         //      root.state = 'disconnected';
41     }
42     }
43     else
44         console.log("*** call doesn't exist.. setting to disconnect");
45         //root.state = 'disconnected';
46   }
47
48   states {
49     State {
50       name: 'active'
51       PropertyChanges {target: root; visible: true}
52     }
53
54     State {
55       name: 'held'
56       PropertyChanges {target: root; visible: true}
57     }
58
59     State {
60       name: 'dialing'
61       PropertyChanges {target: root; visible: true}
62     }
63
64     State {
65       name: 'alerting'
66       PropertyChanges {target: root; visible: true}
67     }
68
69     State {
70       name: 'incoming'
71       PropertyChanges {target: root; visible: true}
72     }
73
74     State {
75       name: 'waiting'
76       PropertyChanges {target: root; visible: true}
77     }
78
79     State {
80       name: 'disconnected'
81       PropertyChanges {target: root; visible: false}
82     }
83   }
84
85   Rectangle
86   {
87     id: background
88     anchors {top: parent.top; left: parent.left; right: parent.right; bottom: parent.bottom; topMargin: parent.height / 4; bottomMargin: parent.height / 5}
89
90     gradient: Gradient {
91       GradientStop {position: 0.0; color: '#4f4f4f'}
92       GradientStop {position: 1.0; color: '#000000'}
93     }
94    
95     CallItemViewLarge
96     {
97      id: largeView
98      call: root.call //parent.call
99      state: root.state //parent.state
100     }
101 }
102 }
103