on xenial help sign in
use call hint visibility api from telephony
d03a6a0Nick Dedekind
qml/Panel/ActiveCallHint.qml+1−1
@@ -23,7 +23,7 @@ import "../Components"
23Item {
23Item {
24 id: callHint
24 id: callHint
25
25
26− property bool active: callManager.hasCalls && ApplicationManager.focusedApplicationId !== "dialer-app"
26+ property bool active: callManager.callIndicatorVisible
27 readonly property QtObject contactWatcher: _contactWatcher
27 readonly property QtObject contactWatcher: _contactWatcher
28 property int alternateLabelInterval: 4000
28 property int alternateLabelInterval: 4000
29 property color color: Qt.rgba(0.1, 0.6, 0.1, 1.0)
29 property color color: Qt.rgba(0.1, 0.6, 0.1, 1.0)
tests/mocks/Ubuntu/Telephony/MockCallManager.cpp+15
@@ -22,6 +22,7 @@ MockCallManager::MockCallManager(QObject *parent)
22 : QObject(parent)
22 : QObject(parent)
23 , m_foregroundCall(nullptr)
23 , m_foregroundCall(nullptr)
24 , m_backgroundCall(nullptr)
24 , m_backgroundCall(nullptr)
25+ , m_callIndicatorVisible(false)
25{
26{
26}
27}
27
28
@@ -63,3 +64,17 @@ bool MockCallManager::hasCalls() const
63{
64{
64 return m_foregroundCall || m_backgroundCall;
65 return m_foregroundCall || m_backgroundCall;
65}
66}
67+
68+
69+bool MockCallManager::callIndicatorVisible() const
70+{
71+ return m_callIndicatorVisible;
72+}
73+
74+void MockCallManager::setCallIndicatorVisible(bool callIndicatorVisible)
75+{
76+ if(m_callIndicatorVisible != callIndicatorVisible){
77+ m_callIndicatorVisible = callIndicatorVisible;
78+ Q_EMIT callIndicatorVisibleChanged();
79+ }
80+}
tests/mocks/Ubuntu/Telephony/MockCallManager.h+5
@@ -29,6 +29,7 @@ class MockCallManager : public QObject
29 Q_PROPERTY(QObject *foregroundCall READ foregroundCall WRITE setForegroundCall NOTIFY foregroundCallChanged)
29 Q_PROPERTY(QObject *foregroundCall READ foregroundCall WRITE setForegroundCall NOTIFY foregroundCallChanged)
30 Q_PROPERTY(QObject *backgroundCall READ backgroundCall WRITE setBackgroundCall NOTIFY backgroundCallChanged)
30 Q_PROPERTY(QObject *backgroundCall READ backgroundCall WRITE setBackgroundCall NOTIFY backgroundCallChanged)
31 Q_PROPERTY(bool hasCalls READ hasCalls NOTIFY hasCallsChanged)
31 Q_PROPERTY(bool hasCalls READ hasCalls NOTIFY hasCallsChanged)
32+ Q_PROPERTY(bool callIndicatorVisible READ callIndicatorVisible WRITE setCallIndicatorVisible NOTIFY callIndicatorVisibleChanged)
32
33
33public:
34public:
34 explicit MockCallManager(QObject *parent = 0);
35 explicit MockCallManager(QObject *parent = 0);
@@ -38,18 +39,22 @@ public:
38 QObject* foregroundCall() const;
39 QObject* foregroundCall() const;
39 QObject* backgroundCall() const;
40 QObject* backgroundCall() const;
40 bool hasCalls() const;
41 bool hasCalls() const;
42+ bool callIndicatorVisible() const;
41
43
42 void setForegroundCall(QObject* foregroundCall);
44 void setForegroundCall(QObject* foregroundCall);
43 void setBackgroundCall(QObject* backgroundCall);
45 void setBackgroundCall(QObject* backgroundCall);
46+ void setCallIndicatorVisible(bool callIndicatorVisible);
44
47
45Q_SIGNALS:
48Q_SIGNALS:
46 void foregroundCallChanged();
49 void foregroundCallChanged();
47 void backgroundCallChanged();
50 void backgroundCallChanged();
48 void hasCallsChanged();
51 void hasCallsChanged();
52+ void callIndicatorVisibleChanged();
49
53
50private:
54private:
51 QObject* m_foregroundCall;
55 QObject* m_foregroundCall;
52 QObject* m_backgroundCall;
56 QObject* m_backgroundCall;
57+ bool m_callIndicatorVisible;
53};
58};
54
59
55#endif // MOCKCALLMANAGER_H
60#endif // MOCKCALLMANAGER_H
tests/qmltests/Panel/tst_ActiveCallHint.qml+15−4
@@ -70,7 +70,20 @@ Item {
70 callHint.alternateLabelInterval = 300;
70 callHint.alternateLabelInterval = 300;
71 }
71 }
72
72
73− function test_activeCall_data() {
73+ function test_activeHint_data() {
74+ return [
75+ { tag: "empty", callIndicatorVisible: false },
76+ { tag: "empty", callIndicatorVisible: true }
77+ ];
78+ }
79+
80+ function test_activeHint(data) {
81+ callManager.callIndicatorVisible = data.callIndicatorVisible;
82+
83+ compare(callHint.active, data.callIndicatorVisible, "Call hint should be active when callIndicatorVisible=true");
84+ }
85+
86+ function test_currentCall_data() {
74 return [
87 return [
75 { tag: "empty", foreground: null, background: null, active: false, label: "" },
88 { tag: "empty", foreground: null, background: null, active: false, label: "" },
76 { tag: "foreground", foreground: call1, background: null, active: true, label: "+447812221111" },
89 { tag: "foreground", foreground: call1, background: null, active: true, label: "+447812221111" },
@@ -79,12 +92,10 @@ Item {
79 ];
92 ];
80 }
93 }
81
94
82− function test_activeCall(data) {
95+ function test_currentCall(data) {
83 callManager.foregroundCall = data.foreground;
96 callManager.foregroundCall = data.foreground;
84 callManager.backgroundCall = data.background;
97 callManager.backgroundCall = data.background;
85
98
86− compare(callHint.active, data.active, "Call hint active enabled does not match");
87−
88 var contactLabel = findChild(callHint, "contactLabel");
99 var contactLabel = findChild(callHint, "contactLabel");
89 verify(contactLabel !== null);
100 verify(contactLabel !== null);
90
101