Warning, /graphics/okular/mobile/app/package/contents/ui/MainView.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.okular 2.0 as Okular
0010 import org.kde.kirigami 2.17 as Kirigami
0011 
0012 Kirigami.Page {
0013     id: root
0014 
0015     property alias document: pageArea.document
0016     leftPadding: 0
0017     topPadding: 0
0018     rightPadding: 0
0019     bottomPadding: 0
0020 
0021     actions: Kirigami.Action {
0022         icon.name: pageArea.page.bookmarked ? "bookmark-remove" : "bookmarks-organize"
0023         checkable: true
0024         onCheckedChanged: pageArea.page.bookmarked = checked
0025         text: pageArea.page.bookmarked ? i18n("Remove bookmark") : i18n("Bookmark this page")
0026     }
0027 
0028     Okular.DocumentView {
0029         id: pageArea
0030         anchors.fill: parent
0031 
0032         onPageChanged: {
0033             bookmarkConnection.target = page
0034             actions.main.checked = page.bookmarked
0035         }
0036         onClicked: fileBrowserRoot.controlsVisible = !fileBrowserRoot.controlsVisible
0037     }
0038 
0039     Connections {
0040         target: root.document
0041 
0042         function onError(text, duration) {
0043             inlineMessage.showMessage(Kirigami.MessageType.Error, text,  duration);
0044         }
0045 
0046         function onWarning(text, duration) {
0047             inlineMessage.showMessage(Kirigami.MessageType.Warning, text,  duration);
0048         }
0049 
0050         function onNotice(text, duration) {
0051             inlineMessage.showMessage(Kirigami.MessageType.Information, text,  duration);
0052         }
0053     }
0054 
0055     Kirigami.InlineMessage {
0056         id: inlineMessage
0057         width: parent.width
0058 
0059         function showMessage(type, text, duration) {
0060             inlineMessage.type = type;
0061             inlineMessage.text = text;
0062             inlineMessage.visible = true;
0063             inlineMessageTimer.interval = duration > 0 ? duration : 500 + 100 * text.length;
0064         }
0065 
0066         onVisibleChanged: {
0067             if (visible) {
0068                 inlineMessageTimer.start()
0069             } else {
0070                 inlineMessageTimer.stop()
0071             }
0072         }
0073 
0074         Timer {
0075             id: inlineMessageTimer
0076             onTriggered: inlineMessage.visible = false
0077         }
0078     }
0079 
0080     Kirigami.PlaceholderMessage {
0081         visible: !document.opened
0082         text: i18n("No document open")
0083         helpfulAction: openDocumentAction
0084         width: parent.width - (Kirigami.Units.largeSpacing * 4)
0085         anchors.centerIn: parent
0086     }
0087 
0088     Connections {
0089         id: bookmarkConnection
0090         target: pageArea.page
0091         function onBookmarkedChanged() {
0092             actions.main.checked = pageArea.page.bookmarked
0093         }
0094     }
0095     QQC2.ProgressBar {
0096         id: bar
0097         z: 99
0098         visible: applicationWindow().controlsVisible
0099         height: Kirigami.Units.smallSpacing
0100         anchors {
0101             left: parent.left
0102             right: parent.right
0103             bottom: parent.bottom
0104         }
0105         value: documentItem.pageCount !== 0 ? ((documentItem.currentPage+1) / documentItem.pageCount) : 0
0106     }
0107 }