Hello community, here is the log from the commit of package knotifications for openSUSE:Factory checked in at 2017-03-28 15:11:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/knotifications (Old) and /work/SRC/openSUSE:Factory/.knotifications.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "knotifications" Tue Mar 28 15:11:22 2017 rev:40 rq:481526 version:5.32.0 Changes: -------- --- /work/SRC/openSUSE:Factory/knotifications/knotifications.changes 2017-03-03 17:03:30.365193436 +0100 +++ /work/SRC/openSUSE:Factory/.knotifications.new/knotifications.changes 2017-03-28 15:11:25.357348035 +0200 @@ -1,0 +2,18 @@ +Sun Mar 19 14:50:49 CET 2017 - [email protected] + +- Update to 5.32.0 + * New feature release + * For more details please see: + * https://www.kde.org/announcements/kde-frameworks-5.32.0.php +- Changes since 5.31.0: + * Commit translations from l10n-kf5 + * Upgrade ECM and KF5 version requirements for 5.32.0 release. + * Removed some dead code. + * Upgrade KF5 version to 5.32.0. + * Added missing @since + * Add support for flatpak portals + * Only use qApp->desktopFileName() when compiling with Qt >= 5.7.0 + * Send desktopfilename as part of notifyByPopup hints + * [KStatusNotifierItem] Restore minimized window as normal + +------------------------------------------------------------------- Old: ---- knotifications-5.31.0.tar.xz New: ---- knotifications-5.32.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ knotifications.spec ++++++ --- /var/tmp/diff_new_pack.08wDXo/_old 2017-03-28 15:11:26.397200726 +0200 +++ /var/tmp/diff_new_pack.08wDXo/_new 2017-03-28 15:11:26.397200726 +0200 @@ -18,9 +18,9 @@ %bcond_without lang %define lname libKF5Notifications5 -%define _tar_path 5.31 +%define _tar_path 5.32 Name: knotifications -Version: 5.31.0 +Version: 5.32.0 Release: 0 %define kf5_version %{version} BuildRequires: cmake >= 3.0 ++++++ knotifications-5.31.0.tar.xz -> knotifications-5.32.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.31.0/CMakeLists.txt new/knotifications-5.32.0/CMakeLists.txt --- old/knotifications-5.31.0/CMakeLists.txt 2017-02-05 12:06:31.000000000 +0100 +++ new/knotifications-5.32.0/CMakeLists.txt 2017-03-04 17:17:36.000000000 +0100 @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 3.0) -set(KF5_VERSION "5.31.0") # handled by release scripts -set(KF5_DEP_VERSION "5.31.0") # handled by release scripts +set(KF5_VERSION "5.32.0") # handled by release scripts +set(KF5_DEP_VERSION "5.32.0") # handled by release scripts project(KNotifications VERSION ${KF5_VERSION}) # ECM setup include(FeatureSummary) -find_package(ECM 5.31.0 NO_MODULE) +find_package(ECM 5.32.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.31.0/po/nb/knotifications5_qt.po new/knotifications-5.32.0/po/nb/knotifications5_qt.po --- old/knotifications-5.31.0/po/nb/knotifications5_qt.po 2017-02-05 12:06:31.000000000 +0100 +++ new/knotifications-5.32.0/po/nb/knotifications5_qt.po 2017-03-04 17:17:36.000000000 +0100 @@ -31,28 +31,28 @@ msgid "Unknown Application" msgstr "Ukjent program" -#: kstatusnotifieritem.cpp:460 kstatusnotifieritem.cpp:939 +#: kstatusnotifieritem.cpp:460 kstatusnotifieritem.cpp:938 msgctxt "KStatusNotifierItem|" msgid "&Minimize" msgstr "&Minimer" -#: kstatusnotifieritem.cpp:731 +#: kstatusnotifieritem.cpp:730 msgctxt "KStatusNotifierItem|" msgid "Quit" msgstr "Avslutt" -#: kstatusnotifieritem.cpp:937 +#: kstatusnotifieritem.cpp:936 msgctxt "KStatusNotifierItem|" msgid "&Restore" msgstr "&Gjenopprett" -#: kstatusnotifieritem.cpp:951 +#: kstatusnotifieritem.cpp:950 #, qt-format msgctxt "KStatusNotifierItem|" msgid "<qt>Are you sure you want to quit <b>%1</b>?</qt>" msgstr "<qt>Vil du avslutte <b>%1</b>?</qt>" -#: kstatusnotifieritem.cpp:954 +#: kstatusnotifieritem.cpp:953 msgctxt "KStatusNotifierItem|" msgid "Confirm Quit From System Tray" msgstr "Bekreft «Avslutt» fra systemkurven" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.31.0/po/se/knotifications5_qt.po new/knotifications-5.32.0/po/se/knotifications5_qt.po --- old/knotifications-5.31.0/po/se/knotifications5_qt.po 2017-02-05 12:06:31.000000000 +0100 +++ new/knotifications-5.32.0/po/se/knotifications5_qt.po 2017-03-04 17:17:36.000000000 +0100 @@ -26,31 +26,31 @@ msgid "Unknown Application" msgstr "Amas prográmma" -#: kstatusnotifieritem.cpp:460 kstatusnotifieritem.cpp:939 +#: kstatusnotifieritem.cpp:460 kstatusnotifieritem.cpp:938 #, fuzzy msgctxt "KStatusNotifierItem|" msgid "&Minimize" msgstr "&Minimere" -#: kstatusnotifieritem.cpp:731 +#: kstatusnotifieritem.cpp:730 #, fuzzy msgctxt "KStatusNotifierItem|" msgid "Quit" msgstr "Heaittit" -#: kstatusnotifieritem.cpp:937 +#: kstatusnotifieritem.cpp:936 #, fuzzy msgctxt "KStatusNotifierItem|" msgid "&Restore" msgstr "&Máhcat" -#: kstatusnotifieritem.cpp:951 +#: kstatusnotifieritem.cpp:950 #, fuzzy, qt-format msgctxt "KStatusNotifierItem|" msgid "<qt>Are you sure you want to quit <b>%1</b>?</qt>" msgstr "<qt>Háliidatgo duođaid heaittihit <b>%1</b>?</qt>" -#: kstatusnotifieritem.cpp:954 +#: kstatusnotifieritem.cpp:953 #, fuzzy msgctxt "KStatusNotifierItem|" msgid "Confirm Quit From System Tray" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.31.0/src/CMakeLists.txt new/knotifications-5.32.0/src/CMakeLists.txt --- old/knotifications-5.31.0/src/CMakeLists.txt 2017-02-05 12:06:31.000000000 +0100 +++ new/knotifications-5.32.0/src/CMakeLists.txt 2017-03-04 17:17:36.000000000 +0100 @@ -19,6 +19,7 @@ imageconverter.cpp #needed to marshal images for sending over dbus by NotifyByPopup notifybypopupgrowl.cpp notifybyexecute.cpp + notifybyflatpak.cpp notifybylogfile.cpp notifybytaskbar.cpp ${knotifications_QM_LOADER} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.31.0/src/knotification.h new/knotifications-5.32.0/src/knotification.h --- old/knotifications-5.31.0/src/knotification.h 2017-02-05 12:06:31.000000000 +0100 +++ new/knotifications-5.32.0/src/knotification.h 2017-03-04 17:17:36.000000000 +0100 @@ -399,6 +399,7 @@ /** * @return the default action, or an empty string if not set + * @since 5.31 */ QString defaultAction() const; @@ -418,6 +419,7 @@ * @param action Label of the default action. The label might or might not * be displayed to the user by the notification server, depending on the * implementation. Passing an empty string disables the default action. + * @since 5.31 */ void setDefaultAction(const QString &defaultAction); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.31.0/src/knotificationmanager.cpp new/knotifications-5.32.0/src/knotificationmanager.cpp --- old/knotifications-5.31.0/src/knotificationmanager.cpp 2017-02-05 12:06:31.000000000 +0100 +++ new/knotifications-5.32.0/src/knotificationmanager.cpp 2017-03-04 17:17:36.000000000 +0100 @@ -25,6 +25,8 @@ #include <QDBusConnection> #include <QPointer> #include <QBuffer> +#include <QFileInfo> +#include <QDBusConnectionInterface> #include <KPluginLoader> #include "knotifyconfig.h" @@ -34,6 +36,7 @@ #include "notifybylogfile.h" #include "notifybytaskbar.h" #include "notifybyexecute.h" +#include "notifybyflatpak.h" #include "debug_p.h" #ifdef HAVE_PHONON4QT5 @@ -74,7 +77,29 @@ d->notifyIdCounter = 0; qDeleteAll(d->notifyPlugins); d->notifyPlugins.clear(); - addPlugin(new NotifyByPopup(this)); + + bool inSandbox = false; + bool portalDBusServiceExists = false; + + if (!qEnvironmentVariableIsEmpty("XDG_RUNTIME_DIR")) { + const QString runtimeDir = qgetenv("XDG_RUNTIME_DIR"); + if (!runtimeDir.isEmpty()) { + inSandbox = QFileInfo::exists(runtimeDir + QLatin1String("/flatpak-info")); + } + } + + if (inSandbox) { + QDBusConnectionInterface *interface = QDBusConnection::sessionBus().interface(); + portalDBusServiceExists = interface->isServiceRegistered(QStringLiteral("org.freedesktop.portal.Desktop")); + } + + // If we are running in sandbox and flatpak portal dbus service is available send popup notifications + // through the portal + if (inSandbox && portalDBusServiceExists) { + addPlugin(new NotifyByFlatpak(this)); + } else { + addPlugin(new NotifyByPopup(this)); + } addPlugin(new NotifyByExecute(this)); addPlugin(new NotifyByLogfile(this)); @@ -223,13 +248,6 @@ void KNotificationManager::update(KNotification *n) { - QByteArray pixmapData; - if (!n->pixmap().isNull()) { - QBuffer buffer(&pixmapData); - buffer.open(QIODevice::WriteOnly); - n->pixmap().save(&buffer, "PNG"); - } - KNotifyConfig notifyConfig(n->appName(), n->contexts(), n->eventId()); Q_FOREACH (KNotificationPlugin *p, d->notifyPlugins) { @@ -239,15 +257,6 @@ void KNotificationManager::reemit(KNotification *n) { - QVariantList contextList; - typedef QPair<QString, QString> Context; - foreach (const Context &ctx, n->contexts()) { - QVariantList vl; - vl << ctx.first << ctx.second; - contextList << vl; - } - - notify(n); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.31.0/src/kstatusnotifieritem.cpp new/knotifications-5.32.0/src/kstatusnotifieritem.cpp --- old/knotifications-5.31.0/src/kstatusnotifieritem.cpp 2017-02-05 12:06:31.000000000 +0100 +++ new/knotifications-5.32.0/src/kstatusnotifieritem.cpp 2017-03-04 17:17:36.000000000 +0100 @@ -976,6 +976,8 @@ KWindowSystem::setCurrentDesktop(info.desktop()); } + auto state = associatedWidget->windowState() & ~Qt::WindowMinimized; + associatedWidget->setWindowState(state); associatedWidget->show(); associatedWidget->raise(); } else { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.31.0/src/notifybyflatpak.cpp new/knotifications-5.32.0/src/notifybyflatpak.cpp --- old/knotifications-5.31.0/src/notifybyflatpak.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/knotifications-5.32.0/src/notifybyflatpak.cpp 2017-03-04 17:17:36.000000000 +0100 @@ -0,0 +1,299 @@ +/* + Copyright (C) 2005-2006 by Olivier Goffart <ogoffart at kde.org> + Copyright (C) 2008 by Dmitry Suzdalev <[email protected]> + Copyright (C) 2014 by Martin Klapetek <[email protected]> + Copyright (C) 2016 Jan Grulich <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "notifybyflatpak.h" + +#include "knotifyconfig.h" +#include "knotification.h" +#include "debug_p.h" + +#include <QtDBus/QtDBus> +#include <QDBusConnection> +#include <QDBusConnectionInterface> +#include <QDBusServiceWatcher> +#include <QDBusError> +#include <QDBusMessage> +#include <QMap> + +#include <kconfiggroup.h> + +static const char portalDbusServiceName[] = "org.freedesktop.portal.Desktop"; +static const char portalDbusInterfaceName[] = "org.freedesktop.portal.Notification"; +static const char portalDbusPath[] = "/org/freedesktop/portal/desktop"; + +class NotifyByFlatpakPrivate { +public: + NotifyByFlatpakPrivate(NotifyByFlatpak *parent) : dbusServiceExists(false), q(parent) {} + + /** + * Sends notification to DBus "org.freedesktop.notifications" interface. + * @param id knotify-sid identifier of notification + * @param config notification data + * @param update If true, will request the DBus service to update + the notification with new data from \c notification + * Otherwise will put new notification on screen + * @return true for success or false if there was an error. + */ + bool sendNotificationToPortal(KNotification *notification, const KNotifyConfig &config); + + /** + * Sends request to close Notification with id to DBus "org.freedesktop.notifications" interface + * @param id knotify-side notification ID to close + */ + + void closePortalNotification(KNotification *notification); + /** + * Find the caption and the icon name of the application + */ + + void getAppCaptionAndIconName(const KNotifyConfig &config, QString *appCaption, QString *iconName); + + /** + * Specifies if DBus Notifications interface exists on session bus + */ + bool dbusServiceExists; + + /* + * As we communicate with the notification server over dbus + * we use only ids, this is for fast KNotifications lookup + */ + QHash<uint, QPointer<KNotification>> flatpakNotifications; + + /* + * Holds the id that will be assigned to the next notification source + * that will be created + */ + uint nextId; + + NotifyByFlatpak * const q; +}; + +//--------------------------------------------------------------------------------------- + +NotifyByFlatpak::NotifyByFlatpak(QObject *parent) + : KNotificationPlugin(parent), + d(new NotifyByFlatpakPrivate(this)) +{ + // check if service already exists on plugin instantiation + QDBusConnectionInterface *interface = QDBusConnection::sessionBus().interface(); + d->dbusServiceExists = interface && interface->isServiceRegistered(portalDbusServiceName); + + if (d->dbusServiceExists) { + onServiceOwnerChanged(portalDbusServiceName, QString(), QStringLiteral("_")); //connect signals + } + + // to catch register/unregister events from service in runtime + QDBusServiceWatcher *watcher = new QDBusServiceWatcher(this); + watcher->setConnection(QDBusConnection::sessionBus()); + watcher->setWatchMode(QDBusServiceWatcher::WatchForOwnerChange); + watcher->addWatchedService(portalDbusServiceName); + connect(watcher,&QDBusServiceWatcher::serviceOwnerChanged, this, &NotifyByFlatpak::onServiceOwnerChanged); +} + + +NotifyByFlatpak::~NotifyByFlatpak() +{ + delete d; +} + +void NotifyByFlatpak::notify(KNotification *notification, KNotifyConfig *notifyConfig) +{ + notify(notification, *notifyConfig); +} + +void NotifyByFlatpak::notify(KNotification *notification, const KNotifyConfig ¬ifyConfig) +{ + if (d->flatpakNotifications.contains(notification->id())) { + // notification is already on the screen, do nothing + finish(notification); + return; + } + + // check if Notifications DBus service exists on bus, use it if it does + if (d->dbusServiceExists) { + if (!d->sendNotificationToPortal(notification, notifyConfig)) { + finish(notification); //an error ocurred. + } + } +} + +void NotifyByFlatpak::close(KNotification *notification) +{ + if (d->dbusServiceExists) { + d->closePortalNotification(notification); + } +} + +void NotifyByFlatpak::update(KNotification *notification, KNotifyConfig *notifyConfig) +{ + // TODO not supported by portals + Q_UNUSED(notification); + Q_UNUSED(notifyConfig); +} + +void NotifyByFlatpak::onServiceOwnerChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner) +{ + Q_UNUSED(serviceName); + // close all notifications we currently hold reference to + Q_FOREACH (KNotification *n, d->flatpakNotifications) { + if (n) { + emit finished(n); + } + } + + d->flatpakNotifications.clear(); + + if (newOwner.isEmpty()) { + d->dbusServiceExists = false; + } else if (oldOwner.isEmpty()) { + d->dbusServiceExists = true; + d->nextId = 1; + + // connect to action invocation signals + bool connected = QDBusConnection::sessionBus().connect(QString(), // from any service + portalDbusPath, + portalDbusInterfaceName, + QStringLiteral("ActionInvoked"), + this, + SLOT(onPortalNotificationActionInvoked(QString,QString,QVariantList))); + if (!connected) { + qCWarning(LOG_KNOTIFICATIONS) << "warning: failed to connect to ActionInvoked dbus signal"; + } + } +} + +void NotifyByFlatpak::onPortalNotificationActionInvoked(const QString &id, const QString &action, const QVariantList ¶meter) +{ + Q_UNUSED(parameter); + + auto iter = d->flatpakNotifications.find(id.toUInt()); + if (iter == d->flatpakNotifications.end()) { + return; + } + + KNotification *n = *iter; + if (n) { + emit actionInvoked(n->id(), action.toUInt()); + } else { + d->flatpakNotifications.erase(iter); + } +} + +void NotifyByFlatpakPrivate::getAppCaptionAndIconName(const KNotifyConfig ¬ifyConfig, QString *appCaption, QString *iconName) +{ + KConfigGroup globalgroup(&(*notifyConfig.eventsfile), QStringLiteral("Global")); + *appCaption = globalgroup.readEntry("Name", globalgroup.readEntry("Comment", notifyConfig.appname)); + + KConfigGroup eventGroup(&(*notifyConfig.eventsfile), QStringLiteral("Event/%1").arg(notifyConfig.eventid)); + if (eventGroup.hasKey("IconName")) { + *iconName = eventGroup.readEntry("IconName", notifyConfig.appname); + } else { + *iconName = globalgroup.readEntry("IconName", notifyConfig.appname); + } +} + +bool NotifyByFlatpakPrivate::sendNotificationToPortal(KNotification *notification, const KNotifyConfig ¬ifyConfig_nocheck) +{ + QDBusMessage dbusNotificationMessage; + dbusNotificationMessage = QDBusMessage::createMethodCall(portalDbusServiceName, + portalDbusPath, + portalDbusInterfaceName, + QStringLiteral("AddNotification")); + + QVariantList args; + // Will be used only with flatpak portal + QVariantMap portalArgs; + + QString appCaption; + QString iconName; + getAppCaptionAndIconName(notifyConfig_nocheck, &appCaption, &iconName); + + //did the user override the icon name? + if (!notification->iconName().isEmpty()) { + iconName = notification->iconName(); + } + + QString title = notification->title().isEmpty() ? appCaption : notification->title(); + QString text = notification->text(); + + // galago spec defines action list to be list like + // (act_id1, action1, act_id2, action2, ...) + // + // assign id's to actions like it's done in fillPopup() method + // (i.e. starting from 1) + QList<QVariantMap> buttons; + buttons.reserve(notification->actions().count()); + + int actId = 0; + Q_FOREACH (const QString &actionName, notification->actions()) { + actId++; + QVariantMap button = { + {QStringLiteral("action"), QString::number(actId)}, + {QStringLiteral("label"), actionName} + }; + buttons << button; + } + + qDBusRegisterMetaType<QList<QVariantMap> >(); + portalArgs.insert(QStringLiteral("icon"), iconName); + portalArgs.insert(QStringLiteral("title"), title); + portalArgs.insert(QStringLiteral("body"), text); + portalArgs.insert(QStringLiteral("buttons"), QVariant::fromValue<QList<QVariantMap> >(buttons)); + + args.append(QString::number(nextId)); + args.append(portalArgs); + + dbusNotificationMessage.setArguments(args); + + QDBusPendingCall notificationCall = QDBusConnection::sessionBus().asyncCall(dbusNotificationMessage, -1); + + // If we are in sandbox we don't need to wait for returned notification id + flatpakNotifications.insert(nextId++, notification); + + return true; +} + +void NotifyByFlatpakPrivate::closePortalNotification(KNotification *notification) +{ + uint id = flatpakNotifications.key(notification, 0); + + qCDebug(LOG_KNOTIFICATIONS) << "ID: " << id; + + if (id == 0) { + qCDebug(LOG_KNOTIFICATIONS) << "not found dbus id to close" << notification->id(); + return; + } + + QDBusMessage m = QDBusMessage::createMethodCall(portalDbusServiceName, + portalDbusPath, + portalDbusInterfaceName, + QStringLiteral("RemoveNotification")); + m.setArguments({QString::number(id)}); + + // send(..) does not block + bool queued = QDBusConnection::sessionBus().send(m); + + if (!queued) { + qCWarning(LOG_KNOTIFICATIONS) << "Failed to queue dbus message for closing a notification"; + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.31.0/src/notifybyflatpak.h new/knotifications-5.32.0/src/notifybyflatpak.h --- old/knotifications-5.31.0/src/notifybyflatpak.h 1970-01-01 01:00:00.000000000 +0100 +++ new/knotifications-5.32.0/src/notifybyflatpak.h 2017-03-04 17:17:36.000000000 +0100 @@ -0,0 +1,63 @@ +/* + Copyright (C) 2005-2006 by Olivier Goffart <ogoffart at kde.org> + Copyright (C) 2008 by Dmitry Suzdalev <[email protected]> + Copyright (C) 2014 by Martin Klapetek <[email protected]> + Copyright (C) 2016 Jan Grulich <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef NOTIFYBYFLATPAK_H +#define NOTIFYBYFLATPAK_H + +#include "knotificationplugin.h" + +#include <QStringList> +#include <QVariantList> + +class KNotification; +class NotifyByFlatpakPrivate; + +class NotifyByFlatpak : public KNotificationPlugin +{ + Q_OBJECT +public: + NotifyByFlatpak(QObject *parent = 0l); + virtual ~NotifyByFlatpak(); + + QString optionName() Q_DECL_OVERRIDE { return QStringLiteral("Popup"); } + void notify(KNotification *notification, KNotifyConfig *notifyConfig) Q_DECL_OVERRIDE; + void close(KNotification *notification) Q_DECL_OVERRIDE; + void update(KNotification *notification, KNotifyConfig *config) Q_DECL_OVERRIDE; + +private Q_SLOTS: + + // slot to catch appearance or dissapearance of org.freedesktop.Desktop DBus service + void onServiceOwnerChanged(const QString &, const QString &, const QString &); + + void onPortalNotificationActionInvoked(const QString &, const QString &, const QVariantList &); + +private: + // TODO KF6, replace current public notify/update + void notify(KNotification *notification, const KNotifyConfig ¬ifyConfig); + void update(KNotification *notification, const KNotifyConfig ¬ifyConfig); + + NotifyByFlatpakPrivate * const d; +}; + +#endif + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.31.0/src/notifybypopup.cpp new/knotifications-5.32.0/src/notifybypopup.cpp --- old/knotifications-5.31.0/src/notifybypopup.cpp 2017-02-05 12:06:31.000000000 +0100 +++ new/knotifications-5.32.0/src/notifybypopup.cpp 2017-03-04 17:17:36.000000000 +0100 @@ -710,6 +710,12 @@ hintsMap[QStringLiteral("transient")] = true; } +#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) + if (!qApp->desktopFileName().isEmpty()) { + hintsMap[QStringLiteral("desktop-entry")] = qApp->desktopFileName(); + } +#endif + //FIXME - reenable/fix // let's see if we've got an image, and store the image in the hints map if (!notification->pixmap().isNull()) {
