Hello community,

here is the log from the commit of package knotifications for openSUSE:Factory 
checked in at 2019-01-21 10:21:20
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/knotifications (Old)
 and      /work/SRC/openSUSE:Factory/.knotifications.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "knotifications"

Mon Jan 21 10:21:20 2019 rev:62 rq:665830 version:5.54.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/knotifications/knotifications.changes    
2018-12-19 13:42:31.715862602 +0100
+++ /work/SRC/openSUSE:Factory/.knotifications.new.28833/knotifications.changes 
2019-01-21 10:21:21.742014359 +0100
@@ -1,0 +2,17 @@
+Mon Jan 14 06:08:49 UTC 2019 - [email protected]
+
+- Update to 5.54.0
+  * New feature release
+  * For more details please see:
+  * https://www.kde.org/announcements/kde-frameworks-5.54.0.php
+- Changes since 5.53.0:
+  * [Android] Fail more gracefully when building with API < 23
+  * Add Android notification backend
+  * Initialize pointer
+  * Build without D-Bus on Android
+  * Clean up tests build system
+  * Don't force Phonon on Android
+  * Hide API documentation of internal classes
+- BuildRequire libcanberra instead of Phonon for notification sounds
+
+-------------------------------------------------------------------

Old:
----
  knotifications-5.53.0.tar.xz

New:
----
  knotifications-5.54.0.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ knotifications.spec ++++++
--- /var/tmp/diff_new_pack.X22Wvz/_old  2019-01-21 10:21:22.398013688 +0100
+++ /var/tmp/diff_new_pack.X22Wvz/_new  2019-01-21 10:21:22.398013688 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package knotifications
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,14 +17,14 @@
 
 
 %define lname   libKF5Notifications5
-%define _tar_path 5.53
+%define _tar_path 5.54
 # 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.53.0
+Version:        5.54.0
 Release:        0
 Summary:        KDE Desktop notifications
 License:        LGPL-2.1-or-later
@@ -40,7 +40,6 @@
 BuildRequires:  kcoreaddons-devel >= %{_kf5_bugfix_version}
 BuildRequires:  kf5-filesystem
 BuildRequires:  kwindowsystem-devel >= %{_kf5_bugfix_version}
-BuildRequires:  phonon4qt5-devel
 BuildRequires:  pkgconfig
 BuildRequires:  cmake(Qt5DBus) >= 5.6.0
 BuildRequires:  cmake(Qt5Test) >= 5.6.0
@@ -48,6 +47,7 @@
 BuildRequires:  cmake(Qt5Widgets) >= 5.6.0
 BuildRequires:  cmake(Qt5X11Extras) >= 5.6.0
 BuildRequires:  pkgconfig(dbusmenu-qt5)
+BuildRequires:  pkgconfig(libcanberra)
 BuildRequires:  pkgconfig(x11)
 %if %{with lang}
 BuildRequires:  cmake(Qt5LinguistTools) >= 5.6.0

++++++ knotifications-5.53.0.tar.xz -> knotifications-5.54.0.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knotifications-5.53.0/CMakeLists.txt 
new/knotifications-5.54.0/CMakeLists.txt
--- old/knotifications-5.53.0/CMakeLists.txt    2018-12-01 15:57:47.000000000 
+0100
+++ new/knotifications-5.54.0/CMakeLists.txt    2019-01-06 21:24:58.000000000 
+0100
@@ -1,12 +1,12 @@
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.5)
 
-set(KF5_VERSION "5.53.0") # handled by release scripts
-set(KF5_DEP_VERSION "5.53.0") # handled by release scripts
+set(KF5_VERSION "5.54.0") # handled by release scripts
+set(KF5_DEP_VERSION "5.54.0") # handled by release scripts
 project(KNotifications VERSION ${KF5_VERSION})
 
 # ECM setup
 include(FeatureSummary)
-find_package(ECM 5.53.0  NO_MODULE)
+find_package(ECM 5.54.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)
 
@@ -33,7 +33,14 @@
 # Dependencies
 set(REQUIRED_QT_VERSION 5.9.0)
 
