From 6b90851d8ce59ef5f571d4034b9b2016a9c47da3 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Tue, 9 Jan 2018 08:22:39 +0100 Subject: [PATCH] DesktopNotifications: Set app icon to preview notification Closes #1859 --- .../desktopnotificationsfactory.cpp | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/lib/notifications/desktopnotificationsfactory.cpp b/src/lib/notifications/desktopnotificationsfactory.cpp index c6273944c..46166d994 100644 --- a/src/lib/notifications/desktopnotificationsfactory.cpp +++ b/src/lib/notifications/desktopnotificationsfactory.cpp @@ -1,6 +1,6 @@ /* ============================================================ * Falkon - Qt web browser -* Copyright (C) 2010-2017 David Rosca +* Copyright (C) 2010-2018 David Rosca * * 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 @@ -19,6 +19,8 @@ #include "desktopnotification.h" #include "datapaths.h" #include "settings.h" +#include "mainapplication.h" +#include "browserwindow.h" #include #include @@ -100,19 +102,12 @@ void DesktopNotificationsFactory::showNotification(const QPixmap &icon, const QS void DesktopNotificationsFactory::nativeNotificationPreview() { -#if defined(Q_OS_UNIX) && !defined(DISABLE_DBUS) - QDBusInterface dbus("org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications", QDBusConnection::sessionBus()); - QVariantList args; - args.append(QLatin1String("falkon")); - args.append(m_uint); - args.append(QString()); - 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 + Type type = m_notifType; + + m_notifType = DesktopNative; + const QPixmap icon = mApp->getWindow()->windowIcon().pixmap(64); + showNotification(icon, QObject::tr("Native System Notification"), tr("Preview")); + m_notifType = type; } #if defined(Q_OS_UNIX) && !defined(DISABLE_DBUS)