Merge lp:~tiagosh/telephony-service/fix-voicemail-indicator2 into lp:telephony-service

Proposed by Tiago Salem Herrmann
Status: Merged
Approved by: Bill Filler
Approved revision: no longer in the source branch.
Merged at revision: 855
Proposed branch: lp:~tiagosh/telephony-service/fix-voicemail-indicator2
Merge into: lp:telephony-service
Diff against target: 97 lines (+44/-9)
2 files modified
libtelephonyservice/callmanager.cpp (+43/-9)
libtelephonyservice/callmanager.h (+1/-0)
To merge this branch: bzr merge lp:~tiagosh/telephony-service/fix-voicemail-indicator2
Reviewer Review Type Date Requested Status
Bill Filler (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+227991@code.launchpad.net

Commit message

Listen for VoicemailNumberChanged() signal

Description of the change

Listen for VoicemailNumberChanged() signal

--Checklist--
Are there any related MPs required for this MP to build/function as expected? Please list.
https://code.launchpad.net/~tiagosh/telepathy-ofono/fix-voicemail-indicator/+merge/227990

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)
Yes

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?
Yes

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/telephony-service) on device or emulator?
Yes

If you changed the UI, was the change specified/approved by design?
N/A

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP?
N/A

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Bill Filler (bfiller) wrote :

tested, works

review: Approve
854. By Tiago Salem Herrmann

Use correct label for blocked and private numbers on messaging-menu. Fixes: 1340386, 1347708
Approved by: Gustavo Pichorim Boiko

855. By Tiago Salem Herrmann

Listen for VoicemailNumberChanged() signal Fixes: 1347085

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libtelephonyservice/callmanager.cpp'
2--- libtelephonyservice/callmanager.cpp 2014-06-27 20:37:38 +0000
3+++ libtelephonyservice/callmanager.cpp 2014-07-23 20:54:42 +0000
4@@ -45,6 +45,8 @@
5 connect(TelepathyHelper::instance(), SIGNAL(channelObserverUnregistered()), SLOT(onChannelObserverUnregistered()));
6 connect(TelepathyHelper::instance(), SIGNAL(accountConnectionChanged()), SLOT(onEmergencyNumbersChanged()));
7 connect(TelepathyHelper::instance(), SIGNAL(accountReady()), SLOT(onEmergencyNumbersChanged()));
8+ connect(TelepathyHelper::instance(), SIGNAL(accountConnectionChanged()), SLOT(onVoicemailNumberChanged()));
9+ connect(TelepathyHelper::instance(), SIGNAL(accountReady()), SLOT(onVoicemailNumberChanged()));
10 connect(this, SIGNAL(hasCallsChanged()), SIGNAL(callsChanged()));
11 connect(this, &CallManager::hasCallsChanged, [this] {
12 Q_EMIT this->callIndicatorVisibleChanged(this->callIndicatorVisible());
13@@ -185,24 +187,29 @@
14 return;
15 }
16
17- // FIXME: needs to handle voicemail numbers from multiple accounts
18- Tp::ConnectionPtr conn(TelepathyHelper::instance()->accounts()[0]->connection());
19+ onVoicemailNumberChanged();
20+
21+ Tp::ConnectionPtr conn;
22+ Q_FOREACH(const Tp::AccountPtr &account, TelepathyHelper::instance()->accounts()) {
23+ if (!account->connection().isNull()) {
24+ conn = account->connection();
25+ break;
26+ }
27+ }
28+
29 if (conn.isNull()) {
30- mVoicemailNumber = QString();
31 return;
32 }
33
34 QString busName = conn->busName();
35 QString objectPath = conn->objectPath();
36- QDBusInterface connIface(busName, objectPath, CANONICAL_TELEPHONY_VOICEMAIL_IFACE);
37- QDBusReply<QString> replyNumber = connIface.call("VoicemailNumber");
38- if (replyNumber.isValid()) {
39- mVoicemailNumber = replyNumber.value();
40- Q_EMIT voicemailNumberChanged();
41- }
42
43 // connect the emergency numbers changed signal
44 QDBusConnection connection = QDBusConnection::sessionBus();
45+ connection.connect(busName, objectPath, CANONICAL_TELEPHONY_VOICEMAIL_IFACE, "VoicemailNumberChanged",
46+ this, SLOT(onVoicemailNumberChanged()));
47+
48+ // connect the emergency numbers changed signal
49 connection.connect(busName, objectPath, CANONICAL_TELEPHONY_EMERGENCYMODE_IFACE, "EmergencyNumbersChanged",
50 this, SLOT(onEmergencyNumbersChanged()));
51 }
52@@ -238,6 +245,33 @@
53 }
54 }
55
56+void CallManager::onVoicemailNumberChanged()
57+{
58+ // FIXME: we need to handle emergency numbers for multiple accounts
59+ Tp::ConnectionPtr conn;
60+ Q_FOREACH(const Tp::AccountPtr &account, TelepathyHelper::instance()->accounts()) {
61+ if (!account->connection().isNull()) {
62+ conn = account->connection();
63+ break;
64+ }
65+ }
66+
67+ if (conn.isNull()) {
68+ mVoicemailNumber = QString();
69+ return;
70+ }
71+
72+ QString busName = conn->busName();
73+ QString objectPath = conn->objectPath();
74+ QDBusInterface connIface(busName, objectPath, CANONICAL_TELEPHONY_VOICEMAIL_IFACE);
75+ QDBusReply<QString> replyNumber = connIface.call("VoicemailNumber");
76+ if (replyNumber.isValid()) {
77+ mVoicemailNumber = replyNumber.value();
78+ qDebug() << mVoicemailNumber;
79+ Q_EMIT voicemailNumberChanged();
80+ }
81+}
82+
83 CallEntry *CallManager::foregroundCall() const
84 {
85 CallEntry *call = 0;
86
87=== modified file 'libtelephonyservice/callmanager.h'
88--- libtelephonyservice/callmanager.h 2014-06-27 17:45:58 +0000
89+++ libtelephonyservice/callmanager.h 2014-07-23 20:54:42 +0000
90@@ -107,6 +107,7 @@
91 void onConnectedChanged();
92 void onCallIndicatorVisibleChanged(bool visible);
93 void onEmergencyNumbersChanged();
94+ void onVoicemailNumberChanged();
95
96 private:
97 explicit CallManager(QObject *parent = 0);

Subscribers

People subscribed via source and target branches