Warning, /graphics/okular/mobile/app/package/contents/ui/main.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 QtCore 0008 import QtQuick 2.15 0009 import QtQuick.Controls 2.15 as QQC2 0010 import QtQuick.Dialogs as QQD 0011 import org.kde.okular 2.0 as Okular 0012 import org.kde.kirigami 2.17 as Kirigami 0013 import org.kde.kirigamiaddons.formcard 1.0 as FormCard 0014 import org.kde.okular.app 2.0 0015 0016 Kirigami.ApplicationWindow { 0017 id: fileBrowserRoot 0018 0019 readonly property int columnWidth: Kirigami.Units.gridUnit * 13 0020 0021 wideScreen: width > columnWidth * 5 0022 visible: true 0023 0024 globalDrawer: Kirigami.GlobalDrawer { 0025 title: i18n("Okular") 0026 titleIcon: "okular" 0027 drawerOpen: false 0028 isMenu: true 0029 0030 QQD.FileDialog { 0031 id: fileDialog 0032 nameFilters: Okular.Okular.nameFilters 0033 currentFolder: StandardPaths.standardLocations(StandardPaths.DocumentsLocation)[0] 0034 onAccepted: { 0035 documentItem.url = fileDialog.selectedFile 0036 } 0037 } 0038 0039 actions: [ 0040 Kirigami.Action { 0041 id: openDocumentAction 0042 text: i18n("Open...") 0043 icon.name: "document-open" 0044 onTriggered: { 0045 fileDialog.open() 0046 } 0047 }, 0048 Kirigami.Action { 0049 text: i18n("About") 0050 icon.name: "help-about-symbolic" 0051 onTriggered: fileBrowserRoot.pageStack.layers.push(aboutPage); 0052 enabled: fileBrowserRoot.pageStack.layers.depth === 1 0053 } 0054 ] 0055 } 0056 contextDrawer: OkularDrawer { 0057 width: columnWidth 0058 contentItem.implicitWidth: columnWidth 0059 modal: !fileBrowserRoot.wideScreen 0060 onModalChanged: drawerOpen = !modal 0061 onEnabledChanged: drawerOpen = enabled && !modal 0062 enabled: documentItem.opened && pageStack.layers.depth < 2 0063 handleVisible: enabled && pageStack.layers.depth < 2 0064 } 0065 0066 title: documentItem.windowTitleForDocument ? documentItem.windowTitleForDocument : i18n("Okular") 0067 Okular.DocumentItem { 0068 id: documentItem 0069 onUrlChanged: { currentPage = 0 } 0070 0071 onNeedsPasswordChanged: { 0072 if (needsPassword) { 0073 passwordDialog.open(); 0074 } 0075 } 0076 } 0077 0078 pageStack.initialPage: MainView { 0079 id: pageArea 0080 document: documentItem 0081 Kirigami.ColumnView.preventStealing: true 0082 } 0083 0084 Component { 0085 id: aboutPage 0086 FormCard.AboutPage { 0087 aboutData: about 0088 } 0089 } 0090 0091 //FIXME: this is due to global vars being binded after the parse is done, do the 2 steps parsing 0092 Timer { 0093 interval: 100 0094 running: true 0095 onTriggered: { 0096 if (uri) { 0097 documentItem.url = uri 0098 } 0099 } 0100 } 0101 0102 QQC2.Dialog { 0103 id: passwordDialog 0104 focus: true 0105 anchors.centerIn: parent 0106 title: i18n("Password Needed") 0107 contentItem: Kirigami.PasswordField { 0108 id: pwdField 0109 onAccepted: passwordDialog.accept(); 0110 focus: true 0111 } 0112 standardButtons: QQC2.Dialog.Ok | QQC2.Dialog.Cancel 0113 0114 onAccepted: documentItem.setPassword(pwdField.text); 0115 onRejected: documentItem.url = ""; 0116 } 0117 }