summaryrefslogtreecommitdiff
path: root/testnotification/testnotification.cpp
blob: d5fe98575dafc41dc87e487948f20bfb307ab4a4 (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
#include "testnotification.h"

using namespace sowatch;

TestNotification::TestNotification(Type type, const QString &title, const QString &body, QObject *parent)
    : Notification(parent),
      _type(type),
      _time(QDateTime::currentDateTime()),
      _title(title), _body(body)
{
	const int high = 10000, low = 5000;
	int rand = qrand() % ((high + 1) - low) + low;
	QTimer::singleShot(rand, this, SIGNAL(dismissed()));
}

Notification::Type TestNotification::type() const
{
	return _type;
}

uint TestNotification::count() const
{
	return 1;
}

QDateTime TestNotification::dateTime() const
{
	return _time;
}

QString TestNotification::title() const
{
	return _title;
}

QString TestNotification::body() const
{
	return _body;
}

void TestNotification::activate()
{
	// Do nothing
}

void TestNotification::dismiss()
{
	deleteLater(); // We do not want to keep those around.
}