Warning, /frameworks/knewstuff/src/qtquick/qml/private/ErrorDisplayer.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2020 Dan Leinir Turthra Jensen <admin@leinir.dk> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.12 0008 import org.kde.kirigami 2.7 as Kirigami 0009 import org.kde.newstuff 1.83 as NewStuff 0010 0011 MessageBoxSheet { 0012 id: component 0013 title: i18ndc("knewstuff5", "Title for a dialog box which shows error messages", "An Error Occurred"); 0014 property bool active: true; 0015 property QtObject engine; 0016 property QtObject connection: Connections { 0017 target: engine 0018 function onErrorCode(errorCode, message, metadata) { 0019 component.showError(errorCode, message, metadata); 0020 } 0021 } 0022 0023 property var errorsToShow: [] 0024 function showError(errorCode, errorMessage, errorMetadata) { 0025 if (active === true) { 0026 errorsToShow.push({ 0027 code: errorCode, 0028 message: errorMessage, 0029 metadata: errorMetadata 0030 }); 0031 showNextError(); 0032 } 0033 } 0034 onSheetOpenChanged: displayThrottle.start() 0035 property QtObject displayThrottle: Timer { 0036 interval: Kirigami.Units.shortDuration 0037 onTriggered: showNextError(); 0038 } 0039 function showNextError() { 0040 if (sheetOpen === false && errorsToShow.length > 0) { 0041 currentError = errorsToShow.shift(); 0042 open(); 0043 } 0044 } 0045 0046 property var currentError: null 0047 text: { 0048 if (currentError === null) { 0049 return ""; 0050 } else if (currentError.code == NewStuff.Engine.TryAgainLaterError) { 0051 return currentError.message + "\n\n" + i18n("Please try again later.") 0052 } else { 0053 return currentError.message; 0054 } 0055 } 0056 icon: { 0057 if (currentError === null) { 0058 return ""; 0059 } else if (currentError.code == NewStuff.Engine.TryAgainLaterError) { 0060 return "accept_time_event"; 0061 } else { 0062 return "dialog-warning"; 0063 } 0064 } 0065 }