Skip to content

Commit 4369d36

Browse files
committed
Improve the display of error messages
1 parent 6057c2f commit 4369d36

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

src/gui/qml/FolderError.qml

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import QtQuick
1616
import QtQuick.Controls
1717
import QtQuick.Layouts
1818

19-
import eu.OpenCloud.resources 1.0
19+
import eu.OpenCloud.gui 1.0
2020

2121
ColumnLayout {
2222
property bool collapsed: true
@@ -25,6 +25,7 @@ ColumnLayout {
2525
component ErrorItem: RowLayout {
2626
property alias text: label.text
2727
property alias maximumLineCount: label.maximumLineCount
28+
property alias truncated: label.truncated
2829
Image {
2930
Layout.alignment: Qt.AlignTop
3031
source: OpenCloud.resourcePath("fontawesome", "", enabled)
@@ -36,7 +37,7 @@ ColumnLayout {
3637
Label {
3738
id: label
3839
Layout.fillWidth: true
39-
elide: Label.ElideLeft
40+
elide: Label.ElideRight
4041
wrapMode: Label.WordWrap
4142
}
4243
}
@@ -46,25 +47,24 @@ ColumnLayout {
4647
ColumnLayout {
4748
Layout.fillWidth: true
4849
ScrollView {
50+
id: scrollView
51+
clip: true
4952
Layout.fillHeight: true
5053
Layout.fillWidth: true
51-
ColumnLayout {
52-
Layout.fillHeight: true
53-
Layout.fillWidth: true
54-
Repeater {
55-
model: errorMessages
56-
delegate: ErrorItem {
57-
required property string modelData
58-
text: modelData
59-
Layout.fillWidth: true
60-
}
54+
contentWidth: availableWidth
55+
ListView {
56+
model: errorMessages
57+
delegate: ErrorItem {
58+
width: scrollView.availableWidth
59+
required property string modelData
60+
text: modelData
6161
}
6262
}
6363
}
64-
Label {
64+
Button {
6565
Layout.alignment: Qt.AlignHCenter
66-
text: "<a href='foo'>" + qsTr("Show less") + "</a>"
67-
onLinkActivated: {
66+
text: qsTr("Show less")
67+
onClicked: {
6868
collapsed = true;
6969
}
7070
}
@@ -75,15 +75,18 @@ ColumnLayout {
7575
id: collapsedError
7676
ColumnLayout {
7777
Layout.fillWidth: true
78+
// we will show 2 lines of text or one line and a button
7879
ErrorItem {
80+
id: errorItem
7981
Layout.fillWidth: true
8082
text: errorMessages[0]
81-
maximumLineCount: 1
83+
maximumLineCount: errorMessages.length > 1 ? 1 : 2
8284
}
83-
Label {
85+
Button {
8486
Layout.alignment: Qt.AlignHCenter
85-
text: "<a href='foo'>" + qsTr("Show more") + "</a>"
86-
onLinkActivated: {
87+
text: qsTr("Show more")
88+
visible: errorMessages.length > 1 || errorItem.truncated
89+
onClicked: {
8790
collapsed = false;
8891
}
8992
}

0 commit comments

Comments
 (0)