Merge lp:~tiagosh/telephony-service/fix-1224082 into lp:telephony-service

Proposed by Tiago Salem Herrmann
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 746
Merged at revision: 744
Proposed branch: lp:~tiagosh/telephony-service/fix-1224082
Merge into: lp:telephony-service
Diff against target: 116 lines (+30/-15)
5 files modified
libtelephonyservice/callentry.cpp (+1/-1)
libtelephonyservice/callmanager.cpp (+26/-14)
libtelephonyservice/callmanager.h (+1/-0)
libtelephonyservice/telepathyhelper.cpp (+1/-0)
libtelephonyservice/telepathyhelper.h (+1/-0)
To merge this branch: bzr merge lp:~tiagosh/telephony-service/fix-1224082
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Gustavo Pichorim Boiko (community) Approve
Review via email: mp+186434@code.launchpad.net

Commit message

- exclude incoming calls from foregroundCalls().
- empty mCallEntries when the observer is unregistered.

Description of the change

- exclude incoming calls from foregroundCalls().
- empty mCallEntries when the observer is unregistered.

To post a comment you must log in.
Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

61 + // incoming calls cant be considered foreground calls

Just to not cause confusion, can you replace "incoming calls" by "incoming but not yet answered calls"?
Because we also use the word "incoming" to differentiate from "outgoing" calls.

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

Looks good and works as expected!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'libtelephonyservice/callentry.cpp'
--- libtelephonyservice/callentry.cpp 2013-07-30 18:20:45 +0000
+++ libtelephonyservice/callentry.cpp 2013-09-18 21:30:40 +0000
@@ -129,7 +129,7 @@
129129
130bool CallEntry::ringing() const130bool CallEntry::ringing() const
131{131{
132 return mChannel->callFlags() & Tp::CallFlagLocallyRinging;132 return incoming() && (mChannel->callState() == Tp::CallStateInitialised);
133}133}
134134
135QString CallEntry::phoneNumber() const135QString CallEntry::phoneNumber() const
136136
=== modified file 'libtelephonyservice/callmanager.cpp'
--- libtelephonyservice/callmanager.cpp 2013-07-18 17:02:10 +0000
+++ libtelephonyservice/callmanager.cpp 2013-09-18 21:30:40 +0000
@@ -41,6 +41,16 @@
41: QObject(parent)41: QObject(parent)
42{42{
43 connect(TelepathyHelper::instance(), SIGNAL(connectedChanged()), SLOT(onConnectedChanged()));43 connect(TelepathyHelper::instance(), SIGNAL(connectedChanged()), SLOT(onConnectedChanged()));
44 connect(TelepathyHelper::instance(), SIGNAL(channelObserverUnregistered()), SLOT(onChannelObserverUnregistered()));
45}
46
47void CallManager::onChannelObserverUnregistered()
48{
49 mCallEntries.clear();
50 Q_EMIT hasCallsChanged();
51 Q_EMIT hasBackgroundCallChanged();
52 Q_EMIT foregroundCallChanged();
53 Q_EMIT backgroundCallChanged();
44}54}
4555
46void CallManager::startCall(const QString &phoneNumber)56void CallManager::startCall(const QString &phoneNumber)
@@ -76,19 +86,25 @@
76 // even if it is held86 // even if it is held
77 if (mCallEntries.count() == 1) {87 if (mCallEntries.count() == 1) {
78 call = mCallEntries.first();88 call = mCallEntries.first();
79 }89 } else {
8090 Q_FOREACH(CallEntry *entry, mCallEntries) {
81 Q_FOREACH(CallEntry *entry, mCallEntries) {91 if (entry->isActive() && !entry->isHeld()) {
82 if (entry->isActive() && !entry->isHeld()) {92 call = entry;
83 call = entry;93 break;
94 }
84 }95 }
85 }96 }
8697
87 if (call && (call->isActive() || call->isHeld() || !call->incoming())) {98 if (!call) {
88 return call;99 return 0;
89 }100 }
90101
91 return 0;102 // incoming but not yet answered calls cant be considered foreground calls
103 if (call->ringing()) {
104 return 0;
105 }
106
107 return call;
92}108}
93109
94QObject *CallManager::backgroundCall() const110QObject *CallManager::backgroundCall() const
@@ -125,10 +141,6 @@
125 entry->setVoicemail(true);141 entry->setVoicemail(true);
126 }142 }
127143
128 if (channel->isRequested()) {
129 entry->setSpeaker(true);
130 }
131
132 mCallEntries.append(entry);144 mCallEntries.append(entry);
133 connect(entry,145 connect(entry,
134 SIGNAL(callEnded()),146 SIGNAL(callEnded()),
135147
=== modified file 'libtelephonyservice/callmanager.h'
--- libtelephonyservice/callmanager.h 2013-07-18 17:02:10 +0000
+++ libtelephonyservice/callmanager.h 2013-09-18 21:30:40 +0000
@@ -72,6 +72,7 @@
7272
73public Q_SLOTS:73public Q_SLOTS:
74 void onCallChannelAvailable(Tp::CallChannelPtr channel);74 void onCallChannelAvailable(Tp::CallChannelPtr channel);
75 void onChannelObserverUnregistered();
75 void onCallEnded();76 void onCallEnded();
76 void onConnectedChanged();77 void onConnectedChanged();
7778
7879
=== modified file 'libtelephonyservice/telepathyhelper.cpp'
--- libtelephonyservice/telepathyhelper.cpp 2013-08-23 21:14:08 +0000
+++ libtelephonyservice/telepathyhelper.cpp 2013-09-18 21:30:40 +0000
@@ -144,6 +144,7 @@
144 }144 }
145 mChannelObserver->deleteLater();145 mChannelObserver->deleteLater();
146 mChannelObserver = NULL;146 mChannelObserver = NULL;
147 Q_EMIT channelObserverUnregistered();
147}148}
148149
149QStringList TelepathyHelper::supportedProtocols() const150QStringList TelepathyHelper::supportedProtocols() const
150151
=== modified file 'libtelephonyservice/telepathyhelper.h'
--- libtelephonyservice/telepathyhelper.h 2013-08-23 20:39:04 +0000
+++ libtelephonyservice/telepathyhelper.h 2013-09-18 21:30:40 +0000
@@ -55,6 +55,7 @@
5555
56Q_SIGNALS:56Q_SIGNALS:
57 void channelObserverCreated(ChannelObserver *observer);57 void channelObserverCreated(ChannelObserver *observer);
58 void channelObserverUnregistered();
58 void accountReady();59 void accountReady();
59 void connectionChanged();60 void connectionChanged();
60 void connectedChanged();61 void connectedChanged();

Subscribers

People subscribed via source and target branches