Warning, /multimedia/kasts/src/qml/SyncPasswordOverlay.qml is written in an unsupported language. File is not indexed.

0001 /**
0002  * SPDX-FileCopyrightText: 2021 Bart De Vries <bart@mogwai.be>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 import QtQuick
0008 import QtQuick.Controls as Controls
0009 import QtQuick.Layouts
0010 
0011 import org.kde.kirigami as Kirigami
0012 
0013 import org.kde.kasts
0014 import org.kde.kasts.settings
0015 
0016 Kirigami.Dialog {
0017     id: syncPasswordOverlay
0018     padding: Kirigami.Units.largeSpacing
0019     preferredWidth: Kirigami.Units.gridUnit * 20
0020     parent: applicationWindow().overlay
0021 
0022     showCloseButton: true
0023     standardButtons: Controls.DialogButtonBox.Ok | Controls.DialogButtonBox.Cancel
0024 
0025     title: i18n("Sync Password Required")
0026 
0027     onAccepted: {
0028         Sync.password = passwordField2.text;
0029         syncPasswordOverlay.close();
0030     }
0031     onRejected: syncPasswordOverlay.close();
0032 
0033     Column {
0034         spacing: Kirigami.Units.largeSpacing
0035         RowLayout {
0036             width: parent.width
0037             spacing: Kirigami.Units.largeSpacing
0038             Kirigami.Icon {
0039                 Layout.preferredHeight: Kirigami.Units.gridUnit * 4
0040                 Layout.preferredWidth: Kirigami.Units.gridUnit * 4
0041                 source: Sync.provider === Sync.GPodderNextcloud ? "kaccounts-nextcloud" : "gpodder"
0042             }
0043             TextEdit {
0044                 id: passwordField
0045                 Layout.fillWidth: true
0046                 readOnly: true
0047                 wrapMode: Text.WordWrap
0048                 text: Sync.provider === Sync.GPodderNextcloud ?
0049                         i18n("The password for user \"%1\" on Nextcloud server \"%2\" could not be retrieved.", SettingsManager.syncUsername, SettingsManager.syncHostname) :
0050                         i18n("The password for user \"%1\" on \"gpodder.net\" could not be retrieved.", SettingsManager.syncUsername)
0051                 color: Kirigami.Theme.textColor
0052             }
0053         }
0054         RowLayout {
0055             width: parent.width
0056             Controls.Label {
0057                 text: i18n("Password:")
0058             }
0059             Controls.TextField {
0060                 id: passwordField2
0061                 Layout.fillWidth: true
0062                 Keys.onReturnPressed: syncPasswordOverlay.accepted();
0063                 focus: syncPasswordOverlay.visible
0064                 echoMode: TextInput.Password
0065                 text: Sync.password
0066             }
0067         }
0068     }
0069 }