Warning, /graphics/okular/mobile/app/package/contents/ui/OkularDrawer.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.Controls 2.15 as QQC2
0009 import org.kde.kirigami 2.17 as Kirigami
0010 import org.kde.okular 2.0 as Okular
0011 import QtQuick.Layouts 1.15
0012 
0013 
0014 Kirigami.OverlayDrawer {
0015     id: root
0016 
0017     bottomPadding: 0
0018     topPadding: 0
0019     leftPadding: 0
0020     rightPadding: 0
0021 
0022     edge: Qt.application.layoutDirection == Qt.RightToLeft ? Qt.LeftEdge : Qt.RightEdge
0023     contentItem: ColumnLayout {
0024         id: browserFrame
0025         spacing: 0
0026 
0027         QQC2.StackView {
0028             id: pageStack
0029             Layout.fillWidth: true
0030             Layout.fillHeight: true
0031             clip: true
0032         }
0033 
0034         Connections {
0035             target: documentItem
0036             function onUrlChanged() {
0037                 thumbnailsButton.checked = true;
0038             }
0039         }
0040 
0041         QQC2.ToolBar {
0042             id: tabsToolbar
0043             position: QQC2.ToolBar.Footer
0044             Layout.fillWidth: true
0045             Component.onCompleted: thumbnailsButton.checked = true;
0046             Item {
0047                 width: parent.width
0048                 height: childrenRect.height
0049                 Row {
0050                     id: mainTabBar
0051                     spacing: 0
0052                     anchors.horizontalCenter: parent.horizontalCenter
0053                     width: Math.min(parent.width, implicitWidth)
0054                     QQC2.ButtonGroup { id: tabPositionGroup }
0055                     QQC2.ToolButton {
0056                         id: thumbnailsButton
0057                         text: tabsToolbar.width > Kirigami.Units.gridUnit * 30 ? i18n("Thumbnails") : ""
0058                         icon.name: "view-preview"
0059                         checkable: true
0060                         flat: false
0061                         onCheckedChanged: {
0062                             if (checked) {
0063                                 pageStack.replace(Qt.createComponent("Thumbnails.qml"))
0064                             }
0065                         }
0066                         QQC2.ButtonGroup.group: tabPositionGroup
0067                     }
0068                     QQC2.ToolButton {
0069                         id: tocButton
0070                         enabled: documentItem.tableOfContents.count > 0
0071                         text: tabsToolbar.width > Kirigami.Units.gridUnit * 30 ? i18n("Table of contents") : ""
0072                         icon.name: "view-table-of-contents-ltr"
0073                         checkable: true
0074                         flat: false
0075                         onCheckedChanged: {
0076                             if (checked) {
0077                                 pageStack.replace(Qt.createComponent("TableOfContents.qml"))
0078                             }
0079                         }
0080                         QQC2.ButtonGroup.group: tabPositionGroup
0081                     }
0082                     QQC2.ToolButton {
0083                         id: bookmarksButton
0084                         enabled: documentItem.bookmarkedPages.length > 0
0085                         text: tabsToolbar.width > Kirigami.Units.gridUnit * 30 ? i18n("Bookmarks") : ""
0086                         icon.name: "bookmarks-organize"
0087                         checkable: true
0088                         flat: false
0089                         onCheckedChanged: {
0090                             if (checked) {
0091                                 pageStack.replace(Qt.createComponent("Bookmarks.qml"))
0092                             }
0093                         }
0094                         QQC2.ButtonGroup.group: tabPositionGroup
0095                     }
0096                     QQC2.ToolButton {
0097                         id: signatyresButton
0098                         enabled: documentItem.signaturesModel.count > 0
0099                         text: tabsToolbar.width > Kirigami.Units.gridUnit * 30 ? i18n("Signatures") : ""
0100                         icon.name: "application-pkcs7-signature"
0101                         checkable: true
0102                         flat: false
0103                         onCheckedChanged: {
0104                             if (checked) {
0105                                 pageStack.replace(signaturesComponent)
0106                             }
0107                         }
0108                         QQC2.ButtonGroup.group: tabPositionGroup
0109                     }
0110                 }
0111             }
0112         }
0113     }
0114 
0115     Component {
0116         id: signaturesComponent
0117         Signatures {
0118             onDialogOpened: {
0119                 // We don't want to have two modal things open at the same time
0120                 if (root.modal) {
0121                     root.close();
0122                 }
0123             }
0124         }
0125     }
0126 }