From 8a1c449396d7ef2cc1ef419d9cf7a3017ab702d5 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Mon, 20 Mar 2017 20:40:27 +0200 Subject: [PATCH] fix #285,expanded to false for applets --when changing session all the applets from the previous session should hide their expanded options --- app/dockcorona.cpp | 1 + app/dockview.cpp | 15 +++++++++++++++ app/dockview.h | 2 ++ 3 files changed, 18 insertions(+) diff --git a/app/dockcorona.cpp b/app/dockcorona.cpp index f5fa0b97a..d92470679 100644 --- a/app/dockcorona.cpp +++ b/app/dockcorona.cpp @@ -511,6 +511,7 @@ void DockCorona::syncDockViews() if (view->session() != currentSession()) { qDebug() << "deleting view that does not belong in this session..."; auto viewToDelete = m_dockViews.take(view->containment()); + viewToDelete->deactivateApplets(); viewToDelete->deleteLater(); //! which explicit docks can be deleted } else if (!found && !view->onPrimary() && (m_dockViews.size() > 1) && m_dockViews.contains(view->containment()) diff --git a/app/dockview.cpp b/app/dockview.cpp index 71a04078a..788ba4994 100644 --- a/app/dockview.cpp +++ b/app/dockview.cpp @@ -1066,6 +1066,21 @@ void DockView::closeApplication() dockCorona->closeApplication(); } +void DockView::deactivateApplets() +{ + if (!containment()) { + return; + } + + foreach (auto applet, containment()->applets()) { + PlasmaQuick::AppletQuickItem *ai = applet->property("_plasma_graphicObject").value(); + + if (ai) { + ai->setExpanded(false); + } + } +} + QVariantList DockView::containmentActions() { QVariantList actions; diff --git a/app/dockview.h b/app/dockview.h index d797cea6c..f50935bb6 100644 --- a/app/dockview.h +++ b/app/dockview.h @@ -139,6 +139,8 @@ public: VisibilityManager *visibility() const; + void deactivateApplets(); + QQmlListProperty screens(); static int countScreens(QQmlListProperty *property); static QScreen *atScreens(QQmlListProperty *property, int index);