make lint

This commit is contained in:
Loren Burkholder 2021-01-19 18:47:44 -05:00
parent b04a7fbef6
commit 7727c0d249

View File

@ -1,12 +1,12 @@
#include "notifications/Manager.h" #include "notifications/Manager.h"
#include <QDebug>
#include <QImage>
#include <QDBusConnection> #include <QDBusConnection>
#include <QDBusMessage> #include <QDBusMessage>
#include <QDBusMetaType> #include <QDBusMetaType>
#include <QDBusPendingCallWatcher> #include <QDBusPendingCallWatcher>
#include <QDBusPendingReply> #include <QDBusPendingReply>
#include <QDebug>
#include <QImage>
NotificationsManager::NotificationsManager(QObject *parent) NotificationsManager::NotificationsManager(QObject *parent)
: QObject(parent) : QObject(parent)
@ -52,38 +52,41 @@ NotificationsManager::postNotification(const QString &roomid,
const QString &text, const QString &text,
const QImage &icon) const QImage &icon)
{ {
Q_UNUSED(icon) Q_UNUSED(icon)
QVariantMap hints; QVariantMap hints;
hints["image-data"] = sender + ": " + text; hints["image-data"] = sender + ": " + text;
hints["sound-name"] = "message-new-instant"; hints["sound-name"] = "message-new-instant";
QList<QVariant> argumentList; QList<QVariant> argumentList;
argumentList << "nheko"; // app_name argumentList << "nheko"; // app_name
argumentList << (uint)0; // replace_id argumentList << (uint)0; // replace_id
argumentList << ""; // app_icon argumentList << ""; // app_icon
argumentList << roomname; // summary argumentList << roomname; // summary
argumentList << text; // body argumentList << text; // body
// The list of actions has always the action name and then a localized version of that // The list of actions has always the action name and then a localized version of that
// action. Currently we just use an empty string for that. // action. Currently we just use an empty string for that.
// TODO(Nico): Look into what to actually put there. // TODO(Nico): Look into what to actually put there.
argumentList << (QStringList("default") << "" argumentList << (QStringList("default") << ""
<< "inline-reply" << "inline-reply"
<< ""); // actions << ""); // actions
argumentList << hints; // hints argumentList << hints; // hints
argumentList << (int)-1; // timeout in ms argumentList << (int)-1; // timeout in ms
static QDBusInterface notifyApp("org.freedesktop.Notifications", static QDBusInterface notifyApp("org.freedesktop.Notifications",
"/org/freedesktop/Notifications", "/org/freedesktop/Notifications",
"org.freedesktop.Notifications"); "org.freedesktop.Notifications");
auto call = auto call = notifyApp.asyncCallWithArgumentList("Notify", argumentList);
notifyApp.asyncCallWithArgumentList("Notify", argumentList); QDBusPendingCallWatcher watcher{QDBusPendingReply{call}};
QDBusPendingCallWatcher watcher{QDBusPendingReply{call}}; connect(&watcher,
connect(&watcher, &QDBusPendingCallWatcher::finished, this, [&watcher, this, &roomid, &eventid]() { &QDBusPendingCallWatcher::finished,
if (watcher.reply().type() == QDBusMessage::ErrorMessage) this,
qDebug() << "D-Bus Error:" << watcher.reply().errorMessage(); [&watcher, this, &roomid, &eventid]() {
else if (watcher.reply().type() == QDBusMessage::ErrorMessage)
notificationIds[watcher.reply().arguments().first().toUInt()] = roomEventId{roomid, eventid}; qDebug() << "D-Bus Error:" << watcher.reply().errorMessage();
}); else
notificationIds[watcher.reply().arguments().first().toUInt()] =
roomEventId{roomid, eventid};
});
} }
void void