9import org.kde.kirigami as Kirigami
10import org.kde.newstuff as NewStuff
12Kirigami.PromptDialog {
15 title: i18ndc("knewstuff6",
"Title for a dialog box which shows error messages",
"An Error Occurred");
16 standardButtons:
Kirigami.Dialog.NoButton
18 property bool active:
true
19 property NewStuff.Engine engine
21 readonly
property Connections connection: Connections {
22 target: component.engine
23 function onErrorCode(errorCode, message, metadata) {
24 component.showError(errorCode, message, metadata);
28 property var errorsToShow: []
29 function showError(errorCode, errorMessage, errorMetadata) {
30 if (active ===
true) {
34 metadata: errorMetadata
39 onVisibleChanged: displayThrottle.start()
40 property QtObject displayThrottle: Timer {
41 interval:
Kirigami.Units.shortDuration
42 onTriggered: showNextError()
44 function showNextError() {
45 if (visible ===
false && errorsToShow.length > 0) {
46 currentError = errorsToShow.shift();
51 property var currentError: null
54 implicitWidth:
Kirigami.Units.gridUnit * 10
58 Layout.alignment:
Qt.AlignVCenter
59 visible: source !==
""
61 if (currentError === null) {
63 }
else if (currentError.code === NewStuff.ErrorCode.TryAgainLaterError) {
64 return "accept_time_event";
66 return "dialog-warning";
72 Layout.fillWidth:
true
73 Layout.alignment:
Qt.AlignVCenter
75 textFormat: TextEdit.AutoText
76 onLinkActivated:
link =>
Qt.openUrlExternally(link)
79 if (currentError === null) {
81 }
else if (currentError.code === NewStuff.ErrorCode.TryAgainLaterError) {
82 return currentError.message +
"\n\n" +
i18n(
"Please try again later.")
84 return currentError.message;
QString i18n(const char *text, const TYPE &arg...)
KCALUTILS_EXPORT QString errorMessage(const KCalendarCore::Exception &exception)
KIOCORE_EXPORT CopyJob * link(const QList< QUrl > &src, const QUrl &destDir, JobFlags flags=DefaultFlags)
const QList< QKeySequence > & open()