@@ -16,6 +16,9 @@
1616
1717.pragma library
1818
19+// %1 is the template["card-background"] string
20+// %2 is the template["card-background"]["elements"][0]
21+// %3 is the template["card-background"]["elements"][1]
1922var kBackgroundLoaderCode = 'Loader {\n\
2023 id: backgroundLoader; \n\
2124 objectName: "backgroundLoader"; \n\
@@ -34,18 +37,14 @@ var kBackgroundLoaderCode = 'Loader {\n\
3437 objectName: "backgroundImage"; \n\
3538 source: { \n\
3639 if (cardData && typeof cardData["background"] === "string") return cardData["background"]; \n\
37− else if (template && typeof template["card-background"] === "string") return template["card-background"]; \n\
38− else return ""; \n\
40+ else return "%1"; \n\
3941 } \n\
4042 } \n\
4143 function getColor(index) { \n\
4244 if (cardData && typeof cardData["background"] === "object" \n\
4345 && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) { \n\
4446 return cardData["background"]["elements"][index]; \n\
45− } else if (template && typeof template["card-background"] === "object" \n\
46− && (template["card-background"]["type"] === "color" || template["card-background"]["type"] === "gradient")) { \n\
47− return template["card-background"]["elements"][index]; \n\
48− } else return undefined; \n\
47+ } else return index === 0 ? %2 : %3; \n\
4948 } \n\
5049 } \n\
5150 }\n';
@@ -315,9 +314,11 @@ var kSummaryLabelCode = 'Label { \n\
315314
316315function cardString(template, components) {
317316 var code;
317+
318+ var templateInteractive = (template == null ? true : (template["non-interactive"] !== undefined ? !template["non-interactive"] : true)) ? "true" : "false";
319+
318320 code = 'AbstractButton { \n\
319321 id: root; \n\
320− property var template; \n\
321322 property var components; \n\
322323 property var cardData; \n\
323324 property var artShapeBorderSource: undefined; \n\
@@ -330,8 +331,8 @@ function cardString(template, components) {
330331 property bool asynchronous: true; \n\
331332 property bool showHeader: true; \n\
332333 implicitWidth: childrenRect.width; \n\
333− enabled: root.template == null ? true : (root.template["non-interactive"] !== undefined ? !root.template["non-interactive"] : true); \n\
334− \n';
334+ enabled: %1; \n\
335+ \n'.arg(templateInteractive);
335336
336337 var hasArt = components["art"] && components["art"]["field"] || false;
337338 var hasSummary = components["summary"] || false;
@@ -348,7 +349,18 @@ function cardString(template, components) {
348349 var hasAttributes = hasTitle && components["attributes"]["field"] || false;
349350
350351 if (hasBackground) {
351− code += kBackgroundLoaderCode;
352+ var templateCardBackground = (template && typeof template["card-background"] === "string") ? template["card-background"] : "";
353+ var backgroundElements0;
354+ var backgroundElements1;
355+ if (template && typeof template["card-background"] === "object" && (template["card-background"]["type"] === "color" || template["card-background"]["type"] === "gradient")) {
356+ if (template["card-background"]["elements"][0] !== undefined) {
357+ backgroundElements0 = '"%1"'.arg(template["card-background"]["elements"][0]);
358+ }
359+ if (template["card-background"]["elements"][1] !== undefined) {
360+ backgroundElements1 = '"%1"'.arg(template["card-background"]["elements"][1]);
361+ }
362+ }
363+ code += kBackgroundLoaderCode.arg(templateCardBackground).arg(backgroundElements0).arg(backgroundElements1);
352364 }
353365
354366 if (hasArt) {