Files
flameshot/src/utils/systemnotification.cpp
lupoDharkael 924d467c53 general cleanup
-use of the override keyword
-delete unused code
-const correctness
-more uniform code style
-for each with const references when possible
-getters no longer use the word 'get'
-others
2017-08-09 13:20:07 +02:00

36 lines
1.2 KiB
C++

#include "systemnotification.h"
#include "src/utils/confighandler.h"
#include <QDBusConnection>
#include <QDBusMessage>
#include <QDBusInterface>
#include <QApplication>
SystemNotification::SystemNotification(QObject *parent) : QObject(parent) {
m_interface = new QDBusInterface("org.freedesktop.Notifications",
"/org/freedesktop/Notifications",
"org.freedesktop.Notifications",
QDBusConnection::sessionBus(),
this);
}
void SystemNotification::sendMessage(
const QString &text,
const QString &title,
const int timeout)
{
if(!ConfigHandler().desktopNotificationValue()) {
return;
}
QList<QVariant> args;
args << (qAppName()) //appname
<< static_cast<unsigned int>(0) //id
<< "flameshot.png" //icon
<< title //summary
<< text //body
<< QStringList() //actions
<< QVariantMap() //hints
<< timeout; //timeout
m_interface->callWithArgumentList(QDBus::AutoDetect, "Notify", args);
}