KNewStuff

ErrorDisplayer.qml
1 /*
2  SPDX-FileCopyrightText: 2020 Dan Leinir Turthra Jensen <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 import QtQuick 2.12
8 
9 MessageBoxSheet {
10  id: component
11  title: i18ndc("knewstuff5", "Title for a dialog box which shows error messages", "An Error Occurred");
12  property bool active: true;
13  property QtObject engine;
14  property QtObject connection: Connections {
15  target: engine
16  onErrorMessage: { component.showError(message); }
17  }
18  property var errorsToShow: []
19  function showError(errorMessage) {
20  if (active === true) {
21  errorsToShow.push(errorMessage);
22  if (sheetOpen === false) {
23  text = errorsToShow.shift();
24  open();
25  }
26  }
27  }
28  onSheetOpenChanged: {
29  if (sheetOpen === false && errorsToShow.length > 0) {
30  text = errorsToShow.shift();
31  open();
32  }
33  }
34 }
QString i18ndc(const char *domain, const char *context, const char *text, const TYPE &arg...)
KIOCORE_EXPORT FileJob * open(const QUrl &url, QIODevice::OpenMode mode)
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.