// SPDX-FileCopyrightText: 2026 Matvey Shcherbinin // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL import QtQuick import QtQuick.Controls as QQC2 import QtQuick.Layouts import org.kde.kirigami as Kirigami import org.kde.kirigamiaddons.formcard as FormCard import koutnet.app // The Matrix half of the protocols tab: the account, the homeserver it talks to, // and the port on it. // // A file of its own rather than a block of the settings page because that tab is // a row of transports and each one is a file: the file of a transport that has // not been built is three lines of placeholder, and one file of a thousand is a // file nobody can find anything in. Written to the same shape as the LAN half // for the same reason. // // An Item rather than a Page for the reason the profile tab gives: the settings // page above draws the background and holds the padding. Item { id: root // handed in so the cards line up with the rest of the settings. property real formWidth: Kirigami.Units.gridUnit * 30 // The account sheet lives in the window above this page, so asking for it is // a question rather than a call. signal matrixAccountRequested() QQC2.ScrollView { id: matrixScroll anchors.fill: parent contentWidth: availableWidth ColumnLayout { // the form column and nothing else, for the reason the profile tab gives width: Math.min(matrixScroll.availableWidth, root.formWidth + Kirigami.Units.gridUnit * 2) spacing: 0 ThemedFormCard { maximumWidth: root.formWidth FormCard.FormButtonDelegate { id: matrixButton icon.name: "network-server" text: i18nc("@action:button", "Matrix account...") description: matrixManager.statusText onClicked: root.matrixAccountRequested() } } ThemedFormHeader { maximumWidth: root.formWidth title: i18nc("@title:group the Matrix homeserver to talk to", "Homeserver") } ThemedFormCard { maximumWidth: root.formWidth // Empty means a homeserver on this machine, which is what self-hosting is. FormCard.FormTextFieldDelegate { id: matrixHostField label: i18nc("@label:textbox", "Homeserver address") description: i18nc("@info:whatsthis", "Leave empty for a server running on this machine. Takes effect the next time the account signs in.") text: appSettings.kServerHost onEditingFinished: appSettings.kServerHost = text } FormCard.FormDelegateSeparator { above: matrixHostField; below: matrixPortField } FormCard.FormSpinBoxDelegate { id: matrixPortField label: i18nc("@label:spinbox", "Homeserver port") from: 0 to: 65535 value: appSettings.kServerPort onValueChanged: appSettings.kServerPort = matrixPortField.value } } } } }