This is only really needed in specific cases, e.g. localUser which isn't attached to a connection and thus needs a little help. Notes for when this is needed is added for future readers.
51 lines
1.2 KiB
QML
51 lines
1.2 KiB
QML
// SPDX-FileCopyrightText: 2023 Tobias Fella <tobias.fella@kde.org>
|
|
// SPDX-License-Identifier: LGPL-2.0-or-later
|
|
|
|
import QtQuick
|
|
|
|
import org.kde.kirigamiaddons.labs.components as Components
|
|
import org.kde.kirigami as Kirigami
|
|
import org.kde.prison
|
|
|
|
Components.AbstractMaximizeComponent {
|
|
id: root
|
|
|
|
required property string text
|
|
property color avatarColor
|
|
required property url avatarSource
|
|
|
|
onOpened: forceActiveFocus()
|
|
|
|
Shortcut {
|
|
sequences: [StandardKey.Cancel]
|
|
onActivated: root.close()
|
|
}
|
|
|
|
leading: Components.Avatar {
|
|
id: userAvatar
|
|
implicitWidth: Kirigami.Units.iconSizes.medium
|
|
implicitHeight: Kirigami.Units.iconSizes.medium
|
|
|
|
name: root.title
|
|
source: root.avatarSource
|
|
color: root.avatarColor
|
|
}
|
|
|
|
content: Item {
|
|
Keys.onEscapePressed: root.close()
|
|
Barcode {
|
|
barcodeType: Barcode.QRCode
|
|
content: root.text
|
|
height: Math.min(parent.height, Kirigami.Units.gridUnit * 20)
|
|
width: height
|
|
anchors.centerIn: parent
|
|
}
|
|
MouseArea {
|
|
id: closeArea
|
|
anchors.fill: parent
|
|
acceptedButtons: Qt.LeftButton
|
|
onClicked: root.close()
|
|
}
|
|
}
|
|
}
|