Port to declarative type registration

This commit is contained in:
Tobias Fella
2023-09-23 14:05:50 +00:00
parent 4ed4f3f628
commit 3a4f71de7f
202 changed files with 604 additions and 532 deletions

84
src/qml/DevicesPage.qml Normal file
View File

@@ -0,0 +1,84 @@
// SPDX-FileCopyrightText: 2020 - 2023 Tobias Fella <tobias.fella@kde.org>
// SPDX-FileCopyrightText: 2022 James Graham <james.h.graham@protonmail.com>
// SPDX-License-Identifier: GPL-2.0-or-later
import QtQuick
import QtQuick.Controls as QQC2
import QtQuick.Layouts
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard
import org.kde.neochat
FormCard.FormCardPage {
id: root
title: i18n("Devices")
required property NeoChatConnection connection
property DevicesModel devicesModel: DevicesModel {
id: devicesModel
connection: root.connection
}
DevicesCard {
title: i18n("This Device")
type: DevicesModel.This
showVerifyButton: false
}
DevicesCard {
title: i18n("Verified Devices")
type: DevicesModel.Verified
showVerifyButton: true
}
DevicesCard {
title: i18n("Unverified Devices")
type: DevicesModel.Unverified
showVerifyButton: true
}
DevicesCard {
title: i18n("Devices without Encryption Support")
type: DevicesModel.Unencrypted
showVerifyButton: false
}
FormCard.AbstractFormDelegate {
Layout.fillWidth: true
visible: root.connection && devicesModel.count === 0 // We can assume 0 means loading since there is at least one device
contentItem: Kirigami.LoadingPlaceholder { }
}
Kirigami.InlineMessage {
Layout.fillWidth: true
Layout.maximumWidth: Kirigami.Units.gridUnit * 30
Layout.alignment: Qt.AlignHCenter
text: i18n("Please login to view the signed-in devices for your account.")
type: Kirigami.MessageType.Information
visible: !root.connection
}
property Kirigami.OverlaySheet passwordSheet: Kirigami.OverlaySheet {
id: passwordSheet
property string deviceId
title: i18n("Remove device")
Kirigami.FormLayout {
QQC2.TextField {
id: passwordField
Kirigami.FormData.label: i18n("Password:")
echoMode: TextInput.Password
}
QQC2.Button {
text: i18n("Confirm")
onClicked: {
devicesModel.logout(passwordSheet.deviceId, passwordField.text)
passwordField.text = ""
passwordSheet.close()
}
}
}
}
}