KNewStuff

EntryCommentsPage.qml
1/*
2 SPDX-FileCopyrightText: 2019 Dan Leinir Turthra Jensen <admin@leinir.dk>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7/**
8 * @brief A Kirigami.Page component used for displaying a NewStuff entry's comments
9 */
10
11import QtQuick 2.11
12import QtQuick.Controls 2.11 as QtControls
13import QtQuick.Layouts 1.11 as QtLayouts
15import org.kde.kirigami 2.7 as Kirigami
16
17import org.kde.newstuff 1.62 as NewStuff
18
19Kirigami.ScrollablePage {
20 id: component
21 property string entryName
22 property string entryAuthorId
23 property string entryProviderId
24 property alias entry: commentsModel.entry
25 property alias itemsModel: commentsModel.itemsModel
26 title: i18ndc("knewstuff6", "Title for the page containing a view of the comments for the entry", "Comments and Reviews for %1", component.entryName)
27 actions: [
28 Kirigami.Action {
29 text: i18ndc("knewstuff6", "Title for the item which is checked when all comments should be shown", "Show All Comments")
30 checked: commentsModel.includedComments == NewStuff.CommentsModel.IncludeAllComments
31 checkable: true
32 onTriggered: commentsModel.includedComments = NewStuff.CommentsModel.IncludeAllComments
33 },
34 Kirigami.Action {
35 text: i18ndc("knewstuff6", "Title for the item which is checked when only comments which are reviews should be shown", "Show Reviews Only")
36 checked: commentsModel.includedComments == NewStuff.CommentsModel.IncludeOnlyReviews
37 checkable: true
38 onTriggered: commentsModel.includedComments = NewStuff.CommentsModel.IncludeOnlyReviews
39 },
40 Kirigami.Action {
41 text: i18ndc("knewstuff6", "Title for the item which is checked when comments which are reviews, and their children should be shown", "Show Reviews and Replies")
42 checked: commentsModel.includedComments == NewStuff.CommentsModel.IncludeReviewsAndReplies
43 checkable: true
44 onTriggered: commentsModel.includedComments = NewStuff.CommentsModel.IncludeReviewsAndReplies
45 }
46 ]
47 ErrorDisplayer { engine: component.itemsModel.engine; active: component.isCurrentPage; }
48 ListView {
49 id: commentsView
50 model: NewStuff.CommentsModel {
52 }
53 QtLayouts.Layout.fillWidth: true
54 header: Item {
55 anchors {
56 left: parent.left
57 right: parent.right
58 }
59 height: Kirigami.Units.largeSpacing
60 }
61 delegate: EntryCommentDelegate {
62 engine: component.itemsModel.engine
63 entryAuthorId: component.entryAuthorId
64 entryProviderId: component.entryProviderId
65 author: model.username
66 score: model.score
67 title: model.subject
68 reviewText: model.text
69 depth: model.depth
70 }
71 }
72}
A card based delegate for showing a comment from a KNewStuffQuick::QuickCommentsModel.
QtObject engine
The KNSQuick Engine object which handles all our content.
QString i18ndc(const char *domain, const char *context, const char *text, const TYPE &arg...)
QTextStream & left(QTextStream &stream)
QTextStream & right(QTextStream &stream)
QTextStream & left(QTextStream &s)
QTextStream & right(QTextStream &s)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sun Feb 25 2024 18:48:13 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.