summaryrefslogtreecommitdiff
path: root/meegohandsetnotification/meegohandsetnotification.cpp
blob: 69e2bd5d3e79b68f3086b1da76ab6b18868057f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "meegohandsetnotification.h"

MeegoHandsetNotification::MeegoHandsetNotification(const ::Notification& n, QObject *parent) :
	sowatch::Notification(parent), _n(n)
{
}

sowatch::Notification::Type MeegoHandsetNotification::type() const
{
	QString eventType = _n.parameters().value("eventType").toString();
	if (eventType == "email.arrived")
		return sowatch::Notification::EmailNotification;
	else if (eventType == "x-nokia.call.missed")
		return sowatch::Notification::MissedCallNotification;
	else if (eventType == "x-nokia.messaging.im")
		return sowatch::Notification::ImNotification;
	else if (eventType == "x-nokia.messaging.sms")
		return sowatch::Notification::SmsNotification;
	else if (eventType == "x-nokia.messaging.mms")
		return sowatch::Notification::MmsNotification;
	else
		return sowatch::Notification::OtherNotification;
}

uint MeegoHandsetNotification::count() const
{
	return _n.parameters().value("count").toUInt();
}

QDateTime MeegoHandsetNotification::dateTime() const
{
	const uint timestamp = _n.parameters().value("timestamp").toUInt();
	return QDateTime::fromTime_t(timestamp);
}

QString MeegoHandsetNotification::title() const
{
	return _n.parameters().value("summary").toString();
}

QString MeegoHandsetNotification::body() const
{
	return _n.parameters().value("body").toString();
}

void MeegoHandsetNotification::activate()
{
	// TODO Actually do something
}

void MeegoHandsetNotification::clear()
{
	// TODO Actually clear...
	emit cleared();
}

void MeegoHandsetNotification::changeTo(const ::Notification &notification)
{
	_n = notification;
	emit changed();
}