-find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Widgets DBus)
+find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Widgets)
+if (NOT ANDROID)
+    find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED DBus)
+else ()
+    find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED AndroidExtras)
+    find_package(Java REQUIRED)
+    include(UseJava)
+endif()
 find_package(Qt5 ${REQUIRED_QT_VERSION} QUIET OPTIONAL_COMPONENTS TextToSpeech)
 set_package_properties(Qt5TextToSpeech PROPERTIES
    DESCRIPTION "Qt text to speech module"
@@ -76,9 +83,11 @@
     find_package(Phonon4Qt5 4.6.60 NO_MODULE)
     set_package_properties(Phonon4Qt5 PROPERTIES
         DESCRIPTION "Qt-based audio library"
-        # This is REQUIRED since you cannot tell CMake "either one of those 
two optional ones are required"
-        TYPE REQUIRED
         PURPOSE "Needed to build audio notification support when Canberra 
isn't available")
+    if (NOT ANDROID)
+        # This is REQUIRED since you cannot tell CMake "either one of those 
two optional ones are required"
+        set_package_properties(Phonon4Qt5 PROPERTIES TYPE REQUIRED)
+    endif()
     if (Phonon4Qt5_FOUND)
         add_definitions(-DHAVE_PHONON4QT5)
     endif()
@@ -111,6 +120,10 @@
 
 include(CMakePackageConfigHelpers)
 
+set(HAVE_DBUS FALSE)
+if (TARGET Qt5::DBus)
+    set(HAVE_DBUS TRUE)
+endif()
 configure_package_config_file(
   "${CMAKE_CURRENT_SOURCE_DIR}/KF5NotificationsConfig.cmake.in"
   "${CMAKE_CURRENT_BINARY_DIR}/KF5NotificationsConfig.cmake"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/knotifications-5.53.0/KF5NotificationsConfig.cmake.in 
new/knotifications-5.54.0/KF5NotificationsConfig.cmake.in
--- old/knotifications-5.53.0/KF5NotificationsConfig.cmake.in   2018-12-01 
15:57:47.000000000 +0100
+++ new/knotifications-5.54.0/KF5NotificationsConfig.cmake.in   2019-01-06 
21:24:58.000000000 +0100
@@ -4,7 +4,9 @@
 
 include(CMakeFindDependencyMacro)
 find_dependency(Qt5Widgets @REQUIRED_QT_VERSION@)
-find_dependency(Qt5DBus @REQUIRED_QT_VERSION@)
+if (@HAVE_DBUS@)
+    find_dependency(Qt5DBus @REQUIRED_QT_VERSION@)
+endif()
 
 include("${CMAKE_CURRENT_LIST_DIR}/KF5NotificationsTargets.cmake")
 @PACKAGE_INCLUDE_QCHTARGETS@
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knotifications-5.53.0/autotests/CMakeLists.txt 
new/knotifications-5.54.0/autotests/CMakeLists.txt
--- old/knotifications-5.53.0/autotests/CMakeLists.txt  2018-12-01 
15:57:47.000000000 +0100
+++ new/knotifications-5.54.0/autotests/CMakeLists.txt  2019-01-06 
21:24:58.000000000 +0100
@@ -7,5 +7,7 @@
     return()
 endif()
 
-set(KNotificationTest_SRCS knotification_test.cpp 
fake_notifications_server.cpp)
-ecm_add_test(${KNotificationTest_SRCS} TEST_NAME "KNotificationTest" 
LINK_LIBRARIES Qt5::Test Qt5::DBus KF5::Notifications)
+if (TARGET Qt5::DBus)
+    set(KNotificationTest_SRCS knotification_test.cpp 
fake_notifications_server.cpp)
+    ecm_add_test(${KNotificationTest_SRCS} TEST_NAME "KNotificationTest" 
LINK_LIBRARIES Qt5::Test Qt5::DBus KF5::Notifications)
+endif()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knotifications-5.53.0/docs/Doxyfile.local 
new/knotifications-5.54.0/docs/Doxyfile.local
--- old/knotifications-5.53.0/docs/Doxyfile.local       1970-01-01 
01:00:00.000000000 +0100
+++ new/knotifications-5.54.0/docs/Doxyfile.local       2019-01-06 
21:24:58.000000000 +0100
@@ -0,0 +1 @@
+EXCLUDE_PATTERNS += */notifyby*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knotifications-5.53.0/po/ca/knotifications5_qt.po 
new/knotifications-5.54.0/po/ca/knotifications5_qt.po
--- old/knotifications-5.53.0/po/ca/knotifications5_qt.po       2018-12-01 
15:57:47.000000000 +0100
+++ new/knotifications-5.54.0/po/ca/knotifications5_qt.po       2019-01-06 
21:24:58.000000000 +0100
@@ -1,5 +1,5 @@
 # Translation of knotifications5_qt.po to Catalan
-# Copyright (C) 2014 This_file_is_part_of_KDE
+# Copyright (C) 1998-2014 This_file_is_part_of_KDE
 # This file is distributed under the license LGPL version 2.1 or
 # version 3 or later versions approved by the membership of KDE e.V.
 #
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/knotifications-5.53.0/po/ca@valencia/knotifications5_qt.po 
new/knotifications-5.54.0/po/ca@valencia/knotifications5_qt.po
--- old/knotifications-5.53.0/po/ca@valencia/knotifications5_qt.po      
2018-12-01 15:57:47.000000000 +0100
+++ new/knotifications-5.54.0/po/ca@valencia/knotifications5_qt.po      
2019-01-06 21:24:58.000000000 +0100
@@ -1,5 +1,5 @@
 # Translation of knotifications5_qt.po to Catalan (Valencian)
-# Copyright (C) 2014 This_file_is_part_of_KDE
+# Copyright (C) 1998-2014 This_file_is_part_of_KDE
 # This file is distributed under the license LGPL version 2.1 or
 # version 3 or later versions approved by the membership of KDE e.V.
 #
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knotifications-5.53.0/po/zh_CN/knotifications5_qt.po 
new/knotifications-5.54.0/po/zh_CN/knotifications5_qt.po
--- old/knotifications-5.53.0/po/zh_CN/knotifications5_qt.po    2018-12-01 
15:57:47.000000000 +0100
+++ new/knotifications-5.54.0/po/zh_CN/knotifications5_qt.po    2019-01-06 
21:24:58.000000000 +0100
@@ -13,7 +13,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: kdeorg\n"
-"PO-Revision-Date: 2018-11-12 09:13\n"
+"PO-Revision-Date: 2019-01-05 20:42\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.53.0/src/CMakeLists.txt 
new/knotifications-5.54.0/src/CMakeLists.txt
--- old/knotifications-5.53.0/src/CMakeLists.txt        2018-12-01 
15:57:47.000000000 +0100
+++ new/knotifications-5.54.0/src/CMakeLists.txt        2019-01-06 
21:24:58.000000000 +0100
@@ -12,22 +12,45 @@
   knotification.cpp
   knotificationmanager.cpp
   kpassivepopup.cpp
-  kstatusnotifieritem.cpp
-  kstatusnotifieritemdbus_p.cpp
-  knotificationrestrictions.cpp
 
   knotifyconfig.cpp
   knotificationplugin.cpp
-  notifybypopup.cpp
-  imageconverter.cpp #needed to marshal images for sending over dbus by 
NotifyByPopup
   notifybypopupgrowl.cpp
   notifybyexecute.cpp
-  notifybyportal.cpp
   notifybylogfile.cpp
   notifybytaskbar.cpp
   ${knotifications_QM_LOADER}
 )
 
+if (TARGET Qt5::DBus)
+  list(APPEND knotifications_SRCS
+    kstatusnotifieritem.cpp
+    kstatusnotifieritemdbus_p.cpp
+    knotificationrestrictions.cpp
+
+    imageconverter.cpp #needed to marshal images for sending over dbus by 
NotifyByPopup
+    notifybypopup.cpp
+    notifybyportal.cpp
+  )
+endif()
+
+if (ANDROID)
+  if (NOT CMAKE_ANDROID_API VERSION_LESS 23)
+    list(APPEND knotifications_SRCS notifybyandroid.cpp)
+    # see qtbase/mkspecs/features/java.prf
+    set(CMAKE_JAVA_COMPILE_FLAGS -source 6 -target 6)
+    add_jar(knotifications_jar
+        SOURCES
+            org/kde/knotifications/KNotification.java
+            org/kde/knotifications/NotifyByAndroid.java
+        INCLUDE_JARS 
${ANDROID_SDK_ROOT}/platforms/android-${CMAKE_ANDROID_API}/android.jar
+        OUTPUT_NAME KF5Notifications
+    )
+  else()
+    message(WARNING "Android notification backend needs at least API level 
23!")
+  endif()
+endif()
+
 ecm_qt_declare_logging_category(knotifications_SRCS HEADER debug_p.h 
IDENTIFIER LOG_KNOTIFICATIONS CATEGORY_NAME org.kde.knotifications)
 
 if (CANBERRA_FOUND)
@@ -55,14 +78,16 @@
    set(HAVE_DBUSMENUQT 0)
 endif()
 
-qt5_add_dbus_adaptor(knotifications_SRCS     org.kde.StatusNotifierItem.xml
-                     kstatusnotifieritemdbus_p.h KStatusNotifierItemDBus)
+if (TARGET Qt5::DBus)
+  qt5_add_dbus_adaptor(knotifications_SRCS     org.kde.StatusNotifierItem.xml
+                      kstatusnotifieritemdbus_p.h KStatusNotifierItemDBus)
 
 
-set(statusnotifierwatcher_xml org.kde.StatusNotifierWatcher.xml)
-qt5_add_dbus_interface(knotifications_SRCS ${statusnotifierwatcher_xml} 
statusnotifierwatcher_interface)
-set(notifications_xml org.freedesktop.Notifications.xml)
-qt5_add_dbus_interface(knotifications_SRCS ${notifications_xml} 
notifications_interface)
+  set(statusnotifierwatcher_xml org.kde.StatusNotifierWatcher.xml)
+  qt5_add_dbus_interface(knotifications_SRCS ${statusnotifierwatcher_xml} 
statusnotifierwatcher_interface)
+  set(notifications_xml org.freedesktop.Notifications.xml)
+  qt5_add_dbus_interface(knotifications_SRCS ${notifications_xml} 
notifications_interface)
+endif()
 
 configure_file(config-knotifications.h.cmake 
${CMAKE_CURRENT_BINARY_DIR}/config-knotifications.h )
 
@@ -74,8 +99,10 @@
 
 target_link_libraries(KF5Notifications PUBLIC
    Qt5::Widgets
-   Qt5::DBus
 )
+if (TARGET Qt5::DBus)
+   target_link_libraries(KF5Notifications PUBLIC Qt5::DBus)
+endif()
 target_link_libraries(KF5Notifications PRIVATE
    KF5::CoreAddons
    KF5::ConfigCore
@@ -113,6 +140,10 @@
   target_link_libraries(KF5Notifications PRIVATE dbusmenu-qt5)
 endif()
 
+if (ANDROID)
+    target_link_libraries(KF5Notifications PRIVATE Qt5::AndroidExtras)
+endif()
+
 set_target_properties(KF5Notifications PROPERTIES VERSION   
${KNOTIFICATIONS_VERSION_STRING}
                                                   SOVERSION 
${KNOTIFICATIONS_SOVERSION}
                                                   EXPORT_NAME Notifications
@@ -161,15 +192,17 @@
     )
 endif()
 
-install(FILES
-    org.kde.StatusNotifierItem.xml
-    DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR}
-    RENAME kf5_org.kde.StatusNotifierItem.xml)
-
-install(FILES
-    org.kde.StatusNotifierWatcher.xml
-    DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR}
-    RENAME kf5_org.kde.StatusNotifierWatcher.xml)
+if (TARGET Qt5::DBus)
+    install(FILES
+        org.kde.StatusNotifierItem.xml
+        DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR}
+        RENAME kf5_org.kde.StatusNotifierItem.xml)
+
+    install(FILES
+        org.kde.StatusNotifierWatcher.xml
+        DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR}
+        RENAME kf5_org.kde.StatusNotifierWatcher.xml)
+endif()
 
 install(FILES
     knotificationplugin.desktop
@@ -179,3 +212,7 @@
 ecm_generate_pri_file(BASE_NAME KNotifications LIB_NAME KF5Notifications DEPS 
"widgets" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR 
${KDE_INSTALL_INCLUDEDIR_KF5}/KNotifications)
 install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
 
+if (ANDROID AND NOT ANDROID_API_LEVEL VERSION_LESS 23)
+    install_jar(knotifications_jar DESTINATION jar)
+    install(FILES KF5Notifications-android-dependencies.xml DESTINATION 
${KDE_INSTALL_LIBDIR})
+endif()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/knotifications-5.53.0/src/KF5Notifications-android-dependencies.xml 
new/knotifications-5.54.0/src/KF5Notifications-android-dependencies.xml
--- old/knotifications-5.53.0/src/KF5Notifications-android-dependencies.xml     
1970-01-01 01:00:00.000000000 +0100
+++ new/knotifications-5.54.0/src/KF5Notifications-android-dependencies.xml     
2019-01-06 21:24:58.000000000 +0100
@@ -0,0 +1,9 @@
+<rules>
+    <dependencies>
+        <lib name="KF5Notifications">
+            <depends>
+                <jar bundling="1" file="jar/KF5Notifications.jar"/>
+            </depends>
+        </lib>
+    </dependencies>
+</rules>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knotifications-5.53.0/src/knotificationmanager.cpp 
new/knotifications-5.54.0/src/knotificationmanager.cpp
--- old/knotifications-5.53.0/src/knotificationmanager.cpp      2018-12-01 
15:57:47.000000000 +0100
+++ new/knotifications-5.54.0/src/knotificationmanager.cpp      2019-01-06 
21:24:58.000000000 +0100
@@ -23,22 +23,29 @@
 
 #include <QHash>
 #include <QWidget>
-#include <QDBusConnection>
 #include <QPointer>
 #include <QBuffer>
 #include <QFileInfo>
-#include <QDBusConnectionInterface>
 #include <KPluginLoader>
 #include <KPluginMetaData>
 
+#ifdef QT_DBUS_LIB
+#include <QDBusConnection>
+#include <QDBusConnectionInterface>
+#endif
+
 #include "knotifyconfig.h"
 #include "knotificationplugin.h"
-#include "notifybypopup.h"
 
 #include "notifybylogfile.h"
 #include "notifybytaskbar.h"
 #include "notifybyexecute.h"
+#ifndef Q_OS_ANDROID
+#include "notifybypopup.h"
 #include "notifybyportal.h"
+#else
+#include "notifybyandroid.h"
+#endif
 #include "debug_p.h"
 
 #if defined(HAVE_CANBERRA)
@@ -93,6 +100,7 @@
         d->inSandbox = true;
     }
 
