nextcloud-desktop/src/gui/ErrorBox.qml
Claudio Cambra 2ec1da22ed Remove now redundant use of textFormat
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
2022-12-05 15:21:09 +01:00

80 lines
1.8 KiB
QML

import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import Style 1.0
import "./tray"
Item {
id: errorBox
signal closeButtonClicked
property string text: ""
property color backgroundColor: Style.errorBoxBackgroundColor
property bool showCloseButton: false
implicitHeight: errorMessageLayout.implicitHeight + (2 * Style.standardSpacing)
Rectangle {
id: solidStripe
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
width: Style.errorBoxStripeWidth
color: errorBox.backgroundColor
}
Rectangle {
anchors.fill: parent
color: errorBox.backgroundColor
opacity: 0.2
}
GridLayout {
id: errorMessageLayout
anchors.fill: parent
anchors.margins: Style.standardSpacing
anchors.leftMargin: Style.standardSpacing + solidStripe.width
columns: 2
EnforcedPlainTextLabel {
Layout.fillWidth: true
color: Style.ncTextColor
font.bold: true
text: qsTr("Error")
visible: errorBox.showCloseButton
}
Button {
Layout.preferredWidth: Style.iconButtonWidth
Layout.preferredHeight: Style.iconButtonWidth
background: null
icon.color: Style.ncTextColor
icon.source: "qrc:///client/theme/close.svg"
visible: errorBox.showCloseButton
enabled: visible
onClicked: errorBox.closeButtonClicked()
}
EnforcedPlainTextLabel {
id: errorMessage
Layout.fillWidth: true
Layout.fillHeight: true
Layout.columnSpan: 2
color: Style.ncTextColor
wrapMode: Text.WordWrap
text: errorBox.text
}
}
}