mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Use the class D-Bus member
This commit is contained in:
parent
8d3e463fa6
commit
ae7468a716
1 changed files with 3 additions and 9 deletions
|
@ -62,10 +62,7 @@ NotificationsManager::postNotification(const mtx::responses::Notification ¬if
|
||||||
const auto text = utils::event_body(notification.event);
|
const auto text = utils::event_body(notification.event);
|
||||||
auto formattedText = utils::markdownToHtml(text);
|
auto formattedText = utils::markdownToHtml(text);
|
||||||
|
|
||||||
static QDBusInterface notifyApp("org.freedesktop.Notifications",
|
auto capabilites = dbus.call("GetCapabilites");
|
||||||
"/org/freedesktop/Notifications",
|
|
||||||
"org.freedesktop.Notifications");
|
|
||||||
auto capabilites = notifyApp.call("GetCapabilites");
|
|
||||||
if (!capabilites.arguments().contains("body-markup"))
|
if (!capabilites.arguments().contains("body-markup"))
|
||||||
formattedText = QTextDocumentFragment::fromHtml(formattedText).toPlainText();
|
formattedText = QTextDocumentFragment::fromHtml(formattedText).toPlainText();
|
||||||
|
|
||||||
|
@ -94,7 +91,7 @@ NotificationsManager::postNotification(const mtx::responses::Notification ¬if
|
||||||
argumentList << hints; // hints
|
argumentList << hints; // hints
|
||||||
argumentList << (int)-1; // timeout in ms
|
argumentList << (int)-1; // timeout in ms
|
||||||
|
|
||||||
QDBusPendingCall call = notifyApp.asyncCallWithArgumentList("Notify", argumentList);
|
QDBusPendingCall call = dbus.asyncCallWithArgumentList("Notify", argumentList);
|
||||||
auto watcher = new QDBusPendingCallWatcher{call, this};
|
auto watcher = new QDBusPendingCallWatcher{call, this};
|
||||||
connect(
|
connect(
|
||||||
watcher, &QDBusPendingCallWatcher::finished, this, [watcher, this, room_id, event_id]() {
|
watcher, &QDBusPendingCallWatcher::finished, this, [watcher, this, room_id, event_id]() {
|
||||||
|
@ -110,10 +107,7 @@ NotificationsManager::postNotification(const mtx::responses::Notification ¬if
|
||||||
void
|
void
|
||||||
NotificationsManager::closeNotification(uint id)
|
NotificationsManager::closeNotification(uint id)
|
||||||
{
|
{
|
||||||
static QDBusInterface closeCall("org.freedesktop.Notifications",
|
auto call = dbus.asyncCall("CloseNotification", (uint)id); // replace_id
|
||||||
"/org/freedesktop/Notifications",
|
|
||||||
"org.freedesktop.Notifications");
|
|
||||||
auto call = closeCall.asyncCall("CloseNotification", (uint)id); // replace_id
|
|
||||||
auto watcher = new QDBusPendingCallWatcher{call, this};
|
auto watcher = new QDBusPendingCallWatcher{call, this};
|
||||||
connect(watcher, &QDBusPendingCallWatcher::finished, this, [watcher]() {
|
connect(watcher, &QDBusPendingCallWatcher::finished, this, [watcher]() {
|
||||||
if (watcher->reply().type() == QDBusMessage::ErrorMessage) {
|
if (watcher->reply().type() == QDBusMessage::ErrorMessage) {
|
||||||
|
|
Loading…
Reference in a new issue