opacity for MessageDialog { id: mesgDialog state: 'hidden' } will make dial page...
[profile/ivi/hfdialer.git] / qml / DeviceDelegateActive.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 QtQuick 2.0
10 Item {
11     id: root
12     property string deviceName
13     property string address
14     property string icon: ""
15     property string alias: ""
16     property string dbuspath: ""
17     property variant uuids: []
18
19     property int containerHeight: 80
20     height: containerHeight
21     width: parent.width
22     signal clicked()
23     signal close()
24
25     Connections {
26         target: adapter
27         onModemOnlineChanged: {
28
29             //If the modem gets powered down for any reason, attempt to power it again to maintain connection
30             if (!adapter.modemOnline)
31             {
32                 mainText.color = "grey"
33                 availableBluetoothItem.source = "/usr/share/hfdialer/images/ivi_btn-list-inactive.png"
34             }
35             else
36             {
37                 mainText.color = "white"
38                 availableBluetoothItem.source = "/usr/share/hfdialer/images/ivi_btn-list.png"
39             }
40          }
41     }
42
43     Image {
44         id: availableBluetoothItem
45
46         source: !adapter.modemOnline? "/usr/share/hfdialer/images/ivi_btn-list-inactive.png" : availableBluetoothItem.source = "/usr/share/hfdialer/images/ivi_btn-list.png"
47         anchors {fill: parent; leftMargin: 8; rightMargin: 8; topMargin: 8}
48
49         MouseArea {
50           id: clickArea
51           anchors.fill: parent
52
53            onPressed: {
54                  availableBluetoothItem.source = "/usr/share/hfdialer/images/ivi_btn-list.png"            
55             }
56
57             onReleased: {
58                  availableBluetoothItem.source = "/usr/share/hfdialer/images/ivi_btn-list-inactive.png"      
59             }
60
61             onClicked: {
62                 adapter.modemOnline = true
63             }
64         }
65
66         Text {
67             id: mainText
68
69             anchors {left: parent.left; top: parent.top; bottom: parent.bottom; leftMargin: 15}
70             width: parent.width * 0.75
71
72             verticalAlignment: Text.AlignVCenter
73             height:  availableBluetoothItem.containerHeight
74             font.pixelSize: parent.height / 2
75             style: Text.Outline
76             styleColor: "#3B3A39"
77             color: !adapter.modemOnline? "grey" : "white"
78             text: root.deviceName
79             elide: Text.ElideRight
80         }
81
82         Image {
83             id: closeButton
84             source: "/usr/share/hfdialer/images/ivi_icon-list-delete.png"
85             anchors { left: mainText.right; right: parent.right; top: parent.top; bottom: parent.bottom}
86
87             MouseArea {
88                 id: closeArea
89                   anchors.fill: parent
90
91             onPressed: {
92                 closeButton.source = "/usr/share/hfdialer/images/ivi_icon-list-delete-active.png"
93             }
94
95             onReleased: {
96                 closeButton.source = "/usr/share/hfdialer/images/ivi_icon-list-delete.png"
97             }
98
99             onClicked: {
100                 console.log("CLOSE BUTTON CLICKED")
101                 root.close()
102                 }
103             }
104         }
105     }
106 }