diff options
Diffstat (limited to 'ckitcallnotification/ckitcallprovider.cpp')
-rw-r--r-- | ckitcallnotification/ckitcallprovider.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/ckitcallnotification/ckitcallprovider.cpp b/ckitcallnotification/ckitcallprovider.cpp new file mode 100644 index 0000000..85f85b2 --- /dev/null +++ b/ckitcallnotification/ckitcallprovider.cpp @@ -0,0 +1,40 @@ +#include <QtCore/QtDebug> +#include <contextsubscriber/contextproperty.h> +#include "ckitcallprovider.h" + +using namespace sowatch; + +CKitCallProvider::CKitCallProvider(QObject *parent) : + NotificationProvider(parent), + _inCall(false), + _activeCall(new ContextProperty("/com/nokia/CallUi/ActiveCall")) +{ + connect(_activeCall, SIGNAL(valueChanged()), SLOT(activeCallChanged())); + qDebug() << _activeCall->value(); +} + +CKitCallProvider::~CKitCallProvider() +{ + +} + +int CKitCallProvider::getCount(Notification::Type type) +{ + Q_UNUSED(type); + return 0; +} + +void CKitCallProvider::activeCallChanged() +{ + QVariantMap info = _activeCall->value().toMap(); + int state = info["state"].toInt(); + if (state == 0) { + // Incoming call, or update to a incoming call + _inCall = true; + emit incomingCall(info["displayName"].toString()); + } else if (_inCall) { + // Call is no longer incoming + _inCall = false; + emit endIncomingCall(); + } +} |