-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotifyd.cpp
84 lines (73 loc) · 2.25 KB
/
notifyd.cpp
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include "notifyd.h"
#include <QtCore/QDebug>
#include <QtGui/QMessageBox>
/*
* Implementation of class Notifyd
*/
Notifyd::Notifyd(QObject* parent)
: QObject(parent)
{
mId = 0;
qDebug() << "Notifyd created";
}
Notifyd::~Notifyd()
{
qDebug() << "Notifyd deleted";
}
void Notifyd::CloseNotification(uint id)
{
qDebug() << QString("CloseNotification(%1);").arg(id);
}
QStringList Notifyd::GetCapabilities()
{
QStringList caps;
caps << "actions"
<< "body"
// << "body-hyperlinks"
// << "body-images"
// << "body-markup"
// << "icon-multi"
// << "icon-static"
// << "sound"
;
qDebug() << QString("GetCapabilities(); =>") << caps;
return caps;
}
QString Notifyd::GetServerInformation(QString& vendor, QString& version, QString& spec_version)
{
//qDebug() << QString("GetServerInformation(%1, %2, %3);").arg(vendor, version, spec_version);
qDebug() << QString("GetServerInformation(...);");
spec_version = QString("0.9");
version = QString("0.1");
vendor = QString("Alec");
return QString("notifyd");
}
uint Notifyd::Notify(const QString& app_name,
uint replaces_id,
const QString& app_icon,
const QString& summary,
const QString& body,
const QStringList& actions,
const QVariantMap& hints,
int expire_timeout
)
{
if (++mId == 0)
mId++;
qDebug() << QString("Notify(\n"
" app_name = %1\n"
" replaces_id = %2\n"
" app_icon = %3\n"
" summary = %4\n"
" body = %5\n"
).arg(app_name, QString::number(replaces_id), app_icon, summary, body)
<< " actions =" << actions << endl
<< " hints =" << hints << endl
<< QString(" expire_timeout = %1\n) => %2").arg(QString::number(expire_timeout), QString::number(mId));
NotificationItem* item = new NotificationItem();
itemMap.insert(mId, item);
item->setSummary(summary);
item->setBody(body);
item->show();
return mId;
}