Warning, /frameworks/knewstuff/src/qtquick/qml/private/EntryCommentsPage.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2019 Dan Leinir Turthra Jensen <admin@leinir.dk>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 /**
0008  * @brief A Kirigami.Page component used for displaying a NewStuff entry's comments
0009  */
0010 
0011 import QtQuick 2.11
0012 import QtQuick.Controls 2.11 as QtControls
0013 import QtQuick.Layouts 1.11 as QtLayouts
0014 
0015 import org.kde.kirigami 2.7 as Kirigami
0016 
0017 import org.kde.newstuff 1.62 as NewStuff
0018 
0019 Kirigami.ScrollablePage {
0020     id: component
0021     property string entryName
0022     property string entryAuthorId
0023     property string entryProviderId
0024     property alias entryIndex: commentsModel.entryIndex
0025     property alias itemsModel: commentsModel.itemsModel
0026     title: i18ndc("knewstuff5", "Title for the page containing a view of the comments for the entry", "Comments and Reviews for %1", component.entryName)
0027     actions {
0028         contextualActions: [
0029             Kirigami.Action {
0030                 text: i18ndc("knewstuff5", "Title for the item which is checked when all comments should be shown", "Show All Comments")
0031                 checked: commentsModel.includedComments == NewStuff.CommentsModel.IncludeAllComments
0032                 checkable: true
0033                 onTriggered: commentsModel.includedComments = NewStuff.CommentsModel.IncludeAllComments
0034             },
0035             Kirigami.Action {
0036                 text: i18ndc("knewstuff5", "Title for the item which is checked when only comments which are reviews should be shown", "Show Reviews Only")
0037                 checked: commentsModel.includedComments == NewStuff.CommentsModel.IncludeOnlyReviews
0038                 checkable: true
0039                 onTriggered: commentsModel.includedComments = NewStuff.CommentsModel.IncludeOnlyReviews
0040             },
0041             Kirigami.Action {
0042                 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")
0043                 checked: commentsModel.includedComments == NewStuff.CommentsModel.IncludeReviewsAndReplies
0044                 checkable: true
0045                 onTriggered: commentsModel.includedComments = NewStuff.CommentsModel.IncludeReviewsAndReplies
0046             }
0047         ]
0048     }
0049     ErrorDisplayer { engine: component.itemsModel.engine; active: component.isCurrentPage; }
0050     ListView {
0051         id: commentsView
0052         model: NewStuff.CommentsModel {
0053             id: commentsModel
0054         }
0055         QtLayouts.Layout.fillWidth: true
0056         header: Item {
0057             anchors {
0058                 left: parent.left
0059                 right: parent.right
0060             }
0061             height: Kirigami.Units.largeSpacing
0062         }
0063         delegate: EntryCommentDelegate {
0064             engine: component.itemsModel.engine
0065             entryAuthorId: component.entryAuthorId
0066             entryProviderId: component.entryProviderId
0067             author: model.username
0068             score: model.score
0069             title: model.subject
0070             reviewText: model.text
0071             depth: model.depth
0072         }
0073     }
0074 }