From 0fa2ca1ee1dec8d7355115426a762f9fe808f2f6 Mon Sep 17 00:00:00 2001 From: Tomasz Sterna Date: Fri, 1 Aug 2014 12:58:36 +0200 Subject: Implemented option to disable phone call forwarding to watch. closes #13 --- app/qml/pages/ManagerPage.qml | 9 +++++++++ daemon/manager.cpp | 5 +++++ daemon/settings.h | 3 +++ 3 files changed, 17 insertions(+) diff --git a/app/qml/pages/ManagerPage.qml b/app/qml/pages/ManagerPage.qml index ecb7610..303c2fa 100644 --- a/app/qml/pages/ManagerPage.qml +++ b/app/qml/pages/ManagerPage.qml @@ -41,6 +41,7 @@ Page { id: settings path: "/org/pebbled/settings" property bool silentWhenConnected: false + property bool incomingCallNotification: true property bool notificationsCommhistoryd: true property bool notificationsMissedCall: true property bool notificationsEmails: false @@ -140,6 +141,14 @@ Page { anchors.right: parent.right anchors.rightMargin: Theme.paddingMedium } + TextSwitch { + text: qsTr("Forward phone calls") + checked: settings.incomingCallNotification + automaticCheck: false + onClicked: { + settings.incomingCallNotification = !settings.incomingCallNotification; + } + } TextSwitch { text: qsTr("Silent when connected") checked: settings.silentWhenConnected diff --git a/daemon/manager.cpp b/daemon/manager.cpp index bd9fc4a..b47c170 100644 --- a/daemon/manager.cpp +++ b/daemon/manager.cpp @@ -120,6 +120,11 @@ void Manager::onActiveVoiceCallChanged() { logger()->debug() << "Manager::onActiveVoiceCallChanged()"; + if (!settings->property("incomingCallNotification").toBool()) { + logger()->debug() << "Ignoring ActiveVoiceCallChanged because of setting!"; + return; + } + VoiceCallHandler* handler = voice->activeVoiceCall(); if (handler) { connect(handler, SIGNAL(statusChanged()), SLOT(onActiveVoiceCallStatusChanged())); diff --git a/daemon/settings.h b/daemon/settings.h index 1f2e2e5..03423e4 100644 --- a/daemon/settings.h +++ b/daemon/settings.h @@ -8,6 +8,7 @@ class Settings : public MDConfGroup Q_OBJECT Q_PROPERTY(bool silentWhenConnected MEMBER silentWhenConnected NOTIFY silentWhenConnectedChanged) + Q_PROPERTY(bool incomingCallNotification MEMBER incomingCallNotification NOTIFY incomingCallNotificationChanged) Q_PROPERTY(bool notificationsCommhistoryd MEMBER notificationsCommhistoryd NOTIFY notificationsCommhistorydChanged) Q_PROPERTY(bool notificationsMissedCall MEMBER notificationsMissedCall NOTIFY notificationsMissedCallChanged) Q_PROPERTY(bool notificationsEmails MEMBER notificationsEmails NOTIFY notificationsEmailsChanged) @@ -17,6 +18,7 @@ class Settings : public MDConfGroup Q_PROPERTY(bool notificationsOther MEMBER notificationsOther NOTIFY notificationsOtherChanged) Q_PROPERTY(bool notificationsAll MEMBER notificationsAll NOTIFY notificationsAllChanged) bool silentWhenConnected; + bool incomingCallNotification; bool notificationsCommhistoryd; bool notificationsMissedCall; bool notificationsEmails; @@ -33,6 +35,7 @@ public: signals: void silentWhenConnectedChanged(bool); + void incomingCallNotificationChanged(bool); void notificationsCommhistorydChanged(bool); void notificationsMissedCallChanged(bool); void notificationsEmailsChanged(bool); -- cgit v1.2.3