KNewStuff

FeedbackOverlay.qml
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 2.11
8 import QtQuick.Controls 2.11 as QtControls
9 
10 import org.kde.kirigami 2.7 as Kirigami
11 
12 import org.kde.newstuff 1.62 as NewStuff
13 
14 Item {
15  property QtObject newStuffModel
16  visible: opacity > 0
17  opacity: (model.status == NewStuff.ItemsModel.InstallingStatus || model.status == NewStuff.ItemsModel.UpdatingStatus) ? 1 : 0
18  Behavior on opacity { NumberAnimation { duration: Kirigami.Units.longDuration; } }
19  Rectangle {
20  anchors.fill: parent
21  color: Kirigami.Theme.backgroundColor
22  opacity: 0.9;
23  }
24  QtControls.BusyIndicator {
25  anchors {
26  horizontalCenter: parent.horizontalCenter
27  bottom: parent.verticalCenter
28  bottomMargin: Kirigami.Units.smallSpacing
29  }
30  running: parent.visible
31  }
32  QtControls.Label {
33  id: statusLabel
34  Connections {
35  target: newStuffModel
36  onEntryChanged: {
37  var status = newStuffModel.data(newStuffModel.index(index, 0), NewStuff.ItemsModel.StatusRole);
38  if (status == NewStuff.ItemsModel.DownloadableStatus
39  || status == NewStuff.ItemsModel.InstalledStatus
40  || status == NewStuff.ItemsModel.UpdateableStatus
41  || status == NewStuff.ItemsModel.DeletedStatus) {
42  statusLabel.text = "";
43  } else if (status == NewStuff.ItemsModel.InstallingStatus) {
44  statusLabel.text = i18ndc("knewstuff5", "Label for the busy indicator showing an item is being installed", "Installing...");
45  } else if (status == NewStuff.ItemsModel.UpdatingStatus) {
46  statusLabel.text = i18ndc("knewstuff5", "Label for the busy indicator showing an item is in the process of being updated", "Updating...");
47  } else {
48  statusLabel.text = i18ndc("knewstuff5", "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>.");
49  }
50  }
51  }
52  onLinkActivated: Qt.openUrlExternally(link);
53  anchors {
54  top: parent.verticalCenter
55  left: parent.left
56  right: parent.right
57  margins: Kirigami.Units.smallSpacing
58  }
59  horizontalAlignment: Text.AlignHCenter
60  // TODO: This is where we'd want to put the download progress and cancel button as well
61  text: i18ndc("knewstuff5", "Label for the busy indicator showing an item is installing", "Installing...");
62  }
63 }
QTextStream & right(QTextStream &stream)
QString i18ndc(const char *domain, const char *context, const char *text, const TYPE &arg...)
QTextStream & left(QTextStream &stream)
QTextStream & left(QTextStream &s)
QTextStream & right(QTextStream &s)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 18 2021 22:43:49 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.