mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Support activation tokens for notifications
This commit is contained in:
parent
234e05eef3
commit
b16b52b40b
4 changed files with 22 additions and 0 deletions
|
@ -101,6 +101,7 @@ private:
|
||||||
// but Qt slot declarations can not be inside an ifdef!
|
// but Qt slot declarations can not be inside an ifdef!
|
||||||
private slots:
|
private slots:
|
||||||
void actionInvoked(uint id, QString action);
|
void actionInvoked(uint id, QString action);
|
||||||
|
void activationToken(uint id, QString action);
|
||||||
void notificationClosed(uint id, uint reason);
|
void notificationClosed(uint id, uint reason);
|
||||||
void notificationReplied(uint id, QString reply);
|
void notificationReplied(uint id, QString reply);
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include "Cache.h"
|
#include "Cache.h"
|
||||||
#include "EventAccessors.h"
|
#include "EventAccessors.h"
|
||||||
|
#include "Logging.h"
|
||||||
#include "MxcImageProvider.h"
|
#include "MxcImageProvider.h"
|
||||||
#include "UserSettingsPage.h"
|
#include "UserSettingsPage.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
@ -58,6 +59,12 @@ NotificationsManager::NotificationsManager(QObject *parent)
|
||||||
QStringLiteral("ActionInvoked"),
|
QStringLiteral("ActionInvoked"),
|
||||||
this,
|
this,
|
||||||
SLOT(actionInvoked(uint,QString)));
|
SLOT(actionInvoked(uint,QString)));
|
||||||
|
QDBusConnection::sessionBus().connect(QStringLiteral("org.freedesktop.Notifications"),
|
||||||
|
QStringLiteral("/org/freedesktop/Notifications"),
|
||||||
|
QStringLiteral("org.freedesktop.Notifications"),
|
||||||
|
QStringLiteral("ActivationToken"),
|
||||||
|
this,
|
||||||
|
SLOT(activationToken(uint,QString)));
|
||||||
QDBusConnection::sessionBus().connect(QStringLiteral("org.freedesktop.Notifications"),
|
QDBusConnection::sessionBus().connect(QStringLiteral("org.freedesktop.Notifications"),
|
||||||
QStringLiteral("/org/freedesktop/Notifications"),
|
QStringLiteral("/org/freedesktop/Notifications"),
|
||||||
QStringLiteral("org.freedesktop.Notifications"),
|
QStringLiteral("org.freedesktop.Notifications"),
|
||||||
|
@ -256,6 +263,14 @@ NotificationsManager::actionInvoked(uint id, QString action)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// receive a wayland activation token from the notification manager
|
||||||
|
void
|
||||||
|
NotificationsManager::activationToken(uint, QString action)
|
||||||
|
{
|
||||||
|
nhlog::net()->debug("Got activation token for notification");
|
||||||
|
qputenv("XDG_ACTIVATION_TOKEN", action.toUtf8());
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
NotificationsManager::notificationReplied(uint id, QString reply)
|
NotificationsManager::notificationReplied(uint id, QString reply)
|
||||||
{
|
{
|
||||||
|
|
|
@ -182,6 +182,8 @@ void NotificationsManager::attachToMacNotifCenter()
|
||||||
// unused
|
// unused
|
||||||
void NotificationsManager::actionInvoked(uint, QString) { }
|
void NotificationsManager::actionInvoked(uint, QString) { }
|
||||||
|
|
||||||
|
void NotificationsManager::activationToken(uint, QString) { }
|
||||||
|
|
||||||
void NotificationsManager::notificationReplied(uint, QString) { }
|
void NotificationsManager::notificationReplied(uint, QString) { }
|
||||||
|
|
||||||
void NotificationsManager::notificationClosed(uint, uint) { }
|
void NotificationsManager::notificationClosed(uint, uint) { }
|
||||||
|
|
|
@ -95,6 +95,10 @@ void
|
||||||
NotificationsManager::actionInvoked(uint, QString)
|
NotificationsManager::actionInvoked(uint, QString)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
void
|
||||||
|
NotificationsManager::activationToken(uint, QString)
|
||||||
|
{}
|
||||||
|
|
||||||
void
|
void
|
||||||
NotificationsManager::notificationReplied(uint, QString)
|
NotificationsManager::notificationReplied(uint, QString)
|
||||||
{}
|
{}
|
||||||
|
|
Loading…
Reference in a new issue