diff options
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 +} + |