+#ifdef QT_DBUS_LIB
     if (d->inSandbox) {
         QDBusConnectionInterface *interface = 
QDBusConnection::sessionBus().interface();
         d->portalDBusServiceExists = 
interface->isServiceRegistered(QStringLiteral("org.freedesktop.portal.Desktop"));
@@ -104,6 +112,7 @@
                                           
QStringLiteral("reparseConfiguration"),
                                           this,
                                           SLOT(reparseConfiguration(QString)));
+#endif
 }
 
 KNotificationManager::~KNotificationManager()
@@ -132,11 +141,15 @@
     // We have a series of built-ins up first, and fall back to trying
     // to instantiate an externally supplied plugin.
     if (action == QLatin1String("Popup")) {
+#ifndef Q_OS_ANDROID
             if (d->inSandbox && d->portalDBusServiceExists) {
                 plugin = new NotifyByPortal(this);
             } else {
                 plugin = new NotifyByPopup(this);
             }
+#elif __ANDROID_API__ >= 23
+        plugin = new NotifyByAndroid(this);
+#endif
 
         addPlugin(plugin);
     } else if (action == QLatin1String("Taskbar")) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knotifications-5.53.0/src/kpassivepopup.cpp 
new/knotifications-5.54.0/src/kpassivepopup.cpp
--- old/knotifications-5.53.0/src/kpassivepopup.cpp     2018-12-01 
15:57:47.000000000 +0100
+++ new/knotifications-5.54.0/src/kpassivepopup.cpp     2019-01-06 
21:24:58.000000000 +0100
@@ -56,8 +56,6 @@
         : q(q),
           popupStyle(DEFAULT_POPUP_TYPE),
           window(winId),
