Hello community, here is the log from the commit of package knotifications for openSUSE:Factory checked in at 2015-06-23 12:10:39 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/knotifications (Old) and /work/SRC/openSUSE:Factory/.knotifications.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "knotifications" Changes: -------- --- /work/SRC/openSUSE:Factory/knotifications/knotifications.changes 2015-05-11 19:48:05.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.knotifications.new/knotifications.changes 2015-06-23 12:10:40.000000000 +0200 @@ -1,0 +2,12 @@ +Sun Jun 7 19:07:48 UTC 2015 - hrvoje.sen...@gmail.com + +- Update to 5.11.0 + * Fix crash in NotifyByExecute when no widget has been set + (kde#348510) + * Improve handling of notifications being closed (kde#342752) + * Replace QDesktopWidget usage with QScreen + * Ensure KNotification can be used from a non-GUI thread + * For more details please see: + https://www.kde.org/announcements/kde-frameworks-5.11.0.php + +------------------------------------------------------------------- Old: ---- knotifications-5.10.0.tar.xz New: ---- knotifications-5.11.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ knotifications.spec ++++++ --- /var/tmp/diff_new_pack.o15RZF/_old 2015-06-23 12:10:40.000000000 +0200 +++ /var/tmp/diff_new_pack.o15RZF/_new 2015-06-23 12:10:40.000000000 +0200 @@ -18,9 +18,9 @@ %bcond_without lang %define lname libKF5Notifications5 -%define _tar_path 5.10 +%define _tar_path 5.11 Name: knotifications -Version: 5.10.0 +Version: 5.11.0 Release: 0 %define kf5_version %{version} BuildRequires: cmake >= 2.8.12 ++++++ knotifications-5.10.0.tar.xz -> knotifications-5.11.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.10.0/CMakeLists.txt new/knotifications-5.11.0/CMakeLists.txt --- old/knotifications-5.10.0/CMakeLists.txt 2015-05-03 17:18:52.000000000 +0200 +++ new/knotifications-5.11.0/CMakeLists.txt 2015-06-06 23:23:08.000000000 +0200 @@ -3,18 +3,22 @@ project(KNotifications) # ECM setup -find_package(ECM 5.10.0 REQUIRED NO_MODULE) +include(FeatureSummary) +find_package(ECM 5.11.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) + set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) -include(FeatureSummary) + include(GenerateExportHeader) include(ECMSetupVersion) include(ECMGenerateHeaders) include(ECMPoQmTools) -set(KF5_VERSION "5.10.0") # handled by release scripts -set(KF5_DEP_VERSION "5.10.0") # handled by release scripts +set(KF5_VERSION "5.11.0") # handled by release scripts +set(KF5_DEP_VERSION "5.11.0") # handled by release scripts ecm_setup_version(${KF5_VERSION} VARIABLE_PREFIX KNOTIFICATIONS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.10.0/po/nb/knotifications5_qt.po new/knotifications-5.11.0/po/nb/knotifications5_qt.po --- old/knotifications-5.10.0/po/nb/knotifications5_qt.po 2015-05-03 17:18:52.000000000 +0200 +++ new/knotifications-5.11.0/po/nb/knotifications5_qt.po 2015-06-06 23:23:08.000000000 +0200 @@ -1,10 +1,10 @@ # Translation of knotifications5_qt to Norwegian Bokmål # -# Knut Yrvin <kn...@skolelinux.no>, 2002, 2003, 2004, 2005. +# Knut Yrvin <knut.yr...@gmail.com>, 2002, 2003, 2004, 2005. # Bjørn Steensrud <bjor...@skogkatt.homelinux.org>, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014. # Eskild Hustvedt <zerod...@skolelinux.no>, 2004, 2005. # Gaute Hvoslef Kvalnes <ga...@verdsveven.com>, 2004, 2005. -# Axel Bojer <ax...@skolelinux.no>, 2005, 2006. +# Axel Bojer <a...@bojer.no>, 2005, 2006. # Nils Kristian Tomren <s...@nilsk.net>, 2005, 2007. # Øyvind A. Holm <su...@sunbase.org>, 2009. msgid "" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.10.0/po/nn/knotifications5_qt.po new/knotifications-5.11.0/po/nn/knotifications5_qt.po --- old/knotifications-5.10.0/po/nn/knotifications5_qt.po 2015-05-03 17:18:52.000000000 +0200 +++ new/knotifications-5.11.0/po/nn/knotifications5_qt.po 2015-06-06 23:23:08.000000000 +0200 @@ -2,21 +2,21 @@ # # Gaute Hvoslef Kvalnes <ga...@verdsveven.com>, 2003, 2004, 2005, 2006. # Håvard Korsvoll <korsv...@skulelinux.no>, 2003, 2005. -# Karl Ove Hufthammer <k...@huftis.org>, 2004, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014. +# Karl Ove Hufthammer <k...@huftis.org>, 2004, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015. # Eirik U. Birkeland <eir...@gmail.com>, 2008, 2009, 2010. msgid "" msgstr "" "Project-Id-Version: kdelibs4\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" "POT-Creation-Date: 2014-02-28 03:44+0000\n" -"PO-Revision-Date: 2013-05-12 14:38+0200\n" +"PO-Revision-Date: 2015-06-02 19:32+0100\n" "Last-Translator: Karl Ove Hufthammer <k...@huftis.org>\n" "Language-Team: Norwegian Nynorsk <i18n...@lister.ping.uio.no>\n" "Language: nn\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Lokalize 1.5\n" +"X-Generator: Lokalize 2.0\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Environment: kde\n" "X-Accelerator-Marker: &\n" @@ -24,37 +24,32 @@ "X-Qt-Contexts: true\n" #: knotificationrestrictions.cpp:184 -#, fuzzy msgctxt "KNotificationRestrictions|" msgid "Unknown Application" msgstr "Ukjent program" #: kstatusnotifieritem.cpp:439 kstatusnotifieritem.cpp:879 -#, fuzzy msgctxt "KStatusNotifierItem|" msgid "&Minimize" msgstr "&Minimer" #: kstatusnotifieritem.cpp:704 -#, fuzzy msgctxt "KStatusNotifierItem|" msgid "Quit" msgstr "Avslutt" #: kstatusnotifieritem.cpp:877 -#, fuzzy msgctxt "KStatusNotifierItem|" msgid "&Restore" msgstr "Gj&enopprett" #: kstatusnotifieritem.cpp:891 -#, fuzzy, qt-format +#, qt-format msgctxt "KStatusNotifierItem|" msgid "<qt>Are you sure you want to quit <b>%1</b>?</qt>" msgstr "<qt>Vil du avslutta <b>%1</b>?</qt>" #: kstatusnotifieritem.cpp:894 -#, fuzzy msgctxt "KStatusNotifierItem|" msgid "Confirm Quit From System Tray" -msgstr "Stadfest «Avslutt» frå systemfeltet" +msgstr "Stadfest avslutting frå systemfeltet" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.10.0/src/knotification.cpp new/knotifications-5.11.0/src/knotification.cpp --- old/knotifications-5.10.0/src/knotification.cpp 2015-05-03 17:18:52.000000000 +0200 +++ new/knotifications-5.11.0/src/knotification.cpp 2015-06-06 23:23:08.000000000 +0200 @@ -92,6 +92,7 @@ connect(&d->updateTimer, SIGNAL(timeout()), this, SLOT(update())); d->updateTimer.setSingleShot(true); d->updateTimer.setInterval(100); + d->widget = nullptr; } KNotification::~KNotification() @@ -402,6 +403,9 @@ int KNotification::id() { + if (!d) { + return -1; + } return d->id; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.10.0/src/knotificationmanager.cpp new/knotifications-5.11.0/src/knotificationmanager.cpp --- old/knotifications-5.10.0/src/knotificationmanager.cpp 2015-05-03 17:18:52.000000000 +0200 +++ new/knotifications-5.11.0/src/knotificationmanager.cpp 2015-06-06 23:23:08.000000000 +0200 @@ -129,13 +129,19 @@ } } -void KNotificationManager::notificationClosed(KNotification *notification) +void KNotificationManager::notificationClosed() { - if (d->notifications.contains(notification->id())) { - qDebug() << notification->id(); - KNotification *n = d->notifications[notification->id()]; - d->notifications.remove(notification->id()); - n->close(); + KNotification *notification = qobject_cast<KNotification*>(sender()); + if (!notification) { + return; + } + // We cannot do d->notifications.find(notification->id()); here because the + // notification->id() is -1 or -2 at this point, so we need to look for value + for (auto iter = d->notifications.begin(); iter != d->notifications.end(); ++iter) { + if (iter.value() == notification) { + d->notifications.erase(iter); + break; + } } } @@ -177,6 +183,7 @@ notifyPlugin->notify(n, ¬ifyConfig); } + connect(n, &KNotification::closed, this, &KNotificationManager::notificationClosed); return d->notifyIdCounter; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.10.0/src/knotificationmanager_p.h new/knotifications-5.11.0/src/knotificationmanager_p.h --- old/knotifications-5.10.0/src/knotificationmanager_p.h 2015-05-03 17:18:52.000000000 +0200 +++ new/knotifications-5.11.0/src/knotificationmanager_p.h 2015-06-06 23:23:08.000000000 +0200 @@ -64,7 +64,7 @@ void reemit(KNotification *n); private Q_SLOTS: - void notificationClosed(KNotification *notification); + void notificationClosed(); void notificationActivated(int id, int action); void notifyPluginFinished(KNotification *notification); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.10.0/src/kpassivepopup.cpp new/knotifications-5.11.0/src/kpassivepopup.cpp --- old/knotifications-5.10.0/src/kpassivepopup.cpp 2015-05-03 17:18:52.000000000 +0200 +++ new/knotifications-5.11.0/src/kpassivepopup.cpp 2015-06-06 23:23:08.000000000 +0200 @@ -22,17 +22,16 @@ #include <config-knotifications.h> // Qt -#include <QApplication> +#include <QGuiApplication> #include <QBitmap> #include <QDebug> -#include <QDesktopWidget> +#include <QScreen> #include <QLabel> #include <QLayout> #include <QBoxLayout> #include <QMouseEvent> #include <QPainter> #include <QPainterPath> -#include <QDesktopWidget> #include <QPolygonF> #include <QStyle> #include <QTimer> @@ -103,7 +102,7 @@ { // get screen-geometry for screen our anchor is on // (geometry can differ from screen to screen! - QRect deskRect = QApplication::desktop()->screenGeometry(anchor); + QRect deskRect = desktopRectForPoint(anchor); const int width = q->width(); const int height = q->height(); @@ -192,7 +191,7 @@ int w = q->minimumSizeHint().width(); int h = q->minimumSizeHint().height(); - QRect r = QApplication::desktop()->screenGeometry(QPoint(x + w / 2, y + h / 2)); + QRect r = desktopRectForPoint(QPoint(x + w / 2, y + h / 2)); if (popupStyle == Balloon) { // find a point to anchor to @@ -229,6 +228,19 @@ return QPoint(x, y); } + + QRect desktopRectForPoint(const QPoint &point) + { + QList<QScreen*> screens = QGuiApplication::screens(); + Q_FOREACH(const QScreen *screen, screens) { + if (screen->geometry().contains(point)) { + return screen->geometry(); + } + } + + // If no screen was found, return the primary screen's geometry + return QGuiApplication::primaryScreen()->geometry(); + } }; KPassivePopup::KPassivePopup(QWidget *parent, Qt::WindowFlags f) @@ -427,7 +439,7 @@ QPoint KPassivePopup::defaultLocation() const { - const QRect r = QApplication::desktop()->availableGeometry(); + const QRect r = QGuiApplication::primaryScreen()->availableGeometry(); return QPoint(r.left(), r.top()); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.10.0/src/notifybyexecute.cpp new/knotifications-5.11.0/src/notifybyexecute.cpp --- old/knotifications-5.10.0/src/notifybyexecute.cpp 2015-05-03 17:18:52.000000000 +0200 +++ new/knotifications-5.11.0/src/notifybyexecute.cpp 2015-06-06 23:23:08.000000000 +0200 @@ -45,14 +45,16 @@ { QString command = config->readEntry(QStringLiteral("Execute")); - qDebug() << command; - if (!command.isEmpty()) { QHash<QChar,QString> subst; subst.insert('e', notification->eventId()); subst.insert('a', notification->appName()); subst.insert('s', notification->text()); - subst.insert('w', QString::number(notification->widget()->topLevelWidget()->winId())); + if (notification->widget()) { + subst.insert('w', QString::number(notification->widget()->topLevelWidget()->winId())); + } else { + subst.insert('w', QStringLiteral("0")); + } subst.insert('i', QString::number(notification->id())); QString execLine = KMacroExpander::expandMacrosShellQuote(command, subst); @@ -63,7 +65,7 @@ KProcess proc; proc.setShellCommand(execLine.trimmed()); if (!proc.startDetached()) { - qDebug() << "KNotify: Could not start process!"; + qDebug() << "KProcess returned an error while trying to execute this command:" << execLine; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.10.0/src/notifybypopup.cpp new/knotifications-5.11.0/src/notifybypopup.cpp --- old/knotifications-5.10.0/src/notifybypopup.cpp 2015-05-03 17:18:52.000000000 +0200 +++ new/knotifications-5.11.0/src/notifybypopup.cpp 2015-06-06 23:23:08.000000000 +0200 @@ -34,7 +34,6 @@ #include <QLabel> #include <QTextDocument> #include <QApplication> -#include <QDesktopWidget> #include <QBoxLayout> #include <QLayout> #include <QDBusConnection> @@ -49,6 +48,8 @@ #include <QXmlStreamEntityResolver> #include <QPointer> #include <QMutableListIterator> +#include <QThread> +#include <QScreen> #include <kconfiggroup.h> #include <KIconThemes/KIconLoader> @@ -158,9 +159,7 @@ d->animationTimer = 0; d->dbusServiceExists = false; d->dbusServiceCapCacheDirty = true; - - QRect screen = QApplication::desktop()->availableGeometry(); - d->nextPosition = screen.top(); + d->nextPosition = -1; // check if service already exists on plugin instantiation QDBusConnectionInterface *interface = QDBusConnection::sessionBus().interface(); @@ -278,12 +277,22 @@ 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()) { + qWarning() << "KNotification did not detect any running org.freedesktop.Notifications server and fallback notifications cannot be used from non-GUI thread!"; + return; + } + // last fallback - display the popup using KPassivePopup KPassivePopup *pop = new KPassivePopup(notification->widget()); d->passivePopups.insert(notification, pop); d->fillPopup(pop, notification, notifyConfig); - QRect screen = QApplication::desktop()->availableGeometry(); + QRect screen = QGuiApplication::primaryScreen()->availableGeometry(); + if (d->nextPosition == -1) { + d->nextPosition = screen.y() + screen.height() - 32; + } pop->setAutoDelete(true); connect(pop, SIGNAL(destroyed()), this, SLOT(onPassivePopupDestroyed())); @@ -324,7 +333,7 @@ } bool cont = false; - QRect screen = QApplication::desktop()->availableGeometry(); + QRect screen = QGuiApplication::primaryScreen()->availableGeometry(); d->nextPosition = screen.top(); Q_FOREACH (KPassivePopup *popup, d->passivePopups) @@ -473,7 +482,6 @@ void NotifyByPopup::onGalagoNotificationClosed(uint dbus_id, uint reason) { - Q_UNUSED(reason) auto iter = d->galagoNotifications.find(dbus_id); if (iter == d->galagoNotifications.end()) { qWarning() << "Failed to find KNotification for dbus_id" << dbus_id; @@ -488,8 +496,10 @@ // if the user closes the popup, it means he wants to get rid // of the notification completely, including playing sound etc // Therefore we close the KNotification completely after closing - // the popup - n->close(); + // the popup, but only if the reason is 2, which means "user closed" + if (reason == 2) { + n->close(); + } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/knotifications-5.10.0/tests/CMakeLists.txt new/knotifications-5.11.0/tests/CMakeLists.txt --- old/knotifications-5.10.0/tests/CMakeLists.txt 2015-05-03 17:18:52.000000000 +0200 +++ new/knotifications-5.11.0/tests/CMakeLists.txt 2015-06-06 23:23:08.000000000 +0200 @@ -1,6 +1,10 @@ include(ECMMarkAsTest) -find_package(ECM 0.0.9 REQUIRED NO_MODULE) + +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 5.2.0 CONFIG REQUIRED Test)