summaryrefslogtreecommitdiff
path: root/ckitcallnotification
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2011-09-24 00:31:46 +0200
committerJavier S. Pedro <maemo@javispedro.com>2011-09-24 00:31:46 +0200
commitcba26597f1c09764d37be0d13863ec5d5c340da0 (patch)
tree5559b1274c228673e2bd519135de8de596c7e91b /ckitcallnotification
parentb414dbdb28d839c9755b1832f27f61d1ec9e7863 (diff)
downloadsowatch-cba26597f1c09764d37be0d13863ec5d5c340da0.tar.gz
sowatch-cba26597f1c09764d37be0d13863ec5d5c340da0.zip
new partially working incoming call plugin
Diffstat (limited to 'ckitcallnotification')
-rw-r--r--ckitcallnotification/ckitcallnotification.pro37
-rw-r--r--ckitcallnotification/ckitcallplugin.cpp29
-rw-r--r--ckitcallnotification/ckitcallplugin.h24
-rw-r--r--ckitcallnotification/ckitcallprovider.cpp40
-rw-r--r--ckitcallnotification/ckitcallprovider.h34
5 files changed, 164 insertions, 0 deletions
diff --git a/ckitcallnotification/ckitcallnotification.pro b/ckitcallnotification/ckitcallnotification.pro
new file mode 100644
index 0000000..17bdf8b
--- /dev/null
+++ b/ckitcallnotification/ckitcallnotification.pro
@@ -0,0 +1,37 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2011-09-24T00:00:03
+#
+#-------------------------------------------------
+
+TARGET = ckitcallnotification
+TEMPLATE = lib
+# CONFIG += plugin # Stupid Qt creator doesn't want to deploy plugins
+QT += dbus
+
+SOURCES += ckitcallplugin.cpp \
+ ckitcallprovider.cpp
+
+HEADERS += ckitcallplugin.h \
+ ckitcallprovider.h
+
+CONFIG += link_pkgconfig
+PKGCONFIG += contextsubscriber-1.0
+
+unix: LIBS += -L$$OUT_PWD/../libsowatch/ -lsowatch
+
+INCLUDEPATH += $$PWD/../libsowatch
+DEPENDPATH += $$PWD/../libsowatch
+
+unix:!symbian {
+ maemo5 {
+ target.path = /opt/sowatch/notifications
+ } else {
+ target.path = /usr/lib/sowatch/notifications
+ }
+ INSTALLS += target
+}
+
+
+
+
diff --git a/ckitcallnotification/ckitcallplugin.cpp b/ckitcallnotification/ckitcallplugin.cpp
new file mode 100644
index 0000000..aea82c2
--- /dev/null
+++ b/ckitcallnotification/ckitcallplugin.cpp
@@ -0,0 +1,29 @@
+#include "ckitcallprovider.h"
+#include "ckitcallplugin.h"
+
+using namespace sowatch;
+
+CKitCallPlugin::CKitCallPlugin(QObject *parent) :
+ QObject(parent)
+{
+}
+
+CKitCallPlugin::~CKitCallPlugin()
+{
+}
+
+QStringList CKitCallPlugin::providers()
+{
+ QStringList providers;
+ providers << "ckitcall";
+ return providers;
+}
+
+NotificationProvider* CKitCallPlugin::getProvider(const QString& driver, QSettings& settings, QObject *parent)
+{
+ Q_UNUSED(driver);
+ Q_UNUSED(settings);
+ return new CKitCallProvider(parent);
+}
+
+Q_EXPORT_PLUGIN2(ckitcallnotification, CKitCallPlugin)
diff --git a/ckitcallnotification/ckitcallplugin.h b/ckitcallnotification/ckitcallplugin.h
new file mode 100644
index 0000000..a9d432d
--- /dev/null
+++ b/ckitcallnotification/ckitcallplugin.h
@@ -0,0 +1,24 @@
+#ifndef CKITCALLPLUGIN_H
+#define CKITCALLPLUGIN_H
+
+#include <sowatch.h>
+
+namespace sowatch
+{
+
+class CKitCallPlugin : public QObject, public NotificationPluginInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(sowatch::NotificationPluginInterface)
+
+public:
+ CKitCallPlugin(QObject *parent = 0);
+ ~CKitCallPlugin();
+
+ QStringList providers();
+ NotificationProvider* getProvider(const QString& driver, QSettings& settings, QObject *parent = 0);
+};
+
+}
+
+#endif // CKITCALLPLUGIN_H
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();
+ }
+}
diff --git a/ckitcallnotification/ckitcallprovider.h b/ckitcallnotification/ckitcallprovider.h
new file mode 100644
index 0000000..49d83a3
--- /dev/null
+++ b/ckitcallnotification/ckitcallprovider.h
@@ -0,0 +1,34 @@
+#ifndef CKITCALLPROVIDER_H
+#define CKITCALLPROVIDER_H
+
+#include <sowatch.h>
+
+class ContextProperty;
+
+namespace sowatch
+{
+
+class CKitCallProvider : public NotificationProvider
+{
+ Q_OBJECT
+public:
+ explicit CKitCallProvider(QObject *parent = 0);
+ ~CKitCallProvider();
+
+ int getCount(Notification::Type type);
+
+signals:
+ void incomingCall(const QString &displayName);
+ void endIncomingCall();
+
+protected:
+ bool _inCall;
+ ContextProperty *_activeCall;
+
+protected slots:
+ void activeCallChanged();
+};
+
+}
+
+#endif // CKITCALLPROVIDER_H