summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Sterna <tomek@xiaoka.com>2014-06-30 02:14:58 +0200
committerTomasz Sterna <tomek@xiaoka.com>2014-06-30 02:14:58 +0200
commitf86af8e40591693f733c539a476c53ccf41c97a1 (patch)
tree4b853f79d9a6d0d78e874cfc8b07b56b494669ac
parent3c52767b24f27ac166f9c68e2fc73811527bafe1 (diff)
Implemented notification on Pebble connect/disconnect
-rw-r--r--daemon/daemon.pro2
-rw-r--r--daemon/manager.cpp15
-rw-r--r--daemon/manager.h3
3 files changed, 19 insertions, 1 deletions
diff --git a/daemon/daemon.pro b/daemon/daemon.pro
index ca7fd70..b0957fe 100644
--- a/daemon/daemon.pro
+++ b/daemon/daemon.pro
@@ -9,7 +9,7 @@ INCLUDEPATH += ../lib
LIBS += -L$$OUT_PWD/../lib -lpebble
QT += bluetooth dbus contacts
-PKGCONFIG += commhistory-qt5
+PKGCONFIG += commhistory-qt5 mlite5
QMAKE_CXXFLAGS += -std=c++0x
SOURCES += \
diff --git a/daemon/manager.cpp b/daemon/manager.cpp
index 691d7a5..cfa955b 100644
--- a/daemon/manager.cpp
+++ b/daemon/manager.cpp
@@ -47,6 +47,21 @@ void Manager::onPebbleChanged()
}
}
+void Manager::onConnectedChanged()
+{
+ QString message = QString("%1 %2")
+ .arg(watch->name().isEmpty() ? "Pebble" : watch->name())
+ .arg(watch->isConnected() ? "connected" : "disconnected");
+ qDebug() << message;
+
+ if (notification.isPublished()) notification.remove();
+
+ notification.setBody(message);
+ if (!notification.publish()) {
+ qDebug() << "Failed publishing notification";
+ }
+}
+
void Manager::onActiveVoiceCallChanged()
{
qDebug() << "Manager::onActiveVoiceCallChanged()";
diff --git a/daemon/manager.h b/daemon/manager.h
index a1b206e..bfbd92d 100644
--- a/daemon/manager.h
+++ b/daemon/manager.h
@@ -10,6 +10,7 @@
#include <QtContacts/QContactManager>
#include <QtContacts/QContactDetailFilter>
#include <CommHistory/GroupModel>
+#include <MNotification>
using namespace QtContacts;
using namespace CommHistory;
@@ -24,6 +25,8 @@ class Manager : public QObject
DBusConnector *dbus;
VoiceCallManager *voice;
+ MNotification notification;
+
QContactManager *contacts;
QContactDetailFilter numberFilter;
GroupManager *conversations;