From 21d4cd8f9fff870bb29080b74295fd4cb7c9b984 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Fri, 9 Nov 2018 13:44:42 +0100 Subject: [PATCH] Add Safety Data Sheet links to materials in Marketplace. [CURA-5922] --- .../qml/ToolboxCompatibilityChart.qml | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml b/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml index fd014d26e1..a1038fd6b2 100644 --- a/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml +++ b/plugins/Toolbox/resources/qml/ToolboxCompatibilityChart.qml @@ -11,7 +11,8 @@ Item id: base property var packageData - property var technicalDataSheetUrl: { + property var technicalDataSheetUrl: + { var link = undefined if ("Technical Data Sheet" in packageData.links) { @@ -25,10 +26,16 @@ Item } return link } + property var safetyDataSheetUrl: + { + var sds_name = "safetyDataSheet" + return (sds_name in packageData.links) ? packageData.links[sds_name] : undefined + } anchors.topMargin: UM.Theme.getSize("default_margin").height height: visible ? childrenRect.height : 0 - visible: packageData.type == "material" && (packageData.has_configs || technicalDataSheetUrl != undefined) + visible: packageData.type == "material" && + (packageData.has_configs || technicalDataSheetUrl !== undefined || safetyDataSheetUrl !== undefined) Item { @@ -163,23 +170,31 @@ Item Label { - id: technical_data_sheet + id: data_sheet_links anchors.top: combatibilityItem.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height / 2 - visible: base.technicalDataSheetUrl !== undefined + visible: base.technicalDataSheetUrl !== undefined || base.safetyDataSheetUrl !== undefined height: visible ? contentHeight : 0 text: { + var result = "" if (base.technicalDataSheetUrl !== undefined) { - return "%2".arg(base.technicalDataSheetUrl).arg("Technical Data Sheet") + result += "%2".arg(base.technicalDataSheetUrl).arg("Technical Data Sheet") } - return "" + if (base.safetyDataSheetUrl !== undefined) + { + if (result.length > 0) + { + result += "
" + } + result += "%2".arg(base.safetyDataSheetUrl).arg("Safety Data Sheet") + } + return result } font: UM.Theme.getFont("very_small") color: UM.Theme.getColor("text") linkColor: UM.Theme.getColor("text_link") onLinkActivated: Qt.openUrlExternally(link) } - }