summaryrefslogtreecommitdiff
path: root/daemon/manager.cpp
diff options
context:
space:
mode:
authorPhilipp Andreas <github@smurfy.de>2014-07-10 21:56:19 +0200
committerPhilipp Andreas <github@smurfy.de>2014-07-10 21:56:19 +0200
commita4084dcd38a78dfc9113168e378b5fa7f7e9f6ea (patch)
tree80ea1ed45651fa3e5fc3e6cc93366805a49913c0 /daemon/manager.cpp
parentcd3011c3ca4eb24627870326d676551edda1c030 (diff)
Adding support for default notifications.
Diffstat (limited to 'daemon/manager.cpp')
-rw-r--r--daemon/manager.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/daemon/manager.cpp b/daemon/manager.cpp
index f25e724..11444fe 100644
--- a/daemon/manager.cpp
+++ b/daemon/manager.cpp
@@ -5,8 +5,8 @@
#include <QtContacts/QContact>
#include <QtContacts/QContactPhoneNumber>
-Manager::Manager(watch::WatchConnector *watch, DBusConnector *dbus, VoiceCallManager *voice) :
- QObject(0), watch(watch), dbus(dbus), voice(voice),
+Manager::Manager(watch::WatchConnector *watch, DBusConnector *dbus, VoiceCallManager *voice, NotificationManager *notifications) :
+ QObject(0), watch(watch), dbus(dbus), voice(voice), notifications(notifications),
notification(MNotification::DeviceEvent)
{
// We don't need to handle presence changes, so report them separately and ignore them
@@ -24,6 +24,10 @@ Manager::Manager(watch::WatchConnector *watch, DBusConnector *dbus, VoiceCallMan
connect(voice, SIGNAL(activeVoiceCallChanged()), SLOT(onActiveVoiceCallChanged()));
connect(voice, SIGNAL(error(const QString &)), SLOT(onVoiceError(const QString &)));
+ connect(notifications, SIGNAL(error(const QString &)), SLOT(onNotifyError(const QString &)));
+ connect(notifications, SIGNAL(emailNotify(const QString &,const QString &,const QString &)), SLOT(onEmailNotify(const QString &,const QString &,const QString &)));
+ connect(notifications, SIGNAL(smsNotify(const QString &,const QString &)), SLOT(onSmsNotify(const QString &,const QString &)));
+
// Watch instantiated hangup, follow the orders
connect(watch, SIGNAL(hangup()), SLOT(hangupAll()));
connect(watch, SIGNAL(connectedChanged()), SLOT(onConnectedChanged()));
@@ -145,6 +149,29 @@ void Manager::onVoiceError(const QString &message)
qWarning() << "Error: " << message;
}
+
+void Manager::onNotifyError(const QString &message)
+{
+ qWarning() << "Error: " << message;
+}
+
+void Manager::onSmsNotify(const QString &sender, const QString &data)
+{
+ qDebug() << "SMS:";
+ qDebug() << sender;
+ qDebug() << data;
+ watch->sendSMSNotification(sender, data);
+}
+
+void Manager::onEmailNotify(const QString &sender, const QString &data,const QString &subject)
+{
+ qDebug() << "Email:";
+ qDebug() << sender;
+ qDebug() << data;
+ qDebug() << subject;
+ watch->sendEmailNotification(sender, data, subject);
+}
+
void Manager::hangupAll()
{
foreach (VoiceCallHandler* handler, voice->voiceCalls()) {