Changeset View
Changeset View
Standalone View
Standalone View
discover/qml/ReviewsPage.qml
Show All 39 Lines | 35 | readonly property var rd: ReviewDialog { | |||
---|---|---|---|---|---|
40 | onAccepted: backend.submitReview(resource, summary, review, rating) | 40 | onAccepted: backend.submitReview(resource, summary, review, rating) | ||
41 | } | 41 | } | ||
42 | 42 | | |||
43 | function openReviewDialog() { | 43 | function openReviewDialog() { | ||
44 | reviewDialog.sheetOpen = true | 44 | reviewDialog.sheetOpen = true | ||
45 | page.sheetOpen = false | 45 | page.sheetOpen = false | ||
46 | } | 46 | } | ||
47 | 47 | | |||
48 | ListView { | | |||
49 | id: reviewsView | | |||
50 | | ||||
51 | clip: true | | |||
52 | spacing: Kirigami.Units.smallSpacing | | |||
53 | implicitWidth: Kirigami.Units.gridUnit * 25 | | |||
54 | cacheBuffer: Math.max(0, contentHeight) | | |||
55 | | ||||
56 | header: ColumnLayout { | 48 | header: ColumnLayout { | ||
57 | width: parent.width | 49 | width: parent.width | ||
58 | spacing: 0 | 50 | spacing: 0 | ||
59 | 51 | | |||
60 | Button { | 52 | Button { | ||
61 | id: reviewButton | 53 | id: reviewButton | ||
62 | 54 | | |||
63 | Layout.alignment: Qt.AlignHCenter | 55 | Layout.alignment: Qt.AlignHCenter | ||
64 | Layout.topMargin: Kirigami.Units.largeSpacing | | |||
65 | Layout.bottomMargin: Kirigami.Units.largeSpacing | | |||
66 | 56 | | |||
67 | visible: page.reviewsBackend != null | 57 | visible: page.reviewsBackend != null | ||
68 | enabled: page.resource.isInstalled | 58 | enabled: page.resource.isInstalled | ||
69 | text: i18n("Write a Review...") | 59 | text: i18n("Write a Review...") | ||
70 | onClicked: page.openReviewDialog() | 60 | onClicked: page.openReviewDialog() | ||
71 | } | 61 | } | ||
72 | Label { | 62 | Label { | ||
73 | Layout.alignment: Qt.AlignHCenter | 63 | Layout.alignment: Qt.AlignHCenter | ||
74 | Layout.bottomMargin: Kirigami.Units.largeSpacing * 2 | 64 | Layout.bottomMargin: Kirigami.Units.largeSpacing * 2 | ||
75 | text: i18n("Install this app to write a review") | 65 | text: i18n("Install this app to write a review") | ||
76 | wrapMode: Text.WordWrap | 66 | wrapMode: Text.WordWrap | ||
77 | visible: !reviewButton.enabled | 67 | visible: !reviewButton.enabled | ||
78 | opacity: 0.6 | 68 | opacity: 0.6 | ||
79 | } | 69 | } | ||
80 | } | 70 | } | ||
81 | 71 | | |||
72 | ListView { | ||||
73 | id: reviewsView | ||||
74 | | ||||
75 | clip: true | ||||
76 | topMargin: Kirigami.Units.largeSpacing | ||||
77 | spacing: Kirigami.Units.smallSpacing | ||||
78 | implicitWidth: Kirigami.Units.gridUnit * 25 | ||||
79 | cacheBuffer: Math.max(0, contentHeight) | ||||
80 | | ||||
82 | delegate: ReviewDelegate { | 81 | delegate: ReviewDelegate { | ||
83 | width: parent.width | 82 | width: parent.width | ||
84 | separator: index != ListView.view.count-1 | 83 | separator: index != ListView.view.count-1 | ||
85 | onMarkUseful: page.model.markUseful(index, useful) | 84 | onMarkUseful: page.model.markUseful(index, useful) | ||
86 | } | 85 | } | ||
87 | } | 86 | } | ||
88 | } | 87 | } |