2 * This file is part of ofono-qt
4 * Copyright (C) 2010-2011 Nokia Corporation and/or its subsidiary(-ies).
6 * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * version 2.1 as published by the Free Software Foundation.
12 * This library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24 #include <QtDBus/QtDBus>
25 #include <QtCore/QObject>
27 #include "ofonocallsettings.h"
28 #include "ofonointerface.h"
30 OfonoCallSettings::OfonoCallSettings(OfonoModem::SelectionSetting modemSetting, const QString &modemPath, QObject *parent)
31 : OfonoModemInterface(modemSetting, modemPath, "org.ofono.CallSettings", OfonoGetAllOnFirstRequest, parent)
33 connect(m_if, SIGNAL(propertyChanged(const QString&, const QVariant&)),
34 this, SLOT(propertyChanged(const QString&, const QVariant&)));
35 connect(m_if, SIGNAL(setPropertyFailed(const QString&)),
36 this, SLOT(setPropertyFailed(const QString&)));
37 connect(m_if, SIGNAL(requestPropertyComplete(bool, const QString&, const QVariant&)),
38 this, SLOT(requestPropertyComplete(bool, const QString&, const QVariant&)));
41 OfonoCallSettings::~OfonoCallSettings()
45 void OfonoCallSettings::requestCallingLinePresentation()
47 m_if->requestProperty("CallingLinePresentation");
50 void OfonoCallSettings::requestCalledLinePresentation()
52 m_if->requestProperty("CalledLinePresentation");
55 void OfonoCallSettings::requestConnectedLinePresentation()
57 m_if->requestProperty("ConnectedLinePresentation");
60 void OfonoCallSettings::requestConnectedLineRestriction()
62 m_if->requestProperty("ConnectedLineRestriction");
65 void OfonoCallSettings::requestCallingLineRestriction()
67 m_if->requestProperty("CallingLineRestriction");
70 void OfonoCallSettings::requestHideCallerId()
72 m_if->requestProperty("HideCallerId");
75 void OfonoCallSettings::requestVoiceCallWaiting()
77 m_if->requestProperty("VoiceCallWaiting");
80 void OfonoCallSettings::setHideCallerId(const QString &preference)
82 return m_if->setProperty("HideCallerId", qVariantFromValue(preference));
85 void OfonoCallSettings::setVoiceCallWaiting(const QString &preference)
87 return m_if->setProperty("VoiceCallWaiting", qVariantFromValue(preference));
90 void OfonoCallSettings::requestPropertyComplete(bool success, const QString& property, const QVariant& value)
92 if (property == "CallingLinePresentation") {
93 success ? emit callingLinePresentationComplete(true, value.value<QString>()) : emit callingLinePresentationComplete(false, value.value<QString>());
94 } else if (property == "CalledLinePresentation") {
95 success ? emit calledLinePresentationComplete(true, value.value<QString>()) : emit calledLinePresentationComplete(false, value.value<QString>());
96 } else if (property == "ConnectedLinePresentation") {
97 success ? emit connectedLinePresentationComplete(true, value.value<QString>()) : emit connectedLinePresentationComplete(false, value.value<QString>());
98 } else if (property == "ConnectedLineRestriction") {
99 success ? emit connectedLineRestrictionComplete(true, value.value<QString>()) : emit connectedLineRestrictionComplete(false, value.value<QString>());
100 } else if (property == "CallingLineRestriction") {
101 success ? emit callingLineRestrictionComplete(true, value.value<QString>()) : emit callingLineRestrictionComplete(false, value.value<QString>());
102 } else if (property == "HideCallerId") {
103 success ? emit hideCallerIdComplete(true, value.value<QString>()) : emit hideCallerIdComplete(false, value.value<QString>());
104 } else if (property == "VoiceCallWaiting") {
105 success ? emit voiceCallWaitingComplete(true, value.value<QString>()) : emit voiceCallWaitingComplete(false, value.value<QString>());
109 void OfonoCallSettings::propertyChanged(const QString& property, const QVariant& value)
111 if (property == "CallingLinePresentation") {
112 emit callingLinePresentationChanged(value.value<QString>());
113 } else if (property == "CalledLinePresentation") {
114 emit calledLinePresentationChanged(value.value<QString>());
115 } else if (property == "ConnectedLinePresentation") {
116 emit connectedLinePresentationChanged(value.value<QString>());
117 } else if (property == "ConnectedLineRestriction") {
118 emit connectedLineRestrictionChanged(value.value<QString>());
119 } else if (property == "CallingLineRestriction") {
120 emit callingLineRestrictionChanged(value.value<QString>());
121 } else if (property == "HideCallerId") {
122 emit hideCallerIdChanged(value.value<QString>());
123 } else if (property == "VoiceCallWaiting") {
124 emit voiceCallWaitingChanged(value.value<QString>());
128 void OfonoCallSettings::setPropertyFailed(const QString& property)
130 if (property == "HideCallerId") {
131 emit setHideCallerIdFailed();
132 } else if (property == "VoiceCallWaiting") {
133 emit setVoiceCallWaitingFailed();