Hello community, here is the log from the commit of package knotifications for openSUSE:Factory checked in at 2019-02-14 14:27:05 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/knotifications (Old) and /work/SRC/openSUSE:Factory/.knotifications.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "knotifications" Thu Feb 14 14:27:05 2019 rev:63 rq:674256 version:5.55.0 Changes: -------- --- /work/SRC/openSUSE:Factory/knotifications/knotifications.changes 2019-01-21 10:21:21.742014359 +0100 +++ /work/SRC/openSUSE:Factory/.knotifications.new.28833/knotifications.changes 2019-02-14 14:27:06.379825541 +0100 @@ -1,0 +2,19 @@ +Sun Feb 10 22:03:14 UTC 2019 - lbeltr...@kde.org + +- Update to 5.55.0 + * New feature release + * For more details please see: + * https://www.kde.org/announcements/kde-frameworks-5.55.0.php +- Changes since 5.54.0: + * Fix memory leak when passing icon data to Java + * Remove the AndroidX support library dependency + * Add Android notification channel support + * Make notifications work on Android with API level < 23 + * Move the Android API level checks to runtime + * Remove unused forward declaration + * Rebuild AAR when Java sources change + * Build the Java side with Gradle, as AAR instead of JAR + * Don't rely on the Plasma workspace integration on Android + * Search for notfication event configuration in qrc resources + +------------------------------------------------------------------- Old: ---- knotifications-5.54.0.tar.xz New: ---- knotifications-5.55.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ knotifications.spec ++++++ --- /var/tmp/diff_new_pack.bGkk9L/_old 2019-02-14 14:27:06.987825258 +0100 +++ /var/tmp/diff_new_pack.bGkk9L/_new 2019-02-14 14:27:06.987825258 +0100 @@ -17,14 +17,14 @@ %define lname libKF5Notifications5 -%define _tar_path 5.54 +%define _tar_path 5.55 # 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.54.0 +Version: 5.55.0 Release: 0 Summary: KDE Desktop notifications License: LGPL-2.1-or-later ++++++ knotifications-5.54.0.tar.xz -> knotifications-5.55.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.54.0/CMakeLists.txt new/knotifications-5.55.0/CMakeLists.txt --- old/knotifications-5.54.0/CMakeLists.txt 2019-01-06 21:24:58.000000000 +0100 +++ new/knotifications-5.55.0/CMakeLists.txt 2019-02-03 01:00:12.000000000 +0100 @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 3.5) -set(KF5_VERSION "5.54.0") # handled by release scripts -set(KF5_DEP_VERSION "5.54.0") # handled by release scripts +set(KF5_VERSION "5.55.0") # handled by release scripts +set(KF5_DEP_VERSION "5.55.0") # handled by release scripts project(KNotifications VERSION ${KF5_VERSION}) # ECM setup include(FeatureSummary) -find_package(ECM 5.54.0 NO_MODULE) +find_package(ECM 5.55.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,15 +31,15 @@ SOVERSION 5) # Dependencies -set(REQUIRED_QT_VERSION 5.9.0) +set(REQUIRED_QT_VERSION 5.10.0) +set(CMAKE_AUTORCC TRUE) 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) + find_package(Gradle REQUIRED) endif() find_package(Qt5 ${REQUIRED_QT_VERSION} QUIET OPTIONAL_COMPONENTS TextToSpeech) set_package_properties(Qt5TextToSpeech PROPERTIES diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.54.0/cmake/modules/FindGradle.cmake new/knotifications-5.55.0/cmake/modules/FindGradle.cmake --- old/knotifications-5.54.0/cmake/modules/FindGradle.cmake 1970-01-01 01:00:00.000000000 +0100 +++ new/knotifications-5.55.0/cmake/modules/FindGradle.cmake 2019-02-03 01:00:12.000000000 +0100 @@ -0,0 +1,107 @@ +#.rst: +# FindGradle +# ---------- +# +# Provides the ability to build Android AAR libraries using Gradle. +# +# This relies on the Qt provided Gradle, so a Qt for Android installation +# is required. +# +# gradle_add_aar(<target> +# BUIDLFILE build.gradle +# NAME <aar-name>) +# +# This builds an Android AAR library using the given ``build.gradle`` file. +# +# gradle_install_aar(<target> +# DESTINATION <dest>) +# +# Installs a Android AAR library that has been created with ``gradle_add_aar``. + +#============================================================================= +# Copyright (c) 2019 Volker Krause <vkra...@kde.org> +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +include(CMakeParseArguments) +include(FindPackageHandleStandardArgs) + +find_package(Qt5Core REQUIRED) + +if (NOT WIN32) + set(Gradle_EXECUTABLE ${CMAKE_BINARY_DIR}/gradle/gradlew) +else() + set(Gradle_EXECUTABLE ${CMAKE_BINARY_DIR}/gradle/gradlew.bat) +endif() + +get_target_property(_qt_core_location Qt5::Core LOCATION) +get_filename_component(_qt_install_root ${_qt_core_location} DIRECTORY) +get_filename_component(_qt_install_root ${_qt_install_root}/../ ABSOLUTE) + +set(_gradle_template_dir ${CMAKE_CURRENT_LIST_DIR}) + +add_custom_command(OUTPUT ${Gradle_EXECUTABLE} + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/gradle + COMMAND ${CMAKE_COMMAND} -E copy_directory ${_qt_install_root}/src/3rdparty/gradle ${CMAKE_BINARY_DIR}/gradle +) +add_custom_target(gradle DEPENDS ${Gradle_EXECUTABLE}) + +find_package_handle_standard_args(Gradle DEFAULT_MSG Gradle_EXECUTABLE) + +function(gradle_add_aar target) + cmake_parse_arguments(ARG "" "BUILDFILE;NAME" "" ${ARGN}) + + set(_build_root ${CMAKE_CURRENT_BINARY_DIR}/gradle_build/${ARG_NAME}) + configure_file(${_gradle_template_dir}/local.properties.in ${_build_root}/local.properties) + configure_file(${_gradle_template_dir}/settings.gradle.in ${_build_root}/settings.gradle) + configure_file(${ARG_BUILDFILE} ${_build_root}/build.gradle) + + if (CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]") + set(_aar_suffix "-debug") + set(_aar_gradleCmd "assembleDebug") + else() + set(_aar_suffix "-release") + set(_aar_gradleCmd "assembleRelease") + endif() + + file(GLOB_RECURSE _src_files CONFIGURE_DEPENDS "*") + add_custom_command( + OUTPUT ${_build_root}/build/outputs/aar/${ARG_NAME}${_aar_suffix}.aar + COMMAND ${Gradle_EXECUTABLE} ${_aar_gradleCmd} + DEPENDS ${Gradle_EXECUTABLE} ${_src_files} + DEPENDS gradle + WORKING_DIRECTORY ${_build_root} + ) + add_custom_target(${target} ALL DEPENDS ${_build_root}/build/outputs/aar/${ARG_NAME}${_aar_suffix}.aar) + set_target_properties(${target} PROPERTIES LOCATION ${_build_root}/build/outputs/aar/${ARG_NAME}${_aar_suffix}.aar) + set_target_properties(${target} PROPERTIES OUTPUT_NAME ${ARG_NAME}) +endfunction() + +function(gradle_install_aar target) + cmake_parse_arguments(ARG "" "DESTINATION" "" ${ARGN}) + get_target_property(_loc ${target} LOCATION) + get_target_property(_name ${target} OUTPUT_NAME) + install(FILES ${_loc} DESTINATION ${ARG_DESTINATION} RENAME ${_name}.aar) +endfunction() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.54.0/cmake/modules/local.properties.in new/knotifications-5.55.0/cmake/modules/local.properties.in --- old/knotifications-5.54.0/cmake/modules/local.properties.in 1970-01-01 01:00:00.000000000 +0100 +++ new/knotifications-5.55.0/cmake/modules/local.properties.in 2019-02-03 01:00:12.000000000 +0100 @@ -0,0 +1 @@ +sdk.dir=@ANDROID_SDK_ROOT@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.54.0/cmake/modules/settings.gradle.in new/knotifications-5.55.0/cmake/modules/settings.gradle.in --- old/knotifications-5.54.0/cmake/modules/settings.gradle.in 1970-01-01 01:00:00.000000000 +0100 +++ new/knotifications-5.55.0/cmake/modules/settings.gradle.in 2019-02-03 01:00:12.000000000 +0100 @@ -0,0 +1 @@ +rootProject.name = '@ARG_NAME@' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.54.0/po/ca/knotifications5_qt.po new/knotifications-5.55.0/po/ca/knotifications5_qt.po --- old/knotifications-5.54.0/po/ca/knotifications5_qt.po 2019-01-06 21:24:58.000000000 +0100 +++ new/knotifications-5.55.0/po/ca/knotifications5_qt.po 2019-02-03 01:00:12.000000000 +0100 @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: knotifications5_qt\n" -"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"Report-Msgid-Bugs-To: https://bugs.kde.org\n" "POT-Creation-Date: 2014-03-23 01:50+0000\n" "PO-Revision-Date: 2014-08-08 15:00+0200\n" "Last-Translator: Antoni Bella Pérez <antonibel...@yahoo.com>\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.54.0/po/ca@valencia/knotifications5_qt.po new/knotifications-5.55.0/po/ca@valencia/knotifications5_qt.po --- old/knotifications-5.54.0/po/ca@valencia/knotifications5_qt.po 2019-01-06 21:24:58.000000000 +0100 +++ new/knotifications-5.55.0/po/ca@valencia/knotifications5_qt.po 2019-02-03 01:00:12.000000000 +0100 @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: knotifications5_qt\n" -"Report-Msgid-Bugs-To: http://bugs.kde.org\n" +"Report-Msgid-Bugs-To: https://bugs.kde.org\n" "POT-Creation-Date: 2014-03-23 01:50+0000\n" "PO-Revision-Date: 2014-08-08 15:00+0200\n" "Last-Translator: Antoni Bella Pérez <antonibel...@yahoo.com>\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.54.0/po/zh_CN/knotifications5_qt.po new/knotifications-5.55.0/po/zh_CN/knotifications5_qt.po --- old/knotifications-5.54.0/po/zh_CN/knotifications5_qt.po 2019-01-06 21:24:58.000000000 +0100 +++ new/knotifications-5.55.0/po/zh_CN/knotifications5_qt.po 2019-02-03 01:00:12.000000000 +0100 @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: kdeorg\n" -"PO-Revision-Date: 2019-01-05 20:42\n" +"PO-Revision-Date: 2019-01-27 22:57\n" "Last-Translator: guoyunhe <i...@guoyunhe.me>\n" "Language-Team: Chinese Simplified\n" "Language: zh_CN\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.54.0/src/CMakeLists.txt new/knotifications-5.55.0/src/CMakeLists.txt --- old/knotifications-5.54.0/src/CMakeLists.txt 2019-01-06 21:24:58.000000000 +0100 +++ new/knotifications-5.55.0/src/CMakeLists.txt 2019-02-03 01:00:12.000000000 +0100 @@ -35,20 +35,8 @@ 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() + add_subdirectory(android) + list(APPEND knotifications_SRCS notifybyandroid.cpp knotifications.qrc) endif() ecm_qt_declare_logging_category(knotifications_SRCS HEADER debug_p.h IDENTIFIER LOG_KNOTIFICATIONS CATEGORY_NAME org.kde.knotifications) @@ -212,7 +200,6 @@ 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) +if (ANDROID) install(FILES KF5Notifications-android-dependencies.xml DESTINATION ${KDE_INSTALL_LIBDIR}) endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.54.0/src/KF5Notifications-android-dependencies.xml new/knotifications-5.55.0/src/KF5Notifications-android-dependencies.xml --- old/knotifications-5.54.0/src/KF5Notifications-android-dependencies.xml 2019-01-06 21:24:58.000000000 +0100 +++ new/knotifications-5.55.0/src/KF5Notifications-android-dependencies.xml 2019-02-03 01:00:12.000000000 +0100 @@ -2,7 +2,7 @@ <dependencies> <lib name="KF5Notifications"> <depends> - <jar bundling="1" file="jar/KF5Notifications.jar"/> + <jar bundling="1" file="jar/KF5Notifications.aar"/> </depends> </lib> </dependencies> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.54.0/src/android/AndroidManifest.xml new/knotifications-5.55.0/src/android/AndroidManifest.xml --- old/knotifications-5.54.0/src/android/AndroidManifest.xml 1970-01-01 01:00:00.000000000 +0100 +++ new/knotifications-5.55.0/src/android/AndroidManifest.xml 2019-02-03 01:00:12.000000000 +0100 @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest package="org.kde.knotifications"/> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.54.0/src/android/CMakeLists.txt new/knotifications-5.55.0/src/android/CMakeLists.txt --- old/knotifications-5.54.0/src/android/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/knotifications-5.55.0/src/android/CMakeLists.txt 2019-02-03 01:00:12.000000000 +0100 @@ -0,0 +1,2 @@ +gradle_add_aar(knotifications_aar BUILDFILE ${CMAKE_CURRENT_SOURCE_DIR}/build.gradle NAME KF5Notifications) +gradle_install_aar(knotifications_aar DESTINATION jar) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.54.0/src/android/build.gradle new/knotifications-5.55.0/src/android/build.gradle --- old/knotifications-5.54.0/src/android/build.gradle 1970-01-01 01:00:00.000000000 +0100 +++ new/knotifications-5.55.0/src/android/build.gradle 2019-02-03 01:00:12.000000000 +0100 @@ -0,0 +1,33 @@ +buildscript { + repositories { + google() + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.2.0' + } +} + +repositories { + google() + jcenter() +} + +apply plugin: 'com.android.library' + +android { + compileSdkVersion 28 + buildToolsVersion '28.0.2' + + sourceSets { + main { + manifest.srcFile '@CMAKE_CURRENT_SOURCE_DIR@/AndroidManifest.xml' + java.srcDirs = ['@CMAKE_CURRENT_SOURCE_DIR@/org'] + } + } + + lintOptions { + abortOnError false + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.54.0/src/android/org/kde/knotifications/KNotification.java new/knotifications-5.55.0/src/android/org/kde/knotifications/KNotification.java --- old/knotifications-5.54.0/src/android/org/kde/knotifications/KNotification.java 1970-01-01 01:00:00.000000000 +0100 +++ new/knotifications-5.55.0/src/android/org/kde/knotifications/KNotification.java 2019-02-03 01:00:12.000000000 +0100 @@ -0,0 +1,51 @@ +/* + Copyright (C) 2018 Volker Krause <vkra...@kde.org> + + 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 android.os.Build; + +import java.lang.Object; +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 Object icon; + public ArrayList<String> actions = new ArrayList<String>(); + public String channelId; + public String channelName; + public String channelDescription; + + public void setIconFromData(byte[] data, int length) + { + if (Build.VERSION.SDK_INT >= 23) { + 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.54.0/src/android/org/kde/knotifications/NotifyByAndroid.java new/knotifications-5.55.0/src/android/org/kde/knotifications/NotifyByAndroid.java --- old/knotifications-5.54.0/src/android/org/kde/knotifications/NotifyByAndroid.java 1970-01-01 01:00:00.000000000 +0100 +++ new/knotifications-5.55.0/src/android/org/kde/knotifications/NotifyByAndroid.java 2019-02-03 01:00:12.000000000 +0100 @@ -0,0 +1,139 @@ +/* + Copyright (C) 2018 Volker Krause <vkra...@kde.org> + + 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.NotificationChannel; +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.graphics.drawable.Icon; +import android.os.Build; +import android.util.Log; +import java.util.HashSet; + +/** 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; + private HashSet<String> m_channels = new HashSet(); + + 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 channel + if (!m_channels.contains(notification.channelId)) { + m_channels.add(notification.channelId); + + if (Build.VERSION.SDK_INT >= 26) { + NotificationChannel channel = new NotificationChannel(notification.channelId, notification.channelName, NotificationManager.IMPORTANCE_DEFAULT); + channel.setDescription(notification.channelDescription); + m_notificationManager.createNotificationChannel(channel); + } + } + + Notification.Builder builder; + if (Build.VERSION.SDK_INT >= 26) { + builder = new Notification.Builder(m_ctx, notification.channelId); + } else { + builder = new Notification.Builder(m_ctx); + } + + if (Build.VERSION.SDK_INT >= 23) { + builder.setSmallIcon((Icon)notification.icon); + } else { + builder.setSmallIcon(m_ctx.getApplicationInfo().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.54.0/src/android_defaults.notifyrc new/knotifications-5.55.0/src/android_defaults.notifyrc --- old/knotifications-5.54.0/src/android_defaults.notifyrc 1970-01-01 01:00:00.000000000 +0100 +++ new/knotifications-5.55.0/src/android_defaults.notifyrc 2019-02-03 01:00:12.000000000 +0100 @@ -0,0 +1,365 @@ +[Event/fatalerror] +Name=Fatal Error +Name[ar]=خطأ فادح +Name[bs]=Kobna greška +Name[ca]=Error fatal +Name[ca@valencia]=Error fatal +Name[cs]=Kritická chyba +Name[da]=Fatal fejl +Name[de]=Schwerer Fehler +Name[el]=Μοιραίο σφάλμα +Name[en_GB]=Fatal Error +Name[es]=Error fatal +Name[et]=Parandamatu tõrge +Name[eu]=Zoritxarreko errorea +Name[fi]=Vakava virhe +Name[fr]=Erreur fatale +Name[gd]=Mearachd mharbhtach +Name[gl]=Erro fatal +Name[he]=שגיאה חמורה +Name[hu]=Végzetes hiba +Name[ia]=Error Fatal +Name[id]=Error Fatal +Name[it]=Errore grave +Name[ko]=치명적 오류 +Name[lt]=Lemtinga klaida +Name[nb]=Kritisk feil +Name[nds]=Swoor Fehler +Name[nl]=Fatale fout +Name[nn]=Kritisk feil +Name[pl]=Poważny błąd +Name[pt]=Erro Fatal +Name[pt_BR]=Erro fatal +Name[ru]=Критическая ошибка +Name[sk]=Fatálna chyba +Name[sl]=Usodna napaka +Name[sr]=Кобна грешка +Name[sr@ijekavian]=Кобна грешка +Name[sr@ijekavianlatin]=Kobna greška +Name[sr@latin]=Kobna greška +Name[sv]=Allvarligt fel +Name[tr]=Ölümcül Hata +Name[uk]=Критична помилка +Name[x-test]=xxFatal Errorxx +Name[zh_CN]=严重错误 +Name[zh_TW]=嚴重錯誤 +Comment=There was a serious error causing the program to exit +Comment[ar]=حدث خطأ جاد سبّب للبرنامج بإغلاقه +Comment[bs]=Došlo je do ozbiljne greške zbog koje je program obustavljen +Comment[ca]=S'ha produït un error seriós que ha provocat la sortida del programa +Comment[ca@valencia]=S'ha produït un error seriós que ha provocat l'eixida del programa +Comment[cs]=Nastala závažná chyba, v důsledku které byl program ukončen +Comment[da]=Der var en alvorlig fejl som forårsagede at programmet afsluttede +Comment[de]=Es ist ein schwerer Fehler aufgetreten, woraufhin das Programm beendet wurde. +Comment[el]=Υπήρξε ένα σοβαρό σφάλμα που προκάλεσε την έξοδο του προγράμματος +Comment[en_GB]=There was a serious error causing the program to exit +Comment[es]=Ha ocurrido un error serio que ha causado la salida del programa +Comment[et]=Tekkis tõsine viga, mis sundis programmi tööd lõpetama +Comment[eu]=Errore garrantzitsua bat egon da programa ixtea eragin duena +Comment[fi]=Vakava virhe aiheutti ohjelman päättymisen +Comment[fr]=Une erreur grave a entraîné la fin du programme +Comment[gd]=Chaidh am prògram fhàgail ri linn mearachd dona +Comment[gl]=Produciuse un erro grave que fixo que o programa saíse +Comment[he]=ארעה שגיאה חמורה הגורמה ליישום להיסגר +Comment[hu]=Olyan hiba történt a programban, melynek hatására a program futása befejeződött +Comment[ia]=Il esseva un serie error que il causava le programma a exir +Comment[id]=Ada error serius yang menyebabkan program keluar +Comment[it]=Si è verificato un errore grave, che ha causato la chiusura del programma +Comment[ko]=프로그램이 종료될 정도의 큰 오류가 발생함 +Comment[lt]=Įvyko rimta klaida, privertusi programą užbaigti darbą +Comment[nb]=Det oppsto en alvorlig feil som gjorde at programmet avsluttet +Comment[nds]=Dat geev en swoor Fehler, dat Programm is utstegen +Comment[nl]=Er deed zich een serieuze fout voor die het programma deed afsluiten +Comment[nn]=Det oppstod ein alvorleg feil som gjorde av programmet avslutta +Comment[pl]=Wystąpił poważny błąd i program zakończył działanie +Comment[pt]=Ocorreu um erro sério que fez com que o programa saísse +Comment[pt_BR]=Ocorreu um erro grave que causou o fechamento do programa +Comment[ru]=Произошла серьёзная ошибка, приведшая к завершению работы программы +Comment[sk]=Vyskytla sa vážna chyba, ktorá spôsobila ukončenie programu +Comment[sl]=Prišlo je do resne napake, zaradi katere se je program končal +Comment[sr]=Дошло је до озбиљне грешке због које је програм обустављен +Comment[sr@ijekavian]=Дошло је до озбиљне грешке због које је програм обустављен +Comment[sr@ijekavianlatin]=Došlo je do ozbiljne greške zbog koje je program obustavljen +Comment[sr@latin]=Došlo je do ozbiljne greške zbog koje je program obustavljen +Comment[sv]=Ett allvarligt fel uppstod vilket fick programmet att avslutas +Comment[tr]=Uygulamadan çıkılacak kadar önemli bir hata oluştu +Comment[uk]=Трапилась серйозна помилка, що призвела до закриття програми +Comment[x-test]=xxThere was a serious error causing the program to exitxx +Comment[zh_CN]=有一个严重错误导致程序退出 +Comment[zh_TW]=程式發生了嚴重錯誤,必須離開 +Action=Popup + +[Event/notification] +Name=Notification +Name[ar]=إخطار +Name[bs]=Obavještenje +Name[ca]=Notificació +Name[ca@valencia]=Notificació +Name[cs]=Upozornění +Name[da]=Bekendtgørelse +Name[de]=Benachrichtigung +Name[el]=Ειδοποίηση +Name[en_GB]=Notification +Name[es]=Notificación +Name[et]=Märguanne +Name[eu]=Jakinarazpena +Name[fi]=Ilmoitus +Name[fr]=Notification +Name[gd]=Brath +Name[gl]=Notificación +Name[he]=התראה +Name[hu]=Értesítés +Name[ia]=Notification +Name[id]=Notifikasi +Name[it]=Notifica +Name[ko]=알림 +Name[lt]=Pranešimas +Name[nb]=Varsling +Name[nds]=Bescheed +Name[nl]=Melding +Name[nn]=Varsling +Name[pa]=ਸੂਚਨਾ +Name[pl]=Powiadomienie +Name[pt]=Notificação +Name[pt_BR]=Notificação +Name[ru]=Уведомление +Name[sk]=Pripomienka +Name[sl]=Obvestila +Name[sr]=Обавештење +Name[sr@ijekavian]=Обавештење +Name[sr@ijekavianlatin]=Obaveštenje +Name[sr@latin]=Obaveštenje +Name[sv]=Underrättelse +Name[tr]=Bildirim +Name[uk]=Сповіщення +Name[x-test]=xxNotificationxx +Name[zh_CN]=通知 +Name[zh_TW]=通知 +Comment=Something special happened in the program +Comment[ar]=حدث شيء خاص في البرنامج +Comment[bs]=Nešto posebno se dogodilo u programu +Comment[ca]=Quelcom especial ha passat en el programa +Comment[ca@valencia]=Alguna cosa especial ha passat en el programa +Comment[cs]=Něco zvláštního se stalo s programem +Comment[da]=Noget specielt skete i programmet +Comment[de]=Im Programm ist ein besonderes Ereignis eingetreten +Comment[el]=Κάτι ιδιαίτερο συνέβη στο πρόγραμμα +Comment[en_GB]=Something special happened in the program +Comment[es]=Ha ocurrido algo especial en el programa +Comment[et]=Programmis juhtus midagi erilist +Comment[eu]=Zerbait berezia gertatu da programan +Comment[fi]=Ohjelmassa tapahtui jotakin erikoista +Comment[fr]=Quelque chose d'anormal s'est produit dans le programme +Comment[gd]=Thachair rudeigin sònraichte sa phrògram +Comment[gl]=Ocorreu algo especial no programa +Comment[he]=משהו מיוחד קרה ביישום +Comment[hu]=Valamilyen esemény következett be a programban +Comment[ia]=Il occurreva qualcosa de special in le programma +Comment[id]=Sesuatu yang istimewa terjadi dalam program +Comment[it]=Si è verificato qualcosa di speciale nel programma +Comment[ko]=프로그램에서 특별한 일이 발생함 +Comment[lt]=Kažkoks specialus įvykis programoje +Comment[nb]=Det hendte noe spesielt i programmet +Comment[nds]=Dat geev en afsünnerlich Begeefnis binnen dat Programm +Comment[nl]=Er gebeurde iets bijzonders in het programma +Comment[nn]=Det skjedde noko spesielt i programmet +Comment[pl]=Coś niezwykłego stało się z programem +Comment[pt]=Ocorreu algo de especial no programa +Comment[pt_BR]=Algo especial aconteceu no programa +Comment[ru]=С программой произошло что-то странное +Comment[sk]=V programe sa stalo niečo zvláštne +Comment[sl]=V programu se je zgodilo nekaj posebnega +Comment[sr]=Нешто посебно се догодило у програму +Comment[sr@ijekavian]=Нешто посебно се догодило у програму +Comment[sr@ijekavianlatin]=Nešto posebno se dogodilo u programu +Comment[sr@latin]=Nešto posebno se dogodilo u programu +Comment[sv]=Någonting speciellt inträffade i programmet +Comment[tr]=Uygulamada bazı özel durumlar oluştu +Comment[uk]=Щось особливе сталось у програмі +Comment[x-test]=xxSomething special happened in the programxx +Comment[zh_CN]=这个程序中发生了特殊的事情 +Comment[zh_TW]=程式中發生了特殊事件 +Action=Popup + +[Event/warning] +Name=Warning +Name[ar]=تحذير +Name[bs]=Upozorenje +Name[ca]=Avís +Name[ca@valencia]=Avís +Name[cs]=Varování +Name[da]=Advarsel +Name[de]=Warnung +Name[el]=Προειδοποίηση +Name[en_GB]=Warning +Name[es]=Advertencia +Name[et]=Hoiatus +Name[eu]=Abisua +Name[fi]=Varoitus +Name[fr]=Avertissement +Name[gd]=Rabhadh +Name[gl]=Aviso +Name[he]=אזהרה +Name[hu]=Figyelmeztetés +Name[ia]=Aviso +Name[id]=Peringatan +Name[it]=Avviso +Name[ko]=경고 +Name[lt]=Perspėjimas +Name[nb]=Advarsel +Name[nds]=Wohrschoen +Name[nl]=Waarschuwing +Name[nn]=Åtvaring +Name[pa]=ਚੇਤਾਵਨੀ +Name[pl]=Ostrzeżenie +Name[pt]=Aviso +Name[pt_BR]=Aviso +Name[ru]=Предупреждение +Name[sk]=Upozornenie +Name[sl]=Opozorilo +Name[sr]=Упозорење +Name[sr@ijekavian]=Упозорење +Name[sr@ijekavianlatin]=Upozorenje +Name[sr@latin]=Upozorenje +Name[sv]=Varning +Name[tr]=Uyarı +Name[uk]=Попередження +Name[x-test]=xxWarningxx +Name[zh_CN]=警告 +Name[zh_TW]=警告 +Comment=There was an error in the program which may cause problems +Comment[ar]=حدث خطأ في البرنامج مما تسبّب بمشاكل +Comment[bs]=Došlo je do greške u programu koja može izazvati probleme +Comment[ca]=S'ha produït un error en el programa que pot provocar problemes +Comment[ca@valencia]=S'ha produït un error en el programa que pot provocar problemes +Comment[cs]=V programu nastala chyba, která může způsobit problémy +Comment[da]=Der var en fejl i program som kan volde problemer +Comment[de]=Im Programm ist ein Fehler aufgetreten, der Probleme verursachen könnte +Comment[el]=Υπήρξε σφάλμα στο πρόγραμμα που μπορεί να προκαλέσει προβλήματα +Comment[en_GB]=There was an error in the program which may cause problems +Comment[es]=Ha ocurrido un error en el programa que puede causar problemas +Comment[et]=Programmis tekkis viga, mis võib tekitada probleeme +Comment[eu]=Errore bat egon da programan arazoak sor ditzakeena +Comment[fi]=Ohjelmassa oli virhe, joka voi aiheuttaa ongelmia +Comment[fr]=Il y a eu une erreur dans le programme qui peut causer des problèmes +Comment[gd]=Bha mearachd sa phrògram a dh'adhbharaicheas trioblaid ma dh'fhaoidte +Comment[gl]=Produciuse un erro no programa que pode causar problemas +Comment[he]=אירעה שגיאה ביישום, דבר העלול לגרום לבעיות +Comment[hu]=Hiba történt a programban, de a program futása folytatódhat +Comment[ia]=Il habeva un error in le programma que il pote causar problemas +Comment[id]=Ada sebuah error dalam program yang menyebabkan masalah +Comment[it]=Si è verificato un errore nel programma che potrebbe causare problemi +Comment[ko]=프로그램에 문제를 가져올 수 있는 오류가 발생함 +Comment[lt]=Įvyko programos klaida, galinti sukelti problemų +Comment[nb]=I programmet oppsto det en feil som kan gi vanskeligheter +Comment[nds]=Dat geev en Fehler binnen dat Programm, villicht suert dor Problemen bi rut +Comment[nl]=Er deed zich een fout voor in het programma dat problemen kan veroorzaken +Comment[nn]=Det oppstod ein feil i programmet som kan gje problem +Comment[pl]=W programie wystąpił błąd, może powodować problemy +Comment[pt]=Ocorreu um erro no programa que poderá provocar problemas +Comment[pt_BR]=Ocorreu um erro no programa, que pode causar problemas +Comment[ru]=В программе произошла ошибка, которая может вызвать проблемы +Comment[sk]=V programe sa vyskytla chyba, ktorá môže spôsobiť problémy +Comment[sl]=V programu je prišlo do napake, ki lahko povzroči težave +Comment[sr]=Дошло је до грешке у програму која може изазвати проблеме +Comment[sr@ijekavian]=Дошло је до грешке у програму која може изазвати проблеме +Comment[sr@ijekavianlatin]=Došlo je do greške u programu koja može izazvati probleme +Comment[sr@latin]=Došlo je do greške u programu koja može izazvati probleme +Comment[sv]=Det uppstod ett fel i programmet vilket kan orsaka problem +Comment[tr]=Uygulamada sorunlara neden olabilecek bir hata oluştu +Comment[uk]=В програмі трапилась помилка, яка може спричинити проблеми +Comment[x-test]=xxThere was an error in the program which may cause problemsxx +Comment[zh_CN]=程序中有一个错误,它可能导致一些问题 +Comment[zh_TW]=程式中發生錯誤,可能造成問題 +Action=Popup + +[Event/catastrophe] +Name=Catastrophe +Name[ar]=كارثة +Name[bs]=Katastrofa +Name[ca]=Catàstrofe +Name[ca@valencia]=Catàstrofe +Name[cs]=Katastrofa +Name[da]=Katastrofe +Name[de]=Katastrophe +Name[el]=Καταστροφή +Name[en_GB]=Catastrophe +Name[es]=Catástrofe +Name[et]=Katastroof +Name[eu]=Hondamendia +Name[fi]=Katastrofi +Name[fr]=Catastrophe +Name[gd]=Tubaist +Name[gl]=Catástrofe +Name[he]=קטטסטרופה +Name[hu]=Súlyos hiba +Name[ia]=Catastrophe +Name[id]=Malapetaka +Name[it]=Catastrofe +Name[ko]=중대한 오류 +Name[lt]=Katastrofa +Name[nb]=Katastrofe +Name[nds]=Groot Malöör +Name[nl]=Catastrofe +Name[nn]=Katastrofe +Name[pl]=Katastrofa +Name[pt]=Catástrofe +Name[pt_BR]=Catástrofe +Name[ru]=Катастрофа +Name[sk]=Katastrofa +Name[sl]=Katastrofa +Name[sr]=Катастрофа +Name[sr@ijekavian]=Катастрофа +Name[sr@ijekavianlatin]=Katastrofa +Name[sr@latin]=Katastrofa +Name[sv]=Katastrof +Name[tr]=Felaket +Name[uk]=Катастрофа +Name[x-test]=xxCatastrophexx +Name[zh_CN]=严重故障 +Name[zh_TW]=發生大災難 +Comment=A very serious error occurred, at least causing the program to exit +Comment[ar]=حدث خطأ جاد جدًا، تسبّب للبرنامج بإنهائه على أقل تقدير +Comment[bs]=Došlo je do vrlo ozbiljne greške, zbog koje je bar program obustavljen +Comment[ca]=S'ha produït un error molt seriós, com a mínim ha provocat la sortida del programa +Comment[ca@valencia]=S'ha produït un error molt seriós, com a mínim ha provocat l'eixida del programa +Comment[cs]=Nastala velmi závažná chyba, která má za následek minimálně ukončení programu +Comment[da]=En meget alvorlig fejl opstod, som mindst forårsagede at programmet afsluttede +Comment[de]=Ein sehr schwerer Fehler ist aufgetreten, der wenigstens das Programm zum Beenden bringt +Comment[el]=Συνέβη ένα πολύ σοβαρό σφάλμα, που προκάλεσε την έξοδο του προγράμματος +Comment[en_GB]=A very serious error occurred, at least causing the program to exit +Comment[es]=Ha ocurrido un error muy serio que ha causado, al menos, la salida del programa +Comment[et]=Tekkis väga tõsine viga, mis sundis programmi tööd lõpetama +Comment[eu]=Errore oso garrantzitsu bat egon da, gutxienez programa ixtea eragin duena +Comment[fi]=Tapahtui erittäin vakava virhe, joka aiheutti ainakin ohjelman päättymisen +Comment[fr]=Une erreur très grave s'est produite, provoquant au minimum la fin du programme +Comment[gd]=Thachair mearachd glè dhona agus chaidh am prògram fhàgail air a char as lugha +Comment[gl]=Produciuse un erro moi grave, que como mínimo fixo que o programa saíse +Comment[he]=אירעה שגיאה חמורה מאוד, הגרמה ליישום כנראה להיסגר +Comment[hu]=Hiba történt a programban, a program futása befejeződött +Comment[ia]=Il occurreva un error le plus serie, al minus causante le exito del programma +Comment[id]=Sebuah error yang sangat serius terjadi, setidaknya menyebabkan program keluar +Comment[it]=Si è verificato un errore molto grave, che ha causato almeno la chiusura del programma +Comment[ko]=프로그램이 종료될 정도의 매우 큰 오류가 발생함 +Comment[lt]=Įvyko labai rimta klaida, privertusi programą bent jau baigti darbą. +Comment[nb]=Det oppsto en meget alvorlig feil som minst førte til at programmet stoppet +Comment[nds]=Dat geev en groot Malöör, tominnst dat Programm is utstegen +Comment[nl]=Er deed zich een serieuze fout voor dat er op zijn minst voor zorgde dat het programma werd afgesloten +Comment[nn]=Det oppstod ein svært alvorleg feil som førte til at programmet avslutta +Comment[pl]=Wystąpił bardzo poważny błąd, co najmniej nastąpiło zakończenie pracy programu +Comment[pt]=Ocorreu um erro muito sério, que fez pelo menos com que o programa saísse +Comment[pt_BR]=Um erro muito sério aconteceu, que causou (no mínimo) o fechamento do programa +Comment[ru]=Произошла очень серьёзная ошибка, как минимум, вызвавшая завершение работы программы +Comment[sk]=Nastala veľmi vážna chyba, ktorá zapríčinila minimálne ukončenie programu +Comment[sl]=Prišlo je do zelo resne napake, zaradi katere se je program končal +Comment[sr]=Дошло је до врло озбиљне грешке, због које је бар програм обустављен +Comment[sr@ijekavian]=Дошло је до врло озбиљне грешке, због које је бар програм обустављен +Comment[sr@ijekavianlatin]=Došlo je do vrlo ozbiljne greške, zbog koje je bar program obustavljen +Comment[sr@latin]=Došlo je do vrlo ozbiljne greške, zbog koje je bar program obustavljen +Comment[sv]=Ett mycket allvarligt fel uppstod, som åtminstone fick programmet att avslutas +Comment[tr]=En azından uygulamadan çıkılacak kadar önemli bir hata oluştu +Comment[uk]=Трапилась дуже серйозна помилка, яка призвела до закриття програми +Comment[x-test]=xxA very serious error occurred, at least causing the program to exitxx +Comment[zh_CN]=发生了一个非常严重的错误,至少已经导致了这个程序退出 +Comment[zh_TW]=發生了非常嚴重的問題,至少造成程式被迫結束 +Action=Popup diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.54.0/src/knotification.cpp new/knotifications-5.55.0/src/knotification.cpp --- old/knotifications-5.54.0/src/knotification.cpp 2019-01-06 21:24:58.000000000 +0100 +++ new/knotifications-5.55.0/src/knotification.cpp 2019-02-03 01:00:12.000000000 +0100 @@ -338,6 +338,15 @@ } } +static QString defaultComponentName() +{ +#ifndef Q_OS_ANDROID + return QStringLiteral("plasma_workspace"); +#else + return QStringLiteral("android_defaults"); +#endif +} + KNotification *KNotification::event(const QString &eventid, const QString &title, const QString &text, const QPixmap &pixmap, QWidget *widget, const NotificationFlags &flags, const QString &componentName) { @@ -345,7 +354,7 @@ notify->setTitle(title); notify->setText(text); notify->setPixmap(pixmap); - notify->setComponentName((flags & DefaultEvent) ? QStringLiteral("plasma_workspace") : componentName); + notify->setComponentName((flags & DefaultEvent) ? defaultComponentName() : componentName); QTimer::singleShot(0, notify, &KNotification::sendEvent); @@ -379,7 +388,7 @@ notify->setTitle(title); notify->setText(text); notify->setIconName(iconName); - notify->setComponentName((flags & DefaultEvent) ? QStringLiteral("plasma_workspace") : componentName); + notify->setComponentName((flags & DefaultEvent) ? defaultComponentName() : componentName); QTimer::singleShot(0, notify, &KNotification::sendEvent); @@ -441,7 +450,7 @@ QString appname; if (d->flags & DefaultEvent) { - appname = QStringLiteral("plasma_workspace"); + appname = defaultComponentName(); } else if (!d->componentName.isEmpty()) { appname = d->componentName; } else { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.54.0/src/knotification.h new/knotifications-5.55.0/src/knotification.h --- old/knotifications-5.54.0/src/knotification.h 2019-01-06 21:24:58.000000000 +0100 +++ new/knotifications-5.55.0/src/knotification.h 2019-02-03 01:00:12.000000000 +0100 @@ -29,7 +29,6 @@ #include <QUrl> class QWidget; -class QDBusError; /** * @class KNotification knotification.h KNotification diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.54.0/src/knotificationmanager.cpp new/knotifications-5.55.0/src/knotificationmanager.cpp --- old/knotifications-5.54.0/src/knotificationmanager.cpp 2019-01-06 21:24:58.000000000 +0100 +++ new/knotifications-5.55.0/src/knotificationmanager.cpp 2019-02-03 01:00:12.000000000 +0100 @@ -147,7 +147,7 @@ } else { plugin = new NotifyByPopup(this); } -#elif __ANDROID_API__ >= 23 +#else plugin = new NotifyByAndroid(this); #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.54.0/src/knotifications.qrc new/knotifications-5.55.0/src/knotifications.qrc --- old/knotifications-5.54.0/src/knotifications.qrc 1970-01-01 01:00:00.000000000 +0100 +++ new/knotifications-5.55.0/src/knotifications.qrc 2019-02-03 01:00:12.000000000 +0100 @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/knotifications5"> + <file>android_defaults.notifyrc</file> + </qresource> +</RCC> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.54.0/src/knotifyconfig.cpp new/knotifications-5.55.0/src/knotifyconfig.cpp --- old/knotifications-5.54.0/src/knotifyconfig.cpp 2019-01-06 21:24:58.000000000 +0100 +++ new/knotifications-5.55.0/src/knotifyconfig.cpp 2019-02-03 01:00:12.000000000 +0100 @@ -38,6 +38,10 @@ } KSharedConfig::Ptr m = KSharedConfig::openConfig(filename, KConfig::NoGlobals, type); + // also search for event config files in qrc resources + if (type == QStandardPaths::GenericDataLocation) { + m->addConfigSources({QStringLiteral(":/") + filename}); + } cache.insert(filename, new KSharedConfig::Ptr(m)); return m; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.54.0/src/notifybyandroid.cpp new/knotifications-5.55.0/src/notifybyandroid.cpp --- old/knotifications-5.54.0/src/notifybyandroid.cpp 2019-01-06 21:24:58.000000000 +0100 +++ new/knotifications-5.55.0/src/notifybyandroid.cpp 2019-02-03 01:00:12.000000000 +0100 @@ -17,6 +17,7 @@ #include "notifybyandroid.h" #include "knotification.h" +#include "knotifyconfig.h" #include "debug_p.h" #include <QtAndroid> @@ -77,9 +78,7 @@ 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() @@ -94,15 +93,15 @@ void NotifyByAndroid::notify(KNotification *notification, KNotifyConfig *config) { + Q_UNUSED(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); + // note that config will be invalid at that point, so we can't pass that along + QMetaObject::invokeMethod(this, [this, notification](){ notifyDeferred(notification); }, Qt::QueuedConnection); } -void NotifyByAndroid::notifyDeferred(KNotification* notification, const KNotifyConfig* config) +void NotifyByAndroid::notifyDeferred(KNotification* notification) { - Q_UNUSED(config); - -#if __ANDROID_API__ >= 23 + KNotifyConfig config(notification->appName(), notification->contexts(), notification->eventId()); QAndroidJniEnvironment env; QAndroidJniObject n("org/kde/knotifications/KNotification", "()V"); @@ -110,6 +109,10 @@ n.setField("text", QAndroidJniObject::fromString(notification->text()).object<jstring>()); n.setField("title", QAndroidJniObject::fromString(notification->title()).object<jstring>()); + n.setField("channelId", QAndroidJniObject::fromString(notification->eventId()).object<jstring>()); + n.setField("channelName", QAndroidJniObject::fromString(config.readEntry(QLatin1String("Name"))).object<jstring>()); + n.setField("channelDescription", QAndroidJniObject::fromString(config.readEntry(QLatin1String("Comment"))).object<jstring>()); + // icon QPixmap pixmap; if (!notification->iconName().isEmpty()) { @@ -125,6 +128,7 @@ 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()); + env->DeleteLocalRef(jIconData); // actions const auto actions = notification->actions(); @@ -135,16 +139,11 @@ 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); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.54.0/src/notifybyandroid.h new/knotifications-5.55.0/src/notifybyandroid.h --- old/knotifications-5.54.0/src/notifybyandroid.h 2019-01-06 21:24:58.000000000 +0100 +++ new/knotifications-5.55.0/src/notifybyandroid.h 2019-02-03 01:00:12.000000000 +0100 @@ -41,7 +41,7 @@ void notificationActionInvoked(int id, int action); private: - void notifyDeferred(KNotification *notification, const KNotifyConfig *config); + void notifyDeferred(KNotification *notification); QAndroidJniObject m_backend; QHash<int, QPointer<KNotification>> m_notifications; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.54.0/src/org/kde/knotifications/KNotification.java new/knotifications-5.55.0/src/org/kde/knotifications/KNotification.java --- old/knotifications-5.54.0/src/org/kde/knotifications/KNotification.java 2019-01-06 21:24:58.000000000 +0100 +++ new/knotifications-5.55.0/src/org/kde/knotifications/KNotification.java 1970-01-01 01:00:00.000000000 +0100 @@ -1,43 +0,0 @@ -/* - Copyright (C) 2018 Volker Krause <vkra...@kde.org> - - 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.54.0/src/org/kde/knotifications/NotifyByAndroid.java new/knotifications-5.55.0/src/org/kde/knotifications/NotifyByAndroid.java --- old/knotifications-5.54.0/src/org/kde/knotifications/NotifyByAndroid.java 2019-01-06 21:24:58.000000000 +0100 +++ new/knotifications-5.55.0/src/org/kde/knotifications/NotifyByAndroid.java 1970-01-01 01:00:00.000000000 +0100 @@ -1,113 +0,0 @@ -/* - Copyright (C) 2018 Volker Krause <vkra...@kde.org> - - 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); -}