on xenial help sign in
Safer fix
commit02bf242f83294635f450eb0a615da7729a98b96c authorAlbert Astals <albert.astals@canonical.com> dateThu 13 Feb 2014, 12:35 (13 years ago) parent291d4b4
2 files changed+11−9
qml/Dash/CardFilterGrid.qml+4−7 qml/Dash/CardTool.qml+7−2
qml/Dash/CardFilterGrid.qml+4−7
@@ -28,13 +28,10 @@ DashFilterGrid {
2828 CardTool {
2929 id: cardTool
3030
31− template: {
32− // We can't trust the parent template. It may happen that originally
33− // it was a carousel but it's now a grid because of the lack of elements
34− var t = genericFilterGrid.template
35− t["category-layout"] = "grid";
36− return t;
37− }
31+ template: genericFilterGrid.template
32+ // We can't trust the template since it may happen it is carousel
33+ // that is being should as a grid because of the lack of elements
34+ categoryLayout: "grid"
3835 components: genericFilterGrid.components
3936 }
4037
qml/Dash/CardTool.qml+7−2
@@ -43,6 +43,11 @@ Item {
4343 */
4444 property var viewWidth
4545
46+ /*!
47+ \brief The category layout for this card tool
48+ */
49+ property string categoryLayout: template ? template["category-layout"] : ""
50+
4651 // FIXME: Saviq
4752 // Only way for the card below to actually be laid out completely.
4853 // If invisible or in "data" array, some components are not taken into account.
@@ -56,7 +61,7 @@ Item {
5661 If undefined, should use implicit width of the actual card.
5762 */
5863 readonly property var cardWidth: {
59− switch (template !== undefined && template["category-layout"]) {
64+ switch (categoryLayout) {
6065 case "grid":
6166 case "vertical-journal":
6267 if (template["card-layout"] === "horizontal") return units.gu(38);
@@ -84,7 +89,7 @@ Item {
8489 If undefined, should use implicit height of the actual card.
8590 */
8691 readonly property var cardHeight: {
87− switch (template !== undefined && template["category-layout"]) {
92+ switch (categoryLayout) {
8893 case "journal":
8994 if (template["card-size"] >= 12 && template["card-size"] <= 38) return units.gu(template["card-size"]);
9095 return units.gu(18.5);