-          msgView(nullptr),
-          topLayout(nullptr),
           hideDelay(DEFAULT_POPUP_TIME),
           hideTimer(new QTimer(q)),
           autoDelete(false)
@@ -90,14 +88,14 @@
     QPoint fixedPosition;
 
     WId window;
-    QWidget *msgView;
-    QBoxLayout *topLayout;
+    QWidget *msgView = nullptr;
+    QBoxLayout *topLayout = nullptr;
     int hideDelay;
-    QTimer *hideTimer;
+    QTimer *hideTimer = nullptr;
 
-    QLabel *ttlIcon;
-    QLabel *ttl;
-    QLabel *msg;
+    QLabel *ttlIcon = nullptr;
+    QLabel *ttl = nullptr;
+    QLabel *msg = nullptr;
 
     bool autoDelete;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knotifications-5.53.0/src/notifybyandroid.cpp 
new/knotifications-5.54.0/src/notifybyandroid.cpp
--- old/knotifications-5.53.0/src/notifybyandroid.cpp   1970-01-01 
01:00:00.000000000 +0100
+++ new/knotifications-5.54.0/src/notifybyandroid.cpp   2019-01-06 
21:24:58.000000000 +0100
@@ -0,0 +1,168 @@
+/*
+    Copyright (C) 2018 Volker Krause <[email protected]>
+
+    This program is free software; you can redistribute it and/or modify it
+    under the terms of the GNU Library General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or (at your
+    option) any later version.
+
+    This program 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 Library General Public
+    License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
+#include "notifybyandroid.h"
+#include "knotification.h"
+#include "debug_p.h"
+
+#include <QtAndroid>
+#include <QAndroidJniEnvironment>
+
+#include <QBuffer>
+#include <QDebug>
+#include <QIcon>
+
+static NotifyByAndroid *s_instance = nullptr;
+
+static void notificationFinished(JNIEnv *env, jobject that, jint 
notificationId)
+{
+    Q_UNUSED(env);
+    Q_UNUSED(that);
+    if (s_instance) {
+        s_instance->notificationFinished(notificationId);
+    }
+}
+
+static void notificationActionInvoked(JNIEnv *env, jobject that, jint id, jint 
action)
+{
+    Q_UNUSED(env);
+    Q_UNUSED(that);
+    if (s_instance) {
+        s_instance->notificationActionInvoked(id, action);
+    }
+}
+
+static const JNINativeMethod methods[] = {
+    {"notificationFinished", "(I)V", (void*)notificationFinished},
+    {"notificationActionInvoked", "(II)V", (void*)notificationActionInvoked}
+};
+
+KNOTIFICATIONS_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void*)
+{
+    static bool initialized = false;
+    if (initialized) {
+        return JNI_VERSION_1_4;
+    }
+    initialized = true;
+
+    JNIEnv *env = nullptr;
+    if (vm->GetEnv((void**)&env, JNI_VERSION_1_4) != JNI_OK) {
+        qCWarning(LOG_KNOTIFICATIONS) << "Failed to get JNI environment.";
+        return -1;
+    }
+    jclass cls = env->FindClass("org/kde/knotifications/NotifyByAndroid");
+    if (env->RegisterNatives(cls, methods, sizeof(methods) / 
sizeof(JNINativeMethod)) < 0) {
+        qCWarning(LOG_KNOTIFICATIONS) << "Failed to register native 
functions.";
+        return -1;
+    }
+
+    return JNI_VERSION_1_4;
+}
+
+NotifyByAndroid::NotifyByAndroid(QObject* parent) :
+    KNotificationPlugin(parent)
+{
+    s_instance = this;
+#if __ANDROID_API__ >= 23
+    m_backend = QAndroidJniObject("org/kde/knotifications/NotifyByAndroid", 
"(Landroid/content/Context;)V", QtAndroid::androidContext().object<jobject>());
+#endif
+}
+
+NotifyByAndroid::~NotifyByAndroid()
+{
+    s_instance = nullptr;
+}
+
+QString NotifyByAndroid::optionName()
+{
+    return QStringLiteral("Popup");
+}
+
+void NotifyByAndroid::notify(KNotification *notification, KNotifyConfig 
*config)
+{
+    // HACK work around that notification->id() is only populated after 
returning from here
+    QMetaObject::invokeMethod(this, [this, notification, config](){ 
notifyDeferred(notification, config); }, Qt::QueuedConnection);
+}
+
+void NotifyByAndroid::notifyDeferred(KNotification* notification, const 
KNotifyConfig* config)
+{
+    Q_UNUSED(config);
+
+#if __ANDROID_API__ >= 23
+    QAndroidJniEnvironment env;
+
+    QAndroidJniObject n("org/kde/knotifications/KNotification", "()V");
+    n.setField("id", notification->id());
+    n.setField("text", 
QAndroidJniObject::fromString(notification->text()).object<jstring>());
+    n.setField("title", 
QAndroidJniObject::fromString(notification->title()).object<jstring>());
+
+    // icon
+    QPixmap pixmap;
+    if (!notification->iconName().isEmpty()) {
+        const auto icon = QIcon::fromTheme(notification->iconName());
+        pixmap = icon.pixmap(32, 32);
+    } else {
+        pixmap = notification->pixmap();
+    }
+    QByteArray iconData;
+    QBuffer buffer(&iconData);
+    buffer.open(QIODevice::WriteOnly);
+    pixmap.save(&buffer, "PNG");
+    auto jIconData = env->NewByteArray(iconData.length());
+    env->SetByteArrayRegion(jIconData, 0, iconData.length(), 
reinterpret_cast<const jbyte*>(iconData.constData()));
+    n.callMethod<void>("setIconFromData", "([BI)V", jIconData, 
iconData.length());
+
+    // actions
+    const auto actions = notification->actions();
+    for (const auto &action : actions) {
+        n.callMethod<void>("addAction", "(Ljava/lang/String;)V", 
QAndroidJniObject::fromString(action).object<jstring>());
+    }
+
+    m_notifications.insert(notification->id(), notification);
+
+    m_backend.callMethod<void>("notify", 
"(Lorg/kde/knotifications/KNotification;)V", n.object<jobject>());
+#else
+    Q_UNUSED(notification);
+#endif
+}
+
+void NotifyByAndroid::close(KNotification* notification)
+{
+#if __ANDROID_API__ >= 23
+    m_backend.callMethod<void>("close", "(I)V", notification->id());
+#endif
+    KNotificationPlugin::close(notification);
+}
+
+void NotifyByAndroid::notificationFinished(int id)
+{
+    qCDebug(LOG_KNOTIFICATIONS) << id;
+    const auto it = m_notifications.find(id);
+    if (it == m_notifications.end()) {
+        return;
+    }
+    m_notifications.erase(it);
+    if (it.value()) {
+        finish(it.value());
+    }
+}
+
+void NotifyByAndroid::notificationActionInvoked(int id, int action)
+{
+    qCDebug(LOG_KNOTIFICATIONS) << id << action;
+    emit actionInvoked(id, action);
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knotifications-5.53.0/src/notifybyandroid.h 
new/knotifications-5.54.0/src/notifybyandroid.h
--- old/knotifications-5.53.0/src/notifybyandroid.h     1970-01-01 
01:00:00.000000000 +0100
+++ new/knotifications-5.54.0/src/notifybyandroid.h     2019-01-06 
21:24:58.000000000 +0100
@@ -0,0 +1,50 @@
+/*
+    Copyright (C) 2018 Volker Krause <[email protected]>
+
+    This program is free software; you can redistribute it and/or modify it
+    under the terms of the GNU Library General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or (at your
+    option) any later version.
+
+    This program 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 Library General Public
+    License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
+#ifndef NOTIFYBYANDROID_H
+#define NOTIFYBYANDROID_H
+
+#include "knotificationplugin.h"
+
+#include <QAndroidJniObject>
+#include <QPointer>
+
+/** Android notification backend. */
+class NotifyByAndroid : public KNotificationPlugin
+{
+    Q_OBJECT
+public:
+    explicit NotifyByAndroid(QObject *parent = nullptr);
+    ~NotifyByAndroid() override;
+
+    // interface of KNotificationPlugin
+    QString optionName() override;
+    void notify(KNotification *notification, KNotifyConfig *config) override;
+    void close(KNotification * notification) override;
+
+    // interface from Java
+    void notificationFinished(int id);
+    void notificationActionInvoked(int id, int action);
+
+private:
+    void notifyDeferred(KNotification *notification, const KNotifyConfig 
*config);
+
+    QAndroidJniObject m_backend;
+    QHash<int, QPointer<KNotification>> m_notifications;
+};
+
+#endif // NOTIFYBYANDROID_H
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/knotifications-5.53.0/src/org/kde/knotifications/KNotification.java 
new/knotifications-5.54.0/src/org/kde/knotifications/KNotification.java
--- old/knotifications-5.53.0/src/org/kde/knotifications/KNotification.java     
1970-01-01 01:00:00.000000000 +0100
+++ new/knotifications-5.54.0/src/org/kde/knotifications/KNotification.java     
2019-01-06 21:24:58.000000000 +0100
@@ -0,0 +1,43 @@
+/*
+    Copyright (C) 2018 Volker Krause <[email protected]>
+
+    This program is free software; you can redistribute it and/or modify it
+    under the terms of the GNU Library General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or (at your
+    option) any later version.
+
+    This program 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 Library General Public
+    License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
+package org.kde.knotifications;
+
+import android.graphics.drawable.Icon;
+import java.util.ArrayList;
+
+/** Java side of KNotification.
+ *  Used to convey the relevant notification data to Java.
+ */
+public class KNotification
+{
+    public int id;
+    public String text;
+    public String title;
+    public Icon icon;
+    public ArrayList<String> actions = new ArrayList<String>();
+
+    public void setIconFromData(byte[] data, int length)
+    {
+        icon = Icon.createWithData(data, 0, length);
+    }
+
+    public void addAction(String action)
+    {
+        actions.add(action);
+    }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/knotifications-5.53.0/src/org/kde/knotifications/NotifyByAndroid.java 
new/knotifications-5.54.0/src/org/kde/knotifications/NotifyByAndroid.java
--- old/knotifications-5.53.0/src/org/kde/knotifications/NotifyByAndroid.java   
1970-01-01 01:00:00.000000000 +0100
+++ new/knotifications-5.54.0/src/org/kde/knotifications/NotifyByAndroid.java   
2019-01-06 21:24:58.000000000 +0100
@@ -0,0 +1,113 @@
+/*
+    Copyright (C) 2018 Volker Krause <[email protected]>
+
+    This program is free software; you can redistribute it and/or modify it
+    under the terms of the GNU Library General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or (at your
+    option) any later version.
+
+    This program 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 Library General Public
+    License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
+*/
+
+package org.kde.knotifications;
+
+import android.app.Activity;
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.util.Log;
+
+/** Java side of the Android notfication backend. */
+public class NotifyByAndroid extends BroadcastReceiver
+{
+    private static final String TAG = "org.kde.knotifications";
+
+    private static final String NOTIFICATION_ACTION = 
".org.kde.knotifications.NOTIFICATION_ACTION";
+    private static final String NOTIFICATION_DELETED = 
".org.kde.knotifications.NOTIFICATION_DELETED";
+    private static final String NOTIFICATION_ID_EXTRA = 
"org.kde.knotifications.NOTIFICATION_ID";
+    private static final String NOTIFICATION_ACTION_ID_EXTRA = 
"org.kde.knotifications.NOTIFICATION_ACTION_ID";
+
+    private android.content.Context m_ctx;
+    private NotificationManager m_notificationManager;
+    private int m_uniquePendingIntentId = 0;
+
+    public NotifyByAndroid(android.content.Context context)
+    {
+        Log.i(TAG, context.getPackageName());
+        m_ctx = context;
+        m_notificationManager = 
(NotificationManager)m_ctx.getSystemService(Context.NOTIFICATION_SERVICE);
+
+        IntentFilter filter = new IntentFilter();
+        filter.addAction(m_ctx.getPackageName() + NOTIFICATION_ACTION);
+        filter.addAction(m_ctx.getPackageName() + NOTIFICATION_DELETED);
+        m_ctx.registerReceiver(this, filter);
+    }
+
+    public void notify(KNotification notification)
+    {
+        Log.i(TAG, notification.text);
+
+        Notification.Builder builder = new Notification.Builder(m_ctx);
+        builder.setSmallIcon(notification.icon);
+        builder.setContentTitle(notification.title);
+        builder.setContentText(notification.text);
+
+        // taping the notification shows the app
+        Intent intent = new Intent(m_ctx, m_ctx.getClass());
+        PendingIntent contentIntent = PendingIntent.getActivity(m_ctx, 0, 
intent, PendingIntent.FLAG_UPDATE_CURRENT);
+        builder.setContentIntent(contentIntent);
+
+        // actions
+        int actionId = 0;
+        for (String actionName : notification.actions) {
+            Intent actionIntent = new Intent(m_ctx.getPackageName() + 
NOTIFICATION_ACTION);
+            actionIntent.putExtra(NOTIFICATION_ID_EXTRA, notification.id);
+            actionIntent.putExtra(NOTIFICATION_ACTION_ID_EXTRA, actionId);
+            PendingIntent pendingIntent = PendingIntent.getBroadcast(m_ctx, 
m_uniquePendingIntentId++, actionIntent, PendingIntent.FLAG_UPDATE_CURRENT);
+            Notification.Action action = new Notification.Action.Builder(0, 
actionName, pendingIntent).build();
+            builder.addAction(action);
+            ++actionId;
+        }
+
+        // notfication about user closing the notification
+        Intent deleteIntent = new Intent(m_ctx.getPackageName() + 
NOTIFICATION_DELETED);
+        deleteIntent.putExtra(NOTIFICATION_ID_EXTRA, notification.id);
+        Log.i(TAG, deleteIntent.getExtras() + " " + notification.id);
+        builder.setDeleteIntent(PendingIntent.getBroadcast(m_ctx, 
m_uniquePendingIntentId++, deleteIntent, PendingIntent.FLAG_UPDATE_CURRENT));
+
+        m_notificationManager.notify(notification.id, builder.build());
+    }
+
+    public void close(int id)
+    {
+        m_notificationManager.cancel(id);
+    }
+
+    @Override
+    public void onReceive(Context context, Intent intent)
+    {
+        String action = intent.getAction();
+        int id = intent.getIntExtra(NOTIFICATION_ID_EXTRA, -1);
+        Log.i(TAG, action + ": " + id + " " + intent.getExtras());
+
+        if (action.equals(m_ctx.getPackageName() + NOTIFICATION_ACTION)) {
+            int actionId = intent.getIntExtra(NOTIFICATION_ACTION_ID_EXTRA, 
-1);
+            notificationActionInvoked(id, actionId);
+        } else if (action.equals(m_ctx.getPackageName() + 
NOTIFICATION_DELETED)) {
+            notificationFinished(id);
+        }
+    }
+
+    public native void notificationFinished(int notificationId);
+    public native void notificationActionInvoked(int notificationId, int 
action);
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knotifications-5.53.0/tests/CMakeLists.txt 
new/knotifications-5.54.0/tests/CMakeLists.txt
--- old/knotifications-5.53.0/tests/CMakeLists.txt      2018-12-01 
15:57:47.000000000 +0100
+++ new/knotifications-5.54.0/tests/CMakeLists.txt      2019-01-06 
21:24:58.000000000 +0100
@@ -1,27 +1,21 @@
-
 include(ECMMarkAsTest)
 
-find_package(ECM 0.0.9  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)
-
-
-find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Test)
-
 macro(knotifications_executable_tests)
   foreach(_testname ${ARGN})
     add_executable(${_testname} ${_testname}.cpp)
-    target_link_libraries(${_testname} Qt5::Test Qt5::DBus KF5::Notifications)
+    target_link_libraries(${_testname} Qt5::DBus KF5::Notifications)
     ecm_mark_as_test(${_testname})
   endforeach(_testname)
 endmacro()
 
-knotifications_executable_tests(
-    knotificationrestrictionstest
-    kpassivepopuptest
-    unitylaunchertest
-    kstatusnotifieritemtest
-    knotificationdbustest
-)
+if (TARGET Qt5::DBus)
+    knotifications_executable_tests(
+        knotificationrestrictionstest
+        kpassivepopuptest
+        unitylaunchertest
+        kstatusnotifieritemtest
+        knotificationdbustest
+    )
 
-target_link_libraries(kpassivepopuptest KF5::WindowSystem)
+    target_link_libraries(kpassivepopuptest KF5::WindowSystem)
+endif()


Reply via email to