| 1 |
/* |
| 2 |
SPDX-FileCopyrightText: 2019 Dan Leinir Turthra Jensen <[email protected]> |
| 3 |
|
| 4 |
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
| 5 |
*/ |
| 6 |
|
| 7 |
import QtQuick |
| 8 |
import QtQuick.Controls as QQC2 |
| 9 |
|
| 10 |
import org.kde.kirigami as Kirigami |
| 11 |
|
| 12 |
import org.kde.newstuff as NewStuff |
| 13 |
|
| 14 |
Item { |
| 15 |
property QtObject newStuffModel |
| 16 |
|
| 17 |
visible: opacity > 0 |
| 18 |
opacity: (model.entry.status === NewStuff.Entry.Installing || model.entry.status === NewStuff.Entry.Updating) ? 1 : 0 |
| 19 |
|
| 20 |
Behavior on opacity { NumberAnimation { duration: Kirigami.Units.longDuration } } |
| 21 |
Rectangle { |
| 22 |
anchors.fill: parent |
| 23 |
color: Kirigami.Theme.backgroundColor |
| 24 |
opacity: 0.9 |
| 25 |
} |
| 26 |
QQC2.BusyIndicator { |
| 27 |
anchors { |
| 28 |
horizontalCenter: parent.horizontalCenter |
| 29 |
bottom: parent.verticalCenter |
| 30 |
bottomMargin: Kirigami.Units.smallSpacing |
| 31 |
} |
| 32 |
running: parent.visible |
| 33 |
} |
| 34 |
QQC2.Label { |
| 35 |
id: statusLabel |
| 36 |
Connections { |
| 37 |
target: newStuffModel |
| 38 |
function onEntryChanged(entry) { |
| 39 |
const status = entry.status; |
| 40 |
if (status === NewStuff.Entry.Downloadable |
| 41 |
|| status === NewStuff.Entry.Installed |
| 42 |
|| status === NewStuff.Entry.Updateable |
| 43 |
|| status === NewStuff.Entry.Deleted) { |
| 44 |
statusLabel.text = ""; |
| 45 |
} else if (status === NewStuff.Entry.Installing) { |
| 46 |
statusLabel.text = i18ndc("knewstuff6", "Label for the busy indicator showing an item is being installed OR uninstalled", "Working…"); |
| 47 |
} else if (status === NewStuff.Entry.Updating) { |
| 48 |
statusLabel.text = i18ndc("knewstuff6", "Label for the busy indicator showing an item is in the process of being updated", "Updating…"); |
| 49 |
} else { |
| 50 |
statusLabel.text = i18ndc("knewstuff6", "Label for the busy indicator which should only be shown when the entry has been given some unknown or invalid status.", "Invalid or unknown state. <a href=\"https://bugs.kde.org/enter_bug.cgi?product=frameworks-knewstuff\">Please report this to the KDE Community in a bug report</a>."); |
| 51 |
} |
| 52 |
} |
| 53 |
} |
| 54 |
onLinkActivated: link => Qt.openUrlExternally(link) |
| 55 |
anchors { |
| 56 |
top: parent.verticalCenter |
| 57 |
left: parent.left |
| 58 |
right: parent.right |
| 59 |
margins: Kirigami.Units.smallSpacing |
| 60 |
} |
| 61 |
horizontalAlignment: Text.AlignHCenter |
| 62 |
// TODO: This is where we'd want to put the download progress and cancel button as well |
| 63 |
text: i18ndc("knewstuff6", "Label for the busy indicator showing an item is installing", "Installing…") |
| 64 |
} |
| 65 |
} |