Warning, /plasma/aura-browser/app/qml/DownloadRequest.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2022 Aditya Mehra <aix.m@outlook.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.12 0008 import QtQuick.Controls 2.12 0009 import QtWebEngine 1.7 0010 import QtWebChannel 1.0 0011 import QtQuick.Layouts 1.12 0012 import org.kde.kirigami as Kirigami 0013 0014 Item { 0015 property var download 0016 property var messageText 0017 property bool actionsVisible: true 0018 property bool isDownloading: false 0019 property var downloadBytes: download.receivedBytes 0020 property string downloadName 0021 0022 onDownloadBytesChanged: { 0023 downloadProgressBar.value = downloadBytes / download.totalBytes 0024 } 0025 0026 width: parent.width 0027 height: parent.height 0028 0029 onMessageTextChanged: { 0030 message.text = messageText 0031 } 0032 0033 RowLayout { 0034 anchors.fill: parent 0035 0036 Label { 0037 id: message 0038 Layout.fillWidth: true 0039 Layout.leftMargin: Kirigami.Units.largeSpacing 0040 text: i18n("Do you want to download %1 file ?", downloadName) 0041 color: Kirigami.Theme.textColor 0042 } 0043 0044 Button { 0045 id: downloadButton 0046 text: "Download" 0047 Layout.alignment: Qt.AlignRight 0048 Layout.preferredWidth: Kirigami.Units.iconSizes.large 0049 visible: actionsVisible && !isDownloading 0050 palette.buttonText: Kirigami.Theme.textColor 0051 0052 background: Rectangle { 0053 color: downloadButton.activeFocus ? Kirigami.Theme.highlightColor : Qt.lighter(Kirigami.Theme.backgroundColor, 1.2) 0054 border.color: Kirigami.Theme.disabledTextColor 0055 radius: 20 0056 } 0057 0058 onClicked: (mouse)=> { 0059 download.resume(); 0060 message.text = i18n("Downloading.. %1", downloadName) 0061 isDownloading = true; 0062 if(download.totalBytes != -1){ 0063 downloadProgressBar.indeterminate = false 0064 } else { 0065 downloadProgressBar.indeterminate = true 0066 } 0067 } 0068 } 0069 0070 ProgressBar { 0071 id: downloadProgressBar 0072 visible: isDownloading 0073 enabled: isDownloading 0074 Layout.preferredWidth: Kirigami.Units.iconSizes.large * 2 0075 Layout.preferredHeight: Kirigami.Units.iconSizes.medium 0076 Layout.alignment: Qt.AlignRight 0077 from: 0 0078 to: 1 0079 } 0080 0081 Button { 0082 id: cancleButton 0083 text: i18n("Cancel") 0084 Layout.alignment: Qt.AlignRight 0085 Layout.preferredWidth: Kirigami.Units.iconSizes.large 0086 visible: actionsVisible 0087 palette.buttonText: Kirigami.Theme.textColor 0088 0089 background: Rectangle { 0090 color: cancleButton.activeFocus ? Kirigami.Theme.highlightColor : Qt.lighter(Kirigami.Theme.backgroundColor, 1.2) 0091 border.color: Kirigami.Theme.disabledTextColor 0092 radius: 20 0093 } 0094 0095 onClicked: (mouse)=> { 0096 download.cancel() 0097 interactionBar.isRequested = false 0098 } 0099 } 0100 0101 Button { 0102 id: closeButton 0103 Layout.alignment: Qt.AlignRight 0104 Layout.preferredWidth: Kirigami.Units.iconSizes.large - (Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing) 0105 Layout.preferredHeight: Kirigami.Units.iconSizes.large - (Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing) 0106 Layout.leftMargin: Kirigami.Units.largeSpacing 0107 0108 background: Rectangle { 0109 color: closeButton.activeFocus ? Kirigami.Theme.highlightColor : Qt.lighter(Kirigami.Theme.backgroundColor, 1.2) 0110 border.color: Kirigami.Theme.disabledTextColor 0111 radius: 200 0112 } 0113 0114 Kirigami.Icon { 0115 anchors.centerIn: parent 0116 width: Kirigami.Units.iconSizes.medium 0117 height: Kirigami.Units.iconSizes.medium 0118 source: "window-close" 0119 } 0120 0121 onClicked: (mouse)=> { 0122 interactionBar.isRequested = false 0123 } 0124 } 0125 } 0126 }