@@ -19,42 +19,63 @@ import Ubuntu.Components 0.1
19import "../Components"
19import "../Components"
21DashRenderer {
21DashRenderer {
22− id: genericVerticalJournal
22+ id: root
24− property alias minimumColumnSpacing: cardVerticalJournal.minimumColumnSpacing
24+ readonly property double collapseLimit: units.gu(35)
25− property alias maximumNumberOfColumns: cardVerticalJournal.maximumNumberOfColumns
26− property alias columnWidth: cardVerticalJournal.columnWidth
27− property alias rowSpacing: cardVerticalJournal.rowSpacing
29− anchors.fill: parent
26+ uncollapsedHeight: cardVerticalJournal.implicitHeight
27+ collapsedHeight: Math.min(collapseLimit, cardVerticalJournal.implicitHeight)
28+ expandable: uncollapsedHeight > collapseLimit
30+ // This minHeight is used as bootstrapper for the height. Vertical Journal
31+ // is special by the fact that it doesn't know how to calculate its implicit height unless we give it
32+ // enough height that it can start creating it's children so we make sure it has enough height for that
33+ // in case the model is non empty
34+ readonly property double minHeight: root.model.count > 1 ? cardVerticalJournal.rowSpacing + 1 : 0
35+ height: filtered ? Math.max(collapsedHeight, minHeight) : uncollapsedHeight
39+ animation: UbuntuNumberAnimation { }
42+ function setFilter(filter, animate) {
43+ heightBehaviour.enabled = animate;
31 ResponsiveVerticalJournal {
47 ResponsiveVerticalJournal {
32 id: cardVerticalJournal
48 id: cardVerticalJournal
33 anchors.fill: parent
52 anchors.fill: parent
34− maximumNumberOfColumns: 2
35− minimumColumnSpacing: units.gu(1)
53+ rowSpacing: minimumColumnSpacing
36− rowSpacing: units.gu(1)
37− model: genericVerticalJournal.model
39− columnWidth: {
54+ columnWidth: cardTool.cardWidth
40− if (genericVerticalJournal.template !== undefined) {
41− switch (genericVerticalJournal.template['card-size']) {
42− case "small": return units.gu(12);
43− case "large": return units.gu(38);
46− return units.gu(18.5);
49− delegate: Card {
56+ displayMarginBeginning: root.displayMarginBeginning
50− id: card
57+ displayMarginEnd: root.displayMarginEnd
51− objectName: "delegate" + index
53− template: genericVerticalJournal.template
54− components: genericVerticalJournal.components
61+ sourceComponent: cardTool.cardComponent
62+ width: cardTool.cardWidth
63+ anchors.horizontalCenter: parent.horizontalCenter
65+ item.objectName = "delegate" + index;
66+ item.width = Qt.binding(function() { return cardTool.cardWidth; });
67+ item.height = Qt.binding(function() { return cardTool.cardHeight; });
68+ item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
69+ item.cardData = Qt.binding(function() { return model; });
70+ item.template = Qt.binding(function() { return cardTool.template; });
71+ item.components = Qt.binding(function() { return cardTool.components; });
72+ item.headerAlignment = Qt.binding(function() { return cardTool.headerAlignment; });
56− //onClicked: cardVerticalJournal.clicked(index, tile.y)
76+ onClicked: root.clicked(index, result)
57− //onPressAndHold: cardVerticalJournal.pressAndHold(index, tile.y)
77+ onPressAndHold: root.pressAndHold(index)