diff options
author | Javier <dev.git@javispedro.com> | 2015-03-23 03:57:44 +0100 |
---|---|---|
committer | Javier <dev.git@javispedro.com> | 2015-03-23 03:57:44 +0100 |
commit | 02d9b5893ef441656d70cbe702e0d2339ae5c6de (patch) | |
tree | e6d741599a1240719fd7fee12f0d06fb597880e7 /saltoqd/voicecallmanager.cpp | |
parent | 5fef356ff3fbcb76a5ec44a81a8d54d29a42f25d (diff) | |
download | saltoq-02d9b5893ef441656d70cbe702e0d2339ae5c6de.tar.gz saltoq-02d9b5893ef441656d70cbe702e0d2339ae5c6de.zip |
use profiled via proxy
Diffstat (limited to 'saltoqd/voicecallmanager.cpp')
-rw-r--r-- | saltoqd/voicecallmanager.cpp | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/saltoqd/voicecallmanager.cpp b/saltoqd/voicecallmanager.cpp index 3ef9223..8820dd6 100644 --- a/saltoqd/voicecallmanager.cpp +++ b/saltoqd/voicecallmanager.cpp @@ -1,18 +1,29 @@ #include <QtDBus/QDBusConnection> #include "voicecallmanager.h" #include "voicecallmanager_interface.h" +#include "profiled_interface.h" +static ComNokiaProfiledInterface *profiled = NULL; static OrgNemomobileVoicecallVoiceCallManagerInterface *vcm = NULL; VoiceCallManager::VoiceCallManager(ToqManager *toq) : QObject(toq), _toq(toq) { + if (!profiled) { + profiled = new ComNokiaProfiledInterface("com.nokia.profiled", + "/com/nokia/profiled", + QDBusConnection::sessionBus()); + } if (!vcm) { vcm = new OrgNemomobileVoicecallVoiceCallManagerInterface("org.nemomobile.voicecall", "/", QDBusConnection::sessionBus()); } + // TODO Fix .xml to catch this signal + connect(profiled, SIGNAL(profile_changed(bool,bool,QString)), + this, SLOT(handleProfileChanged(bool,bool,QString))); + _toq->setEndpointListener(ToqConnection::VoiceCallEndpoint, this); } @@ -47,11 +58,8 @@ void VoiceCallManager::handleGetPhoneStatusMessage(const ToqConnection::Message QString VoiceCallManager::getCurrentProfile() { - QDBusConnection bus = QDBusConnection::sessionBus(); - QDBusReply<QString> resp = bus.call(QDBusMessage::createMethodCall("com.nokia.profiled", - "/com/nokia/profiled", - "com.nokia.profiled", - "get_profile")); + QDBusReply<QString> resp = profiled->get_profile(); + if (resp.isValid()) { return resp.value(); } else { @@ -62,12 +70,18 @@ QString VoiceCallManager::getCurrentProfile() void VoiceCallManager::setProfile(const QString &name) { - QDBusConnection bus = QDBusConnection::sessionBus(); - QDBusReply<bool> resp = bus.call(QDBusMessage::createMethodCall("com.nokia.profiled", - "/com/nokia/profiled", - "com.nokia.profiled", - "set_profile") << name); + QDBusReply<bool> resp = profiled->set_profile(name); + if (!resp.isValid()) { qWarning() << resp.error().message(); } } + +void VoiceCallManager::handleProfileChanged(bool changed, bool active, const QString &profile) +{ + Q_UNUSED(changed); + Q_UNUSED(active); + qDebug() << "Profile changed to" << profile; + // TODO +} + |