@ -101,6 +101,10 @@ Item {
( applet . pluginName === "org.kde.plasma.systemtray" ) ) ? wrapper : wrapperContainer
property Item appletIconItem ; / / f i r s t a p p l e t ' s I c o n I t e m , t o b e a c t i v a t e d o n E x i t s i g n a l
/ / t h i s i s u s e d f o r f o l d e r V i e w a n d i c o n w i d g e t s t o f a k e t h e i r v i s u a l
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
@ -109,6 +113,25 @@ Item {
console . log ( computeHeight ) ;
} * /
/ / s e t u p t h e f a k e c o n t a i n e r s a n d p r o p e r t i e s f o r w h e n a f a k e I c o n I t e m m u s t b e p r e s e n t e d t o t h e u s e r
/ / b e c a u s e t h e p l a s m a w i d g e t s s p e c i f i c i m p l e m e n t a t i o n b r e a k s t h e L a t t e e x p e r i e n c e
onFakeIconItemChanged: {
if ( fakeIconItem ) {
applet . opacity = 0 ;
if ( applet . pluginName === "org.kde.plasma.folder" ) {
applet . parent = fakeIconItemContainer ;
applet . anchors . fill = fakeIconItemContainer ;
}
wrapper . disableScaleWidth = false ;
wrapper . disableScaleHeight = false ;
wrapper . updateLayoutWidth ( ) ;
wrapper . updateLayoutHeight ( ) ;
}
}
onIndexChanged: {
if ( container . latteApplet ) {
root . latteAppletPos = index ;
@ -558,7 +581,7 @@ Item {
layoutHeight = root . statesLineSize + root . iconSize ;
}
else {
if ( applet && ( applet . Layout . minimumHeight > root . iconSize ) && root . isVertical && ( ! canBeHovered ) ) {
if ( applet && ( applet . Layout . minimumHeight > root . iconSize ) && root . isVertical && ! canBeHovered && ! container . fakeIconItem ) {
/ / r e t u r n a p p l e t . L a y o u t . m i n i m u m H e i g h t ;
layoutHeight = applet . Layout . minimumHeight ;
} / / i t i s u s e d f o r p l a s m o i d s t h a t n e e d t o s c a l e o n l y o n e a x i s . . . e . g . t h e W e a t h e r P l a s m o i d
@ -566,7 +589,7 @@ Item {
&& ( ( applet . Layout . maximumHeight < root . iconSize ) || ( applet . Layout . preferredHeight > root . iconSize ) )
&& root . isVertical
&& ! disableScaleWidth
&& applet . pluginName !== "org.kde.plasma.folder" ) {
&& ! container . fakeIconItem ) {
/ / & & ! r o o t . e d i t M o d e ) {
disableScaleHeight = true ;
/ / t h i s w a y i m p r o v e s p e r f o r m a n c e , p r o b a b l y b e c a u s e d u r i n g a n i m a t i o n t h e p r e f e r r e d s i z e s u p d a t e a l o t
@ -603,14 +626,14 @@ Item {
layoutWidth = root . statesLineSize + root . iconSize ;
}
else {
if ( applet && ( applet . Layout . minimumWidth > root . iconSize ) && root . isHorizontal && ( ! canBeHovered ) ) {
if ( applet && ( applet . Layout . minimumWidth > root . iconSize ) && root . isHorizontal && ! canBeHovered && ! container . fakeIconItem ) {
layoutWidth = applet . Layout . minimumWidth ;
} / / i t i s u s e d f o r p l a s m o i d s t h a t n e e d t o s c a l e o n l y o n e a x i s . . . e . g . t h e W e a t h e r P l a s m o i d
else if ( applet
&& ( ( applet . Layout . maximumWidth < root . iconSize ) || ( applet . Layout . preferredWidth > root . iconSize ) )
&& root . isHorizontal
&& ! disableScaleHeight
&& applet . pluginName !== "org.kde.plasma.folder" ) {
&& ! container . fakeIconItem ) {
/ / & & ! r o o t . e d i t M o d e ) {
disableScaleWidth = true ;
/ / t h i s w a y i m p r o v e s p e r f o r m a n c e , p r o b a b l y b e c a u s e d u r i n g a n i m a t i o n t h e p r e f e r r e d s i z e s u p d a t e a l o t
@ -713,16 +736,23 @@ Item {
]
/ / E N D s t a t e s
Item {
id: fakeIconItemContainer
anchors.centerIn: parent
/ / w e s e t u p a s m a x i m u m f o r h i d d e n c o n t a i n e r o f s o m e a p p l e t s t h a t b r e a k
/ / t h e L a t t e e x p e r i e n c e t h e s i z e : 9 6 . T h i s i s w h y a f t e r t h a t s i z e
/ / t h e f o l d e r w i d g e t c h a n g e s t o f u l l R e p r e s e n t a t i o n i n s t e a d o f c o m p a c t o n e
width: Math . min ( 96 , parent . width ) ;
height: Math . min ( 96 , parent . height ) ;
}
Loader {
anchors.fill: parent
active: appletIconItem && appletIconItem . source
active: container. fakeIconItem
sourceComponent: Latte . IconItem {
id: fakeAppletIconItem
source: appletIconItem . source
Component.onCompleted: {
appletIconItem . opacity = 0 ;
}
}
}
}
@ -794,7 +824,7 @@ Item {
anchors.fill: parent
color: "#ff080808"
samples: 2 * radius
source: appletIconItem && appletIconItem . source ? wrapperContainer : container . applet
source: container. fakeIconItem ? wrapperContainer : container . applet
radius: shadowSize
verticalOffset: 2