Merge lp:~boiko/telephony-service/rtm-silence_incoming_cals into lp:telephony-service/rtm-14.09

Proposed by Gustavo Pichorim Boiko
Status: Merged
Approved by: Bill Filler
Approved revision: 925
Merged at revision: 925
Proposed branch: lp:~boiko/telephony-service/rtm-silence_incoming_cals
Merge into: lp:telephony-service/rtm-14.09
Diff against target: 52 lines (+24/-0)
2 files modified
approver/approver.cpp (+23/-0)
approver/approver.h (+1/-0)
To merge this branch: bzr merge lp:~boiko/telephony-service/rtm-silence_incoming_cals
Reviewer Review Type Date Requested Status
Ubuntu Phablet Team Pending
Review via email: mp+247141@code.launchpad.net

Commit message

Silence incoming calls when power button is pressed.

Description of the change

Silence incoming calls when power button is pressed.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'approver/approver.cpp'
2--- approver/approver.cpp 2015-01-13 11:55:50 +0000
3+++ approver/approver.cpp 2015-01-21 12:52:45 +0000
4@@ -72,6 +72,13 @@
5 connect(GreeterContacts::instance(), SIGNAL(contactUpdated(QtContacts::QContact)),
6 this, SLOT(updateNotification(QtContacts::QContact)));
7 }
8+
9+ QDBusConnection::systemBus().connect("com.canonical.Unity.Screen",
10+ "/com/canonical/Unity/Screen",
11+ "com.canonical.Unity.Screen",
12+ "DisplayPowerStateChange",
13+ this, SLOT(onUnityStateChanged(int,int)));
14+
15 // WORKAROUND: we need to use a timer as the qtubuntu sensors backend does not support setPeriod()
16 mVibrateTimer.setInterval(4000);
17 connect(&mVibrateTimer, SIGNAL(timeout()), &mVibrateEffect, SLOT(start()));
18@@ -81,6 +88,22 @@
19 mRejectActions["rejectMessage3"] = C::gettext("Please call me back later.");
20 }
21
22+void Approver::onUnityStateChanged(int state, int reason)
23+{
24+ if (!mPendingSnapDecision) {
25+ return;
26+ }
27+
28+ // state == 0 is power off
29+ // reason == 2 is power key
30+ if (state == 0 && reason == 2) {
31+ Ringtone::instance()->stopIncomingCallSound();
32+ mVibrateTimer.stop();
33+ mVibrateEffect.setDuration(1);
34+ mVibrateEffect.start();
35+ }
36+}
37+
38 Approver::~Approver()
39 {
40 }
41
42=== modified file 'approver/approver.h'
43--- approver/approver.h 2014-12-16 00:42:22 +0000
44+++ approver/approver.h 2015-01-21 12:52:45 +0000
45@@ -71,6 +71,7 @@
46 void onAcceptCallRequested();
47 void onRejectCallRequested();
48 void updateNotification(const QtContacts::QContact &contact);
49+ void onUnityStateChanged(int state, int reason);
50
51 private:
52 QList<Tp::ChannelDispatchOperationPtr> mDispatchOps;

Subscribers

People subscribed via source and target branches