Hello community, here is the log from the commit of package knotifications for openSUSE:Factory checked in at 2018-12-19 13:42:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/knotifications (Old) and /work/SRC/openSUSE:Factory/.knotifications.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "knotifications" Wed Dec 19 13:42:30 2018 rev:61 rq:658581 version:5.53.0 Changes: -------- --- /work/SRC/openSUSE:Factory/knotifications/knotifications.changes 2018-11-14 14:36:29.375144584 +0100 +++ /work/SRC/openSUSE:Factory/.knotifications.new.28833/knotifications.changes 2018-12-19 13:42:31.715862602 +0100 @@ -1,0 +2,11 @@ +Sun Dec 09 19:43:44 UTC 2018 - [email protected] + +- Update to 5.53.0 + * New feature release + * For more details please see: + * https://www.kde.org/announcements/kde-frameworks-5.53.0.php +- Changes since 5.52.0: + * Rename NotifyByFlatpak to NotifyByPortal + * Notification portal: support pixmaps in notifications + +------------------------------------------------------------------- Old: ---- knotifications-5.52.0.tar.xz New: ---- knotifications-5.53.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ knotifications.spec ++++++ --- /var/tmp/diff_new_pack.lKbyxd/_old 2018-12-19 13:42:32.443861577 +0100 +++ /var/tmp/diff_new_pack.lKbyxd/_new 2018-12-19 13:42:32.451861566 +0100 @@ -17,14 +17,14 @@ %define lname libKF5Notifications5 -%define _tar_path 5.52 +%define _tar_path 5.53 # Full KF5 version (e.g. 5.33.0) %{!?_kf5_version: %global _kf5_version %{version}} # Last major and minor KF5 version (e.g. 5.33) %{!?_kf5_bugfix_version: %define _kf5_bugfix_version %(echo %{_kf5_version} | awk -F. '{print $1"."$2}')} %bcond_without lang Name: knotifications -Version: 5.52.0 +Version: 5.53.0 Release: 0 Summary: KDE Desktop notifications License: LGPL-2.1-or-later ++++++ knotifications-5.52.0.tar.xz -> knotifications-5.53.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.52.0/CMakeLists.txt new/knotifications-5.53.0/CMakeLists.txt --- old/knotifications-5.52.0/CMakeLists.txt 2018-11-03 19:03:20.000000000 +0100 +++ new/knotifications-5.53.0/CMakeLists.txt 2018-12-01 15:57:47.000000000 +0100 @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 3.0) -set(KF5_VERSION "5.52.0") # handled by release scripts -set(KF5_DEP_VERSION "5.52.0") # handled by release scripts +set(KF5_VERSION "5.53.0") # handled by release scripts +set(KF5_DEP_VERSION "5.53.0") # handled by release scripts project(KNotifications VERSION ${KF5_VERSION}) # ECM setup include(FeatureSummary) -find_package(ECM 5.52.0 NO_MODULE) +find_package(ECM 5.53.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) @@ -31,7 +31,7 @@ SOVERSION 5) # Dependencies -set(REQUIRED_QT_VERSION 5.8.0) +set(REQUIRED_QT_VERSION 5.9.0) find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Widgets DBus) find_package(Qt5 ${REQUIRED_QT_VERSION} QUIET OPTIONAL_COMPONENTS TextToSpeech) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.52.0/po/id/knotifications5_qt.po new/knotifications-5.53.0/po/id/knotifications5_qt.po --- old/knotifications-5.52.0/po/id/knotifications5_qt.po 2018-11-03 19:03:20.000000000 +0100 +++ new/knotifications-5.53.0/po/id/knotifications5_qt.po 2018-12-01 15:57:47.000000000 +0100 @@ -2,20 +2,22 @@ # Copyright (C) 2010 This_file_is_part_of_KDE # This file is distributed under the same license as the kdelibs4 package. # Andhika Padmawan <[email protected]>, 2010-2014. +# Wantoyo <[email protected]>, 2018. # msgid "" msgstr "" "Project-Id-Version: kdelibs4\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" "POT-Creation-Date: 2014-03-23 01:50+0000\n" -"PO-Revision-Date: 2014-06-23 21:24+0700\n" -"Last-Translator: Andhika Padmawan <[email protected]>\n" -"Language-Team: Indonesian <[email protected]>\n" +"PO-Revision-Date: 2018-11-18 17:12+0700\n" +"Last-Translator: Wantoyo <[email protected]>\n" +"Language-Team: Indonesian <[email protected]>\n" "Language: id\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Lokalize 2.0\n" "X-Qt-Contexts: true\n" #: knotificationrestrictions.cpp:192 @@ -31,7 +33,7 @@ #: kstatusnotifieritem.cpp:804 msgctxt "KStatusNotifierItem|" msgid "Quit" -msgstr "Keluar" +msgstr "Berhenti" #: kstatusnotifieritem.cpp:1053 msgctxt "KStatusNotifierItem|" @@ -47,4 +49,4 @@ #: kstatusnotifieritem.cpp:1070 msgctxt "KStatusNotifierItem|" msgid "Confirm Quit From System Tray" -msgstr "Konfirmasi Keluar Dari Baki Sistem" +msgstr "Konfirmasi Berhenti Dari Baki Sistem" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.52.0/po/nb/knotifications5_qt.po new/knotifications-5.53.0/po/nb/knotifications5_qt.po --- old/knotifications-5.52.0/po/nb/knotifications5_qt.po 2018-11-03 19:03:20.000000000 +0100 +++ new/knotifications-5.53.0/po/nb/knotifications5_qt.po 2018-12-01 15:57:47.000000000 +0100 @@ -31,28 +31,28 @@ msgid "Unknown Application" msgstr "Ukjent program" -#: kstatusnotifieritem.cpp:501 kstatusnotifieritem.cpp:1059 +#: kstatusnotifieritem.cpp:501 kstatusnotifieritem.cpp:1055 msgctxt "KStatusNotifierItem|" msgid "&Minimize" msgstr "&Minimer" -#: kstatusnotifieritem.cpp:806 +#: kstatusnotifieritem.cpp:804 msgctxt "KStatusNotifierItem|" msgid "Quit" msgstr "Avslutt" -#: kstatusnotifieritem.cpp:1057 +#: kstatusnotifieritem.cpp:1053 msgctxt "KStatusNotifierItem|" msgid "&Restore" msgstr "&Gjenopprett" -#: kstatusnotifieritem.cpp:1071 +#: kstatusnotifieritem.cpp:1067 #, 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:1074 +#: kstatusnotifieritem.cpp:1070 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.52.0/po/se/knotifications5_qt.po new/knotifications-5.53.0/po/se/knotifications5_qt.po --- old/knotifications-5.52.0/po/se/knotifications5_qt.po 2018-11-03 19:03:20.000000000 +0100 +++ new/knotifications-5.53.0/po/se/knotifications5_qt.po 2018-12-01 15:57:47.000000000 +0100 @@ -26,31 +26,31 @@ msgid "Unknown Application" msgstr "Amas prográmma" -#: kstatusnotifieritem.cpp:501 kstatusnotifieritem.cpp:1059 +#: kstatusnotifieritem.cpp:501 kstatusnotifieritem.cpp:1055 #, fuzzy msgctxt "KStatusNotifierItem|" msgid "&Minimize" msgstr "&Minimere" -#: kstatusnotifieritem.cpp:806 +#: kstatusnotifieritem.cpp:804 #, fuzzy msgctxt "KStatusNotifierItem|" msgid "Quit" msgstr "Heaittit" -#: kstatusnotifieritem.cpp:1057 +#: kstatusnotifieritem.cpp:1053 #, fuzzy msgctxt "KStatusNotifierItem|" msgid "&Restore" msgstr "&Máhcat" -#: kstatusnotifieritem.cpp:1071 +#: kstatusnotifieritem.cpp:1067 #, 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:1074 +#: kstatusnotifieritem.cpp:1070 #, fuzzy msgctxt "KStatusNotifierItem|" msgid "Confirm Quit From System Tray" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.52.0/po/sr/knotifications5_qt.po new/knotifications-5.53.0/po/sr/knotifications5_qt.po --- old/knotifications-5.52.0/po/sr/knotifications5_qt.po 2018-11-03 19:03:20.000000000 +0100 +++ new/knotifications-5.53.0/po/sr/knotifications5_qt.po 2018-12-01 15:57:47.000000000 +0100 @@ -29,7 +29,7 @@ msgid "Unknown Application" msgstr "непознат програм" -#: kstatusnotifieritem.cpp:501 kstatusnotifieritem.cpp:1051 +#: kstatusnotifieritem.cpp:501 kstatusnotifieritem.cpp:1055 msgctxt "KStatusNotifierItem|" msgid "&Minimize" msgstr "&Минимизуј" @@ -39,19 +39,19 @@ msgid "Quit" msgstr "Напусти" -#: kstatusnotifieritem.cpp:1049 +#: kstatusnotifieritem.cpp:1053 msgctxt "KStatusNotifierItem|" msgid "&Restore" msgstr "&Обнови" -#: kstatusnotifieritem.cpp:1063 +#: kstatusnotifieritem.cpp:1067 #, qt-format msgctxt "KStatusNotifierItem|" msgid "<qt>Are you sure you want to quit <b>%1</b>?</qt>" msgstr "<qt>Желите ли заиста да напустите програм <b>%1</b>?</qt>" # >> @title:window -#: kstatusnotifieritem.cpp:1066 +#: kstatusnotifieritem.cpp:1070 msgctxt "KStatusNotifierItem|" msgid "Confirm Quit From System Tray" msgstr "Потврда напуштања преко системске касете" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.52.0/po/sr@ijekavian/knotifications5_qt.po new/knotifications-5.53.0/po/sr@ijekavian/knotifications5_qt.po --- old/knotifications-5.52.0/po/sr@ijekavian/knotifications5_qt.po 2018-11-03 19:03:20.000000000 +0100 +++ new/knotifications-5.53.0/po/sr@ijekavian/knotifications5_qt.po 2018-12-01 15:57:47.000000000 +0100 @@ -28,7 +28,7 @@ msgid "Unknown Application" msgstr "непознат програм" -#: kstatusnotifieritem.cpp:501 kstatusnotifieritem.cpp:1051 +#: kstatusnotifieritem.cpp:501 kstatusnotifieritem.cpp:1055 msgctxt "KStatusNotifierItem|" msgid "&Minimize" msgstr "&Минимизуј" @@ -38,19 +38,19 @@ msgid "Quit" msgstr "Напусти" -#: kstatusnotifieritem.cpp:1049 +#: kstatusnotifieritem.cpp:1053 msgctxt "KStatusNotifierItem|" msgid "&Restore" msgstr "&Обнови" -#: kstatusnotifieritem.cpp:1063 +#: kstatusnotifieritem.cpp:1067 #, qt-format msgctxt "KStatusNotifierItem|" msgid "<qt>Are you sure you want to quit <b>%1</b>?</qt>" msgstr "<qt>Желите ли заиста да напустите програм <b>%1</b>?</qt>" # >> @title:window -#: kstatusnotifieritem.cpp:1066 +#: kstatusnotifieritem.cpp:1070 msgctxt "KStatusNotifierItem|" msgid "Confirm Quit From System Tray" msgstr "Потврда напуштања преко системске касете" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.52.0/po/sr@ijekavianlatin/knotifications5_qt.po new/knotifications-5.53.0/po/sr@ijekavianlatin/knotifications5_qt.po --- old/knotifications-5.52.0/po/sr@ijekavianlatin/knotifications5_qt.po 2018-11-03 19:03:20.000000000 +0100 +++ new/knotifications-5.53.0/po/sr@ijekavianlatin/knotifications5_qt.po 2018-12-01 15:57:47.000000000 +0100 @@ -28,7 +28,7 @@ msgid "Unknown Application" msgstr "nepoznat program" -#: kstatusnotifieritem.cpp:501 kstatusnotifieritem.cpp:1051 +#: kstatusnotifieritem.cpp:501 kstatusnotifieritem.cpp:1055 msgctxt "KStatusNotifierItem|" msgid "&Minimize" msgstr "&Minimizuj" @@ -38,19 +38,19 @@ msgid "Quit" msgstr "Napusti" -#: kstatusnotifieritem.cpp:1049 +#: kstatusnotifieritem.cpp:1053 msgctxt "KStatusNotifierItem|" msgid "&Restore" msgstr "&Obnovi" -#: kstatusnotifieritem.cpp:1063 +#: kstatusnotifieritem.cpp:1067 #, qt-format msgctxt "KStatusNotifierItem|" msgid "<qt>Are you sure you want to quit <b>%1</b>?</qt>" msgstr "<qt>Želite li zaista da napustite program <b>%1</b>?</qt>" # >> @title:window -#: kstatusnotifieritem.cpp:1066 +#: kstatusnotifieritem.cpp:1070 msgctxt "KStatusNotifierItem|" msgid "Confirm Quit From System Tray" msgstr "Potvrda napuštanja preko sistemske kasete" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.52.0/po/sr@latin/knotifications5_qt.po new/knotifications-5.53.0/po/sr@latin/knotifications5_qt.po --- old/knotifications-5.52.0/po/sr@latin/knotifications5_qt.po 2018-11-03 19:03:20.000000000 +0100 +++ new/knotifications-5.53.0/po/sr@latin/knotifications5_qt.po 2018-12-01 15:57:47.000000000 +0100 @@ -28,7 +28,7 @@ msgid "Unknown Application" msgstr "nepoznat program" -#: kstatusnotifieritem.cpp:501 kstatusnotifieritem.cpp:1051 +#: kstatusnotifieritem.cpp:501 kstatusnotifieritem.cpp:1055 msgctxt "KStatusNotifierItem|" msgid "&Minimize" msgstr "&Minimizuj" @@ -38,19 +38,19 @@ msgid "Quit" msgstr "Napusti" -#: kstatusnotifieritem.cpp:1049 +#: kstatusnotifieritem.cpp:1053 msgctxt "KStatusNotifierItem|" msgid "&Restore" msgstr "&Obnovi" -#: kstatusnotifieritem.cpp:1063 +#: kstatusnotifieritem.cpp:1067 #, qt-format msgctxt "KStatusNotifierItem|" msgid "<qt>Are you sure you want to quit <b>%1</b>?</qt>" msgstr "<qt>Želite li zaista da napustite program <b>%1</b>?</qt>" # >> @title:window -#: kstatusnotifieritem.cpp:1066 +#: kstatusnotifieritem.cpp:1070 msgctxt "KStatusNotifierItem|" msgid "Confirm Quit From System Tray" msgstr "Potvrda napuštanja preko sistemske kasete" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.52.0/po/zh_CN/knotifications5_qt.po new/knotifications-5.53.0/po/zh_CN/knotifications5_qt.po --- old/knotifications-5.52.0/po/zh_CN/knotifications5_qt.po 2018-11-03 19:03:20.000000000 +0100 +++ new/knotifications-5.53.0/po/zh_CN/knotifications5_qt.po 2018-12-01 15:57:47.000000000 +0100 @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: kdeorg\n" -"PO-Revision-Date: 2018-10-09 18:38\n" +"PO-Revision-Date: 2018-11-12 09:13\n" "Last-Translator: guoyunhe <[email protected]>\n" "Language-Team: Chinese Simplified\n" "Language: zh_CN\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.52.0/src/CMakeLists.txt new/knotifications-5.53.0/src/CMakeLists.txt --- old/knotifications-5.52.0/src/CMakeLists.txt 2018-11-03 19:03:20.000000000 +0100 +++ new/knotifications-5.53.0/src/CMakeLists.txt 2018-12-01 15:57:47.000000000 +0100 @@ -22,7 +22,7 @@ imageconverter.cpp #needed to marshal images for sending over dbus by NotifyByPopup notifybypopupgrowl.cpp notifybyexecute.cpp - notifybyflatpak.cpp + notifybyportal.cpp notifybylogfile.cpp notifybytaskbar.cpp ${knotifications_QM_LOADER} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.52.0/src/knotificationmanager.cpp new/knotifications-5.53.0/src/knotificationmanager.cpp --- old/knotifications-5.52.0/src/knotificationmanager.cpp 2018-11-03 19:03:20.000000000 +0100 +++ new/knotifications-5.53.0/src/knotificationmanager.cpp 2018-12-01 15:57:47.000000000 +0100 @@ -38,7 +38,7 @@ #include "notifybylogfile.h" #include "notifybytaskbar.h" #include "notifybyexecute.h" -#include "notifybyflatpak.h" +#include "notifybyportal.h" #include "debug_p.h" #if defined(HAVE_CANBERRA) @@ -89,6 +89,8 @@ if (!runtimeDir.isEmpty()) { d->inSandbox = QFileInfo::exists(QFile::decodeName(runtimeDir) + QLatin1String("/flatpak-info")); } + } else if (qEnvironmentVariableIsSet("SNAP")) { + d->inSandbox = true; } if (d->inSandbox) { @@ -131,7 +133,7 @@ // to instantiate an externally supplied plugin. if (action == QLatin1String("Popup")) { if (d->inSandbox && d->portalDBusServiceExists) { - plugin = new NotifyByFlatpak(this); + plugin = new NotifyByPortal(this); } else { plugin = new NotifyByPopup(this); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.52.0/src/notifybyflatpak.cpp new/knotifications-5.53.0/src/notifybyflatpak.cpp --- old/knotifications-5.52.0/src/notifybyflatpak.cpp 2018-11-03 19:03:20.000000000 +0100 +++ new/knotifications-5.53.0/src/notifybyflatpak.cpp 1970-01-01 01:00:00.000000000 +0100 @@ -1,298 +0,0 @@ -/* - 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 <QDBusConnection> -#include <QDBusConnectionInterface> -#include <QDBusServiceWatcher> -#include <QDBusError> -#include <QDBusMessage> -#include <QDBusMetaType> -#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(QString::fromLatin1(portalDbusServiceName)); - - if (d->dbusServiceExists) { - onServiceOwnerChanged(QString::fromLatin1(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(QString::fromLatin1(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 occurred. - } - } -} - -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 - QString::fromLatin1(portalDbusPath), - QString::fromLatin1(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(QString::fromLatin1(portalDbusServiceName), - QString::fromLatin1(portalDbusPath), - QString::fromLatin1(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(QString::fromLatin1(portalDbusServiceName), - QString::fromLatin1(portalDbusPath), - QString::fromLatin1(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.52.0/src/notifybyflatpak.h new/knotifications-5.53.0/src/notifybyflatpak.h --- old/knotifications-5.52.0/src/notifybyflatpak.h 2018-11-03 19:03:20.000000000 +0100 +++ new/knotifications-5.53.0/src/notifybyflatpak.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,63 +0,0 @@ -/* - 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: - explicit NotifyByFlatpak(QObject *parent = nullptr); - ~NotifyByFlatpak() override; - - QString optionName() override { return QStringLiteral("Popup"); } - void notify(KNotification *notification, KNotifyConfig *notifyConfig) override; - void close(KNotification *notification) override; - void update(KNotification *notification, KNotifyConfig *config) override; - -private Q_SLOTS: - - // slot to catch appearance or disappearance 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.52.0/src/notifybyportal.cpp new/knotifications-5.53.0/src/notifybyportal.cpp --- old/knotifications-5.52.0/src/notifybyportal.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/knotifications-5.53.0/src/notifybyportal.cpp 2018-12-01 15:57:47.000000000 +0100 @@ -0,0 +1,340 @@ +/* + 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 "notifybyportal.h" + +#include "knotifyconfig.h" +#include "knotification.h" +#include "debug_p.h" + +#include <QBuffer> +#include <QDBusConnection> +#include <QDBusConnectionInterface> +#include <QDBusServiceWatcher> +#include <QDBusError> +#include <QDBusMessage> +#include <QDBusMetaType> +#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 NotifyByPortalPrivate { +public: + struct PortalIcon { + QString str; + QDBusVariant data; + }; + + NotifyByPortalPrivate(NotifyByPortal *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>> portalNotifications; + + /* + * Holds the id that will be assigned to the next notification source + * that will be created + */ + uint nextId; + + NotifyByPortal * const q; +}; + +QDBusArgument &operator<<(QDBusArgument &argument, const NotifyByPortalPrivate::PortalIcon &icon) +{ + argument.beginStructure(); + argument << icon.str << icon.data; + argument.endStructure(); + return argument; +} + +const QDBusArgument &operator>>(const QDBusArgument &argument, NotifyByPortalPrivate::PortalIcon &icon) +{ + argument.beginStructure(); + argument >> icon.str >> icon.data; + argument.endStructure(); + return argument; +} + +Q_DECLARE_METATYPE(NotifyByPortalPrivate::PortalIcon) + +//--------------------------------------------------------------------------------------- + +NotifyByPortal::NotifyByPortal(QObject *parent) + : KNotificationPlugin(parent), + d(new NotifyByPortalPrivate(this)) +{ + // check if service already exists on plugin instantiation + QDBusConnectionInterface *interface = QDBusConnection::sessionBus().interface(); + d->dbusServiceExists = interface && interface->isServiceRegistered(QString::fromLatin1(portalDbusServiceName)); + + if (d->dbusServiceExists) { + onServiceOwnerChanged(QString::fromLatin1(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(QString::fromLatin1(portalDbusServiceName)); + connect(watcher,&QDBusServiceWatcher::serviceOwnerChanged, this, &NotifyByPortal::onServiceOwnerChanged); +} + + +NotifyByPortal::~NotifyByPortal() +{ + delete d; +} + +void NotifyByPortal::notify(KNotification *notification, KNotifyConfig *notifyConfig) +{ + notify(notification, *notifyConfig); +} + +void NotifyByPortal::notify(KNotification *notification, const KNotifyConfig ¬ifyConfig) +{ + if (d->portalNotifications.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 occurred. + } + } +} + +void NotifyByPortal::close(KNotification *notification) +{ + if (d->dbusServiceExists) { + d->closePortalNotification(notification); + } +} + +void NotifyByPortal::update(KNotification *notification, KNotifyConfig *notifyConfig) +{ + // TODO not supported by portals + Q_UNUSED(notification); + Q_UNUSED(notifyConfig); +} + +void NotifyByPortal::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->portalNotifications) { + if (n) { + emit finished(n); + } + } + + d->portalNotifications.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 + QString::fromLatin1(portalDbusPath), + QString::fromLatin1(portalDbusInterfaceName), + QStringLiteral("ActionInvoked"), + this, + SLOT(onPortalNotificationActionInvoked(QString,QString,QVariantList))); + if (!connected) { + qCWarning(LOG_KNOTIFICATIONS) << "warning: failed to connect to ActionInvoked dbus signal"; + } + } +} + +void NotifyByPortal::onPortalNotificationActionInvoked(const QString &id, const QString &action, const QVariantList ¶meter) +{ + Q_UNUSED(parameter); + + auto iter = d->portalNotifications.find(id.toUInt()); + if (iter == d->portalNotifications.end()) { + return; + } + + KNotification *n = *iter; + if (n) { + emit actionInvoked(n->id(), action.toUInt()); + } else { + d->portalNotifications.erase(iter); + } +} + +void NotifyByPortalPrivate::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 NotifyByPortalPrivate::sendNotificationToPortal(KNotification *notification, const KNotifyConfig ¬ifyConfig_nocheck) +{ + QDBusMessage dbusNotificationMessage; + dbusNotificationMessage = QDBusMessage::createMethodCall(QString::fromLatin1(portalDbusServiceName), + QString::fromLatin1(portalDbusPath), + QString::fromLatin1(portalDbusInterfaceName), + QStringLiteral("AddNotification")); + + QVariantList args; + // Will be used only with xdg-desktop-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> >(); + qDBusRegisterMetaType<PortalIcon>(); + + if (!notification->pixmap().isNull()) { + QByteArray pixmapData; + QBuffer buffer(&pixmapData); + buffer.open(QIODevice::WriteOnly); + notification->pixmap().save(&buffer, "PNG"); + buffer.close(); + + PortalIcon icon; + icon.str = QStringLiteral("bytes"); + icon.data.setVariant(pixmapData); + portalArgs.insert(QStringLiteral("icon"), QVariant::fromValue<PortalIcon>(icon)); + } else { + // Use this for now for backwards compatibility, we can as well set the variant to be (sv) where the + // string is keyword "themed" and the variant is an array of strings with icon names + 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 + portalNotifications.insert(nextId++, notification); + + return true; +} + +void NotifyByPortalPrivate::closePortalNotification(KNotification *notification) +{ + uint id = portalNotifications.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(QString::fromLatin1(portalDbusServiceName), + QString::fromLatin1(portalDbusPath), + QString::fromLatin1(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.52.0/src/notifybyportal.h new/knotifications-5.53.0/src/notifybyportal.h --- old/knotifications-5.52.0/src/notifybyportal.h 1970-01-01 01:00:00.000000000 +0100 +++ new/knotifications-5.53.0/src/notifybyportal.h 2018-12-01 15:57:47.000000000 +0100 @@ -0,0 +1,64 @@ +/* + 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 NOTIFYBYPORTAL_H +#define NOTIFYBYPORTAL_H + +#include "knotificationplugin.h" + +#include <QDBusVariant> +#include <QStringList> +#include <QVariantList> + +class KNotification; +class NotifyByPortalPrivate; + +class NotifyByPortal : public KNotificationPlugin +{ + Q_OBJECT +public: + explicit NotifyByPortal(QObject *parent = nullptr); + ~NotifyByPortal() override; + + QString optionName() override { return QStringLiteral("Popup"); } + void notify(KNotification *notification, KNotifyConfig *notifyConfig) override; + void close(KNotification *notification) override; + void update(KNotification *notification, KNotifyConfig *config) override; + +private Q_SLOTS: + + // slot to catch appearance or disappearance 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); + + NotifyByPortalPrivate * const d; +}; + +#endif +
