From 83ec35b632ee495df4b3c6f33f7ca33bca398a8f Mon Sep 17 00:00:00 2001 From: Martin Klapetek Date: Fri, 1 May 2015 14:51:37 +0200 Subject: [PATCH 1/5] [notifications] Always check first if the dispatch timer isn't running already That should prevent various mis-queueings. If the timer is running, the queue will get processed once the timer times out. CCBUG: 342605 --- .../plugin/notificationshelper.cpp | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/applets/notifications/plugin/notificationshelper.cpp b/applets/notifications/plugin/notificationshelper.cpp index 37375d01b..b56e3933b 100644 --- a/applets/notifications/plugin/notificationshelper.cpp +++ b/applets/notifications/plugin/notificationshelper.cpp @@ -164,7 +164,9 @@ void NotificationsHelper::processShow() repositionPopups(); QTimer::singleShot(300, popup, SLOT(show())); - m_dispatchTimer->start(); + if (!m_dispatchTimer->isActive()) { + m_dispatchTimer->start(); + } } void NotificationsHelper::processHide() @@ -204,7 +206,9 @@ void NotificationsHelper::processHide() repositionPopups(); } - m_dispatchTimer->start(); + if (!m_dispatchTimer->isActive()) { + m_dispatchTimer->start(); + } } void NotificationsHelper::displayNotification(const QVariantMap ¬ificationData) @@ -243,7 +247,12 @@ void NotificationsHelper::displayNotification(const QVariantMap ¬ificationDat m_showQueue.append(notificationData); m_mutex->unlock(); - processQueues(); + if (!m_dispatchTimer->isActive()) { + // If the dispatch timer is not already running, process + // the queues directly, that should cut the time between + // notification emitting the event and popup displaying + processQueues(); + } } void NotificationsHelper::closePopup(const QString &sourceName) @@ -258,7 +267,10 @@ void NotificationsHelper::closePopup(const QString &sourceName) m_mutex->lockForWrite(); m_hideQueue.append(popup); m_mutex->unlock(); - processQueues(); + + if (!m_dispatchTimer->isActive()) { + processQueues(); + } } } @@ -274,7 +286,10 @@ void NotificationsHelper::onPopupClosed() m_mutex->lockForWrite(); m_hideQueue << popup; m_mutex->unlock(); - processQueues(); + + if (!m_dispatchTimer->isActive()) { + processQueues(); + } } } From af3081abe2337c691cd2d310951ffd20f21da00d Mon Sep 17 00:00:00 2001 From: Martin Klapetek Date: Fri, 1 May 2015 14:54:47 +0200 Subject: [PATCH 2/5] [notifications] Clear notification from show queue if it's closed before it's shown It can happen that a notification is placed in the show queue and then it's closed (eg. programatically) before it was even shown. In this case the notification must be cleared from the show queue otherwise it will get displayed and hidden but the popup is never freed for reuse, resulting in notificaions starting at higher position from the panel. BUG: 342605 --- .../notifications/plugin/notificationshelper.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/applets/notifications/plugin/notificationshelper.cpp b/applets/notifications/plugin/notificationshelper.cpp index b56e3933b..e2880eb23 100644 --- a/applets/notifications/plugin/notificationshelper.cpp +++ b/applets/notifications/plugin/notificationshelper.cpp @@ -263,6 +263,22 @@ void NotificationsHelper::closePopup(const QString &sourceName) bool shouldQueue = popup && !m_hideQueue.contains(popup); m_mutex->unlock(); + // Make sure the notification that was closed (programatically) + // is not in the show queue. This is important otherwise that + // notification will be shown and then never closed (because + // the close event arrives here, before it's even shown) + QMutableListIterator i(m_showQueue); + while (i.hasNext()) { + if (i.next().value("source") == sourceName) { + qDebug() << "########|" << " (locking mutex for write)"; + m_mutex->lockForWrite(); + qDebug() << "########|" << "Removing old data" << i.value().value("summary").toString(); + i.remove(); + m_mutex->unlock(); + qDebug() << "########|" << " (unlocking mutex)"; + } + } + if (shouldQueue) { m_mutex->lockForWrite(); m_hideQueue.append(popup); From 1e460f3158eb4cf2eb515cb60f98e6370915876a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=C4=8Cuki=C4=87?= Date: Sun, 3 May 2015 09:01:35 +0200 Subject: [PATCH 3/5] When switching activities, use only the running ones This makes the activities mouse plugin for plasma shell cycle only through the running activities. BUG: 347029 REVIEW: 123597 --- containmentactions/switchactivity/switch.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/containmentactions/switchactivity/switch.cpp b/containmentactions/switchactivity/switch.cpp index 75d06b77d..8b88c3eb6 100644 --- a/containmentactions/switchactivity/switch.cpp +++ b/containmentactions/switchactivity/switch.cpp @@ -47,7 +47,7 @@ void SwitchActivity::makeMenu() { qDeleteAll(m_actions); m_actions.clear(); - foreach (const QString &id, m_consumer.activities()) { + foreach (const QString &id, m_consumer.activities(KActivities::Info::Running)) { KActivities::Info info(id); QAction *action = new QAction(QIcon::fromTheme(info.icon()), info.name(), this); action->setData(id); @@ -86,18 +86,22 @@ void SwitchActivity::switchTo(QAction *action) void SwitchActivity::performNextAction() { - int i = m_consumer.activities().indexOf(m_consumer.currentActivity()); + const QStringList activities = m_consumer.activities(KActivities::Info::Running); - i = (i + 1) % m_consumer.activities().size(); - m_controller.setCurrentActivity(m_consumer.activities().value(i)); + int i = activities.indexOf(m_consumer.currentActivity()); + + i = (i + 1) % activities.size(); + m_controller.setCurrentActivity(activities[i]); } void SwitchActivity::performPreviousAction() { - int i = m_consumer.activities().indexOf(m_consumer.currentActivity()); + const QStringList activities = m_consumer.activities(KActivities::Info::Running); + + int i = activities.indexOf(m_consumer.currentActivity()); - i = (i + m_consumer.activities().size() -1) % m_consumer.activities().size(); - m_controller.setCurrentActivity(m_consumer.activities().value(i)); + i = (i + activities.size() - 1) % activities.size(); + m_controller.setCurrentActivity(activities[i]); } K_EXPORT_PLASMA_CONTAINMENTACTIONS_WITH_JSON(switchactivity, SwitchActivity, "plasma-containmentactions-switchactivity.json") From ff33964a8ad6b802f8a31dc720f0f35c57f8a86e Mon Sep 17 00:00:00 2001 From: Martin Klapetek Date: Mon, 4 May 2015 15:33:56 +0200 Subject: [PATCH 4/5] [digital-clock] Change the id of the root item It collides with the compact representation item and breaks things. BUG: 346841 FIXED-IN: 5.3.1 --- applets/digital-clock/package/contents/ui/CalendarView.qml | 2 +- applets/digital-clock/package/contents/ui/DigitalClock.qml | 2 +- applets/digital-clock/package/contents/ui/main.qml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/applets/digital-clock/package/contents/ui/CalendarView.qml b/applets/digital-clock/package/contents/ui/CalendarView.qml index 88a25b3b1..b5a080bef 100644 --- a/applets/digital-clock/package/contents/ui/CalendarView.qml +++ b/applets/digital-clock/package/contents/ui/CalendarView.qml @@ -69,7 +69,7 @@ Item { PlasmaCalendar.MonthView { id: monthView borderOpacity: 0.25 - today: main.tzDate + today: root.tzDate anchors.fill: parent } diff --git a/applets/digital-clock/package/contents/ui/DigitalClock.qml b/applets/digital-clock/package/contents/ui/DigitalClock.qml index 914be4b8b..a142d331f 100644 --- a/applets/digital-clock/package/contents/ui/DigitalClock.qml +++ b/applets/digital-clock/package/contents/ui/DigitalClock.qml @@ -403,7 +403,7 @@ Item { } function updateToolTip() { - var timezoneString = Qt.formatDate(main.tzDate, dateFormatString); + var timezoneString = Qt.formatDate(root.tzDate, root.dateFormatString); if (plasmoid.configuration.selectedTimeZones.length > 1) { timezoneString += "
"; for (var i = 0; i < plasmoid.configuration.selectedTimeZones.length; ++i) { diff --git a/applets/digital-clock/package/contents/ui/main.qml b/applets/digital-clock/package/contents/ui/main.qml index 03d403b1a..31373273e 100644 --- a/applets/digital-clock/package/contents/ui/main.qml +++ b/applets/digital-clock/package/contents/ui/main.qml @@ -25,7 +25,7 @@ import org.kde.plasma.private.digitalclock 1.0 //import org.kde.plasma.calendar 2.0 Item { - id: main + id: root width: units.gridUnit * 10 height: units.gridUnit * 4 From bbac56c554c7b5569afc39556b41d95bc6b4b255 Mon Sep 17 00:00:00 2001 From: Martin Klapetek Date: Mon, 4 May 2015 15:35:07 +0200 Subject: [PATCH 5/5] [digital-clock] Fix missing function return --- applets/digital-clock/package/contents/ui/main.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applets/digital-clock/package/contents/ui/main.qml b/applets/digital-clock/package/contents/ui/main.qml index 31373273e..eb9e06f54 100644 --- a/applets/digital-clock/package/contents/ui/main.qml +++ b/applets/digital-clock/package/contents/ui/main.qml @@ -72,7 +72,7 @@ Item { // remove it + the delimiter and space var format = Qt.locale().dateFormat(Locale.LongFormat); format = format.replace(/(^dddd.?\s)|(,?\sdddd$)/, ""); - main.dateFormatString = format; + return format; } ProcessRunner {