1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-09 17:18:11 +03:00

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.
This commit is contained in:
Michail Vourlakos 2018-04-14 17:58:45 +03:00
parent 7f89bd99b0
commit c14470c742
3 changed files with 23 additions and 5 deletions

View File

@ -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

View File

@ -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);

View File

@ -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