Warning, /graphics/okular/mobile/app/package/contents/ui/ThumbnailsBase.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2012 Marco Martin <mart@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 import QtQuick 2.15
0008 import QtQuick.Layouts 1.15
0009 import QtQuick.Controls 2.15 as QQC2
0010 import Qt5Compat.GraphicalEffects
0011 import org.kde.okular 2.0 as Okular
0012 import org.kde.kirigami 2.17 as Kirigami
0013 
0014 ColumnLayout {
0015     id: root
0016     property alias model: resultsGrid.model
0017     property Item view: resultsGrid
0018     signal pageClicked(int pageNumber)
0019 
0020     property alias header: control.contentItem
0021 
0022     QQC2.Control {
0023         id: control
0024         Layout.fillWidth: true
0025         leftPadding: 0
0026         topPadding: 0
0027         bottomPadding: 0
0028         rightPadding: 0
0029     }
0030 
0031     QQC2.ScrollView {
0032         Layout.fillWidth: true
0033         Layout.fillHeight: true
0034         QQC2.ScrollBar.horizontal.policy: QQC2.ScrollBar.AlwaysOff
0035         Kirigami.CardsListView {
0036             id: resultsGrid
0037             clip: true
0038 
0039             Kirigami.PlaceholderMessage {
0040                 anchors.centerIn: parent
0041                 visible: model.length == 0
0042                 width: parent.width - Kirigami.largeSpacing * 4
0043                 text: i18n("No results found.")
0044             }
0045 
0046             delegate: Kirigami.AbstractCard {
0047                 implicitWidth: root.width
0048                 showClickFeedback: true
0049                 readonly property real ratio: contentItem.implicitHeight/contentItem.implicitWidth
0050                 implicitHeight: width * ratio
0051                 contentItem: Okular.ThumbnailItem {
0052                     document: documentItem
0053                     pageNumber: modelData
0054                     Rectangle {
0055                         width: childrenRect.width
0056                         height: childrenRect.height
0057                         color: Kirigami.Theme.backgroundColor
0058                         radius: width
0059                         smooth: true
0060                         anchors {
0061                             top: parent.top
0062                             right: parent.right
0063                         }
0064                         QQC2.Label {
0065                             text: modelData + 1
0066                         }
0067                     }
0068                 }
0069                 onClicked: {
0070                     resultsGrid.currentIndex = index
0071                     documentItem.currentPage = modelData
0072 
0073                     contextDrawer.drawerOpen = false
0074                     root.pageClicked(modelData)
0075                 }
0076             }
0077         }
0078     }
0079 }