@ -1,5 +1,6 @@
/ *
* Copyright 2016 Marco Martin < mart @ kde . org >
* Copyright 2020 Nate Graham < nate @ kde . org >
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU Library General Public License as
@ -25,19 +26,25 @@ import org.kde.plasma.components 3.0 as PlasmaComponents
import org . kde . plasma . extras 2.0 as PlasmaExtras
Item {
/ / s e t w i d t h / h e i g h t t o a v o i d a n u s e l e s s D i a l o g r e s i z e
width: Layout . minimumWidth
height: Layout . minimumHeight
Layout.minimumWidth: units . gridUnit * 24
Layout.minimumHeight: units . gridUnit * 21
Layout.preferredWidth: Layout . minimumWidth
Layout.preferredHeight: Layout . minimumHeight
Layout.maximumWidth: Layout . minimumWidth
Layout.maximumHeight: Layout . minimumHeight
id: popup
/ / s e t w i d t h / h e i g h t t o a v o i d u s e l e s s D i a l o g r e s i z e
readonly property int defaultWidth: units . gridUnit * 24
readonly property int defaultHeight: units . gridUnit * 21
width: defaultWidth
Layout.minimumWidth: defaultWidth
Layout.preferredWidth: defaultWidth
Layout.maximumWidth: defaultWidth
height: defaultHeight
Layout.minimumHeight: defaultHeight
Layout.preferredHeight: defaultHeight
Layout.maximumHeight: defaultHeight
property alias activeApplet: container . activeApplet
property alias hiddenLayout: hiddenItemsView . layout
/ / H e a d e r
PlasmaExtras . PlasmoidHeading {
id: plasmoidHeading
anchors {
@ -48,78 +55,35 @@ Item {
height: trayHeading . height + bottomPadding + container . headingHeight
}
PlasmaExtras . PlasmoidHeading {
id: plasmoidFooter
location: PlasmaExtras . PlasmoidHeading . Location . Footer
anchors {
bottom: parent . bottom
left: parent . left
right: parent . right
}
visible: container . appletHasFooter
height: container . footerHeight
}
/ / M a i n c o n t e n t l a y o u t
ColumnLayout {
id: expandedRepresentation
anchors.fill: parent
/ / T O D O : r e m o v e t h i s s o t h e s c r o l l v i e w f u l l y t o u c h e s t h e h e a d e r ;
/ / a d d t o p p a d d i n g i n t e r n a l l y
spacing: plasmoidHeading . bottomPadding
/ / H e a d e r c o n t e n t l a y o u t
RowLayout {
id: trayHeading
PlasmaExtras . Heading {
id: heading
Layout.fillWidth: true
level: 1
Layout.leftMargin: {
/ / M e n u m o d e
if ( ! activeApplet && hiddenItemsView . visible && ! LayoutMirroring . enabled ) {
return units . smallSpacing ;
/ / a p p l e t o p e n , s i d e b a r
} else if ( activeApplet && hiddenItemsView . visible && ! LayoutMirroring . enabled ) {
return hiddenItemsView . width + units . smallSpacing + dialog . margins . left ;
/ / a p p l e t o p e n , n o s i d e b a r
} else {
return units . smallSpacing ;
}
}
Layout.rightMargin: {
/ / M e n u m o d e
if ( ! activeApplet && hiddenItemsView . visible && LayoutMirroring . enabled ) {
return units . smallSpacing ;
/ / a p p l e t o p e n , s i d e b a r
} else if ( activeApplet && hiddenItemsView . visible && LayoutMirroring . enabled ) {
return hiddenItemsView . width + units . largeSpacing ;
/ / a p p l e t o p e n , n o s i d e b a r
} else {
return 0 ;
}
}
PlasmaComponents . ToolButton {
id: backButton
visible: activeApplet
text: activeApplet ? activeApplet.title : ""
MouseArea {
anchors.fill: parent
onClicked: {
if ( activeApplet ) {
activeApplet . expanded = false ;
dialog . visible = true ;
}
icon.name: "go-previous"
onClicked: {
if ( activeApplet ) {
activeApplet . expanded = false ;
dialog . visible = true ;
}
}
}
PlasmaExtras . Heading {
id: noAppletHeading
visible: ! activeApplet
Layout.fillWidth: true
level: 1
text: i18n ( "Status and Notifications" )
text: activeApplet ? activeApplet.title : i18n ( "Status and Notifications" )
}
PlasmaComponents . ToolButton {
@ -134,40 +98,43 @@ Item {
}
}
RowLayout {
spacing: 0 / / m u s t b e 0 s o t h a t t h e s e p a r a t o r i s a s c l o s e t o t h e i n d i c a t o r a s p o s s i b l e
HiddenItemsView {
id: hiddenItemsView
Layout.fillWidth: ! activeApplet
Layout.fillHeight: true
Layout.topMargin: container . headingHeight
}
/ / G r i d v i e w o f a l l a v a i l a b l e i t e m s
HiddenItemsView {
id: hiddenItemsView
Layout.fillWidth: true
Layout.fillHeight: true
Layout.topMargin: units . smallSpacing
visible: ! activeApplet
}
PlasmaCore . SvgItem {
visible: hiddenItemsView . visible && activeApplet
Layout.fillHeight: true
Layout.preferredWidth: lineSvg . elementSize ( "vertical-line" ) . width
Layout.topMargin: container . headingHeight
elementId: "vertical-line"
svg: PlasmaCore . Svg {
id: lineSvg ;
imagePath: "widgets/line"
}
}
/ / C o n t a i n e r f o r c u r r e n t l y v i s i b l e i t e m
PlasmoidPopupsContainer {
id: container
Layout.fillWidth: true
Layout.fillHeight: true
visible: activeApplet
/ / W e n e e d t o a d d o u r o w n m a r g i n s o n t h e t o p a n d l e f t ( w h e n t h e
/ / h i d d e n i t e m s v i e w i s v i s i b l e , a t l e a s t ) s o i t m a t c h e s t h e
/ / d i a l o g ' s o w n m a r g i n s a n d c o n t e n t i s c e n t e r e d c o r r e c t l y
Layout.topMargin: mergeHeadings ? 0 : dialog . margins . top
Layout.leftMargin: hiddenItemsView . visible && activeApplet && ! LayoutMirroring . enabled ? dialog.margins.left : 0
Layout.rightMargin: hiddenItemsView . visible && activeApplet && LayoutMirroring . enabled ? dialog.margins.right : 0
}
}
PlasmoidPopupsContainer {
id: container
Layout.fillWidth: true
Layout.fillHeight: true
visible: activeApplet
/ / W e n e e d t o a d d o u r o w n m a r g i n s o n t h e t o p a n d l e f t ( w h e n t h e
/ / h i d d e n i t e m s v i e w i s v i s i b l e , a t l e a s t ) s o i t m a t c h e s t h e
/ / d i a l o g ' s o w n m a r g i n s a n d c o n t e n t i s c e n t e r e d c o r r e c t l y
Layout.topMargin: mergeHeadings ? 0 : dialog . margins . top
Layout.leftMargin: hiddenItemsView . visible && activeApplet && ! LayoutMirroring . enabled ? dialog.margins.left : 0
Layout.rightMargin: hiddenItemsView . visible && activeApplet && LayoutMirroring . enabled ? dialog.margins.right : 0
}
/ / F o o t e r
PlasmaExtras . PlasmoidHeading {
id: plasmoidFooter
location: PlasmaExtras . PlasmoidHeading . Location . Footer
anchors {
bottom: parent . bottom
left: parent . left
right: parent . right
}
visible: container . appletHasFooter
height: container . footerHeight
/ / S o t h a t i t d o e s n ' t a p p e a r o v e r t h e c o n t e n t v i e w , w h i c h r e s u l t s i n
/ / t h e f o o t e r c o n t r o l s b e i n g i n a c c e s s i b l e
z: - 9999
}
}