Port the notification backend to KNotifications

This commit is contained in:
Tobias Fella
2020-11-02 22:46:51 +00:00
parent 3c4eff0759
commit 8e7c84fd78
8 changed files with 61 additions and 207 deletions

View File

@@ -0,0 +1,24 @@
#include "notificationsmanager.h"
#include <QDebug>
#include <QImage>
#include <KNotification>
NotificationsManager::NotificationsManager(QObject *parent)
: QObject(parent)
{
}
void NotificationsManager::postNotification(const QString &roomid, const QString &eventid, const QString &roomname, const QString &sender, const QString &text, const QImage &icon)
{
QPixmap img;
img.convertFromImage(icon);
KNotification *notification = new KNotification("message");
notification->setTitle(i18n("%1 (%2)", sender, roomname));
notification->setText(text);
notification->setPixmap(img);
notification->sendEvent();
m_notifications.insert(roomid, notification);
}