Port accounts page to formcard

This commit is contained in:
Tobias Fella
2023-09-01 17:15:13 +02:00
parent ede2707767
commit be71a4349b

View File

@@ -8,33 +8,24 @@ import QtQuick.Window 2.15
import Qt.labs.platform 1.1 import Qt.labs.platform 1.1
import org.kde.kirigami 2.19 as Kirigami import org.kde.kirigami 2.19 as Kirigami
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import org.kde.kirigamiaddons.labs.components 1.0 as KirigamiComponents import org.kde.kirigamiaddons.labs.components 1.0 as KirigamiComponents
import org.kde.neochat 1.0 import org.kde.neochat 1.0
import 'Dialog' as Dialog import 'Dialog' as Dialog
Kirigami.ScrollablePage { FormCard.FormCardPage {
id: page id: root
title: i18n("Accounts") title: i18n("Accounts")
topPadding: 0
leftPadding: 0
rightPadding: 0
ColumnLayout { FormCard.FormHeader {
spacing: 0
MobileForm.FormHeader {
Layout.fillWidth: true
title: i18n("Accounts") title: i18n("Accounts")
} }
MobileForm.FormCard { FormCard.FormCard {
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
Repeater { Repeater {
model: AccountRegistry model: AccountRegistry
delegate: MobileForm.AbstractFormDelegate { delegate: FormCard.AbstractFormDelegate {
id: accountDelegate id: accountDelegate
required property NeoChatConnection connection required property NeoChatConnection connection
Layout.fillWidth: true Layout.fillWidth: true
@@ -89,32 +80,30 @@ Kirigami.ScrollablePage {
connection: model.connection connection: model.connection
onAccepted: { onAccepted: {
if (Controller.accountCount === 1) { if (Controller.accountCount === 1) {
page.Window.window.close() root.Window.window.close()
} }
} }
} }
} }
MobileForm.FormArrow { FormCard.FormArrow {
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
direction: MobileForm.FormArrow.Right direction: FormCard.FormArrow.Right
} }
} }
} }
} }
MobileForm.FormDelegateSeparator { below: addAccountDelegate } FormCard.FormDelegateSeparator { below: addAccountDelegate }
MobileForm.FormButtonDelegate { FormCard.FormButtonDelegate {
id: addAccountDelegate id: addAccountDelegate
text: i18n("Add Account") text: i18n("Add Account")
icon.name: "list-add" icon.name: "list-add"
onClicked: pageStack.layers.push("qrc:/WelcomePage.qml") onClicked: pageStack.layers.push("qrc:/WelcomePage.qml")
} }
} }
}
}
Connections { property Connections connections: Connections {
target: Controller target: Controller
function onConnectionAdded() { function onConnectionAdded() {
if (pageStack.layers.depth > 2) { if (pageStack.layers.depth > 2) {