diff --git a/app/dockview.cpp b/app/dockview.cpp index ac23014ed..9188e9b76 100644 --- a/app/dockview.cpp +++ b/app/dockview.cpp @@ -1165,6 +1165,23 @@ void DockView::deactivateApplets() } } +void DockView::toggleAppletExpanded(const int id) +{ + if (!containment()) { + return; + } + + foreach (auto applet, containment()->applets()) { + if (applet->id() == id) { + PlasmaQuick::AppletQuickItem *ai = applet->property("_plasma_graphicObject").value(); + + if (ai) { + ai->setExpanded(!ai->isExpanded()); + } + } + } +} + QVariantList DockView::containmentActions() { QVariantList actions; diff --git a/app/dockview.h b/app/dockview.h index c8819fb8b..7cfc9ff86 100644 --- a/app/dockview.h +++ b/app/dockview.h @@ -163,6 +163,7 @@ public slots: Q_INVOKABLE void removeTasksPlasmoid(); Q_INVOKABLE bool setCurrentScreen(const QString id); Q_INVOKABLE bool tasksPresent(); + Q_INVOKABLE void toggleAppletExpanded(const int id); Q_INVOKABLE void updateEnabledBorders(); Q_INVOKABLE void closeApplication(); diff --git a/containment/package/contents/ui/AppletItem.qml b/containment/package/contents/ui/AppletItem.qml index 8f448f04a..50ea4775c 100644 --- a/containment/package/contents/ui/AppletItem.qml +++ b/containment/package/contents/ui/AppletItem.qml @@ -102,8 +102,7 @@ Item { property Item appletIconItem; //first applet's IconItem, to be activated onExit signal //this is used for folderView and icon widgets to fake their visual - property bool fakeIconItem: applet && appletIconItem - && (applet.pluginName === "org.kde.plasma.folder" || applet.pluginName === "org.kde.plasma.icon") + property bool fakeIconItem: applet && appletIconItem && (applet.pluginName === "org.kde.plasma.folder" || applet.pluginName === "org.kde.plasma.icon") property alias containsMouse: appletMouseArea.containsMouse property alias pressed: appletMouseArea.pressed @@ -200,7 +199,8 @@ Item { function checkCanBeHovered(){ if ( ((applet && (applet.Layout.minimumWidth > root.iconSize) && root.isHorizontal) || (applet && (applet.Layout.minimumHeight > root.iconSize) && root.isVertical)) - && (applet && applet.pluginName !== "org.kde.plasma.panelspacer") ){ + && (applet && applet.pluginName !== "org.kde.plasma.panelspacer") + && !container.fakeIconItem){ canBeHovered = false; } else{ @@ -219,7 +219,7 @@ Item { } function reconsiderAppletIconItem(){ - if (appletIconItem) + if (container.appletIconItem || !applet) return; //! searching to find for that applet the first IconItem @@ -568,6 +568,7 @@ Item { } function updateLayoutHeight(){ + if(container.isInternalViewSplitter){ if(!root.editMode) layoutHeight = 0; @@ -613,6 +614,7 @@ Item { } function updateLayoutWidth(){ + if(container.isInternalViewSplitter){ if(!root.editMode) layoutWidth = 0; @@ -736,6 +738,15 @@ Item { ] //END states + ///Secret MouseArea to be used by the folder widget + Loader{ + anchors.fill: parent + active: container.fakeIconItem && applet.pluginName === "org.kde.plasma.folder" + sourceComponent: MouseArea{ + onClicked: dock.toggleAppletExpanded(applet.id); + } + } + Item{ id: fakeIconItemContainer anchors.centerIn: parent @@ -743,8 +754,8 @@ Item { //we setup as maximum for hidden container of some applets that break //the Latte experience the size:96 . This is why after that size //the folder widget changes to fullRepresentation instead of compact one - width: Math.min(96, parent.width); - height: Math.min(96, parent.height); + width: Math.min(96, parent.width) + height: width } Loader{ @@ -752,6 +763,7 @@ Item { active: container.fakeIconItem sourceComponent: Latte.IconItem{ id: fakeAppletIconItem + anchors.fill: parent source: appletIconItem.source } } @@ -1028,6 +1040,8 @@ Item { function signalUpdateScale(nIndex, nScale, step){ if(container && (container.index === nIndex)){ + reconsiderAppletIconItem(); + if ( ((canBeHovered && !lockZoom ) || container.latteApplet) && (applet && applet.status !== PlasmaCore.Types.HiddenStatus) //&& (index != currentLayout.hoveredIndex) @@ -1217,7 +1231,9 @@ Item { mouse.accepted = false; } - onReleased: pressed = false; + onReleased: { + pressed = false; + } } //BEGIN states @@ -1297,7 +1313,7 @@ Item { SequentialAnimation{ id: clickedAnimation alwaysRunToEnd: true - running: appletMouseArea.pressed + running: appletMouseArea.pressed && (root.durationTime > 0) onStopped: appletMouseArea.pressed = false;