diff options
Diffstat (limited to 'rockworkd/platformintegration/sailfish/sailfishplatform.cpp')
| -rw-r--r-- | rockworkd/platformintegration/sailfish/sailfishplatform.cpp | 59 |
1 files changed, 53 insertions, 6 deletions
diff --git a/rockworkd/platformintegration/sailfish/sailfishplatform.cpp b/rockworkd/platformintegration/sailfish/sailfishplatform.cpp index 09e1426..bcd834f 100644 --- a/rockworkd/platformintegration/sailfish/sailfishplatform.cpp +++ b/rockworkd/platformintegration/sailfish/sailfishplatform.cpp @@ -1,12 +1,14 @@ #include "sailfishplatform.h" -#include "callchannelobserver.h" +#include "voicecallhandler.h" +#include "voicecallmanager.h" #include "organizeradapter.h" #include "syncmonitorclient.h" #include <QDBusConnection> #include <QDBusConnectionInterface> #include <QDebug> +#include <QSettings> SailfishPlatform::SailfishPlatform(QObject *parent): PlatformInterface(parent), @@ -54,10 +56,10 @@ SailfishPlatform::SailfishPlatform(QObject *parent): } // Calls - m_telepathyMonitor = new TelepathyMonitor(this); - connect(m_telepathyMonitor, &TelepathyMonitor::incomingCall, this, &SailfishPlatform::incomingCall); - connect(m_telepathyMonitor, &TelepathyMonitor::callStarted, this, &SailfishPlatform::callStarted); - connect(m_telepathyMonitor, &TelepathyMonitor::callEnded, this, &SailfishPlatform::callEnded); + m_voiceCallManager = new VoiceCallManager(this); + + connect(m_voiceCallManager, SIGNAL(activeVoiceCallChanged()), SLOT(onActiveVoiceCallChanged())); + connect(m_voiceCallManager, SIGNAL(error(const QString &)), SLOT(onVoiceError(const QString &))); // Organizer m_organizerAdapter = new OrganizerAdapter(this); @@ -75,6 +77,51 @@ QDBusInterface *SailfishPlatform::interface() const return m_iface; } +void SailfishPlatform::onActiveVoiceCallChanged() +{ + + VoiceCallHandler* handler = m_voiceCallManager->activeVoiceCall(); + if (handler) { + connect(handler, SIGNAL(statusChanged()), SLOT(onActiveVoiceCallStatusChanged())); + connect(handler, SIGNAL(destroyed()), SLOT(onActiveVoiceCallStatusChanged())); + if (handler->status()) onActiveVoiceCallStatusChanged(); + } +} + +void SailfishPlatform::onActiveVoiceCallStatusChanged() +{ + VoiceCallHandler* handler = m_voiceCallManager->activeVoiceCall(); + + if (!handler) { + return; + } + + uint handlerId = qHash(handler->handlerId()); + switch ((VoiceCallHandler::VoiceCallStatus)handler->status()) { + case VoiceCallHandler::STATUS_ALERTING: + case VoiceCallHandler::STATUS_DIALING: + qDebug() << "Tell outgoing:" << handler->lineId(); + //emit outgoingCall(handlerId, handler->lineId(), m_voiceCallManager->findPersonByNumber(handler->lineId())); + break; + case VoiceCallHandler::STATUS_INCOMING: + case VoiceCallHandler::STATUS_WAITING: + qDebug() << "Tell incoming:" << handler->lineId(); + emit incomingCall(handlerId, handler->lineId(), m_voiceCallManager->findPersonByNumber(handler->lineId())); + break; + case VoiceCallHandler::STATUS_NULL: + case VoiceCallHandler::STATUS_DISCONNECTED: + qDebug() << "Endphone"; + emit callEnded(handlerId, false); + break; + case VoiceCallHandler::STATUS_ACTIVE: + qDebug() << "Startphone"; + emit callStarted(handlerId); + break; + case VoiceCallHandler::STATUS_HELD: + break; + } +} + uint SailfishPlatform::Notify(const QString &app_name, uint replaces_id, const QString &app_icon, const QString &summary, const QString &body, const QStringList &actions, const QVariantHash &hints, int expire_timeout) { qDebug() << "Notification received" << app_name << replaces_id << app_icon << summary << body << actions << hints << expire_timeout; @@ -236,7 +283,7 @@ MusicMetaData SailfishPlatform::musicMetaData() const void SailfishPlatform::hangupCall(uint cookie) { - m_telepathyMonitor->hangupCall(cookie); + m_voiceCallManager->hangUp(cookie); } QList<CalendarEvent> SailfishPlatform::organizerItems() const |
