Hello community, here is the log from the commit of package knotifications for openSUSE:Factory checked in at 2019-11-12 11:48:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/knotifications (Old) and /work/SRC/openSUSE:Factory/.knotifications.new.2990 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "knotifications" Tue Nov 12 11:48:48 2019 rev:74 rq:747128 version:5.64.0 Changes: -------- --- /work/SRC/openSUSE:Factory/knotifications/knotifications.changes 2019-10-14 13:37:48.121976063 +0200 +++ /work/SRC/openSUSE:Factory/.knotifications.new.2990/knotifications.changes 2019-11-12 11:48:55.726942112 +0100 @@ -1,0 +2,12 @@ +Sun Nov 3 15:47:10 UTC 2019 - Christophe Giboudeaux <[email protected]> + +- Update to 5.64.0 + * New feature release + * For more details please see: + * https://www.kde.org/announcements/kde-frameworks-5.64.0.php +- Changes since 5.63.0: + * [KStatusNotifierItem] Allow left click when menu is null + * Remove Growl support + * Add and enable Notification Center support in macOS + +------------------------------------------------------------------- Old: ---- knotifications-5.63.0.tar.xz knotifications-5.63.0.tar.xz.sig New: ---- knotifications-5.64.0.tar.xz knotifications-5.64.0.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ knotifications.spec ++++++ --- /var/tmp/diff_new_pack.tTqbTk/_old 2019-11-12 11:48:56.414942816 +0100 +++ /var/tmp/diff_new_pack.tTqbTk/_new 2019-11-12 11:48:56.418942820 +0100 @@ -17,14 +17,14 @@ %define lname libKF5Notifications5 -%define _tar_path 5.63 +%define _tar_path 5.64 # 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.63.0 +Version: 5.64.0 Release: 0 Summary: KDE Desktop notifications License: LGPL-2.1-or-later ++++++ knotifications-5.63.0.tar.xz -> knotifications-5.64.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.63.0/CMakeLists.txt new/knotifications-5.64.0/CMakeLists.txt --- old/knotifications-5.63.0/CMakeLists.txt 2019-10-06 11:48:20.000000000 +0200 +++ new/knotifications-5.64.0/CMakeLists.txt 2019-11-02 13:58:56.000000000 +0100 @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 3.5) -set(KF5_VERSION "5.63.0") # handled by release scripts -set(KF5_DEP_VERSION "5.63.0") # handled by release scripts +set(KF5_VERSION "5.64.0") # handled by release scripts +set(KF5_DEP_VERSION "5.64.0") # handled by release scripts project(KNotifications VERSION ${KF5_VERSION}) # ECM setup include(FeatureSummary) -find_package(ECM 5.63.0 NO_MODULE) +find_package(ECM 5.64.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) @@ -119,6 +119,7 @@ if (NOT APPLE) # QtMac::setBadgeLabelText is deprecated add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050d00) endif() +add_definitions(-DQT_DEPRECATED_WARNINGS_SINCE=0x060000) add_subdirectory(src) if (BUILD_TESTING) add_subdirectory(tests) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.63.0/po/gl/knotifications5_qt.po new/knotifications-5.64.0/po/gl/knotifications5_qt.po --- old/knotifications-5.63.0/po/gl/knotifications5_qt.po 2019-10-06 11:48:20.000000000 +0200 +++ new/knotifications-5.64.0/po/gl/knotifications5_qt.po 2019-11-02 13:58:56.000000000 +0100 @@ -1,7 +1,6 @@ # translation of kdelibs4.po to galician # Copyright (C) YEAR This_file_is_part_of_KDE # This file is distributed under the same license as the PACKAGE package. -# # mvillarino <[email protected]>, 2007, 2008, 2009. # Marce Villarino <[email protected]>, 2008, 2009. # marce villarino <[email protected]>, 2009. @@ -9,25 +8,28 @@ # Marce Villarino <[email protected]>, 2009, 2010, 2011, 2012. # Xosé <[email protected]>, 2010. # Marce Villarino <[email protected]>, 2011, 2012, 2013, 2014. +# Adrián Chaves (Gallaecio) <[email protected]>, 2019. +# 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-05-12 23:30+0200\n" -"Last-Translator: Marce Villarino <[email protected]>\n" -"Language-Team: Galician <[email protected]>\n" +"PO-Revision-Date: 2019-10-19 22:26+0200\n" +"Last-Translator: Adrián Chaves (Gallaecio) <[email protected]>\n" +"Language-Team: Galician <[email protected]>\n" "Language: gl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Lokalize 19.11.70\n" "X-Qt-Contexts: true\n" #: knotificationrestrictions.cpp:192 msgctxt "KNotificationRestrictions|" msgid "Unknown Application" -msgstr "Aplicativo descoñecido" +msgstr "Aplicación descoñecida" #: kstatusnotifieritem.cpp:500 kstatusnotifieritem.cpp:1066 msgctxt "KStatusNotifierItem|" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.63.0/po/id/knotifications5_qt.po new/knotifications-5.64.0/po/id/knotifications5_qt.po --- old/knotifications-5.63.0/po/id/knotifications5_qt.po 2019-10-06 11:48:20.000000000 +0200 +++ new/knotifications-5.64.0/po/id/knotifications5_qt.po 2019-11-02 13:58:56.000000000 +0100 @@ -17,7 +17,6 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Lokalize 19.04.3\n" "X-Qt-Contexts: true\n" #: knotificationrestrictions.cpp:192 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.63.0/po/zh_CN/knotifications5_qt.po new/knotifications-5.64.0/po/zh_CN/knotifications5_qt.po --- old/knotifications-5.63.0/po/zh_CN/knotifications5_qt.po 2019-10-06 11:48:20.000000000 +0200 +++ new/knotifications-5.64.0/po/zh_CN/knotifications5_qt.po 2019-11-02 13:58:56.000000000 +0100 @@ -13,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: kdeorg\n" -"PO-Revision-Date: 2019-09-05 09:24\n" +"PO-Revision-Date: 2019-10-09 09:44\n" "Last-Translator: Guo Yunhe (guoyunhe)\n" "Language-Team: Chinese Simplified\n" "Language: zh_CN\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.63.0/src/CMakeLists.txt new/knotifications-5.64.0/src/CMakeLists.txt --- old/knotifications-5.63.0/src/CMakeLists.txt 2019-10-06 11:48:20.000000000 +0200 +++ new/knotifications-5.64.0/src/CMakeLists.txt 2019-11-02 13:58:56.000000000 +0100 @@ -15,7 +15,6 @@ knotifyconfig.cpp knotificationplugin.cpp - notifybypopupgrowl.cpp notifybyexecute.cpp notifybylogfile.cpp notifybytaskbar.cpp @@ -43,6 +42,10 @@ list(APPEND knotifications_SRCS notifybysnore.cpp) endif () +if (APPLE) + list(APPEND knotifications_SRCS notifybymacosnotificationcenter.mm) +endif() + ecm_qt_declare_logging_category(knotifications_SRCS HEADER debug_p.h IDENTIFIER LOG_KNOTIFICATIONS CATEGORY_NAME org.kde.knotifications) if (Canberra_FOUND) @@ -120,7 +123,7 @@ endif() if(APPLE) - target_link_libraries(KF5Notifications PRIVATE Qt5::MacExtras) + target_link_libraries(KF5Notifications PRIVATE Qt5::MacExtras "-framework Foundation" "-framework AppKit") endif() if(X11_XTest_FOUND) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.63.0/src/knotificationmanager.cpp new/knotifications-5.64.0/src/knotificationmanager.cpp --- old/knotifications-5.63.0/src/knotificationmanager.cpp 2019-10-06 11:48:20.000000000 +0200 +++ new/knotifications-5.64.0/src/knotificationmanager.cpp 2019-11-02 13:58:56.000000000 +0100 @@ -40,6 +40,8 @@ #if defined(Q_OS_ANDROID) #include "notifybyandroid.h" +#elif defined(Q_OS_MACOS) +#include "notifybymacosnotificationcenter.h" #elif defined(Q_OS_WIN) #include "notifybysnore.h" #else @@ -137,6 +139,8 @@ plugin = new NotifyByAndroid(this); #elif defined(Q_OS_WIN) plugin = new NotifyBySnore(this); +#elif defined(Q_OS_MACOS) + plugin = new NotifyByMacOSNotificationCenter(this); #else if (d->portalDBusServiceExists) { plugin = new NotifyByPortal(this); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.63.0/src/kstatusnotifieritem.cpp new/knotifications-5.64.0/src/kstatusnotifieritem.cpp --- old/knotifications-5.63.0/src/kstatusnotifieritem.cpp 2019-10-06 11:48:20.000000000 +0200 +++ new/knotifications-5.64.0/src/kstatusnotifieritem.cpp 2019-11-02 13:58:56.000000000 +0100 @@ -616,12 +616,12 @@ emit d->statusNotifierItemDBus->NewStatus(QString::fromLatin1(metaObject()->enumerator(metaObject()->indexOfEnumerator("ItemStatus")).valueToKey(d->status))); } - if (d->associatedWidget == d->menu) { + if (d->associatedWidget && d->associatedWidget == d->menu) { d->statusNotifierItemDBus->ContextMenu(pos.x(), pos.y()); return; } - if (d->menu->isVisible()) { + if (d->menu && d->menu->isVisible()) { d->menu->hide(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.63.0/src/kstatusnotifieritemdbus_p.cpp new/knotifications-5.64.0/src/kstatusnotifieritemdbus_p.cpp --- old/knotifications-5.63.0/src/kstatusnotifieritemdbus_p.cpp 2019-10-06 11:48:20.000000000 +0200 +++ new/knotifications-5.64.0/src/kstatusnotifieritemdbus_p.cpp 2019-11-02 13:58:56.000000000 +0100 @@ -290,11 +290,7 @@ void KStatusNotifierItemDBus::Activate(int x, int y) { - if (m_statusNotifierItem->d->associatedWidget == m_statusNotifierItem->d->menu) { - ContextMenu(x, y); - } else { - m_statusNotifierItem->activate(QPoint(x, y)); - } + m_statusNotifierItem->activate(QPoint(x, y)); } void KStatusNotifierItemDBus::SecondaryActivate(int x, int y) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.63.0/src/notifybymacosnotificationcenter.h new/knotifications-5.64.0/src/notifybymacosnotificationcenter.h --- old/knotifications-5.63.0/src/notifybymacosnotificationcenter.h 1970-01-01 01:00:00.000000000 +0100 +++ new/knotifications-5.64.0/src/notifybymacosnotificationcenter.h 2019-11-02 13:58:56.000000000 +0100 @@ -0,0 +1,20 @@ +#ifndef NOTIFYBYMACOSNOTIFICATIONCENTER_H +#define NOTIFYBYMACOSNOTIFICATIONCENTER_H + +#include "knotificationplugin.h" + +class NotifyByMacOSNotificationCenter : public KNotificationPlugin +{ + Q_OBJECT + +public: + NotifyByMacOSNotificationCenter(QObject* parent); + ~NotifyByMacOSNotificationCenter() override; + + QString optionName() override { return QStringLiteral("Popup"); } + void notify(KNotification *notification, KNotifyConfig *config) override; + void update(KNotification *notification, KNotifyConfig *config) override; + void close(KNotification *notification) override; +}; + +#endif // NOTIFYBYMACOSNOTIFICATIONCENTER_H \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.63.0/src/notifybymacosnotificationcenter.mm new/knotifications-5.64.0/src/notifybymacosnotificationcenter.mm --- old/knotifications-5.63.0/src/notifybymacosnotificationcenter.mm 1970-01-01 01:00:00.000000000 +0100 +++ new/knotifications-5.64.0/src/notifybymacosnotificationcenter.mm 2019-11-02 13:58:56.000000000 +0100 @@ -0,0 +1,228 @@ +#include "notifybymacosnotificationcenter.h" +#include "knotification.h" +#include "knotifyconfig.h" +#include "debug_p.h" + +#include <QIcon> +#include <QDebug> +#include <QtMac> + +#import <Appkit/Appkit.h> +#import <Foundation/Foundation.h> +#import <objc/runtime.h> + + +Q_FORWARD_DECLARE_OBJC_CLASS(MacOSNotificationCenterDelegate); + +class MacOSNotificationCenterPrivate +{ +public: + static MacOSNotificationCenterPrivate *instance(); + ~MacOSNotificationCenterPrivate(); + + QMap<int, KNotification*> m_notifications; + + int m_internalCounter; +private: + MacOSNotificationCenterPrivate(); + MacOSNotificationCenterDelegate *m_delegate; + static MacOSNotificationCenterPrivate *m_instance; +}; + +@interface MacOSNotificationCenterDelegate : NSObject<NSUserNotificationCenterDelegate> {} +@end + +@implementation MacOSNotificationCenterDelegate +- (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification +{ + Q_UNUSED(center); + Q_UNUSED(notification); + return YES; +} + +- (void)userNotificationCenter:(NSUserNotificationCenter *)center didDeliverNotification:(NSUserNotification *)notification +{ + Q_UNUSED(center); + Q_UNUSED(notification); + qCDebug(LOG_KNOTIFICATIONS) << "Send notification " << [notification.userInfo[@"id"] intValue]; +} + +- (void) userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification +{ + Q_UNUSED(center); + qCDebug(LOG_KNOTIFICATIONS) << "User clicked on notification " + << [notification.userInfo[@"id"] intValue] + << ", internal Id: " + << [notification.userInfo[@"internalId"] intValue]; + + switch (notification.activationType) { + case NSUserNotificationActivationTypeReplied: + qCDebug(LOG_KNOTIFICATIONS) << "Replied clicked"; + break; + case NSUserNotificationActivationTypeContentsClicked: { + qCDebug(LOG_KNOTIFICATIONS) << "Content clicked"; + KNotification *originNotification = MacOSNotificationCenterPrivate::instance()->m_notifications.value([notification.userInfo[@"internalId"] intValue]); + if (!originNotification || originNotification->defaultAction().isNull()) { + break; + } + emit originNotification->activate(); + } + break; + case NSUserNotificationActivationTypeActionButtonClicked: { + qCDebug(LOG_KNOTIFICATIONS) << "Main action clicked"; + KNotification *originNotification = MacOSNotificationCenterPrivate::instance()->m_notifications.value([notification.userInfo[@"internalId"] intValue]); + if (!originNotification) { + break; + } + emit originNotification->activate(1); + } + break; + case NSUserNotificationActivationTypeAdditionalActionClicked: { + qCDebug(LOG_KNOTIFICATIONS) << "Additional action clicked"; + KNotification *originNotification = MacOSNotificationCenterPrivate::instance()->m_notifications.value([notification.userInfo[@"internalId"] intValue]); + if (!originNotification) { + break; + } + emit originNotification->activate([notification.additionalActivationAction.identifier intValue] + 1); + } + break; + default: + qCDebug(LOG_KNOTIFICATIONS) << "Other clicked"; + break; + } +} +@end + +MacOSNotificationCenterPrivate *MacOSNotificationCenterPrivate::m_instance = nullptr; + +MacOSNotificationCenterPrivate::MacOSNotificationCenterPrivate() + : m_internalCounter(0) +{ + // Set delegate + m_delegate = [MacOSNotificationCenterDelegate alloc]; + [[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:m_delegate]; +} + +MacOSNotificationCenterPrivate::~MacOSNotificationCenterPrivate() +{ + [[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate: nil]; + [m_delegate release]; + + // Try to finish all KNotification + for (auto it = m_notifications.constBegin(); it != m_notifications.constEnd(); it++) { + it.value()->deref(); + } + + // Try to finish all NSNotification + NSArray<NSUserNotification *> *deliveredNotifications = [NSUserNotificationCenter defaultUserNotificationCenter].deliveredNotifications; + for (NSUserNotification *deliveredNotification in deliveredNotifications) { + // Remove NSNotification in notification center + [[NSUserNotificationCenter defaultUserNotificationCenter] removeDeliveredNotification: deliveredNotification]; + } +} + +MacOSNotificationCenterPrivate *MacOSNotificationCenterPrivate::instance() { + if (!m_instance) { + m_instance = new MacOSNotificationCenterPrivate(); + } + return m_instance; +} + + +NotifyByMacOSNotificationCenter::NotifyByMacOSNotificationCenter(QObject* parent) + : KNotificationPlugin(parent) +{ + // Clear notifications + NSArray<NSUserNotification *> *deliveredNotifications = [NSUserNotificationCenter defaultUserNotificationCenter].deliveredNotifications; + for (NSUserNotification *deliveredNotification in deliveredNotifications) { + // Remove NSNotification in notification center + [[NSUserNotificationCenter defaultUserNotificationCenter] removeDeliveredNotification: deliveredNotification]; + } +} + +NotifyByMacOSNotificationCenter::~NotifyByMacOSNotificationCenter() {} + +void NotifyByMacOSNotificationCenter::notify(KNotification *notification, KNotifyConfig *config) +{ + Q_UNUSED(config); + + int internalId = MacOSNotificationCenterPrivate::instance()->m_internalCounter++; + NSUserNotification *osxNotification = [[[NSUserNotification alloc] init] autorelease]; + NSString *notificationId = [NSString stringWithFormat: @"%d", notification->id()]; + NSString *internalNotificationId = [NSString stringWithFormat: @"%d", internalId]; + NSString *title = notification->title().toNSString(); + NSString *text = notification->text().toNSString(); + + osxNotification.title = title; + osxNotification.userInfo = [NSDictionary dictionaryWithObjectsAndKeys: notificationId, @"id", + internalNotificationId, @"internalId", nil]; + osxNotification.informativeText = text; + + if (notification->pixmap().isNull()) { + QIcon notificationIcon = QIcon::fromTheme(notification->iconName()); + if (!notificationIcon.isNull()) { + osxNotification.contentImage = [[NSImage alloc] + initWithCGImage: notificationIcon.pixmap(QSize(64, 64)).toImage().toCGImage() size: NSMakeSize(64, 64)]; + } + } else { + osxNotification.contentImage = [[NSImage alloc] + initWithCGImage: notification->pixmap().toImage().toCGImage() size: NSMakeSize(64, 64)]; + } + + if (notification->actions().isEmpty()) { + // Remove all buttons + osxNotification.hasReplyButton = false; + osxNotification.hasActionButton = false; + } else { + osxNotification.hasActionButton = true; + // Workaround: this "API" will cause refuse from Apple + // [osxNotification setValue:[NSNumber numberWithBool:YES] forKey: @"_alwaysShowAlternateActionMenu"]; + + // Assign first action to action button + if (notification->actions().length() > 0) { + osxNotification.actionButtonTitle = notification->actions().at(0).toNSString(); + } + + // Construct a list for all actions left for additional buttons + NSMutableArray<NSUserNotificationAction*> *actions = [[NSMutableArray alloc] init]; + for (int index = 1; index < notification->actions().length(); index++) { + NSUserNotificationAction *action = + [NSUserNotificationAction actionWithIdentifier: [NSString stringWithFormat:@"%d", index] + title: notification->actions().at(index).toNSString()]; + [actions addObject: action]; + } + osxNotification.additionalActions = actions; + } + + [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification: osxNotification]; + + MacOSNotificationCenterPrivate::instance()->m_notifications.insert(internalId, notification); +} + +void NotifyByMacOSNotificationCenter::close(KNotification *notification) +{ + qCDebug(LOG_KNOTIFICATIONS) << "Remove notification " << notification->id(); + + NSArray<NSUserNotification *> *deliveredNotifications = [NSUserNotificationCenter defaultUserNotificationCenter].deliveredNotifications; + for (NSUserNotification *deliveredNotification in deliveredNotifications) { + if ([deliveredNotification.userInfo[@"id"] intValue] == notification->id()) { + // Remove KNotification in mapping + int internalId = [deliveredNotification.userInfo[@"id"] intValue]; + + MacOSNotificationCenterPrivate::instance()->m_notifications.remove(internalId); + + // Remove NSNotification in notification center + [[NSUserNotificationCenter defaultUserNotificationCenter] removeDeliveredNotification: deliveredNotification]; + finish(notification); + return; + } + } + qCDebug(LOG_KNOTIFICATIONS) << "Notification " << notification->id() << " not found"; + finish(notification); +} + +void NotifyByMacOSNotificationCenter::update(KNotification *notification, KNotifyConfig *config) +{ + close(notification); + notify(notification, config); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.63.0/src/notifybypopup.cpp new/knotifications-5.64.0/src/notifybypopup.cpp --- old/knotifications-5.63.0/src/notifybypopup.cpp 2019-10-06 11:48:20.000000000 +0200 +++ new/knotifications-5.64.0/src/notifybypopup.cpp 2019-11-02 13:58:56.000000000 +0100 @@ -23,7 +23,6 @@ #include "notifybypopup.h" #include "imageconverter.h" -#include "notifybypopupgrowl.h" #include "kpassivepopup.h" #include "knotifyconfig.h" @@ -240,32 +239,6 @@ // CloseOnTimeout => -1 == let the server decide int timeout = (notification->flags() & KNotification::Persistent) ? 0 : -1; - // if Growl can display our popups, use that instead - if (NotifyByPopupGrowl::canPopup()) { - - QString appCaption, iconName; - d->getAppCaptionAndIconName(notifyConfig, &appCaption, &iconName); - appCaption = d->stripHtml(appCaption); - - //did the user override the icon name? - if (!notification->iconName().isEmpty()) { - iconName = notification->iconName(); - } - - // Our growl implementation does not support html stuff - // so strip it off right away - QString text = notification->text(); - text = d->stripHtml(text); - - // The first arg is QPixmap*, however that pixmap is not used - // at all (it has Q_UNUSED) so just set it to 0 - NotifyByPopupGrowl::popup(nullptr, timeout, appCaption, text); - - // Finish immediately, because current NotifyByPopupGrowl can't callback - finish(notification); - return; - } - // Check if this object lives in the GUI thread and return if it doesn't // as Qt cannot create/handle widgets in non-GUI threads if (QThread::currentThread() != qApp->thread()) { @@ -401,11 +374,6 @@ d->sendNotificationToGalagoServer(notification, notifyConfig, true); return; } - - // otherwise, just display a new Growl notification - if (NotifyByPopupGrowl::canPopup()) { - notify(notification, notifyConfig); - } } void NotifyByPopup::onServiceOwnerChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner) @@ -801,13 +769,9 @@ void NotifyByPopupPrivate::queryPopupServerCapabilities() { if (!dbusServiceExists) { - if (NotifyByPopupGrowl::canPopup()) { - popupServerCapabilities = NotifyByPopupGrowl::capabilities(); - } else { - // Return capabilities of the KPassivePopup implementation - popupServerCapabilities = QStringList() << QStringLiteral("actions") << QStringLiteral("body") << QStringLiteral("body-hyperlinks") + // Return capabilities of the KPassivePopup implementation + popupServerCapabilities = QStringList() << QStringLiteral("actions") << QStringLiteral("body") << QStringLiteral("body-hyperlinks") << QStringLiteral("body-markup") << QStringLiteral("icon-static"); - } } if (dbusServiceCapCacheDirty) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.63.0/src/notifybypopupgrowl.cpp new/knotifications-5.64.0/src/notifybypopupgrowl.cpp --- old/knotifications-5.63.0/src/notifybypopupgrowl.cpp 2019-10-06 11:48:20.000000000 +0200 +++ new/knotifications-5.64.0/src/notifybypopupgrowl.cpp 1970-01-01 01:00:00.000000000 +0100 @@ -1,66 +0,0 @@ -/* - Copyright (C) 2010 by Sjors Gielen <[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 "notifybypopupgrowl.h" -#include <QFile> -#include <QSystemTrayIcon> - -#define GROWL_LOCATION_MACOSX "/Library/PreferencePanes/Growl.prefPane/Contents/MacOS/Growl" -#define GROWL_LOCATION_WIN32 "C:/Program Files/Growl for Windows/Growl.exe" - -/** - * @brief Check if Growl can display plugins. - * Currently, this checks only if Growl is installed, not if it's running. - * As soon as the Growl Notification Protocol is finished, it will be - * implemented and used for this check. - */ -bool NotifyByPopupGrowl::canPopup() -{ - return QFile::exists(QStringLiteral(GROWL_LOCATION_MACOSX)) - || QFile::exists(QStringLiteral(GROWL_LOCATION_WIN32)); -} - -/** - * @brief Get the capabilities supported by Growl. - */ -QStringList NotifyByPopupGrowl::capabilities() -{ - return QStringList(); -} - -/** - * @brief Send a popup through Growl. - * @param icon The icon inside the notification. Currently ignored. - * @param timeout The time in ms to show the notification. - * @param title The title displayed inside the notification. - * @param message The message displayed inside the notification. - */ -void NotifyByPopupGrowl::popup(const QPixmap *icon, int timeout, - const QString &title, const QString &message ) -{ - Q_UNUSED(icon); - - QSystemTrayIcon i; - i.show(); - i.showMessage(title, message, - QSystemTrayIcon::Information, timeout); - i.hide(); -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.63.0/src/notifybypopupgrowl.h new/knotifications-5.64.0/src/notifybypopupgrowl.h --- old/knotifications-5.63.0/src/notifybypopupgrowl.h 2019-10-06 11:48:20.000000000 +0200 +++ new/knotifications-5.64.0/src/notifybypopupgrowl.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,48 +0,0 @@ -/* - Copyright (C) 2010 by Sjors Gielen <[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 NOTIFYBYPOPUPGROWL_H -#define NOTIFYBYPOPUPGROWL_H - -#include <QPixmap> -#include <QString> - -/** - * @brief Display a notification using Growl. - * - * Currently, this class uses QSystemTrayIcon to actually display the - * notification. Inside the Growl project, a protocol is being developed - * to display notifications; this protocol is currently only implemented - * (partly) in the Windows version of Growl. Once it is finished, it will be - * implemented in KNotify and used instead. - * (The normal Growl API is written in Objective C. It's possible to use it, - * but it's a lot harder than just waiting for GNTP to stabilize.) - */ -class NotifyByPopupGrowl -{ -public: - static bool canPopup(); - static QStringList capabilities(); - static void popup(const QPixmap *icon, int timeout, - const QString &title, const QString &message); -}; - -#endif // NOTIFYBYPOPUPGROWL_H
