1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

DesktopNotifications: Set app icon to preview notification

Closes #1859
This commit is contained in:
David Rosca 2018-01-09 08:22:39 +01:00
parent 80eb072bb1
commit 6b90851d8c

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* Falkon - Qt web browser * Falkon - Qt web browser
* Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com> * Copyright (C) 2010-2018 David Rosca <nowrep@gmail.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -19,6 +19,8 @@
#include "desktopnotification.h" #include "desktopnotification.h"
#include "datapaths.h" #include "datapaths.h"
#include "settings.h" #include "settings.h"
#include "mainapplication.h"
#include "browserwindow.h"
#include <QFile> #include <QFile>
#include <QDir> #include <QDir>
@ -100,19 +102,12 @@ void DesktopNotificationsFactory::showNotification(const QPixmap &icon, const QS
void DesktopNotificationsFactory::nativeNotificationPreview() void DesktopNotificationsFactory::nativeNotificationPreview()
{ {
#if defined(Q_OS_UNIX) && !defined(DISABLE_DBUS) Type type = m_notifType;
QDBusInterface dbus("org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications", QDBusConnection::sessionBus());
QVariantList args; m_notifType = DesktopNative;
args.append(QLatin1String("falkon")); const QPixmap icon = mApp->getWindow()->windowIcon().pixmap(64);
args.append(m_uint); showNotification(icon, QObject::tr("Native System Notification"), tr("Preview"));
args.append(QString()); m_notifType = type;
args.append(QObject::tr("Native System Notification"));
args.append(QString());
args.append(QStringList());
args.append(QVariantMap());
args.append(m_timeout);
dbus.callWithCallback("Notify", args, this, SLOT(updateLastId(QDBusMessage)), SLOT(error(QDBusError)));
#endif
} }
#if defined(Q_OS_UNIX) && !defined(DISABLE_DBUS) #if defined(Q_OS_UNIX) && !defined(DISABLE_DBUS)