From c14470c7426645267909dc5e85322c75a92a38da Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sat, 14 Apr 2018 17:58:45 +0300 Subject: [PATCH] fix #983,expose latte availability to applets --allow the applet developers to set at their applet main file: property bool disableLatteParabolicIcon: true in order to disable any Latte functionality concerning the parabolic icon -- allow the applet developers to set at their main file: property bool isInLatte: false in order to be informed by Latte when they are in a Latte containment. For what ever purposes the developers need to adjust to their plasmoid. --- .../package/contents/code/AppletIdentifier.js | 2 +- .../package/contents/ui/applet/AppletItem.qml | 22 +++++++++++++++++-- .../contents/ui/applet/AppletItemWrapper.qml | 4 ++-- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/containment/package/contents/code/AppletIdentifier.js b/containment/package/contents/code/AppletIdentifier.js index 45f29cd73..f38070379 100644 --- a/containment/package/contents/code/AppletIdentifier.js +++ b/containment/package/contents/code/AppletIdentifier.js @@ -9,7 +9,7 @@ function typeOf(obj, className){ } function reconsiderAppletIconItem(){ - if (container.appletIconItem || !applet) + if (container.appletIconItem || !applet || container.disableLatteParabolicIconHeuristics) return; //! searching to find for that applet the first IconItem diff --git a/containment/package/contents/ui/applet/AppletItem.qml b/containment/package/contents/ui/applet/AppletItem.qml index f175ac854..40e058441 100644 --- a/containment/package/contents/ui/applet/AppletItem.qml +++ b/containment/package/contents/ui/applet/AppletItem.qml @@ -44,6 +44,7 @@ Item { property bool canBeHovered: true property bool canShowAppletNumberBadge: !isSeparator && !isHidden && !isLattePlasmoid && !isSpacer && !isInternalViewSplitter + property bool disableLatteParabolicIconHeuristics: applet && applet.disableLatteParabolicIcon !== undefined ? applet.disableLatteParabolicIcon : false property bool inFillCalculations: false //temp record, is used in calculations for fillWidth,fillHeight applets property bool needsFillSpace: { //fill flag, it is used in calculations for fillWidth,fillHeight applets if (!applet || !applet.Layout || (applet && applet.pluginName === "org.kde.plasma.panelspacer")) @@ -80,8 +81,7 @@ Item { (((index === layoutsContainer.startLayout.beginIndex+layoutsContainer.startLayout.count-2)&&(layoutsContainer.startLayout.count>2)) ||((index === layoutsContainer.mainLayout.beginIndex+layoutsContainer.mainLayout.count-2)&&(layoutsContainer.mainLayout.count>2)) ||((index === layoutsContainer.endLayout.beginIndex+layoutsContainer.endLayout.count-1)&&(layoutsContainer.endLayout.count>1))) - - + property bool supportsIsInLatte: applet && applet.isInLatte !== undefined ? true : false property int animationTime: root.durationTime* (1.2 *units.shortDuration) // 70 property int hoveredIndex: layoutsContainer.hoveredIndex @@ -164,6 +164,18 @@ Item { } } + onDisableLatteParabolicIconHeuristicsChanged: { + if (disableLatteParabolicIconHeuristics && applet.opacity === 0) { + applet.opacity = 1; + + wrapper.disableScaleWidth = false; + wrapper.disableScaleHeight = false; + + wrapper.updateLayoutWidth(); + wrapper.updateLayoutHeight(); + } + } + /// BEGIN functions function activateAppletForNeutralAreas(mouse){ //if the event is at the active indicator or spacers area then try to expand the applet, @@ -355,6 +367,12 @@ Item { } } + onSupportsIsInLatteChanged: { + if (supportsIsInLatte) { + applet.isInLatte = true; + } + } + Component.onCompleted: { checkIndex(); root.updateIndexes.connect(checkIndex); diff --git a/containment/package/contents/ui/applet/AppletItemWrapper.qml b/containment/package/contents/ui/applet/AppletItemWrapper.qml index 7eac0bad2..4d585a86f 100644 --- a/containment/package/contents/ui/applet/AppletItemWrapper.qml +++ b/containment/package/contents/ui/applet/AppletItemWrapper.qml @@ -431,7 +431,7 @@ Item{ ///Secret MouseArea to be used by the folder widget Loader{ anchors.fill: parent - active: container.fakeIconItem && applet.pluginName === "org.kde.plasma.folder" + active: container.fakeIconItem && applet.pluginName === "org.kde.plasma.folder" && !container.disableLatteParabolicIconHeuristics sourceComponent: MouseArea{ onClicked: dock.toggleAppletExpanded(applet.id); } @@ -460,7 +460,7 @@ Item{ Loader{ anchors.fill: parent - active: container.fakeIconItem + active: container.fakeIconItem && !container.disableLatteParabolicIconHeuristics sourceComponent: Latte.IconItem{ id: fakeAppletIconItem anchors.fill: parent