~phablet-team/telephony-service/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import QtQuick 1.1
import QtMobility.contacts 1.1
import TelephonyApp 0.1
import "ContactUtils"

Rectangle {
    id: telephony
    width: 800
    height: 600

    function startCallToContact(contact, number) {
        // To keep this simple we rely on the fact that setting source to a
        // local file will immadiately make the item availalable.
        rightPaneContent.source = "DetailViewLiveCall/LiveCall.qml"
        rightPaneContent.item.contact = contact
        rightPaneContent.item.number = number
        rightPaneContent.item.startCall()
    }

    function startCallToNumber(number) {
        rightPaneContent.source = "DetailViewLiveCall/LiveCall.qml"
        rightPaneContent.item.contact = null
        rightPaneContent.item.number = number
        rightPaneContent.item.startCall()
    }

    function startChat(contact, number) {
        rightPaneContent.source = "DetailViewMessages/MessagesView.qml"
        rightPaneContent.item.contact = contact
        rightPaneContent.item.number = number
        rightPaneContent.item.newMessage = false
    }

    function endCall(duration) {
        rightPaneContent.source = "Panes/CallEndedPane.qml"
        rightPaneContent.item.text = duration;
        rightPaneContent.item.postText = "";
    }

    function showContactDetails(contact) {
        rightPaneContent.source = "DetailViewContact/ContactDetails.qml"
        rightPaneContent.item.contact = contact
    }

    function startNewMessage() {
        rightPaneContent.source = "DetailViewMessages/MessagesView.qml"
        rightPaneContent.item.newMessage = true
    }

    function showDial() {
        rightPaneContent.source = "DetailViewKeypad/KeypadView.qml"
    }

    ContactLoader {
        id: contactLoader
        contactId: contactKey

        onContactLoaded: {
            // switch to the contacts tab
            tabs.currentTab = 2;

            // and load the contact details
            showContactDetails(contact)
        }
    }

    Item {
        id: leftPane
        anchors.left: parent.left
        anchors.top: parent.top
        anchors.bottom: parent.bottom

        Tabs {
            id: tabs
            anchors.top: parent.top
            anchors.left: parent.left
            anchors.right: parent.right

            Component.onCompleted: rightPaneContent.source = "Panes/CallEndedPane.qml";
            onCurrentTabChanged: {
                switch (tabs.currentTab) {
                case 0:
                    rightPaneContent.source = "Panes/CallEndedPane.qml";
                    break;
                case 1:
                    rightPaneContent.source = "Panes/SelectMessagePane.qml";
                    break;
                case 2:
                    rightPaneContent.source = "Panes/SelectContactPane.qml";
                    break;
                }
            }
        }

        width: 250

        Loader {
            id: leftPaneContent
            anchors.top: tabs.bottom
            anchors.bottom: leftPane.bottom
            anchors.left: parent.left
            anchors.right: parent.right
            source: {
                switch (tabs.currentTab) {
                case 0:
                    "PanelCalls/CallPanel.qml"
                    break;
                case 1:
                    "PanelMessages/MessagesPanel.qml"
                    break;
                case 2:
                    "PanelContacts/ContactsPanel.qml"
                    break;
                }
            }
        }
    }

    Item {
        id: rightPane
        anchors.left: leftPane.right
        anchors.right: parent.right
        anchors.top: parent.top
        anchors.bottom: parent.bottom

        Rectangle {
            anchors.fill: parent
            color: "#ebebeb"

            Loader {
                id: rightPaneContent
                anchors.fill: parent
            }
        }
    }
}