Warning, /frameworks/knewstuff/src/qtquick/qml/UploadPage.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2019 Dan Leinir Turthra Jensen <admin@leinir.dk> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 /** 0008 * @brief A Kirigami.Page component used for showing how to upload KNS entries to a service 0009 * 0010 * This page shows a short guide for uploading new content to the service provided by a KNewStuff 0011 * provider. This attempts to use the information available through the provider itself, and 0012 * shows a link to the service's web page, and email in case it is not the KDE Store. 0013 * 0014 * While there are not currently any services which support direct OCS API based uploading of 0015 * new content, we still need a way to guide people to how to do this, hence this component's 0016 * simplistic nature. 0017 * 0018 * This component is functionally equivalent to the old UploadDialog 0019 * @see KNewStuff::UploadDialog 0020 * @since 5.85 0021 */ 0022 0023 import QtQuick 2.11 0024 import QtQuick.Controls 2.11 as QtControls 0025 import QtQuick.Layouts 1.11 as QtLayouts 0026 0027 import org.kde.kcm 1.2 as KCM 0028 import org.kde.kirigami 2.12 as Kirigami 0029 0030 import org.kde.newstuff 1.85 as NewStuff 0031 0032 import "private" as Private 0033 0034 Kirigami.ScrollablePage { 0035 id: component; 0036 /** 0037 * The NewStuffQuick Engine instance used to display content for this item. 0038 * You can either pass in one that has already been set up (such as from a 0039 * NewStuff.Page or NewStuff.Dialog), or you can construct a new one yourself, 0040 * simply by doing something like this (which will use the wallpapers configuration): 0041 \code 0042 NewStuff.UploadPage { 0043 engine: NewStuff.Engine { 0044 configFile: "wallpapers.knsrc" 0045 } 0046 } 0047 \endcode 0048 */ 0049 required property QtObject engine 0050 0051 title: i18nc("@knewstuff5", "Upload New Stuff: %1", component.engine.name); 0052 NewStuff.QuestionAsker {} 0053 Private.ErrorDisplayer { engine: component.engine; active: component.isCurrentPage; } 0054 0055 QtLayouts.ColumnLayout { 0056 QtLayouts.Layout.fillWidth: true; 0057 Item { 0058 QtLayouts.Layout.fillWidth: true; 0059 opacity: implicitHeight > 0 ? 1 : 0 0060 Behavior on opacity { NumberAnimation { duration: Kirigami.Units.longDuration; easing.type: Easing.InOutQuad; } } 0061 visible: opacity > 0 0062 implicitHeight: uploaderBusy.running ? uploaderBusy.height + uploaderBusyInfo.height + Kirigami.Units.largeSpacing * 4 : 0; 0063 QtLayouts.Layout.preferredHeight: implicitHeight; 0064 Behavior on QtLayouts.Layout.preferredHeight { NumberAnimation { duration: Kirigami.Units.longDuration; easing.type: Easing.InOutQuad; } } 0065 QtControls.BusyIndicator { 0066 id: uploaderBusy 0067 anchors { 0068 horizontalCenter: parent.horizontalCenter 0069 bottom: parent.verticalCenter 0070 bottomMargin: Kirigami.Units.largeSpacing 0071 } 0072 running: component.engine.isLoading && component.engine.isValid 0073 } 0074 QtControls.Label { 0075 id: uploaderBusyInfo 0076 anchors { 0077 top: parent.verticalCenter 0078 left: parent.left 0079 right: parent.right 0080 margins: Kirigami.Units.largeSpacing 0081 } 0082 horizontalAlignment: Text.AlignHCenter 0083 text: i18ndc("knewstuff5", "A text shown beside a busy indicator suggesting that data is being fetched", "Updating information...") 0084 } 0085 } 0086 Repeater { 0087 model: NewStuff.ProvidersModel { 0088 engine: component.engine.engine; 0089 } 0090 Kirigami.Card { 0091 enabled: !uploaderBusy.running 0092 banner { 0093 title: { 0094 if (model.name === "api.kde-look.org") { 0095 return i18ndc("knewstuff5", "The name of the KDE Store", "KDE Store"); 0096 } else if (model.name !== "") { 0097 return model.name; 0098 } else if (component.engine.name !== "") { 0099 return component.engine.name; 0100 } else { 0101 return i18ndc("knewstuff5", "An unnamed provider", "Your Provider"); 0102 } 0103 } 0104 titleIcon: model.icon == "" ? "get-hot-new-stuff" : model.icon; 0105 } 0106 actions: [ 0107 Kirigami.Action { 0108 visible: model.website != "" 0109 text: i18ndc("knewstuff5", "Text for an action which causes the specified website to be opened using the user's system default browser", "Open Website: %1", model.website) 0110 onTriggered: Qt.openUrlExternally(model.website); 0111 }, 0112 Kirigami.Action { 0113 visible: model.contactEmail != "" && model.name != "api.kde-look.org" 0114 text: i18ndc("knewstuff5", "Text for an action which will attempt to send an email using the user's system default email client", "Send Email To: %1", model.contactEmail) 0115 onTriggered: Qt.openUrlExternally("mailto:" + model.contactEmail); 0116 } 0117 ] 0118 contentItem: QtControls.Label { 0119 wrapMode: Text.Wrap; 0120 text: model.name === "api.kde-look.org" 0121 ? i18ndc("knewstuff5", "A description of how to upload content to a generic provider", "To upload new entries, or to add content to an existing entry on the KDE Store, please open the website and log in. Once you have done this, you will be able to find the My Products entry in the menu which pops up when you click your user icon. Click on this entry to go to the product management system, where you can work on your products .") 0122 : i18ndc("knewstuff5", "A description of how to upload content to the KDE Store specifically", "To upload new entries, or to add content to an existing entry, please open the provider's website and follow the instructions there. You will likely need to create a user and log in to a product management system, where you will need to follow the instructions for how to add. Alternatively, you might be required to contact the managers of the site directly to get new content added.") 0123 } 0124 } 0125 } 0126 } 0127 }