From 0ee35c6f6d0389a8e2d0a5a0506383f22202fb18 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sat, 31 Oct 2020 12:00:14 +0100 Subject: [PATCH] added link for second infosheet --- resources/qml/Widgets/CalendarWidget.qml | 46 ++++++++++++++---------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/resources/qml/Widgets/CalendarWidget.qml b/resources/qml/Widgets/CalendarWidget.qml index f773fdb..56c9c52 100644 --- a/resources/qml/Widgets/CalendarWidget.qml +++ b/resources/qml/Widgets/CalendarWidget.qml @@ -190,7 +190,15 @@ DataListView { } } - var infosheet = getCompInfoUrl(compIndex) !== undefined ? ("" + qsTr('infosheet') + ""): "" + var infoUrls = getCompInfoUrls(compIndex) + var infosheet = ""; + if(infoUrls.length >= 1) + infosheet += ("" + qsTr('infosheet') + "") + if(infoUrls.length === 2) + infosheet += (", " + qsTr('further infos') + "") + + console.log("Infosheet: " + infosheet) + var eventWebsite = control.widgetData["competitions"][compIndex]["homepage"] !== undefined ? ("" + qsTr('Event Website') + ""):"" selector.appear(selectOptions, control.widgetData["competitions"][compIndex]['name'], eventWebsite + ((eventWebsite !== "" && infosheet !== "") ? ", ":"") + infosheet ) @@ -270,23 +278,25 @@ DataListView { } - function getCompInfoUrl(compIndex) { - switch(params.nation) { - case "GER": - if(control.widgetData["competitions"][compIndex]['info'] !== undefined){ - return "http://ranking.alpenverein.de/" + control.year + "/GER/" + control.widgetData["competitions"][compIndex]['rkey'] + ".pdf" - } - return - case "SUI": - return - default: - if(control.widgetData["competitions"][compIndex]['info'] === undefined){ - return control.widgetData["competitions"][compIndex]['info2'] - } - else { - return control.widgetData["competitions"][compIndex]['info'] - } + function getCompInfoUrls(compIndex) { + + var urls = []; + + if(control.widgetData["competitions"][compIndex].hasOwnProperty("info")) { + if(params.nation === "GER") + urls.push("http://ranking.alpenverein.de/" + control.year + "/GER/" + control.widgetData["competitions"][compIndex]['rkey'] + ".pdf") + else + urls.push(control.widgetData["competitions"][compIndex]['info']) } + + if(control.widgetData["competitions"][compIndex].hasOwnProperty("info2")) { + if(params.nation === "GER") + urls.push("http://ranking.alpenverein.de/" + control.year + "/GER/i" + control.widgetData["competitions"][compIndex]['rkey'] + ".pdf") + else + urls.push(control.widgetData["competitions"][compIndex]['info2']) + } + + return urls; } function filterCats(display, cats) { @@ -414,7 +424,7 @@ DataListView { width: parent.width height: thisIsVisible ? compDelCol.height + 10 : 0 - enabled: ((thisData["cats"] !== undefined && thisData["cats"].length > 0) || competitionDel.thisData["homepage"] !== undefined || getCompInfoUrl(index) !== undefined) && height > 0 + enabled: ((thisData["cats"] !== undefined && thisData["cats"].length > 0) || competitionDel.thisData["homepage"] !== undefined || getCompInfoUrls(index).length > 0) && height > 0 //visible: includedByFilter opacity: 0