KNewStuff

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