Commit b8841a3d authored by Claudio Cambra's avatar Claudio Cambra
Browse files

Fix issues with incidence viewer layouts and scrollview content height



Signed-off-by: Claudio Cambra's avatarClaudio Cambra <claudio.cambra@gmail.com>
parent f9093665
Pipeline #236431 failed with stage
in 2 minutes and 25 seconds
......@@ -26,6 +26,8 @@ QQC2.ScrollView {
property var incidenceWrapper
property var collectionData
property alias contentPadding: infoBody.padding
readonly property var activeTags : Filter.tags
readonly property int relatedIncidenceDelegateHeight: Kirigami.Units.gridUnit * 3
readonly property alias scrollView: root
......@@ -38,9 +40,13 @@ QQC2.ScrollView {
readonly property bool sameIncidenceStartAndEndTime: root.incidenceData.startTime.toTimeString() === root.incidenceData.endTime.toTimeString()
onIncidenceDataChanged: {
incidenceWrapper = Qt.createQmlObject('import org.kde.kalendar 1.0; IncidenceWrapper {id: incidence}', root, "incidence");
incidenceWrapper.incidenceItem = CalendarManager.incidenceItem(incidenceData.incidencePtr);
collectionData = CalendarManager.getCollectionDetails(incidenceWrapper.collectionId);
QQC2.ScrollBar.vertical.position = 0;
if(incidenceData) {
incidenceWrapper = Qt.createQmlObject('import org.kde.kalendar 1.0; IncidenceWrapper {id: incidence}', root, "incidence");
incidenceWrapper.incidenceItem = CalendarManager.incidenceItem(incidenceData.incidencePtr);
collectionData = CalendarManager.getCollectionDetails(incidenceWrapper.collectionId);
}
}
component HoverLabel: QQC2.Label {
......@@ -60,7 +66,7 @@ QQC2.ScrollView {
}
contentWidth: availableWidth
contentHeight: infoBody.implicitHeight + (infoBody.padding * 2)
contentHeight: infoBody.height
clip: true
property real yScrollPos: QQC2.ScrollBar.vertical.position
......@@ -74,12 +80,17 @@ QQC2.ScrollView {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: padding
anchors.leftMargin: padding
anchors.rightMargin: padding
columns: 2
RowLayout {
id: incidenceHeader
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.topMargin: infoBody.padding
Kirigami.Heading {
Layout.fillWidth: true
......@@ -595,5 +606,11 @@ QQC2.ScrollView {
}
}
}
Item {
id: incidenceFooterPadding
Layout.fillWidth: true
Layout.preferredHeight: infoBody.padding
}
}
}
......@@ -14,10 +14,8 @@ QQC2.Popup {
id: root
property var incidenceData
property alias scrollView: incidenceInfoContents.scrollView
contentWidth: availableWidth
padding: 0
clip: false
background: Kirigami.ShadowedRectangle {
......@@ -35,11 +33,19 @@ QQC2.Popup {
border.color: Kirigami.ColorUtils.tintWithAlpha(color, Kirigami.Theme.textColor, 0.2)
}
contentItem: IncidenceInfoContents {
id: incidenceInfoContents
contentItem: Loader {
id: incidenceInfoContentsLoader
anchors.fill: parent
active: root.visible && root.incidenceData !== null && root.incidenceData !== undefined
sourceComponent: IncidenceInfoContents {
id: incidenceInfoContents
anchors.fill: parent
contentPadding: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing
clip: true
incidenceData: root.incidenceData
clip: true
incidenceData: root.incidenceData
}
}
}
......@@ -36,9 +36,10 @@ Kirigami.OverlayDrawer {
contentItem: Loader {
anchors.fill: parent
active: root.drawerOpen
active: root.drawerOpen && root.incidenceData !== null && root.incidenceData !== undefined
sourceComponent: ColumnLayout {
anchors.fill: parent
spacing: 0
Kirigami.AbstractApplicationHeader {
Layout.fillWidth: true
......
......@@ -121,6 +121,8 @@ QtObject {
const incidenceInfoComponent = usingDrawer ? appMain.incidenceInfoDrawer : appMain.incidenceInfoPopup;
// HACK: Give it a chance to reset properly
incidenceInfoComponent.incidenceData = null;
incidenceInfoComponent.incidenceData = modelData;
if (!usingDrawer) {
......
......@@ -515,8 +515,19 @@ Kirigami.ApplicationWindow {
sourceComponent: IncidenceInfoDrawer {
id: incidenceInfoDrawer
width: if(!Kirigami.Settings.isMobile) actualWidth
height: if(Kirigami.Settings.isMobile) applicationWindow().height * 0.6
readonly property int minWidth: Kirigami.Units.gridUnit * 15
readonly property int maxWidth: Kirigami.Units.gridUnit * 25
readonly property int defaultWidth: Kirigami.Units.gridUnit * 20
property int actualWidth: {
if (Config.incidenceInfoDrawerDrawerWidth && Config.incidenceInfoDrawerDrawerWidth === -1) {
return defaultWidth;
} else {
return Config.incidenceInfoDrawerDrawerWidth;
}
}
width: Kirigami.Settings.isMobile ? parent.width : actualWidth
height: Kirigami.Settings.isMobile ? applicationWindow().height * 0.6 : parent.height
bottomPadding: menuLoader.active ? menuLoader.height : 0
modal: !root.wideScreen || !enabled
......@@ -529,17 +540,6 @@ Kirigami.ApplicationWindow {
onIncidenceDataChanged: root.openOccurrence = incidenceData;
onVisibleChanged: visible ? root.openOccurrence = incidenceData : root.openOccurrence = null
readonly property int minWidth: Kirigami.Units.gridUnit * 15
readonly property int maxWidth: Kirigami.Units.gridUnit * 25
readonly property int defaultWidth: Kirigami.Units.gridUnit * 20
property int actualWidth: {
if (Config.incidenceInfoDrawerDrawerWidth && Config.incidenceInfoDrawerDrawerWidth === -1) {
return defaultWidth;
} else {
return Config.incidenceInfoDrawerDrawerWidth;
}
}
ResizerSeparator {
anchors.left: if(Qt.application.layoutDirection !== Qt.RightToLeft) parent.left
anchors.leftMargin: if(Qt.application.layoutDirection !== Qt.RightToLeft) -1 // Cover up the natural separator on the drawer
......@@ -654,7 +654,7 @@ Kirigami.ApplicationWindow {
y: positionBelowIncidenceItem && openingIncidenceItem ? incidenceItemPosition.y + openingIncidenceItem.height : incidenceItemPosition.y - height;
width: Math.min(pageStack.currentItem.width, Kirigami.Units.gridUnit * 30)
height: Math.min(Kirigami.Units.gridUnit * 16, scrollView.contentHeight)
height: Math.min(Kirigami.Units.gridUnit * 16, implicitHeight)
onIncidenceDataChanged: root.openOccurrence = incidenceData
onVisibleChanged: {
......@@ -664,6 +664,8 @@ Kirigami.ApplicationWindow {
reposition();
} else {
root.openOccurrence = null;
// Unlike the drawer we are not going to reopen the popup without selecting an incidence
incidenceData = null;
}
}
}
......
Supports Markdown
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