From c9515a0353e39eac610508f2c3c8e513a6a5e651 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Fri, 15 Oct 2021 01:38:24 +0300 Subject: [PATCH] activate through mouse wheel more applets --when an applet is not identified as expandable but on the other hand has activated the flag activationTogglesExpanded then for those applets the mouse wheel option should also trigger an activation event --- app/view/containmentinterface.cpp | 23 +++++++++++++++++++ app/view/containmentinterface.h | 1 + .../package/contents/ui/applet/AppletItem.qml | 4 +++- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/app/view/containmentinterface.cpp b/app/view/containmentinterface.cpp index c1c0c3d22..089f127e2 100644 --- a/app/view/containmentinterface.cpp +++ b/app/view/containmentinterface.cpp @@ -449,6 +449,29 @@ bool ContainmentInterface::appletIsExpandable(PlasmaQuick::AppletQuickItem *appl || Latte::Layouts::Storage::self()->isSubContainment(m_view->layout(), appletQuickItem->applet())); } +bool ContainmentInterface::appletIsActivationTogglesExpanded(const int id) const +{ + if (!m_view->containment() || !m_view->inReadyState()) { + return false; + } + + for (const auto applet : m_view->containment()->applets()) { + if (applet && applet->id() == (uint)id) { + if (Layouts::Storage::self()->isSubContainment(m_view->layout(), applet)) { + return true; + } + + PlasmaQuick::AppletQuickItem *ai = applet->property("_plasma_graphicObject").value(); + + if (ai) { + return ai->isActivationTogglesExpanded(); + } + } + } + + return false; +} + bool ContainmentInterface::hasExpandedApplet() const { return m_expandedAppletIds.count() > 0; diff --git a/app/view/containmentinterface.h b/app/view/containmentinterface.h index 1cf73ad6c..cc186d46b 100644 --- a/app/view/containmentinterface.h +++ b/app/view/containmentinterface.h @@ -82,6 +82,7 @@ public slots: Q_INVOKABLE bool appletIsExpandable(const int id) const; Q_INVOKABLE bool appletIsExpanded(const int id) const; + Q_INVOKABLE bool appletIsActivationTogglesExpanded(const int id) const; Q_INVOKABLE bool isApplication(const QUrl &url) const; diff --git a/containment/package/contents/ui/applet/AppletItem.qml b/containment/package/contents/ui/applet/AppletItem.qml index 8001854ef..e4ebff0ba 100644 --- a/containment/package/contents/ui/applet/AppletItem.qml +++ b/containment/package/contents/ui/applet/AppletItem.qml @@ -660,7 +660,9 @@ Item { blockWheel = true; scrollDelayer.start(); - if (appletItem.containsPos(pos) && root.latteView.extendedInterface.appletIsExpandable(applet.id)) { + if (appletItem.containsPos(pos) + && (root.latteView.extendedInterface.appletIsExpandable(applet.id) + || (root.latteView.extendedInterface.appletIsActivationTogglesExpanded(applet.id)))) { var angle = angleDelta.y / 8; var expanded = root.latteView.extendedInterface.appletIsExpanded(applet.id);