Commit 0f28094f authored by Niccolò Venerandi's avatar Niccolò Venerandi

Add footer support to systray

Summary: This adds a footer element that will replace with a possible footer that the contained plasmoid could have, given that they are using a Page.

Test Plan: {F8258401}

Reviewers: ngraham

Reviewed By: ngraham

Subscribers: plasma-devel

Tags: #plasma

Maniphest Tasks: T10470

Differential Revision: https://phabricator.kde.org/D29142
parent 5c1b2b5d
......@@ -41,6 +41,18 @@ 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
}
ColumnLayout {
id: expandedRepresentation
//set width/height to avoid an useless Dialog resize
......@@ -147,9 +159,9 @@ Item {
PlasmoidPopupsContainer {
id: container
visible: activeApplet
Layout.fillWidth: true
Layout.fillHeight: true
visible: activeApplet
// We need to add our own margins on the top and left (when the
// hidden items view is visible, at least) so it matches the
// dialog's own margins and content is centered correctly
......
......@@ -34,12 +34,19 @@ StackView {
Layout.minimumHeight: units.gridUnit * 12
property Item activeApplet
/* Heading */
property bool appletHasHeading: false
property bool appletHeadingShown: appletHasHeading && activeApplet.fullRepresentationItem.header.visible
property bool mergeHeadings: appletHasHeading && appletHeadingShown
property bool mergeHeadings: appletHasHeading && activeApplet.fullRepresentationItem.header.visible
property int headingHeight: mergeHeadings ? activeApplet.fullRepresentationItem.header.height : 0
/* Footer */
property bool appletHasFooter: false
property bool mergeFooters: appletHasFooter && activeApplet.fullRepresentationItem.footer.visible
property int footerHeight: mergeFooters ? activeApplet.fullRepresentationItem.footer.height : 0
onActiveAppletChanged: {
mainStack.appletHasHeading = false
mainStack.appletHasFooter = false
if (activeApplet != null) {
//reset any potential anchor
activeApplet.fullRepresentationItem.anchors.left = undefined;
......@@ -49,18 +56,19 @@ StackView {
activeApplet.fullRepresentationItem.anchors.centerIn = undefined;
activeApplet.fullRepresentationItem.anchors.fill = undefined;
if (activeApplet.fullRepresentationItem instanceof PlasmaComponents3.Page
&& activeApplet.fullRepresentationItem.header instanceof PlasmaExtras.PlasmoidHeading
) {
mainStack.appletHasHeading = true
activeApplet.fullRepresentationItem.header.background.visible = false
} else {
mainStack.appletHasHeading = false
if (activeApplet.fullRepresentationItem instanceof PlasmaComponents3.Page) {
if (activeApplet.fullRepresentationItem.header && activeApplet.fullRepresentationItem.header instanceof PlasmaExtras.PlasmoidHeading) {
mainStack.appletHasHeading = true
activeApplet.fullRepresentationItem.header.background.visible = false
}
if (activeApplet.fullRepresentationItem.footer && activeApplet.fullRepresentationItem.footer instanceof PlasmaExtras.PlasmoidHeading) {
mainStack.appletHasFooter = true
activeApplet.fullRepresentationItem.footer.background.visible = false
}
}
mainStack.replace({item: activeApplet.fullRepresentationItem, immediate: !dialog.visible, properties: {focus: true}});
} else {
mainStack.appletHasHeading = false
mainStack.replace(emptyPage);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment