KNewStuff

EntryCommentsPage.qml
1 /*
2  * Copyright (C) 2019 Dan Leinir Turthra Jensen <[email protected]>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) version 3, or any
8  * later version accepted by the membership of KDE e.V. (or its
9  * successor approved by the membership of KDE e.V.), which shall
10  * act as a proxy defined in Section 6 of version 3 of the license.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
26 import QtQuick 2.11
27 import QtQuick.Controls 2.11 as QtControls
28 import QtQuick.Layouts 1.11 as QtLayouts
29 
30 import org.kde.kirigami 2.7 as Kirigami
31 
32 import org.kde.newstuff 1.62 as NewStuff
33 
34 Kirigami.ScrollablePage {
35  id: component
36  property string entryName
37  property string entryAuthorId
38  property string entryProviderId
39  property alias entryIndex: commentsModel.entryIndex
40  property alias itemsModel: commentsModel.itemsModel
41  title: i18ndc("knewstuff5", "Title for the page containing a view of the comments for the entry", "Comments and Reviews for %1", component.entryName)
42  actions {
43  contextualActions: [
44  Kirigami.Action {
45  text: i18ndc("knewstuff5", "Title for the item which is checked when all comments should be shown", "Show All Comments")
46  checked: commentsModel.includedComments == NewStuff.CommentsModel.IncludeAllComments
47  checkable: true
48  onTriggered: commentsModel.includedComments = NewStuff.CommentsModel.IncludeAllComments
49  },
50  Kirigami.Action {
51  text: i18ndc("knewstuff5", "Title for the item which is checked when only comments which are reviews should be shown", "Show Reviews Only")
52  checked: commentsModel.includedComments == NewStuff.CommentsModel.IncludeOnlyReviews
53  checkable: true
54  onTriggered: commentsModel.includedComments = NewStuff.CommentsModel.IncludeOnlyReviews
55  },
56  Kirigami.Action {
57  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")
58  checked: commentsModel.includedComments == NewStuff.CommentsModel.IncludeReviewsAndReplies
59  checkable: true
60  onTriggered: commentsModel.includedComments = NewStuff.CommentsModel.IncludeReviewsAndReplies
61  }
62  ]
63  }
64  ErrorDisplayer { engine: component.itemsModel.engine; active: component.isCurrentPage; }
65  ListView {
66  id: commentsView
67  model: NewStuff.CommentsModel {
68  id: commentsModel
69  }
70  QtLayouts.Layout.fillWidth: true
71  header: Item {
72  anchors {
73  left: parent.left
74  right: parent.right
75  }
76  height: Kirigami.Units.largeSpacing
77  }
78  delegate: EntryCommentDelegate {
79  engine: component.itemsModel.engine
80  entryAuthorId: component.entryAuthorId
81  entryProviderId: component.entryProviderId
82  author: model.username
83  score: model.score
84  title: model.subject
85  reviewText: model.text
86  depth: model.depth
87  }
88  }
89 }
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-2020 The KDE developers.
Generated on Sun Aug 9 2020 22:43:40 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.