2 * Copyright (C) 2014 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18import Lomiri.Telephony 0.1 as Telephony
19import Lomiri.Components 1.3
20import QtMir.Application 0.1
26 property bool greeterShown: false
28 readonly property bool active: {
29 var application = ApplicationManager.findApplication("dialer-app");
31 if (callManager.callIndicatorVisible) {
32 // at the moment, callIndicatorVisible is only "valid" if dialer is in focus.
33 if (application && ApplicationManager.focusedApplicationId === "dialer-app") {
34 // Don't show if application is still starting; might get a fleeting true/false.
35 return application.state !== ApplicationInfoInterface.Starting;
38 if (greeterShown || ApplicationManager.focusedApplicationId !== "dialer-app") {
40 // Don't show if application is still starting; might get a fleeting true/false.
41 return application.state !== ApplicationInfoInterface.Starting && callManager.hasCalls;
43 return callManager.hasCalls;
47 readonly property QtObject contactWatcher: _contactWatcher
48 property int labelSwitchInterval: 6000
49 implicitWidth: row.x + row.width
51 Component.onCompleted: {
52 telepathyHelper.registerChannelObserver("lomiri");
55 function showLiveCall() {
56 Qt.openUrlExternally("dialer:///?view=liveCall");
64 objectName: "contactColumn"
66 anchors.left: parent.left
68 Component.onCompleted: {
70 labelPathView.column1 = column;
72 labelPathView.column2 = column;
77 height: callHint.height
78 verticalAlignment: Text.AlignVCenter
79 text: i18n.tr("Tap to return to call...");
80 color: theme.palette.normal.activityText
84 objectName: "contactLabel"
85 height: callHint.height
86 verticalAlignment: Text.AlignVCenter
87 width: Math.max(contentWidth, 1)
92 } else if (d.activeCall.isConference) {
93 return i18n.tr("Conference");
95 return contactWatcher.alias !== "" ? contactWatcher.alias : contactWatcher.phoneNumber;
98 color: theme.palette.normal.activityText
107 bottom: parent.bottom
109 leftMargin: units.gu(1)
115 objectName: "timeLabel"
119 bottom: parent.bottom
121 verticalAlignment: Text.AlignVCenter
122 horizontalAlignment: Text.AlignRight
124 var m = Math.floor(d.callTime/60);
125 var ss = d.callTime % 60;
129 return m + ":0" + ss;
132 color: theme.palette.normal.activityText
137 objectName: "labelPathView"
141 bottom: parent.bottom
143 width: column1 && column2 ? Math.max(column1.width, column1.width) : 0
146 property Column column1
147 property Column column2
148 property int columnHeight: column1 ? column1.height : 0
150 delegate: contactColumn
156 startY: -labelPathView.columnHeight / 2
158 y: labelPathView.columnHeight * 1.5
166 // ensure we go faster than the label switch
167 duration: labelSwitchInterval/8
169 easing.type: Easing.InOutQuad
176 id: alternateLabelTimer
177 running: callHint.active
178 interval: labelPathView.offset % 1.0 !== 0 ? labelSwitchInterval : labelSwitchInterval/4
183 offsetBehaviour.enabled = false;
184 labelPathView.offset = 0;
185 offsetBehaviour.enabled = true;
190 labelPathView.offset = labelPathView.offset + 0.5;
194 Telephony.ContactWatcher {
196 objectName: "contactWatcher"
197 phoneNumber: d.activeCall ? d.activeCall.phoneNumber : ""
203 property QtObject activeCall: {
204 if (callManager.foregroundCall) {
205 return callManager.foregroundCall;
207 return callManager.backgroundCall;
209 property int callTime: activeCall ? activeCall.elapsedTime : 0