Commit 1a6b40cb authored by Niccolò Venerandi's avatar Niccolò Venerandi

Make headings of systray and applet merge

Summary:
When the applet is a page with a plasmoidHeading as header, merge it with systray one.
{F8215920}

The only big problem is that it looks bad when you open said applet while in sidebar view, see:
{F8215916}

I'd like to solve that by removing the sidebar and adding a back button, but that would be for another patch in the future.

Test Plan: To be tested together with D28467

Reviewers: #plasma, #vdg, ngraham

Reviewed By: #vdg, ngraham

Subscribers: mart, manueljlin, ognarb, ngraham, plasma-devel

Tags: #plasma

Maniphest Tasks: T10470

Differential Revision: https://phabricator.kde.org/D28575
parent c963fe87
......@@ -24,26 +24,38 @@ import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
ColumnLayout {
id: expandedRepresentation
//set width/height to avoid an useless Dialog resize
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
spacing: 0 // avoid gap between title and content
Item {
width: expandedRepresentation.width
height: expandedRepresentation.height
property alias activeApplet: container.activeApplet
property alias hiddenLayout: hiddenItemsView.layout
PlasmaExtras.PlasmoidHeading {
id: plasmoidHeading
anchors {
top: parent.top
left: parent.left
right: parent.right
}
height: trayHeading.height + bottomPadding + container.headingHeight
}
ColumnLayout {
id: expandedRepresentation
//set width/height to avoid an useless Dialog resize
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
spacing: plasmoidHeading.bottomPadding
RowLayout {
anchors.fill: parent
id: trayHeading
PlasmaExtras.Heading {
id: heading
......@@ -110,39 +122,41 @@ ColumnLayout {
}
}
}
}
RowLayout {
spacing: 0 // must be 0 so that the separator is as close to the indicator as possible
RowLayout {
spacing: 0 // must be 0 so that the separator is as close to the indicator as possible
HiddenItemsView {
id: hiddenItemsView
Layout.fillWidth: !activeApplet
Layout.fillHeight: true
}
HiddenItemsView {
id: hiddenItemsView
Layout.fillWidth: !activeApplet
Layout.fillHeight: true
Layout.topMargin: container.headingHeight
}
PlasmaCore.SvgItem {
visible: hiddenItemsView.visible && activeApplet
Layout.fillHeight: true
Layout.preferredWidth: lineSvg.elementSize("vertical-line").width
elementId: "vertical-line"
svg: PlasmaCore.Svg {
id: lineSvg;
imagePath: "widgets/line"
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"
}
}
}
PlasmoidPopupsContainer {
id: container
visible: activeApplet
Layout.fillWidth: true
Layout.fillHeight: true
// 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
Layout.topMargin: 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
visible: activeApplet
Layout.fillWidth: true
Layout.fillHeight: true
// 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
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
}
}
}
}
......@@ -22,6 +22,8 @@ import QtQuick.Layouts 1.1
import QtQuick.Controls 1.4
//needed for units
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.extras 2.0 as PlasmaExtras
StackView {
id: mainStack
......@@ -32,6 +34,10 @@ StackView {
Layout.minimumHeight: units.gridUnit * 12
property Item activeApplet
property bool appletHasHeading: false
property bool appletHeadingShown: appletHasHeading && activeApplet.fullRepresentationItem.header.visible
property bool mergeHeadings: appletHasHeading && appletHeadingShown
property int headingHeight: mergeHeadings ? activeApplet.fullRepresentationItem.header.height : 0
onActiveAppletChanged: {
if (activeApplet != null) {
......@@ -43,8 +49,18 @@ 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
}
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