2 * This file is part of ofono-qt
4 * Copyright (C) 2010 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"
29 OfonoCallSettings::OfonoCallSettings(OfonoModem::SelectionSetting modemSetting, const QString &modemPath, QObject *parent)
30 : OfonoModemInterface(modemSetting, modemPath, "org.ofono.CallSettings", OfonoInterface::GetAllOnFirstRequest, parent)
32 connect(this, SIGNAL(propertyChanged(const QString&, const QVariant&)),
33 this, SLOT(propertyChanged(const QString&, const QVariant&)));
34 connect(this, SIGNAL(setPropertyFailed(const QString&)),
35 this, SLOT(setPropertyFailed(const QString&)));
36 connect(this, SIGNAL(requestPropertyComplete(bool, const QString&, const QVariant&)),
37 this, SLOT(requestPropertyComplete(bool, const QString&, const QVariant&)));
40 OfonoCallSettings::~OfonoCallSettings()
44 void OfonoCallSettings::requestCallingLinePresentation()
46 requestProperty("CallingLinePresentation");
49 void OfonoCallSettings::requestCalledLinePresentation()
51 requestProperty("CalledLinePresentation");
54 void OfonoCallSettings::requestCalledLineRestriction()
56 requestProperty("CalledLineRestriction");
59 void OfonoCallSettings::requestCallingLineRestriction()
61 requestProperty("CallingLineRestriction");
64 void OfonoCallSettings::requestHideCallerId()
66 requestProperty("HideCallerId");
69 void OfonoCallSettings::requestVoiceCallWaiting()
71 requestProperty("VoiceCallWaiting");
74 void OfonoCallSettings::setHideCallerId(const QString &preference)
76 return setProperty("HideCallerId", qVariantFromValue(preference));
79 void OfonoCallSettings::setVoiceCallWaiting(const QString &preference)
81 return setProperty("VoiceCallWaiting", qVariantFromValue(preference));
84 void OfonoCallSettings::requestPropertyComplete(bool success, const QString& property, const QVariant& value)
86 if (property == "CallingLinePresentation") {
87 success ? emit callingLinePresentationComplete(true, value.value<QString>()) : emit callingLinePresentationComplete(false, value.value<QString>());
88 } else if (property == "CalledLinePresentation") {
89 success ? emit calledLinePresentationComplete(true, value.value<QString>()) : emit calledLinePresentationComplete(false, value.value<QString>());
90 } else if (property == "CalledLineRestriction") {
91 success ? emit calledLineRestrictionComplete(true, value.value<QString>()) : emit calledLineRestrictionComplete(false, value.value<QString>());
92 } else if (property == "CallingLineRestriction") {
93 success ? emit callingLineRestrictionComplete(true, value.value<QString>()) : emit callingLineRestrictionComplete(false, value.value<QString>());
94 } else if (property == "HideCallerId") {
95 success ? emit hideCallerIdComplete(true, value.value<QString>()) : emit hideCallerIdComplete(false, value.value<QString>());
96 } else if (property == "VoiceCallWaiting") {
97 success ? emit voiceCallWaitingComplete(true, value.value<QString>()) : emit voiceCallWaitingComplete(false, value.value<QString>());
101 void OfonoCallSettings::propertyChanged(const QString& property, const QVariant& value)
103 if (property == "CallingLinePresentation") {
104 emit callingLinePresentationChanged(value.value<QString>());
105 } else if (property == "CalledLinePresentation") {
106 emit calledLinePresentationChanged(value.value<QString>());
107 } else if (property == "CalledLineRestriction") {
108 emit calledLineRestrictionChanged(value.value<QString>());
109 } else if (property == "CallingLineRestriction") {
110 emit callingLineRestrictionChanged(value.value<QString>());
111 } else if (property == "HideCallerId") {
112 emit hideCallerIdChanged(value.value<QString>());
113 } else if (property == "VoiceCallWaiting") {
114 emit voiceCallWaitingChanged(value.value<QString>());
118 void OfonoCallSettings::setPropertyFailed(const QString& property)
120 if (property == "HideCallerId") {
121 emit setHideCallerIdFailed();
122 } else if (property == "VoiceCallWaiting") {
123 emit setVoiceCallWaitingFailed();