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 SPDX-FileCopyrightText: 2023 ivan tkachenko <me@ratijas.tk> 0004 0005 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0006 */ 0007 0008 /** 0009 * @brief A Kirigami.Page component used for showing how to upload KNS entries to a service 0010 * 0011 * This page shows a short guide for uploading new content to the service provided by a KNewStuff 0012 * provider. This attempts to use the information available through the provider itself, and 0013 * shows a link to the service's web page, and email in case it is not the KDE Store. 0014 * 0015 * While there are not currently any services which support direct OCS API based uploading of 0016 * new content, we still need a way to guide people to how to do this, hence this component's 0017 * simplistic nature. 0018 * 0019 * This component is functionally equivalent to the old UploadDialog 0020 * @see KNewStuff::UploadDialog 0021 * @since 5.85 0022 */ 0023 0024 import QtQuick 0025 import QtQuick.Controls as QQC2 0026 import QtQuick.Layouts 0027 import org.kde.kcmutils as KCM 0028 import org.kde.kirigami 2 as Kirigami 0029 import org.kde.newstuff as NewStuff 0030 0031 import "private" as Private 0032 0033 Kirigami.ScrollablePage { 0034 id: component 0035 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("@knewstuff6", "Upload New Stuff: %1", component.engine.name) 0052 0053 NewStuff.QuestionAsker { } 0054 0055 Private.ErrorDisplayer { 0056 engine: component.engine 0057 active: component.isCurrentPage 0058 } 0059 0060 ColumnLayout { 0061 Layout.fillWidth: true 0062 spacing: Kirigami.Units.smallSpacing 0063 0064 Item { 0065 Layout.fillWidth: true 0066 Layout.preferredHeight: implicitHeight 0067 0068 Behavior on Layout.preferredHeight { 0069 NumberAnimation { 0070 duration: Kirigami.Units.longDuration 0071 easing.type: Easing.InOutQuad 0072 } 0073 } 0074 0075 implicitHeight: uploaderBusy.running 0076 ? uploaderBusy.height + uploaderBusyInfo.height + Kirigami.Units.largeSpacing * 4 0077 : 0 0078 0079 visible: uploaderBusy.running 0080 opacity: uploaderBusy.running ? 1 : 0 0081 0082 Behavior on opacity { 0083 NumberAnimation { 0084 duration: Kirigami.Units.longDuration 0085 easing.type: Easing.InOutQuad 0086 } 0087 } 0088 0089 QQC2.BusyIndicator { 0090 id: uploaderBusy 0091 0092 anchors { 0093 horizontalCenter: parent.horizontalCenter 0094 bottom: parent.verticalCenter 0095 bottomMargin: Kirigami.Units.largeSpacing 0096 } 0097 running: component.engine.isLoading && component.engine.isValid 0098 } 0099 0100 QQC2.Label { 0101 id: uploaderBusyInfo 0102 0103 anchors { 0104 top: parent.verticalCenter 0105 left: parent.left 0106 right: parent.right 0107 margins: Kirigami.Units.largeSpacing 0108 } 0109 horizontalAlignment: Text.AlignHCenter 0110 text: i18ndc("knewstuff6", "A text shown beside a busy indicator suggesting that data is being fetched", "Updating information…") 0111 } 0112 } 0113 0114 Repeater { 0115 model: NewStuff.ProvidersModel { 0116 engine: component.engine.engine 0117 } 0118 0119 Kirigami.Card { 0120 enabled: !uploaderBusy.running 0121 0122 banner { 0123 title: { 0124 if (model.name === "api.kde-look.org") { 0125 return i18ndc("knewstuff6", "The name of the KDE Store", "KDE Store"); 0126 } else if (model.name !== "") { 0127 return model.name; 0128 } else if (component.engine.name !== "") { 0129 return component.engine.name; 0130 } else { 0131 return i18ndc("knewstuff6", "An unnamed provider", "Your Provider"); 0132 } 0133 } 0134 titleIcon: model.icon == "" ? "get-hot-new-stuff" : model.icon 0135 } 0136 0137 actions: [ 0138 Kirigami.Action { 0139 visible: model.website != "" 0140 text: i18ndc("knewstuff6", "Text for an action which causes the specified website to be opened using the user's system default browser", "Open Website: %1", model.website) 0141 onTriggered: Qt.openUrlExternally(model.website) 0142 }, 0143 0144 Kirigami.Action { 0145 visible: model.contactEmail != "" && model.name != "api.kde-look.org" 0146 text: i18ndc("knewstuff6", "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) 0147 onTriggered: Qt.openUrlExternally("mailto:" + model.contactEmail) 0148 } 0149 ] 0150 0151 contentItem: QQC2.Label { 0152 wrapMode: Text.Wrap 0153 text: model.name === "api.kde-look.org" 0154 ? i18ndc("knewstuff6", "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 .") 0155 : i18ndc("knewstuff6", "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.") 0156 } 0157 } 0158 } 0159 } 0160 }