diff options
Diffstat (limited to 'examples/pdf/pdfviewer/viewer.qml')
-rw-r--r-- | examples/pdf/pdfviewer/viewer.qml | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/examples/pdf/pdfviewer/viewer.qml b/examples/pdf/pdfviewer/viewer.qml index c174a79ed..0454d533f 100644 --- a/examples/pdf/pdfviewer/viewer.qml +++ b/examples/pdf/pdfviewer/viewer.qml @@ -193,15 +193,35 @@ ApplicationWindow { } Dialog { + id: passwordDialog + title: "Password" + standardButtons: Dialog.Ok | Dialog.Cancel + modal: true + closePolicy: Popup.CloseOnEscape + anchors.centerIn: parent + width: 300 + + contentItem: TextField { + id: passwordField + placeholderText: qsTr("Please provide the password") + echoMode: TextInput.Password + width: parent.width + onAccepted: passwordDialog.accept() + } + onOpened: function() { passwordField.forceActiveFocus() } + onAccepted: document.password = passwordField.text + } + + Dialog { id: errorDialog title: "Error loading " + document.source - standardButtons: Dialog.Ok + standardButtons: Dialog.Close modal: true closePolicy: Popup.CloseOnEscape anchors.centerIn: parent width: 300 - Label { + contentItem: Label { id: errorField text: document.error } @@ -215,6 +235,7 @@ ApplicationWindow { id: document source: Qt.resolvedUrl(root.source) onStatusChanged: if (status === PdfDocument.Error) errorDialog.open() + onPasswordRequired: passwordDialog.open() } searchString: searchField.text } |